Interface ItemListAccessRuleService<P extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule>

  • All Superinterfaces:
    com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>
    All Known Implementing Classes:
    DefaultItemListAccessRuleService

    public interface ItemListAccessRuleService<P extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule>
    extends com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>
    Service for managing item list access rules.
    Author:
    Jacob Mitash
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void deleteAllByListIds​(Collection<String> listIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Deletes all access rules that belong to multiple item lists
      com.broadleafcommerce.cart.client.domain.ItemListAccessResponse filterItemListIdsByRoles​(@NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef, @NonNull Set<String> roles, @NonNull Set<String> listIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Filters item list IDs based on whether the customer has a specified role for them or not.
      org.springframework.data.domain.Page<P> findAllByCustomer​(com.broadleafcommerce.order.common.domain.CustomerRef customerRef, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Find all access rules for a specific customer.
      org.springframework.data.domain.Page<P> findAllByItemListId​(String itemListId, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Finds all access rules for a specific item list.
      P findByItemListIdAndCustomer​(String itemListId, com.broadleafcommerce.order.common.domain.CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Finds an access rule for a given list and customer.
      • Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService

        create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort
    • Method Detail

      • findAllByCustomer

        org.springframework.data.domain.Page<P> findAllByCustomer​(com.broadleafcommerce.order.common.domain.CustomerRef customerRef,
                                                                  org.springframework.data.domain.Pageable pageable,
                                                                  @Nullable
                                                                  com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Find all access rules for a specific customer.
        Parameters:
        customerRef - a reference to the customer to find rules for
        pageable - the requested paged of access rules
        context - the context of the request
        Returns:
        a page of access rules
      • findByItemListIdAndCustomer

        P findByItemListIdAndCustomer​(String itemListId,
                                      com.broadleafcommerce.order.common.domain.CustomerRef customerRef,
                                      @Nullable
                                      com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Finds an access rule for a given list and customer.
        Parameters:
        itemListId - the ID of the item list to find access rules for
        customerRef - a reference to the customer to find rules for
        context - the context of the request
        Returns:
        the access rule for the given list and customer
        Throws:
        com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - when no relevant access rule could be found
      • filterItemListIdsByRoles

        com.broadleafcommerce.cart.client.domain.ItemListAccessResponse filterItemListIdsByRoles​(@NonNull
                                                                                                 @NonNull com.broadleafcommerce.order.common.domain.CustomerRef customerRef,
                                                                                                 @NonNull
                                                                                                 @NonNull Set<String> roles,
                                                                                                 @NonNull
                                                                                                 @NonNull Set<String> listIds,
                                                                                                 @Nullable
                                                                                                 com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Filters item list IDs based on whether the customer has a specified role for them or not.
        Parameters:
        customerRef - a reference to the customer to find rules for
        roles - the roles to check access for
        listIds - list of list item ids to check
        context - the context of the request
        Returns:
        a access response with accessible and inaccessible list item ids for the request
      • findAllByItemListId

        org.springframework.data.domain.Page<P> findAllByItemListId​(String itemListId,
                                                                    org.springframework.data.domain.Pageable pageable,
                                                                    @Nullable
                                                                    com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Finds all access rules for a specific item list.
        Parameters:
        itemListId - the ID of the item list to find access rules for
        pageable - the requested paged of access rules
        context - the context of the request
        Returns:
        a page of access rules for the given item list
      • deleteAllByListIds

        void deleteAllByListIds​(Collection<String> listIds,
                                @Nullable
                                com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Deletes all access rules that belong to multiple item lists
        Parameters:
        listIds - list of item list ids
        context - the request context information