Interface ClassificationService

  • All Known Implementing Classes:
    DefaultClassificationService

    public interface ClassificationService
    Service to obtain information about a product's features and to search for products with classifcation attribute filters applied
    Spring Bean ID:
    classificationService
    • Method Detail

      • getFeatures

        FeatureList getFeatures​(ProductModel product)
        Returns a list of classification features for a given product.
        Parameters:
        product - the product to load the features for
        Returns:
        the list of features
        Throws:
        java.lang.IllegalArgumentException - thrown when product is null or is not persisted
      • getFeature

        Feature getFeature​(ProductModel product,
                           ClassAttributeAssignmentModel assignment)
        Returns a classification feature for a given product and assignment.
        Parameters:
        product - the item to load the features for
        Returns:
        the features
        Throws:
        java.lang.IllegalArgumentException - thrown when product is null or is not persisted, assignment is null
      • getProductsByFilter

        ProductFilterResult getProductsByFilter​(ProductFilter filter)
                                         throws UnknownIdentifierException,
                                                AmbiguousIdentifierException
        Returns all products for which the given filter applies. The filter is defined in terms of a category and a number of classification attribute code/value pairs. Attribute values can be given as String. This method will convert string values to the type of the actual classification attribute before applying the filter. Scalar types are converted by using the valueOf method of attribute value's class. When the attribute is of type enum the string is interpreted as the code of the enum value.
        Parameters:
        filter - the filter to apply
        Returns:
        the filtered products
        Throws:
        UnknownIdentifierException - when a attribute with a given code cannot be found
        AmbiguousIdentifierException - when there's more than one attribute with a given code
      • setFeatures

        void setFeatures​(ProductModel product,
                         FeatureList featureList)
        Sets the given list of classification Features to the given ProductModel. Any other existing feature at the product model which is not in the list won't change
        Parameters:
        product - the product
        featureList - the FeatureList object
        Throws:
        java.lang.IllegalArgumentException - thrown when product is null or is not persisted, featureList is null
      • replaceFeatures

        void replaceFeatures​(ProductModel product,
                             FeatureList featureList)
        Sets all the features from the list to the product model. The existing features at the producr model which are not in the feature list are removed (untyped feature) or the feature values of this feature are cleared (typed feature)
        Parameters:
        product - the Product model
        featureList - contains the features with new/changed feature values. Or features with the same feature values which are already stored - those won't change then.
        Throws:
        java.lang.IllegalArgumentException - thrown when product is null or is not persisted, featureList is null
      • setFeature

        void setFeature​(ProductModel product,
                        Feature feature)
        Sets a single Feature to the given ProductModel. Any other Feature at the product model won't be changed.
        Parameters:
        product - the product
        feature - the feature
        Throws:
        java.lang.IllegalArgumentException - thrown when product is null or is not persisted, feature is null
      • getFeatures

        FeatureList getFeatures​(ProductModel product,
                                java.util.List<ClassAttributeAssignmentModel> assignments)
        Returns a list of classification features for a given product and assignments.
        Parameters:
        product - the product to load the features for
        assignments - list of assignments
        Returns:
        the list of features
        Throws:
        java.lang.IllegalArgumentException - thrown when product is null or is not persisted