Class DefaultItemListAddToCartService
- java.lang.Object
-
- com.broadleafcommerce.cartoperation.service.DefaultItemListAddToCartService
-
- All Implemented Interfaces:
ItemListAddToCartService
public class DefaultItemListAddToCartService extends Object implements ItemListAddToCartService
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringITEM_LIST_ITEM_ID
-
Constructor Summary
Constructors Constructor Description 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 Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected ItemListAddToCartResponseaddAccessibleItemListsToCart(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 ofItemListids, add the lists's items to the cart.protected ItemListAddToCartResponseaddAccessibleItemListToCart(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.ItemListAddToCartResponseaddItemListsToCart(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 allItemListItemsto the cart from theItemListsidentified by the provided itemListIdsItemListAddToCartResponseaddItemListToCart(@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 allItemListItemsto the cart from theItemListidentified by the provided itemListIdprotected BulkAddToCartResponseaddItemsToCart(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 CartOperationServicegetCartOpService()protected CartPricingServicegetCartPricingService()Deprecated.since 1.6, usegetCartOpService()insteadprotected List<String>getFailedItemAdditions(List<AddItemFailure> addItemFailures)Identifies theItemListItemids related to the failedAddItemRequests.protected ItemListItemManagementService<com.broadleafcommerce.cart.client.domain.ItemListItem>getItemService()protected ItemListAddToCartPropertiesgetProperties()protected ItemListSecurityService<com.broadleafcommerce.cart.client.domain.ItemListAccessRule>getSecurityService()protected com.broadleafcommerce.common.extension.TypeFactorygetTypeFactory()
-
-
-
Field Detail
-
ITEM_LIST_ITEM_ID
protected static final String ITEM_LIST_ITEM_ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
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:ItemListAddToCartServiceAdds allItemListItemsto the cart from theItemListidentified by the provided itemListId- Specified by:
addItemListToCartin 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:ItemListAddToCartServiceAdds allItemListItemsto the cart from theItemListsidentified by the provided itemListIds- Specified by:
addItemListsToCartin 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 ofItemListids, 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 ofItemListids 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 theItemListthat 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
protected List<String> getFailedItemAdditions(List<AddItemFailure> addItemFailures)
Identifies theItemListItemids 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
protected CartOperationService getCartOpService()
-
getCartPricingService
@Deprecated protected CartPricingService getCartPricingService()
Deprecated.since 1.6, usegetCartOpService()instead
-
getProperties
protected ItemListAddToCartProperties getProperties()
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-
-