Interface ProductReferenceService
- All Known Implementing Classes:
DefaultProductReferenceService
public interface ProductReferenceService
Service providing product references oriented functionality.
-
Method Summary
Modifier and TypeMethodDescriptiongetProductReferences(String qualifier, ProductModel source, ProductModel target, boolean activeOnly) ReturnsProductReferenceModels that join the two given products in the given source/target configuration having the givenProductReferenceModel.QUALIFIERvalue.getProductReferencesForSourceAndTarget(ProductModel source, ProductModel target, boolean activeOnly) Returns allProductReferenceModels that join the two given products in the given (persisted) source/target configuration.getProductReferencesForSourceProduct(ProductModel source, ProductReferenceTypeEnum referenceType, boolean activeOnly) Returns allProductReferenceModels for the given (persisted) sourceProductModeland for the specificProductReferenceTypeEnum.getProductReferencesForTargetProduct(ProductModel target, ProductReferenceTypeEnum referenceType, boolean activeOnly) Returns allProductReferenceModels for the given (persisted) targetProductModeland for the specificProductReferenceTypeEnum.
-
Method Details
-
getProductReferencesForSourceProduct
Collection<ProductReferenceModel> getProductReferencesForSourceProduct(ProductModel source, ProductReferenceTypeEnum referenceType, boolean activeOnly) Returns allProductReferenceModels for the given (persisted) sourceProductModeland for the specificProductReferenceTypeEnum. Example: UsingProductReferenceTypeEnum.ACCESSORIESreturns the related (accessories)ProductReferenceModels, NOT the actual products (accessories), useProductReferenceModel.getTarget()to get the actual accessory product.- Parameters:
source- the sourceProductModelreferenceType- the type of the reference -ProductReferenceTypeEnum. If this argument isnull, the productReferences of all types will be returned.activeOnly- - iftrue, only active product references will be returned.- Returns:
- a collection of
ProductReferenceModels or an empty list if there are no source references for the given product - Throws:
IllegalArgumentException- ifsourceproduct is null.
-
getProductReferencesForTargetProduct
Collection<ProductReferenceModel> getProductReferencesForTargetProduct(ProductModel target, ProductReferenceTypeEnum referenceType, boolean activeOnly) Returns allProductReferenceModels for the given (persisted) targetProductModeland for the specificProductReferenceTypeEnum. Example: UsingProductReferenceTypeEnum.CROSSELLINGreturns the related (for cross selling)ProductReferenceModels, NOT the actual cross selled (source) products, useProductReferenceModel.getSource()to get the source product of the cross selling.- Parameters:
target- the targetProductModelreferenceType- the type of the reference -ProductReferenceTypeEnum. If this argument isnull, the productReferences of all types will be returned.activeOnly- - iftrue, only active product references will be returned.- Returns:
- a collection of
ProductReferenceModels or empty list if there are no target references for the given product. - Throws:
IllegalArgumentException- iftargetproduct is null.
-
getProductReferencesForSourceAndTarget
Collection<ProductReferenceModel> getProductReferencesForSourceAndTarget(ProductModel source, ProductModel target, boolean activeOnly) Returns allProductReferenceModels that join the two given products in the given (persisted) source/target configuration. One can get multipleProductReferenceModels as one product may reference another in different way (differentProductReferenceModel.REFERENCETYPE) Example: two products can be joined by a reference ofProductReferenceTypeEnum.ACCESSORIESandProductReferenceTypeEnum.CROSSELLINGtypes, which means that one is an accessory of the other and - at the same time - they are configured in the cross-selling strategy.- Parameters:
source- the sourceProductModeltarget- the targetProductModelactiveOnly- - iftrue, only active Product references will be returned.- Returns:
- Collection of the
ProductReferenceModels or empty list. - Throws:
IllegalArgumentException- if eithersourceortargetproduct is null.
-
getProductReferences
Collection<ProductReferenceModel> getProductReferences(String qualifier, ProductModel source, ProductModel target, boolean activeOnly) ReturnsProductReferenceModels that join the two given products in the given source/target configuration having the givenProductReferenceModel.QUALIFIERvalue.- Parameters:
qualifier- the desiredProductReferenceModel.QUALIFIER. If this argument isnullor empty string, it will be ignored as a search criterion.source- the sourceProductModeltarget- the targetProductModelactiveOnly- - iftrue, only active Product references will be returned.- Returns:
- Collection of the
ProductReferenceModels or empty list. - Throws:
IllegalArgumentException- if eithersourceortargetproduct is null.
-