public class InfoGeneratorService extends GenericService
This service examines the product catalog and ensures that every category has a category-info object for each catalog it is contained in, that every product has a product-info for each catalog it is contained in, and that every sku has a sku-info for each catalog it is contained in.
This service will also ensure that the catalogs properties for categories, products, and skus are up to date.
You may limit this to specific catalogs by provide a Collection of catalog ids.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
InfoGeneratorService() |
Modifier and Type | Method and Description |
---|---|
protected RepositoryItem |
addCategoryInfo(RepositoryItem pCategory,
RepositoryItem pCatalog,
java.util.Map pCategoryInfos,
Repository pCatalogRepository)
Create a new category info object and add it to the map.
|
protected RepositoryItem |
addProductInfo(RepositoryItem pProduct,
RepositoryItem pCatalog,
RepositoryItem pParentCategory,
java.util.Map pProductInfos,
Repository pCatalogRepository)
Create a new product info object and add it to the map.
|
protected RepositoryItem |
addSkuInfo(RepositoryItem pSku,
RepositoryItem pCatalog,
RepositoryItem pParentProduct,
java.util.Map pSkuInfos,
Repository pCatalogRepository)
Create a new sku info object and add it to the map.
|
protected RepositoryItem |
createCategoryInfoItem(RepositoryItem pCategory,
RepositoryItem pCatalog,
Repository pCatalogRepository)
This method will create a new categoryInfo repository item.
|
protected RepositoryItem |
createProductInfoItem(RepositoryItem pProduct,
RepositoryItem pCatalog,
Repository pCatalogRepository)
This method will create a new productInfo repository item.
|
protected RepositoryItem |
createSkuInfoItem(RepositoryItem pSku,
RepositoryItem pCatalog,
Repository pCatalogRepository)
This method will create a new skuInfo repository item.
|
void |
generateCategoryInfoObjects()
Iterate through all catalog and create the category-info objects
|
void |
generateCategoryInfoObjects(java.util.Collection pCatalogIds)
Iterate through the catalog and create the category-info objects,
for the given catalogs.
|
void |
generateCategoryInfoObjects(Repository pCatalogRepository,
java.util.Collection pCatalogIds)
Iterate through the catalog and create the category-info objects,
for the given catalogs in the given repository.
|
void |
generateInfoObjects()
This method generates info objects for all categories, products,
and skus, for all catalogs.
|
void |
generateInfoObjects(java.util.Collection pCatalogIds)
This method generates info objects for all categories, products,
and skus, for the given catalogs.
|
void |
generateInfoObjects(Repository pCatalogRepository,
java.util.Collection pCatalogIds)
This method generates info objects for all categories, products,
and skus, for the given catalogs within the given repository.
|
void |
generateProductInfoObjects()
Iterate through the catalog and create the product-info objects
|
void |
generateProductInfoObjects(java.util.Collection pCatalogIds)
Iterate through the catalog and create the product-info objects,
for the given catalogs.
|
void |
generateProductInfoObjects(Repository pCatalogRepository,
java.util.Collection pCatalogIds)
Iterate through the catalog and create the product-info objects,
for the given catalogs.
|
void |
generateSkuInfoObjects()
Iterate through the catalog and create the sku-info objects
|
void |
generateSkuInfoObjects(java.util.Collection pCatalogIds)
Iterate through the catalog and create the sku-info objects, for
the given catalogs.
|
void |
generateSkuInfoObjects(Repository pCatalogRepository,
java.util.Collection pCatalogIds)
Iterate through the catalog and create the sku-info objects, for
the given catalogs.
|
protected RepositoryItem |
getBaseCategoryInfo(RepositoryItem pCategoryInfo,
RepositoryItem pCategory,
RepositoryItem pCatalog)
This method is used to provide a source of information when populating a category info.
|
protected RepositoryItem |
getBaseProductInfo(RepositoryItem pProductInfo,
RepositoryItem pProduct,
RepositoryItem pCatalog)
This method is used to provide a source of information when populating a product info.
|
protected RepositoryItem |
getBaseSkuInfo(RepositoryItem pSkuInfo,
RepositoryItem pSku,
RepositoryItem pCatalog)
This method is used to provide a source of information when populating a sku info.
|
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
|
java.lang.String[] |
getCategoryInfoPropertiesToCopy()
The list of properties that are copied inside
populateCategoryInfo from the info returned by
getBaseCategoryInfo |
int |
getMaxItemsPerTransaction()
Returns property maxItemsPerTransaction
|
java.lang.String[] |
getProductInfoPropertiesToCopy()
The list of properties that are copied inside
populateProductInfo from the info returned by
getBaseProductInfo |
java.lang.String[] |
getSkuInfoPropertiesToCopy()
The list of properties that are copied inside
populateSkuInfo from the info returned by
getBaseSkuInfo |
javax.transaction.TransactionManager |
getTransactionManager()
Returns property transactionManager
|
boolean |
isAttemptToPopulateNewInfoItems()
If this is true, this class will attempt to populate any new info
items with the information from another info.
|
boolean |
isCheckForUnreferencedCategories()
If true, an extra check is made for each category.
|
boolean |
isDeleteUnreferencedInfoItems()
If this is true, then an info that is no longer in an items map
of catalog specific information will be removed from the
repository
The default is true.
|
protected RepositoryItem |
populateCategoryInfoItem(RepositoryItem pCategoryInfo,
RepositoryItem pCategory,
RepositoryItem pCatalog)
Populate the given category info object.
|
protected RepositoryItem |
populateProductInfoItem(RepositoryItem pProductInfo,
RepositoryItem pProduct,
RepositoryItem pParentCategory,
RepositoryItem pCatalog)
Populate the given product info object.
|
protected RepositoryItem |
populateSkuInfoItem(RepositoryItem pSkuInfo,
RepositoryItem pSku,
RepositoryItem pParentProduct,
RepositoryItem pCatalog)
Populate the given sku info object.
|
protected boolean |
removeInfoMapEntry(java.util.Map pInfoMap,
java.lang.String pCatalogId,
Repository pCatalogRepository)
Remove the given key from the map.
|
void |
setAttemptToPopulateNewInfoItems(boolean pAttemptToPopulateNewInfoItems) |
void |
setCatalogProperties(CatalogProperties pCatalogProperties) |
void |
setCatalogRepositories(java.lang.String[] pCatalogRepositories)
Sets property catalogRepositories
|
void |
setCatalogTools(CustomCatalogTools pCatalogTools)
Sets property catalogTools
|
void |
setCategoryInfoPropertiesToCopy(java.lang.String[] pCategoryInfoPropertiesToCopy) |
void |
setCheckForUnreferencedCategories(boolean pCheckForUnreferencedCategories) |
void |
setDeleteUnreferencedInfoItems(boolean pDeleteUnreferencedInfoItems) |
void |
setMaxItemsPerTransaction(int pMaxItemsPerTransaction)
Sets property maxItemsPerTransaction
|
void |
setProductInfoPropertiesToCopy(java.lang.String[] pProductInfoPropertiesToCopy) |
void |
setSkuInfoPropertiesToCopy(java.lang.String[] pSkuInfoPropertiesToCopy) |
void |
setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Sets property transactionManager
|
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
public void setCatalogProperties(CatalogProperties pCatalogProperties)
public CatalogProperties getCatalogProperties()
public void setCatalogTools(CustomCatalogTools pCatalogTools)
public CustomCatalogTools getCatalogTools()
public void setCatalogRepositories(java.lang.String[] pCatalogRepositories)
public java.lang.String[] getCatalogRepositories()
public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
public javax.transaction.TransactionManager getTransactionManager()
public void setMaxItemsPerTransaction(int pMaxItemsPerTransaction)
public int getMaxItemsPerTransaction()
public void setCategoryInfoPropertiesToCopy(java.lang.String[] pCategoryInfoPropertiesToCopy)
public java.lang.String[] getCategoryInfoPropertiesToCopy()
populateCategoryInfo
from the info returned by
getBaseCategoryInfo
public void setProductInfoPropertiesToCopy(java.lang.String[] pProductInfoPropertiesToCopy)
public java.lang.String[] getProductInfoPropertiesToCopy()
populateProductInfo
from the info returned by
getBaseProductInfo
public void setSkuInfoPropertiesToCopy(java.lang.String[] pSkuInfoPropertiesToCopy)
public java.lang.String[] getSkuInfoPropertiesToCopy()
populateSkuInfo
from the info returned by
getBaseSkuInfo
public void setAttemptToPopulateNewInfoItems(boolean pAttemptToPopulateNewInfoItems)
public boolean isAttemptToPopulateNewInfoItems()
CatalogVerificationService
The default is true.public void setDeleteUnreferencedInfoItems(boolean pDeleteUnreferencedInfoItems)
public boolean isDeleteUnreferencedInfoItems()
public void setCheckForUnreferencedCategories(boolean pCheckForUnreferencedCategories)
public boolean isCheckForUnreferencedCategories()
public void generateInfoObjects()
public void generateInfoObjects(java.util.Collection pCatalogIds)
pCatalogIds
- a collection of catalog ids. The type of each id is String
If this param is null, all catalogs are assumedpublic void generateInfoObjects(Repository pCatalogRepository, java.util.Collection pCatalogIds)
pCatalogRepository
- The repository to updatepCatalogIds
- a collection of catalog ids. The type of each id is String
If this param is null, all catalogs are assumedpublic void generateCategoryInfoObjects()
public void generateCategoryInfoObjects(java.util.Collection pCatalogIds)
pCatalogIds
- a collection of catalog ids. The type of each id is String
If this param is null, all catalogs are assumedpublic void generateCategoryInfoObjects(Repository pCatalogRepository, java.util.Collection pCatalogIds)
pCatalogRepository
- The repository to updatepCatalogIds
- a collection of catalog ids. The type of each id is String
If this param is null, all catalogs are assumedpublic void generateProductInfoObjects()
public void generateProductInfoObjects(java.util.Collection pCatalogIds)
pCatalogIds
- a collection of catalog ids. The type of each id is String
If this param is null, all catalogs are assumedpublic void generateProductInfoObjects(Repository pCatalogRepository, java.util.Collection pCatalogIds)
pCatalogRepository
- The repository to updatepCatalogIds
- a collection of catalog ids. The type of each id is String
If this param is null, all catalogs are assumedpublic void generateSkuInfoObjects()
public void generateSkuInfoObjects(java.util.Collection pCatalogIds)
pCatalogIds
- a collection of catalog ids. The type of each id is String
If this param is null, all catalogs are assumedpublic void generateSkuInfoObjects(Repository pCatalogRepository, java.util.Collection pCatalogIds)
pCatalogRepository
- The repository to updatepCatalogIds
- a collection of catalog ids. The type of each id is String
If this param is null, all catalogs are assumedprotected RepositoryItem addCategoryInfo(RepositoryItem pCategory, RepositoryItem pCatalog, java.util.Map pCategoryInfos, Repository pCatalogRepository) throws RepositoryException
populateCategoryInfoItem
pCategory
- The category that will contain the new info itempCatalog
- The catalog that will map to the new info itempCategoryInfos
- The map of category info items, that the new info item will be added topCatalogRepository
- The repository that will store the new info itemRepositoryException
createCategoryInfoItem(atg.repository.RepositoryItem, atg.repository.RepositoryItem, atg.repository.Repository)
,
#populatedCategoryInfoItem
protected RepositoryItem createCategoryInfoItem(RepositoryItem pCategory, RepositoryItem pCatalog, Repository pCatalogRepository) throws RepositoryException
pCategory
- The category that will contain the new infopCatalog
- The catalog that maps to the new infopCatalogRepository
- The repository that will contain the new infoRepositoryException
protected RepositoryItem populateCategoryInfoItem(RepositoryItem pCategoryInfo, RepositoryItem pCategory, RepositoryItem pCatalog) throws RepositoryException
getBaseCategoryInfo
and use the returned item as the source of any information other than parentCategory. If
getBaseCategoryInfo
returns null, then copyInfoProperites
is called.
If attemptToPopulateNewInfoItems
is false, then nothing is populated and the
category info object passed in is returned. If attemptToPopulateNewInfoItems
is true,
it is important to run the CatalogVerificationService
to ensure that the new info
does not reference items outside of the correct catalog.pCategoryInfo
- The categoryInfo that will be updatedpCategory
- The category that contains this infopCatalog
- The catalog that maps to the info itemRepositoryException
getBaseCategoryInfo(atg.repository.RepositoryItem, atg.repository.RepositoryItem, atg.repository.RepositoryItem)
protected RepositoryItem getBaseCategoryInfo(RepositoryItem pCategoryInfo, RepositoryItem pCategory, RepositoryItem pCatalog) throws RepositoryException
pCategoryInfo
- The info that will be populate based on what is returned by this methodpCategory
- The category containing both info itemspCatalog
- The catalog that maps to pCategoryInfoRepositoryException
protected RepositoryItem addProductInfo(RepositoryItem pProduct, RepositoryItem pCatalog, RepositoryItem pParentCategory, java.util.Map pProductInfos, Repository pCatalogRepository) throws RepositoryException
populateProductInfoItem
pProduct
- The product that will contain the new info itempCatalog
- The catalog that will map to the new info itempParentCategory
- The new value for productInfo.parentCategorypProductInfos
- The map of product info items, that the new info item will be added topCatalogRepository
- The repository that will store the new info itemRepositoryException
createProductInfoItem(atg.repository.RepositoryItem, atg.repository.RepositoryItem, atg.repository.Repository)
,
#populatedProductInfoItem
protected RepositoryItem createProductInfoItem(RepositoryItem pProduct, RepositoryItem pCatalog, Repository pCatalogRepository) throws RepositoryException
pProduct
- The product that will contain the new infopCatalog
- The catalog that maps to the new infopCatalogRepository
- The repository that will contain the new infoRepositoryException
protected RepositoryItem populateProductInfoItem(RepositoryItem pProductInfo, RepositoryItem pProduct, RepositoryItem pParentCategory, RepositoryItem pCatalog) throws RepositoryException
getBaseProductInfo
and use the returned item as the source of any information other than parentCategory. If
getBaseProductInfo
returns null, then the only property that gets populated is
parentCategory. If attemptToPopulateNewInfoItems
is false, then the only property
that gets populated is parentCategory. If attemptToPopulateNewInfoItems
is true,
it is important to run the CatalogVerificationService
to ensure that the new info
does not reference items outside of the correct catalog.pProductInfo
- The productInfo that will be updatedpProduct
- The product that contains this infopParentCategory
- The new value for pProductInfo.parentCategorypCatalog
- The catalog that maps to the info itemRepositoryException
getBaseProductInfo(atg.repository.RepositoryItem, atg.repository.RepositoryItem, atg.repository.RepositoryItem)
protected RepositoryItem getBaseProductInfo(RepositoryItem pProductInfo, RepositoryItem pProduct, RepositoryItem pCatalog) throws RepositoryException
pProductInfo
- The info that will be populate based on what is returned by this methodpProduct
- The product containing both info itemspCatalog
- The catalog that maps to pProductInfoRepositoryException
protected RepositoryItem addSkuInfo(RepositoryItem pSku, RepositoryItem pCatalog, RepositoryItem pParentProduct, java.util.Map pSkuInfos, Repository pCatalogRepository) throws RepositoryException
populateSkuInfoItem
pSku
- The sku that will contain the new info itempCatalog
- The catalog that will map to the new info itempParentCategory
- The new value for skuInfo.parentCategorypSkuInfos
- The map of sku info items, that the new info item will be added topCatalogRepository
- The repository that will store the new info itemRepositoryException
createSkuInfoItem(atg.repository.RepositoryItem, atg.repository.RepositoryItem, atg.repository.Repository)
,
#populatedSkuInfoItem
protected RepositoryItem createSkuInfoItem(RepositoryItem pSku, RepositoryItem pCatalog, Repository pCatalogRepository) throws RepositoryException
pSku
- The sku that will contain the new infopCatalog
- The catalog that maps to the new infopCatalogRepository
- The repository that will contain the new infoRepositoryException
protected RepositoryItem populateSkuInfoItem(RepositoryItem pSkuInfo, RepositoryItem pSku, RepositoryItem pParentProduct, RepositoryItem pCatalog) throws RepositoryException
getBaseSkuInfo
and use the returned item as the source of any information other than parentCategory. If
getBaseSkuInfo
returns null or if attemptToPopulateNewInfoItems
is
false, nothing gets populated. If attemptToPopulateNewInfoItems
is true,
it is important to run the CatalogVerificationService
to ensure that the new info
does not reference items outside of the correct catalog.pSkuInfo
- The skuInfo that will be updatedpSku
- The sku that contains this infopParentCategory
- The new value for pSkuInfo.parentCategorypCatalog
- The catalog that maps to the info itemRepositoryException
getBaseSkuInfo(atg.repository.RepositoryItem, atg.repository.RepositoryItem, atg.repository.RepositoryItem)
protected RepositoryItem getBaseSkuInfo(RepositoryItem pSkuInfo, RepositoryItem pSku, RepositoryItem pCatalog) throws RepositoryException
pSkuInfo
- The info that will be populate based on what is returned by this methodpSku
- The sku containing both info itemspCatalog
- The catalog that maps to pSkuInfoRepositoryException
protected boolean removeInfoMapEntry(java.util.Map pInfoMap, java.lang.String pCatalogId, Repository pCatalogRepository)
deleteUnreferencedInfoItems
remove the item from the repository.
Return true if something was removed from the repository.