public class FieldConstraintBuilder extends ConstraintBuilder
Modifier | Constructor and Description |
---|---|
protected |
FieldConstraintBuilder(String fieldName) |
Modifier and Type | Method and Description |
---|---|
Constraint |
between(Calendar start,
Calendar end,
DateTools.Resolution dateResolution)
Adds a FAST DATE RANGE constraint that the Calendar value for
fieldAttributeName is between start and end (boundaries included) BASED ON the
granularity resolution . |
Constraint |
between(Object value1,
Object value2)
Adds a constraint that the value
fieldAttributeName is between value1 and value2 (boundaries included). |
Constraint |
contains(String value)
Adds a fulltext search to this Filter.
|
Constraint |
equalTo(Calendar value,
DateTools.Resolution dateResolution)
Adds a constraint that the Calendar value for
fieldAttributeName rounded to its resolution is equal to the
rounded value for calendar . |
Constraint |
equalTo(Object value)
Adds a constraint that the value
fieldAttributeName is equal to value |
Constraint |
equalToCaseInsensitive(String value)
Case insensitive testing of
fieldAttributeName for some value . |
Constraint |
exists()
Add a constraint that the result does have the property
fieldAttributeName , regardless its value |
Constraint |
greaterOrEqualThan(Calendar value,
DateTools.Resolution dateResolution)
note: supported resolutions are
DateTools.Resolution.YEAR ,
DateTools.Resolution.MONTH ,
DateTools.Resolution.DAY or
DateTools.Resolution.HOUR |
Constraint |
greaterOrEqualThan(Object value)
Adds a constraint that the value
fieldAttributeName is greater than or equal to value |
Constraint |
greaterThan(Calendar value,
DateTools.Resolution dateResolution)
note: supported resolutions are
DateTools.Resolution.YEAR ,
DateTools.Resolution.MONTH ,
DateTools.Resolution.DAY or
DateTools.Resolution.HOUR |
Constraint |
greaterThan(Object value)
Adds a constraint that the value
fieldAttributeName is greater than value |
Constraint |
jcrExpression(String value)
Adds the xpath
jcrExpression as constraint. |
Constraint |
lessOrEqualThan(Calendar value,
DateTools.Resolution dateResolution)
note: supported resolutions are
DateTools.Resolution.YEAR ,
DateTools.Resolution.MONTH ,
DateTools.Resolution.DAY or
DateTools.Resolution.HOUR |
Constraint |
lessOrEqualThan(Object value)
Adds a constraint that the value
fieldAttributeName is less than or equal to value |
Constraint |
lessThan(Calendar value,
DateTools.Resolution dateResolution)
note: supported resolutions are
DateTools.Resolution.YEAR ,
DateTools.Resolution.MONTH ,
DateTools.Resolution.DAY or
DateTools.Resolution.HOUR |
Constraint |
lessThan(Object value)
Adds a constraint that the value
fieldAttributeName is less than value |
Constraint |
like(String value)
This function is based on the LIKE predicate found in SQL.
|
Constraint |
notBetween(Calendar start,
Calendar end,
DateTools.Resolution dateResolution)
note: supported resolutions are
DateTools.Resolution.YEAR ,
DateTools.Resolution.MONTH ,
DateTools.Resolution.DAY or
DateTools.Resolution.HOUR |
Constraint |
notBetween(Object value1,
Object value2)
Adds a constraint that the value
fieldAttributeName is NOT between value1 and value2 ,
including NOT value1 and value2 |
Constraint |
notContains(String value)
The negated version of
ConstraintBuilder.contains(String) |
Constraint |
notEqualTo(Calendar value,
DateTools.Resolution dateResolution)
Case insensitive testing of
fieldAttributeName for some value . |
Constraint |
notEqualTo(Object value)
Adds a constraint that the value
fieldAttributeName is NOT equal to value |
Constraint |
notEqualToCaseInsensitive(String value)
note: supported resolutions are
DateTools.Resolution.YEAR ,
DateTools.Resolution.MONTH ,
DateTools.Resolution.DAY or
DateTools.Resolution.HOUR |
Constraint |
notExists()
Add a constraint that the result does NOT have the property
fieldAttributeName |
Constraint |
notLike(String value) |
and, constraint, or
protected FieldConstraintBuilder(String fieldName)
public Constraint equalTo(Object value)
ConstraintBuilder
fieldAttributeName
is equal to value
equalTo
in class ConstraintBuilder
value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
. If
the parameter value
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.Constraint
public Constraint equalTo(Calendar value, DateTools.Resolution dateResolution)
ConstraintBuilder
Adds a constraint that the Calendar value for fieldAttributeName
rounded to its resolution is equal to the
rounded value for calendar
. Thus assume the Resolution
is equal to Resolution.DAY
,
then all nodes/documents where the property fieldAttributeName
as a Calendar value with the calendar
rounded to days, will match.
supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
equalTo
in class ConstraintBuilder
value
- The Calendar
value constraint that the results should be equal to. If
the parameter value
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.dateResolution
- the resolution to use to compare dates. The higher the Resolution (year is highest) the better the performance.
supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
Constraint
public Constraint equalToCaseInsensitive(String value)
ConstraintBuilder
fieldAttributeName
for some value
.equalToCaseInsensitive
in class ConstraintBuilder
value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
. If
the parameter value
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.Constraint
same as equalTo(Object) only now the equality is checked
case insensitive and the value can only be of type String
public Constraint notEqualTo(Object value)
ConstraintBuilder
fieldAttributeName
is NOT equal to value
notEqualTo
in class ConstraintBuilder
value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
. If
the parameter value
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.Constraint
public Constraint notEqualTo(Calendar value, DateTools.Resolution dateResolution)
ConstraintBuilder
fieldAttributeName
for some value
.notEqualTo
in class ConstraintBuilder
Constraint
same as notEqualTo(Object) only now the inequality is checked
case insensitive and the value can only be of type {@link Calendar}
public Constraint notEqualToCaseInsensitive(String value)
ConstraintBuilder
note: supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
notEqualToCaseInsensitive
in class ConstraintBuilder
value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
. If
the parameter value
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.Constraint
equalTo(java.util.Calendar, DateTools.Resolution) only now negated
public Constraint greaterOrEqualThan(Object value)
ConstraintBuilder
Adds a constraint that the value fieldAttributeName
is greater than or equal to value
note that for range queries on calendar/date instances where the granularity of, say Day, is enough, you
should use ConstraintBuilder.greaterOrEqualThan(java.util.Calendar, DateTools.Resolution)
with the highest resolution that is acceptable for your use case, as this performs much better, OR make sure
that your application runs with a default resolution set to for example 'day'
greaterOrEqualThan
in class ConstraintBuilder
value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
. If
the parameter value
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.Constraint
public Constraint greaterOrEqualThan(Calendar value, DateTools.Resolution dateResolution)
ConstraintBuilder
note: supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
greaterOrEqualThan
in class ConstraintBuilder
value
- Calendar
object. If
the parameter value
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.dateResolution
- the resolution to use to compare dates. The higher the Resolution (year is highest) the better the performance.
supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
Constraint
between(java.util.Calendar, java.util.Calendar, DateTools.Resolution) but now no upper bound
public Constraint greaterThan(Object value)
ConstraintBuilder
Adds a constraint that the value fieldAttributeName
is greater than value
note that for range queries on calendar/date instances where the granularity of, say Day, is enough, you
should use ConstraintBuilder.greaterThan(java.util.Calendar, org.hippoecm.repository.util.DateTools.Resolution)
with the highest resolution that is acceptable for your use case, as this performs much better, OR make sure
that your application runs with a default resolution set to for example 'day'
greaterThan
in class ConstraintBuilder
value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
. If
the parameter value
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.Constraint
public Constraint greaterThan(Calendar value, DateTools.Resolution dateResolution)
ConstraintBuilder
note: supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
greaterThan
in class ConstraintBuilder
value
- Calendar
object. If
the parameter value
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.dateResolution
- the resolution to use to compare dates. The higher the Resolution (year is highest) the better the performance.
supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
Constraint
between(java.util.Calendar, java.util.Calendar, DateTools.Resolution) but now no upper bound and lower bound not included
public Constraint lessOrEqualThan(Object value)
ConstraintBuilder
Adds a constraint that the value fieldAttributeName
is less than or equal to value
note that for range queries on calendar/date instances where the granularity of, say Day, is enough, you
should use ConstraintBuilder.lessOrEqualThan(java.util.Calendar, org.hippoecm.repository.util.DateTools.Resolution)
with the highest resolution that is acceptable for your use case, as this performs much better, OR make sure
that your application runs with a default resolution set to for example 'day'
lessOrEqualThan
in class ConstraintBuilder
value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
. If
the parameter value
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.Constraint
public Constraint lessOrEqualThan(Calendar value, DateTools.Resolution dateResolution)
ConstraintBuilder
note: supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
lessOrEqualThan
in class ConstraintBuilder
Constraint
between(java.util.Calendar, java.util.Calendar, DateTools.Resolution) but now no lower bound
public Constraint lessThan(Object value)
ConstraintBuilder
Adds a constraint that the value fieldAttributeName
is less than value
note that for range queries on calendar/date instances where the granularity of, say Day, is enough, you
should use ConstraintBuilder.lessThan(java.util.Calendar, org.hippoecm.repository.util.DateTools.Resolution)
with the highest resolution that is acceptable for your use case, as this performs much better, OR make sure
that your application runs with a default resolution set to for example 'day'
lessThan
in class ConstraintBuilder
value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
Constraint
public Constraint lessThan(Calendar value, DateTools.Resolution dateResolution)
ConstraintBuilder
note: supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
lessThan
in class ConstraintBuilder
value
- Calendar
object. If
the parameter value
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.dateResolution
- the resolution to use to compare dates. The higher the Resolution (year is highest) the better the performance.
supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
Constraint
between(java.util.Calendar, java.util.Calendar, DateTools.Resolution) but now no lower bound and upper bound not included
public Constraint contains(String value)
ConstraintBuilder
scope
. When the
scope
is just a .
, the search will be done on the entire document. When the scope
is
for example @myproject:title
, the free text search is done on this property only. You can also point to properties of
child nodes, for example a scope like myproject:paragraph/@myproject:header
contains
in class ConstraintBuilder
value
- the text to search on. If
the parameter fullTextSearch
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.Constraint
public Constraint notContains(String value)
ConstraintBuilder
ConstraintBuilder.contains(String)
notContains
in class ConstraintBuilder
value
- the text to search on. If
the parameter fullTextSearch
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.Constraint
ConstraintBuilder.contains(String)
public Constraint between(Object value1, Object value2)
ConstraintBuilder
Adds a constraint that the value fieldAttributeName
is between value1
and value2
(boundaries included).
note that for range queries on calendar/date instances where the granularity of, say Day, is enough, you
should use ConstraintBuilder.between(java.util.Calendar, java.util.Calendar, DateTools.Resolution)
with the highest resolution that is acceptable for your use case, as this performs much better, OR make sure
that your application runs with a default resolution set to for example 'day'
between
in class ConstraintBuilder
value1
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
. If
the parameter value1
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.value2
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
. If
the parameter value2
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.Constraint
public Constraint between(Calendar start, Calendar end, DateTools.Resolution dateResolution)
ConstraintBuilder
fieldAttributeName
is between start
and end
(boundaries included) BASED ON the
granularity resolution
. Thus suppose the Resolution is Resolution.DAY
, then results with the same DAY as value for fieldAttributeName
will be included. The higher the Resolution (year is highest) the better the performance!between
in class ConstraintBuilder
start
- the date to start from (including). If
the parameter start
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.end
- the date to end (including). If
the parameter end
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.dateResolution
- the resolution to use to compare dates. The higher the Resolution (year is highest) the better the performance.
supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
Constraint
public Constraint notBetween(Object value1, Object value2)
ConstraintBuilder
Adds a constraint that the value fieldAttributeName
is NOT between value1
and value2
,
including NOT value1
and value2
note that for range queries on calendar/date instances where the granularity of, say Day, is enough, you
should use ConstraintBuilder.notBetween(java.util.Calendar, java.util.Calendar, DateTools.Resolution)
with the highest resolution that is acceptable for your use case, as this performs much better, OR make sure
that your application runs with a default resolution set to for example 'day'
notBetween
in class ConstraintBuilder
value1
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
. If
the parameter value1
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.value2
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
. If
the parameter value2
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.Constraint
public Constraint notBetween(Calendar start, Calendar end, DateTools.Resolution dateResolution)
ConstraintBuilder
note: supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
notBetween
in class ConstraintBuilder
start
- the date to start from (including). If
the parameter start
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.end
- the date to end (including). If
the parameter end
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.dateResolution
- the resolution to use to compare dates. The higher the Resolution (year is highest) the better the performance.
supported resolutions are
DateTools.Resolution.YEAR
,
DateTools.Resolution.MONTH
,
DateTools.Resolution.DAY
or
DateTools.Resolution.HOUR
Constraint
between(String, java.util.Calendar, java.util.Calendar, DateTools.Resolution) but now negated
public Constraint like(String value)
ConstraintBuilder
This function is based on the LIKE predicate found in SQL. This method maps to jcr:like
as
jcr:like($property as attribute(), $pattern as xs:string)
. Also see JCR spec 1.0 6.6.5.1 jcr:like
usage: For example, the query “Find all documents whose myproject:title
property starts with
hip
”, is expressed as: addLike("myproject:title","hip%")
.
The %
after hip
is the wildcard.
This method is particularly helpful in key kind of fields, where the key values contain chars on which
Lucene text indexing tokenizes. For example, "give me all the documents that have a key that start with JIRA key
HSTTW0-23
" can be expressed as addLike("myproject:key","HSTTW0-23%")
.
This results in documents having key HSTTW0-2345
, HSTTW0-2357
, etc.
DO NOT USE '%' AS A PREFIX. Thus do not use a query like
addLike("myproject:key","%HSTTW0-23%")
. Note the prefix '%'. Prefix wildcards blow up in memory and CPU
as they cannot be efficiently done in Lucene.
like
in class ConstraintBuilder
value
- object that must be of type String. If
the parameter start
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.Constraint
public Constraint notLike(String value)
notLike
in class ConstraintBuilder
value
- object that must be of type String. If
the parameter start
is null
, this ConstraintBuilder
is ignored (unless another
constraint method is invoked without null
value.Constraint
only now inverted
public Constraint exists()
ConstraintBuilder
fieldAttributeName
, regardless its valueexists
in class ConstraintBuilder
Constraint
public Constraint notExists()
ConstraintBuilder
fieldAttributeName
notExists
in class ConstraintBuilder
Constraint
public Constraint jcrExpression(String value)
ConstraintBuilder
jcrExpression
as constraint. See jsr-170 spec for the xpath formatjcrExpression
in class ConstraintBuilder
value
- the jcrExpression
to include in thisConstraint
Copyright © 2008–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.