Class DefaultJpaVendorNarrowingQueryCustomizer
java.lang.Object
com.broadleafcommerce.sandbox.provider.jpa.marketplace.vendor.DefaultJpaVendorNarrowingQueryCustomizer
- All Implemented Interfaces:
JpaVendorNarrowingQueryCustomizer
public class DefaultJpaVendorNarrowingQueryCustomizer
extends Object
implements JpaVendorNarrowingQueryCustomizer
Default implementation of
JpaVendorNarrowingQueryCustomizer.-
Constructor Summary
ConstructorsConstructorDescriptionDefaultJpaVendorNarrowingQueryCustomizer(com.broadleafcommerce.data.tracking.core.policy.trackable.marketplace.vendor.VendorAwareTrackablePolicyUtils vendorAwareTrackablePolicyUtils, JpaVendorNarrowingCriteriaManager vendorCriteriaManager) -
Method Summary
Modifier and TypeMethodDescription<D> jakarta.persistence.criteria.PredicatebuildVendorNarrowingCriteriaForCurrentAuthentication(@NonNull Class<D> persistedDomainTypeToRead, @NonNull jakarta.persistence.criteria.CriteriaQuery<?> criteriaQuery, @NonNull jakarta.persistence.criteria.Root<D> root, @NonNull Map<String, Object> queryParameters, @NonNull jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Depending on the current authentication's restrictions/permissions and the current operation's policy requirements, it may be necessary to restrict query results to only include data from certain vendors.protected com.broadleafcommerce.data.tracking.core.policy.trackable.marketplace.vendor.VendorAwareTrackablePolicyUtilsprotected JpaVendorNarrowingCriteriaManager
-
Constructor Details
-
DefaultJpaVendorNarrowingQueryCustomizer
public DefaultJpaVendorNarrowingQueryCustomizer(com.broadleafcommerce.data.tracking.core.policy.trackable.marketplace.vendor.VendorAwareTrackablePolicyUtils vendorAwareTrackablePolicyUtils, JpaVendorNarrowingCriteriaManager vendorCriteriaManager)
-
-
Method Details
-
buildVendorNarrowingCriteriaForCurrentAuthentication
@Nullable public <D> jakarta.persistence.criteria.Predicate buildVendorNarrowingCriteriaForCurrentAuthentication(@NonNull @NonNull Class<D> persistedDomainTypeToRead, @NonNull @NonNull jakarta.persistence.criteria.CriteriaQuery<?> criteriaQuery, @NonNull @NonNull jakarta.persistence.criteria.Root<D> root, @NonNull @NonNull Map<String, Object> queryParameters, @NonNull @NonNull jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:JpaVendorNarrowingQueryCustomizerDepending on the current authentication's restrictions/permissions and the current operation's policy requirements, it may be necessary to restrict query results to only include data from certain vendors.This method is responsible for building a
Predicatethat can be added to the provided query for restricting results to only include those appropriate for the current authentication, current policy requirements, and the persisted-domain entity being read.- Specified by:
buildVendorNarrowingCriteriaForCurrentAuthenticationin interfaceJpaVendorNarrowingQueryCustomizer- Type Parameters:
D- the persisted-domain type of the entity being queried- Parameters:
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
Predicatethat can appropriate filter query results to only include the records accessible by the current authentication. Alternatively, returnsnullif no vendor narrowing should be applied. - See Also:
-
getVendorAwareTrackablePolicyUtils
protected com.broadleafcommerce.data.tracking.core.policy.trackable.marketplace.vendor.VendorAwareTrackablePolicyUtils getVendorAwareTrackablePolicyUtils() -
getVendorCriteriaManager
-