atg.svc.agent.environment
Class EnvironmentTools

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.svc.agent.environment.EnvironmentTools
All Implemented Interfaces:
atg.naming.NameContextBindingListener, atg.naming.NameContextElement, atg.naming.NameResolver, atg.nucleus.AdminableService, atg.nucleus.logging.ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, atg.nucleus.naming.ComponentNameResolver, atg.nucleus.Service, atg.nucleus.ServiceListener, java.util.EventListener

public class EnvironmentTools
extends atg.nucleus.GenericService

This class provides the API for changing and accessing the agent's environment. The "environment" consist of several related objects that the agent interacts with while using the application. Whenever the objects are changed by something explicitly or implicitly done by the agent, this API is used to broadcast details of the change to the participating applications so they can react appropriately. For example, if the agent changes the current active customer, the framework will automatically ensure the ticket is updated or a new ticket provided (if the ticket owner cannot be changed).

Applications participate in this process by creating an EnvironmentMonitor component and adding it to this component's environmentMonitors property.

Each environment change is identified by a unique change key.


Field Summary
static java.lang.String AGENT_PROFILE_COMPONENT_PATH
          The agent profile component path
static java.lang.String CALL_STATE_COMPONENT_PATH
          The call state component path
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String DEFAULT_TICKET_CREATE_CHANNEL
          Creation channel used to create a new ticket when a channel isn't provided
static java.lang.String ENVIRONMENTTOOLS_PATH
          The path to the EnvironmentTools component
protected  java.lang.String mAgentApplicationContextRoot
           
protected  java.lang.String mAgentApplicationName
           
protected  java.lang.String mAgentUserType
           
protected  EnvironmentMonitor[] mEnvironmentMonitors
           
protected  atg.svc.agent.events.FrameworkEventTools mEventTools
          Used to record agent audit recoder events used for reporting and external integration hooks
protected static EnvironmentTools mGlobalEnvironmentTools
           
protected  atg.repository.Repository mInternalProfileRepository
           
protected  java.lang.String mLocaleToolsPath
           
protected  atg.web.messaging.MessageTools mMessageTools
           
protected  atg.security.GenericSecurityDomain mSecurityDomain
           
protected  atg.multisite.SiteContextManager mSiteContextManager
           
protected  atg.ticketing.TicketingManager mTicketingManager
           
protected  TicketingTools mTicketingTools
           
protected  atg.servlet.security.UserLoginManager mUserLoginManager
           
static java.lang.String VIEW_CUSTOMER_PROFILE_COMPONENT_PATH
          The view customer profile component path
static java.lang.String VIEW_TICKET_HOLDER_COMPONENT_PATH
          view ticket holder component path
 
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
EnvironmentTools()
           
 
Method Summary
 void addChangeActiveProfileDetail(java.lang.String pProfileId, EnvironmentChangeState pEnvironmentChangeState)
          Adds a EnvironmentChangeDetail to the EnvironmentChangeState that indicates a change to the active profile item.
 void addChangeActiveTicketDetail(java.lang.String pTicketId, EnvironmentChangeState pEnvironmentChangeState)
          Adds a EnvironmentChangeDetail to the EnvironmentChangeState that indicates a change to the active ticket item.
 void addChangeSiteDetail(atg.multisite.Site pNewSite, EnvironmentChangeState pEnvironmentChangeState)
          Adds a change site detail for loading an existing site.
 void addChangeSiteDetail(java.lang.String pNewSiteId, EnvironmentChangeState pEnvironmentChangeState)
          Adds a change site detail for loading an existing site.
 void addNewActiveProfileDetail(java.lang.String pProfileId, EnvironmentChangeState pEnvironmentChangeState)
          Adds an EnvironmentChangeDetail for a new active customer profile change.
 void addNewActiveTicketDetail(EnvironmentChangeState pEnvironmentChangeState)
          Adds a EnvironmentChangeDetail to the EnvironmentChangeState that indicates a new ticket ticket item.
 void applyChanges(EnvironmentChangeState pEnvironmentChangeState)
          Calls each EnvironmentMonitor to apply the change details in the EnvironmentChangeState
 void changeActiveTicket(java.lang.String pApplicationName, java.lang.String pTicketId, TicketDispositionOptions pTicketDispositionOptions)
          Changes the environment's active ticket to the given ticket
 void changeNewActiveTicket(java.lang.String pApplicationName)
          Changes the environment's active ticket to a new ticket
 void changeUser(atg.repository.RepositoryItem pNewProfile, atg.userprofiling.Profile pCustomerProfile)
          This method loads a new customer profile into the customer profile object.
 void changeUser(java.lang.String pNewProfileId, atg.userprofiling.Profile pCustomerProfile)
          Loads a new profile into the customer profile object.
 java.lang.String conformRedirectURL(java.lang.String pContextRoot, java.lang.String pURL)
          if the pURL contains the context root, then the URL is not modified and returned.
 java.util.Locale convertLocale(java.lang.Object pLocale)
          Convert an object to a Locale.
 EnvironmentChangeState createEnvironmentChangeState()
          Returns a new EnvironmentChangeState object
 void createWarningsForChangeEnvironment(EnvironmentChangeState pEnvironmentChangeState)
          Calls each EnvironmentMonitor to add warnings related to the EnvironmentChangeState related to the pending changes detailed in the state.
 boolean currentUserHasAccessRight(java.lang.String pAccessRightName)
          Return true if the current user has a named access right.
 boolean doesProfileExist(java.lang.String pProfileId)
          Determines if a profile exists with the given id
 void endCall(EnvironmentChangeState pEnvironmentChangeState)
          Ends the call in the the current call state and sends end call event.
 void generateChangeDetails(EnvironmentChangeState pEnvironmentChangeState)
          Generates the List of EnvironmentChangeDetails for the given environment change.
 java.util.Locale getActiveCustomerDisplayLocale()
          Returns the display locale for the active customer.
 atg.repository.RepositoryItem getActiveCustomerProfile()
          Returns the active customer profile item.
 atg.userprofiling.Profile getActiveCustomerProfileComponent()
          Returns the active customer profile component.
 atg.repository.RepositoryItem getActiveTicket()
          Returns the active ticket from the environment.
 java.lang.String getActiveTicketId()
          Returns the active ticket id
 java.lang.String getAgentApplicationContextRoot()
          Returns the agentApplicationContextRoot
 java.lang.String getAgentApplicationName()
           
 atg.agent.events.AgentMessagingTools getAgentMessagingTools()
          Returns component for sending agent messages
 atg.userprofiling.Profile getAgentProfile()
          Returns the agent profile component.
 java.lang.String getAgentUserType()
          Defines the base item type for agent profiles
 CallState getCallState()
          returns the call state
 atg.repository.RepositoryItem getCurrentActiveCustomerProfile(EnvironmentChangeState pEnvironmentChangeState)
          Returns the active customer profile item.
 atg.multisite.Site getCurrentActiveSite(EnvironmentChangeState pEnvironmentChangeState)
          Returns the active site.
 atg.multisite.Site getCurrentSite()
          Returns the environment's current site.
 atg.multisite.Site getCurrentSite(atg.servlet.DynamoHttpServletRequest pRequest)
          Returns the environment's current site.
 EnvironmentMonitor[] getEnvironmentMonitors()
          Returns the configured array of EnvironmentMonitor components.
 java.lang.Object getEnvironmentObject(java.lang.String pEnvironmentObjectName)
          Returns the environment object for the given name.
 atg.svc.agent.events.FrameworkEventTools getEventTools()
           
static EnvironmentTools getInstance()
          Returns the global EnvironmentTools component by resolving it from the current request.
 atg.repository.Repository getInternalProfileRepository()
          The interna; profile repository
 atg.core.i18n.LocaleTools getLocaleTools()
          Resolves the LocaleTools component from the current request using the component path defined by the localeToolsPath property
 java.lang.String getLocaleToolsPath()
           
 atg.web.messaging.MessageTools getMessageTools()
          Returns the MessageTools component
 atg.repository.RepositoryItem getProfileFromDetail(EnvironmentChangeDetail pEnvironmentChangeDetail)
          Returns the profile repository item from the change detail.
 atg.userprofiling.ProfileTools getProfileTools()
          The ProfileTools component
 atg.security.GenericSecurityDomain getSecurityDomain()
          Return the security domain that provides security checks.
 atg.multisite.SiteContext getSiteContext(atg.multisite.Site pSite)
          This is a convenience method to return site context.
 atg.multisite.SiteContextManager getSiteContextManager()
          Returns the siteContextManager
 atg.ticketing.TicketingManager getTicketingManager()
           
 TicketingTools getTicketingTools()
           
 java.util.Locale getUserLocale()
          This method gets the current user Locale
 atg.servlet.security.UserLoginManager getUserLoginManager()
          Gets the userDirectory property
 atg.repository.RepositoryItem getViewCustomerProfile()
          Returns the view customer profile
 atg.userprofiling.Profile getViewCustomerProfileComponent()
          Returns view customer profile component
 atg.repository.RepositoryItem getViewTicket()
          Returns the view ticket from the holder.
 EnvironmentChangeState initializeChange(java.lang.String pApplicationName, java.lang.String pEnvironmentChangeKey, java.util.Map pInputParameters, TicketDispositionOptions pTicketDispositionOptions, boolean pIncludeWarnings)
          Initializes a change to the environment and returns the assoicated state object.
 void initializeDefaultsForProfile(atg.repository.MutableRepositoryItem pProfile)
          Calls back to each EnvironmentMonitor to initialize the default values of a new profile.
 void initializeEnvironment()
          Initializes the environment
 void initializeEnvironmentChangeState(EnvironmentChangeState pEnvironmentChangeState, java.lang.String pApplicationName, java.lang.String pEnvironmentChangeKey, java.util.Map pInputParameters, TicketDispositionOptions pTicketDispositionOptions, boolean pIncludeWarnings)
          This method initializes the given EnvironmentChangeState for the given change key and input parameters.
 boolean isProcessDisposition(EnvironmentChangeState pEnvironmentChangeState)
          Determines if the ticket disposition handling is necessary for the given change by checking if the ticket is changing or the change is a logoff.
 boolean isTestRevert()
           
 boolean isTransactionMarkedAsRollBack()
          Returns true if the transaction associated with the current thread is marked for rollback.
 boolean loadNewAnonymousProfile(java.lang.String pProfileId)
          This method will sets up a new anonymous profile into the active customer profile.
 boolean loadNewAnonymousProfile(java.lang.String pProfileId, atg.userprofiling.Profile pProfile)
          This method will sets up a new anonymous profile item into the given profile object.
 boolean loadNewProfile(java.lang.String pProfileId, atg.userprofiling.Profile pProfile)
          Loads a profile item into the given profile.
 void loadViewProfile(java.lang.String pProfileId)
          Loads the given profile into the view profile component.
 boolean markTransactionForRollback()
          Returns true if the transaction has been marked for rollback, false if unable to access the transaction.
 void processTicketDisposition(atg.repository.RepositoryItem pTicket, TicketDispositionOptions pTicketDispositionOptions, java.lang.String pApplicationName)
          Processes the ticket according the disposition options.
 void revertChanges(EnvironmentChangeState pEnvironmentChangeState)
          Calls each environment monitor through its revertChanges interface so they will revert any changes to the environment they may have applied.
 void setAgentApplicationContextRoot(java.lang.String pAgentApplicationContextRoot)
          Sets the agentApplicationContextRoot
 void setAgentApplicationName(java.lang.String pAgentApplicationName)
           
 void setAgentMessagingTools(atg.agent.events.AgentMessagingTools pAgentMessagingTools)
          Sets the component for sending agent messages
 void setAgentUserType(java.lang.String pAgentUserType)
           
 void setCurrentSite(atg.multisite.Site pSite)
          sets the current site in the environment
 void setEnvironmentMonitors(EnvironmentMonitor[] pEnvironmentMonitors)
           
 void setEventTools(atg.svc.agent.events.FrameworkEventTools pEventTools)
           
 void setInternalProfileRepository(atg.repository.Repository pInternalProfileRepository)
           
 void setLocaleToolsPath(java.lang.String pLocaleToolsPath)
           
 void setMessageTools(atg.web.messaging.MessageTools pMessageTools)
           
 void setProfileTools(atg.userprofiling.ProfileTools pProfileTools)
          Sets the ProfileTools component
 void setSecurityDomain(atg.security.GenericSecurityDomain pSecurityDomain)
           
 void setSiteContextManager(atg.multisite.SiteContextManager pSiteContextManager)
          Sets the siteContextManager
 void setTestRevert(boolean pTestRevert)
           
 void setTicketingManager(atg.ticketing.TicketingManager pTicketingManager)
          sets the configured TicketManager
 void setTicketingTools(TicketingTools pTicketingTools)
           
 void setUserLoginManager(atg.servlet.security.UserLoginManager pUserLoginManager)
          Sets the userDirectory property
 void setViewCustomerProfile(atg.repository.RepositoryItem pProfile)
          Sets the view profile datasource to the given profile repository item.
 void setViewTicket(atg.repository.RepositoryItem pTicket)
          Sets the view ticket to the given ticket
 void startCall(EnvironmentChangeState pEnvironmentChangeState)
          Initializes the current call state object and sends the new call event
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, 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
 
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

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


ENVIRONMENTTOOLS_PATH

public static final java.lang.String ENVIRONMENTTOOLS_PATH
The path to the EnvironmentTools component

See Also:
Constant Field Values

DEFAULT_TICKET_CREATE_CHANNEL

public static final java.lang.String DEFAULT_TICKET_CREATE_CHANNEL
Creation channel used to create a new ticket when a channel isn't provided

See Also:
Constant Field Values

VIEW_TICKET_HOLDER_COMPONENT_PATH

public static final java.lang.String VIEW_TICKET_HOLDER_COMPONENT_PATH
view ticket holder component path

See Also:
Constant Field Values

VIEW_CUSTOMER_PROFILE_COMPONENT_PATH

public static final java.lang.String VIEW_CUSTOMER_PROFILE_COMPONENT_PATH
The view customer profile component path

See Also:
Constant Field Values

AGENT_PROFILE_COMPONENT_PATH

public static final java.lang.String AGENT_PROFILE_COMPONENT_PATH
The agent profile component path

See Also:
Constant Field Values

CALL_STATE_COMPONENT_PATH

public static final java.lang.String CALL_STATE_COMPONENT_PATH
The call state component path

See Also:
Constant Field Values

mGlobalEnvironmentTools

protected static EnvironmentTools mGlobalEnvironmentTools

mLocaleToolsPath

protected java.lang.String mLocaleToolsPath

mUserLoginManager

protected atg.servlet.security.UserLoginManager mUserLoginManager

mSecurityDomain

protected atg.security.GenericSecurityDomain mSecurityDomain

mMessageTools

protected atg.web.messaging.MessageTools mMessageTools

mAgentUserType

protected java.lang.String mAgentUserType

mInternalProfileRepository

protected atg.repository.Repository mInternalProfileRepository

mEventTools

protected atg.svc.agent.events.FrameworkEventTools mEventTools
Used to record agent audit recoder events used for reporting and external integration hooks


mAgentApplicationName

protected java.lang.String mAgentApplicationName

mTicketingTools

protected TicketingTools mTicketingTools

mTicketingManager

protected atg.ticketing.TicketingManager mTicketingManager

mEnvironmentMonitors

protected EnvironmentMonitor[] mEnvironmentMonitors

mSiteContextManager

protected atg.multisite.SiteContextManager mSiteContextManager

mAgentApplicationContextRoot

protected java.lang.String mAgentApplicationContextRoot
Constructor Detail

EnvironmentTools

public EnvironmentTools()
Method Detail

getInstance

public static EnvironmentTools getInstance()
Returns the global EnvironmentTools component by resolving it from the current request.

Returns:
CSREnvironmentTools

getLocaleToolsPath

public java.lang.String getLocaleToolsPath()
Returns:
the path to the LocaleTools component

setLocaleToolsPath

public void setLocaleToolsPath(java.lang.String pLocaleToolsPath)

setUserLoginManager

public void setUserLoginManager(atg.servlet.security.UserLoginManager pUserLoginManager)
Sets the userDirectory property

Parameters:
pUserDirectory - the userdirectory to perform on

getSecurityDomain

public atg.security.GenericSecurityDomain getSecurityDomain()
Return the security domain that provides security checks.

Returns:
the security domain

setSecurityDomain

public void setSecurityDomain(atg.security.GenericSecurityDomain pSecurityDomain)

getUserLoginManager

public atg.servlet.security.UserLoginManager getUserLoginManager()
Gets the userDirectory property

Returns:
the userdirectory to perform on

getMessageTools

public atg.web.messaging.MessageTools getMessageTools()
Returns the MessageTools component

Returns:
MessageTools

setMessageTools

public void setMessageTools(atg.web.messaging.MessageTools pMessageTools)

setAgentMessagingTools

public void setAgentMessagingTools(atg.agent.events.AgentMessagingTools pAgentMessagingTools)
Sets the component for sending agent messages

Parameters:
pAgentMessagingTools -

getAgentMessagingTools

public atg.agent.events.AgentMessagingTools getAgentMessagingTools()
Returns component for sending agent messages

Returns:
AgentMessagingTools

getAgentUserType

public java.lang.String getAgentUserType()
Defines the base item type for agent profiles

Returns:
String

setAgentUserType

public void setAgentUserType(java.lang.String pAgentUserType)

getInternalProfileRepository

public atg.repository.Repository getInternalProfileRepository()
The interna; profile repository

Returns:
Repository

setInternalProfileRepository

public void setInternalProfileRepository(atg.repository.Repository pInternalProfileRepository)

getEventTools

public atg.svc.agent.events.FrameworkEventTools getEventTools()

setEventTools

public void setEventTools(atg.svc.agent.events.FrameworkEventTools pEventTools)

getAgentApplicationName

public java.lang.String getAgentApplicationName()
Returns:
the name of the agent application

setAgentApplicationName

public void setAgentApplicationName(java.lang.String pAgentApplicationName)

getTicketingTools

public TicketingTools getTicketingTools()

setTicketingTools

public void setTicketingTools(TicketingTools pTicketingTools)

setTicketingManager

public void setTicketingManager(atg.ticketing.TicketingManager pTicketingManager)
sets the configured TicketManager


getTicketingManager

public atg.ticketing.TicketingManager getTicketingManager()
Returns:
the configured TicketManager

getEnvironmentMonitors

public EnvironmentMonitor[] getEnvironmentMonitors()
Returns the configured array of EnvironmentMonitor components.

These components are called back for various changes made in the environment.

Returns:
array of moinitors.

setEnvironmentMonitors

public void setEnvironmentMonitors(EnvironmentMonitor[] pEnvironmentMonitors)

setProfileTools

public void setProfileTools(atg.userprofiling.ProfileTools pProfileTools)
Sets the ProfileTools component

Parameters:
pProfileTools - the ProfileTools component

getProfileTools

public atg.userprofiling.ProfileTools getProfileTools()
The ProfileTools component

Returns:
the ProfileTools component

getSiteContextManager

public atg.multisite.SiteContextManager getSiteContextManager()
Returns the siteContextManager

Returns:
the siteContextManager

setSiteContextManager

public void setSiteContextManager(atg.multisite.SiteContextManager pSiteContextManager)
Sets the siteContextManager

Parameters:
pSiteContextManager - the siteContextManager to set

getAgentApplicationContextRoot

public java.lang.String getAgentApplicationContextRoot()
Returns the agentApplicationContextRoot

Returns:
the agentApplicationContextRoot

setAgentApplicationContextRoot

public void setAgentApplicationContextRoot(java.lang.String pAgentApplicationContextRoot)
Sets the agentApplicationContextRoot

Parameters:
pAgentApplicationContextRoot - the agentApplicationContextRoot to set

generateChangeDetails

public void generateChangeDetails(EnvironmentChangeState pEnvironmentChangeState)
                           throws EnvironmentException
Generates the List of EnvironmentChangeDetails for the given environment change.

Each monitor is called to create and add their EnvironmentChangeDetail objects.

Parameters:
pEnvironmentChangeState -
Throws:
EnvironmentException
See Also:
EnvironmentMonitor.generateChangeDetails(EnvironmentChangeState, EnvironmentChangeDetail)

applyChanges

public void applyChanges(EnvironmentChangeState pEnvironmentChangeState)
                  throws EnvironmentException
Calls each EnvironmentMonitor to apply the change details in the EnvironmentChangeState

This process executes three methods on the monitor interface: preApplyChanges, applyChanges and postApplyChanges.

EnvironmentExceptions thrown by the monitors in the preApplyChanges method will result in the change being aborted.

EnvironmentExceptions thrown by the monitors in the applyChanges method will result in the transaction being marked for roll back and each monitor that was called to apply will be called to revert their change through the revertChanges interface.

EnvironmentExceptions thrown by the monitors in the postApplyChanges method will be logged but will not cause a revert of the change. Monitors should not execute code that could cause a transaction roll back in postApplyChanges as it could lead to an inconsistent state in the application.

Parameters:
pEnvironmentChangeState -
Throws:
EnvironmentException
See Also:
EnvironmentMonitor.preApplyChanges(EnvironmentChangeState), EnvironmentMonitor.applyChanges(EnvironmentChangeState), EnvironmentMonitor.postApplyChanges(EnvironmentChangeState), EnvironmentMonitor.revertChanges(EnvironmentChangeState)

revertChanges

public void revertChanges(EnvironmentChangeState pEnvironmentChangeState)
Calls each environment monitor through its revertChanges interface so they will revert any changes to the environment they may have applied.

Parameters:
pEnvironmentChangeState -
Throws:
EnvironmentException

createWarningsForChangeEnvironment

public void createWarningsForChangeEnvironment(EnvironmentChangeState pEnvironmentChangeState)
                                        throws EnvironmentException
Calls each EnvironmentMonitor to add warnings related to the EnvironmentChangeState related to the pending changes detailed in the state.

Parameters:
pEnvironmentChangeState -
Throws:
EnvironmentException

getActiveTicket

public atg.repository.RepositoryItem getActiveTicket()
Returns the active ticket from the environment.

Returns:
the active ticket from the environment.

getActiveTicketId

public java.lang.String getActiveTicketId()
Returns the active ticket id

Returns:
active ticket id

getViewTicket

public atg.repository.RepositoryItem getViewTicket()
Returns the view ticket from the holder.

Returns:
view ticket repository item

setViewTicket

public void setViewTicket(atg.repository.RepositoryItem pTicket)
                   throws EnvironmentException
Sets the view ticket to the given ticket

Throws:
EnvironmentException

getActiveCustomerProfileComponent

public atg.userprofiling.Profile getActiveCustomerProfileComponent()
Returns the active customer profile component.

Returns:
active customer profile component.

getActiveCustomerProfile

public atg.repository.RepositoryItem getActiveCustomerProfile()
Returns the active customer profile item.

Returns:
the active customer profile item.

getCurrentActiveCustomerProfile

public atg.repository.RepositoryItem getCurrentActiveCustomerProfile(EnvironmentChangeState pEnvironmentChangeState)
                                                              throws EnvironmentException
Returns the active customer profile item.

If the customer is changing this method returns EnvironmentChangeState.getActiveCustomerDetail(). Otherwise it returns getActiveCustomerProfile().

Returns:
the active customer profile item.
Throws:
EnvironmentException
See Also:
EnvironmentChangeState.getActiveCustomerDetail(), getActiveCustomerProfile()

getCurrentActiveSite

public atg.multisite.Site getCurrentActiveSite(EnvironmentChangeState pEnvironmentChangeState)
                                        throws EnvironmentException
Returns the active site.

If the site is changing this method returns EnvironmentChangeState.getActiveSiteDetail(). Otherwise it returns getCurrentSite().

Returns:
the active site.
Throws:
EnvironmentException
See Also:
EnvironmentChangeState.getActiveSiteDetail(), getCurrentSite()

getViewCustomerProfileComponent

public atg.userprofiling.Profile getViewCustomerProfileComponent()
Returns view customer profile component

Returns:
view customer profile component

getViewCustomerProfile

public atg.repository.RepositoryItem getViewCustomerProfile()
Returns the view customer profile

Returns:
the view customer profile

setViewCustomerProfile

public void setViewCustomerProfile(atg.repository.RepositoryItem pProfile)
                            throws EnvironmentException
Sets the view profile datasource to the given profile repository item.

Parameters:
pProfile - the profile repository item.
Throws:
EnvironmentException

getAgentProfile

public atg.userprofiling.Profile getAgentProfile()
Returns the agent profile component.

Returns:
the agent profile component.

getCallState

public CallState getCallState()
returns the call state

Returns:
CallState

initializeEnvironmentChangeState

public void initializeEnvironmentChangeState(EnvironmentChangeState pEnvironmentChangeState,
                                             java.lang.String pApplicationName,
                                             java.lang.String pEnvironmentChangeKey,
                                             java.util.Map pInputParameters,
                                             TicketDispositionOptions pTicketDispositionOptions,
                                             boolean pIncludeWarnings)
                                      throws EnvironmentException
This method initializes the given EnvironmentChangeState for the given change key and input parameters.

As part of this process the monitors are called to generate the change details and the property processActiveTicketDisposition is set based on the call to isProcessDisposition

If the ticket disposition option is not set, it is set based on whether the ticket is automatically discardable as determined by the ticket manager.

Parameters:
pEnvironmentChangeState -
pApplicationName - The application name initializing the state
pEnvironmentChangeKey -
pInputParameters -
pTicketDispositionOptions -
pIncludeWarnings -
Throws:
EnvironmentException
See Also:
generateChangeDetails(EnvironmentChangeState), isProcessDisposition(EnvironmentChangeState)

initializeChange

public EnvironmentChangeState initializeChange(java.lang.String pApplicationName,
                                               java.lang.String pEnvironmentChangeKey,
                                               java.util.Map pInputParameters,
                                               TicketDispositionOptions pTicketDispositionOptions,
                                               boolean pIncludeWarnings)
                                        throws EnvironmentException
Initializes a change to the environment and returns the assoicated state object.

Parameters:
pApplicationName - The application initializing the change
pEnvironmentChangeKey -
pInputParameters -
pTicketDispositionOptions -
pIncludeWarnings -
Returns:
EnvironmentChangeState
Throws:
EnvironmentException

createEnvironmentChangeState

public EnvironmentChangeState createEnvironmentChangeState()
Returns a new EnvironmentChangeState object

Returns:
EnvironmentChangeState

loadNewProfile

public boolean loadNewProfile(java.lang.String pProfileId,
                              atg.userprofiling.Profile pProfile)
Loads a profile item into the given profile.

Parameters:
pProfileId -
Returns:
true if the load was successful

loadNewAnonymousProfile

public boolean loadNewAnonymousProfile(java.lang.String pProfileId)
                                throws EnvironmentException
This method will sets up a new anonymous profile into the active customer profile.

Returns:
boolean indicating if a profile was successfully loaded
Throws:
atg.repository.RepositoryException
EnvironmentException
See Also:
loadNewAnonymousProfile(String, Profile)

loadNewAnonymousProfile

public boolean loadNewAnonymousProfile(java.lang.String pProfileId,
                                       atg.userprofiling.Profile pProfile)
                                throws EnvironmentException
This method will sets up a new anonymous profile item into the given profile object.

Parameters:
pProfileId - the profile to assign to the new item
pProfile - the profile object that will have its datasource set.
Returns:
boolean indicating if a profile was successfully loaded
Throws:
atg.repository.RepositoryException
EnvironmentException
See Also:
initializeDefaultsForProfile(MutableRepositoryItem)

changeUser

public void changeUser(atg.repository.RepositoryItem pNewProfile,
                       atg.userprofiling.Profile pCustomerProfile)
                throws EnvironmentException
This method loads a new customer profile into the customer profile object.

Parameters:
pNewProfile - the profile to load
pCustomerProfile - the profile object in which to load the new profile.
Throws:
atg.repository.RepositoryException
EnvironmentException

changeUser

public void changeUser(java.lang.String pNewProfileId,
                       atg.userprofiling.Profile pCustomerProfile)
                throws EnvironmentException
Loads a new profile into the customer profile object.

If the new profile id is null or cannot be found, a new anonymous profile is loaded into the profile object.

Parameters:
pNewProfileId -
pCustomerProfile -
Throws:
EnvironmentException

initializeDefaultsForProfile

public void initializeDefaultsForProfile(atg.repository.MutableRepositoryItem pProfile)
                                  throws EnvironmentException
Calls back to each EnvironmentMonitor to initialize the default values of a new profile.

Parameters:
pProfile - the new profile.
Throws:
EnvironmentException

doesProfileExist

public boolean doesProfileExist(java.lang.String pProfileId)
Determines if a profile exists with the given id

Parameters:
pProfileId -
Returns:
true if a profile exists with the given id

addNewActiveProfileDetail

public void addNewActiveProfileDetail(java.lang.String pProfileId,
                                      EnvironmentChangeState pEnvironmentChangeState)
                               throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                      EnvironmentException
Adds an EnvironmentChangeDetail for a new active customer profile change.

Parameters:
pProfileId - this parameter is optional. If specified, the new profile will have this id assigned to it.
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
EnvironmentException

addNewActiveTicketDetail

public void addNewActiveTicketDetail(EnvironmentChangeState pEnvironmentChangeState)
                              throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                     EnvironmentException
Adds a EnvironmentChangeDetail to the EnvironmentChangeState that indicates a new ticket ticket item. a change to create a new ticket item.

Parameters:
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
EnvironmentException

addChangeActiveTicketDetail

public void addChangeActiveTicketDetail(java.lang.String pTicketId,
                                        EnvironmentChangeState pEnvironmentChangeState)
                                 throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                        EnvironmentException
Adds a EnvironmentChangeDetail to the EnvironmentChangeState that indicates a change to the active ticket item. The new ticket is loaded from the repository and included in the EnvironmentChangeDetail.

Parameters:
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
EnvironmentException

addChangeActiveProfileDetail

public void addChangeActiveProfileDetail(java.lang.String pProfileId,
                                         EnvironmentChangeState pEnvironmentChangeState)
                                  throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                         EnvironmentException
Adds a EnvironmentChangeDetail to the EnvironmentChangeState that indicates a change to the active profile item. The new profile is loaded from the repository and included in the EnvironmentChangeDetail.

Parameters:
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
EnvironmentException

processTicketDisposition

public void processTicketDisposition(atg.repository.RepositoryItem pTicket,
                                     TicketDispositionOptions pTicketDispositionOptions,
                                     java.lang.String pApplicationName)
                              throws EnvironmentException
Processes the ticket according the disposition options.

Parameters:
pTicket -
pTicketDispositionOptions -
pApplicationName -
Throws:
EnvironmentException

initializeEnvironment

public void initializeEnvironment()
                           throws EnvironmentException
Initializes the environment

Throws:
EnvironmentException

changeActiveTicket

public void changeActiveTicket(java.lang.String pApplicationName,
                               java.lang.String pTicketId,
                               TicketDispositionOptions pTicketDispositionOptions)
                        throws EnvironmentException
Changes the environment's active ticket to the given ticket

Parameters:
pApplicationName -
pTicketId - id of the ticket to be loaded into the environment.
pTicketDispositionOptions - the options used to modify the disposition the currently active ticket before the change.
Throws:
EnvironmentException

changeNewActiveTicket

public void changeNewActiveTicket(java.lang.String pApplicationName)
                           throws EnvironmentException
Changes the environment's active ticket to a new ticket

Parameters:
pApplicationName -
Throws:
EnvironmentException

isProcessDisposition

public boolean isProcessDisposition(EnvironmentChangeState pEnvironmentChangeState)
Determines if the ticket disposition handling is necessary for the given change by checking if the ticket is changing or the change is a logoff.

Returns:
true if the ticket disposition is necessary

getEnvironmentObject

public java.lang.Object getEnvironmentObject(java.lang.String pEnvironmentObjectName)
Returns the environment object for the given name. The environment monitors are polled until one comes back with an object for the given name

Parameters:
pEnvironmentObjectName -
Returns:
environment object
Throws:
EnvironmentException

getProfileFromDetail

public atg.repository.RepositoryItem getProfileFromDetail(EnvironmentChangeDetail pEnvironmentChangeDetail)
                                                   throws EnvironmentException
Returns the profile repository item from the change detail.

If the detail is for a new profile, a new item is created and returned.

Parameters:
pEnvironmentChangeDetail -
Returns:
profile repository item
Throws:
EnvironmentException

loadViewProfile

public void loadViewProfile(java.lang.String pProfileId)
                     throws EnvironmentException
Loads the given profile into the view profile component.

If the profile doesn't exist in the Repository a new one will be created and loaded.

Parameters:
pProfileId -
Throws:
EnvironmentException
See Also:
loadNewProfile(String, Profile), loadNewAnonymousProfile(String, Profile)

startCall

public void startCall(EnvironmentChangeState pEnvironmentChangeState)
Initializes the current call state object and sends the new call event

Parameters:
pEnvironmentChangeState - the change state
See Also:
CallState.initializeNewCall()

endCall

public void endCall(EnvironmentChangeState pEnvironmentChangeState)
Ends the call in the the current call state and sends end call event.

Parameters:
pEnvironmentChangeState - the change state
See Also:
CallState.endCall()

isTransactionMarkedAsRollBack

public boolean isTransactionMarkedAsRollBack()
Returns true if the transaction associated with the current thread is marked for rollback.


markTransactionForRollback

public boolean markTransactionForRollback()
Returns true if the transaction has been marked for rollback, false if unable to access the transaction.


getLocaleTools

public atg.core.i18n.LocaleTools getLocaleTools()
Resolves the LocaleTools component from the current request using the component path defined by the localeToolsPath property

Returns:
LocaleTools

getUserLocale

public java.util.Locale getUserLocale()
This method gets the current user Locale

Returns:
the current Locale
See Also:
LocaleTools.LocaleHelper#getLocale()

isTestRevert

public boolean isTestRevert()

setTestRevert

public void setTestRevert(boolean pTestRevert)

addChangeSiteDetail

public void addChangeSiteDetail(java.lang.String pNewSiteId,
                                EnvironmentChangeState pEnvironmentChangeState)
                         throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                EnvironmentException,
                                atg.svc.agent.environment.SiteNotFoundException
Adds a change site detail for loading an existing site.

Parameters:
pNewSiteId -
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
EnvironmentException
atg.svc.agent.environment.SiteNotFoundException

addChangeSiteDetail

public void addChangeSiteDetail(atg.multisite.Site pNewSite,
                                EnvironmentChangeState pEnvironmentChangeState)
                         throws atg.svc.agent.environment.EnvironmentChangeDetailConflict,
                                EnvironmentException
Adds a change site detail for loading an existing site.

Parameters:
pNewSite -
pEnvironmentChangeState -
Throws:
atg.svc.agent.environment.EnvironmentChangeDetailConflict
EnvironmentException

getCurrentSite

public atg.multisite.Site getCurrentSite()
                                  throws EnvironmentException
Returns the environment's current site.

Returns:
site
Throws:
EnvironmentException

getCurrentSite

public atg.multisite.Site getCurrentSite(atg.servlet.DynamoHttpServletRequest pRequest)
                                  throws EnvironmentException
Returns the environment's current site.

Returns:
site
Throws:
EnvironmentException

setCurrentSite

public void setCurrentSite(atg.multisite.Site pSite)
                    throws EnvironmentException
sets the current site in the environment

Parameters:
pSite -
Throws:
EnvironmentException

getSiteContext

public atg.multisite.SiteContext getSiteContext(atg.multisite.Site pSite)
                                         throws EnvironmentException
This is a convenience method to return site context.

if the site is null, then SiteContextManager.getEmptySiteContext() is returned. otherwise SiteContextManager.getSiteContext(String) is returned.

Parameters:
pSite -
Returns:
Throws:
EnvironmentException
See Also:
SiteContextManager.getEmptySiteContext(), SiteContextManager.getSiteContext(String)

conformRedirectURL

public java.lang.String conformRedirectURL(java.lang.String pContextRoot,
                                           java.lang.String pURL)
if the pURL contains the context root, then the URL is not modified and returned. If the pURL does not contain the context root, the context root is prepended to the URL and it is returned.

Parameters:
pContextRoot -
pURL -

currentUserHasAccessRight

public boolean currentUserHasAccessRight(java.lang.String pAccessRightName)
Return true if the current user has a named access right.

Parameters:
pAccessRightName - - name of the access right
Returns:
true if the agent has the named access right, or if pAccessRightName is null / blank.

getActiveCustomerDisplayLocale

public java.util.Locale getActiveCustomerDisplayLocale()
Returns the display locale for the active customer.

This implementation will return the customer profile's locale setting first. If that is null, the current user locale is returned.

Returns:

convertLocale

public java.util.Locale convertLocale(java.lang.Object pLocale)
Convert an object to a Locale. This method handles conversion of locale Strings and passes through Locale objects.

Parameters:
pLocale -
Returns:
a Locale object or null