com.ibm.commerce.marketing.promotion.condition

Class OrderedQuantityFilter

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


    public class OrderedQuantityFilter
    extends java.lang.Object
    implements Filter
    OrderedQuantityFilter sorts the LineItemSet and returns the specified quantity of either highest priced or lowest priced LineItems. The quantity of the LineItemSet used for filtration is specified by the NoOfItems node value. The FilterCriteria node can have one of four values namely 'upto', 'exact', 'minimum' or 'rest'. These four values are explained by the example below.
    Example: Suppose the quantity of the input LineItemSet is designated as 'inputQuantity' and the number of items of the filter ( specified by the NoOfItems node) is designated as 'filterQuantity'.

    If the FilterCriteria is 'upto' then:
    If filterQuantity is >= inputQuantity, then the filtered result quantity is inputQuantity.
    If filterQuantity is < inputQuantity, then the filtered result quantity is filterQuantity.

    If the FilterCriteria is 'exact' then:
    If filterQuantity is >= inputQuantity, then the filtered result quantity is 0.
    If filterQuantity is < inputQuantity, then the filtered result quantity is filterQuantity.

    If the FilterCriteria is 'minimum' then:
    If filterQuantity is > inputQuantity, then the filtered result quantity is 0.
    If filterQuantity is <= inputQuantity, then the filtered result quantity is inputQuantity.

    If the FilterCriteria is 'rest' then:
    If filterQuantity is >= inputQuantity, then the filtered result quantity is 0.
    If filterQuantity is < inputQuantity, then the filtered result quantity is inputQuantity - filterQuantity.

    This class implements Filter interface. XML Snippet for this type of Filter:
      <Filter impl="com.ibm.commerce.marketing.promotion.condition.OrderedQuantityFilter">
                    <!-- highest or lowest -->
                    <Type>highest</Type>
                 <!-- upto, exact, minimum, rest -->
                    <FilterCriteria>upto</FilterCriteria>
                    <NoOfItems>2</NoOfItems>
            </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.String CRITERIA_EXACT
      XML value exact
      static java.lang.String CRITERIA_MINMUM
      XML value minimum
      static java.lang.String CRITERIA_REST
      XML value rest
      static java.lang.String CRITERIA_UPTO
      XML value upto
      static java.lang.Integer HIGH
      Indicates Highest priced LineItems to be selected.
      static java.lang.Integer LOW
      Indicates Lowest priced LineItems to be selected.
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      LineItemSet filter(LineItemSet input, PromotionContext context)
      This method sorts the input LineItemSet and returns the specified quantity of either highest priced or lowest priced LineItems in a LineItemSet.
      void fromXML(org.w3c.dom.Node anXMLNode)
      Transforms the XML node into its corresponding real Object.
      java.lang.String getFilterCriteria()
      This method returns the FilterCriteria.
      int getNoOfItems()
      This method returns the number of items to be selected.
      java.lang.Integer getType()
      This method gets the type of the selection.
      void setFilterCriteria(java.lang.String _filterCriteria)
      This method sets the FilterCriteria.
      void setNoOfItems(int _noOfItems)
      This method sets the number of items to be selected.
      void setType(java.lang.Integer newType)
      This method sets the type of the selection.
      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
      • CRITERIA_UPTO

        public static final java.lang.String CRITERIA_UPTO
        XML value upto
        See Also:
        Constant Field Values
      • CRITERIA_EXACT

        public static final java.lang.String CRITERIA_EXACT
        XML value exact
        See Also:
        Constant Field Values
      • CRITERIA_MINMUM

        public static final java.lang.String CRITERIA_MINMUM
        XML value minimum
        See Also:
        Constant Field Values
      • CRITERIA_REST

        public static final java.lang.String CRITERIA_REST
        XML value rest
        See Also:
        Constant Field Values
      • HIGH

        public static final java.lang.Integer HIGH
        Indicates Highest priced LineItems to be selected.
      • LOW

        public static final java.lang.Integer LOW
        Indicates Lowest priced LineItems to be selected.
    • Constructor Detail

      • OrderedQuantityFilter

        public OrderedQuantityFilter()
        Constructor for OrderedQuantityFilter.
    • Method Detail

      • getType

        public java.lang.Integer getType()
        This method gets the type of the selection.
        Returns:
        one of the two constants of HIGH or LOW.
      • getNoOfItems

        public int getNoOfItems()
        This method returns the number of items to be selected.
        Returns:
        int Number Of Items
      • setType

        public void setType(java.lang.Integer newType)
        This method sets the type of the selection.
        Parameters:
        newType - Set to one of the two constants of HIGH or LOW.
      • getFilterCriteria

        public java.lang.String getFilterCriteria()
        This method returns the FilterCriteria.
        Returns:
        one of the four constants of CRITERIA_UPTO, CRITERIA_EXACT, CRITERIA_MINMUM or CRITERIA_REST.
      • setFilterCriteria

        public void setFilterCriteria(java.lang.String _filterCriteria)
        This method sets the FilterCriteria.
        Parameters:
        _filterCriteria - Set to one of the four constants of CRITERIA_UPTO, CRITERIA_EXACT, CRITERIA_MINMUM or CRITERIA_REST.
      • setNoOfItems

        public void setNoOfItems(int _noOfItems)
        This method sets the number of items to be selected.
        Parameters:
        _noOfItems - The number of items to be set.
      • filter

        public LineItemSet filter(LineItemSet input,
                                  PromotionContext context)
        This method sorts the input LineItemSet and returns the specified quantity of either highest priced or lowest priced LineItems in a LineItemSet. It uses the FitlerCriteria and NoOfItems node values to determine the filter configuration and return value. These nodes are described in more detail in the class summary.
        Specified by:
        filter in interface Filter
        Parameters:
        input - LineItemSet
        context - PromotionContext
        Returns:
        the filtered LineItemSet
        See Also:
        Filter.filter(LineItemSet, PromotionContext)