public class QueryUtils extends Object
Constructor and Description |
---|
QueryUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
effectiveDate(javax.persistence.criteria.CriteriaBuilder builder,
List<javax.persistence.criteria.Predicate> restrictions,
javax.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(javax.persistence.criteria.CriteriaBuilder builder,
List<javax.persistence.criteria.Predicate> restrictions,
javax.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.
|
public static void effectiveDate(javax.persistence.criteria.CriteriaBuilder builder, List<javax.persistence.criteria.Predicate> restrictions, javax.persistence.criteria.Path datesPath, String startDateFieldName, String endDateFieldName)
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"public static void notArchived(javax.persistence.criteria.CriteriaBuilder builder, List<javax.persistence.criteria.Predicate> restrictions, javax.persistence.criteria.Path archivedPath, String archivedFieldName)
builder
- restrictions
- archivedPath
- archivedFieldName
- Copyright © 2022. All rights reserved.