Class VariantMatrixFactoryUtil

java.lang.Object
de.hybris.platform.commercefacades.product.converters.populator.VariantMatrixFactoryUtil

public class VariantMatrixFactoryUtil extends Object
  • Field Details

  • Constructor Details

    • VariantMatrixFactoryUtil

      public VariantMatrixFactoryUtil()
  • Method Details

    • 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 List<List<CategoryModel>> createCategoriyModelTree(int dimension, Map<String,List<String>> categoryNamesMap)
      Creates the structure of the categories and value categories.
    • multiplyPermutations

      public static List<List<CategoryModel>> multiplyPermutations(List<List<CategoryModel>> allPermutations, 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.
    • mockNewVariantModel

      public static GenericVariantProductModel mockNewVariantModel(ProductModel baseProductModel, List<CategoryModel> valueCategories, int id)
    • mockNewVariantProductModelWithVariantsAndValueCategories

      public static ProductModel mockNewVariantProductModelWithVariantsAndValueCategories(int dimension)
    • mockProductDataWithTree

      public static ProductData mockProductDataWithTree(ProductModel firstVariant)
    • mockNewProductModel

      public static ProductModel mockNewProductModel()
    • mockNewValueCategory

      public static VariantValueCategoryModel mockNewValueCategory(VariantCategoryModel parentCategory, int sequence, String valueCategoryName)
    • getIndent

      protected static String getIndent(int level)