Class QueryUtils

java.lang.Object
org.broadleafcommerce.common.util.dao.QueryUtils

public class QueryUtils extends Object
Helper class for criteria queries.
Author:
gdiaz
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    effectiveDate(jakarta.persistence.criteria.CriteriaBuilder builder, List<jakarta.persistence.criteria.Predicate> restrictions, jakarta.persistence.criteria.Path datesPath, String startDateFieldName, String endDateFieldName)
    given a list of AND-ed query restrictions, adds to the list the restrictions necessary for effective-dating The rules used are: The "activeStart" effective date has to exist (otherwise, inactive) The "activeStart" effective date has be prior or equal to today For the record to remain active, the "activeEnd" date can be either left unspecified, or be after today
    static void
    notArchived(jakarta.persistence.criteria.CriteriaBuilder builder, List<jakarta.persistence.criteria.Predicate> restrictions, jakarta.persistence.criteria.Path archivedPath, String archivedFieldName)
    given a list of AND-ed restrictions, it determines wether or not the record is "archived", and adds the necessary restrictions.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • QueryUtils

      public QueryUtils()
  • Method Details

    • effectiveDate

      public static void effectiveDate(jakarta.persistence.criteria.CriteriaBuilder builder, List<jakarta.persistence.criteria.Predicate> restrictions, jakarta.persistence.criteria.Path datesPath, String startDateFieldName, String endDateFieldName)
      given a list of AND-ed query restrictions, adds to the list the restrictions necessary for effective-dating The rules used are:
      • The "activeStart" effective date has to exist (otherwise, inactive)
      • The "activeStart" effective date has be prior or equal to today
      • For the record to remain active, the "activeEnd" date can be either left unspecified, or be after today
        Parameters:
        builder - the Criteria builder
        restrictions - the list of AND-ed restrictions
        datesPath - the Path expression that can be used to retrieve the date fields
        startDateFieldName - the name of the start date field, for example, "activeStartDate"
        endDateFieldName - the name of the end date field, for example, "activeEndDate"
      • notArchived

        public static void notArchived(jakarta.persistence.criteria.CriteriaBuilder builder, List<jakarta.persistence.criteria.Predicate> restrictions, jakarta.persistence.criteria.Path archivedPath, String archivedFieldName)
        given a list of AND-ed restrictions, it determines wether or not the record is "archived", and adds the necessary restrictions. A record is considered "archived" when the ARCHIVED field is explicitly "Y", so both null and "N" will do as non-archived
        Parameters:
        builder -
        restrictions -
        archivedPath -
        archivedFieldName -