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, atg.nucleus.logging.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 or when a catalog or category is added or removed as a child from another category or catalog. Properties computed by this service: catalog.directAncestorCatalogsAndSelf catalog.allRootCategories catalog.indirectAncestorCatalogs catalog.ancestorCategories category.parentCategory category.parentCatalog Optionally, catalog.subCatalogs will be maintained

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 addCatalogToCatalog(MutableRepositoryItem pParentCatalog, MutableRepositoryItem pChildCatalog)
          This method performs the operations related to adding a catalog to another catalog's rootSubCatalogs.
 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 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()
          Returns property computeSubCatalogs
 boolean isEnabled()
          Returns property enabled, which indicates if this service should compute any properties.
 void removeCatalogFromCatalog(MutableRepositoryItem pParentCatalog, MutableRepositoryItem pChildCatalog)
          This method performs the operations related to removing a catalog from another catalog's rootSubCatalogs.
 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 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)
          Sets boolean property indicating whether to compute the catalogs' subCatalogs property.
 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, 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)
Sets boolean property indicating whether to compute the catalogs' subCatalogs property.


isComputeSubCatalogs

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


addCategoryToCatalog

public void addCategoryToCatalog(MutableRepositoryItem pCatalog,
                                 MutableRepositoryItem pCategory)
                          throws RepositoryException,
                                 MultipleCatalogException
This method performs the operations related to adding a category to a catalog's rootCategories. This includes: - Checking to see if the category's "catalog" property is null. If this category already exists in a different catalog, then adding the category to another catalog is an illegal operation. If this happens, CatalogCompletionService will then remove the category from the rootCategories of the catalog that it was just added to, throw an error informing the user of the mistake, and abort any further maintenance. - Adding the new child category to the "allRootCategories" property of the catalog it was added to, and all direct ancestors of that catalog. - Adding the new parent catalog and all of that catalog's ancestor catalogs as "indirectAncestorCatalogs" to all descedant catalogs of the new child category. - 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. - 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
MultipleCatalogException - if the category already exists in a different catalog

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 it's direct ancestor catalogs to the "directAncestorCatalogsAndSelf" property of the new child catalog and all direct descendant catalogs of the new child catalog. - Adding all "indirectAncestorCatalogs" of the new parent catalog to the "indirectAncestorCatalogs" of the new child catalog and all direct descendant catalogs of the new child catalog. - 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. - 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 the new parent category's containing catalog, and all ancestors of that catalog, as "indirectAncestorCatalogs" to the new child catalog, and all descendant catalogs of the new child catalog as an ancestor. - 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. - 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,
                                  MultipleCatalogException
This method performs the operations related to adding a category to another category's fixedChildCategories. This includes: - Checking to see if the "catalog" property of both the parent and child category are the same. If the child category already belonged to a catalog other than the one that contains the parent category, then this is an illegal operation. In this case, we remove the child category from the parent category's "fixedChildCategories", throw an error, and end processing. - Adding the parent category's containing catalog, and all ancestor catalogs of that catalog as "indirectAncestorCatalogs" of all descendant catalogs of the new child category. - Adding the new parent category, and all ancestor categories of that category, as "ancestorCategories" of all descendant catalogs of the new child category. - Adding the new parent category as the "parentCategory" if the child category ONLY IF the "parentCategory" of the child category is null. If it is not null, then the child category already has another parent, which will remain the main parent (for upward tree traversal purposes), unless the user chooses to specifically change this via the UI. - 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
MultipleCatalogException - if the category already exists in a different catalog

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 the former parent catalog and all ancestors of that catalog from the "indirectAncestorCatalogs" property of all descendant catalogs of the former child category - 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. - 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 the former parent catalog and all direct ancestors of that catalog from the "directAncestorCatalogsAndSelf" property of the former child catalog and all direct descendant catalogs - Removing the former parent catalog and all direct ancestors of the catalog from the "indirectAncestorCatalogs" proeprty of all indirect descenadants of the former child catalog - Removing all "indirectAncestorCatalogs" of the former parent catalog from the "indirectAncestorCatalogs" property of the former child catalog and all descendant catalogs (direct or indirect). - 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. - 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 the former parent category's containing catalog, and all ancestors of that catalog, from the "indirectAncestorCatalogs" property of the former child catalog and descendant catalogs. - Removing all ancestor categories of the old parent category from the "ancestorCategories" property of the former child catalog and all descendant catalogs. - 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 catalog's containing catalog, and all ancestors (direct or indirect) of that catalog from the "indirectAncestorCatalogs" property of all descendant catalogs of the former child category. - 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. - Checking to see if the former child category's "parentCategory" property is the former parent category. If so, it sees if the child category has any other parents that it can reset this property to. - 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