Class VariantMatrixFactoryUtil


  • public class VariantMatrixFactoryUtil
    extends java.lang.Object
    • Field Detail

      • BASE_PRODUCT_CODE

        public static final java.lang.String BASE_PRODUCT_CODE
        See Also:
        Constant Field Values
      • dimensions

        public static final java.lang.String[] dimensions
      • categoryNamesMap

        public static final java.util.Map<java.lang.String,​java.util.List<java.lang.String>> categoryNamesMap
    • Constructor Detail

      • VariantMatrixFactoryUtil

        public VariantMatrixFactoryUtil()
    • Method Detail

      • addVariantsWithValueCategories

        public static int addVariantsWithValueCategories​(ProductModel baseProductModel,
                                                         int dimension)
        Generate sample variants, using the category tree and adds those variants to the productmodel.
        Parameters:
        baseProductModel - the product to generate variants for
        dimension - the amount of dimensions to create
        Returns:
        the amount of variants created
      • createCategoriyModelTree

        public static java.util.List<java.util.List<CategoryModel>> createCategoriyModelTree​(int dimension,
                                                                                             java.util.Map<java.lang.String,​java.util.List<java.lang.String>> categoryNamesMap)
        Creates the structure of the categories and value categories.
      • multiplyPermutations

        public static java.util.List<java.util.List<CategoryModel>> multiplyPermutations​(java.util.List<java.util.List<CategoryModel>> allPermutations,
                                                                                         java.util.List<CategoryModel> valueCategories)
        Combines the lists of generated values this way:

        If allPermutations = [[1,2],[1,3]] and valueCategories = [4,5] the result is = [[1,2,4],[1,3,4],[1,2,5],[1,3,5]]

        Parameters:
        allPermutations - the existing Permutations
        valueCategories - the new Permutation elements to be combined
        Returns:
        the total set of Permutations posible.
      • mockNewVariantProductModelWithVariantsAndValueCategories

        public static ProductModel mockNewVariantProductModelWithVariantsAndValueCategories​(int dimension)
      • mockNewProductModel

        public static ProductModel mockNewProductModel()
      • getIndent

        protected static java.lang.String getIndent​(int level)