Class JpaCriteriaUtils
java.lang.Object
com.broadleafcommerce.catalog.provider.jpa.repository.support.JpaCriteriaUtils
Support class with convenience methods for criteria-building functionality common to custom JPA
repository implementations.
- Author:
- Samarth Dhruva (samarthd)
-
Method Summary
Modifier and TypeMethodDescriptionstatic jakarta.persistence.criteria.Predicate
buildNonProductionTrackingLevelFilter
(jakarta.persistence.criteria.Root<?> entity, jakarta.persistence.criteria.CriteriaBuilder builder) Builds aPredicate
for non-production tracking level.static jakarta.persistence.criteria.Predicate
buildNotArchivedFilter
(jakarta.persistence.criteria.Root<?> entity, jakarta.persistence.criteria.CriteriaBuilder builder) static jakarta.persistence.criteria.Predicate
buildTenantIdFilter
(jakarta.persistence.criteria.Root<?> entity, jakarta.persistence.criteria.CriteriaBuilder builder, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) static jakarta.persistence.criteria.Predicate
getSortingCriteria
(boolean isSorted, jakarta.persistence.criteria.Root<?> root, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String, Object> parameterValues) Creates a filter that restricts results to only include entities whoseSortable.getSorted()
has the given value.static String
getTenantIdFromContext
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
-
Method Details
-
getSortingCriteria
public static jakarta.persistence.criteria.Predicate getSortingCriteria(boolean isSorted, jakarta.persistence.criteria.Root<?> root, jakarta.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String, Object> parameterValues) Creates a filter that restricts results to only include entities whoseSortable.getSorted()
has the given value. This is implemented by creating criteria based around the value ofSortable.getSorting()
.- Parameters:
isSorted
- the criteria created will restrict results to only include entities whoseSortable.getSorted()
has the given valueroot
- the root entity on which the query will be performedcriteriaBuilder
- the criteria builder used to generate parameters/predicatesparameterValues
- a map of parameter names to argument values that will be used to run the query. Any parameter values required to perform the query should be added to this map.- Returns:
- a criteria that restricts results to only include entities whose
Sortable.getSorted()
has the given value
-
buildNonProductionTrackingLevelFilter
public static jakarta.persistence.criteria.Predicate buildNonProductionTrackingLevelFilter(jakarta.persistence.criteria.Root<?> entity, jakarta.persistence.criteria.CriteriaBuilder builder) Builds aPredicate
for non-production tracking level. -
buildTenantIdFilter
public static jakarta.persistence.criteria.Predicate buildTenantIdFilter(jakarta.persistence.criteria.Root<?> entity, jakarta.persistence.criteria.CriteriaBuilder builder, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
buildNotArchivedFilter
public static jakarta.persistence.criteria.Predicate buildNotArchivedFilter(jakarta.persistence.criteria.Root<?> entity, jakarta.persistence.criteria.CriteriaBuilder builder) -
getTenantIdFromContext
@Nullable public static String getTenantIdFromContext(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
-