com.ibm.commerce.marketing.promotion.reward

Class AdjustmentFunction

  • java.lang.Object
    • com.ibm.commerce.marketing.promotion.reward.AdjustmentFunction
  • All Implemented Interfaces:
    XMLizable, java.io.Serializable


    public class AdjustmentFunction
    extends java.lang.Object
    implements XMLizable
    AdjustmentFunction class encapsulates Adjustment and the list of Filter for that particular adjustment. AdjustmentFunction is defined by a set of filters and an Adjustment. This is the XML Snippet for AdjustmentFunction:
      <AdjustmentFunction impl="com.ibm.commerce.marketing.promotion.reward.AdjustmentFunction">
                    <FilterChain impl="com.ibm.commerce.marketing.promotion.condition.FilterChain">
                            <!-- Multiple Filters can be specified  -->
                            <Filter></Filter>
                    </FilterChain>
                    <Adjustment></Adjustment>
            </AdjustmentFunction>
     
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
    • Constructor Summary

      Constructors 
      Constructor and Description
      AdjustmentFunction()
      Constructor for AdjustmentFunction.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void fromXML(org.w3c.dom.Node anXMLNode)
      Transforms the XML node into its corresponding real Object.
      Adjustment getAdjustment()
      This method gets the Adjustment of this AdjustmentFunction.
      FilterChain getFilterChain()
      This method gets the FilterChain for this AdjustmentFunction.
      boolean invoke(LineItemSet targetedItems, java.math.BigDecimal targetedAmount, int targetedAmountTypes, java.util.Vector affectedItemsVector, java.util.Vector adjustmentsVector, PromotionContext context)
      This method gets the filter list of the adjustment function and applies all the filters to the targeted order items to obtain the affected order items.
      void setAdjustment(Adjustment newAdjustment)
      This method sets the Adjustment for this AdjustmentFunction.
      void setFilterChain(FilterChain _filterChain)
      This method sets the FilterChain for this AdjustmentFunction.
      java.lang.String toXML()
      Converts the object into its corresponding XML format representation.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

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

      • AdjustmentFunction

        public AdjustmentFunction()
        Constructor for AdjustmentFunction.
    • Method Detail

      • getAdjustment

        public Adjustment getAdjustment()
        This method gets the Adjustment of this AdjustmentFunction.
        Returns:
        Adjustment
      • getFilterChain

        public FilterChain getFilterChain()
        This method gets the FilterChain for this AdjustmentFunction.
        Returns:
        the FilterChain
      • setAdjustment

        public void setAdjustment(Adjustment newAdjustment)
        This method sets the Adjustment for this AdjustmentFunction.
        Parameters:
        newAdjustment - Adjustment
      • setFilterChain

        public void setFilterChain(FilterChain _filterChain)
        This method sets the FilterChain for this AdjustmentFunction.
        Parameters:
        _filterChain - The FilterChain
      • invoke

        public boolean invoke(LineItemSet targetedItems,
                              java.math.BigDecimal targetedAmount,
                              int targetedAmountTypes,
                              java.util.Vector affectedItemsVector,
                              java.util.Vector adjustmentsVector,
                              PromotionContext context)
                       throws PromotionRuntimeException
        This method gets the filter list of the adjustment function and applies all the filters to the targeted order items to obtain the affected order items. It then uses the other parameters to call the apply(LineItemSet, BigDecimal, int, LineItemSet, Vector, Vector, PromotionContext) method of the Adjustment associated with this AdjusmentFunction and returns the boolean value returned by the apply method. This method is called in the computeReward(PromotionContext, PromotionExecutionRecord) method of DefaultReward.
        Parameters:
        targetedItems - The targeted order items. This is a set of order items (or portions of order items) that are used to qualify for the promotion of which the Adjustment associated with the AdjustmentFunction is a part.
        targetedAmount - Targeted amount.
        targetedAmountTypes - Type of the Targeted amount.
        affectedItemsVector - A Vector of affected LineItemSets.
        adjustmentsVector - A Vector of Adjustment objects.
        context - The PromotionContext.
        Returns:
        true if the adjustment was applied successully, otherwise a false value is returned.
        Throws:
        PromotionRuntimeException - when the computation encounters a problem.