Class QueryUtils
java.lang.Object
org.broadleafcommerce.common.util.dao.QueryUtils
Helper class for criteria queries.
- Author:
- gdiaz
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 todaystatic 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.
-
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 builderrestrictions
- the list of AND-ed restrictionsdatesPath
- the Path expression that can be used to retrieve the date fieldsstartDateFieldName
- 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
-
-