com.ibm.commerce.taxation.commands

Class TaxCalculationRuleCalculateCmdImpl

  • All Implemented Interfaces:
    com.ibm.commerce.command.CacheableECCommand, ECCommand, ECTargetableCommand, TaskCommand, com.ibm.commerce.order.utils.CalculationCmd, com.ibm.commerce.order.utils.CalculationRuleCalculateCmd, TaxCalculationRuleCalculateCmd, com.ibm.websphere.cache.Sizeable, com.ibm.websphere.command.CacheableCommand, com.ibm.websphere.command.Command, com.ibm.websphere.command.CommandCaller, com.ibm.websphere.command.TargetableCommand, java.io.Serializable

    Deprecated. 

    public class TaxCalculationRuleCalculateCmdImpl
    extends com.ibm.commerce.order.utils.CalculationRuleCalculateCmdImpl
    implements TaxCalculationRuleCalculateCmd
    The default implementation adds the results from each applicable
    CalculationScale
    .

    A

    CalculationScale
    is applicable if it can calculate a MonetaryAmount in the Order currency. But a
    CalculationScale
    whose
    currStr
    indicates a currency other than the Order currency is not applicable. The
    CalculationScale
    is not applicable if either:
    1. another applicable
      CalculationScale
      has a
      currStr
      that does indicate the Order currency, or
    2. a set of applicable CalculationScales with a common yet different
      currStr
      attribute exists and can produce a lower total result.
    Effectively, if any scales have a currency, only one such currency will be used, and it will be the Order currency if such a scale exists. Otherwise it will be the currency of the set of scales that gives the lowest result.

    The default implementation's algorithm is:

    1. If a
      CalculationScale
      throws a conversion exception, continue processing as if we did not call that
      CalculationScale
      .
    2. Start with a zero total result for each OrderItem.
    3. For each
      CalculationScale
      associated with this CalculationRule whose
      currStr
      attribute is empty:
      1. Obtain a MonetaryAmount result for each OrderItem in the Order currency from the
        CalculationScale
        . Add this result to the total result for each OrderItem.
    4. Determine the set of currencies indicated by the
      currStr
      attributes of the CalculationScales. The CalculationScales'
      currStr
      attributes indicate currencies that can be converted to the Order currency.
    5. If the set of currencies includes the Order currency:
      1. Start with a zero candidate result for each OrderItem.
      2. For each
        CalculationScale
        associated with this CalculationRule whose
        currStr
        attribute indicates the
        CalculationScale
        is in that currency:
      3. Obtain a MonetaryAmount result for each OrderItem in that currency from the
        CalculationScale
        . Add these results to the candidate results.
    6. However, If the set of currencies does not include the Order currency:
      1. For each currency in the set, calculate a candidate result for each OrderItem using steps 5a, 5b, and 5b1.
    7. Choose the set of candidate results (that is One per OrderItem) whose sum is the lowest. Add those results to the total result for each OrderItem.
    8. Return the total results, one for each OrderItem.

    See Also:
    Serialized Form
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        Deprecated. 
        See Also:
        Constant Field Values
    • Constructor Detail

      • TaxCalculationRuleCalculateCmdImpl

        public TaxCalculationRuleCalculateCmdImpl()
        Deprecated. 
    • Method Detail

      • performExecute

        public void performExecute()
                            throws ECException
        Deprecated. 
        Executes main business logic of the command.
        Specified by:
        performExecute in interface ECCommand
        Specified by:
        performExecute in interface com.ibm.websphere.command.TargetableCommand
        Overrides:
        performExecute in class com.ibm.commerce.order.utils.CalculationRuleCalculateCmdImpl
        Throws:
        ECException
      • setCalculationRuleAB

        public void setCalculationRuleAB(CalculationRuleAccessBean calculationRuleAB)
        Deprecated. 
        Sets the CalculationRuleAccessBean.
        Specified by:
        setCalculationRuleAB in interface com.ibm.commerce.order.utils.CalculationRuleCalculateCmd
        Overrides:
        setCalculationRuleAB in class com.ibm.commerce.order.utils.CalculationRuleCalculateCmdImpl
        Parameters:
        calculationRuleAB - The CalculationRuleAccessBean.
      • setOrderItemABHash

        public void setOrderItemABHash(java.util.Hashtable orderItemABHash)
        Deprecated. 
        Sets the list of OrderItemAccessBean.
        Specified by:
        setOrderItemABHash in interface com.ibm.commerce.order.utils.CalculationRuleCalculateCmd
        Overrides:
        setOrderItemABHash in class com.ibm.commerce.order.utils.CalculationRuleCalculateCmdImpl
        Parameters:
        orderItemABHash - The list of OrderItemAccessBean.