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 jakarta.persistence.criteria.Predicate
    buildNonProductionTrackingLevelFilter(jakarta.persistence.criteria.Root<?> entity, jakarta.persistence.criteria.CriteriaBuilder builder)
    Builds a Predicate 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 whose Sortable.getSorted() has the given value.
    static String
    getTenantIdFromContext(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 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
    • buildNonProductionTrackingLevelFilter

      public static jakarta.persistence.criteria.Predicate buildNonProductionTrackingLevelFilter(jakarta.persistence.criteria.Root<?> entity, jakarta.persistence.criteria.CriteriaBuilder builder)
      Builds a Predicate 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)