Class DefaultItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>

  • 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      L changeItemListAttributes​(@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.
      L 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 request
      L createItemList​(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.
      void deleteItemList​(@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.
      DeleteItemListResponse deleteItemLists​(Set<String> listIds, com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Deletes multiple item lists by ID
      L getItemListById​(@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> getItemService()  
      protected ItemListProvider<L> getListProvider()  
      protected ItemListSecurityService<com.broadleafcommerce.cart.client.domain.ItemListAccessRule> getSecurityService()  
      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()  
      L replaceItemList​(@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.
      void shareItemList​(@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.
      L 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 Detail

      • 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 Detail

      • 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: ItemListManagementService
        Gets a page of item lists.
        Specified by:
        getItemListPage in interface ItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>
        Parameters:
        customerRef - the reference to the customer of which to get item lists for
        filters - additional filters to apply in the query.
        pageable - the page information being requested
        context - 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: ItemListManagementService
        Gets a specific item list by its ID.
        Specified by:
        getItemListById in interface ItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>
        Parameters:
        listId - the ID of the item list
        customerRef - the reference to the customer retrieving the list
        context - 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: ItemListManagementService
        Creates an item list and handles related security access grants.
        Specified by:
        createItemList in interface ItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>
        Parameters:
        itemList - The item list to create
        customerRef - the reference to the customer to create the item list for
        context - 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: ItemListManagementService
        Changes the name of the item list without having to include all of the items in the update request
        Specified by:
        changeItemListName in interface ItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>
        Parameters:
        listId - the ID of the item list whose name is being changed
        replacementName - the new name for the list
        customerRef - the reference to the customer to create the item list for
        context - 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: ItemListManagementService
        Changes 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:
        changeItemListAttributes in interface ItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>
        Parameters:
        listId - the ID of the item list whose attributes are being added
        attributes - the new attributes for the list
        customerRef - the reference to the customer to create the item list for
        context - 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: ItemListManagementService
        Replaces an item list after checking if operation is allowed on the list.
        Specified by:
        replaceItemList in interface ItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>
        Parameters:
        listId - the ID of the item list to replace
        replaceRequest - the replacement data to apply to the item list
        customerRef - the reference to the customer modifying the list
        context - 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: ItemListManagementService
        Updates an item list after checking if the operation is allowed on the list.
        Specified by:
        updateItemList in interface ItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>
        Parameters:
        listId - the ID of the item list to replace
        updateRequest - the update data to apply to the item list
        customerRef - the reference to the customer modifying the list
        context - 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: ItemListManagementService
        Deletes an item list by ID.
        Specified by:
        deleteItemList in interface ItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>
        Parameters:
        listId - the ID of the item list to delete
        customerRef - the reference to the customer deleting the list
        context - 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: ItemListManagementService
        Deletes multiple item lists by ID
        Specified by:
        deleteItemLists in interface ItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>
        Parameters:
        listIds - the list IDs of the item lists to delete
        customerRef - the reference to the customer deleting the list
        context - the context of the request
        Returns:
        a response indicating which deletions were successful
      • shareItemList

        public void shareItemList​(@NonNull
                                  @NonNull ShareItemListRequest shareRequest,
                                  @NonNull
                                  @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef,
                                  @Nullable
                                  com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Description copied from interface: ItemListManagementService
        Shares an item list with other users.
        Specified by:
        shareItemList in interface ItemListManagementService<L extends com.broadleafcommerce.cart.client.domain.ItemList>
        Parameters:
        shareRequest - the request body describing who and how to share the list with
        customerRef - the reference to the customer who initiated the sharing request
        context - the context of the request
      • getTypeFactory

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

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