java.lang.Object
com.broadleafcommerce.catalog.provider.jpa.repository.support.JpaCriteriaUtils

public final class JpaCriteriaUtils extends Object
Support class with convenience methods for criteria-building functionality common to custom JPA repository implementations.
Author:
Samarth Dhruva (samarthd)
  • Method Summary

    Modifier and Type
    Method
    Description
    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 whose Sortable.getSorted() has the given value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 whose Sortable.getSorted() has the given value. This is implemented by creating criteria based around the value of Sortable.getSorting().
      Parameters:
      isSorted - the criteria created will restrict results to only include entities whose Sortable.getSorted() has the given value
      root - the root entity on which the query will be performed
      criteriaBuilder - the criteria builder used to generate parameters/predicates
      parameterValues - 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