public class AncestorGeneratorService
extends atg.commerce.catalog.CMSService
The primary public method in this class, performService, generates the set of ancestor categories for each category and product in the product catalog, and updates the ancestorCategories property for each category and product to contain the appropriate set. This set is used in hierarchical search.
Methods generateCategoryAncestors> and generateProductAncestors can be called to update the ancestors for only categories or products, respectively.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
mJobId
SERVICE_INFO_KEY
AGS_GENANCESTORS, AGS_GENANCESTORS_FOR_CATEGORY, AGS_GENANCESTORS_FOR_PRODUCT, AGS_GENCATALOGS, AGS_GENCATALOGS_FOR_CATEGORY, AGS_GENCATALOGS_FOR_PRODUCT, AGS_GENCATALOGS_FOR_SKU, AGS_GENPARENTCATS, AGS_GENPROPERTIES, AGS_GENPROPERTIES_FOR_CATEGORY, AGS_GENPROPERTIES_FOR_PRODUCT, 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_FOLDER_ITEM_TYPE, DEFAULT_CATALOG_ITEM_TYPE, DEFAULT_MAP_SIZE, GENERATED_ANCESTORS_MAP, INFOS_GENERATED, IS_ANCESTORS_GENERATED_MAP, LEVEL_DEBUG, LEVEL_ERROR, LEVEL_INFO, LEVEL_WARNING, NO_PATH, NOT_GENERATOR, TYPE_ANCESTOR, TYPE_CATALOGMAINTENANCE, TYPE_CUSTOM_MIGRATION, TYPE_MIGRATION, TYPE_UPDATE, TYPE_VERIFY, VALID_PATH
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
AncestorGeneratorService() |
Modifier and Type | Method and Description |
---|---|
void |
generateAncestors()
Generate and update the values of the ancestorCategories property for all
categories and products in all specified product catalogs.
|
void |
generateAncestors(Repository pRepository)
Generate and update the values of the ancestorCategories property for all
categories and products in all specified product catalogs.
|
protected java.util.Set |
generateAncestorsForCategory(RepositoryItem pCategory,
Repository pCatalog)
Recursive subroutine for topLevelGenerateAncestorsForCategory
|
void |
generateCategoryAncestors()
Generate and update the values of the ancestorCategories property for all
categories in all specified product catalogs.
|
void |
generateCategoryAncestors(Repository pRepository)
Generate and update the values of the ancestorCategories property for all
categories in all specified product catalogs.
|
protected void |
generateCategoryAncestorsForCurrentCatalog(Repository pCatalog)
Generate and update the values of the ancestorCategories property for all
categories in the current product catalog.
|
protected java.util.Set |
generateEmptySet()
Helper method to return an empty set.
|
void |
generateProductAncestors()
Generate and update the values of the ancestorCategories property for all
products in all specified product catalogs.
|
void |
generateProductAncestors(Repository pRepository)
Generate and update the values of the ancestorCategories property for all
products in all specified product catalogs.
|
protected void |
generateProductAncestorsForCurrentCatalog(Repository pCatalog)
Generate and update the values of the ancestorCategories property for all
products in the current product catalog.
|
java.lang.String |
getAncestorCategoriesPropertyName()
Returns property ancestorCategoriesPropertyName
|
java.lang.String[] |
getCatalogs()
Returns property catalogs
|
CatalogTools |
getCatalogTools()
Returns property catalogTools
|
java.lang.String |
getCategoryItemName()
Returns property categoryItemName
|
protected RepositoryView |
getCategoryRepositoryView(Repository pCatalog)
Helper method to get the RepositoryView for finding category items
|
java.util.Stack |
getCategoryStack()
Returns property useShortTransactions
|
java.lang.String |
getChildCategoriesPropertyName()
Returns property childCategoriesPropertyName
|
java.lang.String |
getChildProductsPropertyName()
Returns property childProductsPropertyName
|
java.lang.String |
getIdPropertyName()
The name of the id property for categories, products, and skus
|
java.lang.String |
getJobDescription()
Get property
jobDescription |
java.lang.String |
getJobName()
Get property
jobName |
int |
getMaxItemsPerTransaction()
Returns property maxItemsPerTransaction
|
java.lang.String |
getProductItemName()
Returns property productItemName
|
protected RepositoryView |
getProductRepositoryView(Repository pCatalog)
Helper method to get the RepositoryView for finding product items
|
Scheduler |
getScheduler()
Returns property Scheduler
|
java.lang.String |
getServiceName() |
javax.transaction.TransactionManager |
getTransactionManager()
Returns property transactionManager
|
Schedule |
getUpdateSchedule()
Returns property UpdateSchedule
|
boolean |
performService(Repository pRepository,
java.util.Collection pCatalogIds,
java.util.List pServiceFunctions)
Performs this services functions
|
void |
setAncestorCategoriesPropertyName(java.lang.String pAncestorCategoriesPropertyName)
Sets property ancestorCategoriesPropertyName
|
protected void |
setAncestorsForCategory(RepositoryItem pCategory,
java.util.Collection pAncestors,
Repository pCatalog)
Helper method to set the ancestorCategories property for a category
|
protected void |
setAncestorsForProduct(RepositoryItem pProduct,
java.util.Collection pAncestors,
Repository pCatalog)
Helper method to set the ancestorCategories property for a product
|
void |
setCatalogs(java.lang.String[] pCatalogs)
Sets property catalogs
|
void |
setCatalogTools(CatalogTools pCatalogTools)
Sets property catalogTools
|
void |
setCategoryItemName(java.lang.String pCategoryItemName)
Sets property categoryItemName
|
void |
setCategoryStack(java.util.Stack pCategoryStack)
Sets property categoryStack
|
void |
setChildCategoriesPropertyName(java.lang.String pChildCategoriesPropertyName)
Sets property childCategoriesPropertyName
|
void |
setChildProductsPropertyName(java.lang.String pChildProductsPropertyName)
Sets property childProductsPropertyName
|
void |
setIdPropertyName(java.lang.String pIdPropertyName) |
void |
setMaxItemsPerTransaction(int pMaxItemsPerTransaction)
Sets property maxItemsPerTransaction
|
void |
setProductItemName(java.lang.String pProductItemName)
Sets property productItemName
|
void |
setScheduler(Scheduler pScheduler)
Sets property Scheduler
|
void |
setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Sets property transactionManager
|
void |
setUpdateSchedule(Schedule pUpdateSchedule)
Sets property UpdateSchedule
|
protected java.util.Set |
topLevelGenerateAncestorsForCategory(RepositoryItem pCategory,
Repository pCatalog)
Generate the set of all ancestor categories for a given category, using the
recursive method generateAncestorsForCategory
|
protected void |
updateAncestorsForProduct(RepositoryItem pProduct,
Repository pCatalog)
Generate the set of ancestor categories for a given product and set its
ancestorCategories property to that set
|
addErrorMessage, addInfoMessage, addWarningMessage, clearBookkeepingForThread, clearMessages, createCMSMessage, doScheduledTask, doService, getAvailableFunctions, getBookkeepingForThread, getCurrentMessages, getErrorMessages, getFunctionsToPerformByDefault, getInfoMessages, getServiceLock, getTotalNumberOfErrorMessages, getTotalNumberOfInfoMessages, getTotalNumberOfMessages, getTotalNumberOfWarningMessages, getWarningMessages, hasFunction, isSaveMessages, logDebug, logError, logInfo, logWarning, performService, postService, preService, removeServiceLock, setAvailableFunctions, setFunctionsToPerformByDefault, setSaveMessages, stringIt, stringIt
acquireLock, getClientLockManager, getLockName, getLockTimeOut, performScheduledTask, releaseLock, setClientLockManager, setLockName, setLockTimeOut
doStartService, doStopService, getJobId, getSchedule, getThreadMethod, getThreadMethodString, isTransactional, setJobDescription, setJobName, setSchedule, setThreadMethod, setThreadMethodString, setTransactional, startScheduledJob, stopScheduledJob
addLogListener, createAdminServlet, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logError, logError, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public java.lang.String getServiceName()
getServiceName
in class atg.commerce.catalog.CMSService
public java.lang.String getJobName()
jobName
getJobName
in class SchedulableService
jobName
public java.lang.String getJobDescription()
jobDescription
getJobDescription
in class SchedulableService
jobDescription
public void setScheduler(Scheduler pScheduler)
setScheduler
in class SchedulableService
pScheduler
- new value to setpublic Scheduler getScheduler()
getScheduler
in class SchedulableService
scheduler
public void setUpdateSchedule(Schedule pUpdateSchedule)
public Schedule getUpdateSchedule()
public void setAncestorCategoriesPropertyName(java.lang.String pAncestorCategoriesPropertyName)
public java.lang.String getAncestorCategoriesPropertyName()
public void setChildCategoriesPropertyName(java.lang.String pChildCategoriesPropertyName)
public java.lang.String getChildCategoriesPropertyName()
public void setChildProductsPropertyName(java.lang.String pChildProductsPropertyName)
public java.lang.String getChildProductsPropertyName()
public void setIdPropertyName(java.lang.String pIdPropertyName)
public java.lang.String getIdPropertyName()
public void setCatalogTools(CatalogTools pCatalogTools)
public CatalogTools getCatalogTools()
public void setCatalogs(java.lang.String[] pCatalogs)
public java.lang.String[] getCatalogs()
public void setCategoryItemName(java.lang.String pCategoryItemName)
public java.lang.String getCategoryItemName()
public void setProductItemName(java.lang.String pProductItemName)
public java.lang.String getProductItemName()
public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
setTransactionManager
in class atg.commerce.catalog.CMSService
public javax.transaction.TransactionManager getTransactionManager()
getTransactionManager
in class atg.commerce.catalog.CMSService
public void setMaxItemsPerTransaction(int pMaxItemsPerTransaction)
public int getMaxItemsPerTransaction()
public void setCategoryStack(java.util.Stack pCategoryStack)
public java.util.Stack getCategoryStack()
public boolean performService(Repository pRepository, java.util.Collection pCatalogIds, java.util.List pServiceFunctions)
performService
in class atg.commerce.catalog.CMSService
pRepository
- - Catalog repository to operate againstpCatalogIds
- - a collection of catalogs to processpServiceFunctions
- - a list of strings that identify service functions. used to
conditionally executed specific functions of a servicepublic void generateAncestors()
public void generateAncestors(Repository pRepository)
pRepository
- - Catalog repository to operate againstpublic void generateCategoryAncestors()
public void generateCategoryAncestors(Repository pRepository)
pRepository
- - Catalog repository to operate againstpublic void generateProductAncestors()
public void generateProductAncestors(Repository pRepository)
pRepository
- - Catalog repository to operate againstprotected void generateCategoryAncestorsForCurrentCatalog(Repository pCatalog)
pCatalog
- current catalog to operate onprotected void generateProductAncestorsForCurrentCatalog(Repository pCatalog)
pCatalog
- current catalog to operate onprotected void updateAncestorsForProduct(RepositoryItem pProduct, Repository pCatalog) throws RepositoryException
N.B. This assumes that all categories already have their ancestorCategories property set correctly.
pProduct
- the product whose ancestorCategories property should be setpCatalog
- current catalog to operate onRepositoryException
protected java.util.Set generateEmptySet()
protected void setAncestorsForCategory(RepositoryItem pCategory, java.util.Collection pAncestors, Repository pCatalog) throws RepositoryException
pCategory
- the category whose ancestorCategories property should be setpAncestors
- what to set it topCatalog
- current catalog to operate onRepositoryException
protected void setAncestorsForProduct(RepositoryItem pProduct, java.util.Collection pAncestors, Repository pCatalog) throws RepositoryException
pProduct
- the product whose ancestorCategories property should be setpAncestors
- what to set it topCatalog
- current catalog to operate onRepositoryException
protected java.util.Set topLevelGenerateAncestorsForCategory(RepositoryItem pCategory, Repository pCatalog) throws RepositoryException
Also detect cycles of parentage
pCategory
- the category whose ancestors should be foundpCatalog
- current catalog to operate onRepositoryException
generateAncestorsForCategory
protected java.util.Set generateAncestorsForCategory(RepositoryItem pCategory, Repository pCatalog) throws RepositoryException
pCategory
- the category whose ancestors should be foundpCatalog
- current catalog to operate onRepositoryException
topLevelGenerateAncestorsForCategory
protected RepositoryView getCategoryRepositoryView(Repository pCatalog) throws RepositoryException
pCatalog
- current catalog to operate onRepositoryException
protected RepositoryView getProductRepositoryView(Repository pCatalog) throws RepositoryException
pCatalog
- current catalog to operate onRepositoryException