Class ProductFilter


  • public class ProductFilter
    extends java.lang.Object
    A product filter defined in terms of a category and a number classification attribute code/value pairs. Also you can provide a limit and offset. A filter must have a category but may have zero attribute/value pairs.
    See Also:
    ClassificationService.getProductsByFilter(ProductFilter)
    • Constructor Detail

      • ProductFilter

        public ProductFilter​(CategoryModel category)
        Initialize the filter with a category. The category must not be null.
        Parameters:
        category - the filtered category
        Throws:
        java.lang.IllegalArgumentException - when the category is null
    • Method Detail

      • setAttribute

        public void setAttribute​(java.lang.String attributeCode,
                                 java.lang.Object value)
        Sets a filtered attribute. The attribute is given by its code. The value must either be of the attribute's type or may be a string. See the ClassificationService's getProductsByFilter method for more information on how value are converted
        Parameters:
        attributeCode - the code of the filter attribute
        value - the value of the filter attribute
        See Also:
        ClassificationService.getProductsByFilter(ProductFilter)
      • getAttributes

        public java.util.Map<java.lang.String,​java.lang.Object> getAttributes()
        Returns all filter attributes. Keys are the attribute's code, value are the attribute values
        Returns:
        the filter attributes
      • getCategory

        public CategoryModel getCategory()
        Returns the category of this filter
        Returns:
        the category of this filter
      • getStart

        public int getStart()
        Return the start index of the filter result. 0 is the first index number.
        Returns:
        the start index of the filter result
      • setStart

        public void setStart​(int start)
        Set the start index of the filter result. 0 is the first index number.
        Parameters:
        start - the start index of the filter result
      • getCount

        public int getCount()
        Returns the maximum amount of items in the filter result. -1 denotes no maximum.
        Returns:
        the maximum amount of filered items
      • setCount

        public void setCount​(int count)
        Sets the maximum amount of items in the filter result. -1 denotes no maximum.
        Parameters:
        count - the maximum amount of filered items