Class DefaultItemListAddToCartService
java.lang.Object
com.broadleafcommerce.cartoperation.service.DefaultItemListAddToCartService
- All Implemented Interfaces:
ItemListAddToCartService
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefaultItemListAddToCartService
(ItemListSecurityService<com.broadleafcommerce.cart.client.domain.ItemListAccessRule> securityService, ItemListItemManagementService<com.broadleafcommerce.cart.client.domain.ItemListItem> itemService, CartOperationService cartOpService, ItemListAddToCartProperties properties, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected ItemListAddToCartResponse
addAccessibleItemListsToCart
(com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, Set<String> itemListIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) After verifying the user's access to the set ofItemList
ids, add the lists's items to the cart.protected ItemListAddToCartResponse
addAccessibleItemListToCart
(com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, String itemListId, boolean shouldPriceCart, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) After verifying the user's access to theItemList
, add the list's items to the cart.addItemListsToCart
(com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, Set<String> itemListIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Adds allItemListItems
to the cart from theItemLists
identified by the provided itemListIdsaddItemListToCart
(@NonNull com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, String itemListId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Adds allItemListItems
to the cart from theItemList
identified by the provided itemListIdprotected BulkAddToCartResponse
addItemsToCart
(com.broadleafcommerce.cart.client.domain.Cart cart, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, org.springframework.data.domain.Page<com.broadleafcommerce.cart.client.domain.ItemListItem> itemPage, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Responsible for adding the provided ItemListItem page to the cartprotected List<AddItemRequest>
buildAddItemRequests
(org.springframework.data.domain.Page<com.broadleafcommerce.cart.client.domain.ItemListItem> itemPage, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Responsible for creating AddItemRequests based on the provided ItemListItem pageprotected CartOperationService
protected CartPricingService
Deprecated.getFailedItemAdditions
(List<AddItemFailure> addItemFailures) Identifies theItemListItem
ids related to the failedAddItemRequests
.protected ItemListItemManagementService<com.broadleafcommerce.cart.client.domain.ItemListItem>
protected ItemListAddToCartProperties
protected ItemListSecurityService<com.broadleafcommerce.cart.client.domain.ItemListAccessRule>
protected com.broadleafcommerce.common.extension.TypeFactory
-
Field Details
-
ITEM_LIST_ITEM_ID
- See Also:
-
-
Constructor Details
-
DefaultItemListAddToCartService
public DefaultItemListAddToCartService(ItemListSecurityService<com.broadleafcommerce.cart.client.domain.ItemListAccessRule> securityService, ItemListItemManagementService<com.broadleafcommerce.cart.client.domain.ItemListItem> itemService, CartOperationService cartOpService, ItemListAddToCartProperties properties, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
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 allItemListItems
to the cart from theItemList
identified by the provided itemListId- Specified by:
addItemListToCart
in interfaceItemListAddToCartService
- Parameters:
cart
- The cart that is to be added tocustomerRef
- The current customer & owner of the cartitemListId
- The id of the ItemList that is to be added to cartcontextInfo
- 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 allItemListItems
to the cart from theItemLists
identified by the provided itemListIds- Specified by:
addItemListsToCart
in interfaceItemListAddToCartService
- Parameters:
cart
- The cart that is to be added tocustomerRef
- The current customer & owner of the cartitemListIds
- The ids of the ItemLists that are to be added to cartcontextInfo
- 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 ofItemList
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 tocustomerRef
- The cart's owning useritemListIds
- List ofItemList
ids that should be added to the cartcontextInfo
- 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 theItemList
, add the list's items to the cart.- Parameters:
cart
- The cart that is being added tocustomerRef
- The cart's owning useritemListId
- Id of theItemList
that should be added to the cartcontextInfo
- 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 tocustomerRef
- The cart's owning useritemPage
- Page of ItemListItems that are to be added to cartcontextInfo
- 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 cartcontextInfo
- The context of the user's request- Returns:
- A list of AddItemRequests based on the provided ItemListItem page
-
getFailedItemAdditions
Identifies theItemListItem
ids related to the failedAddItemRequests
.- 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
-
getCartPricingService
Deprecated.since 1.6, usegetCartOpService()
instead -
getProperties
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-
getCartOpService()
instead