atg.svc.agent.environment
Class EnvironmentChangeFormHandler

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.droplet.EmptyFormHandler
              extended by atg.droplet.GenericFormHandler
                  extended by atg.svc.agent.environment.EnvironmentChangeFormHandler
All Implemented Interfaces:
atg.droplet.DropletFormHandler, 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
Direct Known Subclasses:
C2CStartNewCall

public class EnvironmentChangeFormHandler
extends atg.droplet.GenericFormHandler

Based form handler class for Agent gestures that perform environment changes.

This form handler is designed to provide a specific flow when the agent uses gestures that change the environment.

The flow consist of: start change w/agent UI gesture -> warnings/ticket disposition confirmation page -> complete change.

Changes in the environment can be monitored by all Service applications, which can apply their own related implicit changes. Service applications can generate warnings related to the change that the agent must confirm before proceeding. Also, if the change includes a ticket change, the agent may also have to decide the dispostion of the current ticket before proceeding.

When the ticket is changing, processing the current ticket's dispostion is made up of two steps. First, the agent is prompted with a form in which they can set the disposition options. Secondly, the current ticket disposition is modified based on the ticket disposition options. Ticket disposition options are either supplied by the agent through prompting or by a default set of options. The prompting of the agent for disposition options is optional, but modifiying the current ticket's disposition is not. Whenever the ticket changes as a result of an environment change, the current ticket's disposition is modified based on the supplied options.

Also, as part of the environment change process, warnings can be generated by the Service applications. The agent must confirm the warnings before the change is applied. Displaying warning confirmations is optional by configuration, but disabling them should be used with caution since they are likely to give the agent insight into the possible reprecussions of their requested change. A property configuration determines if warning confirmation is displayed to the agent.

Form handler properpties:

initChangeState
determines if the environment change state is initialized. Default is true. The state should be initialized on the first request to start the change. The confirmation page sets this property to false to preserve the environment change state throughout the flow.
environmentChangeState
contains the state information for the change. This property should be configured to a window scoped EnvironmentChangeState object.
environmentChangeKey
Identifies the type of environment change being requested. This value is transferred into the environment change state when it is initialized in preChangeEnvironment
inputParameters
A map of change input parameters. These are set by the form and transferred into the environment change state when it is initialized in preChangeEnvironment
doWarnings
determines if warnings are generated and show to the agent.
doDispositionPrompt
determines if the agent should be prompted with ticket disposition options when the curren ticket is changing as a result of the requested change. Default is true. This property should be set to false on the confirmation page.
confirmURL
The URL that launches the warnings/ticket disposition prompt.
confirmPromptURL
The URL that defines the contents of the prompt window for warnings/ticket disposition options.


Field Summary
protected static java.lang.String AGENTRESOURCES
          Resources file
protected static java.lang.String AGENTUSERRESOURCES
           
static java.lang.String CLASS_VERSION
          Class version string
protected  java.lang.String mApplicationName
           
protected  boolean mDoTicketDispositionPrompt
           
protected  boolean mDoWarnings
           
protected  java.lang.String mEnvironmentChangeKey
           
protected  EnvironmentChangeState mEnvironmentChangeState
           
protected  EnvironmentTools mEnvironmentTools
           
protected  boolean mInitChangeState
           
protected  java.util.Map mInputParameters
           
protected  atg.web.messaging.MessageTools mMessageTools
           
protected  TicketDispositionOptions mTicketDispositionOptions
           
protected  TicketingTools mTicketingTools
           
protected  javax.transaction.TransactionManager mTransactionManager
           
protected  java.util.ResourceBundle sBundle
           
 
Fields inherited from class atg.droplet.GenericFormHandler
PARAM_DEFER_FORWARD_OR_REDIRECT, PARAM_USE_FORWARDS
 
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
EnvironmentChangeFormHandler()
           
 
Method Summary
protected  boolean changeEnvironment(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Applies the changes to the environment.
 java.lang.String getApplicationName()
           
 java.lang.String getConfirmPromptURL()
          Returns property ConfirmURL
 java.lang.String getConfirmURL()
          Returns property ConfirmURL
 java.lang.String getEnvironmentChangeKey()
          The change key for the environment change.
 EnvironmentChangeState getEnvironmentChangeState()
          Contains state information related to the environment change.
 EnvironmentTools getEnvironmentTools()
           
 java.lang.String getErrorURL()
          Returns property ErrorURL
 java.util.Map getInputParameters()
          Returns the input parameters to the environment change.
 atg.web.messaging.MessageTools getMessageTools()
          Returns the MessageTools component
 java.lang.String getSuccessURL()
          Returns property SuccessURL
 TicketDispositionOptions getTicketDispositionOptions()
          This method will lazily create an instance of TicketDispositionOptions if one doesn't already exist.
 TicketingTools getTicketingTools()
          Returns the agent TicketingTools component
 javax.transaction.TransactionManager getTransactionManager()
          Returns the transaction manager
protected  java.util.Locale getUserLocale()
          This method gets the current Locale
protected  java.lang.String getUserMessage(java.lang.String pBundleName, java.lang.String pKey, java.lang.Object[] pMsgArgs)
          Returns a resource string using the given user message resource bundle name and the user locale.
protected  java.lang.String getUserMessage(java.lang.String pBundleName, java.lang.String pKey, java.lang.String[] pMsgArgs)
          Deprecated.  
 boolean handleChangeEnvironment(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Handler for changing the environment.
protected  void initChangeState(java.lang.String pEnvironmentChangeKey, java.util.Map pInputParameters, TicketDispositionOptions pTicketDispositionOptions, boolean pDoWarnings)
          Initializes the state using the form handler's environmentChangeKey and inputParameters.
 boolean isDoTicketDispositionPrompt()
          Returns if the ticket disposition prompting should be included for this change.
 boolean isDoWarnings()
          determines if warnings should be generated for the change.
 boolean isInitChangeState()
          Determines if the EnvironmentChangeState is re-initialized.
 boolean isShowDispositionPrompt()
          Determines if the ticket disposition prompt is necessary for the current change.
protected  boolean postChangeEnvironment(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Post environment change processing.
protected  boolean preChangeEnvironment(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Pre change environment process.
 void setApplicationName(java.lang.String pApplicationName)
           
 void setConfirmPromptURL(java.lang.String pConfirmPromptURL)
          Sets property ConfirmPromptURL
 void setConfirmURL(java.lang.String pConfirmURL)
          Sets property ConfirmURL
 void setDoTicketDispositionPrompt(boolean pDoTicketDispositionPrompt)
           
 void setDoWarnings(boolean pDoWarnings)
           
 void setEnvironmentChangeKey(java.lang.String pEnvironmentChangeKey)
           
 void setEnvironmentChangeState(EnvironmentChangeState pEnvironmentChangeState)
           
 void setEnvironmentTools(EnvironmentTools pEnvironmentTools)
           
 void setErrorURL(java.lang.String pErrorURL)
          Sets property ErrorURL.
 void setInitChangeState(boolean pInitChangeState)
           
 void setInputParameters(java.util.Map pInputParameters)
           
 void setMessageTools(atg.web.messaging.MessageTools pMessageTools)
           
 void setSuccessURL(java.lang.String pSuccessURL)
          Sets property SuccessURL
 void setTicketDispositionOptions(TicketDispositionOptions pTicketDispositionOptions)
           
 void setTicketingTools(TicketingTools pTicketingTools)
           
 void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
          Sets the Transaction Manager
 
Methods inherited from class atg.droplet.GenericFormHandler
addFormException, addUncheckedFormException, afterSet, beforeSet, checkFormRedirect, createFormSubmissionMessage, getCancelURL, getCheckForValidSession, getFormError, getFormExceptions, getFormName, getMessagePort, getMessageSource, getMessageType, getPropertyExceptions, getSendMessages, getUncheckedFormExceptions, handleCancel, handleFormException, handleUncheckedFormException, hasUncheckedFormExceptions, isDeferForwardsAndRedirects, isRestorableForm, isUseForwards, isValidSession, redirectOrForward, resetFormExceptions, setCancelURL, setCheckForValidSession, setDeferForwardsAndRedirects, setFormName, setMessagePort, setMessageSource, setMessageType, setRestorableForm, setSendMessages, setUseForwards
 
Methods inherited from class atg.droplet.EmptyFormHandler
afterGet, beforeGet
 
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 final java.lang.String CLASS_VERSION
Class version string

See Also:
Constant Field Values

AGENTRESOURCES

protected static final java.lang.String AGENTRESOURCES
Resources file

See Also:
Constant Field Values

sBundle

protected final java.util.ResourceBundle sBundle

AGENTUSERRESOURCES

protected static final java.lang.String AGENTUSERRESOURCES
See Also:
Constant Field Values

mApplicationName

protected java.lang.String mApplicationName

mMessageTools

protected atg.web.messaging.MessageTools mMessageTools

mTicketingTools

protected TicketingTools mTicketingTools

mTicketDispositionOptions

protected TicketDispositionOptions mTicketDispositionOptions

mDoTicketDispositionPrompt

protected boolean mDoTicketDispositionPrompt

mDoWarnings

protected boolean mDoWarnings

mTransactionManager

protected javax.transaction.TransactionManager mTransactionManager

mEnvironmentTools

protected EnvironmentTools mEnvironmentTools

mEnvironmentChangeKey

protected java.lang.String mEnvironmentChangeKey

mInputParameters

protected java.util.Map mInputParameters

mEnvironmentChangeState

protected EnvironmentChangeState mEnvironmentChangeState

mInitChangeState

protected boolean mInitChangeState
Constructor Detail

EnvironmentChangeFormHandler

public EnvironmentChangeFormHandler()
Method Detail

getApplicationName

public java.lang.String getApplicationName()
Returns:
the application name

setApplicationName

public void setApplicationName(java.lang.String pApplicationName)

getMessageTools

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

Returns:
MessageTools

setMessageTools

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

getTicketingTools

public TicketingTools getTicketingTools()
Returns the agent TicketingTools component

Returns:
TicketingTools

setTicketingTools

public void setTicketingTools(TicketingTools pTicketingTools)

getTicketDispositionOptions

public TicketDispositionOptions getTicketDispositionOptions()
This method will lazily create an instance of TicketDispositionOptions if one doesn't already exist.

Returns:
Returns the TicketDispositionOptions that holds the ticket disposition options.

setTicketDispositionOptions

public void setTicketDispositionOptions(TicketDispositionOptions pTicketDispositionOptions)
Parameters:
pTicketDispositionOptions - the TicketDispositionOptions holds the ticket disposition options.

isDoTicketDispositionPrompt

public boolean isDoTicketDispositionPrompt()
Returns if the ticket disposition prompting should be included for this change. Default is true. If false, the ticket dispostion prompt will not appear even if the current ticket is changing.

Returns:
boolean

setDoTicketDispositionPrompt

public void setDoTicketDispositionPrompt(boolean pDoTicketDispositionPrompt)

isDoWarnings

public boolean isDoWarnings()
determines if warnings should be generated for the change. Default is true.

Returns:
if warnings should be generated for the change

setDoWarnings

public void setDoWarnings(boolean pDoWarnings)

setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Sets the Transaction Manager

Parameters:
pTransactionManager -

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
Returns the transaction manager


setErrorURL

public void setErrorURL(java.lang.String pErrorURL)
Sets property ErrorURL.

This property can be set by request parameter using the name defined by ERROR_URL.This makes it possible to pass the parameter using an anchor tag.

Parameters:
pErrorURL - a String value

getErrorURL

public java.lang.String getErrorURL()
Returns property ErrorURL

Returns:
a String value

setSuccessURL

public void setSuccessURL(java.lang.String pSuccessURL)
Sets property SuccessURL

This property can be set by request parameter using the name defined by SUCCESS_URL. This makes it possible to pass the parameter using an anchor tag.

Parameters:
pSuccessURL - a String value

getSuccessURL

public java.lang.String getSuccessURL()
Returns property SuccessURL

Returns:
a String value

setConfirmURL

public void setConfirmURL(java.lang.String pConfirmURL)
Sets property ConfirmURL

This property can be set by request parameter using the name defined by SUCCESS_URL. This makes it possible to pass the parameter using an anchor tag.

Parameters:
pConfirmURL - a String value

getConfirmURL

public java.lang.String getConfirmURL()
Returns property ConfirmURL

Returns:
a String value

setConfirmPromptURL

public void setConfirmPromptURL(java.lang.String pConfirmPromptURL)
Sets property ConfirmPromptURL

This property defines the url location of the contents of the ticket disposition prompt dialog.

Parameters:
pConfirmPromptURL - a String value

getConfirmPromptURL

public java.lang.String getConfirmPromptURL()
Returns property ConfirmURL

Returns:
a String value

getEnvironmentTools

public EnvironmentTools getEnvironmentTools()

setEnvironmentTools

public void setEnvironmentTools(EnvironmentTools pEnvironmentTools)

initChangeState

protected void initChangeState(java.lang.String pEnvironmentChangeKey,
                               java.util.Map pInputParameters,
                               TicketDispositionOptions pTicketDispositionOptions,
                               boolean pDoWarnings)
                        throws EnvironmentException
Initializes the state using the form handler's environmentChangeKey and inputParameters.

Parameters:
pEnvironmentChangeKey -
pInputParameters -
pTicketDispositionOptions -
pDoWarnings -
Throws:
EnvironmentException

preChangeEnvironment

protected boolean preChangeEnvironment(atg.servlet.DynamoHttpServletRequest pRequest,
                                       atg.servlet.DynamoHttpServletResponse pResponse)
                                throws javax.servlet.ServletException,
                                       java.io.IOException
Pre change environment process. This method will initialize the environment state object and redirects to the confirmation page, if necessary.

Parameters:
pRequest -
pResponse -
Returns:
false if redirected
Throws:
javax.servlet.ServletException
java.io.IOException

changeEnvironment

protected boolean changeEnvironment(atg.servlet.DynamoHttpServletRequest pRequest,
                                    atg.servlet.DynamoHttpServletResponse pResponse)
                             throws javax.servlet.ServletException,
                                    java.io.IOException
Applies the changes to the environment.

Parameters:
pRequest -
pResponse -
Returns:
false if the method has redirected.
Throws:
javax.servlet.ServletException
java.io.IOException
See Also:
EnvironmentTools.applyChanges(EnvironmentChangeState)

handleChangeEnvironment

public boolean handleChangeEnvironment(atg.servlet.DynamoHttpServletRequest pRequest,
                                       atg.servlet.DynamoHttpServletResponse pResponse)
                                throws javax.servlet.ServletException,
                                       java.io.IOException
Handler for changing the environment.

Parameters:
pRequest -
pResponse -
Returns:
boolean
Throws:
javax.servlet.ServletException
java.io.IOException

postChangeEnvironment

protected boolean postChangeEnvironment(atg.servlet.DynamoHttpServletRequest pRequest,
                                        atg.servlet.DynamoHttpServletResponse pResponse)
                                 throws javax.servlet.ServletException,
                                        java.io.IOException
Post environment change processing.

Parameters:
pRequest -
pResponse -
Returns:
false if redirected
Throws:
javax.servlet.ServletException
java.io.IOException

getEnvironmentChangeKey

public java.lang.String getEnvironmentChangeKey()
The change key for the environment change. The change identifies what operation is taking place. For example, "changeUser" or "changeTicket" or "startNewCall".

Returns:
String

setEnvironmentChangeKey

public void setEnvironmentChangeKey(java.lang.String pEnvironmentChangeKey)

getInputParameters

public java.util.Map getInputParameters()
Returns the input parameters to the environment change.

Returns:
Map of input parameters.

setInputParameters

public void setInputParameters(java.util.Map pInputParameters)

getEnvironmentChangeState

public EnvironmentChangeState getEnvironmentChangeState()
Contains state information related to the environment change.

Returns:
EnvironmentChangeState
See Also:
EnvironmentChangeState

setEnvironmentChangeState

public void setEnvironmentChangeState(EnvironmentChangeState pEnvironmentChangeState)

isInitChangeState

public boolean isInitChangeState()
Determines if the EnvironmentChangeState is re-initialized. The default is true. This parameter should be set to false on the confirmation page.

Returns:
true if the environment change state should be initialized.

setInitChangeState

public void setInitChangeState(boolean pInitChangeState)

isShowDispositionPrompt

public boolean isShowDispositionPrompt()
Determines if the ticket disposition prompt is necessary for the current change.

Returns:
true if the ticket disposition is necessary

getUserLocale

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

Returns:
the current Locale

getUserMessage

protected java.lang.String getUserMessage(java.lang.String pBundleName,
                                          java.lang.String pKey,
                                          java.lang.String[] pMsgArgs)
Deprecated. 

Returns a resource string using the given user message resource bundle name and the user locale.

Parameters:
pKey -
pMsgArgs -
Returns:
String

getUserMessage

protected java.lang.String getUserMessage(java.lang.String pBundleName,
                                          java.lang.String pKey,
                                          java.lang.Object[] pMsgArgs)
Returns a resource string using the given user message resource bundle name and the user locale.

Parameters:
pKey -
pMsgArgs -
Returns:
String