Class SearchContextRequestHydrator

java.lang.Object
com.broadleafcommerce.data.tracking.core.web.DefaultContextRequestHydrator
com.broadleafcommerce.search.core.web.endpoint.SearchContextRequestHydrator
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.core.Ordered

public class SearchContextRequestHydrator extends com.broadleafcommerce.data.tracking.core.web.DefaultContextRequestHydrator
Hydrates the customerContextId to the tenantId if it was not provided in the ContextRequest and if it is not at the tenant level.
  • Field Summary

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    SearchContextRequestHydrator(SearchCatalogAccessPolicyUtils catalogAccessPolicyUtils, com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationService ruleEvaluationService, SearchCatalogAccessPolicyService<com.broadleafcommerce.search.api.domain.accesspolicy.SearchCatalogAccessPolicy> searchCatalogAccessPolicyService, com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    filterInheritanceLines(com.broadleafcommerce.data.tracking.core.tenant.domain.Application application, Collection<String> allRestrictedCatalogImplicitIds, Collection<String> visibleRestrictedCatalogImplicitIds)
     
    protected void
    filterIsolatedCatalogs(com.broadleafcommerce.data.tracking.core.tenant.domain.Application application, Collection<String> allRestrictedCatalogImplicitIds, Collection<String> visibleRestrictedCatalogImplicitIds)
     
    protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils
     
     
    protected List<String>
    getImplicitCatalogIdsForRestrictedCatalogs(Collection<? extends com.broadleafcommerce.search.api.domain.accesspolicy.SearchCatalogAccessPolicy> catalogAccessPolicies, Map<String,String> catalogIdsToImplicitIds)
     
    int
     
    protected com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationService
     
    protected SearchCatalogAccessPolicyService<com.broadleafcommerce.search.api.domain.accesspolicy.SearchCatalogAccessPolicy>
     
    com.broadleafcommerce.data.tracking.core.context.ContextRequest
    hydrate(com.broadleafcommerce.data.tracking.core.context.ContextRequest dehydrated)
    Additional ContextRequest hydration steps pertaining to SearchCatalogAccessPolicy restrictions.
    protected void
    hydrateCustomerContextId(com.broadleafcommerce.data.tracking.core.context.ContextRequest dehydrated)
     
    protected List<com.broadleafcommerce.search.api.domain.accesspolicy.SearchCatalogAccessPolicy>
    readCatalogTargetingAccessPolicies(com.broadleafcommerce.data.tracking.core.context.ContextRequest dehydrated)
     
    protected void
    updateApplicationCatalogs(com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest, Collection<? extends com.broadleafcommerce.search.api.domain.accesspolicy.SearchCatalogAccessPolicy> catalogAccessPolicies, Map<String,String> catalogIdsToImplicitIds, @NonNull Set<? extends com.broadleafcommerce.search.api.domain.accesspolicy.SearchCatalogAccessPolicy> policiesMatchingContext)
    Removes inheritance lines and isolated catalogs from the resolved application if they are not visible due to a SearchCatalogAccessPolicy that targets them not matching the request context.
    protected <D extends com.broadleafcommerce.search.api.domain.accesspolicy.SearchCatalogAccessPolicy>
    void
    updateCatalog(com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest, Collection<D> catalogAccessPolicies, @NonNull Set<D> policiesMatchingContext)
    Evaluates the match rules of SearchCatalogAccessPolicies targeting the application's Application.getIsolatedCatalogs() against the current SearchCatalogAccessPolicyContext.

    Methods inherited from class com.broadleafcommerce.data.tracking.core.web.DefaultContextRequestHydrator

    determineCatalog, fetchFromCache, isCatalogVisible, setApplicationService, setAttributesConverter, setBeanFactory, setCatalogService, setDataRouteReference, setEnvironment, setupCurrentCatalog, setupSiteInheritanceLines

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SearchContextRequestHydrator

      public SearchContextRequestHydrator(SearchCatalogAccessPolicyUtils catalogAccessPolicyUtils, com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationService ruleEvaluationService, SearchCatalogAccessPolicyService<com.broadleafcommerce.search.api.domain.accesspolicy.SearchCatalogAccessPolicy> searchCatalogAccessPolicyService, 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)
      Additional ContextRequest hydration steps pertaining to SearchCatalogAccessPolicy restrictions. These evaluate active policy restrictions to make the due updates to the context request's Application.getIsolatedCatalogs() , Application.getInheritanceLines() and the ContextRequest.getCatalogHierarchy()
      Specified by:
      hydrate in interface com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator
      Overrides:
      hydrate in class com.broadleafcommerce.data.tracking.core.web.DefaultContextRequestHydrator
      Parameters:
      dehydrated - the dehydrated context request
      Returns:
      the hydrated context request
    • readCatalogTargetingAccessPolicies

      protected List<com.broadleafcommerce.search.api.domain.accesspolicy.SearchCatalogAccessPolicy> readCatalogTargetingAccessPolicies(com.broadleafcommerce.data.tracking.core.context.ContextRequest dehydrated)
    • updateCatalog

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

      protected void updateApplicationCatalogs(com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest, Collection<? extends com.broadleafcommerce.search.api.domain.accesspolicy.SearchCatalogAccessPolicy> catalogAccessPolicies, Map<String,String> catalogIdsToImplicitIds, @NonNull @NonNull Set<? extends com.broadleafcommerce.search.api.domain.accesspolicy.SearchCatalogAccessPolicy> policiesMatchingContext)
      Removes inheritance lines and isolated catalogs from the resolved application if they are not visible due to a SearchCatalogAccessPolicy 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)
    • hydrateCustomerContextId

      protected void hydrateCustomerContextId(com.broadleafcommerce.data.tracking.core.context.ContextRequest dehydrated)
    • getImplicitCatalogIdsForRestrictedCatalogs

      protected List<String> getImplicitCatalogIdsForRestrictedCatalogs(Collection<? extends com.broadleafcommerce.search.api.domain.accesspolicy.SearchCatalogAccessPolicy> catalogAccessPolicies, Map<String,String> catalogIdsToImplicitIds)
    • getOrder

      public int getOrder()
    • getCatalogAccessPolicyUtils

      protected SearchCatalogAccessPolicyUtils getCatalogAccessPolicyUtils()
    • getRuleEvaluationService

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

      protected SearchCatalogAccessPolicyService<com.broadleafcommerce.search.api.domain.accesspolicy.SearchCatalogAccessPolicy> getSearchCatalogAccessPolicyService()
    • getAuthenticationUtils

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