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 javax.persistence.criteria.Predicate
getSortingCriteria
(boolean isSorted, javax.persistence.criteria.Root<?> root, javax.persistence.criteria.CriteriaBuilder criteriaBuilder, Map<String, Object> parameterValues) Creates a filter that restricts results to only include entities whoseSortable.getSorted()
has the given value.
-
Method Details
-
getSortingCriteria
public static javax.persistence.criteria.Predicate getSortingCriteria(boolean isSorted, javax.persistence.criteria.Root<?> root, javax.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
-