atg.commerce.order.purchase
Class CostCenterFormHandler

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.CostCenterFormHandler
All Implemented Interfaces:
atg.commerce.order.CostCenterConstants, 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
Direct Known Subclasses:
CostCenterFormHandler

public class CostCenterFormHandler
extends PurchaseProcessFormHandler
implements atg.commerce.order.CostCenterConstants

The CostCenterFormHandler is used to associate CostCenters with the various Order pieces. This component is used during the Order checkout process, and any Order successfully processed by the CostCenterFormHandler is ready for the next checkout phase, which may be confirmation.

The CostCenterFormHandler is composed of the following containers:
CostCenterMapContainer - container for the user's potential CostCenters
CommerceIdentifierCostCenterContainer - container for the user's CommerceIdentifierCostCenter associations for a particular Order's CommerceIdentifiers

There are 2 main handler methods in the CostCenterFormHandler, namely handleSplitCostCenters and handleApplyCostCenters:

  1. handleSplitCostCenters splits extra CommerceIdentifierCostCenter objects by quantity. In a form the user might request to split 50 of an original CommerceItem quantity of 100 onto a separate CostCenter. This will create a separate CommerceIdentifierCostCenter object, and adjust the quantity of both the original and the new CommerceIdentifierCostCenter objects to add up to the original CommerceItem total quantity.
  2. handleApplyCostCenters is used when the CommerceIdentifierCostCenter associations created by the user are scrutinized and the appropriate business methods are called in the CostCenterManager. Validation takes place, via a configurable Pipeline chain.

In order to conveniently manipulate CostCenters and CommerceIdentifierCostCenter Lists, you can set the ListId and CostCenterId properties. This will automatically expose the corresponding CostCenter and List in the CurrentCostCenter and CurrentCostCenter properties.

See Also:
GenericFormHandler, PurchaseProcessFormHandler

Field Summary
static java.lang.String CLASS_VERSION
           
 
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.commerce.order.CostCenterConstants
CICC_MAP, CLEAR_ALL, CLEAR_COST_CENTER_CONTAINER, CLEAR_COST_CENTER_MAP, COST_CENTERS, INIT_CC, INIT_ITEM_COSTCENTERS, INIT_ORDER_COSTCENTERS, INIT_SHIPPING_COSTCENTERS, INIT_TAX_COSTCENTERS, LOAD_COSTCENTERS, MSG_INVALID_SPLIT_QUANTITY, ONE_COST_CENTER, ORDER, OUTPUT, USE_AMOUNT
 
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
CostCenterFormHandler()
          Creates a new CostCenterFormHandler instance.
 
Method Summary
protected  void addAmountToCostCenter(int type, CostCenterManager ccm, Order order, java.lang.String itemId, java.lang.String ccId, long quantity, double amount)
          The addAmountToCostCenter method switches on the RelationshipType of the CommerceIdentifierCostCenter to invoke the appropriate CostCenterManager function.
protected  void applyCommerceIdentifierCostCenter(CommerceIdentifierCostCenter pCommerceIdentifierCostCenter, Order order)
          applyCommerceIdentifierCostCenter will take the supplied cost center information and update the Order.
 void applyCostCenters(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          applyCostCenters iterates over the supplied CommerceIdentifierCostCenters for each of the CommerceIdentifiers.
protected  void applyDefaultCostCenter(Order order)
          applyDefaultCostCenter will check to see if there is a defaultCostCenter.
 java.lang.String getApplyCostCentersErrorURL()
          Return the ApplyCostCentersErrorURL property.
 java.lang.String getApplyCostCentersSuccessURL()
          Return the ApplyCostCentersSuccessURL property.
 CommerceIdentifierCostCenterContainer getCommerceIdentifierCostCenterContainer()
          Return the CommerceIdentifierCostCenterContainer property.
protected  CostCenter getCostCenter(java.lang.String pCostCenterName)
          getCostCenter gets the CostCenter with the given name from the CostCenterMapContainer.
 java.lang.String getCostCenterId()
          Return the CostCenterId property.
 CostCenterManager getCostCenterManager()
          Return the CostCenterManager property.
 CostCenterMapContainer getCostCenterMapContainer()
          Return the CostCenterMapContainer property.
 CostCenter getCurrentCostCenter()
          Return the CurrentCostCenter property.
 java.util.List getCurrentList()
          Return the CurrentList property.
 java.lang.String getListId()
          Return the ListId property.
 Order getOrder()
          Overriding getOrder to use the getOrderFromId property Return the Order property.
 java.lang.String getOrderId()
          Return the OrderId property.
 java.lang.String getSplitCostCentersErrorURL()
          Return the SplitCostCentersErrorURL property.
 java.lang.String getSplitCostCentersSuccessURL()
          Return the SplitCostCentersSuccessURL property.
 java.lang.String getValidateCostCentersChainId()
          Return the ValidateCostCentersChainId property.
 boolean handleApplyCostCenters(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          handleApplyCostCenters is used when the user has supplied the cost center information for this order, and is ready to proceed with the next checkout phase.
 boolean handleSplitCostCenters(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          handleSplitCostCenters is used when the user is ready to split a particular CommerceIdentifierCostCenter by quantity.
protected  boolean isCostCenterInOrder(Order pOrder, java.lang.String pCostCenterId)
          isCostCenterInOrder is used to determine if the CostCenter is already in the Order.
 boolean isGetOrderFromId()
          Return the GetOrderFromId property.
 boolean postApplyCostCenters(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          postApplyCostCenters is for work that must happen after the CostCenters are applied.
 boolean postSplitCostCenters(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          postSplitCostCenters is for work that must happen after the CommerceIdentifierCostCenters are split.
 boolean preApplyCostCenters(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          preApplyCostCenters is for work that must happen before the CostCenters are applied.
 boolean preSplitCostCenters(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          preSplitCostCenters is for work that must happen before the CommerceIdentifierCostCenters are split.
protected  void runProcessValidateCostCenters(Order pOrder, PricingModelHolder pPricingModels, java.util.Locale pLocale, RepositoryItem pProfile, java.util.Map pExtraParameters)
          runProcessValidateCostCenters runs a configurable Pipeline chain to validate CostCenters or prepare for the next checkout phase.
 void setApplyCostCentersErrorURL(java.lang.String pApplyCostCentersErrorURL)
          Set the ApplyCostCentersErrorURL property.
 void setApplyCostCentersSuccessURL(java.lang.String pApplyCostCentersSuccessURL)
          Set the ApplyCostCentersSuccessURL property.
 void setCommerceIdentifierCostCenterContainer(CommerceIdentifierCostCenterContainer pCommerceIdentifierCostCenterContainer)
          Set the CommerceIdentifierCostCenterContainer property.
 void setCostCenterId(java.lang.String pCostCenterId)
          Set the CostCenterId property.
 void setCostCenterManager(CostCenterManager pCostCenterManager)
          Set the CostCenterManager property.
 void setCostCenterMapContainer(CostCenterMapContainer pCostCenterMapContainer)
          Set the CostCenterMapContainer property.
 void setCurrentCostCenter(CostCenter pCurrentCostCenter)
          Set the CurrentCostCenter property.
 void setCurrentList(java.util.List pCurrentList)
          Set the CurrentList property.
 void setGetOrderFromId(boolean pGetOrderFromId)
          Set the GetOrderFromId property.
 void setListId(java.lang.String pListId)
          Set the ListId property.
 void setOrder(Order pOrder)
          Set the Order property.
 void setOrderId(java.lang.String pOrderId)
          Set the OrderId property.
 void setSplitCostCentersErrorURL(java.lang.String pSplitCostCentersErrorURL)
          Set the SplitCostCentersErrorURL property.
 void setSplitCostCentersSuccessURL(java.lang.String pSplitCostCentersSuccessURL)
          Set the SplitCostCentersSuccessURL property.
 void setValidateCostCentersChainId(java.lang.String pValidateCostCentersChainId)
          Set the ValidateCostCentersChainId property.
protected  void splitCommerceIdentifierCostCenter(CommerceIdentifierCostCenter pCommerceIdentifierCostCenter)
          splitCommerceIdentifierCostCenter determines which CommerceIdentifierCostCenter objects need to be split, and in what manner.
protected  void splitCommerceIdentifierCostCenterByQuantity(CommerceIdentifierCostCenter pCommerceIdentifierCostCenter, long pSplitQuantity)
          splitCommerceIdentifierCostCenterByQuantity splits a CommerceIdentifierCenter by quantity.
protected  void splitCostCenters(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse)
          splitCostCenters invokes the splitCommerceIdentifierCostCenter method on each CommerceIdentifierCostCenter.
 
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, getOrderManager, getPaymentGroupManager, getPaymentGroupMapContainer, getPipelineManager, getPriceList, getPriceListId, getPriceListManager, getProfile, getProfileRepository, getPurchaseProcessHelper, getRepeatingRequestMonitor, getRepriceOrderChainId, getResourceBundle, 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, 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
Constructor Detail

CostCenterFormHandler

public CostCenterFormHandler()
Creates a new CostCenterFormHandler instance.

Method Detail

setListId

public void setListId(java.lang.String pListId)
Set the ListId property.

Parameters:
pListId - a String value

getListId

public java.lang.String getListId()
Return the ListId property.

Returns:
a String value

setCurrentList

public void setCurrentList(java.util.List pCurrentList)
Set the CurrentList property.

Parameters:
pCurrentList - a List value

getCurrentList

public java.util.List getCurrentList()
Return the CurrentList property.

Returns:
a List value

setCostCenterId

public void setCostCenterId(java.lang.String pCostCenterId)
Set the CostCenterId property.

Parameters:
pCostCenterId - a String value

getCostCenterId

public java.lang.String getCostCenterId()
Return the CostCenterId property.

Returns:
a String value

setCurrentCostCenter

public void setCurrentCostCenter(CostCenter pCurrentCostCenter)
Set the CurrentCostCenter property.

Parameters:
pCurrentCostCenter - a CostCenter value

getCurrentCostCenter

public CostCenter getCurrentCostCenter()
Return the CurrentCostCenter property.

Returns:
a CostCenter value

setCostCenterManager

public void setCostCenterManager(CostCenterManager pCostCenterManager)
Set the CostCenterManager property.

Parameters:
pCostCenterManager - a CostCenterManager value

getCostCenterManager

public CostCenterManager getCostCenterManager()
Return the CostCenterManager property.

Returns:
a CostCenterManager value

setApplyCostCentersSuccessURL

public void setApplyCostCentersSuccessURL(java.lang.String pApplyCostCentersSuccessURL)
Set the ApplyCostCentersSuccessURL property.

Parameters:
pApplyCostCentersSuccessURL - a String value

getApplyCostCentersSuccessURL

public java.lang.String getApplyCostCentersSuccessURL()
Return the ApplyCostCentersSuccessURL property.

Returns:
a String value

setApplyCostCentersErrorURL

public void setApplyCostCentersErrorURL(java.lang.String pApplyCostCentersErrorURL)
Set the ApplyCostCentersErrorURL property.

Parameters:
pApplyCostCentersErrorURL - a String value

getApplyCostCentersErrorURL

public java.lang.String getApplyCostCentersErrorURL()
Return the ApplyCostCentersErrorURL property.

Returns:
a String value

setSplitCostCentersSuccessURL

public void setSplitCostCentersSuccessURL(java.lang.String pSplitCostCentersSuccessURL)
Set the SplitCostCentersSuccessURL property.

Parameters:
pSplitCostCentersSuccessURL - a String value

getSplitCostCentersSuccessURL

public java.lang.String getSplitCostCentersSuccessURL()
Return the SplitCostCentersSuccessURL property.

Returns:
a String value

setSplitCostCentersErrorURL

public void setSplitCostCentersErrorURL(java.lang.String pSplitCostCentersErrorURL)
Set the SplitCostCentersErrorURL property.

Parameters:
pSplitCostCentersErrorURL - a String value

getSplitCostCentersErrorURL

public java.lang.String getSplitCostCentersErrorURL()
Return the SplitCostCentersErrorURL property.

Returns:
a String value

setCommerceIdentifierCostCenterContainer

public void setCommerceIdentifierCostCenterContainer(CommerceIdentifierCostCenterContainer pCommerceIdentifierCostCenterContainer)
Set the CommerceIdentifierCostCenterContainer property.

Parameters:
pCommerceIdentifierCostCenterContainer - a CommerceIdentifierCostCenterContainer value

getCommerceIdentifierCostCenterContainer

public CommerceIdentifierCostCenterContainer getCommerceIdentifierCostCenterContainer()
Return the CommerceIdentifierCostCenterContainer property.

Returns:
a CommerceIdentifierCostCenterContainer value

setCostCenterMapContainer

public void setCostCenterMapContainer(CostCenterMapContainer pCostCenterMapContainer)
Set the CostCenterMapContainer property.

Parameters:
pCostCenterMapContainer - a CostCenterMapContainer value

getCostCenterMapContainer

public CostCenterMapContainer getCostCenterMapContainer()
Return the CostCenterMapContainer property.

Returns:
a CostCenterMapContainer value

setValidateCostCentersChainId

public void setValidateCostCentersChainId(java.lang.String pValidateCostCentersChainId)
Set the ValidateCostCentersChainId property.

Parameters:
pValidateCostCentersChainId - a String value

getValidateCostCentersChainId

public java.lang.String getValidateCostCentersChainId()
Return the ValidateCostCentersChainId property.

Returns:
a String value

setGetOrderFromId

public void setGetOrderFromId(boolean pGetOrderFromId)
Set the GetOrderFromId property.

Parameters:
pGetOrderFromId - a boolean value

isGetOrderFromId

public boolean isGetOrderFromId()
Return the GetOrderFromId property.

Returns:
a boolean value

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

setOrder

public void setOrder(Order pOrder)
Set the Order property.

Overrides:
setOrder in class PurchaseProcessFormHandler
Parameters:
pOrder - an Order value

getOrder

public Order getOrder()
Overriding getOrder to use the getOrderFromId property Return the Order property.

Overrides:
getOrder in class PurchaseProcessFormHandler
Returns:
an Order value

handleSplitCostCenters

public boolean handleSplitCostCenters(DynamoHttpServletRequest pRequest,
                                      DynamoHttpServletResponse pResponse)
                               throws javax.servlet.ServletException,
                                      java.io.IOException
handleSplitCostCenters is used when the user is ready to split a particular CommerceIdentifierCostCenter by quantity.

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

preSplitCostCenters

public boolean preSplitCostCenters(DynamoHttpServletRequest pRequest,
                                   DynamoHttpServletResponse pResponse)
                            throws javax.servlet.ServletException,
                                   java.io.IOException
preSplitCostCenters is for work that must happen before the CommerceIdentifierCostCenters are split.

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

postSplitCostCenters

public boolean postSplitCostCenters(DynamoHttpServletRequest pRequest,
                                    DynamoHttpServletResponse pResponse)
                             throws javax.servlet.ServletException,
                                    java.io.IOException
postSplitCostCenters is for work that must happen after the CommerceIdentifierCostCenters are split.

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

splitCostCenters

protected void splitCostCenters(DynamoHttpServletRequest pRequest,
                                DynamoHttpServletResponse pResponse)
                         throws javax.servlet.ServletException,
                                java.io.IOException
splitCostCenters invokes the splitCommerceIdentifierCostCenter method on each CommerceIdentifierCostCenter.

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

splitCommerceIdentifierCostCenter

protected void splitCommerceIdentifierCostCenter(CommerceIdentifierCostCenter pCommerceIdentifierCostCenter)
splitCommerceIdentifierCostCenter determines which CommerceIdentifierCostCenter objects need to be split, and in what manner. This relies on the CommerceIdentifierCostCenter.SplitQuantity property.

Parameters:
pCommerceIdentifierCostCenter - a CommerceIdentifierCostCenter value

splitCommerceIdentifierCostCenterByQuantity

protected void splitCommerceIdentifierCostCenterByQuantity(CommerceIdentifierCostCenter pCommerceIdentifierCostCenter,
                                                           long pSplitQuantity)
splitCommerceIdentifierCostCenterByQuantity splits a CommerceIdentifierCenter by quantity.

Parameters:
pCommerceIdentifierCostCenter - a CommerceIdentifierCostCenter value
pSplitQuantity - a long value

handleApplyCostCenters

public boolean handleApplyCostCenters(DynamoHttpServletRequest pRequest,
                                      DynamoHttpServletResponse pResponse)
                               throws javax.servlet.ServletException,
                                      java.io.IOException
handleApplyCostCenters is used when the user has supplied the cost center information for this order, and is ready to proceed with the next checkout phase.

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

preApplyCostCenters

public boolean preApplyCostCenters(DynamoHttpServletRequest pRequest,
                                   DynamoHttpServletResponse pResponse)
                            throws javax.servlet.ServletException,
                                   java.io.IOException
preApplyCostCenters is for work that must happen before the CostCenters are applied.

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

postApplyCostCenters

public boolean postApplyCostCenters(DynamoHttpServletRequest pRequest,
                                    DynamoHttpServletResponse pResponse)
                             throws javax.servlet.ServletException,
                                    java.io.IOException
postApplyCostCenters is for work that must happen after the CostCenters are applied.

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

applyCostCenters

public void applyCostCenters(DynamoHttpServletRequest pRequest,
                             DynamoHttpServletResponse pResponse)
                      throws javax.servlet.ServletException,
                             java.io.IOException
applyCostCenters iterates over the supplied CommerceIdentifierCostCenters for each of the CommerceIdentifiers. Each CommerceIdentifierCostCenter is then used to apply the Order.

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

addAmountToCostCenter

protected void addAmountToCostCenter(int type,
                                     CostCenterManager ccm,
                                     Order order,
                                     java.lang.String itemId,
                                     java.lang.String ccId,
                                     long quantity,
                                     double amount)
                              throws CommerceException
The addAmountToCostCenter method switches on the RelationshipType of the CommerceIdentifierCostCenter to invoke the appropriate CostCenterManager function.

Parameters:
type - an int value
ccm - a CostCenterManager value
order - a Order value
itemId - a String value
ccId - a String value
quantity - a long value
amount - a double value
Throws:
CommerceException - if an error occurs

applyCommerceIdentifierCostCenter

protected void applyCommerceIdentifierCostCenter(CommerceIdentifierCostCenter pCommerceIdentifierCostCenter,
                                                 Order order)
applyCommerceIdentifierCostCenter will take the supplied cost center information and update the Order. This invokes business logic in the OrderManager that corresponds to the RelationshipType set in the CommerceIdentifierCostCenter.

Parameters:
pCommerceIdentifierCostCenter - a CommerceIdentifierCostCenter value
order - an Order value

applyDefaultCostCenter

protected void applyDefaultCostCenter(Order order)
applyDefaultCostCenter will check to see if there is a defaultCostCenter. If so, this CostCenter is added to the Order's remaining amount. This can facilitate simpler applications that only permit one CostCenter per Order, as well as advanced applications that apply a default CostCenter to any remaining Order amount not explicitly covered by other CostCenters.

Parameters:
order - an Order value

isCostCenterInOrder

protected boolean isCostCenterInOrder(Order pOrder,
                                      java.lang.String pCostCenterId)
isCostCenterInOrder is used to determine if the CostCenter is already in the Order.

Parameters:
pOrder - an Order value
pCostCenterId - a String value
Returns:
a boolean value

getCostCenter

protected CostCenter getCostCenter(java.lang.String pCostCenterName)
getCostCenter gets the CostCenter with the given name from the CostCenterMapContainer.

Parameters:
pCostCenterName - a String value
Returns:
a CostCenter value

runProcessValidateCostCenters

protected void runProcessValidateCostCenters(Order pOrder,
                                             PricingModelHolder pPricingModels,
                                             java.util.Locale pLocale,
                                             RepositoryItem pProfile,
                                             java.util.Map pExtraParameters)
                                      throws RunProcessException
runProcessValidateCostCenters runs a configurable Pipeline chain to validate CostCenters or prepare for the next checkout phase.

Parameters:
pOrder - an Order value
pPricingModels - a PricingModelHolder value
pLocale - a Locale value
pProfile - a RepositoryItem value
pExtraParameters - a Map value
Throws:
RunProcessException - if an error occurs