Class ProductVariantMatrixPopulator<SOURCE extends ProductModel,TARGET extends ProductData>
java.lang.Object
de.hybris.platform.commercefacades.product.converters.populator.AbstractProductPopulator<SOURCE,TARGET>
de.hybris.platform.commercefacades.product.converters.populator.ProductVariantMatrixPopulator<SOURCE,TARGET>
- All Implemented Interfaces:
Populator<SOURCE,TARGET>
- Direct Known Subclasses:
CPQProductVariantMatrixPopulator
public class ProductVariantMatrixPopulator<SOURCE extends ProductModel,TARGET extends ProductData>
extends AbstractProductPopulator<SOURCE,TARGET>
Populate the multi-dimensional variant tree for a given product.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected VariantMatrixElementDatacreateNode(VariantMatrixElementData parent, VariantValueCategoryModel valueCategory) protected voidcreateNodesForVariant(VariantProductModel variant, VariantMatrixElementData currentParentNode) protected VariantMatrixElementDatagetExistingNode(VariantMatrixElementData parent, VariantValueCategoryModel valueCategory) Finds inside the elements of the parent node if there is a node for this valueCategoryprotected VariantProductModelgetStarterVariant(ProductModel productModel, Collection<VariantProductModel> variants) protected Comparator<VariantValueCategoryModel>protected Collection<VariantProductModel>getVariants(ProductModel productModel) protected List<VariantValueCategoryModel>getVariantValuesCategories(ProductModel productModel) Get the list ofVariantValueCategoryModelrelated to a specificGenericVariantProductModel.protected voidorderTree(List<VariantMatrixElementData> elementsList) Sort the tree on each level, by tree element sequence.voidpopulate(ProductModel productModel, ProductData productData) Populates the productData with the categories information modeled as a tree.voidsetValueCategoryComparator(Comparator<VariantValueCategoryModel> valueCategoryComparator) voidsetVariantMatrixElementPopulator(Populator<VariantValueCategoryModel, VariantMatrixElementData> variantMatrixElementPopulator) Methods inherited from class de.hybris.platform.commercefacades.product.converters.populator.AbstractProductPopulator
getModelService, getProductAttribute, safeToString, setModelService
-
Constructor Details
-
ProductVariantMatrixPopulator
public ProductVariantMatrixPopulator()
-
-
Method Details
-
populate
Populates the productData with the categories information modeled as a tree. The resulting tree, modeled as a group of nested lists, where the outer list will have someVariantMatrixElementDatarepresenting the categories with priority_1, and each of those contains a list ofVariantMatrixElementDatarepresenting the categories with priority_2, and so on.
e.g.: A product with dimensions color/fit/size would return a list organized like this: <BROWN:<normal:<7;8;9>; wide:<8;9;10>>; BLACK<normal:<7;8>>>- Parameters:
productModel- the product to take the data from.productData- the data to put the data in.- Throws:
ConversionException
-
getStarterVariant
protected VariantProductModel getStarterVariant(ProductModel productModel, Collection<VariantProductModel> variants) -
createNodesForVariant
protected void createNodesForVariant(VariantProductModel variant, VariantMatrixElementData currentParentNode) -
getVariants
-
getVariantValuesCategories
Get the list ofVariantValueCategoryModelrelated to a specificGenericVariantProductModel.- Parameters:
productModel- the variant product.- Returns:
- The variant value categories, ordered by variant category priority.
-
createNode
protected VariantMatrixElementData createNode(VariantMatrixElementData parent, VariantValueCategoryModel valueCategory) -
orderTree
Sort the tree on each level, by tree element sequence. The method is recursive in a way lists will be sorted bottom-up (i.e. list of leaves will be organized before of its parents). -
getExistingNode
protected VariantMatrixElementData getExistingNode(VariantMatrixElementData parent, VariantValueCategoryModel valueCategory) Finds inside the elements of the parent node if there is a node for this valueCategory -
getValueCategoryComparator
-
setValueCategoryComparator
public void setValueCategoryComparator(Comparator<VariantValueCategoryModel> valueCategoryComparator) -
getVariantMatrixElementPopulator
protected Populator<VariantValueCategoryModel,VariantMatrixElementData> getVariantMatrixElementPopulator() -
setVariantMatrixElementPopulator
public void setVariantMatrixElementPopulator(Populator<VariantValueCategoryModel, VariantMatrixElementData> variantMatrixElementPopulator)
-