Interface JpaVendorNarrowingCriteriaHandler
- All Superinterfaces:
org.springframework.core.Ordered
- All Known Implementing Classes:
JpaChangeDeployVendorNarrowingCriteriaHandler
,JpaChangeSummaryGroupVendorNarrowingCriteriaHandler
,JpaChangeSummaryVendorNarrowingCriteriaHandler
public interface JpaVendorNarrowingCriteriaHandler
extends org.springframework.core.Ordered
A specialized component that can understand how to build vendor-narrowing criteria for a specific
entity.
Implementations declare which entities they support via canHandle(Class)
, and the
JpaVendorNarrowingCriteriaManager
will delegate to the first that can handle it.
Consumers should almost always call on JpaVendorNarrowingCriteriaManager
and not call any
of the methods in this interface directly.
This is somewhat analogous to VendorVisibilityHandler
.
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Method Summary
Modifier and TypeMethodDescription<D> jakarta.persistence.criteria.Predicate
buildVendorNarrowingCriteria
(Set<String> restrictedVendorRefs, Class<D> persistedDomainTypeToRead, jakarta.persistence.criteria.CriteriaQuery<?> criteriaQuery, jakarta.persistence.criteria.Root<D> root, Map<String, Object> queryParameters, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) For the persisted domain entity type supported by this handler, build aPredicate
that can be applied to the given query to restrict results to only include data from therestrictedVendorRefs
.boolean
Reports whether the handler supports operations on the given type.Methods inherited from interface org.springframework.core.Ordered
getOrder
-
Method Details
-
canHandle
Reports whether the handler supports operations on the given type. If supported, theJpaVendorNarrowingCriteriaManager
will delegate to it for various operations.- Parameters:
persistedDomainTypeToRead
- the type to check support for- Returns:
- true if the handler supports operations on the given type, false otherwise
-
buildVendorNarrowingCriteria
<D> jakarta.persistence.criteria.Predicate buildVendorNarrowingCriteria(Set<String> restrictedVendorRefs, Class<D> persistedDomainTypeToRead, jakarta.persistence.criteria.CriteriaQuery<?> criteriaQuery, jakarta.persistence.criteria.Root<D> root, Map<String, Object> queryParameters, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) For the persisted domain entity type supported by this handler, build aPredicate
that can be applied to the given query to restrict results to only include data from therestrictedVendorRefs
.This is particularly useful to prevent vendor-restricted authentications from accessing data outside of their allowed vendors.
- Type Parameters:
D
- the persisted-domain type of the entity being queried- Parameters:
restrictedVendorRefs
- the "vendorRef" (typically a vendor ID or code) of all vendors that the results need to be restricted to. Will never be empty.persistedDomainTypeToRead
- the persisted-domain type of the entity being queriedcriteriaQuery
- the query for which vendor-narrowing criteria should be builtroot
- the entity root for the queryqueryParameters
- parameters that will be set on the querycriteriaBuilder
- a standard criteria buildercontextInfo
- context information surrounding multitenant state. While typical narrowing will not apply, this parameter may be useful to certain implementations for determining additional information about the request.- Returns:
- a
Predicate
that can appropriately filter query results to only include the records accessible fromrestrictedVendorRefs
. Cannot return null. - See Also:
-