Class ItemChoiceAvailabilityConsolidationContributor
java.lang.Object
com.broadleafcommerce.catalog.service.product.consolidation.ItemChoiceAvailabilityConsolidationContributor
- All Implemented Interfaces:
ProductConsolidationContributor
public class ItemChoiceAvailabilityConsolidationContributor
extends Object
implements ProductConsolidationContributor
Performs logic to handle if a product with required item choices has all item choices available
for purchase. This handles item bundles to determine if the product has enough available items in
order to .
-
Constructor Summary
ConstructorDescriptionItemChoiceAvailabilityConsolidationContributor
(ProductService<Product> productService, CategoryProductService<CategoryProduct> categoryProductService, CategoryService<Category> categoryService, com.broadleafcommerce.data.tracking.core.filtering.fetch.rsql.RSQLFilterParser rsqlFilterParser) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkBundleProductsAvailable
(List<ConsolidatedProduct> products, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected boolean
checkForProductsInRuleBasedCategory
(String categoryId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.This is assumed to be true for the purposes of indexing.void
consolidateProducts
(Set<String> productIds, List<ConsolidatedProduct> products, com.broadleafcommerce.data.tracking.core.tenant.domain.InheritanceLines inheritanceLines, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Consolidate products with their related domain and translations.protected void
determineItemsInBundleAvailable
(ConsolidatedProduct consolidatedProduct, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected void
determineRequiredItemChoicesAvailable
(List<ConsolidatedProduct> productsWithRequiredItemChoices, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected CategoryProductService<CategoryProduct>
protected CategoryService<Category>
protected ProductService<Product>
protected List<ConsolidatedProduct>
getProductsWithRequiredItems
(List<ConsolidatedProduct> products) protected com.broadleafcommerce.data.tracking.core.filtering.fetch.rsql.RSQLFilterParser
protected void
hydrateBundleProducts
(List<ConsolidatedProduct> bundleProducts, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected void
hydrateCategoryProducts
(org.springframework.data.domain.Page<CategoryProduct> categoryProducts, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected boolean
isItemAvailableInCategory
(ProductOption productOption, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.This is assumed to be true for the purposes of indexing.protected boolean
isSpecificProductAvailable
(ProductOption productOption) If 1 product is available in a bundle, even if that bundle has a minimum quantity of greater than 1, we assume it is available.
-
Constructor Details
-
ItemChoiceAvailabilityConsolidationContributor
public ItemChoiceAvailabilityConsolidationContributor(ProductService<Product> productService, CategoryProductService<CategoryProduct> categoryProductService, CategoryService<Category> categoryService, com.broadleafcommerce.data.tracking.core.filtering.fetch.rsql.RSQLFilterParser rsqlFilterParser)
-
-
Method Details
-
consolidateProducts
public void consolidateProducts(Set<String> productIds, List<ConsolidatedProduct> products, com.broadleafcommerce.data.tracking.core.tenant.domain.InheritanceLines inheritanceLines, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ProductConsolidationContributor
Consolidate products with their related domain and translations. This includes both hydratingProduct
fields and combining external references likeCategoryProduct
. Any catalog or sandbox overrides made to external references for non-overridden products will generate new placeholder products to store those overrides.- Specified by:
consolidateProducts
in interfaceProductConsolidationContributor
- Parameters:
productIds
- the IDs of the products to consolidateproducts
- the product in all explicit context statesinheritanceLines
- the catalog inheritance lines top-down from all of the productscontext
- context information surrounding sandboxing/multitenant state
-
checkBundleProductsAvailable
protected void checkBundleProductsAvailable(List<ConsolidatedProduct> products, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
hydrateBundleProducts
protected void hydrateBundleProducts(List<ConsolidatedProduct> bundleProducts, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
determineItemsInBundleAvailable
protected void determineItemsInBundleAvailable(ConsolidatedProduct consolidatedProduct, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
getProductsWithRequiredItems
protected List<ConsolidatedProduct> getProductsWithRequiredItems(List<ConsolidatedProduct> products) -
determineRequiredItemChoicesAvailable
protected void determineRequiredItemChoicesAvailable(List<ConsolidatedProduct> productsWithRequiredItemChoices, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
isItemAvailableInCategory
@Deprecated protected boolean isItemAvailableInCategory(ProductOption productOption, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.This is assumed to be true for the purposes of indexing. As of 1.5.0-GA. -
hydrateCategoryProducts
protected void hydrateCategoryProducts(org.springframework.data.domain.Page<CategoryProduct> categoryProducts, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
checkForProductsInRuleBasedCategory
@Deprecated protected boolean checkForProductsInRuleBasedCategory(String categoryId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated.This is assumed to be true for the purposes of indexing. As of 1.5.0-GA. -
isSpecificProductAvailable
If 1 product is available in a bundle, even if that bundle has a minimum quantity of greater than 1, we assume it is available. That's because, even if there's a minimum quantity of 2 and only 1 product is available, we can say that the customer could purchase 2 of the 1 available product.- Parameters:
productOption
-- Returns:
- true if at least one specific item choice is available, else false.
-
getProductService
-
getCategoryProductService
-
getCategoryService
-
getRsqlFilterParser
protected com.broadleafcommerce.data.tracking.core.filtering.fetch.rsql.RSQLFilterParser getRsqlFilterParser()
-