com.ibm.commerce.marketing.promotion.runtime

Class OrderQualifyingTotal

  • java.lang.Object
    • com.ibm.commerce.marketing.promotion.runtime.OrderQualifyingTotal
  • All Implemented Interfaces:
    XMLizable, java.io.Serializable, java.lang.Cloneable


    public class OrderQualifyingTotal
    extends java.lang.Object
    implements java.lang.Cloneable, XMLizable
    The class represents the total price of an order including monetary adjustment.

    XML Snippet of OrderQualifyingTotal:

       <OrderQualifyingTotal impl="com.ibm.commerce.marketing.promotion.runtime.OrderQualifyingTotal">
            <SubTotal>200</SubTotal>
            <Shipping>100</Shipping>
            <Tax>50</Tax>
            <ShippingTax>50</ShippingTax>
       </OrderQualifyingTotal>
     
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM Copyright
      static java.math.BigDecimal ZERO
      BigDecimal value "0"
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.Object clone() 
      boolean equals(java.lang.Object obj) 
      void fromXML(org.w3c.dom.Node anXMLNode)
      Transforms the XML node into its corresponding real Object.
      java.math.BigDecimal getOrderQualifyingTotal(int types)
      Gets the order qualifying total of the specified monetary types
      java.math.BigDecimal getShipping()
      Returns shipping charge
      java.math.BigDecimal getShippingTax()
      Returns tax on shipping charge
      java.math.BigDecimal getSubTotal()
      Returns the sum of all Order Item Price * Order Item Quantity
      java.math.BigDecimal getTax()
      Returns tax on order
      int hashCode() 
      boolean isContained(java.math.BigDecimal value, int mask)
      Checks if monetary values as specified by the mask bit pattern of this OrderQualifyingTotal is greater or equal to those of operand.
      boolean isContained(OrderQualifyingTotal aTotal)
      Checks if all monetary values of this OrderQualifyingTotal is greater or equal to those of operand.
      void subtract(java.math.BigDecimal value, int mask)
      Finds the difference between two OrderQualifyingTotals.
      OrderQualifyingTotal subtract(OrderQualifyingTotal aTotal)
      Finds the difference between two OrderQualifyingTotals.
      java.lang.String toString() 
      java.lang.String toXML()
      Converts the object into its corresponding XML format representation.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • COPYRIGHT

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

        public static final java.math.BigDecimal ZERO
        BigDecimal value "0"
    • Constructor Detail

      • OrderQualifyingTotal

        public OrderQualifyingTotal()
        Constructor.
      • OrderQualifyingTotal

        public OrderQualifyingTotal(java.math.BigDecimal _subTotal,
                                    java.math.BigDecimal _shipping,
                                    java.math.BigDecimal _tax,
                                    java.math.BigDecimal _shippingTax)
        Constructor.
        Parameters:
        _subTotal - the sum of all price*quantity for all items
        _shipping - the shipping cost
        _tax - the tax cost
        _shippingTax - the shipping tax cost
      • OrderQualifyingTotal

        public OrderQualifyingTotal(OrderRunningTotal total)
        Constructor.
        Parameters:
        total - an order running total that this OrderQualifyingTotal object will be created from.
    • 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:
        com.ibm.commerce.marketing.promotion.runtime.ProtectedContextAttribute.clone()
      • getShipping

        public java.math.BigDecimal getShipping()
        Returns shipping charge
        Returns:
        shiping charge
      • getShippingTax

        public java.math.BigDecimal getShippingTax()
        Returns tax on shipping charge
        Returns:
        tax on shipping charge
      • getSubTotal

        public java.math.BigDecimal getSubTotal()
        Returns the sum of all Order Item Price * Order Item Quantity
        Returns:
        the sum of all Order Item Price * Order Item Quantity
      • getTax

        public java.math.BigDecimal getTax()
        Returns tax on order
        Returns:
        tax on order
      • getOrderQualifyingTotal

        public java.math.BigDecimal getOrderQualifyingTotal(int types)
        Gets the order qualifying total of the specified monetary types
        Parameters:
        types - the monetary types for which an order qualifying total is needed. A bit pattern
        Returns:
        the monetary value in order currency
      • subtract

        public OrderQualifyingTotal subtract(OrderQualifyingTotal aTotal)
        Finds the difference between two OrderQualifyingTotals. No negative values are allowed for OrderQualifyingTotals. In the case of a negative value, value "0" is used in place.
         

        For example OrderQualifyingTotal Q1 and Q2, if Q1.subTotal=10, Q1.shipping = 2, Q1.tax = 2, Q1.shippingTax=1 and Q2.subTotal=20, Q1.shipping = 1, Q1.tax = 2, Q1.shippingTax=0. Q3 is the result of Q1-Q2. Then Q3.subTotal = 0, Q3.shipping=1, Q3.tax=0 and Q3.shippingTax=1.

        Parameters:
        aTotal - is the object of OrderQualifyingTotal to be subtracted
        Returns:
        OrderQualifyingTotal representing the result of subtraction
      • isContained

        public boolean isContained(OrderQualifyingTotal aTotal)
        Checks if all monetary values of this OrderQualifyingTotal is greater or equal to those of operand.
        Parameters:
        aTotal - the operand, a value to be compared
        Returns:
        true if all monetary values of this OrderQualifyingTotal is greater or equal to those of the operand.
      • toString

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

        public boolean equals(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()
      • isContained

        public boolean isContained(java.math.BigDecimal value,
                                   int mask)
        Checks if monetary values as specified by the mask bit pattern of this OrderQualifyingTotal is greater or equal to those of operand.
        Parameters:
        value - the amount, a value to be compared
        mask - the bit pattern that marks the monetary values of this OrderQualifyingTotal to be compared against.
        Returns:
        true if all monetary values of this OrderQualifyingTotal is greater or equal to those of the operand.
      • subtract

        public void subtract(java.math.BigDecimal value,
                             int mask)
        Finds the difference between two OrderQualifyingTotals. No negative values are allowed for OrderQualifyingTotals. In the case of a negative value, value "0" is used in place.
        Parameters:
        value - a total value of all the monetary values to be compared
        mask - the types of monetary values to be compared.