Class DefaultCartItemCatalogInformationService<P extends Product>
java.lang.Object
com.broadleafcommerce.cartoperation.service.mapping.DefaultCartItemCatalogInformationService<P>
- All Implemented Interfaces:
CartItemCatalogInformationService<P>
public class DefaultCartItemCatalogInformationService<P extends Product>
extends Object
implements CartItemCatalogInformationService<P>
-
Constructor Summary
ConstructorDescriptionDefaultCartItemCatalogInformationService
(CartItemConfigurationService<Product> cartItemConfigurationService, List<CartItemProductMapper> cartItemProductMappers, CartOperationServiceProperties properties) DefaultCartItemCatalogInformationService
(List<CartItemProductMapper> cartItemProductMappers) -
Method Summary
Modifier and TypeMethodDescriptionbuildItemAttributeChoices
(@NonNull Map<String, String> requestItemAttributeChoices) protected com.broadleafcommerce.pricing.client.domain.PriceInfo
cleanPriceInfo
(@NonNull com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo) ExcludePriceableTarget
information from thePriceInfo
as it's unnecessary to calculate pricing.protected BroadleafProductService<Product>
protected CartItemConfigurationService<Product>
protected List<CartItemProductMapper>
protected CartItemProductServiceProperties
getCategoryIdsForProduct
(P product) protected String
getDataDrivenEnumId
(DataDrivenEnum dataDrivenEnum) protected com.broadleafcommerce.cart.client.domain.ImageAssetRef
getImageAssetForProduct
(P product) protected com.broadleafcommerce.cart.client.domain.ImageAssetRef
getImageAssetForVariant
(@NonNull Variant variant, P product) protected IncludedProductConfigurationService
protected ItemChoiceConfigurationService
protected String
getPricingKey
(P product, @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem) Returns the product price key, if specified, otherwise retrieves it from the cart item or generates a new one.protected CartOperationServiceProperties
protected void
hydrateIncludedProductDependentItems
(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> potentialDependentItems, P product, boolean isAdd) PopulateIncludedProduct
information onCartItem.getDependentCartItems()
based on the product configuration.protected void
hydrateItemChoiceDependentItems
(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> potentialDependentItems, P product) PopulateItemChoice
information onCartItem.getDependentCartItems()
based on the product configuration.identifyProductForCartItem
(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull CatalogItemList<? extends CatalogItem> catalogItemList) protected void
populateAttributeChoiceLabelsFromOptions
(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, P product) com.broadleafcommerce.cart.client.domain.CartItem
populateCatalogItemInformation
(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull CatalogItemList<? extends CatalogItem> catalogItemList, boolean isAdd, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Populate catalog information within theCartItem
based on the providedCatalogItem
and the merchandising contextcom.broadleafcommerce.cart.client.domain.CartItem
populateCatalogItemInformation
(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, P product, @NonNull List<P> catalogItemList, boolean isAdd, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Populate catalog information within theCartItem
based on the providedCatalogItem
and the merchandising contextprotected void
populateDependentItemInformation
(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, P product, @NonNull List<P> products, boolean isAdd) Deprecated.protected void
populateDependentItemInformation
(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, P product, @NonNull List<P> products, boolean isAdd, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected void
populateVariantInformation
(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull Variant variant, @NonNull Map<String, com.broadleafcommerce.pricing.client.domain.PriceInfo> skuPriceInfos) void
setBroadleafProductService
(BroadleafProductService<Product> broadleafProductService) void
setCartItemProductServiceProperties
(CartItemProductServiceProperties cartItemProductServiceProperties) void
setIncludedProductService
(IncludedProductConfigurationService includedProductService) void
setItemChoiceService
(ItemChoiceConfigurationService itemChoiceService)
-
Constructor Details
-
DefaultCartItemCatalogInformationService
-
DefaultCartItemCatalogInformationService
public DefaultCartItemCatalogInformationService(CartItemConfigurationService<Product> cartItemConfigurationService, List<CartItemProductMapper> cartItemProductMappers, CartOperationServiceProperties properties)
-
-
Method Details
-
populateCatalogItemInformation
public com.broadleafcommerce.cart.client.domain.CartItem populateCatalogItemInformation(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull CatalogItemList<? extends CatalogItem> catalogItemList, boolean isAdd, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CartItemCatalogInformationService
Populate catalog information within theCartItem
based on the providedCatalogItem
and the merchandising context- Specified by:
populateCatalogItemInformation
in interfaceCartItemCatalogInformationService<P extends Product>
- Parameters:
cartItem
- The CartItem that is to be updated with catalog item datacatalogItemList
- The catalog items that were retrieved for the add-to-cart, including dependent catalog itemsisAdd
- Whether we are in an add-to-cart flowcontextInfo
- Context information around sandbox and multitenant state- Returns:
- the updated CartItem that now contains CatalogItem data
-
populateCatalogItemInformation
public com.broadleafcommerce.cart.client.domain.CartItem populateCatalogItemInformation(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull P product, @NonNull @NonNull List<P> catalogItemList, boolean isAdd, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:CartItemCatalogInformationService
Populate catalog information within theCartItem
based on the providedCatalogItem
and the merchandising context- Specified by:
populateCatalogItemInformation
in interfaceCartItemCatalogInformationService<P extends Product>
- Parameters:
cartItem
- The CartItem that is to be updated with catalog item dataproduct
- The CatalogItem that this CartItem is intended to representcatalogItemList
- The catalog items that were retrieved for the add-to-cart, including dependent catalog itemsisAdd
- Whether we are in an add-to-cart flowcontextInfo
- Context information around sandbox and multitenant state- Returns:
- the updated CartItem that now contains CatalogItem data
-
identifyProductForCartItem
protected Optional<P> identifyProductForCartItem(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull CatalogItemList<? extends CatalogItem> catalogItemList) -
getDataDrivenEnumId
-
cleanPriceInfo
protected com.broadleafcommerce.pricing.client.domain.PriceInfo cleanPriceInfo(@NonNull @NonNull com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo) ExcludePriceableTarget
information from thePriceInfo
as it's unnecessary to calculate pricing.- Parameters:
priceInfo
- The price info to clean up for addition to CartItem attributes- Returns:
- The price info with target information excluded
-
getPricingKey
protected String getPricingKey(@NonNull P product, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem) Returns the product price key, if specified, otherwise retrieves it from the cart item or generates a new one. This in general only needed for theDefaultProductType.MERCHANDISING_PRODUCT
as it doesn't have the SKU and pricing key.- Parameters:
product
- the product to get the pricing key fromcartItem
- the cart item to get the pricing key from- Returns:
- the pricing key
-
getImageAssetForProduct
@Nullable protected com.broadleafcommerce.cart.client.domain.ImageAssetRef getImageAssetForProduct(@NonNull P product) -
getImageAssetForVariant
-
getCategoryIdsForProduct
-
populateVariantInformation
-
buildItemAttributeChoices
-
populateAttributeChoiceLabelsFromOptions
protected void populateAttributeChoiceLabelsFromOptions(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull P product) -
populateDependentItemInformation
@Deprecated protected void populateDependentItemInformation(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull P product, @NonNull @NonNull List<P> products, boolean isAdd) Deprecated. -
populateDependentItemInformation
-
hydrateIncludedProductDependentItems
protected void hydrateIncludedProductDependentItems(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> potentialDependentItems, @NonNull P product, boolean isAdd) PopulateIncludedProduct
information onCartItem.getDependentCartItems()
based on the product configuration.- Parameters:
cartItem
- The cart item on which to populate dependent item product configuration information.potentialDependentItems
- The list ofCartItem.getDependentCartItems()
to pick from to find a match for anIncludedProduct
.product
- The product with configuration to be used for hydration.isAdd
- Whether we are in an add-to-cart flow
-
hydrateItemChoiceDependentItems
protected void hydrateItemChoiceDependentItems(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull List<com.broadleafcommerce.cart.client.domain.CartItem> potentialDependentItems, @NonNull P product) PopulateItemChoice
information onCartItem.getDependentCartItems()
based on the product configuration.- Parameters:
cartItem
- The cart item on which to populate dependent item product configuration information.potentialDependentItems
- The list ofCartItem.getDependentCartItems()
to pick from to find a match for anItemChoice
.product
- The product with configuration to be used for hydration.
-
getCartItemConfigurationService
-
getCartItemProductMappers
-
getProperties
-
getBroadleafProductService
-
setBroadleafProductService
@Autowired public void setBroadleafProductService(BroadleafProductService<Product> broadleafProductService) -
getIncludedProductService
-
setIncludedProductService
@Autowired public void setIncludedProductService(IncludedProductConfigurationService includedProductService) -
getItemChoiceService
-
setItemChoiceService
-
getCartItemProductServiceProperties
-
setCartItemProductServiceProperties
@Autowired public void setCartItemProductServiceProperties(CartItemProductServiceProperties cartItemProductServiceProperties)
-