com.ibm.commerce.marketing.promotion.condition

Class QuantitySelectionFilter

  • java.lang.Object
    • com.ibm.commerce.marketing.promotion.condition.QuantitySelectionFilter
  • All Implemented Interfaces:
    Filter, XMLizable, java.io.Serializable


    public class QuantitySelectionFilter
    extends java.lang.Object
    implements Filter
    QuantitySelectionFilter class groups the items LineItemSet in groups of number specified by the value of the GroupOf element. It then selects a number of items specified by the Select element value. This selection is done of either the first, last or random items in the group. This is controlled by the value specified in the SelectPosition element. This class implements the Filter interface. XML Snippet for this type of Filter.
     <Filter impl="com.ibm.commerce.marketing.promotion.condition.QuantitySelectionFilter">         
            <GroupOf>10</GroupOf>
            <Select>2</Select>
            <!-- could be first, last or random -->
            <SelectPosition>random</SelectPosition>
     </Filter>
     
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
      static java.lang.Integer FIRST
      Indicates select from Beginning
      static java.lang.Integer LAST
      Indicates select at end
      static java.lang.Integer RANDOM
      Indicates select in Random way
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      LineItemSet filter(LineItemSet input, PromotionContext context)
      This method performs the business logic to filter the input LineItemSet and return a subset of the original LineItemSet.
      void fromXML(org.w3c.dom.Node anXMLNode)
      Transforms the XML node into its corresponding real Object.
      long getGroupSize()
      This method gets the groupSize.
      long getNoOfItems()
      This method gets the Number Of Items.
      java.lang.Integer getSelectPosition()
      This method gets the SelectPosition.
      void setGroupSize(int _groupSize)
      This method sets the groupSize.
      void setNoOfItems(int _noOfItems)
      This method sets the Number Of Items.
      void setSelectPosition(java.lang.Integer _selectPosition)
      This method sets the SelectPosition.
      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
      • FIRST

        public static final java.lang.Integer FIRST
        Indicates select from Beginning
      • LAST

        public static final java.lang.Integer LAST
        Indicates select at end
      • RANDOM

        public static final java.lang.Integer RANDOM
        Indicates select in Random way
    • Constructor Detail

      • QuantitySelectionFilter

        public QuantitySelectionFilter()
        Constructor for QuantitySelectionFilter.
    • Method Detail

      • getGroupSize

        public long getGroupSize()
        This method gets the groupSize.
        Returns:
        int groupSize
      • getNoOfItems

        public long getNoOfItems()
        This method gets the Number Of Items.
        Returns:
        int noOfItems
      • getSelectPosition

        public java.lang.Integer getSelectPosition()
        This method gets the SelectPosition.
        Returns:
        Integer selectPosition
      • setGroupSize

        public void setGroupSize(int _groupSize)
        This method sets the groupSize.
        Parameters:
        _groupSize - int
      • setNoOfItems

        public void setNoOfItems(int _noOfItems)
        This method sets the Number Of Items.
        Parameters:
        _noOfItems - int
      • setSelectPosition

        public void setSelectPosition(java.lang.Integer _selectPosition)
        This method sets the SelectPosition.
        Parameters:
        _selectPosition - Integer
      • filter

        public LineItemSet filter(LineItemSet input,
                                  PromotionContext context)
        Description copied from interface: Filter
        This method performs the business logic to filter the input LineItemSet and return a subset of the original LineItemSet. An empty LineItemSet may be returned if no line item matches the filtering condition.
        Specified by:
        filter in interface Filter
        Parameters:
        input - LineItemSet
        context - PromotionContext
        Returns:
        the filtered LineItemSet
        See Also:
        Filter.filter(LineItemSet, PromotionContext)