public class PromotionTemplateManager extends GenericService implements Schedulable
| Modifier and Type | Field and Description | 
|---|---|
static java.lang.String | 
CLASS_VERSION
Class version string 
 | 
SERVICE_INFO_KEYDEFAULT_LOG_TRACE_STATUSDEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS| Constructor and Description | 
|---|
PromotionTemplateManager()  | 
| Modifier and Type | Method and Description | 
|---|---|
protected boolean | 
canDisplay(java.lang.String pPath,
          java.lang.String pType)
 Determines if the template can be displayed in the promotions ui. 
 | 
void | 
doStartService()
Adds the update job to the scheduler 
 | 
java.util.Map<java.lang.String,java.lang.Object> | 
getAllProperties(java.lang.String pPath,
                java.util.Map<java.lang.String,java.lang.String> pPlaceholderReplacements)
 Gets all the properties in the template pPath. 
 | 
java.util.Map<java.lang.String,java.lang.Object> | 
getAllProperties(java.lang.String pPath,
                java.util.Map<java.lang.String,java.lang.String> pPlaceholderReplacements,
                java.util.List<java.lang.String> pExclusionList)
 Calls getAllProperties(String, Map) but removes the properties whose name
 appears in the pExclusionList 
 | 
protected java.util.Map<java.lang.String,java.lang.String> | 
getAttributesMap(java.lang.String pPath,
                java.lang.String pTag)
 Gets the attributes of a node and returns them in a Map where the keys 
 are the attribute names and the values are the attribute values. 
 | 
protected org.w3c.dom.Document | 
getDocument(java.lang.String pPath)
 Gets a document from the registry 
 | 
Repository | 
getProductCatalog()
Returns the product catalog repository 
 | 
java.lang.Object | 
getProperty(java.lang.String pPropertyName,
           java.lang.String pPath,
           java.util.Map<java.lang.String,java.lang.String> pPlaceholderReplacements,
           boolean pReplaceEmtpyPlaceholders)
 Gets the property specified by pPropertyName from the template pPath. 
 | 
java.util.Map<java.lang.String,java.lang.Object> | 
getPropertyPlaceholdersMap(java.lang.String pPath)
 Returns a Map containing a template property name and either a List of 
 place holders associated with this template property, or a List of Maps
 associated with this property if the property has sub properties. 
 | 
atg.repository.editingtemplate.RepositoryItemEditingTemplateParser | 
getRepositoryItemEditingTemplateParser()
Gets the RepositoryItemEditingTemplateParser 
 | 
Schedule | 
getSchedule()
Gets the schedule 
 | 
Scheduler | 
getScheduler()
Gets the scheduler 
 | 
java.util.Map<java.lang.String,java.util.Map> | 
getTemplateInfoForUI(java.lang.String pType)
 Filters a map of templates with a specified type for the templates
 which firstly, have a ui-description section and secondly whose
 display-in-ui attribute is set to true. 
 | 
java.lang.String | 
getTemplateItemType(java.lang.String pPath)
 Returns the item-type (e.g "Shipping Discount") attribute of the promotion
 template at pPath. 
 | 
atg.commerce.service.registry.TemplateRegistry | 
getTemplateRegistry()
Gets the template registry 
 | 
java.lang.String | 
getTemplateUIDescription(java.lang.String pPath)
 Returns the  
 | 
protected boolean | 
isDisplayAttributeTrue(org.w3c.dom.Document pDocument)
 Determines whether or not the available-in-ui attribute is set 
 | 
protected boolean | 
isPromotionTypeCorrect(org.w3c.dom.Document pDocument,
                      java.lang.String pType)
 Determines if the current template's type (or one of its super-types) matches
 that of the requested promotion's type. 
 | 
void | 
performScheduledTask(Scheduler pScheduler,
                    ScheduledJob pJob)
 Update the cache of templates on a configurable basis as 
 defined by the schedule. 
 | 
void | 
setProductCatalog(Repository pProductCatalog)
Sets the product catalog repository 
 | 
void | 
setRepositoryItemEditingTemplateParser(atg.repository.editingtemplate.RepositoryItemEditingTemplateParser pRepositoryItemEditingTemplateParser)
Sets the RepositoryItemEditingTemplateParser 
 | 
void | 
setSchedule(Schedule pSchedule)
Sets the schedule 
 | 
void | 
setScheduler(Scheduler pScheduler)
Sets the scheduler 
 | 
void | 
setTemplateRegistry(atg.commerce.service.registry.TemplateRegistry pTemplateRegistry)
Sets the template registry 
 | 
void | 
updateTemplateCache()
 Updates the template registrys cache to reflect the templates stored 
 in the registry. 
 | 
protected boolean | 
validRoot(org.w3c.dom.Element pRoot)
 Determines if this document has a valid generic template root 
 | 
addLogListener, createAdminServlet, 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, toStringvlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarningpublic Scheduler getScheduler()
public void setScheduler(Scheduler pScheduler)
public Schedule getSchedule()
public void setSchedule(Schedule pSchedule)
public atg.repository.editingtemplate.RepositoryItemEditingTemplateParser getRepositoryItemEditingTemplateParser()
public void setRepositoryItemEditingTemplateParser(atg.repository.editingtemplate.RepositoryItemEditingTemplateParser pRepositoryItemEditingTemplateParser)
public atg.commerce.service.registry.TemplateRegistry getTemplateRegistry()
public void setTemplateRegistry(atg.commerce.service.registry.TemplateRegistry pTemplateRegistry)
public Repository getProductCatalog()
public void setProductCatalog(Repository pProductCatalog)
pProductCatalog - the product catalog repositorypublic void doStartService()
                    throws ServiceException
doStartService in class GenericServiceServiceException - if the Service had a problem starting uppublic void performScheduledTask(Scheduler pScheduler, ScheduledJob pJob)
Update the cache of templates on a configurable basis as defined by the schedule.
performScheduledTask in interface SchedulablepScheduler - calling the jobpJob - the ScheduledJobpublic java.util.Map<java.lang.String,java.util.Map> getTemplateInfoForUI(java.lang.String pType)
                                                                   throws atg.repository.editingtemplate.TemplateException
Filters a map of templates with a specified type for the templates which firstly, have a ui-description section and secondly whose display-in-ui attribute is set to true. This means the template author intended them to be displayed in the UI.
If there are no templates matching pType or there are no templates which are displayable in the ui then an empty map will be returned.
atg.repository.editingtemplate.TemplateException - if an error occurred parsing the template
 or if the required pType is null.public void updateTemplateCache()
                         throws atg.service.registry.RegistryException
Updates the template registrys cache to reflect the templates stored in the registry. Any changes to templates will be picked up by this action.
atg.service.registry.RegistryException - if an error occurred reading a template in 
 the registrypublic java.lang.String getTemplateUIDescription(java.lang.String pPath)
                                          throws atg.repository.editingtemplate.TemplateException
 Returns the 
pPath - The full path to a templateatg.repository.editingtemplate.TemplateException - If the required argument pPath is null or there
 is a problem parsing the templatepublic java.lang.Object getProperty(java.lang.String pPropertyName,
                                    java.lang.String pPath,
                                    java.util.Map<java.lang.String,java.lang.String> pPlaceholderReplacements,
                                    boolean pReplaceEmtpyPlaceholders)
                             throws atg.repository.editingtemplate.TemplateException
Gets the property specified by pPropertyName from the template pPath. If there are place holders in the property value then the Map pPlaceholderReplacements will be used to replace them.
 A property will be returned as a string, unless the property has itself has 
 properties (name=value pairs), in this case a List of Maps will be returned. 
 Each Map in the list represents a sub 
pPath - The full path to a templatepPropertyName - The name of a template propertypPlaceholderReplacements - A map of key=value pairs representing 
 place holder names and place holder valuespReplaceEmtpyPlaceholders - Flag to indicate whether to replace empty 
 placeholders with empty stringsatg.repository.editingtemplate.TemplateException - If the required argument pPath is null or there
 is a problem parsing the templatepublic java.util.Map<java.lang.String,java.lang.Object> getAllProperties(java.lang.String pPath,
                                                                         java.util.Map<java.lang.String,java.lang.String> pPlaceholderReplacements)
                                                                  throws atg.repository.editingtemplate.TemplateException
Gets all the properties in the template pPath. Any place holders in the property values will be replaced by the replacement values specified in pPlaceholderReplacements Map.
pPath - The full template pathpPlaceholderReplacements - A map of key=value pairs representing 
 place holder names and place holder valuesatg.repository.editingtemplate.TemplateException - If the required argument pPath is null or there
 is a problem parsing the templatepublic java.util.Map<java.lang.String,java.lang.Object> getAllProperties(java.lang.String pPath,
                                                                         java.util.Map<java.lang.String,java.lang.String> pPlaceholderReplacements,
                                                                         java.util.List<java.lang.String> pExclusionList)
                                                                  throws atg.repository.editingtemplate.TemplateException
Calls getAllProperties(String, Map) but removes the properties whose name appears in the pExclusionList
pPath - The full template pathpExclusionList - A list of properties which will not appear in the 
 returned Map.pPlaceholderReplacements - A map of key=value pairs representing 
 place holder names and place holder valuesatg.repository.editingtemplate.TemplateException - If the required argument pPath is null or there
 is a problem parsing the templatepublic java.util.Map<java.lang.String,java.lang.Object> getPropertyPlaceholdersMap(java.lang.String pPath)
                                                                            throws atg.repository.editingtemplate.TemplateException
Returns a Map containing a template property name and either a List of place holders associated with this template property, or a List of Maps associated with this property if the property has sub properties.
pPath - The path to a templateatg.repository.editingtemplate.TemplateException - If the required argument pPath is null or there
 is a problem parsing the templatepublic java.lang.String getTemplateItemType(java.lang.String pPath)
                                     throws atg.repository.editingtemplate.TemplateException
Returns the item-type (e.g "Shipping Discount") attribute of the promotion template at pPath. If the template at pPath does not exist then null is returned.
pPath - A path to a promotions templateatg.repository.editingtemplate.TemplateException - If the required argument pPath is null or the
 promotions template at pPath does not have the required attributes.protected boolean canDisplay(java.lang.String pPath,
                             java.lang.String pType)
                      throws atg.repository.editingtemplate.TemplateException
Determines if the template can be displayed in the promotions ui. The "available-in-ui" ui-description attribute must be true and the promotion type must be of the requested type
pPath - A path to a templatepType - The type of templateatg.repository.editingtemplate.TemplateException - if either of the required parameters are null
 or there is a problem getting the template from the registryprotected boolean isDisplayAttributeTrue(org.w3c.dom.Document pDocument)
                                  throws atg.repository.editingtemplate.TemplateException
Determines whether or not the available-in-ui attribute is set
pDocument - A Document representation of a templateatg.repository.editingtemplate.TemplateException - If the template is not a promotions templateprotected boolean isPromotionTypeCorrect(org.w3c.dom.Document pDocument,
                                         java.lang.String pType)
                                  throws atg.repository.editingtemplate.TemplateException
Determines if the current template's type (or one of its super-types) matches that of the requested promotion's type. .
pDocument - A Document representation of a templatepType - The template typeatg.repository.editingtemplate.TemplateException - If the template is not a promotions templateprotected java.util.Map<java.lang.String,java.lang.String> getAttributesMap(java.lang.String pPath,
                                                                            java.lang.String pTag)
                                                                     throws atg.service.registry.RegistryException,
                                                                            atg.repository.editingtemplate.TemplateException
Gets the attributes of a node and returns them in a Map where the keys are the attribute names and the values are the attribute values. If the node has no attributes null is returned.
pPath - the path to the templatepTag - the element whose attributes to getatg.repository.editingtemplate.TemplateException - if an error occurred parsing a template 
 or the required arguments are nullatg.service.registry.RegistryException - if an error occurred reading the template in 
 the registryprotected org.w3c.dom.Document getDocument(java.lang.String pPath)
                                    throws atg.repository.editingtemplate.TemplateException
Gets a document from the registry
pPath - The full path to a templateatg.repository.editingtemplate.TemplateException - If a problem occurred retrieving the template
 from the registryprotected boolean validRoot(org.w3c.dom.Element pRoot)
Determines if this document has a valid generic template root
pRoot - The document element of the template