atg.commerce.catalog.comparison
Class ProductComparisonList

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.catalog.comparison.ComparisonList
              extended by atg.commerce.catalog.comparison.ProductComparisonList
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class ProductComparisonList
extends ComparisonList

ProductComparisonList extends ComparisonList and manages list elements Entry that are specifically designed for comparing catalog-based category/product/sku tuples rather than simple Java objects.

This class includes convenience methods that take product, category, and sku id's and retrieve the corresponding objects from the product catalog, making it easier to write form handlers and droplet that manipulate the list contents. It also endows each list element with an unambiguous unique id and allows callers to remove elements by specifying their ids, which eases the task of writing form handlers that display a sorted list of product entries with "remove" buttons or checkboxes associated with Entry.

Example:

The following JHTML fragment displays the names, category names, and inventory availability of all of the items in a product comparison list:


 <droplet bean="ForEach">
  <param name="array" value="bean:ComparisonList.items">
  <param name="sortProperties" value="bean:ComparisonList.sortString">
  <oparam name="output">
    Product: <valueof param="element.product.displayName">unknown</valueof><br>
    Category: <valueof param="element.category.displayName">none</valueof><br>
    Inventory: <valueof param="element.inventoryInfo.availabilityStatusMsg">unknown</valueof><
  </oparam>
 </droplet>
 


Nested Class Summary
static class ProductComparisonList.Entry
          Entry is specifically designed for comparing catalog-based category/product/sku tuples rather than simple Java objects.
 
Field Summary
static java.lang.String CATEGORY_KEY
           
static java.lang.String CATEGORY_LINK_KEY
           
static java.lang.String CATEGORY_PROPERTY
           
static java.lang.String CLASS_VERSION
           
static java.lang.String ID_KEY
           
static java.lang.String INVENTORY_KEY
           
protected  CatalogTools mCatalogTools
           
protected  SiteURLManager mSiteURLManager
           
static java.lang.String MY_RESOURCE_NAME
           
static java.lang.String PRICE_INFO_KEY
           
static java.lang.String PRODUCT_KEY
           
static java.lang.String PRODUCT_LINK_KEY
           
static java.lang.String SITE_ID
           
static java.lang.String SKU_KEY
           
static java.lang.String SKULIST_PROPERTY
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
ProductComparisonList()
           
 
Method Summary
 boolean add(java.lang.String pProductId, java.lang.String pCategoryId, java.lang.String pSkuId, java.lang.String pCatalogKey)
          Add a product to the product comparison list, optionally specifying an associated category and sku.
 boolean add(java.lang.String pProductId, java.lang.String pCategoryId, java.lang.String pSkuId, java.lang.String pCatalogKey, java.lang.String pSiteId)
          Add a product to the product comparison list, optionally specifying an associated category and sku.
 int addAllSkus(java.lang.String pProductId, java.lang.String pCategoryId, java.lang.String pCatalogKey)
          Add entries to the comparison list for every sku associated with a given product.
 int addAllSkus(java.lang.String pProductId, java.lang.String pCategoryId, java.lang.String pCatalogKey, java.lang.String pSiteId)
          Add entries to the comparison list for every sku associated with a given product.
protected  boolean arrayContains(int[] pIds, int pTarget)
          Return true if the specified array of ints contains the target value.
 boolean contains(java.lang.String pProductId)
          Return true if the product comparison list contains any Entry for the given product id, regardless of that Entry's category and sku.
 boolean contains(java.lang.String pProductId, java.lang.String pSiteId)
          Return true if the product comparison list contains any Entry for the given product id, regardless of that Entry's category and sku on chosen site.
 boolean contains(java.lang.String pProductId, java.lang.String pCategoryId, java.lang.String pCatalogKey)
          Return true if the product comparison list contains any Entry for the given product id and category id, regardless of that Entry's sku.
 boolean contains(java.lang.String pProductId, java.lang.String pCategoryId, java.lang.String pSkuId, java.lang.String pCatalogKey)
          Return true if the product comparison list contains an Entry for the given product id, category id, and sku id.
 boolean contains(java.lang.String pProductId, java.lang.String pCategoryId, java.lang.String pSkuId, java.lang.String pCatalogKey, java.lang.String pSiteId, boolean pMatchSku)
          Return true if the product comparison list contains an Entry for the given product id, category id, and sku id.
protected  ProductComparisonList.Entry createListEntry(RepositoryItem pCategory, RepositoryItem pProduct, RepositoryItem pSku)
          Create a product comparison list Entry for the given category, product, and sku.
protected  ProductComparisonList.Entry createListEntry(RepositoryItem pCategory, RepositoryItem pProduct, RepositoryItem pSku, java.lang.String pSiteId)
          Create a product comparison list Entry for the given category, product, and sku for given site.
protected  RepositoryItem defaultCategory(RepositoryItem pProduct)
          Get the default parent category for a given product.
protected  RepositoryItem defaultSku(RepositoryItem pProduct)
          Get the default sku for a given product.
protected  java.lang.String errorMsg(java.lang.String pResourceKey, java.lang.Object[] pArgs)
          Get a formatted error message string based on an error message resource key and an array of message arguments.
 CatalogTools getCatalogTools()
          Get the CatalogTools object to use when looking up products, categories and skus.
 java.lang.String getCategoryLinkFormat()
          Get the format of the HTML generated for a link to a category page.
protected  java.lang.String getDefaultCategoryId(RepositoryItem pProduct)
          Get the id of the parent category, the is obtained via defaultCategory
protected  java.lang.String getDefaultSkuId(RepositoryItem pProduct)
          Get the id of the default sku for given product.
 InventoryManager getInventoryManager()
          Get the InventoryManager object to use when fetching inventory availability information for items in the product comparison list.
 ProductComparisonList.Entry getItems(int pEntryId)
          Get a product comparison Entry given its uid.
 PricingTools getPricingTools()
          Get the PricingTools object to use when fetching the ItemPriceInfo for each item in the product comparison list.
 java.lang.String getProductLinkFormat()
          Get the format of the HTML generated for a link to a product page.
 SiteURLManager getSiteURLManager()
           
protected  ItemPriceInfo getUnitPrice(RepositoryItem pProduct, RepositoryItem pSku)
          Return an ItemPriceInfo object representing the unit price of the product and sku represented by pColumn; return null if the column has no sku information.
protected  boolean idMatch(java.lang.String pId, RepositoryItem pItem)
          Return true if pId is considered a match for pItem.
 boolean isEncodeLinkURLs()
          Query whether to encode URLs on links created using productLinkFormat and categoryLinkFormat.
 boolean isPreloadInventoryData()
          Query whether to load inventory data for each Entry in the product comparison list when that Entry is created, or to leave the inventory information empty until a call is made to refreshInventoryData.
protected  java.lang.String makeLink(java.lang.String pFormat, RepositoryItem pItem)
          Expand the format string for a product or category, substituting in the name, repository id, and template url.
protected  java.lang.String makeLink(java.lang.String pFormat, RepositoryItem pItem, boolean pEncode, java.lang.String pSiteId)
          Expand the format string for a product or category, substituting in the name, repository id, and template url.
protected  java.lang.String makeLink(java.lang.String pFormat, RepositoryItem pItem, java.lang.String pSiteId)
          Expand the format string for a product or category, substituting in the name, repository id, and template url.
 void refreshInventoryData()
          Update the inventory information associated with each product in the product comparison list to obtain the latest inventory levels and status.
 void remove(java.util.Collection pEntryIds)
          Remove the list entries with the specified uids.
 void remove(int pEntryId)
          Remove the list Entry with the specified uid.
 void remove(int[] pEntryIds)
          Remove the list entries with the specified uids.
 void remove(java.lang.String pProductId, java.lang.String pCategoryId, java.lang.String pSkuId, java.lang.String pCatalogKey)
          Remove the list Entry containing the given product id, category id, and sku id.
 void remove(java.lang.String pProductId, java.lang.String pCategoryId, java.lang.String pSkuId, java.lang.String pCatalogKey, java.lang.String pSiteId)
          Remove the Entry containing the given product id, category id, and sku id.
 void removeAll(java.lang.String pProductId)
          Remove all list entries for the specified product, regardless of the Entry's category or sku.
 void removeAll(java.lang.String pProductId, java.lang.String pSiteId)
          Remove all list entries for the specified product, regardless of the Entry's category or sku that belongs to specified site.
 void removeAll(java.lang.String pProductId, java.lang.String pCategoryId, java.lang.String pCatalogKey)
          Remove all list entries for the specified product and category, regardless of the Entry's sku.
 void removeAll(java.lang.String pProductId, java.lang.String pCategoryId, java.lang.String pCatalogKey, java.lang.String pSiteId)
          Remove all list entries for the specified product and category, regardless of the Entry's sku.
 void removeCategory(java.lang.String pCategoryId)
          Remove all list entries for the specified category, regardless of the Entry's product or sku.
 void removeCategory(java.lang.String pCategoryId, java.lang.String pSiteId)
          Remove all list entries for the specified category, regardless of the Entry's product or sku on chosen site.
 void setCatalogTools(CatalogTools pCatalogTools)
          Set the CatalogTools object to use when looking up products, categories and skus.
 void setCategoryLinkFormat(java.lang.String pCategoryLinkFormat)
          Set the format of the HTML generated for a link to a category page.
 void setEncodeLinkURLs(boolean pEncodeLinkURLs)
          Specify whether or not to call DynamoHttpServletRequest.encodeURL on links to products and categories built using productLinkFormat and categoryLinkFormat.
 void setInventoryManager(InventoryManager pInventoryManager)
          Set the InventoryManager object to use when fetching inventory availability information for items in the product comparison list.
 void setPreloadInventoryData(boolean pPreloadInventoryData)
          Specifies whether to load inventory data for each Entry in the product comparison list when that Entry is created, or to leave the inventory information empty until a call is made to refreshInventoryData.
 void setPricingTools(PricingTools pPricingTools)
          Set the PricingTools object to use when fetching the ItemPriceInfo for each item in the product comparison list.
 void setProductLinkFormat(java.lang.String pProductLinkFormat)
          Set the format of the HTML generated for a link to a product page.
 void setRefreshInventoryData(java.lang.String pUnused)
          "set" method to make the refreshInventoryData functionality available from jhtml.
 void setSiteURLManager(SiteURLManager pSiteURLManager)
           
protected  java.util.List skuList(RepositoryItem pProduct)
          Get the list of skus for a given product.
 
Methods inherited from class atg.commerce.catalog.comparison.ComparisonList
addItem, clear, containsItem, getItem, getItems, getPrimarySortString, getSortString, getTableColumns, getTableInfo, indexOf, removeItem, removeItem, setItems, setTableInfo, size
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static final java.lang.String CLASS_VERSION
See Also:
Constant Field Values

CATEGORY_PROPERTY

public static final java.lang.String CATEGORY_PROPERTY

SKULIST_PROPERTY

public static final java.lang.String SKULIST_PROPERTY

CATEGORY_KEY

public static final java.lang.String CATEGORY_KEY

CATEGORY_LINK_KEY

public static final java.lang.String CATEGORY_LINK_KEY

PRODUCT_KEY

public static final java.lang.String PRODUCT_KEY

PRODUCT_LINK_KEY

public static final java.lang.String PRODUCT_LINK_KEY

SKU_KEY

public static final java.lang.String SKU_KEY

INVENTORY_KEY

public static final java.lang.String INVENTORY_KEY

PRICE_INFO_KEY

public static final java.lang.String PRICE_INFO_KEY

ID_KEY

public static final java.lang.String ID_KEY

SITE_ID

public static final java.lang.String SITE_ID

MY_RESOURCE_NAME

public static final java.lang.String MY_RESOURCE_NAME
See Also:
Constant Field Values

mSiteURLManager

protected SiteURLManager mSiteURLManager

mCatalogTools

protected CatalogTools mCatalogTools
Constructor Detail

ProductComparisonList

public ProductComparisonList()
Method Detail

getSiteURLManager

public SiteURLManager getSiteURLManager()

setSiteURLManager

public void setSiteURLManager(SiteURLManager pSiteURLManager)

getItems

public ProductComparisonList.Entry getItems(int pEntryId)
Get a product comparison Entry given its uid. This method is structured to present "items[id]" as an indexed bean property so it can be used within JHTML pages to retrieve a given Entry using syntax like "bean:/path/to/ProductList.items[param:id]".

Parameters:
pUID - The unique id of the Entry to return.
Returns:
The Entry whose id matches pUID, or null if there is no matching Entry.

add

public boolean add(java.lang.String pProductId,
                   java.lang.String pCategoryId,
                   java.lang.String pSkuId,
                   java.lang.String pCatalogKey)
            throws RepositoryException
Add a product to the product comparison list, optionally specifying an associated category and sku. If the category is not specified, the product's default category will be used if possible. If the sku is not specified, the first sku in the product's sku list will be used if possible.

Parameters:
pProductId - The repository id of the product being added.
pCategoryId - The repository id of the parent category to use for this Entry. If null, the product's default parent category will be used instead. If the product has no default parent category, the category in the Entry will be null.
pSkuId - The repository id of the sku to use for this Entry. If null, the first sku in the product's sku list will be used instead. If the product has no skus, the sku in the Entry will be null.
pCatalogKey - An optional key that is passed to the CatalogTools component, which uses it to locate an alternate product catalog from which to add the product. If null, the default catalog is used.
Returns:
True if the item was added to the list, false if it was not, either because no such product with the given id was found, or because the category/product/sku triplet already existed in the list.
Throws:
RepositoryException - if there is any repository error while looking up categories, products, or skus.

add

public boolean add(java.lang.String pProductId,
                   java.lang.String pCategoryId,
                   java.lang.String pSkuId,
                   java.lang.String pCatalogKey,
                   java.lang.String pSiteId)
            throws RepositoryException
Add a product to the product comparison list, optionally specifying an associated category and sku. If the category is not specified, the product's default category will be used if possible. If the sku is not specified, the first sku in the product's sku list will be used if possible.

Parameters:
pProductId - The repository id of the product being added.
pCategoryId - The repository id of the parent category to use for this Entry. If null, the product's default parent category will be used instead. If the product has no default parent category, the category in the Entry will be null.
pSkuId - The repository id of the sku to use for this Entry. If null, the first sku in the product's sku list will be used instead. If the product has no skus, the sku in the Entry will be null.
pCatalogKey - An optional key that is passed to the CatalogTools component, which uses it to locate an alternate product catalog from which to add the product. If null, the default catalog is used.
pSiteId - The site id.
Returns:
True if the item was added to the list, false if it was not, either because no such product with the given id was found, or because the category/product/sku triplet already existed in the list.
Throws:
RepositoryException - if there is any repository error while looking up categories, products, or skus.

addAllSkus

public int addAllSkus(java.lang.String pProductId,
                      java.lang.String pCategoryId,
                      java.lang.String pCatalogKey)
               throws RepositoryException
Add entries to the comparison list for every sku associated with a given product.

Parameters:
pProductId - The repository id of the product being added.
pCategoryId - The repository id of the parent category to use for this Entry. If null, the product's default parent category will be used instead. If the product has no default parent category, the category in the Entry will be null.
pCatalogKey - An optional key that is passed to the CatalogTools component, which uses it to locate an alternate product catalog from which to add the product. If null, the default catalog is used.
Returns:
The number of new list entries created. If zero is returned, no new entries were created. This may be because no product with the given id was found, or because all of the category/product/sku triplets already existed in the list.
Throws:
RepositoryException - if there is any repository error while looking up categories, products, or skus.

addAllSkus

public int addAllSkus(java.lang.String pProductId,
                      java.lang.String pCategoryId,
                      java.lang.String pCatalogKey,
                      java.lang.String pSiteId)
               throws RepositoryException
Add entries to the comparison list for every sku associated with a given product.

Parameters:
pProductId - The repository id of the product being added.
pCategoryId - The repository id of the parent category to use for this Entry. If null, the product's default parent category will be used instead. If the product has no default parent category, the category in the Entry will be null.
pCatalogKey - An optional key that is passed to the CatalogTools component, which uses it to locate an alternate product catalog from which to add the product. If null, the default catalog is used.
pSiteId - The site id.
Returns:
The number of new list entries created. If zero is returned, no new entries were created. This may be because no product with the given id was found, or because all of the category/product/sku triplets already existed in the list.
Throws:
RepositoryException - if there is any repository error while looking up categories, products, or skus.

contains

public boolean contains(java.lang.String pProductId,
                        java.lang.String pCategoryId,
                        java.lang.String pSkuId,
                        java.lang.String pCatalogKey)
                 throws RepositoryException
Return true if the product comparison list contains an Entry for the given product id, category id, and sku id. A null category id matches the product's default parent category, if any. A null sku id matches the product's default sku, if any.

The behavior of contains therefore parallels the behavior of add, so that calling add(productId, categoryId, skuId) and then calling contains(productId, categoryId, skuId)> with the same values will return true.

The pCatalogKey parameter is used to select a product catalog in cases where it is necessary to locate a product's default parent category or default sku. A null value means use the default product catalog.

Throws:
RepositoryException

contains

public boolean contains(java.lang.String pProductId,
                        java.lang.String pCategoryId,
                        java.lang.String pCatalogKey)
                 throws RepositoryException
Return true if the product comparison list contains any Entry for the given product id and category id, regardless of that Entry's sku. A null category id matches the product's default parent category, if any.

The pCatalogKey parameter is used to select a product catalog in cases where it is necessary to locate a product's default parent category. A null value means use the default product catalog.

Throws:
RepositoryException

contains

public boolean contains(java.lang.String pProductId)
                 throws RepositoryException
Return true if the product comparison list contains any Entry for the given product id, regardless of that Entry's category and sku.

Throws:
RepositoryException

contains

public boolean contains(java.lang.String pProductId,
                        java.lang.String pSiteId)
                 throws RepositoryException
Return true if the product comparison list contains any Entry for the given product id, regardless of that Entry's category and sku on chosen site.

Throws:
RepositoryException

contains

public boolean contains(java.lang.String pProductId,
                        java.lang.String pCategoryId,
                        java.lang.String pSkuId,
                        java.lang.String pCatalogKey,
                        java.lang.String pSiteId,
                        boolean pMatchSku)
                 throws RepositoryException
Return true if the product comparison list contains an Entry for the given product id, category id, and sku id. A null category id matches the product's default parent category, if any. A null sku id matches the product's default sku, if any. If pMatchSku is false, then no check on sku is hold.

The behavior of contains therefore parallels the behavior of add, so that calling add(productId, categoryId, skuId) and then calling contains(productId, categoryId, skuId)> with the same values will return true.

The pCatalogKey parameter is used to select a product catalog in cases where it is necessary to locate a product's default parent category or default sku. A null value means use the default product catalog.

The pMatchSku indicates is pSkuId parameter is used. If pMatchSku is false, then no ckek on sku.

Throws:
RepositoryException

remove

public void remove(java.lang.String pProductId,
                   java.lang.String pCategoryId,
                   java.lang.String pSkuId,
                   java.lang.String pCatalogKey)
            throws RepositoryException
Remove the list Entry containing the given product id, category id, and sku id. A null category id matches the product's default parent category, if any. A null sku id matches the product's default sku, if any.

The behavior of remove therefore parallels the behavior of add, so that calling add(productId, categoryId, skuId) and then calling remove(productId, categoryId, skuId)> with the same values will remove the item just added.

The pCatalogKey parameter is used to select a product catalog in cases where it is necessary to locate a product's default parent category or default sku. A null value means use the default product catalog.

Throws:
RepositoryException

remove

public void remove(java.lang.String pProductId,
                   java.lang.String pCategoryId,
                   java.lang.String pSkuId,
                   java.lang.String pCatalogKey,
                   java.lang.String pSiteId)
            throws RepositoryException
Remove the Entry containing the given product id, category id, and sku id. A null category id matches the product's default parent category, if any. A null sku id matches the product's default sku, if any.

The behavior of remove therefore parallels the behavior of add, so that calling add(productId, categoryId, skuId) and then calling remove(productId, categoryId, skuId)> with the same values will remove the item just added.

The pCatalogKey parameter is used to select a product catalog in cases where it is necessary to locate a product's default parent category or default sku. A null value means use the default product catalog. The pSiteId parameter is used to pass site id

Throws:
RepositoryException

remove

public void remove(int pEntryId)
Remove the list Entry with the specified uid.


remove

public void remove(int[] pEntryIds)
Remove the list entries with the specified uids.


remove

public void remove(java.util.Collection pEntryIds)
Remove the list entries with the specified uids.

Parameters:
pEntryIds - A Collection of Integer objects representing the uid's of the entries to remove.

removeAll

public void removeAll(java.lang.String pProductId)
Remove all list entries for the specified product, regardless of the Entry's category or sku.


removeAll

public void removeAll(java.lang.String pProductId,
                      java.lang.String pSiteId)
Remove all list entries for the specified product, regardless of the Entry's category or sku that belongs to specified site.


removeAll

public void removeAll(java.lang.String pProductId,
                      java.lang.String pCategoryId,
                      java.lang.String pCatalogKey)
               throws RepositoryException
Remove all list entries for the specified product and category, regardless of the Entry's sku. A null category id matches the product's default parent category, if any.

The pCatalogKey parameter is used to select a product catalog in cases where it is necessary to locate a product's default parent category. A null value means use the default product catalog.

Throws:
RepositoryException

removeAll

public void removeAll(java.lang.String pProductId,
                      java.lang.String pCategoryId,
                      java.lang.String pCatalogKey,
                      java.lang.String pSiteId)
               throws RepositoryException
Remove all list entries for the specified product and category, regardless of the Entry's sku. A null category id matches the product's default parent category, if any.

The pCatalogKey parameter is used to select a product catalog in cases where it is necessary to locate a product's default parent category. A null value means use the default product catalog. pSiteId site id

Throws:
RepositoryException

removeCategory

public void removeCategory(java.lang.String pCategoryId)
Remove all list entries for the specified category, regardless of the Entry's product or sku.


removeCategory

public void removeCategory(java.lang.String pCategoryId,
                           java.lang.String pSiteId)
Remove all list entries for the specified category, regardless of the Entry's product or sku on chosen site.


getDefaultCategoryId

protected java.lang.String getDefaultCategoryId(RepositoryItem pProduct)
Get the id of the parent category, the is obtained via defaultCategory


defaultCategory

protected RepositoryItem defaultCategory(RepositoryItem pProduct)
Get the default parent category for a given product. Returns null if no parent category could be found, or if the value of the parent category property was not a repository item.


skuList

protected java.util.List skuList(RepositoryItem pProduct)
Get the list of skus for a given product. Returns null if no skus could be found, or if the value of the sku list property was not a list.


getDefaultSkuId

protected java.lang.String getDefaultSkuId(RepositoryItem pProduct)
Get the id of the default sku for given product. Default sku is obtained via


defaultSku

protected RepositoryItem defaultSku(RepositoryItem pProduct)
Get the default sku for a given product. Returns null if no skus could be found, or if value of the the sku list property was not a list, or if the first list element was not a repository item.


createListEntry

protected ProductComparisonList.Entry createListEntry(RepositoryItem pCategory,
                                                      RepositoryItem pProduct,
                                                      RepositoryItem pSku)
Create a product comparison list Entry for the given category, product, and sku. Any of the values may be null, although product should not be null in normal usage.


createListEntry

protected ProductComparisonList.Entry createListEntry(RepositoryItem pCategory,
                                                      RepositoryItem pProduct,
                                                      RepositoryItem pSku,
                                                      java.lang.String pSiteId)
Create a product comparison list Entry for the given category, product, and sku for given site. Any of the values may be null, although product should not be null in normal usage.


refreshInventoryData

public void refreshInventoryData()
Update the inventory information associated with each product in the product comparison list to obtain the latest inventory levels and status.


setRefreshInventoryData

public void setRefreshInventoryData(java.lang.String pUnused)
"set" method to make the refreshInventoryData functionality available from jhtml.


errorMsg

protected java.lang.String errorMsg(java.lang.String pResourceKey,
                                    java.lang.Object[] pArgs)
Get a formatted error message string based on an error message resource key and an array of message arguments.


idMatch

protected boolean idMatch(java.lang.String pId,
                          RepositoryItem pItem)
Return true if pId is considered a match for pItem. If pId is null, then pItme must also be null. Otherwise pId must be the repository id of pItem.


arrayContains

protected boolean arrayContains(int[] pIds,
                                int pTarget)
Return true if the specified array of ints contains the target value.


setCatalogTools

public void setCatalogTools(CatalogTools pCatalogTools)
Set the CatalogTools object to use when looking up products, categories and skus.


getCatalogTools

public CatalogTools getCatalogTools()
Get the CatalogTools object to use when looking up products, categories and skus.


setInventoryManager

public void setInventoryManager(InventoryManager pInventoryManager)
Set the InventoryManager object to use when fetching inventory availability information for items in the product comparison list.


getInventoryManager

public InventoryManager getInventoryManager()
Get the InventoryManager object to use when fetching inventory availability information for items in the product comparison list.


setPreloadInventoryData

public void setPreloadInventoryData(boolean pPreloadInventoryData)
Specifies whether to load inventory data for each Entry in the product comparison list when that Entry is created, or to leave the inventory information empty until a call is made to refreshInventoryData.

If your pages explicitly refresh the inventory data before displaying product comparison information, you can set this property to false and avoid one extra query to the inventory manager when each item is created. If your pages do not explicitly refresh the inventory data, you should set this property to true so your comparison list entries will contain a snapshot of the inventory data at the time each Entry was added to the list.

The default value for preloadInventoryData is true.


isPreloadInventoryData

public boolean isPreloadInventoryData()
Query whether to load inventory data for each Entry in the product comparison list when that Entry is created, or to leave the inventory information empty until a call is made to refreshInventoryData.

See Also:
setPreloadInventoryData

setPricingTools

public void setPricingTools(PricingTools pPricingTools)
Set the PricingTools object to use when fetching the ItemPriceInfo for each item in the product comparison list.


getPricingTools

public PricingTools getPricingTools()
Get the PricingTools object to use when fetching the ItemPriceInfo for each item in the product comparison list.


setProductLinkFormat

public void setProductLinkFormat(java.lang.String pProductLinkFormat)
Set the format of the HTML generated for a link to a product page. The format string is passed to java.text.MessageFormat, and may include up to three argument expressions, {0}, {1}, and {2}.

{0} is replaced by the display name of the product.
{1} is replaced by the repository id of the product.
{2} is replaced by the template url of the product.

The default format is <a href=templateURL?id=repositoryId>productName<a>


getProductLinkFormat

public java.lang.String getProductLinkFormat()
Get the format of the HTML generated for a link to a product page.


setCategoryLinkFormat

public void setCategoryLinkFormat(java.lang.String pCategoryLinkFormat)
Set the format of the HTML generated for a link to a category page. The format string is passed to java.text.MessageFormat, and may include up to three argument expressions, {0}, {1}, and {2}.

{0} is replaced by the display name of the category.
{1} is replaced by the repository id of the category.
{2} is replaced by the template url of the category.

The default format is <a href=templateURL?id=repositoryId>categoryName<a>


getCategoryLinkFormat

public java.lang.String getCategoryLinkFormat()
Get the format of the HTML generated for a link to a category page.


setEncodeLinkURLs

public void setEncodeLinkURLs(boolean pEncodeLinkURLs)
Specify whether or not to call DynamoHttpServletRequest.encodeURL on links to products and categories built using productLinkFormat and categoryLinkFormat. Links should normally be encoded to ensure that URL-based session tracking works, and that servlet context paths are handled correctly when using the Dynamo Application Framework on other application servers.


isEncodeLinkURLs

public boolean isEncodeLinkURLs()
Query whether to encode URLs on links created using productLinkFormat and categoryLinkFormat. The default value is true.


makeLink

protected java.lang.String makeLink(java.lang.String pFormat,
                                    RepositoryItem pItem)
Expand the format string for a product or category, substituting in the name, repository id, and template url.

Parameters:
pFormat - The format string, in which {0} is replaced by the item's displayName, {1} by its repository id, and {2} by its template URL.
pItem - The product or category RepositoryItem to consult when expanding the format string.

makeLink

protected java.lang.String makeLink(java.lang.String pFormat,
                                    RepositoryItem pItem,
                                    java.lang.String pSiteId)
Expand the format string for a product or category, substituting in the name, repository id, and template url.

Parameters:
pFormat - The format string, in which {0} is replaced by the item's displayName, {1} by its repository id, and {2} by its template URL.
pItem - The product or category RepositoryItem to consult when expanding the format string.
pSiteId - The site id

makeLink

protected java.lang.String makeLink(java.lang.String pFormat,
                                    RepositoryItem pItem,
                                    boolean pEncode,
                                    java.lang.String pSiteId)
Expand the format string for a product or category, substituting in the name, repository id, and template url.

Parameters:
pFormat - The format string, in which {0} is replaced by the item's displayName, {1} by its repository id, and {2} by its template URL.
pItem - The product or category RepositoryItem to consult when expanding the format string.
pEncode - If true, call DynamoHttpServletRequest.encodeURL on the link before returning it.
pSiteId - The site id.

getUnitPrice

protected ItemPriceInfo getUnitPrice(RepositoryItem pProduct,
                                     RepositoryItem pSku)
Return an ItemPriceInfo object representing the unit price of the product and sku represented by pColumn; return null if the column has no sku information.