atg.commerce.order.purchase
Class CancelOrderFormHandler

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.commerce.order.purchase.PurchaseProcessFormHandler
                      extended by atg.commerce.order.purchase.CancelOrderFormHandler
All Implemented Interfaces:
atg.commerce.util.PipelineErrorHandler, DropletFormHandler, atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class CancelOrderFormHandler
extends PurchaseProcessFormHandler

The CancelOrderFormHandler is used to cancel the user's current Order, which deletes the Order from the ShoppingCart.

See Also:
GenericFormHandler, PurchaseProcessFormHandler

Field Summary
static java.lang.String CLASS_VERSION
           
static java.lang.String MSG_ERROR_CANCELLING_ORDER
           
static java.lang.String MSG_ERROR_LOADING_ORDER
           
static java.lang.String MSG_ERROR_SENDING_MESSAGE
           
static java.lang.String MSG_INVALID_ORDER_ID
           
static java.lang.String MSG_ORDER_NOT_CURRENT
           
static java.lang.String MSG_USER_INFO_NOT_AVAILABLE
           
static java.lang.String MSG_USER_NO_PERMISSION_TO_CANCEL
           
 
Fields inherited from class atg.commerce.order.purchase.PurchaseProcessFormHandler
LOCK_NAME_ATTRIBUTE_NAME, PARAM_TRANSACTION_CREATED, PARAM_VALUE_TRUE
 
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
CancelOrderFormHandler()
          Creates a new CancelOrderFormHandler instance.
 
Method Summary
 void cancelOrder(Order pOrder, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method calls the CancelOrderService.cancelOrder method.
protected  boolean canUserCancelOrder(Order pOrder, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Checks whether the order is created by the user in the request.
 void deleteOrder(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Deprecated. This method is not used anymore, See CancelOrderService
 void deleteOrder(java.lang.String pOrderId)
          Deprecated. This method is not used anymore, See CancelOrderService
 java.lang.String getCancelOrderErrorURL()
          Return the CancelOrderErrorURL property.
 atg.commerce.order.CancelOrderService getCancelOrderService()
          The Nucleus service used to cancel orders
 java.lang.String getCancelOrderSuccessURL()
          Return the CancelOrderSuccessURL property.
 java.lang.String[] getDeleteStates()
          Return the DeleteStates property.
 java.lang.String[] getIgnoreStates()
          Return the IgnoreStates property.
 MessageSender getMessageSender()
          Return the MessageSender property.
 java.lang.String getOrderIdToCancel()
          Return the OrderIdToCancel property.
 boolean handleCancelCurrentOrder(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          The handleCancelCurrentOrder method cancels the ShoppingCart's current order.
 boolean handleCancelOrder(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          The handleCancelOrder method cancels the Order specified by the OrderIdToCancel property.
 boolean isDeleteState(int pState)
          Deprecated. This method is not used anymore, See CancelOrderService
 boolean isIgnoreState(int pState)
          Deprecated. This method is not used anymore, See CancelOrderService
 void postCancelOrder(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          postCancelOrder is used for work that must happen after the Order is cancelled.
 void preCancelOrder(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          preCancelOrder is used for work that must happen before the Order is cancelled.
 void preserveOrder(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Deprecated. This method is not used anymore, See CancelOrderService
 void setCancelOrderErrorURL(java.lang.String pCancelOrderErrorURL)
          Set the CancelOrderErrorURL property.
 void setCancelOrderService(atg.commerce.order.CancelOrderService pCancelOrderService)
          The Nucleus service used to cancel orders
 void setCancelOrderSuccessURL(java.lang.String pCancelOrderSuccessURL)
          Set the CancelOrderSuccessURL property.
 void setDeleteStates(java.lang.String[] pDeleteStates)
          Set the DeleteStates property.
 void setIgnoreStates(java.lang.String[] pIgnoreStates)
          Set the IgnoreStates property.
 void setMessageSender(MessageSender pMessageSender)
          Set the MessageSender property.
 void setOrderIdToCancel(java.lang.String pOrderIdToCancel)
          Set the OrderIdToCancel property.
 
Methods inherited from class atg.commerce.order.purchase.PurchaseProcessFormHandler
acquireTransactionLock, acquireTransactionLock, afterSet, beforeSet, checkFormRedirect, commitTransaction, copyConfiguration, createRepriceParameterMap, defaultLocalLockManager, defaultUserProfile, doStartService, ensureTransaction, formatUserMessage, formatUserMessage, formatUserMessage, formatUserMessage, generatePropertyPath, getClaimableManager, getCommerceIdentifierPaymentInfoContainer, getCommerceItemManager, getCommerceItemShippingInfoContainer, getCommerceProfileTools, getCommercePropertyManager, getConfiguration, getCurrentTransaction, getDefaultLocale, getGiftlistManager, getHandlingInstructionManager, getLocalLockManager, getOrder, getOrderManager, getPaymentGroupManager, getPaymentGroupMapContainer, getPipelineManager, getPriceList, getPriceListId, getPriceListManager, getProfile, getProfileRepository, getPurchaseProcessHelper, getRepeatingRequestMonitor, getRepriceOrderChainId, getResourceBundle, getResourceBundle, getResourceBundleName, getSessionExpirationURL, getShippingGroupManager, getShippingGroupMapContainer, getShoppingCart, getTransactionManager, getUserLocale, getUserLocale, getUserPricingModels, handlePipelineError, isConcurrentUpdate, isEnsureTransaction, isFormSubmission, isTransactionCreated, isTransactionMarkedAsRollBack, isUseLocksAroundTransactions, isUseRequestLocale, processException, processPipelineErrors, releaseTransactionLock, releaseTransactionLock, runProcess, runProcess, runProcess, runProcessRepriceOrder, runProcessRepriceOrder, runRepricingProcess, setClaimableManager, setCommerceIdentifierPaymentInfoContainer, setCommerceItemManager, setCommerceItemShippingInfoContainer, setCommerceProfileTools, setCommercePropertyManager, setConfiguration, setCurrentTransaction, setDefaultLocale, setEnsureTransaction, setGiftlistManager, setHandlingInstructionManager, setLocalLockManager, setOrder, setOrderManager, setPaymentGroupManager, setPaymentGroupMapContainer, setPipelineManager, setPriceListId, setPriceListManager, setProfile, setProfileRepository, setPurchaseProcessHelper, setRepeatingRequestMonitor, setRepriceOrderChainId, setSessionExpirationURL, setShippingGroupManager, setShippingGroupMapContainer, setShoppingCart, setTransactionCreated, setTransactionManager, setTransactionToRollbackOnly, setUseLocksAroundTransactions, setUseRequestLocale, setUserLocale, setUserPricingModels, transactionLockName, unsetTransactionCreated
 
Methods inherited from class atg.droplet.GenericFormHandler
addFormException, addUncheckedFormException, 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, 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

MSG_INVALID_ORDER_ID

public static final java.lang.String MSG_INVALID_ORDER_ID
See Also:
Constant Field Values

MSG_ERROR_LOADING_ORDER

public static final java.lang.String MSG_ERROR_LOADING_ORDER
See Also:
Constant Field Values

MSG_ERROR_SENDING_MESSAGE

public static final java.lang.String MSG_ERROR_SENDING_MESSAGE
See Also:
Constant Field Values

MSG_ERROR_CANCELLING_ORDER

public static final java.lang.String MSG_ERROR_CANCELLING_ORDER
See Also:
Constant Field Values

MSG_ORDER_NOT_CURRENT

public static final java.lang.String MSG_ORDER_NOT_CURRENT
See Also:
Constant Field Values

MSG_USER_NO_PERMISSION_TO_CANCEL

public static final java.lang.String MSG_USER_NO_PERMISSION_TO_CANCEL
See Also:
Constant Field Values

MSG_USER_INFO_NOT_AVAILABLE

public static final java.lang.String MSG_USER_INFO_NOT_AVAILABLE
See Also:
Constant Field Values
Constructor Detail

CancelOrderFormHandler

public CancelOrderFormHandler()
Creates a new CancelOrderFormHandler instance.

Method Detail

setCancelOrderSuccessURL

public void setCancelOrderSuccessURL(java.lang.String pCancelOrderSuccessURL)
Set the CancelOrderSuccessURL property.

Parameters:
pCancelOrderSuccessURL - a String value

getCancelOrderSuccessURL

public java.lang.String getCancelOrderSuccessURL()
Return the CancelOrderSuccessURL property.

Returns:
a String value

setCancelOrderErrorURL

public void setCancelOrderErrorURL(java.lang.String pCancelOrderErrorURL)
Set the CancelOrderErrorURL property.

Parameters:
pCancelOrderErrorURL - a String value

getCancelOrderErrorURL

public java.lang.String getCancelOrderErrorURL()
Return the CancelOrderErrorURL property.

Returns:
a String value

setOrderIdToCancel

public void setOrderIdToCancel(java.lang.String pOrderIdToCancel)
Set the OrderIdToCancel property.

Parameters:
pOrderIdToCancel - a String value

getOrderIdToCancel

public java.lang.String getOrderIdToCancel()
Return the OrderIdToCancel property.

Returns:
a String value

setDeleteStates

public void setDeleteStates(java.lang.String[] pDeleteStates)
Set the DeleteStates property. This property is the list of states for which Order cancellation entails explicit Order deletion. All other states will invoke alternate behavior.

Parameters:
pDeleteStates - a String[] value

getDeleteStates

public java.lang.String[] getDeleteStates()
Return the DeleteStates property. This property is the list of states for which Order cancellation entails explicit Order deletion. All other states will invoke alternate behavior.

Returns:
a String[] value

setIgnoreStates

public void setIgnoreStates(java.lang.String[] pIgnoreStates)
Set the IgnoreStates property. This property is the list of states for which Order cancellation need not be performed. The default is the PENDING_REMOVE state, which indicates the remove has been requested but hasn't finished processing.

Parameters:
pIgnoreStates - a String[] value

getIgnoreStates

public java.lang.String[] getIgnoreStates()
Return the IgnoreStates property. This property is the list of states for which Order cancellation need not be performed. The default is the PENDING_REMOVE state, which indicates the remove has been requested but hasn't finished processing.

Returns:
a String[] value

setMessageSender

public void setMessageSender(MessageSender pMessageSender)
Set the MessageSender property.

Parameters:
pMessageSender - a MessageSender value

getMessageSender

public MessageSender getMessageSender()
Return the MessageSender property.

Returns:
a MessageSender value

setCancelOrderService

public void setCancelOrderService(atg.commerce.order.CancelOrderService pCancelOrderService)
The Nucleus service used to cancel orders

Parameters:
pCancelOrderService - a CancelOrderService value

getCancelOrderService

public atg.commerce.order.CancelOrderService getCancelOrderService()
The Nucleus service used to cancel orders


preCancelOrder

public void preCancelOrder(DynamoHttpServletRequest pRequest,
                           DynamoHttpServletResponse pResponse)
                    throws javax.servlet.ServletException,
                           java.io.IOException
preCancelOrder is used for work that must happen before the Order is cancelled.

Parameters:
pRequest - a DynamoHttpServletRequest value
pResponse - a DynamoHttpServletResponse value
Throws:
javax.servlet.ServletException - if an error occurs
java.io.IOException - if an error occurs

postCancelOrder

public void postCancelOrder(DynamoHttpServletRequest pRequest,
                            DynamoHttpServletResponse pResponse)
                     throws javax.servlet.ServletException,
                            java.io.IOException
postCancelOrder is used for work that must happen after the Order is cancelled.

Parameters:
pRequest - a DynamoHttpServletRequest value
pResponse - a DynamoHttpServletResponse value
Throws:
javax.servlet.ServletException - if an error occurs
java.io.IOException - if an error occurs

handleCancelOrder

public boolean handleCancelOrder(DynamoHttpServletRequest pRequest,
                                 DynamoHttpServletResponse pResponse)
                          throws javax.servlet.ServletException,
                                 java.io.IOException
The handleCancelOrder method cancels the Order specified by the OrderIdToCancel property.

Parameters:
pRequest - a DynamoHttpServletRequest value
pResponse - a DynamoHttpServletResponse value
Returns:
a boolean value
Throws:
javax.servlet.ServletException - if an error occurs
java.io.IOException - if an error occurs

handleCancelCurrentOrder

public boolean handleCancelCurrentOrder(DynamoHttpServletRequest pRequest,
                                        DynamoHttpServletResponse pResponse)
                                 throws javax.servlet.ServletException,
                                        java.io.IOException
The handleCancelCurrentOrder method cancels the ShoppingCart's current order. If the OrderIdToCancel property is set, its value is compared to the current order to make sure they match.

Parameters:
pRequest - a DynamoHttpServletRequest value
pResponse - a DynamoHttpServletResponse value
Returns:
a boolean value
Throws:
javax.servlet.ServletException - if an error occurs
java.io.IOException - if an error occurs

cancelOrder

public void cancelOrder(Order pOrder,
                        DynamoHttpServletRequest pRequest,
                        DynamoHttpServletResponse pResponse)
                 throws javax.servlet.ServletException,
                        java.io.IOException
This method calls the CancelOrderService.cancelOrder method. All logic for what to do happens there.

Parameters:
pOrder - the Order to be canceled
pRequest - a DynamoHttpServletRequest value
pResponse - a DynamoHttpServletResponse value
Throws:
javax.servlet.ServletException - if an error occurs
java.io.IOException - if an error occurs

deleteOrder

public void deleteOrder(java.lang.String pOrderId)
Deprecated. This method is not used anymore, See CancelOrderService

deleteOrder is used to handle an Order whose state is one of the configured DeleteStates of this component. This deletes the specified order if that order is in the ShoppingCart.

Parameters:
pOrderId - the ID of the Order to be deleted
Throws:
javax.servlet.ServletException - if an error occurs
java.io.IOException - if an error occurs

deleteOrder

public void deleteOrder(DynamoHttpServletRequest pRequest,
                        DynamoHttpServletResponse pResponse)
                 throws javax.servlet.ServletException,
                        java.io.IOException
Deprecated. This method is not used anymore, See CancelOrderService

deleteOrder is used to handle an Order whose state is one of the configured DeleteStates of this component. This deletes the Order identified by the orderIdToCancel property if that order is in the ShoppingCart.

Parameters:
pRequest - a DynamoHttpServletRequest value
pResponse - a DynamoHttpServletResponse value
Throws:
javax.servlet.ServletException - if an error occurs
java.io.IOException - if an error occurs

preserveOrder

public void preserveOrder(DynamoHttpServletRequest pRequest,
                          DynamoHttpServletResponse pResponse)
                   throws javax.servlet.ServletException,
                          java.io.IOException
Deprecated. This method is not used anymore, See CancelOrderService

preserveOrderis used to handle an Order whose state is not one of the configured DeleteStates of this component. This is used to send a ModifyOrder message to Fulfillment with a GenericRemove Modification.

Parameters:
pRequest - a DynamoHttpServletRequest value
pResponse - a DynamoHttpServletResponse value
Throws:
javax.servlet.ServletException - if an error occurs
java.io.IOException - if an error occurs

isDeleteState

public boolean isDeleteState(int pState)
Deprecated. This method is not used anymore, See CancelOrderService

isDeleteState returns a boolean indicating whether the Order's state is one of the DeleteStates.

Parameters:
pState - an int value
Returns:
a boolean value

isIgnoreState

public boolean isIgnoreState(int pState)
Deprecated. This method is not used anymore, See CancelOrderService

isIgnoreState returns a boolean indicating whether the Order's state is one of the IgnoreStates.

Parameters:
pState - an int value
Returns:
a boolean value

canUserCancelOrder

protected boolean canUserCancelOrder(Order pOrder,
                                     DynamoHttpServletRequest pRequest,
                                     DynamoHttpServletResponse pResponse)
                              throws javax.servlet.ServletException,
                                     java.io.IOException
Checks whether the order is created by the user in the request.

Parameters:
pOrder - is the order to check
pRequest - is the request created for user's session
pResponse - is the response to the user'ns request.
Returns:
true if order is created by the user, otherwise returns false
Throws:
javax.servlet.ServletException - if an error occurs
java.io.IOException - if an error occurs