|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object atg.nucleus.logging.VariableArgumentApplicationLoggingImpl atg.nucleus.GenericService atg.commerce.promotion.template.PromotionTemplateManager
public class PromotionTemplateManager
Manages operations involving the template registry used in promotions. The template registry stores the templates used in promotions.
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 | |
---|---|
PromotionTemplateManager()
|
Method Summary | |
---|---|
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 |
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 has the requested promotion type |
void |
performScheduledTask(Scheduler pScheduler,
ScheduledJob pJob)
Update the cache of templates on a configurable basis as defined by the schedule. |
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 |
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl |
---|
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, 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 |
---|
public static java.lang.String CLASS_VERSION
Constructor Detail |
---|
public PromotionTemplateManager()
Method Detail |
---|
public 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 void doStartService() throws ServiceException
doStartService
in class GenericService
ServiceException
- 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 Schedulable
pScheduler
- 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 template
atg.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 strings
atg.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 values
atg.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 values
atg.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 template
atg.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 template
atg.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 template
atg.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 template
atg.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 has the requested promotion type
pDocument
- A Document representation of a templatepType
- The template type
atg.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 get
atg.repository.editingtemplate.TemplateException
- if an error occurred parsing a template
or the required arguments are null
atg.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 template
atg.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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |