com.ibm.commerce.order.calculation
Class DiscountCalculationCodeApplyCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.TaskCommandImpl
                    |
                    +--com.ibm.commerce.command.BusinessPolicyCommandImpl
                          |
                          +--com.ibm.commerce.order.calculation.CalculationCmdImpl
                                |
                                +--com.ibm.commerce.order.calculation.DiscountCalculationCodeApplyCmdImpl
All Implemented Interfaces:
BusinessPolicyCommand, CalculationCmd, CalculationCodeApplyCmd, DiscountCalculationCodeApplyCmd, ECCommand, ECTargetableCommand, TaskCommand

public class DiscountCalculationCodeApplyCmdImpl
extends CalculationCmdImpl
implements DiscountCalculationCodeApplyCmd

The default implementation of DiscountCalculationCodeApplyCmd.

Its behaviour is as follows:

  1. adjusts the values if one or more of the values cross the zero boundary (see CalculationHelper.correctZeroBoundaryCrossings(Item[], BigDecimal[], String, CommandContext)).
  2. creates an order adjustment for the order (see ORDADJUST).
  3. copies the calculation code descriptions and exempted tax categories to the order adjustment (see CALCODEDSC, CALCODTXEX, ORDADJDSC, ORDADJTXEX).
  4. for each value, creates an orderitem adjustment for the corresponding item (see ORDIADJUST).

Commands used:

Access beans used:
See Also:
Serialized Form

Field Summary
static java.lang.String COPYRIGHT
          The IBM copyright notice field.
 
Fields inherited from class com.ibm.commerce.command. BusinessPolicyCommandImpl
policyId, requestProperties
 
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.order.calculation. DiscountCalculationCodeApplyCmd
defaultCommandClassName, NAME
 
Fields inherited from interface com.ibm.commerce.command. ECCommand
defaultCommandClassName
 
Constructor Summary
DiscountCalculationCodeApplyCmdImpl()
          Constructor for DiscountCalculationCodeApplyCmdImpl.
 
Method Summary
protected   OrderAdjustmentAccessBean createOrderAdjustment(java.lang.Long anOrderId, java.math.BigDecimal adOrderAdjustmentAmount)
          Creates an order adjustment for an order.
 void performExecute()
          The business logic for this command.
 void reset()
          This method should be called after a command has been executed to reset its states variables.
 void setCode(CalculationCodeAccessBean aabCode)
          Sets the calculation code.
 void setItems( Item[] aItems)
          Sets the items.
 void setValues(java.math.BigDecimal[] adValues)
          Sets the orderitem adjustment amounts.
 void setValues(java.lang.Integer anTaxCategoryId, java.math.BigDecimal[] adValues)
          Sets the orderitem adjustment amounts.
 
Methods inherited from class com.ibm.commerce.order.calculation. CalculationCmdImpl
createCommand, getCurrency, getCustomProperties, getCustomProperty, getTimestamp, getUsageId, setCurrency, setCustomProperties, setCustomProperty, setTimestamp, setUsageId
 
Methods inherited from class com.ibm.commerce.command. BusinessPolicyCommandImpl
getPolicyId, getRequestProperties, setPolicyId, setRequestProperties
 
Methods inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.commerce.order.calculation. CalculationCmd
getCurrency, getCustomProperties, getCustomProperty, getTimestamp, getUsageId, setCurrency, setCustomProperties, setCustomProperty, setTimestamp, setUsageId
 
Methods inherited from interface com.ibm.commerce.command. BusinessPolicyCommand
getPolicyId, getRequestProperties, setPolicyId, setRequestProperties
 

Field Detail
public static final java.lang.String COPYRIGHT
The IBM copyright notice field.
See Also:
Constant Field Values
Constructor Detail

DiscountCalculationCodeApplyCmdImpl

public DiscountCalculationCodeApplyCmdImpl()
Constructor for DiscountCalculationCodeApplyCmdImpl.
Method Detail

createOrderAdjustment

protected OrderAdjustmentAccessBean createOrderAdjustment(java.lang.Long anOrderId,
                                                          java.math.BigDecimal adOrderAdjustmentAmount)
                                                   throws ECException
Creates an order adjustment for an order. This method is called by performExecute().
Parameters:
anOrderId - the order ID.
adOrderAdjustmentAmount - the order adjustment amount.
Returns:
the order adjustment.
ECException

performExecute

public void performExecute()
                    throws ECException
Description copied from class: AbstractECTargetableCommand
The business logic for this command. This method should be overwritten by all command writers. Command writers should call super.performExecute() as the first line in their method.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException
See Also:
ECCommand.performExecute()

reset

public void reset()
Description copied from class: AbstractECTargetableCommand
This method should be called after a command has been executed to reset its states variables. After the call to reset, we should be able to execute the command again.
Overrides:
reset in class CalculationCmdImpl
See Also:
com.ibm.websphere.command.Command#reset()

setCode

public void setCode(CalculationCodeAccessBean aabCode)
Sets the calculation code.
Specified by:
setCode in interface CalculationCodeApplyCmd
Parameters:
aabCode - the calculation code.

setItems

public void setItems(Item[] aItems)
Sets the items.
Specified by:
setItems in interface CalculationCodeApplyCmd
Parameters:
aItems - the items.

setValues

public void setValues(java.math.BigDecimal[] adValues)
Sets the orderitem adjustment amounts.
Specified by:
setValues in interface CalculationCodeApplyCmd
Parameters:
adValues - the orderitem adjustment amounts.

setValues

public void setValues(java.lang.Integer anTaxCategoryId,
                      java.math.BigDecimal[] adValues)
Sets the orderitem adjustment amounts.
Specified by:
setValues in interface CalculationCodeApplyCmd
Parameters:
anTaxCategoryId - the tax category ID. Always null.
adValues - the orderitem adjustment amounts.