Class DefaultCartItemProductService
- java.lang.Object
-
- com.broadleafcommerce.cartoperation.service.mapping.DefaultCartItemProductService
-
- All Implemented Interfaces:
CartItemProductService
public class DefaultCartItemProductService extends Object implements CartItemProductService
-
-
Constructor Summary
Constructors Constructor Description DefaultCartItemProductService(CartItemConfigurationService cartItemConfigurationService, List<CartItemProductMapper> cartItemProductMappers, CartOperationServiceProperties properties)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected Map<String,com.broadleafcommerce.order.common.domain.AttributeChoiceValue>buildItemAttributeChoices(@NonNull Map<String,String> requestItemAttributeChoices)protected com.broadleafcommerce.pricing.client.domain.PriceInfocleanPriceInfo(@NonNull com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo)ExcludePriceableTargetinformation from thePriceInfoas it's unnecessary to calculate pricing.protected CartItemConfigurationServicegetCartItemConfigurationService()protected List<CartItemProductMapper>getCartItemProductMappers()protected Set<String>getCategoryIdsForProduct(@NonNull Product product)protected StringgetDataDrivenEnumId(DataDrivenEnum dataDrivenEnum)protected com.broadleafcommerce.cart.client.domain.ImageAssetRefgetImageAssetForProduct(@NonNull Product product)protected com.broadleafcommerce.cart.client.domain.ImageAssetRefgetImageAssetForVariant(@NonNull Variant variant, @NonNull Product product)protected StringgetPricingKey(Product product, 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 CartOperationServicePropertiesgetProperties()protected voidpopulateAttributeChoiceLabelsFromOptions(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull Product product)protected voidpopulateDependentItemInformation(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull Product product, @NonNull List<Product> products, boolean isAdd)Deprecated.protected voidpopulateDependentItemInformation(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull Product product, @NonNull List<Product> products, boolean isAdd, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)com.broadleafcommerce.cart.client.domain.CartItempopulateProductInformation(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull Product product, List<Product> productList, boolean isAdd, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Populate product information within theCartItembased on the provided product and the merchandising contextcom.broadleafcommerce.cart.client.domain.CartItempopulateProductInformation(com.broadleafcommerce.cart.client.domain.CartItem cartItem, Product product, List<Product> productList, boolean isAdd)Populate product information within theCartItembased on the provided productprotected voidpopulateVariantInformation(@NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull Variant variant, Map<String,com.broadleafcommerce.pricing.client.domain.PriceInfo> skuPriceInfos)
-
-
-
Constructor Detail
-
DefaultCartItemProductService
public DefaultCartItemProductService(CartItemConfigurationService cartItemConfigurationService, List<CartItemProductMapper> cartItemProductMappers, CartOperationServiceProperties properties)
-
-
Method Detail
-
populateProductInformation
public com.broadleafcommerce.cart.client.domain.CartItem populateProductInformation(com.broadleafcommerce.cart.client.domain.CartItem cartItem, Product product, List<Product> productList, boolean isAdd)Description copied from interface:CartItemProductServicePopulate product information within theCartItembased on the provided product- Specified by:
populateProductInformationin interfaceCartItemProductService- Parameters:
cartItem- The CartItem that is to be updated with product dataproduct- The product that this CartItem is intended to representproductList- The products that were retrieved for the add-to-cart, including dependent item productsisAdd- Whether we are in an add-to-cart flow- Returns:
- the updated CartItem that now contains Product data
-
populateProductInformation
public com.broadleafcommerce.cart.client.domain.CartItem populateProductInformation(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull Product product, List<Product> productList, boolean isAdd, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)Description copied from interface:CartItemProductServicePopulate product information within theCartItembased on the provided product and the merchandising context- Specified by:
populateProductInformationin interfaceCartItemProductService- Parameters:
cartItem- The CartItem that is to be updated with product dataproduct- The product that this CartItem is intended to representproductList- The products that were retrieved for the add-to-cart, including dependent item productsisAdd- Whether we are in an add-to-cart flowcontextInfo- Context information around sandbox and multitenant state- Returns:
- the updated CartItem that now contains Product data
-
getDataDrivenEnumId
@Nullable protected String getDataDrivenEnumId(@Nullable DataDrivenEnum dataDrivenEnum)
-
cleanPriceInfo
protected com.broadleafcommerce.pricing.client.domain.PriceInfo cleanPriceInfo(@NonNull @NonNull com.broadleafcommerce.pricing.client.domain.PriceInfo priceInfo)ExcludePriceableTargetinformation from thePriceInfoas 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(Product product, 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_PRODUCTas 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 @NonNull Product product)
-
getImageAssetForVariant
@Nullable protected com.broadleafcommerce.cart.client.domain.ImageAssetRef getImageAssetForVariant(@NonNull @NonNull Variant variant, @NonNull @NonNull Product product)
-
getCategoryIdsForProduct
protected Set<String> getCategoryIdsForProduct(@NonNull @NonNull Product product)
-
populateVariantInformation
protected void populateVariantInformation(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull Variant variant, Map<String,com.broadleafcommerce.pricing.client.domain.PriceInfo> skuPriceInfos)
-
buildItemAttributeChoices
protected Map<String,com.broadleafcommerce.order.common.domain.AttributeChoiceValue> buildItemAttributeChoices(@NonNull @NonNull Map<String,String> requestItemAttributeChoices)
-
populateAttributeChoiceLabelsFromOptions
protected void populateAttributeChoiceLabelsFromOptions(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull Product product)
-
populateDependentItemInformation
@Deprecated protected void populateDependentItemInformation(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull Product product, @NonNull @NonNull List<Product> products, boolean isAdd)
Deprecated.
-
populateDependentItemInformation
protected void populateDependentItemInformation(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull Product product, @NonNull @NonNull List<Product> products, boolean isAdd, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
-
getCartItemConfigurationService
protected CartItemConfigurationService getCartItemConfigurationService()
-
getCartItemProductMappers
protected List<CartItemProductMapper> getCartItemProductMappers()
-
getProperties
protected CartOperationServiceProperties getProperties()
-
-