Class ProductOptionValueCombinationService
java.lang.Object
com.broadleafcommerce.catalog.service.option.ProductOptionValueCombinationService
Used to generate combinations from a list of product options and their allowed values. This is
primarily used in Sku generation
- Author:
- Phillip Verheyden (phillipuniverse)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerateValueCombinations(List<ProductOption> variantDistinguishingOptions, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Generate all of the unique combinations for a given set ofProductOptionRef.protected List<Set<ProductOptionValueCombination>>generateValueCombinationsHelper(int currentOptionIdx, Set<ProductOptionValueCombination> currentCombination, List<ProductOption> options, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected List<AttributeChoiceValue>getValues(@NonNull ProductOption option, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
-
Constructor Details
-
ProductOptionValueCombinationService
public ProductOptionValueCombinationService()
-
-
Method Details
-
generateValueCombinations
public List<Set<ProductOptionValueCombination>> generateValueCombinations(List<ProductOption> variantDistinguishingOptions, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Generate all of the unique combinations for a given set of
ProductOptionRef. The number of combinations that are generated should equal the number of allowed values of each product option multiplied together.ProductOptionRefs that participate in combination detection are only those whereProductOptionRef#isVariantDistinguishing()is true.The allowed values for a given
ProductOptionRefare read from the underlying data store to generate the combinations- Parameters:
variantDistinguishingOptions- seed of options to generate combinations for, should all be of typeDefaultProductOptionType.VARIANT_DISTINGUISHINGcontext- the sandbox and multi-tenant context to run this operation under- Returns:
- all of the combinations from the
OptionTemplateValues for the given set of options
-
generateValueCombinationsHelper
protected List<Set<ProductOptionValueCombination>> generateValueCombinationsHelper(int currentOptionIdx, Set<ProductOptionValueCombination> currentCombination, List<ProductOption> options, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
getValues
protected List<AttributeChoiceValue> getValues(@NonNull @NonNull ProductOption option, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
-