atg.projects.store.catalog
Class StoreCatalogTools

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
                  extended by atg.projects.store.catalog.StoreCatalogTools
All Implemented Interfaces:
atg.commerce.catalog.CMSConstants, atg.dms.registry.MessageTyper, atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.logging.ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, atg.nucleus.naming.ComponentNameResolver, atg.nucleus.Service, atg.nucleus.ServiceListener, java.util.EventListener

public class StoreCatalogTools
extends atg.commerce.catalog.custom.CustomCatalogTools

The extensions to ootb CatalogTools. At the time of its writing, all it contained were the ids of the Store catalog and the corresponding repository items.


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_INVALID_PARENT_BRANCH, CUS_NAME_ALREADY_IN_USE, CUS_UNABLE_TO_GET_WS, CUS_UPDATECATALOGS, CUS_USING_CHECKED_IN_WS, CUS_VM_NOT_SET, CUS_WS_NOT_CREATED, CUS_WS_NOT_CREATED_INVALID_PARENT_BRANCH, CUS_WS_REQUIRED, 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
StoreCatalogTools()
           
 
Method Summary
 void doStartService()
          The E-commerce catalog id is set in a property file.
 atg.repository.RepositoryItem findSku(java.util.Collection pSkus, java.lang.String pColor, java.lang.String pSize)
          Finds the sku with the matching color and size.
 atg.repository.RepositoryItem getCatalog(java.lang.String pCatalogId)
          Get the catalog with the given id.
 java.util.List getPossibleColors(java.util.Collection pSkus)
          Returns a list of possible colors for a collection of skus.
 java.util.Map getPossibleColorSwatches(java.util.Collection pSkus)
          Creates a map of color names to swatch items.
 java.util.List getPossibleSizes(java.util.Collection pSkus)
          Returns the list of possible sizes for a given collection of skus.
 java.util.List getPossibleValuesForSkus(java.util.Collection pSkus, java.lang.String pPropertyName)
          Returns the list of possible values for a given collection of skus.
 java.util.Collection getProductChildSkus(atg.repository.RepositoryItem pProduct)
          Returns a product's child skus.
 java.lang.String getRootNavigationCategoryId()
           
 java.lang.String[] getSizeSortOrder()
           
 atg.repository.RepositoryItem getStoreCatalog()
           
 java.lang.String getStoreCatalogId()
           
 void setRootNavigationCategoryId(java.lang.String pRootNavigationCategoryId)
           
 void setSizeSortOrder(java.lang.String[] pSizeSortOrder)
           
 void setStoreCatalog(atg.repository.RepositoryItem item)
           
 void setStoreCatalogId(java.lang.String pStoreCatalogId)
           
 java.util.List sortColors(java.util.List pColors)
          Sorts a list of colors.
 java.util.List sortSizes(java.util.List pSizes)
          Sorts sizes accoring to the configured template.
 java.util.List sortStrings(java.util.List pStrings, java.lang.String[] pSortOrder)
          Sorts the collection of strings relative to their ordinal position in the sort order array.
 
Methods inherited from class atg.commerce.catalog.custom.CustomCatalogTools
computeRecursedRootSubCatalogs, filterCollectionByCatalog, findCatalogItem, findCatalogItem, findCatalogItems, findCatalogItems, findCategories, findCategories, findCategories, findCategories, findCategory, findCategory, findCategory, findCategory, findProduct, findProduct, findProduct, findProduct, findProducts, findProducts, findProducts, findProducts, findSKU, findSKU, findSKU, findSKU, findSKUs, findSKUs, findSKUs, findSKUs, getAllAncestorCategories, getAncestors, getAncestors, getBaseCatalogItemType, getCatalogBeanInfos, getCatalogItemTypes, getCatalogProperties, getCatalogsContainingThisCatalog, getCatalogsForRepository, getCatalogsProperty, getCatalogsThatIncludeCatalogInRootSubCatalogs, getCatalogsWithCategoryAsRoot, getCategoriesContainingThisCatalog, getCategoriesContainingThisCategorysCatalog, getCategoriesInCatalog, getCategoriesWithCatalogAsSubCatalog, getCategoriesWithIndirectPathToCatalog, getCategoriesWithIndirectPathToCategory, getCategorysInfoMapProperty, getCurrentCatalog, getParentCategories, getProductsCategories, getProductsInfoMapProperty, getProfileCatalogPropertyName, getRootCategoriesForCatalog, getSkusInfoMapProperty, getStatePropertyName, getTrackState, getTransactionManager, isCategoryReferenced, isReturnEmptyResults, isSaveCachedAncestors, setBaseCatalogItemType, setCatalogItemTypes, setCatalogProperties, setCatalogsProperty, setCategorysInfoMapProperty, setProductsInfoMapProperty, setProfileCatalogPropertyName, setReturnEmptyResults, setSaveCachedAncestors, setSkusInfoMapProperty, setState, setState, setStatePropertyName, setTrackState, setTransactionManager, verifyCatalog, verifyCatalog
 
Methods inherited from class atg.commerce.catalog.CatalogTools
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 java.lang.String CLASS_VERSION
Class version string.

Constructor Detail

StoreCatalogTools

public StoreCatalogTools()
Method Detail

getRootNavigationCategoryId

public java.lang.String getRootNavigationCategoryId()
Returns:
RootNavigationCategoryId.

setRootNavigationCategoryId

public void setRootNavigationCategoryId(java.lang.String pRootNavigationCategoryId)
Parameters:
pRootNavigationCategoryId - - new RootNavigationCategoryId.

getSizeSortOrder

public java.lang.String[] getSizeSortOrder()
Returns:
Returns the SizeSortOrder used for displaying sizes.

setSizeSortOrder

public void setSizeSortOrder(java.lang.String[] pSizeSortOrder)
Parameters:
pSizeSortOrder - The SizeSortOrder used for displaying sizes.

getStoreCatalogId

public java.lang.String getStoreCatalogId()
Returns:
The Store Catalog Id.

setStoreCatalogId

public void setStoreCatalogId(java.lang.String pStoreCatalogId)
Parameters:
pStoreCatalogId - - The Store Catalog Id.

getStoreCatalog

public atg.repository.RepositoryItem getStoreCatalog()
Returns:
The Store Catalog.

setStoreCatalog

public void setStoreCatalog(atg.repository.RepositoryItem item)
Parameters:
item - - The StoreCatalog.

doStartService

public void doStartService()
                    throws atg.nucleus.ServiceException

The E-commerce catalog id is set in a property file. The doStartService verifies that the catalog id does indeed refer to actual catalog in the repository.

Overrides:
doStartService in class atg.commerce.catalog.CatalogTools
Throws:
atg.nucleus.ServiceException - if error occurs

getCatalog

public atg.repository.RepositoryItem getCatalog(java.lang.String pCatalogId)
                                         throws atg.repository.RepositoryException
Get the catalog with the given id.

Parameters:
pCatalogId - - catalog id
Returns:
the catalog with the given id
Throws:
atg.repository.RepositoryException - if error occurs

getPossibleColors

public java.util.List getPossibleColors(java.util.Collection pSkus)
Returns a list of possible colors for a collection of skus.

Parameters:
pSkus - collection of skus
Returns:
a list of possible colors

getPossibleColorSwatches

public java.util.Map getPossibleColorSwatches(java.util.Collection pSkus)
Creates a map of color names to swatch items.

Parameters:
pSkus - - sku collection
Returns:
Map of color names to swatch media items

getPossibleSizes

public java.util.List getPossibleSizes(java.util.Collection pSkus)
Returns the list of possible sizes for a given collection of skus.

Parameters:
pSkus - collection of skus
Returns:
list of colors

getPossibleValuesForSkus

public java.util.List getPossibleValuesForSkus(java.util.Collection pSkus,
                                               java.lang.String pPropertyName)
Returns the list of possible values for a given collection of skus.

Parameters:
pSkus - collection of skus
pPropertyName - the property name of the sku to use.
Returns:
Collection of values

findSku

public atg.repository.RepositoryItem findSku(java.util.Collection pSkus,
                                             java.lang.String pColor,
                                             java.lang.String pSize)
Finds the sku with the matching color and size.

Parameters:
pSkus - collection of skus
pColor - - color name
pSize - - size name
Returns:
the matching child sku

getProductChildSkus

public java.util.Collection getProductChildSkus(atg.repository.RepositoryItem pProduct)
Returns a product's child skus.

Parameters:
pProduct - - product
Returns:
Collection of skus

sortColors

public java.util.List sortColors(java.util.List pColors)
Sorts a list of colors.

Parameters:
pColors - - list of pColors
Returns:
the sorted list of colors.

sortSizes

public java.util.List sortSizes(java.util.List pSizes)
Sorts sizes accoring to the configured template.

Parameters:
pSizes - - list of sizes
Returns:
List of sorted sizes
See Also:
getSizeSortOrder()

sortStrings

public java.util.List sortStrings(java.util.List pStrings,
                                  java.lang.String[] pSortOrder)
Sorts the collection of strings relative to their ordinal position in the sort order array.

Parameters:
pStrings - a collection of strings to sort
pSortOrder - the string array of possible values and their relative order.
Returns:
List of sorted Strings