atg.commerce.catalog.custom
Class CustomCatalogTools

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.catalog.CatalogTools
              extended by atg.commerce.catalog.custom.CustomCatalogTools
All Implemented Interfaces:
atg.commerce.catalog.CMSConstants, MessageTyper, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class CustomCatalogTools
extends CatalogTools
implements atg.commerce.catalog.CMSConstants

This class is an extension of atg.commerce.catalog.CatalogTools that modifies the behavior so it works with custom catalogs. For example, findSku will only return a result if the result is accessible throug the current users catalogs.

All of the configuration is the same with some additional properties:

 $class=atg.commerce.catalog.custom.CustomCatalogTools

 transactionManager=/atg/dynamo/transaction/TransactionManager
 profileCatalogPropertyName=catalog

 categorysInfosMapProperty=categoryInfos
 productsInfosMapProperty=productInfos
 skusInfosMapProperty=skuInfos

 catalogsProperty=catalogs

 baseCatalogItemType=catalog
 catalogItemTypes=catalog

 catalogProperties=/atg/commerce/catalog/custom/CatalogProperties

 trackState=true
 


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.commerce.catalog.CatalogTools
DEFAULT_CATEGORY_ITEM_TYPE, DEFAULT_PRODUCT_ITEM_TYPE, DEFAULT_SKU_ITEM_TYPE
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.commerce.catalog.CMSConstants
AGS_GENANCESTORS, AGS_GENCATALOGS, AGS_GENPARENTCATS, ANCESTORS_GENERATED, CATALOGS_UPDATED, CATALOGS_VERIFIED, CATEGORIES_VERIFIED, CUS_UPDATECATALOGS, CVS_VERIFYCATALOGS, CVS_VERIFYCATEGORIES, CVS_VERIFYPRODUCTS, CVS_VERIFYSKUS, DEFAULT_CATALOG_ITEM_TYPE, DEFAULT_MAP_SIZE, GENERATED_ANCESTORS, INFOS_GENERATED, IS_ANCESTORS_GENERATED, LEVEL_DEBUG, LEVEL_ERROR, LEVEL_INFO, LEVEL_WARNING, MY_RESOURCE_NAME, NO_PATH, NOT_GENERATOR, sResourceBundle, TYPE_ANCESTOR, TYPE_CATALOGMAINTENANCE, TYPE_CUSTOM_MIGRATION, TYPE_MIGRATION, TYPE_UPDATE, TYPE_VERIFY, VALID_PATH
 
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
CustomCatalogTools()
           
 
Method Summary
 java.util.Collection computeRecursedRootSubCatalogs(RepositoryItem pCatalog)
          method to compute the rootSubCatalog ancestor tree for a catalog
 java.util.List filterCollectionByCatalog(RepositoryItem pCatalog, java.util.Collection pCollection)
           
 RepositoryItem findCatalogItem(java.lang.String pId)
          With the given id return an object which represents the catalog
 RepositoryItem findCatalogItem(java.lang.String pId, java.lang.String pCatalogKey)
          With the given id return an object which represents the catalog It is important not to confuse this with the "findCatalog" method.
 RepositoryItem[] findCatalogItems(java.lang.String[] pIds)
          With the given id return an object which represents the catalog
 RepositoryItem[] findCatalogItems(java.lang.String[] pIds, java.lang.String pCatalogKey)
          With the given id return an object which represents the catalog
 RepositoryItem[] findCategories(java.lang.String[] pIds)
          With the given id return an object which represents the category
 RepositoryItem[] findCategories(java.lang.String[] pIds, java.lang.String pCatalogKey)
          With the given id return an object which represents the category
 RepositoryItem[] findCategories(java.lang.String[] pIds, java.lang.String pCatalogKey, boolean pVerifyCatalog)
          With the given id return an object which represents the category
 RepositoryItem[] findCategories(java.lang.String[] pIds, java.lang.String pCatalogKey, RepositoryItem pCatalog)
          With the given id return an object which represents the category
 RepositoryItem findCategory(java.lang.String pId)
          With the given id return an object which represents the category
 RepositoryItem findCategory(java.lang.String pId, java.lang.String pCatalogKey)
          With the given id return an object which represents the category The item is only returned if it is in the current users catalog
 RepositoryItem findCategory(java.lang.String pId, java.lang.String pCatalogKey, boolean pVerifyCatalog)
          With the given id return an object which represents the category The item is only returned if it is in the current users catalog
 RepositoryItem findCategory(java.lang.String pId, java.lang.String pCatalogKey, RepositoryItem pCatalog)
          With the given id return an object which represents the category The item is only returned if it is in the current users catalog
 RepositoryItem findProduct(java.lang.String pId)
          With the given id return an object which represents the product
 RepositoryItem findProduct(java.lang.String pId, java.lang.String pCatalogKey)
          With the given id return an object which represents the product
 RepositoryItem findProduct(java.lang.String pId, java.lang.String pCatalogKey, boolean pVerifyCatalog)
          With the given id return an object which represents the product
 RepositoryItem findProduct(java.lang.String pId, java.lang.String pCatalogKey, RepositoryItem pCatalog)
          With the given id return an object which represents the product
 RepositoryItem[] findProducts(java.lang.String[] pIds)
          With the given id return an object which represents the product
 RepositoryItem[] findProducts(java.lang.String[] pIds, java.lang.String pCatalogKey)
          With the given id return an object which represents the product
 RepositoryItem[] findProducts(java.lang.String[] pIds, java.lang.String pCatalogKey, boolean pVerifyCatalog)
          With the given id return an object which represents the product
 RepositoryItem[] findProducts(java.lang.String[] pIds, java.lang.String pCatalogKey, RepositoryItem pCatalog)
          With the given id return an object which represents the product
 RepositoryItem findSKU(java.lang.String pId)
          With the given id return an object which represents the sku
 RepositoryItem findSKU(java.lang.String pId, java.lang.String pCatalogKey)
          With the given id return an object which represents the sku
 RepositoryItem findSKU(java.lang.String pId, java.lang.String pCatalogKey, boolean pVerifyCatalog)
          With the given id return an object which represents the sku
 RepositoryItem findSKU(java.lang.String pId, java.lang.String pCatalogKey, RepositoryItem pCatalog)
          With the given id return an object which represents the sku
 RepositoryItem[] findSKUs(java.lang.String[] pIds)
          With the given ids return an array of objects which represent the skus
 RepositoryItem[] findSKUs(java.lang.String[] pIds, java.lang.String pCatalogKey)
          With the given ids return an array of objects which represent the skus
 RepositoryItem[] findSKUs(java.lang.String[] pIds, java.lang.String pCatalogKey, boolean pVerifyCatalog)
          With the given ids return an array of objects which represent the skus
 RepositoryItem[] findSKUs(java.lang.String[] pIds, java.lang.String pCatalogKey, RepositoryItem pCatalog)
          With the given ids return an array of objects which represent the skus
 java.util.List getAllAncestorCategories(RepositoryItem pItem)
           
 java.util.LinkedList getAncestors(RepositoryItem pItem)
          This method gets the parentCategory property of the repository item passed in, and gets the parentCategory's parentCategory and so forth until there is no more parent.
 java.util.LinkedList getAncestors(RepositoryItem pItem, RepositoryItem pCatalog)
          This method gets the parentCategory property of the repository item passed in, and gets the parentCategory's parentCategory and so forth until there is no more parent.
 java.lang.String getBaseCatalogItemType()
          Returns property BaseCatalogItemType
 java.util.Map getCatalogBeanInfos()
          Returns property CatalogBeanInfos
 java.lang.String[] getCatalogItemTypes()
          Returns property CatalogItemTypes
 CatalogProperties getCatalogProperties()
          A class that stores the names of various items and properties in the repository
 java.util.Collection getCatalogsContainingThisCatalog(RepositoryItem pCatalog, Repository pCatalogRepository)
          This method will return all the catalogs that contain the given catalog as a sub catalog.
 RepositoryItem[] getCatalogsForRepository(Repository pRepository, java.util.Collection pCatalogIds)
          returns an array of catalog items for the given repository.
 java.lang.String getCatalogsProperty()
          The name of the property in category, product, or sku that contains the list of catalogs that have the item in it The default is "catalogs"
 RepositoryItem[] getCatalogsThatIncludeCatalogInRootSubCatalogs(RepositoryItem pCatalog, Repository pRepository)
          returns an array of catalog items that have the given catalog in their rootSubCatalogs property
 RepositoryItem[] getCatalogsWithCategoryAsRoot(RepositoryItem pCategory, Repository pCatalogRepository)
          Get the catalogs whose rootCategories contains this category
 java.util.Collection getCategoriesContainingThisCatalog(RepositoryItem pCatalog, Repository pCatalogRepository)
          Generate the immediate categories that can navigate to this catalog.
 java.util.Collection getCategoriesContainingThisCategorysCatalog(RepositoryItem pCategory, Repository pCatalogRepository)
          Generate the immediate categories that can navigate to this category's catalog There are two ways this can happen 1.
 RepositoryItem[] getCategoriesInCatalog(RepositoryItem pCatalog, Repository pCatalogRepository)
          Get categories whose catalog property equals the given catalog
 RepositoryItem[] getCategoriesWithCatalogAsSubCatalog(RepositoryItem pCatalog, Repository pRepository)
          returns an array of categories items that have the given catalog in their subCatalogs property
 java.util.Collection getCategoriesWithIndirectPathToCatalog(RepositoryItem pCatalog)
          gets categories that contain the catalog as a subCatalog, or any of the rootSubCatalogs as a subCatalog.
 java.util.Collection getCategoriesWithIndirectPathToCategory(RepositoryItem pCategory)
          gets categories that contain the current category's catalog as a subCatalog, or any of the rootSubCatalogs as a subCatalog.
 java.lang.String getCategorysInfoMapProperty()
          The name of the map property in category that maps catalogs to categoryInfos The default is "categoryInfos"
 RepositoryItem getCurrentCatalog()
          Get the catalog from the thread if specified as a thread local variable.
 RepositoryItem[] getParentCategories(RepositoryItem pCategory, Repository pCatalogRepository)
          Get the categories whose childCategories contains this category
 java.util.Collection getProductsCategories(RepositoryItem pProduct, Repository pCatalogRepository)
          This method will return a list of the categories that the given product appears in.
 java.lang.String getProductsInfoMapProperty()
          The name of the map property in product that maps catalogs to productInfos The default is "productInfos"
 java.lang.String getProfileCatalogPropertyName()
          The name of the property in the profile that stores the current users catalog.
 java.util.Collection getRootCategoriesForCatalog(RepositoryItem pCatalog, Repository pCatalogRepository)
          Return the list of all root categories for a catalog (including all root categories of the rootSubCatalogs
 java.lang.String getSkusInfoMapProperty()
          The name of the map property in sku that maps catalogs to skuInfos The default is "skuInfos"
 java.lang.String getStatePropertyName()
          The name of the property in the catalog that tracks the status of differnent catalog maintenance services.
 boolean getTrackState()
          A boolean value that the user can specify whether to track the state of catalog maintenance service
 javax.transaction.TransactionManager getTransactionManager()
          The beginning and ending of transactions are handled by the transaction manager.
 boolean isCategoryReferenced(RepositoryItem pCategory, RepositoryItem pCatalog, Repository pCatalogRepository)
          This method will check if the given category is included in any catalogs 'rootCategories' list or in any categories 'childCategories' list.
 boolean isReturnEmptyResults()
          Query whether findCategories, findProducts, and findSkus should return empty results if none of the target ids appears in the user's catalog, or whether they should return the complete set of products or categories for the id's in question.
 void setBaseCatalogItemType(java.lang.String pBaseCatalogItemType)
          Sets property BaseCatalogItemType
 void setCatalogItemTypes(java.lang.String[] pCatalogItemTypes)
          Set property CatalogItemTypes
 void setCatalogProperties(CatalogProperties pCatalogProperties)
           
 void setCatalogsProperty(java.lang.String pCatalogsProperty)
           
 void setCategorysInfoMapProperty(java.lang.String pCategorysInfoMapProperty)
           
 void setProductsInfoMapProperty(java.lang.String pProductsInfoMapProperty)
           
 void setProfileCatalogPropertyName(java.lang.String pProfileCatalogPropertyName)
           
 void setReturnEmptyResults(boolean pEmptyResultReturnsAll)
          Specify whether findCategories, findProducts, and findSkus should return empty results if none of the target ids appears in the user's catalog, or whether they should return the complete set of products or categories for the id's in question.
 void setSkusInfoMapProperty(java.lang.String pSkusInfoMapProperty)
           
 void setState(java.util.Collection pCatalogIds, java.lang.String pState)
          This method will set the status for the specified catalogs.
 void setState(java.lang.String pState)
          This method will set the status for all the existing catalogs.
 void setStatePropertyName(java.lang.String pStatePropertyName)
           
 void setTrackState(boolean pTrackState)
           
 void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
           
 boolean verifyCatalog(RepositoryItem pItem)
          This method returns true if the given catalog appears in the given items "catalogs" list.
 boolean verifyCatalog(RepositoryItem pItem, RepositoryItem pCatalog)
          This method returns true if the given catalog appears in the given items "catalogs" list.
 
Methods inherited from class atg.commerce.catalog.CatalogTools
doStartService, findCatalog, getAlternateCatalogs, getBaseCategoryItemType, getBaseMediaItemType, getBaseProductItemType, getBaseSKUItemType, getBeanInfo, getCatalog, getCatalogServiceLockName, getCatalogServiceLockTimeOut, getCategoryBeanInfos, getCategoryItemTypes, getParentCategoryPropertyName, getProductBeanInfos, getProductItemTypes, getSKUBeanInfos, getSKUItemTypes, getTypeInfo, isProduct, isUseDefaultCatalog, setAlternateCatalogs, setBaseCategoryItemType, setBaseMediaItemType, setBaseProductItemType, setBaseSKUItemType, setCatalog, setCatalogServiceLockName, setCatalogServiceLockTimeOut, setCategoryItemTypes, setParentCategoryPropertyName, setProductItemTypes, setSKUItemTypes, setUseDefaultCatalog
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, 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
Class version string

See Also:
Constant Field Values
Constructor Detail

CustomCatalogTools

public CustomCatalogTools()
Method Detail

setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
The beginning and ending of transactions are handled by the transaction manager.


setStatePropertyName

public void setStatePropertyName(java.lang.String pStatePropertyName)

getStatePropertyName

public java.lang.String getStatePropertyName()
The name of the property in the catalog that tracks the status of differnent catalog maintenance services. The default is "status"


setProfileCatalogPropertyName

public void setProfileCatalogPropertyName(java.lang.String pProfileCatalogPropertyName)

getProfileCatalogPropertyName

public java.lang.String getProfileCatalogPropertyName()
The name of the property in the profile that stores the current users catalog. The default is "catalog"


setCategorysInfoMapProperty

public void setCategorysInfoMapProperty(java.lang.String pCategorysInfoMapProperty)

getCategorysInfoMapProperty

public java.lang.String getCategorysInfoMapProperty()
The name of the map property in category that maps catalogs to categoryInfos The default is "categoryInfos"


setProductsInfoMapProperty

public void setProductsInfoMapProperty(java.lang.String pProductsInfoMapProperty)

getProductsInfoMapProperty

public java.lang.String getProductsInfoMapProperty()
The name of the map property in product that maps catalogs to productInfos The default is "productInfos"


setSkusInfoMapProperty

public void setSkusInfoMapProperty(java.lang.String pSkusInfoMapProperty)

getSkusInfoMapProperty

public java.lang.String getSkusInfoMapProperty()
The name of the map property in sku that maps catalogs to skuInfos The default is "skuInfos"


setCatalogsProperty

public void setCatalogsProperty(java.lang.String pCatalogsProperty)

getCatalogsProperty

public java.lang.String getCatalogsProperty()
The name of the property in category, product, or sku that contains the list of catalogs that have the item in it The default is "catalogs"


setBaseCatalogItemType

public void setBaseCatalogItemType(java.lang.String pBaseCatalogItemType)
Sets property BaseCatalogItemType


getBaseCatalogItemType

public java.lang.String getBaseCatalogItemType()
Returns property BaseCatalogItemType


setCatalogItemTypes

public void setCatalogItemTypes(java.lang.String[] pCatalogItemTypes)
Set property CatalogItemTypes


getCatalogItemTypes

public java.lang.String[] getCatalogItemTypes()
Returns property CatalogItemTypes


getCatalogBeanInfos

public java.util.Map getCatalogBeanInfos()
Returns property CatalogBeanInfos


setCatalogProperties

public void setCatalogProperties(CatalogProperties pCatalogProperties)

getCatalogProperties

public CatalogProperties getCatalogProperties()
A class that stores the names of various items and properties in the repository


setTrackState

public void setTrackState(boolean pTrackState)

getTrackState

public boolean getTrackState()
A boolean value that the user can specify whether to track the state of catalog maintenance service


isReturnEmptyResults

public boolean isReturnEmptyResults()
Query whether findCategories, findProducts, and findSkus should return empty results if none of the target ids appears in the user's catalog, or whether they should return the complete set of products or categories for the id's in question. The default is to return empty results if appropriate.


setReturnEmptyResults

public void setReturnEmptyResults(boolean pEmptyResultReturnsAll)
Specify whether findCategories, findProducts, and findSkus should return empty results if none of the target ids appears in the user's catalog, or whether they should return the complete set of products or categories for the id's in question.

The correct behavior is to return empty results, but prior to ATG 7.0 the code did not implement this behavior. Instead, it returned the unfiltered set of categories or products obtained by calling super.findCategories or super.findProducts. This bug was fixed for ATG 7.0

In the unlikely event that application code depends on the old behavior, setting returnEmptyResults to false in the custom catalog tools configuration will restore that behavior.


getCatalogsForRepository

public RepositoryItem[] getCatalogsForRepository(Repository pRepository,
                                                 java.util.Collection pCatalogIds)
                                          throws RepositoryException
returns an array of catalog items for the given repository. if pCatalogs is null, all catalog items are returned

Parameters:
pRepository - - the repository containing the catalog items
pCatalogIds - - a collection of catalog ids to constrain the query for catalogs
Returns:
RepositoryItem[] - array of catalog items
Throws:
RepositoryException

getCatalogsThatIncludeCatalogInRootSubCatalogs

public RepositoryItem[] getCatalogsThatIncludeCatalogInRootSubCatalogs(RepositoryItem pCatalog,
                                                                       Repository pRepository)
                                                                throws RepositoryException
returns an array of catalog items that have the given catalog in their rootSubCatalogs property

Parameters:
pCatalog - - the catalog used to query catalogs
pRepository - - the repository containing the catalog items
Returns:
RepositoryItem[] - array of catalog items
Throws:
RepositoryException

getCategoriesWithCatalogAsSubCatalog

public RepositoryItem[] getCategoriesWithCatalogAsSubCatalog(RepositoryItem pCatalog,
                                                             Repository pRepository)
                                                      throws RepositoryException
returns an array of categories items that have the given catalog in their subCatalogs property

Parameters:
pCatalog - - the catalog used to query categories
pRepository - - the repository containing the category items
Returns:
RepositoryItem[] - array of category items
Throws:
RepositoryException

getParentCategories

public RepositoryItem[] getParentCategories(RepositoryItem pCategory,
                                            Repository pCatalogRepository)
                                     throws RepositoryException
Get the categories whose childCategories contains this category

Parameters:
pCategory - - the category to get parents for
pCatalogRepository - - The repository where the catalog resides
Returns:
RepositoryItem[] - array of categorys that have the incoming category as a child
Throws:
RepositoryException

getCatalogsWithCategoryAsRoot

public RepositoryItem[] getCatalogsWithCategoryAsRoot(RepositoryItem pCategory,
                                                      Repository pCatalogRepository)
                                               throws RepositoryException
Get the catalogs whose rootCategories contains this category

Parameters:
pCategory - - the category
pCatalogRepository - - The repository where the catalog resides.if null, defaults to pCategory's repository
Returns:
RepositoryItem[] - array of catalogs that have the incoming category as a root
Throws:
RepositoryException

getAncestors

public java.util.LinkedList getAncestors(RepositoryItem pItem)
This method gets the parentCategory property of the repository item passed in, and gets the parentCategory's parentCategory and so forth until there is no more parent. Then it returns a LinkedList of repository items. It obtains the name of the parentCategory property name from the parentCategoryPropertyName property. If you implementation of the catalog uses another name for the parentCategory property the parentCategoryPropertyName property should be changed. The parentCategory is retrieved from the info object that is mapped to by the current profile's catalog. If the catalog containing this item is a sub catalog of the current catalog, the path from the "parent catalog" to the current catalog is included.

Overrides:
getAncestors in class CatalogTools
Parameters:
pItem - The category or product we are getting the ancestors for

getAncestors

public java.util.LinkedList getAncestors(RepositoryItem pItem,
                                         RepositoryItem pCatalog)
This method gets the parentCategory property of the repository item passed in, and gets the parentCategory's parentCategory and so forth until there is no more parent. Then it returns a LinkedList of repository items. It obtains the name of the parentCategory property name from the parentCategoryPropertyName property. If you implementation of the catalog uses another name for the parentCategory property the parentCategoryPropertyName property should be changed. The parentCategory is retrieved from the info object in the case of the product, and from the category in the case of a category If the catalog containing this item is a sub catalog of the current catalog, the path from the "parent catalog" to the current catalog is included.

Parameters:
pItem - The category or product we are getting the ancestors for
pCatalog - the current catalog

getCategoriesInCatalog

public RepositoryItem[] getCategoriesInCatalog(RepositoryItem pCatalog,
                                               Repository pCatalogRepository)
Get categories whose catalog property equals the given catalog

Parameters:
pCatalog - The catalog to look in
pCatalogRepository - - the repository where the items reside. If null, pCatalog's repository is assumed.
Returns:
an array of category RepositoryItems in pCatalog

findCatalogItem

public RepositoryItem findCatalogItem(java.lang.String pId,
                                      java.lang.String pCatalogKey)
                               throws RepositoryException
With the given id return an object which represents the catalog It is important not to confuse this with the "findCatalog" method. That method returns a catalog repository. This method returns a catalog RepositoryItem. This mehod is only relevant when using custom catalogs.

Throws:
RepositoryException - if there was an error attempting to find the item

findCatalogItem

public RepositoryItem findCatalogItem(java.lang.String pId)
                               throws RepositoryException
With the given id return an object which represents the catalog

Throws:
RepositoryException - if there was an error attempting to find the item

findCatalogItems

public RepositoryItem[] findCatalogItems(java.lang.String[] pIds,
                                         java.lang.String pCatalogKey)
                                  throws RepositoryException
With the given id return an object which represents the catalog

Throws:
RepositoryException - if there was an error attempting to find the item

findCatalogItems

public RepositoryItem[] findCatalogItems(java.lang.String[] pIds)
                                  throws RepositoryException
With the given id return an object which represents the catalog

Throws:
RepositoryException - if there was an error attempting to find the item

findCategory

public RepositoryItem findCategory(java.lang.String pId,
                                   java.lang.String pCatalogKey,
                                   boolean pVerifyCatalog)
                            throws RepositoryException
With the given id return an object which represents the category The item is only returned if it is in the current users catalog

Throws:
RepositoryException - if there was an error attempting to find the item

findCategory

public RepositoryItem findCategory(java.lang.String pId,
                                   java.lang.String pCatalogKey,
                                   RepositoryItem pCatalog)
                            throws RepositoryException
With the given id return an object which represents the category The item is only returned if it is in the current users catalog

Throws:
RepositoryException - if there was an error attempting to find the item

findCategory

public RepositoryItem findCategory(java.lang.String pId,
                                   java.lang.String pCatalogKey)
                            throws RepositoryException
With the given id return an object which represents the category The item is only returned if it is in the current users catalog

Overrides:
findCategory in class CatalogTools
Throws:
RepositoryException - if there was an error attempting to find the item

findCategory

public RepositoryItem findCategory(java.lang.String pId)
                            throws RepositoryException
With the given id return an object which represents the category

Overrides:
findCategory in class CatalogTools
Throws:
RepositoryException - if there was an error attempting to find the item

findCategories

public RepositoryItem[] findCategories(java.lang.String[] pIds,
                                       java.lang.String pCatalogKey,
                                       boolean pVerifyCatalog)
                                throws RepositoryException
With the given id return an object which represents the category

Throws:
RepositoryException - if there was an error attempting to find the item

findCategories

public RepositoryItem[] findCategories(java.lang.String[] pIds,
                                       java.lang.String pCatalogKey,
                                       RepositoryItem pCatalog)
                                throws RepositoryException
With the given id return an object which represents the category

Throws:
RepositoryException - if there was an error attempting to find the item

findCategories

public RepositoryItem[] findCategories(java.lang.String[] pIds,
                                       java.lang.String pCatalogKey)
                                throws RepositoryException
With the given id return an object which represents the category

Overrides:
findCategories in class CatalogTools
Throws:
RepositoryException - if there was an error attempting to find the item

findCategories

public RepositoryItem[] findCategories(java.lang.String[] pIds)
                                throws RepositoryException
With the given id return an object which represents the category

Overrides:
findCategories in class CatalogTools
Throws:
RepositoryException - if there was an error attempting to find the item

findProduct

public RepositoryItem findProduct(java.lang.String pId,
                                  java.lang.String pCatalogKey,
                                  boolean pVerifyCatalog)
                           throws RepositoryException
With the given id return an object which represents the product

Throws:
RepositoryException - if there was an error attempting to find the item

findProduct

public RepositoryItem findProduct(java.lang.String pId,
                                  java.lang.String pCatalogKey,
                                  RepositoryItem pCatalog)
                           throws RepositoryException
With the given id return an object which represents the product

Throws:
RepositoryException - if there was an error attempting to find the item

findProduct

public RepositoryItem findProduct(java.lang.String pId,
                                  java.lang.String pCatalogKey)
                           throws RepositoryException
With the given id return an object which represents the product

Overrides:
findProduct in class CatalogTools
Throws:
RepositoryException - if there was an error attempting to find the item

findProduct

public RepositoryItem findProduct(java.lang.String pId)
                           throws RepositoryException
With the given id return an object which represents the product

Overrides:
findProduct in class CatalogTools
Throws:
RepositoryException - if there was an error attempting to find the item

findProducts

public RepositoryItem[] findProducts(java.lang.String[] pIds,
                                     java.lang.String pCatalogKey,
                                     boolean pVerifyCatalog)
                              throws RepositoryException
With the given id return an object which represents the product

Throws:
RepositoryException - if there was an error attempting to find the item

findProducts

public RepositoryItem[] findProducts(java.lang.String[] pIds,
                                     java.lang.String pCatalogKey,
                                     RepositoryItem pCatalog)
                              throws RepositoryException
With the given id return an object which represents the product

Throws:
RepositoryException - if there was an error attempting to find the item

findProducts

public RepositoryItem[] findProducts(java.lang.String[] pIds,
                                     java.lang.String pCatalogKey)
                              throws RepositoryException
With the given id return an object which represents the product

Overrides:
findProducts in class CatalogTools
Throws:
RepositoryException - if there was an error attempting to find the item

findProducts

public RepositoryItem[] findProducts(java.lang.String[] pIds)
                              throws RepositoryException
With the given id return an object which represents the product

Overrides:
findProducts in class CatalogTools
Throws:
RepositoryException - if there was an error attempting to find the item

findSKU

public RepositoryItem findSKU(java.lang.String pId,
                              java.lang.String pCatalogKey,
                              boolean pVerifyCatalog)
                       throws RepositoryException
With the given id return an object which represents the sku

Throws:
RepositoryException - if there was an error attempting to find the item

findSKU

public RepositoryItem findSKU(java.lang.String pId,
                              java.lang.String pCatalogKey,
                              RepositoryItem pCatalog)
                       throws RepositoryException
With the given id return an object which represents the sku

Throws:
RepositoryException - if there was an error attempting to find the item

findSKU

public RepositoryItem findSKU(java.lang.String pId,
                              java.lang.String pCatalogKey)
                       throws RepositoryException
With the given id return an object which represents the sku

Overrides:
findSKU in class CatalogTools
Throws:
RepositoryException - if there was an error attempting to find the item

findSKU

public RepositoryItem findSKU(java.lang.String pId)
                       throws RepositoryException
With the given id return an object which represents the sku

Overrides:
findSKU in class CatalogTools
Throws:
RepositoryException - if there was an error attempting to find the item

findSKUs

public RepositoryItem[] findSKUs(java.lang.String[] pIds,
                                 java.lang.String pCatalogKey,
                                 boolean pVerifyCatalog)
                          throws RepositoryException
With the given ids return an array of objects which represent the skus

Throws:
RepositoryException - if there was an error attempting to find the items

findSKUs

public RepositoryItem[] findSKUs(java.lang.String[] pIds,
                                 java.lang.String pCatalogKey,
                                 RepositoryItem pCatalog)
                          throws RepositoryException
With the given ids return an array of objects which represent the skus

Throws:
RepositoryException - if there was an error attempting to find the items

findSKUs

public RepositoryItem[] findSKUs(java.lang.String[] pIds,
                                 java.lang.String pCatalogKey)
                          throws RepositoryException
With the given ids return an array of objects which represent the skus

Overrides:
findSKUs in class CatalogTools
Throws:
RepositoryException - if there was an error attempting to find the items

findSKUs

public RepositoryItem[] findSKUs(java.lang.String[] pIds)
                          throws RepositoryException
With the given ids return an array of objects which represent the skus

Overrides:
findSKUs in class CatalogTools
Throws:
RepositoryException - if there was an error attempting to find the items

getCurrentCatalog

public RepositoryItem getCurrentCatalog()
Get the catalog from the thread if specified as a thread local variable. Otherwise, get the catalog from the current user profile. The property used is profileCatalogPropertyName

See Also:
CatalogContext.setCurrentCatalog(RepositoryItem)

verifyCatalog

public boolean verifyCatalog(RepositoryItem pItem)
This method returns true if the given catalog appears in the given items "catalogs" list. Otherwise it returns false. The catalog used is the catalog stored in the profile.


verifyCatalog

public boolean verifyCatalog(RepositoryItem pItem,
                             RepositoryItem pCatalog)
This method returns true if the given catalog appears in the given items "catalogs" list. Otherwise it returns false


getRootCategoriesForCatalog

public java.util.Collection getRootCategoriesForCatalog(RepositoryItem pCatalog,
                                                        Repository pCatalogRepository)
                                                 throws RepositoryException
Return the list of all root categories for a catalog (including all root categories of the rootSubCatalogs

Throws:
RepositoryException

getCatalogsContainingThisCatalog

public java.util.Collection getCatalogsContainingThisCatalog(RepositoryItem pCatalog,
                                                             Repository pCatalogRepository)
                                                      throws RepositoryException
This method will return all the catalogs that contain the given catalog as a sub catalog.

Parameters:
pCatalog - The catalog whose "parents" will be returned
pCatalogRepository - The repository containing pCatalog
Throws:
RepositoryException

getProductsCategories

public java.util.Collection getProductsCategories(RepositoryItem pProduct,
                                                  Repository pCatalogRepository)
                                           throws RepositoryException
This method will return a list of the categories that the given product appears in. It does this by querying for all categories whose "fixedChildProducts" contains the given product.

Parameters:
pProduct - The product contained in all the returned categories
pCatalogRepository - The repository containing the given product
Throws:
RepositoryException

getAllAncestorCategories

public java.util.List getAllAncestorCategories(RepositoryItem pItem)
                                        throws RepositoryException
Throws:
RepositoryException

getCategoriesContainingThisCategorysCatalog

public java.util.Collection getCategoriesContainingThisCategorysCatalog(RepositoryItem pCategory,
                                                                        Repository pCatalogRepository)
                                                                 throws RepositoryException
Generate the immediate categories that can navigate to this category's catalog There are two ways this can happen 1. A category can have thisCategory.catalog in it's subCatalogs 2. A category can have a catalog in it's subcatalogs that contains thisCategory.catalog as a rootSubCatalog

Parameters:
pCategory - - category whose catalog to search for
PCatalogRepository - - the Catalog's repository
Returns:
Collection - all the categories that either contain this category's catalog as a subCatalog or contain a subCatalog that has this category's catalog as a rootSubCatalog
Throws:
RepositoryException

getCategoriesWithIndirectPathToCategory

public java.util.Collection getCategoriesWithIndirectPathToCategory(RepositoryItem pCategory)
                                                             throws RepositoryException
gets categories that contain the current category's catalog as a subCatalog, or any of the rootSubCatalogs as a subCatalog. Note it only does immediate categories, not the entire ancestor tree for each immediate category

Parameters:
pCategory - - category to process
Returns:
Collection - immediate (indirect)categories that have a path to this category.
Throws:
RepositoryException

getCategoriesWithIndirectPathToCatalog

public java.util.Collection getCategoriesWithIndirectPathToCatalog(RepositoryItem pCatalog)
                                                            throws RepositoryException
gets categories that contain the catalog as a subCatalog, or any of the rootSubCatalogs as a subCatalog. Note it only does immediate categories, not the entire ancestor tree for each

Parameters:
pCatalog - - catalog to process
Returns:
Collection - immediate (indirect)categories that have a path to this catalog
Throws:
RepositoryException

computeRecursedRootSubCatalogs

public java.util.Collection computeRecursedRootSubCatalogs(RepositoryItem pCatalog)
                                                    throws RepositoryException
method to compute the rootSubCatalog ancestor tree for a catalog

Parameters:
pCatalog - - catalog to process
Returns:
Collection - the rootSubCatalog tree
Throws:
RepositoryException

getCategoriesContainingThisCatalog

public java.util.Collection getCategoriesContainingThisCatalog(RepositoryItem pCatalog,
                                                               Repository pCatalogRepository)
                                                        throws RepositoryException
Generate the immediate categories that can navigate to this catalog. Only one level up is generated (i.e. immediate) There are two ways this can happen 1. A category can have thisCatalog in it's subCatalogs 2. A category can have a catalog in it's subcatalogs that contains thisCatalog as a rootSubCatalog

Parameters:
pCategory - - category whose catalog to search for
PCatalogRepository - - the Catalog's repository
Returns:
Collection - all the categories that either contain this catalog as a subCatalog or contain a subCatalog that has this catalog as a rootSubCatalog
Throws:
RepositoryException

isCategoryReferenced

public boolean isCategoryReferenced(RepositoryItem pCategory,
                                    RepositoryItem pCatalog,
                                    Repository pCatalogRepository)
                             throws RepositoryException
This method will check if the given category is included in any catalogs 'rootCategories' list or in any categories 'childCategories' list. In this implementation we only check the given catalog's rootCategories list. This is okay since we are assuming that CatalogVerificationService.verifyCategories has run

Parameters:
pCategory - The category to check
pCatalog - The catalog currently referenced by category.catalog
pCatalogRepository - The repository containing the category
Returns:
true if the category is referenced, false if it is not
Throws:
RepositoryException

setState

public void setState(java.lang.String pState)
              throws RepositoryException
This method will set the status for all the existing catalogs. This method will be used to track the status of CatalogMaintenanceService.

Parameters:
pState - The state of different Catalog Service
Throws:
RepositoryException

setState

public void setState(java.util.Collection pCatalogIds,
                     java.lang.String pState)
              throws RepositoryException
This method will set the status for the specified catalogs. This method will be used to track the status of CatalogMaintenanceService.

Parameters:
pCatalogIds - The collections of catalogs
pState - The state of different Catalog Service
Throws:
RepositoryException

filterCollectionByCatalog

public java.util.List filterCollectionByCatalog(RepositoryItem pCatalog,
                                                java.util.Collection pCollection)