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:
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.
GenericFormHandler,
PurchaseProcessFormHandler| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CLASS_VERSION |
LOCK_NAME_ATTRIBUTE_NAME, PARAM_TRANSACTION_CREATED, PARAM_VALUE_TRUEPARAM_DEFER_FORWARD_OR_REDIRECT, PARAM_USE_FORWARDSSERVICE_INFO_KEYCICC_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_AMOUNTDEFAULT_LOG_TRACE_STATUSDEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS| Constructor and Description |
|---|
CostCenterFormHandler()
Creates a new
CostCenterFormHandler instance. |
| Modifier and Type | Method and Description |
|---|---|
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. |
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, 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, setOrderManager, setPaymentGroupManager, setPaymentGroupMapContainer, setPipelineManager, setPriceListId, setPriceListManager, setProfile, setProfileRepository, setPurchaseProcessHelper, setRepeatingRequestMonitor, setRepriceOrderChainId, setSessionExpirationURL, setShippingGroupManager, setShippingGroupMapContainer, setShoppingCart, setTransactionCreated, setTransactionManager, setTransactionToRollbackOnly, setUseLocksAroundTransactions, setUseRequestLocale, setUserLocale, setUserPricingModels, transactionLockName, unsetTransactionCreatedaddFormException, 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, setUseForwardsafterGet, beforeGetaddLogListener, 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, stopServicevlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarningpublic CostCenterFormHandler()
CostCenterFormHandler instance.public void setListId(java.lang.String pListId)
pListId - a String valuepublic java.lang.String getListId()
String valuepublic void setCurrentList(java.util.List pCurrentList)
pCurrentList - a List valuepublic java.util.List getCurrentList()
List valuepublic void setCostCenterId(java.lang.String pCostCenterId)
pCostCenterId - a String valuepublic java.lang.String getCostCenterId()
String valuepublic void setCurrentCostCenter(CostCenter pCurrentCostCenter)
pCurrentCostCenter - a CostCenter valuepublic CostCenter getCurrentCostCenter()
CostCenter valuepublic void setCostCenterManager(CostCenterManager pCostCenterManager)
pCostCenterManager - a CostCenterManager valuepublic CostCenterManager getCostCenterManager()
CostCenterManager valuepublic void setApplyCostCentersSuccessURL(java.lang.String pApplyCostCentersSuccessURL)
pApplyCostCentersSuccessURL - a String valuepublic java.lang.String getApplyCostCentersSuccessURL()
String valuepublic void setApplyCostCentersErrorURL(java.lang.String pApplyCostCentersErrorURL)
pApplyCostCentersErrorURL - a String valuepublic java.lang.String getApplyCostCentersErrorURL()
String valuepublic void setSplitCostCentersSuccessURL(java.lang.String pSplitCostCentersSuccessURL)
pSplitCostCentersSuccessURL - a String valuepublic java.lang.String getSplitCostCentersSuccessURL()
String valuepublic void setSplitCostCentersErrorURL(java.lang.String pSplitCostCentersErrorURL)
pSplitCostCentersErrorURL - a String valuepublic java.lang.String getSplitCostCentersErrorURL()
String valuepublic void setCommerceIdentifierCostCenterContainer(CommerceIdentifierCostCenterContainer pCommerceIdentifierCostCenterContainer)
pCommerceIdentifierCostCenterContainer - a CommerceIdentifierCostCenterContainer valuepublic CommerceIdentifierCostCenterContainer getCommerceIdentifierCostCenterContainer()
CommerceIdentifierCostCenterContainer valuepublic void setCostCenterMapContainer(CostCenterMapContainer pCostCenterMapContainer)
pCostCenterMapContainer - a CostCenterMapContainer valuepublic CostCenterMapContainer getCostCenterMapContainer()
CostCenterMapContainer valuepublic void setValidateCostCentersChainId(java.lang.String pValidateCostCentersChainId)
pValidateCostCentersChainId - a String valuepublic java.lang.String getValidateCostCentersChainId()
String valuepublic void setGetOrderFromId(boolean pGetOrderFromId)
pGetOrderFromId - a boolean valuepublic boolean isGetOrderFromId()
boolean valuepublic void setOrderId(java.lang.String pOrderId)
pOrderId - a String valuepublic java.lang.String getOrderId()
String valuepublic void setOrder(Order pOrder)
setOrder in class PurchaseProcessFormHandlerpOrder - an Order valuepublic Order getOrder()
getOrder in class PurchaseProcessFormHandlerOrder valuepublic 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.pRequest - a DynamoHttpServletRequest valuepResponse - a DynamoHttpServletResponse valueboolean valuejavax.servlet.ServletException - if an error occursjava.io.IOException - if an error occurspublic 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.pRequest - a DynamoHttpServletRequest valuepResponse - a DynamoHttpServletResponse valueboolean valuejavax.servlet.ServletException - if an error occursjava.io.IOException - if an error occurspublic 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.pRequest - a DynamoHttpServletRequest valuepResponse - a DynamoHttpServletResponse valueboolean valuejavax.servlet.ServletException - if an error occursjava.io.IOException - if an error occursprotected void splitCostCenters(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws javax.servlet.ServletException, java.io.IOException
splitCostCenters invokes the splitCommerceIdentifierCostCenter
method on each CommerceIdentifierCostCenter.pRequest - a DynamoHttpServletRequest valuepResponse - a DynamoHttpServletResponse valuejavax.servlet.ServletException - if an error occursjava.io.IOException - if an error occursprotected void splitCommerceIdentifierCostCenter(CommerceIdentifierCostCenter pCommerceIdentifierCostCenter)
splitCommerceIdentifierCostCenter determines which CommerceIdentifierCostCenter
objects need to be split, and in what manner. This relies on the
CommerceIdentifierCostCenter.SplitQuantity property.pCommerceIdentifierCostCenter - a CommerceIdentifierCostCenter valueprotected void splitCommerceIdentifierCostCenterByQuantity(CommerceIdentifierCostCenter pCommerceIdentifierCostCenter, long pSplitQuantity)
splitCommerceIdentifierCostCenterByQuantity splits a CommerceIdentifierCenter
by quantity.pCommerceIdentifierCostCenter - a CommerceIdentifierCostCenter valuepSplitQuantity - a long valuepublic 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.pRequest - a DynamoHttpServletRequest valuepResponse - a DynamoHttpServletResponse valueboolean valuejavax.servlet.ServletException - if an error occursjava.io.IOException - if an error occurspublic 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.pRequest - a DynamoHttpServletRequest valuepResponse - a DynamoHttpServletResponse valueboolean valuejavax.servlet.ServletException - if an error occursjava.io.IOException - if an error occurspublic 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.pRequest - a DynamoHttpServletRequest valuepResponse - a DynamoHttpServletResponse valueboolean valuejavax.servlet.ServletException - if an error occursjava.io.IOException - if an error occurspublic 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.pRequest - a DynamoHttpServletRequest valuepResponse - a DynamoHttpServletResponse valuejavax.servlet.ServletException - if an error occursjava.io.IOException - if an error occursprotected void addAmountToCostCenter(int type,
CostCenterManager ccm,
Order order,
java.lang.String itemId,
java.lang.String ccId,
long quantity,
double amount)
throws CommerceException
addAmountToCostCenter method switches on the RelationshipType
of the CommerceIdentifierCostCenter to invoke the appropriate CostCenterManager
function.type - an int valueccm - a CostCenterManager valueorder - a Order valueitemId - a String valueccId - a String valuequantity - a long valueamount - a double valueCommerceException - if an error occursprotected 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.pCommerceIdentifierCostCenter - a CommerceIdentifierCostCenter valueorder - an Order valueprotected 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.order - an Order valueprotected boolean isCostCenterInOrder(Order pOrder, java.lang.String pCostCenterId)
isCostCenterInOrder is used to determine if the CostCenter
is already in the Order.pOrder - an Order valuepCostCenterId - a String valueboolean valueprotected CostCenter getCostCenter(java.lang.String pCostCenterName)
getCostCenter gets the CostCenter with the given name
from the CostCenterMapContainer.pCostCenterName - a String valueCostCenter valueprotected 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.pOrder - an Order valuepPricingModels - a PricingModelHolder valuepLocale - a Locale valuepProfile - a RepositoryItem valuepExtraParameters - a Map valueRunProcessException - if an error occurs