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)
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionCatalogContextRequestHydrator
(com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationService ruleEvaluationService, CatalogAccessPolicyService<CatalogAccessPolicy> catalogAccessPolicyService, CatalogAccessPolicyUtils catalogAccessPolicyUtils, com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils authenticationUtils) -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 CatalogAccessPolicyService<CatalogAccessPolicy>
protected CatalogAccessPolicyUtils
getImplicitCatalogIdsForRestrictedCatalogs
(Collection<? extends CatalogAccessPolicy> catalogAccessPolicies, Map<String, String> catalogIdsToImplicitIds) int
getOrder()
protected com.broadleafcommerce.rulesengine.expression.service.RuleEvaluationService
com.broadleafcommerce.data.tracking.core.context.ContextRequest
hydrate
(com.broadleafcommerce.data.tracking.core.context.ContextRequest dehydrated) protected List<CatalogAccessPolicy>
readCatalogTargetingAccessPolicies
(com.broadleafcommerce.data.tracking.core.context.ContextRequest dehydrated) protected void
removeRestrictedCatalogsIfCatalogIdUnspecified
(@NonNull com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest, @NonNull List<CatalogAccessPolicy> catalogAccessPolicies, @NonNull Map<String, String> catalogIdsToImplicitIds) * Removes by default allApplication.getInheritanceLines()
from a context request application when targeted by aCatalogAccessPolicy
.protected void
updateApplicationCatalogs
(@NonNull com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest, @NonNull Collection<? extends CatalogAccessPolicy> catalogAccessPolicies, @NonNull Map<String, String> catalogIdsToImplicitIds, @NonNull Set<? extends CatalogAccessPolicy> policiesMatchingContext) Removes inheritance lines and isolated catalogs from the resolved application if they are not visible due to aCatalogAccessPolicy
that targets them not matching the request context.protected <D extends CatalogAccessPolicy>
voidupdateCatalog
(@NonNull com.broadleafcommerce.data.tracking.core.context.ContextRequest contextRequest, @NonNull Collection<D> catalogAccessPolicies, @NonNull Set<D> policiesMatchingContext) Evaluates the match rules ofCatalogAccessPolicies
targeting the application'sApplication.getIsolatedCatalogs()
against the currentCatalogAccessPolicyContext
.Methods inherited from class com.broadleafcommerce.data.tracking.core.web.DefaultContextRequestHydrator
determineCatalog, fetchFromCache, setApplicationService, setAttributesConverter, setCatalogService, setDataRouteReference, setEnvironment, setupCurrentCatalog, setupSiteInheritanceLines
-
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 interfacecom.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator
- Overrides:
hydrate
in classcom.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 ofCatalogAccessPolicies
targeting the application'sApplication.getIsolatedCatalogs()
against the currentCatalogAccessPolicyContext
.- Parameters:
contextRequest
- the context request to modifycatalogAccessPolicies
- 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 aCatalogAccessPolicy
that targets them not matching the request context.- Parameters:
contextRequest
- the context request to modifycatalogAccessPolicies
- the list of all catalog access policiescatalogIdsToImplicitIds
- 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 allApplication.getInheritanceLines()
from a context request application when targeted by aCatalogAccessPolicy
. This method should only be called when the user is in admin context.- Parameters:
contextRequest
- the context request to modifycatalogAccessPolicies
- 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
-
getCatalogAccessPolicyUtils
-
getAuthenticationUtils
protected com.broadleafcommerce.resource.security.utils.service.AuthenticationUtils getAuthenticationUtils()
-