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 Summary
FieldsModifier and TypeFieldDescriptionprotected org.broadleafcommerce.core.catalog.service.CatalogServiceprotected jakarta.persistence.EntityManagerprotected AdminCatalogServiceExtensionManagerstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringprotected org.broadleafcommerce.core.catalog.dao.SkuDaoprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheckForInconsistentPermutations(List<List<org.broadleafcommerce.core.catalog.domain.ProductOptionValue>> allPermutations, List<List<org.broadleafcommerce.core.catalog.domain.ProductOptionValue>> previouslyGeneratedPermutations) protected booleancheckSkuMaxGeneration(List<org.broadleafcommerce.core.catalog.domain.ProductOption> productOptions) cloneProduct(Long productId) This will create a new product along with a new Sku for the defaultSku, along with new Skus for all of the additional Skus.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 ProductOptionsgenerateSkus(Long productId) Create new Skus based on a product's ProductOptions by permutation and add them to existing ones.generateSkusFromProduct(Long productId) 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 Productprotected booleanisSamePermutation(List<org.broadleafcommerce.core.catalog.domain.ProductOptionValue> perm1, List<org.broadleafcommerce.core.catalog.domain.ProductOptionValue> perm2)
-
Field Details
-
NO_SKUS_GENERATED_KEY
-
MAX_SKU_GENERATION_KEY
-
NO_PRODUCT_OPTIONS_GENERATED_KEY
-
FAILED_SKU_GENERATION_KEY
-
NUMBER_SKUS_GENERATED_KEY
-
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
-
-
Constructor Details
-
AdminCatalogServiceImpl
public AdminCatalogServiceImpl()
-
-
Method Details
-
generateSkusFromProduct
Description copied from interface:AdminCatalogServiceClear 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:
generateSkusFromProductin interfaceAdminCatalogService- Parameters:
productId- - the Product to generate Skus from- Returns:
- the number of generated Skus from the ProductOption permutations
-
generateSkus
Description copied from interface:AdminCatalogServiceCreate new Skus based on a product's ProductOptions by permutation and add them to existing ones.- Specified by:
generateSkusin interfaceAdminCatalogService- 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
-
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
Description copied from interface:AdminCatalogServiceThis 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:
cloneProductin interfaceAdminCatalogService- Returns:
-