public class DefaultItemListItemManagementService<I extends com.broadleafcommerce.cart.client.domain.ItemListItem> extends Object implements ItemListItemManagementService<I>
Modifier and Type | Field and Description |
---|---|
protected static String |
ATTR_MERGE_UPDATED
Attribute key for a boolean value that indicates that an item was updated as a result of a
merge instead of the typical addition/create.
|
Constructor and Description |
---|
DefaultItemListItemManagementService(ItemListProvider<com.broadleafcommerce.cart.client.domain.ItemList> itemListProvider,
ItemListItemProvider<I> itemProvider,
ItemListSecurityService<com.broadleafcommerce.cart.client.domain.ItemListAccessRule> securityService,
com.broadleafcommerce.common.extension.TypeFactory typeFactory,
ItemListItemMergingService<I> mergingService) |
Modifier and Type | Method and Description |
---|---|
List<I> |
createItemListItems(@NonNull String listId,
@NonNull Collection<I> createRequests,
@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Creates item list items.
|
void |
deleteItemListItems(@NonNull String listId,
@NonNull Collection<String> itemIds,
@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Deletes item list items from a list.
|
org.springframework.data.domain.Page<I> |
getItemListItemPage(@NonNull String listId,
@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
org.springframework.data.domain.Pageable pageable,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Gets a page of item list items.
|
List<I> |
getItemListItems(@NonNull String listId,
@NonNull Collection<String> itemIds,
@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Gets specific item list items by their IDs.
|
protected ItemListProvider<com.broadleafcommerce.cart.client.domain.ItemList> |
getItemListProvider() |
protected ItemListItemProvider<I> |
getItemProvider() |
protected ItemListItemMergingService<I> |
getMergingService() |
protected ItemListSecurityService<com.broadleafcommerce.cart.client.domain.ItemListAccessRule> |
getSecurityService() |
protected com.broadleafcommerce.common.extension.TypeFactory |
getTypeFactory() |
protected List<I> |
handleAddMerge(@NonNull String itemListId,
@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
@NonNull List<I> addedItems,
@NonNull List<MergeItemPair<I>> mergePairs,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Handles adding and merging items into an itemlist.
|
protected List<I> |
handleZeroQuantityItems(@NonNull Stream<I> items,
@NonNull String listId,
@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Handles item updates with a quantity of zero by deleting the items and filtering them from
the results.
|
protected boolean |
hasZeroQuantity(I item)
Tells if the given item has a zero quantity.
|
List<I> |
replaceItemListItems(@NonNull String listId,
@NonNull Collection<I> updateRequests,
@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Replaces item list items.
|
List<I> |
updateItemListItems(@NonNull String listId,
@NonNull Collection<I> updateRequests,
@NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef,
com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
Updates item list items.
|
protected static final String ATTR_MERGE_UPDATED
public DefaultItemListItemManagementService(ItemListProvider<com.broadleafcommerce.cart.client.domain.ItemList> itemListProvider, ItemListItemProvider<I> itemProvider, ItemListSecurityService<com.broadleafcommerce.cart.client.domain.ItemListAccessRule> securityService, com.broadleafcommerce.common.extension.TypeFactory typeFactory, ItemListItemMergingService<I> mergingService)
public org.springframework.data.domain.Page<I> getItemListItemPage(@NonNull @NonNull String listId, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @Nullable org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListItemManagementService
getItemListItemPage
in interface ItemListItemManagementService<I extends com.broadleafcommerce.cart.client.domain.ItemListItem>
listId
- the ID of the item list to fetch items fromcustomerRef
- Information about the owning customerpageable
- the page informationcontext
- the context of the requestpublic List<I> getItemListItems(@NonNull @NonNull String listId, @NonNull @NonNull Collection<String> itemIds, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListItemManagementService
getItemListItems
in interface ItemListItemManagementService<I extends com.broadleafcommerce.cart.client.domain.ItemListItem>
listId
- the ID of the item list to fetch items fromitemIds
- the IDs of the items to findcustomerRef
- Information about the owning customercontext
- the context of the requestpublic List<I> createItemListItems(@NonNull @NonNull String listId, @NonNull @NonNull Collection<I> createRequests, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListItemManagementService
createItemListItems
in interface ItemListItemManagementService<I extends com.broadleafcommerce.cart.client.domain.ItemListItem>
listId
- the ID of the item list to create the items forcreateRequests
- the item creation requestscustomerRef
- Information about the owning customercontext
- the context of the requestpublic List<I> replaceItemListItems(@NonNull @NonNull String listId, @NonNull @NonNull Collection<I> updateRequests, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListItemManagementService
replaceItemListItems
in interface ItemListItemManagementService<I extends com.broadleafcommerce.cart.client.domain.ItemListItem>
listId
- the ID of the item list to replace items inupdateRequests
- the item update requestscustomerRef
- Information about the owning customercontext
- the context of the requestpublic List<I> updateItemListItems(@NonNull @NonNull String listId, @NonNull @NonNull Collection<I> updateRequests, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListItemManagementService
updateItemListItems
in interface ItemListItemManagementService<I extends com.broadleafcommerce.cart.client.domain.ItemListItem>
listId
- the ID of the item list to update items inupdateRequests
- the item update requestscontext
- the context of the requestpublic void deleteItemListItems(@NonNull @NonNull String listId, @NonNull @NonNull Collection<String> itemIds, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
ItemListItemManagementService
deleteItemListItems
in interface ItemListItemManagementService<I extends com.broadleafcommerce.cart.client.domain.ItemListItem>
listId
- the ID of the list to delete fromitemIds
- the IDs of the items to deletecustomerRef
- Information about the owning customercontext
- the context of the requestprotected List<I> handleZeroQuantityItems(@NonNull @NonNull Stream<I> items, @NonNull @NonNull String listId, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
items
- the stream of items to handle (can include items of any quantity)listId
- the ID of the list the items belong tocustomerRef
- the reference to the customer performing the update operationcontext
- the context of the requestprotected boolean hasZeroQuantity(@NonNull I item)
item
- the item to testprotected List<I> handleAddMerge(@NonNull @NonNull String itemListId, @NonNull @NonNull com.broadleafcommerce.cart.client.domain.CustomerRef customerRef, @NonNull @NonNull List<I> addedItems, @NonNull @NonNull List<MergeItemPair<I>> mergePairs, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
itemListId
- the id of the itemlist to add tocustomerRef
- the customerRef the itemlist belongs toaddedItems
- the items to add to the itemlistmergePairs
- the items to merge into the itemlistcontext
- the context of the requestprotected ItemListProvider<com.broadleafcommerce.cart.client.domain.ItemList> getItemListProvider()
protected ItemListItemProvider<I> getItemProvider()
protected ItemListSecurityService<com.broadleafcommerce.cart.client.domain.ItemListAccessRule> getSecurityService()
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
protected ItemListItemMergingService<I> getMergingService()
Copyright © 2021. All rights reserved.