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
    Constructor
    Description
     
  • 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.
    int
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JpaChangeSummaryVendorNarrowingCriteriaHandler

      public JpaChangeSummaryVendorNarrowingCriteriaHandler()
  • Method Details

    • canHandle

      public boolean canHandle(Class<?> persistedDomainTypeToRead)
      Description copied from interface: JpaVendorNarrowingCriteriaHandler
      Reports whether the handler supports operations on the given type. If supported, the JpaVendorNarrowingCriteriaManager will delegate to it for various operations.
      Specified by:
      canHandle in interface JpaVendorNarrowingCriteriaHandler
      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 interface org.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 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.

      Specified by:
      buildVendorNarrowingCriteria in interface JpaVendorNarrowingCriteriaHandler
      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: