atg.commerce.csr.approvals.order
Class OrderApprovalFormHandler

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
                      extended by atg.commerce.csr.approvals.order.OrderApprovalFormHandler
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

public class OrderApprovalFormHandler
extends atg.svc.agent.environment.EnvironmentChangeFormHandler

This form handler is used to execute the approval process for an Order Approval.

It also integrates an update of the agent's environment with the approval process. To complete the approval, the Approval's customer profile and ticket are loaded into global context.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String INPUT_PARAM_APPROVAL
          input parameter name used to store the Approval object that's loaded from the id
static java.lang.String INPUT_PARAM_APPROVAL_ID
          input parameter used to store the approvalId
protected static java.lang.String LOCK_NAME_ATTRIBUTE_NAME
           
protected  java.lang.String mApprovalId
           
protected  ApprovalsManager mApprovalsManager
           
protected  boolean mAutoSendApprovalAcceptedEmail
           
protected  boolean mAutoSendApprovalRejectedEmail
           
protected  ConfirmationInfo mConfirmationInfo
           
protected  CSRAgentTools mCSRAgentTools
           
protected  java.lang.String mCustomerEmail
           
protected  java.lang.String mCustomerProfileIdParameterName
           
protected  boolean mEnsureTransaction
           
protected  OrderApprovalTools mOrderApprovalTools
           
protected  atg.userprofiling.Profile mProfile
           
protected static java.lang.String PARAM_TRANSACTION_CREATED
           
protected static java.lang.String PARAM_VALUE_TRUE
           
 
Fields inherited from class atg.svc.agent.environment.EnvironmentChangeFormHandler
AGENTRESOURCES, AGENTUSERRESOURCES, mApplicationName, mDoTicketDispositionPrompt, mDoWarnings, mEnvironmentChangeKey, mEnvironmentChangeState, mEnvironmentTools, mInitChangeState, mInputParameters, mMessageTools, mTicketDispositionChangeHandler, mTicketDispositionOptions, mTicketingTools, mTransactionManager, 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
OrderApprovalFormHandler()
           
 
Method Summary
protected  void acquireTransactionLock(atg.servlet.DynamoHttpServletRequest pRequest)
          Attempt to acquire a local lock before creating a transaction that may modify the order, but only if useLocksAroundTransactions is set to true.
 boolean afterSet(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Called after any setX methods on this form are set when a form that modifies properties of this form handler is submitted.
protected  boolean approve(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Executes the changeEnvironment method to complete the environment change process.
 boolean beforeSet(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Called before any setX methods on this form are set when a form that modifies properties of this form handler is submitted.
protected  void commitTransaction(javax.transaction.Transaction pTransaction)
          Commits the supplied transaction
protected  javax.transaction.Transaction ensureTransaction()
          This method ensures that a transaction exists before returning.
 java.lang.String getApprovalId()
          Returns the Approval ID, used in the approval and rejection process.
 ApprovalsManager getApprovalsManager()
          reference to the ApprovalsManager component used to execute the approval process.
 boolean getAutoSendApprovalAcceptedEmail()
          Returns the auto send approval accepted email configuration
 boolean getAutoSendApprovalRejectedEmail()
          Returns the auto send approval rejected email configuration
 ConfirmationInfo getConfirmationInfo()
          Returns the confirmation info component used to send emails
 CSRAgentTools getCSRAgentTools()
           
 javax.transaction.Transaction getCurrentTransaction()
          Returns property currentTransaction
 java.lang.String getCustomerEmail()
          Returns the customer email as a String.
 java.lang.String getCustomerProfileIdParameterName()
          Returns the customer profile ID parameter name as a String.
 OrderApprovalTools getOrderApprovalTools()
          Returns the order approval tools
 atg.userprofiling.Profile getProfile()
          reference to the current profile, used to get the approving agent
 atg.commerce.util.TransactionLockFactory getTransactionLockFactory()
          The transactionLockFactory is used to get the locks if useLocksArountTransactions is true
 boolean handleApprove(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Executes the environment change and approval process.
 boolean handleReject(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Executes the environment change and rejection process.
protected  boolean initializeConfirmationInfoForApprove(Approval pApproval)
          Initializes the confirmation info object when an order is approved
protected  boolean initializeConfirmationInfoForReject(Approval pApproval)
          Initializes the confirmation info object when an order is rejected
 boolean isEnsureTransaction()
          Enables and disables the ensure transaction check.
protected  boolean isTransactionCreated(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
           
protected  boolean isTransactionMarkedAsRollBack()
          Returns true if the transaction associated with the current thread is marked for rollback.
protected  boolean postApprove(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          If there are no errors, adds a success message to the message bar.
protected  boolean postReject(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          If there are no errors, adds a rejection success message to the message bar.
protected  boolean preApprove(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Performed before the approve() method.
protected  boolean preReject(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Performed before the reject() method.
 void processException(java.lang.Exception pException, atg.commerce.order.Order pOrder)
          Checks for a concurrent update in the exception
protected  boolean reject(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Executes the changeEnvironment method to complete the environment change process.
protected  void releaseTransactionLock(atg.servlet.DynamoHttpServletRequest pRequest)
          Attempt to release the local lock that was acquired before creating a transaction that may have modified the order, but only if useLocksAroundTransactions is set to true.
 void setApprovalId(java.lang.String pApprovalId)
          Sets the Approval ID, used in the approval and rejection process.
 void setApprovalsManager(ApprovalsManager pApprovalsManager)
          Sets the Approvals Manager
 void setAutoSendApprovalAcceptedEmail(boolean pAutoSendApprovalAcceptedEmail)
          Sets the auto send approval accepted email configuration
 void setAutoSendApprovalRejectedEmail(boolean pAutoSendApprovalRejectedEmail)
          Sets the auto send approval rejected email configuration
 void setConfirmationInfo(ConfirmationInfo pConfirmationInfo)
          Sets the confirmation info component used to send emails
 void setCSRAgentTools(CSRAgentTools pCSRAgentTools)
          Sets the property CSRAgentTools.
 void setCustomerEmail(java.lang.String pCustomerEmail)
          Sets the customer email as a String.
 void setCustomerProfileIdParameterName(java.lang.String pCustomerProfileIdParameterName)
          Sets the customer profile ID parameter name as a String.
 void setEnsureTransaction(boolean pEnsureTransaction)
          Enables and disables the ensure transaction check
 void setOrderApprovalTools(OrderApprovalTools pOrderApprovalTools)
          Sets the order approval tools
 void setProfile(atg.userprofiling.Profile pProfile)
          Sets the profile
protected  void setTransactionCreated(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
           
 void setTransactionLockFactory(atg.commerce.util.TransactionLockFactory pTransactionLockFactory)
          The transactionLockFactory is used to get the locks if useLocksArountTransactions is true
protected  void setupInputParameters(java.util.Map pInputParameters, atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
          Extended to load the approval object based on the id and determine the environment objects: customer profile and ticket, that should be loaded into global context before the approval is executed.
protected  void unsetTransactionCreated(atg.servlet.DynamoHttpServletRequest pRequest, atg.servlet.DynamoHttpServletResponse pResponse)
           
 
Methods inherited from class atg.svc.agent.environment.EnvironmentChangeFormHandler
addRedirectURLParams, changeEnvironment, conformRedirectURL, getApplicationName, getConfirmPromptURL, getConfirmURL, getEnvironmentChangeKey, getEnvironmentChangeState, getEnvironmentTools, getErrorURL, getInputParameters, getMessageTools, getSuccessURL, getTicketDispositionChangeHandler, getTicketDispositionOptions, getTicketingTools, getTransactionManager, getUserLocale, getUserMessage, getUserMessage, handleChangeEnvironment, initChangeState, initChangeState, isDoTicketDispositionPrompt, isDoWarnings, isInitChangeState, isShowDispositionPrompt, postChangeEnvironment, preChangeEnvironment, setApplicationName, setConfirmPromptURL, setConfirmURL, setDoTicketDispositionPrompt, setDoWarnings, setEnvironmentChangeKey, setEnvironmentChangeState, setEnvironmentTools, setErrorURL, setInitChangeState, setInputParameters, setMessageTools, setSuccessURL, setTicketDispositionChangeHandler, setTicketDispositionOptions, setTicketingTools, setTransactionManager
 
Methods inherited from class atg.droplet.GenericFormHandler
addFormException, addUncheckedFormException, 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, 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


INPUT_PARAM_APPROVAL_ID

public static final java.lang.String INPUT_PARAM_APPROVAL_ID
input parameter used to store the approvalId

See Also:
Constant Field Values

INPUT_PARAM_APPROVAL

public static final java.lang.String INPUT_PARAM_APPROVAL
input parameter name used to store the Approval object that's loaded from the id

See Also:
Constant Field Values

PARAM_TRANSACTION_CREATED

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

PARAM_VALUE_TRUE

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

LOCK_NAME_ATTRIBUTE_NAME

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

mApprovalsManager

protected ApprovalsManager mApprovalsManager

mProfile

protected atg.userprofiling.Profile mProfile

mCSRAgentTools

protected CSRAgentTools mCSRAgentTools

mAutoSendApprovalAcceptedEmail

protected boolean mAutoSendApprovalAcceptedEmail

mAutoSendApprovalRejectedEmail

protected boolean mAutoSendApprovalRejectedEmail

mConfirmationInfo

protected ConfirmationInfo mConfirmationInfo

mOrderApprovalTools

protected OrderApprovalTools mOrderApprovalTools

mApprovalId

protected java.lang.String mApprovalId

mCustomerEmail

protected java.lang.String mCustomerEmail

mEnsureTransaction

protected boolean mEnsureTransaction

mCustomerProfileIdParameterName

protected java.lang.String mCustomerProfileIdParameterName
Constructor Detail

OrderApprovalFormHandler

public OrderApprovalFormHandler()
Method Detail

getApprovalsManager

public ApprovalsManager getApprovalsManager()
reference to the ApprovalsManager component used to execute the approval process.


setApprovalsManager

public void setApprovalsManager(ApprovalsManager pApprovalsManager)
Sets the Approvals Manager


getProfile

public atg.userprofiling.Profile getProfile()
reference to the current profile, used to get the approving agent


setProfile

public void setProfile(atg.userprofiling.Profile pProfile)
Sets the profile


setCSRAgentTools

public void setCSRAgentTools(CSRAgentTools pCSRAgentTools)
Sets the property CSRAgentTools.


getCSRAgentTools

public CSRAgentTools getCSRAgentTools()
Returns:
The CSRAgentTools component used to manipulate the profile

setAutoSendApprovalAcceptedEmail

public void setAutoSendApprovalAcceptedEmail(boolean pAutoSendApprovalAcceptedEmail)
Sets the auto send approval accepted email configuration

Parameters:
pAutoSendApprovalAcceptedEmail - the AutoSendApprovalAcceptedEmail to set

getAutoSendApprovalAcceptedEmail

public boolean getAutoSendApprovalAcceptedEmail()
Returns the auto send approval accepted email configuration

Returns:
the mAutoSendApprovalAcceptedEmail

setAutoSendApprovalRejectedEmail

public void setAutoSendApprovalRejectedEmail(boolean pAutoSendApprovalRejectedEmail)
Sets the auto send approval rejected email configuration

Parameters:
pAutoSendApprovalRejectedEmail - the AutoSendApprovalRejectedEmail to set

getAutoSendApprovalRejectedEmail

public boolean getAutoSendApprovalRejectedEmail()
Returns the auto send approval rejected email configuration

Returns:
the mAutoSendApprovalRejectedEmail

setConfirmationInfo

public void setConfirmationInfo(ConfirmationInfo pConfirmationInfo)
Sets the confirmation info component used to send emails

Parameters:
pConfirmationInfo - the ConfirmationInfo to set

getConfirmationInfo

public ConfirmationInfo getConfirmationInfo()
Returns the confirmation info component used to send emails

Returns:
the mConfirmationInfo

setOrderApprovalTools

public void setOrderApprovalTools(OrderApprovalTools pOrderApprovalTools)
Sets the order approval tools

Parameters:
pOrderApprovalTools - the OrderApprovalTools to set

getOrderApprovalTools

public OrderApprovalTools getOrderApprovalTools()
Returns the order approval tools

Returns:
the OrderApprovalTools

setApprovalId

public void setApprovalId(java.lang.String pApprovalId)
Sets the Approval ID, used in the approval and rejection process.

Parameters:
pApprovalId - the ApprovalId to set

getApprovalId

public java.lang.String getApprovalId()
Returns the Approval ID, used in the approval and rejection process.

Returns:
the ApprovalId

setCustomerEmail

public void setCustomerEmail(java.lang.String pCustomerEmail)
Sets the customer email as a String.

Parameters:
pCustomerEmail - the Customer Email to set

getCustomerEmail

public java.lang.String getCustomerEmail()
Returns the customer email as a String.

Returns:
the Customer Email

setEnsureTransaction

public void setEnsureTransaction(boolean pEnsureTransaction)
Enables and disables the ensure transaction check


isEnsureTransaction

public boolean isEnsureTransaction()
Enables and disables the ensure transaction check. If disabled the form handler wont guarantee a transaction


setTransactionLockFactory

public void setTransactionLockFactory(atg.commerce.util.TransactionLockFactory pTransactionLockFactory)
The transactionLockFactory is used to get the locks if useLocksArountTransactions is true


getTransactionLockFactory

public atg.commerce.util.TransactionLockFactory getTransactionLockFactory()
The transactionLockFactory is used to get the locks if useLocksArountTransactions is true


setCustomerProfileIdParameterName

public void setCustomerProfileIdParameterName(java.lang.String pCustomerProfileIdParameterName)
Sets the customer profile ID parameter name as a String.

Parameters:
pCustomerProfileIdParameterName - the CustomerProfileIdParameterName to set

getCustomerProfileIdParameterName

public java.lang.String getCustomerProfileIdParameterName()
Returns the customer profile ID parameter name as a String.

Returns:
the mCustomerProfileIdParameterName

setupInputParameters

protected void setupInputParameters(java.util.Map pInputParameters,
                                    atg.servlet.DynamoHttpServletRequest pRequest,
                                    atg.servlet.DynamoHttpServletResponse pResponse)
                             throws atg.svc.agent.environment.EnvironmentException
Extended to load the approval object based on the id and determine the environment objects: customer profile and ticket, that should be loaded into global context before the approval is executed. These objects are added as input parameters to the environment change.

Overrides:
setupInputParameters in class atg.svc.agent.environment.EnvironmentChangeFormHandler
Parameters:
pInputParameters - - a map of input parameters
pRequest -
pResponse -
Throws:
atg.svc.agent.environment.EnvironmentException

preApprove

protected boolean preApprove(atg.servlet.DynamoHttpServletRequest pRequest,
                             atg.servlet.DynamoHttpServletResponse pResponse)
                      throws javax.servlet.ServletException,
                             java.io.IOException
Performed before the approve() method. This method sets up the environment and changes the order state to INCOMPLETE prior to being approved

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

preReject

protected boolean preReject(atg.servlet.DynamoHttpServletRequest pRequest,
                            atg.servlet.DynamoHttpServletResponse pResponse)
                     throws javax.servlet.ServletException,
                            java.io.IOException
Performed before the reject() method. This method sets up the environment and changes the order state to INCOMPLETE prior to being rejected

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

handleApprove

public boolean handleApprove(atg.servlet.DynamoHttpServletRequest pRequest,
                             atg.servlet.DynamoHttpServletResponse pResponse)
                      throws javax.servlet.ServletException,
                             java.io.IOException
Executes the environment change and approval process.

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

handleReject

public boolean handleReject(atg.servlet.DynamoHttpServletRequest pRequest,
                            atg.servlet.DynamoHttpServletResponse pResponse)
                     throws javax.servlet.ServletException,
                            java.io.IOException
Executes the environment change and rejection process.

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

postApprove

protected boolean postApprove(atg.servlet.DynamoHttpServletRequest pRequest,
                              atg.servlet.DynamoHttpServletResponse pResponse)
                       throws javax.servlet.ServletException,
                              java.io.IOException
If there are no errors, adds a success message to the message bar.

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

initializeConfirmationInfoForApprove

protected boolean initializeConfirmationInfoForApprove(Approval pApproval)
Initializes the confirmation info object when an order is approved

Parameters:
Approval - - the approval to use in the confirmation message
Returns:
boolean - returns false if no customer email on the approval

initializeConfirmationInfoForReject

protected boolean initializeConfirmationInfoForReject(Approval pApproval)
Initializes the confirmation info object when an order is rejected

Parameters:
Approval - - the approval to use in the confirmation message
Returns:
boolean - returns false if no customer email on the approval

postReject

protected boolean postReject(atg.servlet.DynamoHttpServletRequest pRequest,
                             atg.servlet.DynamoHttpServletResponse pResponse)
                      throws javax.servlet.ServletException,
                             java.io.IOException
If there are no errors, adds a rejection success message to the message bar.

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

approve

protected boolean approve(atg.servlet.DynamoHttpServletRequest pRequest,
                          atg.servlet.DynamoHttpServletResponse pResponse)
                   throws javax.servlet.ServletException,
                          java.io.IOException
Executes the changeEnvironment method to complete the environment change process. After which, the ApprovalsManager is called to execute the approval process.

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

reject

protected boolean reject(atg.servlet.DynamoHttpServletRequest pRequest,
                         atg.servlet.DynamoHttpServletResponse pResponse)
                  throws javax.servlet.ServletException,
                         java.io.IOException
Executes the changeEnvironment method to complete the environment change process. After which, the ApprovalsManager is called to execute the rejection process.

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

beforeSet

public boolean beforeSet(atg.servlet.DynamoHttpServletRequest pRequest,
                         atg.servlet.DynamoHttpServletResponse pResponse)
                  throws atg.droplet.DropletFormException
Called before any setX methods on this form are set when a form that modifies properties of this form handler is submitted. Creates a transaction if necessary at the beginning of the form submission process, optionally obtaining a local lock to prevent multiple forms from creating transactions that may modify the same order.

Specified by:
beforeSet in interface atg.droplet.DropletFormHandler
Overrides:
beforeSet in class atg.droplet.GenericFormHandler
Parameters:
pRequest - a DynamoHttpServletRequest value
pResponse - a DynamoHttpServletResponse value
Returns:
a boolean value
Throws:
atg.droplet.DropletFormException - if an error occurs
See Also:
afterSet(atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse), ensureTransaction(), #setUseLocksAroundTransactions

afterSet

public boolean afterSet(atg.servlet.DynamoHttpServletRequest pRequest,
                        atg.servlet.DynamoHttpServletResponse pResponse)
                 throws atg.droplet.DropletFormException
Called after any setX methods on this form are set when a form that modifies properties of this form handler is submitted. Commits or rolls back any transaction created in beforeSet, and releases any lock that was acquired at the time.

Specified by:
afterSet in interface atg.droplet.DropletFormHandler
Overrides:
afterSet in class atg.droplet.GenericFormHandler
Parameters:
pRequest - a DynamoHttpServletRequest value
pResponse - a DynamoHttpServletResponse value
Returns:
a boolean value
Throws:
atg.droplet.DropletFormException - if an error occurs
See Also:
beforeSet(atg.servlet.DynamoHttpServletRequest, atg.servlet.DynamoHttpServletResponse), ensureTransaction(), #setUseLocksAroundTransactions

ensureTransaction

protected javax.transaction.Transaction ensureTransaction()
This method ensures that a transaction exists before returning. If there is no transaction, a new one is started and returned. In this case, you must call commitTransaction when the transaction completes.

Returns:
a Transaction value

getCurrentTransaction

public javax.transaction.Transaction getCurrentTransaction()
Returns property currentTransaction

Returns:
returns property currentTransaction

commitTransaction

protected void commitTransaction(javax.transaction.Transaction pTransaction)
Commits the supplied transaction

Parameters:
pTransaction - a Transaction value

processException

public void processException(java.lang.Exception pException,
                             atg.commerce.order.Order pOrder)
Checks for a concurrent update in the exception

Parameters:
pException - an Exception value
pOrder - a DynamoHttpServletResponse value

isTransactionMarkedAsRollBack

protected boolean isTransactionMarkedAsRollBack()
Returns true if the transaction associated with the current thread is marked for rollback. This is useful if you do not want to perform some action (e.g. updating the order) if some other subservice already needs the transaction rolledback.

Returns:
a boolean value

setTransactionCreated

protected void setTransactionCreated(atg.servlet.DynamoHttpServletRequest pRequest,
                                     atg.servlet.DynamoHttpServletResponse pResponse)

unsetTransactionCreated

protected void unsetTransactionCreated(atg.servlet.DynamoHttpServletRequest pRequest,
                                       atg.servlet.DynamoHttpServletResponse pResponse)

isTransactionCreated

protected boolean isTransactionCreated(atg.servlet.DynamoHttpServletRequest pRequest,
                                       atg.servlet.DynamoHttpServletResponse pResponse)

acquireTransactionLock

protected void acquireTransactionLock(atg.servlet.DynamoHttpServletRequest pRequest)
                               throws atg.service.lockmanager.DeadlockException
Attempt to acquire a local lock before creating a transaction that may modify the order, but only if useLocksAroundTransactions is set to true.

Parameters:
pRequest -
Throws:
atg.service.lockmanager.DeadlockException

releaseTransactionLock

protected void releaseTransactionLock(atg.servlet.DynamoHttpServletRequest pRequest)
                               throws atg.service.lockmanager.LockManagerException
Attempt to release the local lock that was acquired before creating a transaction that may have modified the order, but only if useLocksAroundTransactions is set to true.

Parameters:
pRequest -
Throws:
atg.service.lockmanager.LockManagerException