Class JpaInventoryTenantQueryHelper
java.lang.Object
com.broadleafcommerce.inventory.provider.jpa.repository.JpaInventoryTenantQueryHelper
Convenience methods to help query for JPA inventory-related entities matching a tenant context.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionJpaInventoryTenantQueryHelper
(com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder filtersCriteriaBuilder) -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 ofJpaNarrowExecutor
.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
-
Field Details
-
INCLUDE_APPLICATION_ID_PREDICATE
- See Also:
-
CONTEXT_ID
- See Also:
-
TENANT_ID_QUERY_PARAM
- See Also:
-
TENANT_ID_FIELD_PATH
- See Also:
-
APPLICATION_ID_FIELD_PATH
- See Also:
-
APPLICATION_ID_QUERY_PARAM
- See Also:
-
-
Constructor Details
-
JpaInventoryTenantQueryHelper
public JpaInventoryTenantQueryHelper(com.broadleafcommerce.data.tracking.jpa.filtering.fetch.rsql.JpaFiltersCriteriaBuilder filtersCriteriaBuilder)
-
-
Method Details
-
buildContextIdIsEqualToFilter
-
buildContextIdIsInFilter
-
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 ofJpaNarrowExecutor
.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 statecriteria
- The current query being built upqueryParams
- contains parameters that will be set on thequery
entity
- the query root entitymanagedType
- the type being queried for- Returns:
- filters narrowing the query by tenant, archival, hints, influencers, and active dates from context
-
buildTenantIdFilter
-
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()
-