Class DefaultItemListAddToCartService

java.lang.Object
com.broadleafcommerce.cartoperation.service.DefaultItemListAddToCartService
All Implemented Interfaces:
ItemListAddToCartService

public class DefaultItemListAddToCartService extends Object implements ItemListAddToCartService
  • Field Details

  • Constructor Details

  • Method Details

    • addItemListToCart

      public ItemListAddToCartResponse addItemListToCart(@NonNull @NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, String itemListId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: ItemListAddToCartService
      Adds all ItemListItems to the cart from the ItemList identified by the provided itemListId
      Specified by:
      addItemListToCart in interface ItemListAddToCartService
      Parameters:
      cart - The cart that is to be added to
      customerRef - The current customer & owner of the cart
      itemListId - The id of the ItemList that is to be added to cart
      contextInfo - The context of the current request
      Returns:
      A DTO representing the updated cart & any individual add to cart failures
    • addItemListsToCart

      public ItemListAddToCartResponse addItemListsToCart(@Nullable com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, Set<String> itemListIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: ItemListAddToCartService
      Adds all ItemListItems to the cart from the ItemLists identified by the provided itemListIds
      Specified by:
      addItemListsToCart in interface ItemListAddToCartService
      Parameters:
      cart - The cart that is to be added to
      customerRef - The current customer & owner of the cart
      itemListIds - The ids of the ItemLists that are to be added to cart
      contextInfo - The context of the current request
      Returns:
      A DTO representing the updated cart & any individual add to cart failures
    • addAccessibleItemListsToCart

      protected ItemListAddToCartResponse addAccessibleItemListsToCart(@Nullable com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, Set<String> itemListIds, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      After verifying the user's access to the set of ItemList ids, add the lists's items to the cart. Note: We intentionally avoid pricing the cart until after all of the items have been added to cart
      Parameters:
      cart - The cart that is being added to
      customerRef - The cart's owning user
      itemListIds - List of ItemList ids that should be added to the cart
      contextInfo - The context of the user's request
      Returns:
      an object containing the updated cart & any identified issues while adding the lists to the cart
    • addAccessibleItemListToCart

      protected ItemListAddToCartResponse addAccessibleItemListToCart(@Nullable com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, String itemListId, boolean shouldPriceCart, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      After verifying the user's access to the ItemList, add the list's items to the cart.
      Parameters:
      cart - The cart that is being added to
      customerRef - The cart's owning user
      itemListId - Id of the ItemList that should be added to the cart
      contextInfo - The context of the user's request
      Returns:
      an object containing the updated cart & any identified issues while adding the list to the cart
    • addItemsToCart

      protected BulkAddToCartResponse addItemsToCart(@Nullable com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, org.springframework.data.domain.Page<com.broadleafcommerce.cart.client.domain.ItemListItem> itemPage, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Responsible for adding the provided ItemListItem page to the cart
      Parameters:
      cart - The cart that is being added to
      customerRef - The cart's owning user
      itemPage - Page of ItemListItems that are to be added to cart
      contextInfo - The context of the user's request
      Returns:
      an object containing the updated cart & any add to cart failures
    • buildAddItemRequests

      protected List<AddItemRequest> buildAddItemRequests(org.springframework.data.domain.Page<com.broadleafcommerce.cart.client.domain.ItemListItem> itemPage, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Responsible for creating AddItemRequests based on the provided ItemListItem page
      Parameters:
      itemPage - Page of ItemListItems that are to be added to cart
      contextInfo - The context of the user's request
      Returns:
      A list of AddItemRequests based on the provided ItemListItem page
    • getFailedItemAdditions

      protected List<String> getFailedItemAdditions(List<AddItemFailure> addItemFailures)
      Identifies the ItemListItem ids related to the failed AddItemRequests.
      Parameters:
      addItemFailures - The list of items that failed add to cart
      Returns:
      the list of ItemListItem ids that could not be added to cart
    • getSecurityService

      protected ItemListSecurityService<com.broadleafcommerce.cart.client.domain.ItemListAccessRule> getSecurityService()
    • getItemService

      protected ItemListItemManagementService<com.broadleafcommerce.cart.client.domain.ItemListItem> getItemService()
    • getCartOpService

      protected CartOperationService getCartOpService()
    • getCartPricingService

      @Deprecated protected CartPricingService getCartPricingService()
      Deprecated.
      since 1.6, use getCartOpService() instead
    • getProperties

      protected ItemListAddToCartProperties getProperties()
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()