Class Name |
|
---|---|
Component(s) |
|
The CostCenterDroplet
servlet bean is a request-scoped component whose service method is responsible for the following tasks:
CostCenter
initialization:CostCenter
objects representing the user’s authorized cost centers are created and added to theCostCenterMapContainer
.CommerceIdentifierCostCenter
initialization: NewCommerceIdentifierCostCenter
instances are created specific to the currentOrder
and added to theCommerceIdentifierCostCenterContainer
.
These tasks enable the user to associate their authorized cost centers with an order’s various CommerceIdentifier
objects. During initialization, CostCenterDroplet
optionally creates one CommerceIdentifierCostCenter
object for each object of a CommerceIdentifier
type (for example, each CommerceItem
, each ShippingGroup
, the Order
, and the Tax
).
For more information on the cost center classes and framework, see the Managing Cost Centers chapter.
Input Parameters
clear
If this parameter is set to true, CostCenterDroplet
clears both CommerceIdentifierCostCenterContainer
and the CostCenterMapContainer
.
clearCostCenterContainer
If this parameter is set to true, CostCenterDroplet
clears the CommerceIdentifierCostCenters
in the CommerceIdentifierCostCenterContainer
.
clearCostCenterMap
If this parameter is set to true, CostCenterDroplet
clears the CostCenters
in the CostCenterMapContainer
.
initCostCenters
If this parameter is set to true, CostCenterDroplet
places the CostCenter
objects that represent the user’s authorized cost centers into the CostCenterMapContainer
.
initItemCostCenters
If this parameter is set to true, CostCenterDroplet
creates a CommerceIdentifierCostCenter
object for each CommerceItem
in the order and adds them to the CommerceIdentifierCostCenterContainer
.
initShippingCostCenters
If this parameter is set to true, CostCenterDroplet
creates a CommerceIdentifierCostCenter
object for each ShippingGroup
in the order and adds them to the CommerceIdentifierCostCenterContainer
.
initTaxCostCenters
If this parameter is set to true, CostCenterDroplet
creates a CommerceIdentifierCostCenter
object for the tax and adds it to the CommerceIdentifierCostCenterContainer
.
initOrderCostCenters
If this parameter is set to true, CostCenterDroplet
creates a CommerceIdentifierCostCenter
object for the order and adds it to the CommerceIdentifierCostCenterContainer
.
useAmount
The useAmount
parameter describes the type of relationship that will exist between the commerce items and cost centers. This is dictated by whether your developer has allowed users to divide commerce items among cost centers by quantity or by amount. If this parameter is set to true, then amounts are used to determine the cost center relationships. If the value is set to false, then quantities are used to determine the cost center relationships. The default value is false.
order
The user’s order to which to assign cost centers.
Output Parameters
costCenters
The list of the user’s valid cost centers.
ciccMap
A map whose keys are the commerce identifiers, and whose values are the list of CommerceIdentifierCostCenters
associated with that commerce identifier.
order
The user’s order that was passed in.
Open Parameters
output
The open parameter rendered if the operations are successful.
Example
A common use of CostCenterDroplet
is to build in its output
parameter a form that 1) displays the output set by the servlet bean, and 2) enables the user to reassign items and other costs to other valid cost centers. This usage explains why, in the JSP example below, the clear
, clearCostCenterMap
, and clearCostCenterContainer
parameters are all set to false. If the servlet bean is used with a form that gets reloaded after submission, setting these parameters to false prevents the erasure of any changes the user has made and submitted.
<dsp:droplet name="CostCenterDroplet"> <dsp:param bean="ShoppingCartModifier.order" name="order"/> <dsp:param value="false" name="clear"/> <dsp:param value="false" name="clearCostCenterMap"/> <dsp:param value="false" name="clearCostCenterContainer"/> <dsp:param value="true" name="initCostCenters"/> <dsp:param value="true" name="initItemCostCenters"/> <dsp:param value="true" name="initShippingCostCenters"/> <dsp:param value="true" name="initTaxCostCenters"/> <dsp:param value="false" name="useAmount"/> <dsp:oparam name="output">some form </dsp:oparam> </dsp:droplet>