When you are creating a multiple site environment, changing one environment object may affect another environment object. For example, if you change an order, it may change the site, price list, sale price list, user, ticket or other environment-managed objects.
In a multisite setting, environment management recognizes site support and manages site-related effects. Because basic site environment management support is added to Service Center, functions like pricing model holder initialization, site dependent changes or order dependent changes are supported using the /atg/svc/agent/environment/EnvironmentTools
API.
The atg.svc.agent.environment.EnvironmentTools
API is configured as follows:
/atg/svc/agent/environment/EnvironmentTools.java
public void addChangeSiteDetail(String pNewSiteId,
EnvironmentChangeState
pEnvironmentChangeState) throws EnvironmentChangeDetailConflict,
EnvironmentException {}
public Site getCurrentSite() throws EnvironmentException {}
public void setCurrentSite(Site pSite) throws EnvironmentException {}
The following methods are used to get or set site information:
addChangeSiteDetail
– This method adds site change detailsgetCurrentSite
– This method obtains the current site from theCurrentSiteHolder
setCurrentSite
– This method sets the current site in theCurrentSiteHolder
The ServiceEnvironmentMonitor
API also sets site information:
/atg/svc/agent/environment/ServiceEnvironmentMonitor.java
protected void
generateInitialChangesForChangeSite(EnvironmentChangeState
pEnvironmentChangeState) throws EnvironmentException {}
public void revertSiteChangeDetail(EnvironmentChangeDetail
pEnvironmentChangeDetail,EnvironmentChangeState
pEnvironmentChangeState) {}
public void applySiteChangeDetail(EnvironmentChangeDetail
pEnvironmentChangeDetail, EnvironmentChangeState
pEnvironmentChangeState)throws EnvironmentException {}
The ServiceEnvironmentMonitor
uses the following methods:
generateInitialChangesForChangeSite
– generates initial changes for the change siteapplySiteChangeDetail
– This method applies the site change information in theCurrentSiteHolder
revertSiteChangeDetail
– This method reverts site details to the old site details that are set in theCurrentSiteHolder