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 Type
    Method
    Description
    <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 a Predicate that can be applied to the given query to restrict results to only include data from the restrictedVendorRefs.
    boolean
    canHandle(Class<?> persistedDomainTypeToRead)
    Reports whether the handler supports operations on the given type.

    Methods inherited from interface org.springframework.core.Ordered

    getOrder
  • Method Details

    • canHandle

      boolean canHandle(Class<?> persistedDomainTypeToRead)
      Reports whether the handler supports operations on the given type. If supported, the JpaVendorNarrowingCriteriaManager 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 a Predicate that can be applied to the given query to restrict results to only include data from the restrictedVendorRefs.

      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 queried
      criteriaQuery - the query for which vendor-narrowing criteria should be built
      root - the entity root for the query
      queryParameters - parameters that will be set on the query
      criteriaBuilder - a standard criteria builder
      contextInfo - 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 from restrictedVendorRefs. Cannot return null.
      See Also: