Class AdminCatalogServiceImpl

java.lang.Object
org.broadleafcommerce.admin.server.service.AdminCatalogServiceImpl
All Implemented Interfaces:
AdminCatalogService

@Service("blAdminCatalogService") public class AdminCatalogServiceImpl extends Object implements AdminCatalogService
Author:
Phillip Verheyden
  • Field Details

    • NO_SKUS_GENERATED_KEY

      public static String NO_SKUS_GENERATED_KEY
    • MAX_SKU_GENERATION_KEY

      public static String MAX_SKU_GENERATION_KEY
    • NO_PRODUCT_OPTIONS_GENERATED_KEY

      public static String NO_PRODUCT_OPTIONS_GENERATED_KEY
    • FAILED_SKU_GENERATION_KEY

      public static String FAILED_SKU_GENERATION_KEY
    • NUMBER_SKUS_GENERATED_KEY

      public static String NUMBER_SKUS_GENERATED_KEY
    • INCONSISTENT_PERMUTATIONS_KEY

      public static String INCONSISTENT_PERMUTATIONS_KEY
    • skuMaxGeneration

      @Value("${product.sku.generation.max:400}") protected int skuMaxGeneration
    • catalogService

      protected org.broadleafcommerce.core.catalog.service.CatalogService catalogService
    • skuDao

      protected org.broadleafcommerce.core.catalog.dao.SkuDao skuDao
    • em

      protected jakarta.persistence.EntityManager em
    • extensionManager

      protected AdminCatalogServiceExtensionManager extensionManager
  • Constructor Details

    • AdminCatalogServiceImpl

      public AdminCatalogServiceImpl()
  • Method Details

    • generateSkusFromProduct

      public Integer generateSkusFromProduct(Long productId)
      Description copied from interface: AdminCatalogService
      Clear out any Skus that are already attached to the Product if there were any there and generate a new set of Skus based on the permutations of ProductOptions attached to this Product
      Specified by:
      generateSkusFromProduct in interface AdminCatalogService
      Parameters:
      productId - - the Product to generate Skus from
      Returns:
      the number of generated Skus from the ProductOption permutations
    • generateSkus

      public Map<String,Object> generateSkus(Long productId)
      Description copied from interface: AdminCatalogService
      Create new Skus based on a product's ProductOptions by permutation and add them to existing ones.
      Specified by:
      generateSkus in interface AdminCatalogService
      Parameters:
      productId - - Product ID to create SKUs
      Returns:
      the map as ResponseBody
    • checkForInconsistentPermutations

      protected List<List<org.broadleafcommerce.core.catalog.domain.ProductOptionValue>> checkForInconsistentPermutations(List<List<org.broadleafcommerce.core.catalog.domain.ProductOptionValue>> allPermutations, List<List<org.broadleafcommerce.core.catalog.domain.ProductOptionValue>> previouslyGeneratedPermutations)
    • checkSkuMaxGeneration

      protected boolean checkSkuMaxGeneration(List<org.broadleafcommerce.core.catalog.domain.ProductOption> productOptions)
    • isSamePermutation

      protected boolean isSamePermutation(List<org.broadleafcommerce.core.catalog.domain.ProductOptionValue> perm1, List<org.broadleafcommerce.core.catalog.domain.ProductOptionValue> perm2)
    • generatePermutations

      public List<List<org.broadleafcommerce.core.catalog.domain.ProductOptionValue>> generatePermutations(int currentTypeIndex, List<org.broadleafcommerce.core.catalog.domain.ProductOptionValue> currentPermutation, List<org.broadleafcommerce.core.catalog.domain.ProductOption> options)
      Generates all the possible permutations for the combinations of given ProductOptions
      Parameters:
      currentTypeIndex -
      currentPermutation -
      options -
      Returns:
      a list containing all of the possible combinations of ProductOptionValues based on grouping by the ProductOptionValue
    • cloneProduct

      public Boolean cloneProduct(Long productId)
      Description copied from interface: AdminCatalogService
      This will create a new product along with a new Sku for the defaultSku, along with new Skus for all of the additional Skus. This is achieved by simply detaching the entities from the persistent session, resetting the primary keys and then saving the entity.

      Note: Media for the product is not saved separately, meaning if you make a change to the original product's media items (the one specified by productId) it will change the cloned product's media and vice-versa.

      Specified by:
      cloneProduct in interface AdminCatalogService
      Returns: