atg.commerce.catalog.custom
Class CatalogCompletionService

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

public class CatalogCompletionService
extends GenericService

This service performs incremental maintenance on the catalog system after changes have been made to the catalog structure in the UI. Methods are called from CatalogChangesListener when: a catalog is created a catalogFolder or catalog is added/removed as a child from another catalogFolder a catalog or category is added/removed as a child from another category or catalog. Methods are also called from CatalogChangesListener when sites are added or removed to/from a catalogFolder or catalog. Properties computed by this service: catalogFolder.siteIds catalog.directAncestorCatalogsAndSelf catalog.allRootCategories catalog.indirectAncestorCatalogs catalog.ancestorCategories catalog.siteIds category.parentCatalog category.catalogs category.siteIds

See Also:
CatalogChangesListener

Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
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
CatalogCompletionService()
           
 
Method Summary
 void addCatalogFolderToCatalogFolder(MutableRepositoryItem pParentFolder, MutableRepositoryItem pChildFolder)
          This method will update site property details for the new child catalog folder.
 void addCatalogToCatalog(MutableRepositoryItem pParentCatalog, MutableRepositoryItem pChildCatalog)
          This method performs the operations related to adding a catalog to another catalog's rootSubCatalogs.
 void addCatalogToCatalogFolder(MutableRepositoryItem pCatalogFolder, MutableRepositoryItem pCatalog)
          This method will update site property details for the new child catalog.
 void addCatalogToCategory(MutableRepositoryItem pCategory, MutableRepositoryItem pCatalog)
          This method performs the operations related to adding a catalog to a category's subCatalogs.
 void addCategoryToCatalog(MutableRepositoryItem pCatalog, MutableRepositoryItem pCategory)
          This method performs the operations related to adding a category to a catalog's rootCategories.
 void addCategoryToCategory(MutableRepositoryItem pParentCategory, MutableRepositoryItem pChildCategory)
          This method performs the operations related to adding a category to another category's fixedChildCategories.
 void addItemProperties(MutableRepositoryItem pItem, java.util.Collection<java.lang.String> pSiteIds, java.util.Collection<RepositoryItem> pDirectCatalogs, java.util.Collection<RepositoryItem> pIndirectCatalogs)
          Walks down the catalog tree, adding sites and catalogs to each catalog folder/catalog/ category, where applicable.
 void createCatalog(MutableRepositoryItem pCatalog)
          This method performs the operations related to the creation of a catalog.
 CatalogProperties getCatalogProperties()
          A helper class that holds commonly accessed reposority property and item names
 MutableRepository getCatalogRepository()
          Returns property catalogRepository
 CustomCatalogTools getCatalogTools()
          Returns property catalogTools
 javax.transaction.TransactionManager getTransactionManager()
          The beginning and ending of transactions are handled by the transaction manager.
 boolean isComputeSubCatalogs()
          Deprecated. catalog.subCatalogs is never computed by this service
 boolean isEnabled()
          Returns property enabled, which indicates if this service should compute any properties.
 void removeCatalogFolderFromCatalogFolder(MutableRepositoryItem pParentFolder, MutableRepositoryItem pChildFolder)
          This method will update site property details for the child catalog folder being removed.
 void removeCatalogFromCatalog(MutableRepositoryItem pParentCatalog, MutableRepositoryItem pChildCatalog)
          This method performs the operations related to removing a catalog from another catalog's rootSubCatalogs.
 void removeCatalogFromCatalogFolder(MutableRepositoryItem pCatalogFolder, MutableRepositoryItem pCatalog)
          This method will update site property details for the catalog being removed.
 void removeCatalogFromCategory(MutableRepositoryItem pCategory, MutableRepositoryItem pCatalog)
          This method performs the operations related to removing a catalog from a category's subCatalogs.
 void removeCategoryFromCatalog(MutableRepositoryItem pCatalog, MutableRepositoryItem pCategory)
          This method performs the operations related to removing a category from a catalog's rootCategories.
 void removeCategoryFromCategory(MutableRepositoryItem pParentCategory, MutableRepositoryItem pChildCategory)
          This method performs the operations related to removing a category from another category's fixedChildCategories.
 void removeItemProperties(RepositoryItem pItem, java.util.Collection<java.lang.String> pSiteIds, java.util.Collection<RepositoryItem> pCatalogs)
          Walks down the catalog, attempting to remove sites and catalogs from each catalog folder/catalog/category encountered.
 void setCatalogProperties(CatalogProperties pCatalogProperties)
           
 void setCatalogRepository(MutableRepository pCatalogRepository)
          Sets the GSA repository instance to modify.
 void setCatalogTools(CustomCatalogTools pCatalogTools)
          Sets the instance of CatalogTools to be used
 void setComputeSubCatalogs(boolean pComputeSubCatalogs)
          Deprecated. catalog.subCatalogs is never computed by this service
 void setEnabled(boolean pEnabled)
          Sets boolean indicating if this service should compute any properties
 void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
           
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, 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, reResolveThis, 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

CatalogCompletionService

public CatalogCompletionService()
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.


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 the instance of CatalogTools to be used


getCatalogTools

public CustomCatalogTools getCatalogTools()
Returns property catalogTools


setCatalogRepository

public void setCatalogRepository(MutableRepository pCatalogRepository)
Sets the GSA repository instance to modify.


getCatalogRepository

public MutableRepository getCatalogRepository()
Returns property catalogRepository


setComputeSubCatalogs

public void setComputeSubCatalogs(boolean pComputeSubCatalogs)
Deprecated. catalog.subCatalogs is never computed by this service

Sets boolean indicating if the subCatalogs property of the catalog item should be computed.


isComputeSubCatalogs

public boolean isComputeSubCatalogs()
Deprecated. catalog.subCatalogs is never computed by this service

Returns property computeSubCatalogs


setEnabled

public void setEnabled(boolean pEnabled)
Sets boolean indicating if this service should compute any properties


isEnabled

public boolean isEnabled()
Returns property enabled, which indicates if this service should compute any properties. A customer can disable this if this service is causing performance issues. If this is disabled, CatalogUpdateService must be run after changes have been made.


addCatalogFolderToCatalogFolder

public void addCatalogFolderToCatalogFolder(MutableRepositoryItem pParentFolder,
                                            MutableRepositoryItem pChildFolder)
                                     throws RepositoryException
This method will update site property details for the new child catalog folder. Where applicable, site information will be propagated down the tree for all descendants.

Parameters:
pParentFolder - repository item representing a parent catalog folder
pChildFolder - repository item representing a child catalog folder
Throws:
RepositoryException - if there was an error updating the sites property

addCatalogToCatalogFolder

public void addCatalogToCatalogFolder(MutableRepositoryItem pCatalogFolder,
                                      MutableRepositoryItem pCatalog)
                               throws RepositoryException
This method will update site property details for the new child catalog. Where applicable, site information will be propagated down the tree for all descendants.

Parameters:
pCatalogFolder - repository item representing a catalog folder
pCatalog - repository item representing a catalog folder
Throws:
RepositoryException - if there was an error updating the sites property

addCategoryToCatalog

public void addCategoryToCatalog(MutableRepositoryItem pCatalog,
                                 MutableRepositoryItem pCategory)
                          throws RepositoryException,
                                 CatalogLoopException
This method performs the operations related to adding a category to a catalog's rootCategories. This includes: - Adding the new child category to the "allRootCategories" property of the catalog it was added to, and all direct ancestors of that catalog. - Adding all "ancestorCategories" of the new parent catalog as "ancestorCategories" to all descendant catalogs of the new child category - Set the new child category's "parentCatalog" to the new parent catalog. - Updating site and catalog information based on the parent's relationships - Optionally, adding all descendant catalogs of the new child category as "subCatalogs" of the new parent catalog, plus all ancestor catalogs of that catalog.

Parameters:
pCatalog - - The repository item representing the parent catalog
pCategory - - The repository item representing the child category
Throws:
RepositoryException - if there is an error in any of the property changes
CatalogLoopException - if the new category causes the catalog to become a descendant of itself

addCatalogToCatalog

public void addCatalogToCatalog(MutableRepositoryItem pParentCatalog,
                                MutableRepositoryItem pChildCatalog)
                         throws RepositoryException,
                                CatalogLoopException
This method performs the operations related to adding a catalog to another catalog's rootSubCatalogs. This includes: - Adding all the categories in the child catalog's "allRootCategories" property to the "allRootCategories" of the new parent catalog, and all of its direct ancestor catalogs. - Adding the new parent catalog and all of its ancestor catalogs (direct or indirect) as "indirectAncestorCatalogs" of all indirect descendant catalogs of the new child catalog - Adding the "ancestorCategories" of the new parent category to the new child catalog and all descendant catalogs of the new child catalog. - Updating site and catalog information based on the parent's relationships - Optionally, adding the new child catalog, and all of it's "subCatalogs", as "subCatalogs" of the new parent catalog, and all ancestors of the parent catalog.

Parameters:
pParentCatalog - - The repository item representing the parent catalog
pChildCatalog - - The repository item representing the child catalog
Throws:
RepositoryException - if there is an error in any of the property changes
CatalogLoopException - if the operation creates a situation where a catalog is an ancestor of itself

addCatalogToCategory

public void addCatalogToCategory(MutableRepositoryItem pCategory,
                                 MutableRepositoryItem pCatalog)
                          throws RepositoryException,
                                 CatalogLoopException
This method performs the operations related to adding a catalog to a category's subCatalogs. This includes: - Adding all ancestor categories of the new parent category as "ancestorCategories" of the new child catalog, and all descendant catalogs of the new child catalog. - Updating site and catalog information based on the parent's relationships - Optionally, adding the new child catalog, and all descendant catalogs of the new child catalog as "subCatalogs" of the new parent category's containing catalog, and all ancestors of that catalog.

Parameters:
pCategory - - The repository item representing the parent category.
pCatalog - - The repository item representing the child catalog.
Throws:
RepositoryException - if there is an error in any of the property changes
CatalogLoopException - if the operation creates a situation where a catalog is an ancestor of itself

addCategoryToCategory

public void addCategoryToCategory(MutableRepositoryItem pParentCategory,
                                  MutableRepositoryItem pChildCategory)
                           throws RepositoryException,
                                  CatalogLoopException
This method performs the operations related to adding a category to another category's fixedChildCategories. This includes: - Adding the new parent category, and all ancestor categories of that category, as "ancestorCategories" of all descendant catalogs of the new child category. - Updating site and catalog information based on the parent's relationships - Optionally, adding the descendant catalogs of the new child category as "subCatalogs" of the parent category's containing catalog, and all ancestors of that catalog.

Parameters:
pParentCategory - - The repository item representing the parent category.
pChildCategory - - The repository item representing the child category.
Throws:
RepositoryException - if there is an error in any of the property changes
CatalogLoopException - if the added child category is an ancestor of the parent category

removeCatalogFolderFromCatalogFolder

public void removeCatalogFolderFromCatalogFolder(MutableRepositoryItem pParentFolder,
                                                 MutableRepositoryItem pChildFolder)
                                          throws RepositoryException
This method will update site property details for the child catalog folder being removed. Where applicable, site information will be propagated down the tree for all descendants.

Parameters:
pParentFolder - repository item representing a parent catalog folder
pChildFolder - repository item representing a child catalog folder
Throws:
RepositoryException - if there was an error updating the sites property

removeCatalogFromCatalogFolder

public void removeCatalogFromCatalogFolder(MutableRepositoryItem pCatalogFolder,
                                           MutableRepositoryItem pCatalog)
                                    throws RepositoryException
This method will update site property details for the catalog being removed. Where applicable, site information will be propagated down the tree for all descendants.

Parameters:
pCatalogFolder - repository item representing a catalog folder
pCatalog - repository item representing a catalog folder
Throws:
RepositoryException - if there was an error updating the sites property

removeCategoryFromCatalog

public void removeCategoryFromCatalog(MutableRepositoryItem pCatalog,
                                      MutableRepositoryItem pCategory)
                               throws RepositoryException
This method performs the operations related to removing a category from a catalog's rootCategories. This includes: - Removing the former child category from the "allRootCategories" property of the former parent catalog and all direct ancestors. - Removing all ancestor categories of the former parent catalog from the "ancestorCategories" property of all descendant catalogs of the former child category. - Setting the former child category's "parentCatalog" to null. - Updating site and catalog information based on the parent's relationships - Optionally, removing all descendant catalogs of the former child category from the "subCatalogs" property of the former parent catalog and all its ancestors.

Parameters:
pCatalog - - The repository item representing the former parent catalog
pCategory - - The repository item representing the former child category
Throws:
RepositoryException - if there is an error in any of the property changes

removeCatalogFromCatalog

public void removeCatalogFromCatalog(MutableRepositoryItem pParentCatalog,
                                     MutableRepositoryItem pChildCatalog)
                              throws RepositoryException
This method performs the operations related to removing a catalog from another catalog's rootSubCatalogs. This includes: - Removing all categories contained in the "allRootCategories" property in the former child catalog from the "allRootCategories" property of the former parent catalog and all direct ancestors. - Removing all "ancestorCategories" of the former parent catalog from the "ancestorCategories" property of the former child catalog and all descendant catalogs. - Updating site and catalog information based on the parent's relationships - Optionally, remove the former child catalog's "subCatalogs" from the former parent catalog and all ancestor catalogs.

Parameters:
pParentCatalog - - The repository item representing the former parent catalog.
pChildCatalog - - The repository item representing the former child catalog.
Throws:
RepositoryException - if there is an error in any of the property changes

removeCatalogFromCategory

public void removeCatalogFromCategory(MutableRepositoryItem pCategory,
                                      MutableRepositoryItem pCatalog)
                               throws RepositoryException
This method performs the operations related to removing a catalog from a category's subCatalogs. This includes: - Removing all ancestor categories of the old parent category from the "ancestorCategories" property of the former child catalog and all descendant catalogs. - Updating site and catalog information based on the parent's relationships - Optionally, remove the former child catalog and descendant catalogs from the "subCatalogs" property of the former parent category's containing catalog and all ancestors of the containing catalog.

Parameters:
pCategory - - The repository item representing the former parent category
pCatalog - - The repository item representing the former child catalog
Throws:
RepositoryException - if there is an error in any of the property changes

removeCategoryFromCategory

public void removeCategoryFromCategory(MutableRepositoryItem pParentCategory,
                                       MutableRepositoryItem pChildCategory)
                                throws RepositoryException
This method performs the operations related to removing a category from another category's fixedChildCategories. This includes: - Removing the former parent category and all ancestor categories of that category from the "ancestorCategories" property of all descendant catalogs of the former child category. - Updating site and catalog information based on the parent's relationships - Optionally, removing each descendant catalog of the former child category from the "subCatalogs" property of the former parent category's containing catalog and all ancestors of that catalog.

Parameters:
pParentCategory - - The repository item representing the former parent category
pChildCategory - - The repository item representing the former child category
Throws:
RepositoryException - if there is an error in any of the property changes

createCatalog

public void createCatalog(MutableRepositoryItem pCatalog)
                   throws RepositoryException
This method performs the operations related to the creation of a catalog. It sets the "directAncestorCatalogsAndSelf" property of the catalog to itself.

Parameters:
pCatalog - - The repository item representing the newly created catalog
Throws:
RepositoryException

addItemProperties

public void addItemProperties(MutableRepositoryItem pItem,
                              java.util.Collection<java.lang.String> pSiteIds,
                              java.util.Collection<RepositoryItem> pDirectCatalogs,
                              java.util.Collection<RepositoryItem> pIndirectCatalogs)
                       throws RepositoryException
Walks down the catalog tree, adding sites and catalogs to each catalog folder/catalog/ category, where applicable. If it is found that a particular descendant already contains all of the site and catalog info, the tree walk is suspended on that branch.

Parameters:
pItem - the item that is going to be updated
pSiteIds - a collection of new sites to add to the item
pDirectCatalogs - a collection of potential new direct catalogs
pIndirectCatalogs - a collection of potential new indirect catalogs
Throws:
RepositoryException - if there was an error when checking descendants

removeItemProperties

public void removeItemProperties(RepositoryItem pItem,
                                 java.util.Collection<java.lang.String> pSiteIds,
                                 java.util.Collection<RepositoryItem> pCatalogs)
                          throws RepositoryException
Walks down the catalog, attempting to remove sites and catalogs from each catalog folder/catalog/category encountered. If it is found that a particular descendant doesn't contain the sites and catalogs, the tree walk is suspended on that branch. Before either sites or catalog details can be removed, all parents (categories and catalogs) need to be checked in order to determine if the link we are trying to remove exists. For a catalog, it's assumed that property data (site or catalog) has already been removed before reaching here. In this case, we can inspect all descendants. For a category, we check if the information to be removed exists. If not, it has already been removed and we can stop processing on that branch.

Parameters:
pItem - the item that is going to be updated
pSiteIds - a collection of site for removal
pCatalogs - a collection of catalogs to remove
Throws:
RepositoryException - if there was an error when checking ancestors or descendants