com.ibm.commerce.marketing.promotion.condition

Class QuantityBasedGroupingFilter

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


    public class QuantityBasedGroupingFilter
    extends java.lang.Object
    implements Filter
    QuantityBasedGroupingFilter selects a sub set of order items based on defined quantity related selection logic. Parameters to this filter include:
    BaseQuantity
    MaxGroupCount
    SelectionQuantity
    BaseSelectionPosition
    SelectionPosition

    Example A:
    BaseQuantity: 3
    MaxGroupCount: 2
    SelectionQuantity: 1
    BaseSelectionPosition: 1 (LOWEST). The other possible value is 2 (HIGHEST).
    SelectionPosition: 3 (LOWEST_WITHIN_GROUP). The other possible values are 4 (HIGHEST_WITHIN_GROUP), 2 (HIGHEST), and 1 (LOWEST).
    Order contains 10 items
    First, 10 items are divided by 3 (BaseQuantity), and then the first (BaseSelectionPosition) 2 (MaxGroupOfCount) groups are selected. With in the selected 6 items, the first (SelectionQuantity) in each group (SelectionPosition) is selected and returned, i.e. the 1st and 4th items out of the 10 items are returned.

    Example B:
    BaseQuantity: 3
    MaxGroupCount: 2
    SelectionQuantity: 1
    BaseSelectionPosition: 1 (LOWEST). The other possible value is 2 (HIGHEST).
    SelectionPosition: 1 (LOWEST). The other possible values are 2 (HIGHEST), 4 (HIGHEST_WITHIN_GROUP), and 3 (LOWEST_WITHIN_GROUP).
    Order contains 10 items
    First, 10 items are divided by 3 (BaseQuantity), and then the first (BaseSelectionPosition) 2 (MaxGroupOfCount) groups are selected. With in the selected 6 items, the first 2 items are selected, i.e. the 1st and 2nd items in the order are returned. The difference between this example and the previous one is the SelectionPosition, the previous selects items in each group based on the number of matched groups and selection quantity. In this example, the lowest ranked items are selected based on the number of matched groups and selection quantity.

            <Filter impl="com.ibm.commerce.marketing.promotion.condition.QuantityBasedGroupingFilter">
                    <BaseQuantity>3</BaseQuantity>
                    <MaxGroupCount>2</MaxGroupCount>
                    <SelectPosition>1</SelectPosition>
                    <SelectionQuantity>3</SelectionQuantity> 
                    <BaseSelectionPosition>1</BaseSelectionPosition> 
            </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 HIGHEST
      Indicates select at end
      static java.lang.Integer HIGHEST_WITHIN_GROUP
      Indicates select in Random way
      static java.lang.Integer LOWEST
      Indicates select from Beginning
      static java.lang.Integer LOWEST_WITHIN_GROUP
      Indicates select in Random way
    • Field Detail

      • COPYRIGHT

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

        public static final java.lang.Integer LOWEST
        Indicates select from Beginning
      • HIGHEST

        public static final java.lang.Integer HIGHEST
        Indicates select at end
      • LOWEST_WITHIN_GROUP

        public static final java.lang.Integer LOWEST_WITHIN_GROUP
        Indicates select in Random way
      • HIGHEST_WITHIN_GROUP

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

      • QuantityBasedGroupingFilter

        public QuantityBasedGroupingFilter()
        Constructor for QuantityBasedGroupingFilter.
    • Method Detail

      • 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)
      • getBaseQuantity

        public int getBaseQuantity()
        Returns the base quantity of the filter.
        Returns:
        int The base quantity of the filter.
      • getBaseSelectionPosition

        public int getBaseSelectionPosition()
        Returns the base selection position of the filter. Possible values include LOWEST and HIGHEST.
        Returns:
        int The base section position of the filter.
      • getMaxGroupCount

        public int getMaxGroupCount()
        Returns the maximum group count of the filter.
        Returns:
        int The maximum group count of the filter.
      • getSelectionQuantity

        public int getSelectionQuantity()
        Returns the selection quantity of the filter.
        Returns:
        int The selection quantity of the filter.
      • getSelectionPosition

        public int getSelectionPosition()
        Returns the selection position of the filter. Possible values include LOWEST, HIGHEST, LOWEST_WITHIN_GROUP and HIGHEST_WITHIN_GROUP.
        Returns:
        int The selection position of the filter.
      • setBaseQuantity

        public void setBaseQuantity(int i)
        Sets the base quantity of the filter.
        Parameters:
        i - The base quantity to set the filter to.
      • setBaseSelectionPosition

        public void setBaseSelectionPosition(int i)
        Sets the base selection position of the filter. Possible values include LOWEST and HIGHEST.
        Parameters:
        i - The base selection position to set the filter to.
      • setMaxGroupCount

        public void setMaxGroupCount(int i)
        Sets the maximum group count size of the filter.
        Parameters:
        i - The maximum group count to set the filter to.
      • setSelectionQuantity

        public void setSelectionQuantity(int i)
        Sets the selection quantity of the filter.
        Parameters:
        i - The selection quantity to set the filter to.
      • setSelectionPosition

        public void setSelectionPosition(int i)
        Sets the selection position of the filter. Possible values include LOWEST, HIGHEST, LOWEST_WITHIN_GROUP and HIGHEST_WITHIN_GROUP.
        Parameters:
        i - The selection position to set the filter to.