Class DefaultItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>
java.lang.Object
com.broadleafcommerce.cartoperation.service.DefaultItemListManagementService<L>
- All Implemented Interfaces:
ItemListManagementService<L>
public class DefaultItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>
extends Object
implements ItemListManagementService<L>
Default implementation of an item list management service.
- Author:
- Jacob Mitash
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultItemListManagementService(com.broadleafcommerce.common.extension.TypeFactory typeFactory, ItemListProvider<L> listProvider, ItemListSecurityService<com.broadleafcommerce.cart.client.domain.ItemListAccessRule> securityService, ItemListItemManagementService<com.broadleafcommerce.cart.client.domain.ItemListItem> itemService) -
Method Summary
Modifier and TypeMethodDescriptionchangeItemListAttributes(@NonNull String listId, @NonNull Map<String, Object> attributes, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Changes the attributes of the item list without having to include all of the items in the update request.changeItemListName(@NonNull String listId, @NonNull String replacementName, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Changes the name of the item list without having to include all of the items in the update requestcreateItemList(L itemList, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Creates an item list and handles related security access grants.voiddeleteItemList(@NonNull String listId, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Deletes an item list by ID.deleteItemLists(Set<String> listIds, com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Deletes multiple item lists by IDgetItemListById(@NonNull String listId, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Gets a specific item list by its ID.org.springframework.data.domain.Page<L>getItemListPage(@NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Gets a page of item lists.protected ItemListItemManagementService<com.broadleafcommerce.cart.client.domain.ItemListItem>protected ItemListProvider<L>protected ItemListSecurityService<com.broadleafcommerce.cart.client.domain.ItemListAccessRule>protected com.broadleafcommerce.common.extension.TypeFactoryreplaceItemList(@NonNull String listId, L replaceRequest, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Replaces an item list after checking if operation is allowed on the list.voidshareItemList(@NonNull ShareItemListRequest shareRequest, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Shares an item list with other users.updateItemList(@NonNull String listId, L updateRequest, @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Updates an item list after checking if the operation is allowed on the list.
-
Constructor Details
-
DefaultItemListManagementService
public DefaultItemListManagementService(com.broadleafcommerce.common.extension.TypeFactory typeFactory, ItemListProvider<L> listProvider, ItemListSecurityService<com.broadleafcommerce.cart.client.domain.ItemListAccessRule> securityService, ItemListItemManagementService<com.broadleafcommerce.cart.client.domain.ItemListItem> itemService)
-
-
Method Details
-
getItemListPage
public org.springframework.data.domain.Page<L> getItemListPage(@NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable pageable, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListManagementServiceGets a page of item lists.- Specified by:
getItemListPagein interfaceItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>- Parameters:
customerRef- the reference to the customer of which to get item lists forfilters- additional filters to apply in the query.pageable- the page information being requestedcontext- the context of the request- Returns:
- a page of item lists
-
getItemListById
public L getItemListById(@NonNull @NonNull String listId, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListManagementServiceGets a specific item list by its ID.- Specified by:
getItemListByIdin interfaceItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>- Parameters:
listId- the ID of the item listcustomerRef- the reference to the customer retrieving the listcontext- the context of the request- Returns:
- the item list
-
createItemList
public L createItemList(@NonNull L itemList, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListManagementServiceCreates an item list and handles related security access grants.- Specified by:
createItemListin interfaceItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>- Parameters:
itemList- The item list to createcustomerRef- the reference to the customer to create the item list forcontext- the context of the request- Returns:
- the created item list
-
changeItemListName
public L changeItemListName(@NonNull @NonNull String listId, @NonNull @NonNull String replacementName, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListManagementServiceChanges the name of the item list without having to include all of the items in the update request- Specified by:
changeItemListNamein interfaceItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>- Parameters:
listId- the ID of the item list whose name is being changedreplacementName- the new name for the listcustomerRef- the reference to the customer to create the item list forcontext- the context of the request- Returns:
- the item list with an updated name value
-
changeItemListAttributes
public L changeItemListAttributes(@NonNull @NonNull String listId, @NonNull @NonNull Map<String, Object> attributes, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListManagementServiceChanges the attributes of the item list without having to include all of the items in the update request. Only attributes with keys specified in the request will be updated. To have an attribute removed, map the key to a null value:myKey -> null.- Specified by:
changeItemListAttributesin interfaceItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>- Parameters:
listId- the ID of the item list whose attributes are being addedattributes- the new attributes for the listcustomerRef- the reference to the customer to create the item list forcontext- the context of the request- Returns:
- the item list with an updated name value
-
replaceItemList
public L replaceItemList(@NonNull @NonNull String listId, @NonNull L replaceRequest, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListManagementServiceReplaces an item list after checking if operation is allowed on the list.- Specified by:
replaceItemListin interfaceItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>- Parameters:
listId- the ID of the item list to replacereplaceRequest- the replacement data to apply to the item listcustomerRef- the reference to the customer modifying the listcontext- the context of the request- Returns:
- the replaced version of the item list
-
updateItemList
public L updateItemList(@NonNull @NonNull String listId, @NonNull L updateRequest, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListManagementServiceUpdates an item list after checking if the operation is allowed on the list.- Specified by:
updateItemListin interfaceItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>- Parameters:
listId- the ID of the item list to replaceupdateRequest- the update data to apply to the item listcustomerRef- the reference to the customer modifying the listcontext- the context of the request- Returns:
- the updated version of the item list
-
deleteItemList
public void deleteItemList(@NonNull @NonNull String listId, @NonNull @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListManagementServiceDeletes an item list by ID.- Specified by:
deleteItemListin interfaceItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>- Parameters:
listId- the ID of the item list to deletecustomerRef- the reference to the customer deleting the listcontext- the context of the request
-
deleteItemLists
public DeleteItemListResponse deleteItemLists(Set<String> listIds, com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ItemListManagementServiceDeletes multiple item lists by ID- Specified by:
deleteItemListsin interfaceItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>- Parameters:
listIds- the list IDs of the item lists to deletecustomerRef- the reference to the customer deleting the listcontext- the context of the request- Returns:
- a response indicating which deletions were successful
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getListProvider
-
getSecurityService
protected ItemListSecurityService<com.broadleafcommerce.cart.client.domain.ItemListAccessRule> getSecurityService() -
getItemService
protected ItemListItemManagementService<com.broadleafcommerce.cart.client.domain.ItemListItem> getItemService()
-