com.ibm.commerce.marketing.promotion.reward

Class ItemCostVolumeDistribution

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


    public class ItemCostVolumeDistribution
    extends java.lang.Object
    implements com.ibm.commerce.marketing.promotion.reward.GenericDistribution
    ItemCostVolumeDistribution class provides an implementation of distribution based on total cost ranges of all items that are matched in the specified range pattern. If a range pattern is not specified, the cost will be calculated according to all items in the input LineItemSets. This implementation should only be used with volume based promotion types. XML Snippet for ItemCostVolumeDistribution:

    <Distribution impl="com.ibm.commerce.marketing.promotion.reward.ItemCostVolumeDistribution"> <Currency>USD</Currency> <!-- CostBase, 1-Price, 2-Shipping --> <CostBase>1</CostBase> <!-- The item selection Pattern to calculate the total cost --> <Pattern></Pattern> <!-- Multiple Ranges can be specified --> <Range> <LowerBound>1</LowerBound> <UpperBound>5</UpperBound> <Reward></Reward> <Reward></Reward> </Range> <Range> <LowerBound>6</LowerBound> <UpperBound>10</UpperBound> <Reward></Reward> <Reward></Reward> </Range> <!-- Multiple Pattern Filters can go here --> <PatternFilter></PatternFilter> </Distribution>

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String ATTR_IMPL
      XML attribute name -"impl"
      static java.lang.String TAG_COSTBASE
      XML tag -"CostBase"
      static java.lang.String TAG_CURRENCY
      XML tag -"Currency"
      static java.lang.String TAG_DISTRIBUTION
      XML tag -"Distribution"
      static java.lang.String TAG_PATTERN
      XML tag -"Pattern"
      static java.lang.String TAG_PATTERN_FILTER
      XML tag -"PatternFilter"
      static java.lang.String TAG_RANGE
      XML tag -"Range"
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean distribute(LineItemSet[] inputItems, PromotionContext context)
      This method distributes the LineItemSets according to the range setting and calculates the rewards for all qualified LineItemSets.
      void fromXML(org.w3c.dom.Node anXMLNode)
      Transforms the XML node into its corresponding real Object.
      int getCostBase()
      Gets the CostBase of the range.
      java.lang.String getCurrency()
      This method gets the Currency that is used for defining ranges.
      java.util.List getPatternFilters()
      This method gets the PatternFilter of this distribution.
      com.ibm.commerce.marketing.promotion.condition.GenericPattern getRangePattern()
      Gets the pattern object to evaluate the range qualification.
      java.util.List getRanges()
      This method gets the Ranges of the Distribution.
      void setCostBase(int aCostBase)
      Sets the type of the value for range.
      void setCurrency(java.lang.String aCurrency)
      This method sets the Currency used for defining ranges in Cost based Distribution.
      void setRangePattern(com.ibm.commerce.marketing.promotion.condition.GenericPattern aPattern)
      Sets the pattern object to evaluate the range qualification.
      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

      • TAG_DISTRIBUTION

        public static final java.lang.String TAG_DISTRIBUTION
        XML tag -"Distribution"
        See Also:
        Constant Field Values
      • TAG_PATTERN_FILTER

        public static final java.lang.String TAG_PATTERN_FILTER
        XML tag -"PatternFilter"
        See Also:
        Constant Field Values
      • TAG_PATTERN

        public static final java.lang.String TAG_PATTERN
        XML tag -"Pattern"
        See Also:
        Constant Field Values
      • TAG_RANGE

        public static final java.lang.String TAG_RANGE
        XML tag -"Range"
        See Also:
        Constant Field Values
      • ATTR_IMPL

        public static final java.lang.String ATTR_IMPL
        XML attribute name -"impl"
        See Also:
        Constant Field Values
      • TAG_CURRENCY

        public static final java.lang.String TAG_CURRENCY
        XML tag -"Currency"
        See Also:
        Constant Field Values
      • TAG_COSTBASE

        public static final java.lang.String TAG_COSTBASE
        XML tag -"CostBase"
        See Also:
        Constant Field Values
    • Constructor Detail

      • ItemCostVolumeDistribution

        public ItemCostVolumeDistribution()
        Constructor for ItemCostVolumeDistribution.
    • Method Detail

      • getCurrency

        public java.lang.String getCurrency()
        This method gets the Currency that is used for defining ranges.
        Returns:
        The currency
      • getPatternFilters

        public java.util.List getPatternFilters()
        This method gets the PatternFilter of this distribution.
        Returns:
        list of PatternFilters of the distribution
      • setCurrency

        public void setCurrency(java.lang.String aCurrency)
        This method sets the Currency used for defining ranges in Cost based Distribution.
        Parameters:
        aCurrency - The currency for the cost range.
      • getRanges

        public java.util.List getRanges()
        This method gets the Ranges of the Distribution.
        Returns:
        list of DistributionRange
      • distribute

        public boolean distribute(LineItemSet[] inputItems,
                                  PromotionContext context)
        This method distributes the LineItemSets according to the range setting and calculates the rewards for all qualified LineItemSets.
        Specified by:
        distribute in interface com.ibm.commerce.marketing.promotion.reward.GenericDistribution
        Parameters:
        inputItems - List of LineItemSet
        context - PromotionContext
        Returns:
        boolean true if successfully distributed, false otherwise;
      • getCostBase

        public int getCostBase()
        Gets the CostBase of the range.
        Returns:
        Returns the CostBase.
      • setCostBase

        public void setCostBase(int aCostBase)
        Sets the type of the value for range.
        Parameters:
        aCostBase - The CostBase to set. Value 1(default) is for price, 2 is for shipping charge.
      • getRangePattern

        public com.ibm.commerce.marketing.promotion.condition.GenericPattern getRangePattern()
        Gets the pattern object to evaluate the range qualification.
        Returns:
        Returns a Pattern object if it is configured.
      • setRangePattern

        public void setRangePattern(com.ibm.commerce.marketing.promotion.condition.GenericPattern aPattern)
        Sets the pattern object to evaluate the range qualification.
        Parameters:
        aPattern - The pattern object to set.