com.ibm.commerce.marketing.promotion.runtime

Class OrderRunningTotal

  • java.lang.Object
    • com.ibm.commerce.marketing.promotion.runtime.OrderRunningTotal
  • All Implemented Interfaces:
    java.lang.Cloneable


    public class OrderRunningTotal
    extends java.lang.Object
    implements java.lang.Cloneable
    This class keeps running total for an order.
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM Copyright
        See Also:
        Constant Field Values
      • NO_ADJUSTMENT_APPLIED

        public static final int NO_ADJUSTMENT_APPLIED
        No adjustment is applicable
        See Also:
        Constant Field Values
      • SOME_MONETARY_ADJUSTMENT_APPLIED

        public static final int SOME_MONETARY_ADJUSTMENT_APPLIED
        Some monetary adjustment has been applied
        See Also:
        Constant Field Values
      • OTHER_ADJUSTMENT_PRESENT

        public static final int OTHER_ADJUSTMENT_PRESENT
        Some other adjustments are present
        See Also:
        Constant Field Values
    • Constructor Detail

      • OrderRunningTotal

        public OrderRunningTotal()
        Default constructor
      • OrderRunningTotal

        public OrderRunningTotal(Order order)
        Constructor. Takes an Order object and initializes the running total based on the order content.
        Parameters:
        order - the order.
    • Method Detail

      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException
        See Also:
        Object.clone()
      • applyAdjustmentsFromAPromotionExecutionRecord

        public int applyAdjustmentsFromAPromotionExecutionRecord(PromotionExecutionRecord record,
                                                                 PromotionContext context)
        Applies all monetary adjustments in a PromotionExecutionRecord. Updates any running total that might be affected as a result.
        Parameters:
        record - The promotion execution record
        context - the promotion context
        Returns:
        0, if no adjustment has been applied. 1, if some monetary adjustments have been applied, no other types of adjustment is present. 2, if no monetary adjustments are applied, but some other adjustments are present. 3, if some monetary adjustment have been applied, and other adjustments are present.
      • getRunningTotalFor

        public java.math.BigDecimal getRunningTotalFor(OrderItem oi,
                                                       int type)
        Returns the running total for subTotal, shipping charge, shipping tax or tax for an order item.
        Parameters:
        oi - order item
        type - the type of running total to return
        Returns:
        the running total in big decimal format
      • getRunningTotalFor

        public java.math.BigDecimal getRunningTotalFor(AssociatedOrderItem anItem,
                                                       int type)
        Returns the running total for an order item or a portion of it as identified by the AssociatedOrderItem parameter. The running total contains subTotal, shipping charge, shipping tax or tax.
        Parameters:
        anItem - the AssociatedOrderItem
        type - the type of running total to return
        Returns:
        the running total
      • getRunningTotalFor

        public java.math.BigDecimal getRunningTotalFor(AssociatedOrderItem[] items,
                                                       int type)
        Returns the running total for an array of order items or portions of them as identified by the AssociatedOrderItem array parameter. The running total contains subTotal, shipping charge, shipping tax or tax.
        Parameters:
        items - the AssociatedOrderItems
        type - the type of running total to return
        Returns:
        the running total
      • getRunningTotalFor

        public java.math.BigDecimal getRunningTotalFor(LineItemSet set,
                                                       int type)
        Returns the running total for everything in a LineItemSet. The running total contains subTotal, shipping charge, shipping tax or tax.
        Parameters:
        set - the LineItemSet
        type - the type of running total to return
        Returns:
        the running total
      • getOrderRunningTotal

        public java.math.BigDecimal getOrderRunningTotal(int type)
        Returns the running total for the order with which this OrderRunningTotalController was initialized. The running total contains subTotal, shipping charge, shipping tax or tax.
        Parameters:
        type - the type of running total to return
        Returns:
        the running total
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()
      • getClonedItems

        public AssociatedOrderItem[] getClonedItems(AssociatedOrderItem[] items)
        A method that returns an array of cloned AssociatedOrderItems
        Parameters:
        items - the original associatedOrderItems
        Returns:
        cloned copy of original associatedOrderItems