Class JpaChangeSummaryVendorNarrowingCriteriaHandler
java.lang.Object
com.broadleafcommerce.sandbox.provider.jpa.marketplace.vendor.JpaChangeSummaryVendorNarrowingCriteriaHandler
- All Implemented Interfaces:
JpaVendorNarrowingCriteriaHandler
,org.springframework.core.Ordered
public class JpaChangeSummaryVendorNarrowingCriteriaHandler
extends Object
implements JpaVendorNarrowingCriteriaHandler
Can build criteria to narrow queries on
JpaChangeSummary
to only produce records matching
the appropriate vendor restrictions.
Ultimately, the only summaries that are accessible are those which do not have an effect outside of the provided vendor restrictions.
- See Also:
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
Constructors -
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.int
getOrder()
-
Constructor Details
-
JpaChangeSummaryVendorNarrowingCriteriaHandler
public JpaChangeSummaryVendorNarrowingCriteriaHandler()
-
-
Method Details
-
canHandle
Description copied from interface:JpaVendorNarrowingCriteriaHandler
Reports whether the handler supports operations on the given type. If supported, theJpaVendorNarrowingCriteriaManager
will delegate to it for various operations.- Specified by:
canHandle
in interfaceJpaVendorNarrowingCriteriaHandler
- Parameters:
persistedDomainTypeToRead
- the type to check support for- Returns:
- true if the handler supports operations on the given type, false otherwise
-
getOrder
public int getOrder()- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
-
buildVendorNarrowingCriteria
public <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) Description copied from interface:JpaVendorNarrowingCriteriaHandler
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.
- Specified by:
buildVendorNarrowingCriteria
in interfaceJpaVendorNarrowingCriteriaHandler
- 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:
-