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>
Maps Product and Variant information into the CartItem.
  • Constructor Details

  • 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 the CartItem based on the provided CatalogItem and the merchandising context
      Specified by:
      populateCatalogItemInformation in interface CartItemCatalogInformationService<P extends Product>
      Parameters:
      cartItem - The CartItem that is to be updated with catalog item data
      catalogItemList - The catalog items that were retrieved for the add-to-cart, including dependent catalog items
      isAdd - Whether we are in an add-to-cart flow
      contextInfo - 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 the CartItem based on the provided CatalogItem and the merchandising context
      Specified by:
      populateCatalogItemInformation in interface CartItemCatalogInformationService<P extends Product>
      Parameters:
      cartItem - The CartItem that is to be updated with catalog item data
      product - The CatalogItem that this CartItem is intended to represent
      catalogItemList - The catalog items that were retrieved for the add-to-cart, including dependent catalog items
      isAdd - Whether we are in an add-to-cart flow
      contextInfo - 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

      @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)
      Exclude PriceableTarget information from the PriceInfo 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 the DefaultProductType.MERCHANDISING_PRODUCT as it doesn't have the SKU and pricing key.
      Parameters:
      product - the product to get the pricing key from
      cartItem - 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

      @Nullable protected com.broadleafcommerce.cart.client.domain.ImageAssetRef getImageAssetForVariant(@NonNull @NonNull Variant variant, @NonNull P product)
    • getCategoryIdsForProduct

      protected Set<String> getCategoryIdsForProduct(@NonNull P product)
    • populateVariantInformation

      protected void populateVariantInformation(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull @NonNull Variant variant, @NonNull @NonNull 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 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

      protected void populateDependentItemInformation(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.CartItem cartItem, @NonNull P product, @NonNull @NonNull List<P> products, boolean isAdd, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • 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)
      Populate IncludedProduct information on CartItem.getDependentCartItems() based on the product configuration.
      Parameters:
      cartItem - The cart item on which to populate dependent item product configuration information.
      potentialDependentItems - The list of CartItem.getDependentCartItems() to pick from to find a match for an IncludedProduct.
      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)
      Populate ItemChoice information on CartItem.getDependentCartItems() based on the product configuration.
      Parameters:
      cartItem - The cart item on which to populate dependent item product configuration information.
      potentialDependentItems - The list of CartItem.getDependentCartItems() to pick from to find a match for an ItemChoice.
      product - The product with configuration to be used for hydration.
    • getCartItemConfigurationService

      protected CartItemConfigurationService<Product> getCartItemConfigurationService()
    • getCartItemProductMappers

      protected List<CartItemProductMapper> getCartItemProductMappers()
    • getProperties

      protected CartOperationServiceProperties getProperties()
    • getBroadleafProductService

      protected BroadleafProductService<Product> getBroadleafProductService()
    • setBroadleafProductService

      @Autowired public void setBroadleafProductService(BroadleafProductService<Product> broadleafProductService)
    • getIncludedProductService

      protected IncludedProductConfigurationService getIncludedProductService()
    • setIncludedProductService

      @Autowired public void setIncludedProductService(IncludedProductConfigurationService includedProductService)
    • getItemChoiceService

      protected ItemChoiceConfigurationService getItemChoiceService()
    • setItemChoiceService

      @Autowired public void setItemChoiceService(ItemChoiceConfigurationService itemChoiceService)
    • getCartItemProductServiceProperties

      protected CartItemProductServiceProperties getCartItemProductServiceProperties()
    • setCartItemProductServiceProperties

      @Autowired public void setCartItemProductServiceProperties(CartItemProductServiceProperties cartItemProductServiceProperties)