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

  • All Known Implementing Classes:
    ExternalItemListAccessRuleProvider

    public interface ItemListAccessRuleProvider<P extends com.broadleafcommerce.cart.client.domain.ItemListAccessRule>
    A provider of item list access rules.
    Author:
    Jacob Mitash
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      P createItemListAccessRule​(P rule, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Create an item list access rule.
      List<P> createItemListAccessRules​(String itemListId, List<P> rules, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Creates item list access rules.
      void deleteItemListAccessRule​(String itemListId, String ruleId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Deletes an item list access rule by ID.
      void deleteItemListAccessRules​(String itemListId, Set<String> ruleIds, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Deletes item list access rules by IDs.
      Optional<P> getItemListAccessRuleForCustomerAndItemList​(com.broadleafcommerce.order.common.domain.CustomerRef customerRef, String itemListId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Get an item list access rule for a customer for specific list.
      org.springframework.data.domain.Page<P> getItemListAccessRulesForCustomer​(com.broadleafcommerce.order.common.domain.CustomerRef customerRef, org.springframework.data.domain.Pageable pageable, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Get item list access rules by customer.
      P replaceItemListAccessRule​(String itemListId, P rule, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Replaces an item list access rule.
      P updateItemListAccessRule​(String itemListId, P rule, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Updates an item list access rule.
      com.broadleafcommerce.cart.client.domain.ItemListAccessResponse validateCustomerAccess​(com.broadleafcommerce.order.common.domain.CustomerRef customerRef, Set<String> itemListIds, Set<String> roles, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Checks item list access rules for a list of item list ids based on the given customer ref and role
    • Method Detail

      • getItemListAccessRulesForCustomer

        org.springframework.data.domain.Page<P> getItemListAccessRulesForCustomer​(com.broadleafcommerce.order.common.domain.CustomerRef customerRef,
                                                                                  @Nullable
                                                                                  org.springframework.data.domain.Pageable pageable,
                                                                                  @Nullable
                                                                                  com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Get item list access rules by customer.
        Parameters:
        customerRef - the reference to the customer for which to find rules for
        pageable - the requested page of access rules
        context - the context of the request
        Returns:
        a page of item list access rules
      • validateCustomerAccess

        com.broadleafcommerce.cart.client.domain.ItemListAccessResponse validateCustomerAccess​(com.broadleafcommerce.order.common.domain.CustomerRef customerRef,
                                                                                               Set<String> itemListIds,
                                                                                               Set<String> roles,
                                                                                               @Nullable
                                                                                               com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Checks item list access rules for a list of item list ids based on the given customer ref and role
        Parameters:
        customerRef - the customer to check access for
        itemListIds - the list of item list ids to check
        roles - the access roles we want to verify
        context - the context of the request
        Returns:
        two lists, accessible and inaccessible item list ids
      • getItemListAccessRuleForCustomerAndItemList

        Optional<P> getItemListAccessRuleForCustomerAndItemList​(com.broadleafcommerce.order.common.domain.CustomerRef customerRef,
                                                                String itemListId,
                                                                @Nullable
                                                                com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Get an item list access rule for a customer for specific list.
        Parameters:
        customerRef - the reference to the customer for which to find the rule for
        itemListId - the ID of the item list to find the rule for
        context - the context of the request
        Returns:
        the item list access rule for the customer and list, or null if none was found
      • createItemListAccessRule

        P createItemListAccessRule​(P rule,
                                   @Nullable
                                   com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Create an item list access rule.
        Parameters:
        rule - the rule to create (must contain item list ID)
        context - the context of the request
        Returns:
        the created access rule
      • createItemListAccessRules

        List<P> createItemListAccessRules​(String itemListId,
                                          List<P> rules,
                                          @Nullable
                                          com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Creates item list access rules.
        Parameters:
        itemListId - the item list ID
        rules - the rules to create (must belong to the same item list)
        context - the context of the request
        Returns:
        the created access rules
      • updateItemListAccessRule

        P updateItemListAccessRule​(String itemListId,
                                   P rule,
                                   @Nullable
                                   com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Updates an item list access rule.
        Parameters:
        itemListId - the item list ID
        rule - the rule to update with (must include ID)
        context - the context of the request
        Returns:
        the updated item list access rule
      • replaceItemListAccessRule

        P replaceItemListAccessRule​(String itemListId,
                                    P rule,
                                    @Nullable
                                    com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Replaces an item list access rule.
        Parameters:
        itemListId - the item list ID
        rule - the rule to replace with (must include ID)
        context - the context of the request
        Returns:
        the replaced item list access rule
      • deleteItemListAccessRule

        void deleteItemListAccessRule​(String itemListId,
                                      String ruleId,
                                      @Nullable
                                      com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Deletes an item list access rule by ID.
        Parameters:
        itemListId - the ID of the item list to delete from
        ruleId - the ID of the access rule
        context - the context of the request
      • deleteItemListAccessRules

        void deleteItemListAccessRules​(String itemListId,
                                       Set<String> ruleIds,
                                       @Nullable
                                       com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
        Deletes item list access rules by IDs.
        Parameters:
        itemListId - the ID of the item list to delete from
        ruleIds - the IDs of the rules to delete
        context - the context of the request