Class CatalogContextRequestHydrator

java.lang.Object
com.broadleafcommerce.data.tracking.core.web.DefaultContextRequestHydrator
com.broadleafcommerce.catalog.web.context.CatalogContextRequestHydrator
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator, org.springframework.core.Ordered

public class CatalogContextRequestHydrator extends com.broadleafcommerce.data.tracking.core.web.DefaultContextRequestHydrator
Author:
Susana Cruz (susanaccruz)
  • Constructor Details

    • CatalogContextRequestHydrator

      public CatalogContextRequestHydrator(com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationService ruleEvaluationService, CatalogAccessPolicyService<CatalogAccessPolicy> catalogAccessPolicyService, CatalogAccessPolicyUtils catalogAccessPolicyUtils, com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils)
  • Method Details

    • hydrate

      public com.broadleafcommerce.data.tracking.core.context.ContextRequest hydrate(com.broadleafcommerce.data.tracking.core.context.ContextRequest dehydrated)
      Specified by:
      hydrate in interface com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator
      Overrides:
      hydrate in class com.broadleafcommerce.data.tracking.core.web.DefaultContextRequestHydrator
    • readCatalogTargetingAccessPolicies

      protected List<CatalogAccessPolicy> readCatalogTargetingAccessPolicies(com.broadleafcommerce.data.tracking.core.context.ContextRequest dehydrated)
    • updateCatalog

      protected <D extends CatalogAccessPolicy> void updateCatalog(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest, @NonNull @NonNull Collection<D> catalogAccessPolicies, @NonNull @NonNull Set<D> policiesMatchingContext)
      Evaluates the match rules of CatalogAccessPolicies targeting the application's Application.getIsolatedCatalogs() against the current CatalogAccessPolicyContext.
      Parameters:
      contextRequest - the context request to modify
      catalogAccessPolicies - the list of all catalog access policies
    • updateApplicationCatalogs

      protected void updateApplicationCatalogs(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest, @NonNull @NonNull Collection<? extends CatalogAccessPolicy> catalogAccessPolicies, @NonNull @NonNull Map<String,String> catalogIdsToImplicitIds, @NonNull @NonNull Set<? extends CatalogAccessPolicy> policiesMatchingContext)
      Removes inheritance lines and isolated catalogs from the resolved application if they are not visible due to a CatalogAccessPolicy that targets them not matching the request context.
      Parameters:
      contextRequest - the context request to modify
      catalogAccessPolicies - the list of all catalog access policies
      catalogIdsToImplicitIds - the map of catalog ids to implicit ids used in the catalog ref
    • filterInheritanceLines

      protected void filterInheritanceLines(com.broadleafcommerce.data.tracking.core.tenant.domain.Application application, Collection<String> allRestrictedCatalogImplicitIds, Collection<String> visibleRestrictedCatalogImplicitIds)
    • filterIsolatedCatalogs

      protected void filterIsolatedCatalogs(com.broadleafcommerce.data.tracking.core.tenant.domain.Application application, Collection<String> allRestrictedCatalogImplicitIds, Collection<String> visibleRestrictedCatalogImplicitIds)
    • removeRestrictedCatalogsIfCatalogIdUnspecified

      protected void removeRestrictedCatalogsIfCatalogIdUnspecified(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest, @NonNull @NonNull List<CatalogAccessPolicy> catalogAccessPolicies, @NonNull @NonNull Map<String,String> catalogIdsToImplicitIds)
      * Removes by default all Application.getInheritanceLines() from a context request application when targeted by a CatalogAccessPolicy. This method should only be called when the user is in admin context.
      Parameters:
      contextRequest - the context request to modify
      catalogAccessPolicies - the list of all catalog access policies
    • getImplicitCatalogIdsForRestrictedCatalogs

      protected List<String> getImplicitCatalogIdsForRestrictedCatalogs(Collection<? extends CatalogAccessPolicy> catalogAccessPolicies, Map<String,String> catalogIdsToImplicitIds)
    • getOrder

      public int getOrder()
    • getRuleEvaluationService

      protected com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationService getRuleEvaluationService()
    • getCatalogAccessPolicyService

      protected CatalogAccessPolicyService<CatalogAccessPolicy> getCatalogAccessPolicyService()
    • getCatalogAccessPolicyUtils

      protected CatalogAccessPolicyUtils getCatalogAccessPolicyUtils()
    • getAuthenticationUtils

      protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils()