atg.commerce.order.purchase
Class CommitOrderFormHandler

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.CommitOrderFormHandler
All Implemented Interfaces:
atg.commerce.util.PipelineErrorHandler, DropletFormHandler, NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class CommitOrderFormHandler
extends PurchaseProcessFormHandler

The CommitOrderFormHandler is used to submit the Order for final confirmation. This calls the OrderManager's processOrder method. If there are no errors with processing the Order, then the current Order in the user's ShoppingCart will be set to null and the submitted Order will become the ShoppingCart's last Order.

See Also:
GenericFormHandler, PurchaseProcessFormHandler

Field Summary
static java.lang.String CLASS_VERSION
           
static java.lang.String MSG_COMMIT_ERROR
           
static java.lang.String MSG_ORDER_ALREADY_SUBMITTED
           
static java.lang.String MSG_ORDER_EMPTY
           
static java.lang.String MSG_ORDER_NOT_CURRENT
           
 
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
CommitOrderFormHandler()
          Creates a new CommitOrderFormHandler instance.
 
Method Summary
 void commitOrder(Order pOrder, DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method is called between preCommitOrder and postCommitOrder.
 boolean getAllowEmptyOrders()
          Return the allowEmptyOrders property.
 java.lang.String getCommitOrderErrorURL()
          Returns property CommitOrderErrorURL
 java.lang.String getCommitOrderSuccessURL()
          Returns property CommitOrderSuccessURL
 java.lang.String getOrderId()
          Return the OrderId property.
 java.util.HashMap getProcessOrderMap(java.util.Locale pLocale)
          This method calls the OrderManager.getProcessOrderMap(pLocale, map) to get the process order map and adds sales channel to the map.
 java.lang.String getSalesChannel()
          Returns the salesChannel.
 boolean handleCommitOrder(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          This method is used to submit the current order.
 void postCommitOrder(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Called after all processing is done by the handleCommitOrder method.
 void preCommitOrder(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          Called before any processing is done by the handleCommitOrder method.
 void setAllowEmptyOrders(boolean pAllowEmptyOrders)
          Set the allowEmptyOrders property.
 void setCommitOrderErrorURL(java.lang.String pCommitOrderErrorURL)
          Sets property CommitOrderErrorURL
 void setCommitOrderSuccessURL(java.lang.String pCommitOrderSuccessURL)
          Sets property CommitOrderSuccessURL
 void setOrderId(java.lang.String pOrderId)
          Set the OrderId property.
 void setSalesChannel(java.lang.String pSalesChannel)
          Sets the salesChannel.
 
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, getResourceBundleName, getSessionExpirationURL, getShippingGroupManager, getShippingGroupMapContainer, getShoppingCart, getTransactionManager, getUserLocale, getUserLocale, getUserPricingModels, handlePipelineError, 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, 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 java.lang.String CLASS_VERSION

MSG_COMMIT_ERROR

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

MSG_ORDER_ALREADY_SUBMITTED

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

MSG_ORDER_EMPTY

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

MSG_ORDER_NOT_CURRENT

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

CommitOrderFormHandler

public CommitOrderFormHandler()
Creates a new CommitOrderFormHandler instance.

Method Detail

getSalesChannel

public java.lang.String getSalesChannel()
Returns the salesChannel. Returns the sales channel which is used to submit the order. This could be "Web", "Call Center", or "Scheduled Orders". These values are defined in the order repository.

Returns:
salesChannel

setSalesChannel

public void setSalesChannel(java.lang.String pSalesChannel)
Sets the salesChannel. Sets the sales channel which is used to submit the order. This could be "Web", "Call Center", or "Scheduled Orders". These values are defined in the order repository.

Parameters:
pSalesChannel -

setOrderId

public void setOrderId(java.lang.String pOrderId)
Set the OrderId property.

Parameters:
pOrderId - a String value

getOrderId

public java.lang.String getOrderId()
Return the OrderId property.

Returns:
a String value

setAllowEmptyOrders

public void setAllowEmptyOrders(boolean pAllowEmptyOrders)
Set the allowEmptyOrders property.

Parameters:
pAllowEmptyOrders - if false, handleCommit adds a form exception if called for an order with no items

getAllowEmptyOrders

public boolean getAllowEmptyOrders()
Return the allowEmptyOrders property.

Returns:
a boolean value

setCommitOrderSuccessURL

public void setCommitOrderSuccessURL(java.lang.String pCommitOrderSuccessURL)
Sets property CommitOrderSuccessURL

Parameters:
pCommitOrderSuccessURL - a String value

getCommitOrderSuccessURL

public java.lang.String getCommitOrderSuccessURL()
Returns property CommitOrderSuccessURL

Returns:
a String value

setCommitOrderErrorURL

public void setCommitOrderErrorURL(java.lang.String pCommitOrderErrorURL)
Sets property CommitOrderErrorURL

Parameters:
pCommitOrderErrorURL - a String value

getCommitOrderErrorURL

public java.lang.String getCommitOrderErrorURL()
Returns property CommitOrderErrorURL

Returns:
a String value

preCommitOrder

public void preCommitOrder(DynamoHttpServletRequest pRequest,
                           DynamoHttpServletResponse pResponse)
                    throws javax.servlet.ServletException,
                           java.io.IOException
Called before any processing is done by the handleCommitOrder method. The default implementation does nothing. This method is called from within a synchronized block that synchronizes on the current order object.

Parameters:
pRequest - the request object
pResponse - the response object
Throws:
javax.servlet.ServletException - if an error occurs
java.io.IOException - if an error occurs

postCommitOrder

public void postCommitOrder(DynamoHttpServletRequest pRequest,
                            DynamoHttpServletResponse pResponse)
                     throws javax.servlet.ServletException,
                            java.io.IOException
Called after all processing is done by the handleCommitOrder method. The default implementation does nothing. This method is called from within a synchronized block that synchronizes on the current order object.

By the time this method is called the order has been committed to the database by calling OrderManager.processOrder. If an application modifies the order within its own postCommitOrder method, that method is responsible for saving the new state of the order by calling OrderManager.updateOrder.

Parameters:
pRequest - the request object
pResponse - the response object
Throws:
javax.servlet.ServletException - if an error occurs
java.io.IOException - if an error occurs

handleCommitOrder

public boolean handleCommitOrder(DynamoHttpServletRequest pRequest,
                                 DynamoHttpServletResponse pResponse)
                          throws javax.servlet.ServletException,
                                 java.io.IOException
This method is used to submit the current order. It calls the preCommitOrder method, allowing the application to do any required work before the order is submitted. Next it ensures that the user is not trying to double submit the order by seeing if the shopping cart last order id is is equal to the current order id.

Assuming the order is not a duplicate submission, the form handler calls OrderManager.processOrder to actually place the order. If placing the order succeeds, then the form handler sets the shopping cart lastOrder to the current (just submitted) order and the currentOrder to null. Finally, it calls the postCommitOrder method for any application-specific post-processing.

Parameters:
pRequest - the servlet's request
pResponse - the servlet's response
Returns:
a boolean value
Throws:
javax.servlet.ServletException - if there was an error while executing the code
java.io.IOException - if there was an error with servlet io

commitOrder

public void commitOrder(Order pOrder,
                        DynamoHttpServletRequest pRequest,
                        DynamoHttpServletResponse pResponse)
                 throws javax.servlet.ServletException,
                        java.io.IOException
This method is called between preCommitOrder and postCommitOrder. This method calls the getProcessOrderMap(Locale) to get the process order map and calls the Order Manager to process the order.

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

getProcessOrderMap

public java.util.HashMap getProcessOrderMap(java.util.Locale pLocale)
                                     throws CommerceException
This method calls the OrderManager.getProcessOrderMap(pLocale, map) to get the process order map and adds sales channel to the map.

Returns:
Throws:
CommerceException