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 Summary
Modifier and TypeMethodDescriptiongetAttributeUnits(ClassificationSystemVersionModel systemVersion) Returns a list of all classification attribute units.getFeature(ItemModel item, ClassAttributeAssignmentModel assignment) Deprecated, for removal: This API element is subject to removal in a future version.getFeature(ProductModel product, ClassAttributeAssignmentModel assignment) Returns a classification feature for a given product and assignment.getFeatures(ProductModel product) Returns a list of classification features for a given product.getFeatures(ProductModel product, List<ClassAttributeAssignmentModel> assignments) Returns a list of classification features for a given product and assignments.getProductsByFilter(ProductFilter filter) Returns all products for which the given filter applies.voidreplaceFeatures(ProductModel product, FeatureList featureList) Sets all the features from the list to the product model.voidsetFeature(ProductModel product, Feature feature) Sets a singleFeatureto the givenProductModel.voidsetFeatures(ProductModel product, FeatureList featureList) Sets the given list of classificationFeatures to the givenProductModel.
-
Method Details
-
getFeatures
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:
IllegalArgumentException- thrown whenproductis null or is not persisted
-
getFeature
@Deprecated(since="ages", forRemoval=true) Feature getFeature(ItemModel item, ClassAttributeAssignmentModel assignment) Deprecated, for removal: This API element is subject to removal in a future version.since ages - usegetFeature(ProductModel, ClassAttributeAssignmentModel)instead.Returns a classification feature for a given item.- Parameters:
item- the item to load the features for- Returns:
- the features
-
getFeature
Returns a classification feature for a given product and assignment.- Parameters:
product- the item to load the features for- Returns:
- the features
- Throws:
IllegalArgumentException- thrown whenproductis null or is not persisted,assignmentis 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 thevalueOfmethod 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 foundAmbiguousIdentifierException- when there's more than one attribute with a given code
-
setFeatures
Sets the given list of classificationFeatures to the givenProductModel. Any other existing feature at the product model which is not in the list won't change- Parameters:
product- the productfeatureList- the FeatureList object- Throws:
IllegalArgumentException- thrown whenproductis null or is not persisted,featureListis null
-
replaceFeatures
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 modelfeatureList- 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:
IllegalArgumentException- thrown whenproductis null or is not persisted,featureListis null
-
setFeature
Sets a singleFeatureto the givenProductModel. Any other Feature at the product model won't be changed.- Parameters:
product- the productfeature- the feature- Throws:
IllegalArgumentException- thrown whenproductis null or is not persisted,featureis null
-
getAttributeUnits
Collection<ClassificationAttributeUnitModel> getAttributeUnits(ClassificationSystemVersionModel systemVersion) Returns a list of all classification attribute units.- Parameters:
systemVersion- the system version of the classification- Returns:
- the classification attribute units
-
getFeatures
Returns a list of classification features for a given product and assignments.- Parameters:
product- the product to load the features forassignments- list of assignments- Returns:
- the list of features
- Throws:
IllegalArgumentException- thrown whenproductis null or is not persisted
-
getFeature(ProductModel, ClassAttributeAssignmentModel)instead.