atg.commerce.catalog.custom
Class AncestorGeneratorService

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.service.scheduler.SchedulableService
              extended by atg.service.scheduler.SingletonSchedulableService
                  extended by atg.commerce.catalog.CMSService
                      extended by atg.commerce.catalog.custom.AncestorGeneratorService
All Implemented Interfaces:
atg.commerce.catalog.CMSConstants, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, Schedulable, java.util.EventListener

public class AncestorGeneratorService
extends atg.commerce.catalog.CMSService

This CMSService performs the following service functions Available service functions: AGS_GENCATALOGS - generate catalog and catalogs (for catalogs, products and skus) AGS_GENPARENTCATS - generate parent categories (for products) AGS_GENANCESTORS - generate ancestors (for products and skus)

See Also:
getAvailableFunctions, generateAncestors, generates the set of ancestor categories for each category and product in each catalog in the catalog repository, and updates the ancestorCategories property.

Methods generateCategoryAncestors and generateProductAncestors can be called to update the ancestors for only categories or products, respectively.

generateCatalogAndCatalogs, generates the catalog and catalogs properties for all categories, products and skus in each catalog generateCatalogParentCategoriesForProducts, generates the parent category at the catalog level. This is necessary when more than one category in a catalog has the same product as a childProduct.

Methods generateCatalogsForProducts , generateCatalogsForSkus and generateCatalogAndCatalogsForCategories can be called to update the catalogs and catalogs properties for only categories, products or skus, respectively.

This set is used in hierarchical search. You may limit this to specific catalogs by provide a Collection of catalog ids.,


Nested Class Summary
 
Nested classes/interfaces inherited from class atg.commerce.catalog.CMSService
atg.commerce.catalog.CMSService.BookkeepingForThread
 
Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.service.scheduler.SchedulableService
mJobId
 
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
AncestorGeneratorService()
           
 
Method Summary
 void generateAncestors()
          Generate and update the values of the ancestorCategories property for all categories and products in all specified product catalogs.
 void generateAncestors(java.util.Collection pCatalogIds)
          Generate and update the values of the ancestorCategories property for all categories and products in all specified product catalogs.
 void generateAncestors(Repository pCatalogRepository, java.util.Collection pCatalogIds)
          Generate and update the values of the ancestorCategories property for all categories and products in all specified product catalogs in the specified repository.
 void generateCatalogAndCatalogs()
          Generate and update the catalog and catalogs property for all categories, products and skus in all product catalog repositories and all catalogs.
 void generateCatalogAndCatalogs(Repository pRepository, java.util.Collection pCatalogIds)
          Generate and update the catalog and catalogs property for all categories, products and skus in all product catalog repositories and all catalogs.
 void generateCatalogAndCatalogsForCategories()
          Generate and update the values of the catalog and catalogs property for all categories in the specified repository and catalogs.
 void generateCatalogAndCatalogsForCategories(Repository pCatalogRepository, java.util.Collection pCatalogIds)
          Generate and update the values of the catalog and catalogs property for all categories in the specified repository and catalogs.
 void generateCatalogParentCategoriesForProducts()
          Generate and update the values of the parent category for catalogs.
 void generateCatalogParentCategoriesForProducts(Repository pCatalogRepository, java.util.Collection pCatalogIds)
          Generate and update the values of the parent category for catalogs.
 void generateCatalogsForProducts()
          Generate and update the values of the catalogs property for all products in the specified repository and catalogs.
 void generateCatalogsForProducts(Repository pCatalogRepository)
          Generate and update the values of the catalogs property for all products in the specified repository and catalogs.
 void generateCatalogsForSkus()
          Generate and update the values of the catalogs property for all skus in the specified repository and catalogs.
 void generateCatalogsForSkus(Repository pCatalogRepository)
          Generate and update the values of the catalogs property for all skus in the specified repository and catalogs.
 void generateCategoryAncestors()
          Generate and update the values of the ancestorCategories property for all categories in all product catalogs.
 void generateCategoryAncestors(java.util.Collection pCatalogIds)
          Generate and update the values of the ancestorCategories property for all categories in all specified product catalogs.
 void generateCategoryAncestors(Repository pCatalogRepository, java.util.Collection pCatalogIds)
          Generate and update the values of the ancestorCategories property for all categories in all specified product catalogs in the specified repository.
protected  java.util.Map generateEmptyMap()
          Helper method to return an empty map.
 void generateProductAncestors()
          Generate and update the values of the ancestorCategories property for all products in all product catalogs.
 void generateProductAncestors(java.util.Collection pCatalogIds)
          Generate and update the values of the ancestorCategories property for all products in all specified product catalogs.
 void generateProductAncestors(Repository pCatalogRepository, java.util.Collection pCatalogIds)
          Generate and update the values of the ancestorCategories property for all products in all specified product catalogs in the specified repository.
 CatalogProperties getCatalogProperties()
          A helper class that holds commonly accessed reposority property and item names
 java.lang.String[] getCatalogRepositories()
          Returns property catalogRepositories
 CustomCatalogTools getCatalogTools()
          Returns property catalogTools
 int getMaxItemsPerTransaction()
          Returns property maxItemsPerTransaction
 java.lang.String getServiceName()
           
 boolean performService(Repository pRepository, java.util.Collection pCatalogIds, java.util.List pServiceFunctions)
          Performs this services functions
protected  java.util.Collection removeSelfFromAncestors(RepositoryItem pCategory, java.util.Collection pAncestors)
          Remove pCategory from each of the lists mapped to in pAncestors
 void setCatalogProperties(CatalogProperties pCatalogProperties)
           
 void setCatalogRepositories(java.lang.String[] pCatalogRepositories)
          Sets property catalogRepositories
 void setCatalogTools(CustomCatalogTools pCatalogTools)
          Sets property catalogTools
 void setMaxItemsPerTransaction(int pMaxItemsPerTransaction)
          Sets property maxItemsPerTransaction
 void showMessages()
           
protected  java.lang.String stringIt(java.util.Collection pObject)
           
protected  java.lang.String stringIt(java.lang.Object[] pObject)
           
 
Methods inherited from class atg.commerce.catalog.CMSService
addErrorMessage, addInfoMessage, addWarningMessage, clearBookkeepingForThread, clearMessages, createCMSMessage, doScheduledTask, doService, getAvailableFunctions, getBookkeepingForThread, getCurrentMessages, getErrorMessages, getFunctionsToPerformByDefault, getInfoMessages, getServiceLock, getTotalNumberOfErrorMessages, getTotalNumberOfInfoMessages, getTotalNumberOfMessages, getTotalNumberOfWarningMessages, getTransactionManager, getWarningMessages, hasFunction, isSaveMessages, logDebug, logError, logInfo, logWarning, performService, postService, preService, removeServiceLock, setAvailableFunctions, setFunctionsToPerformByDefault, setSaveMessages, setTransactionManager
 
Methods inherited from class atg.service.scheduler.SingletonSchedulableService
acquireLock, getClientLockManager, getLockName, getLockTimeOut, performScheduledTask, releaseLock, setClientLockManager, setLockName, setLockTimeOut
 
Methods inherited from class atg.service.scheduler.SchedulableService
doStartService, doStopService, getJobDescription, getJobName, getSchedule, getScheduler, getThreadMethod, isTransactional, setJobDescription, setJobName, setSchedule, setScheduler, setThreadMethod, setTransactional, startScheduledJob, stopScheduledJob
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logError, logError, logInfo, logInfo, logTrace, logTrace, logTrace, 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

AncestorGeneratorService

public AncestorGeneratorService()
Method Detail

setCatalogRepositories

public void setCatalogRepositories(java.lang.String[] pCatalogRepositories)
Sets property catalogRepositories


getCatalogRepositories

public java.lang.String[] getCatalogRepositories()
Returns property catalogRepositories


setCatalogProperties

public void setCatalogProperties(CatalogProperties pCatalogProperties)

getCatalogProperties

public CatalogProperties getCatalogProperties()
A helper class that holds commonly accessed reposority property and item names


setCatalogTools

public void setCatalogTools(CustomCatalogTools pCatalogTools)
Sets property catalogTools


getCatalogTools

public CustomCatalogTools getCatalogTools()
Returns property catalogTools


setMaxItemsPerTransaction

public void setMaxItemsPerTransaction(int pMaxItemsPerTransaction)
Sets property maxItemsPerTransaction


getMaxItemsPerTransaction

public int getMaxItemsPerTransaction()
Returns property maxItemsPerTransaction


getServiceName

public java.lang.String getServiceName()
Specified by:
getServiceName in class atg.commerce.catalog.CMSService

generateCatalogAndCatalogs

public void generateCatalogAndCatalogs()
Generate and update the catalog and catalogs property for all categories, products and skus in all product catalog repositories and all catalogs. Note that only catalogs is set at the product and sku level.


generateCatalogAndCatalogs

public void generateCatalogAndCatalogs(Repository pRepository,
                                       java.util.Collection pCatalogIds)
Generate and update the catalog and catalogs property for all categories, products and skus in all product catalog repositories and all catalogs. Note that only the catalog property is set at the product and sku level.

Parameters:
pRepository - - the repository where the items reside. if null the repositories returned by getCatalogRepositories() are processed. otherwise the repository returned catalogTools.getCatalog() is used.
pCatalogIds - - a collection of catalog item repository ids. this collection is used to constrain the selection of categories, products and skus. if null all catalog items are processed

generateCatalogAndCatalogsForCategories

public void generateCatalogAndCatalogsForCategories()
Generate and update the values of the catalog and catalogs property for all categories in the specified repository and catalogs.


generateCatalogAndCatalogsForCategories

public void generateCatalogAndCatalogsForCategories(Repository pCatalogRepository,
                                                    java.util.Collection pCatalogIds)
Generate and update the values of the catalog and catalogs property for all categories in the specified repository and catalogs.

Parameters:
pCatalogRepository - - the repository where the items reside. if null the repositories returned by getCatalogRepositories() are processed. otherwise the repository returned catalogTools.getCatalog() is used.
pCatalogIds - - a collection of catalog item repository ids. this collection is used to constrain the selection of categories. if null all catalog items are processed

generateCatalogParentCategoriesForProducts

public void generateCatalogParentCategoriesForProducts()
Generate and update the values of the parent category for catalogs. This property maintains a map of a product's parent category for each catalog. Since each product may have more than one parent category in a catalog, one is arbitrarily chosen to be the designated parent (for navigation purposes)


generateCatalogParentCategoriesForProducts

public void generateCatalogParentCategoriesForProducts(Repository pCatalogRepository,
                                                       java.util.Collection pCatalogIds)
Generate and update the values of the parent category for catalogs. This property maintains a map of a product's parent category for each catalog. Since each product may have more than one parent category in a catalog, one is arbitrarily chosen to be the designated parent (for navigation purposes)

Parameters:
pRepository - - the repository where the items reside. if null the repositories returned by getCatalogRepositories() are processed. otherwise the repository returned catalogTools.getCatalog() is used.
pCatalogIds - - a collection of catalog item repository ids. this collection is used to constrain the selection of products if null all catalog items are processed

generateCatalogsForProducts

public void generateCatalogsForProducts()
Generate and update the values of the catalogs property for all products in the specified repository and catalogs. .


generateCatalogsForProducts

public void generateCatalogsForProducts(Repository pCatalogRepository)
Generate and update the values of the catalogs property for all products in the specified repository and catalogs. Catalogs must already be generated for categories.

Parameters:
pRepository - - the repository where the items reside. if null the repositories returned by getCatalogRepositories() are processed. otherwise the repository returned catalogTools.getCatalog() is used.

generateCatalogsForSkus

public void generateCatalogsForSkus()
Generate and update the values of the catalogs property for all skus in the specified repository and catalogs.


generateCatalogsForSkus

public void generateCatalogsForSkus(Repository pCatalogRepository)
Generate and update the values of the catalogs property for all skus in the specified repository and catalogs.

Parameters:
pRepository - - the repository where the items reside. if null the repositories returned by getCatalogRepositories() are processed. otherwise the repository returned catalogTools.getCatalog() is used.

stringIt

protected java.lang.String stringIt(java.util.Collection pObject)
Overrides:
stringIt in class atg.commerce.catalog.CMSService

stringIt

protected java.lang.String stringIt(java.lang.Object[] pObject)
Overrides:
stringIt in class atg.commerce.catalog.CMSService

generateAncestors

public void generateAncestors()
Generate and update the values of the ancestorCategories property for all categories and products in all specified product catalogs.


generateAncestors

public void generateAncestors(java.util.Collection pCatalogIds)
Generate and update the values of the ancestorCategories property for all categories and products in all specified product catalogs.

Parameters:
pCatalogIds - a collection of catalog ids. The type of each id is String If this param is null, all catalogs are assumed

generateAncestors

public void generateAncestors(Repository pCatalogRepository,
                              java.util.Collection pCatalogIds)
Generate and update the values of the ancestorCategories property for all categories and products in all specified product catalogs in the specified repository.

Parameters:
pCatalogRepository - - The repository to update
pCatalogIds - - a collection of catalog ids. The type of each id is String If this param is null, all catalogs are assumed

generateCategoryAncestors

public void generateCategoryAncestors()
Generate and update the values of the ancestorCategories property for all categories in all product catalogs.


generateCategoryAncestors

public void generateCategoryAncestors(java.util.Collection pCatalogIds)
Generate and update the values of the ancestorCategories property for all categories in all specified product catalogs.

Parameters:
pCatalogIds - a collection of catalog ids. The type of each id is String If this param is null, all catalogs are assumed

generateCategoryAncestors

public void generateCategoryAncestors(Repository pCatalogRepository,
                                      java.util.Collection pCatalogIds)
Generate and update the values of the ancestorCategories property for all categories in all specified product catalogs in the specified repository.

Parameters:
pCatalogRepository - The repository to update
pCatalogIds - a collection of catalog ids. The type of each id is String If this param is null, all catalogs are assumed

generateProductAncestors

public void generateProductAncestors()
Generate and update the values of the ancestorCategories property for all products in all product catalogs.


generateProductAncestors

public void generateProductAncestors(java.util.Collection pCatalogIds)
Generate and update the values of the ancestorCategories property for all products in all specified product catalogs.


generateProductAncestors

public void generateProductAncestors(Repository pCatalogRepository,
                                     java.util.Collection pCatalogIds)
Generate and update the values of the ancestorCategories property for all products in all specified product catalogs in the specified repository.

Parameters:
pCatalogRepository - The repository to update
pCatalogIds - a collection of catalog ids. The type of each id is String If this param is null, all catalogs are assumed

generateEmptyMap

protected java.util.Map generateEmptyMap()
Helper method to return an empty map.


removeSelfFromAncestors

protected java.util.Collection removeSelfFromAncestors(RepositoryItem pCategory,
                                                       java.util.Collection pAncestors)
Remove pCategory from each of the lists mapped to in pAncestors

Parameters:
pCategory - The category to remove from each list of ancestors
pAncestors - The mapping of catalogIds to ancestors to update.

showMessages

public void showMessages()

performService

public boolean performService(Repository pRepository,
                              java.util.Collection pCatalogIds,
                              java.util.List pServiceFunctions)
Performs this services functions

Specified by:
performService in class atg.commerce.catalog.CMSService
Parameters:
pRepository - - Catalog repository to operate against
pCatalogIds - - a collection of catalogs to process
pServiceFunctions - - a list of strings that identify service functions. used to conditionally executed specific functions of a service
Returns:
boolean - service success or failure
See Also:
generateCatalogAndCatalogs(), generateCatalogParentCategoriesForProducts(), generateCatalogParentCategoriesForProducts(), generateAncestors()