Class JpaInventoryTenantQueryHelper

java.lang.Object
com.broadleafcommerce.inventory.provider.jpa.repository.JpaInventoryTenantQueryHelper

public class JpaInventoryTenantQueryHelper extends Object
Convenience methods to help query for JPA inventory-related entities matching a tenant context.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final String
     
    protected static final String
     
    protected static final String
     
    static final String
     
    protected static final String
     
    protected static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    JpaInventoryTenantQueryHelper(com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder filtersCriteriaBuilder)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected jakarta.persistence.criteria.Predicate
    buildApplicationIdFilter(String applicationId, Map<String,Object> queryParams, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, jakarta.persistence.criteria.Root<? extends com.broadleafcommerce.data.tracking.core.Trackable> entity)
     
    protected jakarta.persistence.criteria.Predicate
    buildArchivedFilter(jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, jakarta.persistence.criteria.Root<? extends com.broadleafcommerce.data.tracking.core.Trackable> entity)
     
    <D extends com.broadleafcommerce.data.tracking.core.Trackable>
    List<jakarta.persistence.criteria.Predicate>
    buildContextFilters(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, jakarta.persistence.criteria.CriteriaQuery<D> criteria, Map<String,Object> queryParams, jakarta.persistence.criteria.Root<D> entity, Class<D> managedType)
    Creates filters narrowing the context as an alternative to the narrowing of JpaNarrowExecutor.
    jakarta.persistence.criteria.Predicate
    buildContextIdIsEqualToFilter(String contextId, Map<String,Object> queryParams, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, jakarta.persistence.criteria.Root<? extends com.broadleafcommerce.data.tracking.core.Trackable> entity)
     
    jakarta.persistence.criteria.Predicate
    buildContextIdIsInFilter(Iterable<String> contextIds, Map<String,Object> queryParams, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, jakarta.persistence.criteria.Root<? extends com.broadleafcommerce.data.tracking.core.Trackable> entity)
     
    protected jakarta.persistence.criteria.Predicate
    buildTenantIdFilter(String tenantId, Map<String,Object> queryParams, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, jakarta.persistence.criteria.Root<? extends com.broadleafcommerce.data.tracking.core.Trackable> entity)
     
    protected jakarta.persistence.EntityManager
     
    protected com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder
     

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • JpaInventoryTenantQueryHelper

      public JpaInventoryTenantQueryHelper(com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder filtersCriteriaBuilder)
  • Method Details

    • buildContextIdIsEqualToFilter

      public jakarta.persistence.criteria.Predicate buildContextIdIsEqualToFilter(String contextId, Map<String,Object> queryParams, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, jakarta.persistence.criteria.Root<? extends com.broadleafcommerce.data.tracking.core.Trackable> entity)
    • buildContextIdIsInFilter

      public jakarta.persistence.criteria.Predicate buildContextIdIsInFilter(Iterable<String> contextIds, Map<String,Object> queryParams, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, jakarta.persistence.criteria.Root<? extends com.broadleafcommerce.data.tracking.core.Trackable> entity)
    • buildContextFilters

      public <D extends com.broadleafcommerce.data.tracking.core.Trackable> List<jakarta.persistence.criteria.Predicate> buildContextFilters(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, jakarta.persistence.criteria.CriteriaQuery<D> criteria, Map<String,Object> queryParams, jakarta.persistence.criteria.Root<D> entity, Class<D> managedType)
      Creates filters narrowing the context as an alternative to the narrowing of JpaNarrowExecutor.

      Will add filters on tenant, archived status, hints, influencers, and active dates. Will include application filters by default, but they can be skipped by setting an additional property on the context. Set the additionalProperty on ContextInfo "INCLUDE_APPLICATION_ID_PREDICATE" to Boolean.FALSE to prevent any application filtering. This does not perform any catalog narrowing.

      Type Parameters:
      D - the entity type being queried for
      Parameters:
      contextInfo - context information surrounding multitenant state
      criteria - The current query being built up
      queryParams - contains parameters that will be set on the query
      entity - the query root entity
      managedType - the type being queried for
      Returns:
      filters narrowing the query by tenant, archival, hints, influencers, and active dates from context
    • buildTenantIdFilter

      protected jakarta.persistence.criteria.Predicate buildTenantIdFilter(@Nullable String tenantId, Map<String,Object> queryParams, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, jakarta.persistence.criteria.Root<? extends com.broadleafcommerce.data.tracking.core.Trackable> entity)
    • buildApplicationIdFilter

      protected jakarta.persistence.criteria.Predicate buildApplicationIdFilter(@Nullable String applicationId, Map<String,Object> queryParams, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, jakarta.persistence.criteria.Root<? extends com.broadleafcommerce.data.tracking.core.Trackable> entity)
    • buildArchivedFilter

      protected jakarta.persistence.criteria.Predicate buildArchivedFilter(jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, jakarta.persistence.criteria.Root<? extends com.broadleafcommerce.data.tracking.core.Trackable> entity)
    • getEntityManager

      protected jakarta.persistence.EntityManager getEntityManager()
    • getFiltersCriteriaBuilder

      protected com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder getFiltersCriteriaBuilder()