public class FilterImpl extends Object implements Filter
Constructor and Description |
---|
FilterImpl(javax.jcr.Session session)
Deprecated.
since 2.24.13 / 2.26.01 : Use
FilterImpl(javax.jcr.Session, DateTools.Resolution)
instead |
FilterImpl(javax.jcr.Session session,
org.hippoecm.repository.util.DateTools.Resolution resolution) |
Modifier and Type | Method and Description |
---|---|
Filter |
addAndFilter(BaseFilter filter) |
void |
addBetween(String fieldAttributeName,
Calendar start,
Calendar end,
org.hippoecm.repository.util.DateTools.Resolution resolution)
Adds a FAST DATE RANGE constraint that the Calendar value for
fieldAttributeName is between start and end (boundaries included) BASED ON the
granularity resolution . |
void |
addBetween(String fieldAttributeName,
Object value1,
Object value2)
Adds a constraint that the value
fieldAttributeName is between value1 and value2 (boundaries included). |
void |
addContains(String scope,
String fullTextSearch)
Adds a fulltext search to this Filter.
|
void |
addEqualTo(String fieldAttributeName,
Calendar calendar,
org.hippoecm.repository.util.DateTools.Resolution resolution)
Adds a constraint that the Calendar value for
fieldAttributeName rounded to its resolution is equal to the
rounded value for calendar . |
void |
addEqualTo(String fieldAttributeName,
Object value)
Adds a constraint that the value
fieldAttributeName is equal to value |
void |
addGreaterOrEqualThan(String fieldAttributeName,
Calendar calendar,
org.hippoecm.repository.util.DateTools.Resolution resolution) |
void |
addGreaterOrEqualThan(String fieldAttributeName,
Object value)
Adds a constraint that the value
fieldAttributeName is greater than or equal to value |
void |
addGreaterThan(String fieldAttributeName,
Calendar calendar,
org.hippoecm.repository.util.DateTools.Resolution resolution) |
void |
addGreaterThan(String fieldAttributeName,
Object value)
Adds a constraint that the value
fieldAttributeName is greater than value |
void |
addIsNull(String fieldAttributeName)
Add a constraint that the result does NOT have the property
fieldAttributeName |
void |
addJCRExpression(String jcrExpression)
Adds the xpath
jcrExpression as constraint. |
void |
addLessOrEqualThan(String fieldAttributeName,
Calendar calendar,
org.hippoecm.repository.util.DateTools.Resolution resolution) |
void |
addLessOrEqualThan(String fieldAttributeName,
Object value)
Adds a constraint that the value
fieldAttributeName is less than or equal to value |
void |
addLessThan(String fieldAttributeName,
Calendar calendar,
org.hippoecm.repository.util.DateTools.Resolution resolution) |
void |
addLessThan(String fieldAttributeName,
Object value)
Adds a constraint that the value
fieldAttributeName is less than value |
void |
addLike(String fieldAttributeName,
Object value)
Try to not use this method as it blows up searches.
|
void |
addNotBetween(String fieldAttributeName,
Calendar start,
Calendar end,
org.hippoecm.repository.util.DateTools.Resolution resolution) |
void |
addNotBetween(String fieldAttributeName,
Object value1,
Object value2)
Adds a constraint that the value
fieldAttributeName is NOT between value1 and value2 ,
including NOT value1 and value2 |
void |
addNotContains(String scope,
String fullTextSearch)
The negated version of
Filter.addContains(String, String) |
void |
addNotEqualTo(String fieldAttributeName,
Calendar calendar,
org.hippoecm.repository.util.DateTools.Resolution resolution) |
void |
addNotEqualTo(String fieldAttributeName,
Object value)
Adds a constraint that the value
fieldAttributeName is NOT equal to value |
void |
addNotLike(String fieldAttributeName,
Object value)
Try to not use this method as it blows up searches.
|
void |
addNotNull(String fieldAttributeName)
Add a constraint that the result does have the property
fieldAttributeName , regardless its value |
Filter |
addOrFilter(BaseFilter filter) |
String |
getJcrExpression() |
String |
getStringValue(Object value) |
Filter |
negate()
negates the current filter
|
@Deprecated public FilterImpl(javax.jcr.Session session)
FilterImpl(javax.jcr.Session, DateTools.Resolution)
insteadpublic FilterImpl(javax.jcr.Session session, org.hippoecm.repository.util.DateTools.Resolution resolution)
public void addContains(String scope, String fullTextSearch) throws FilterException
Filter
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
addContains
in interface Filter
scope
- the scope to search in. scope = "."
means searching in the entire node/document. scope = "example:title"
only
searches in the property "example:title". scope
is also allowed to be a path to a property in a descendant node, for example scope = "address/example:street"
. The
latter is equivalent to scope = "address/@example:street"
fullTextSearch
- the text to search onFilterException
- when scope
or fullTextSearch
is null
public void addNotContains(String scope, String fullTextSearch) throws FilterException
Filter
Filter.addContains(String, String)
addNotContains
in interface Filter
scope
- the scope to search in. scope = "."
means searching in the entire node/document. scope = "example:title"
only
searches in the property "example:title". scope
is also allowed to be a path to a property in a descendant node, for example scope = "address/example:street"
. The
latter is equivalent to scope = "address/@example:street"
fullTextSearch
- the text to search onFilterException
- when scope
or fullTextSearch
is null
#addContains(String, String)}
public void addBetween(String fieldAttributeName, Object value1, Object value2) throws FilterException
Filter
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 Filter.addBetween(String, 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'
addBetween
in interface Filter
fieldAttributeName
- the name of the attribute, eg "hippo:lastModified"value1
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
value2
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
, value1
or value2
are invalid types/values or one of them is null
public void addBetween(String fieldAttributeName, Calendar start, Calendar end, org.hippoecm.repository.util.DateTools.Resolution resolution) throws FilterException
Filter
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!addBetween
in interface Filter
fieldAttributeName
- the name of the attribute, eg "hippo:lastModified"start
- the date to start from (including)end
- the date to end (including)resolution
- the resolution to use to compare dates. The higher the Resolution (year is highest) the better the performanFilterException
public void addNotBetween(String fieldAttributeName, Object value1, Object value2) throws FilterException
Filter
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 Filter.addNotBetween(String, 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'
addNotBetween
in interface Filter
fieldAttributeName
- the name of the attribute, eg "example:date"value1
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
value2
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
, value1
or value2
are invalid types/values or one of them is null
public void addNotBetween(String fieldAttributeName, Calendar start, Calendar end, org.hippoecm.repository.util.DateTools.Resolution resolution) throws FilterException
addNotBetween
in interface Filter
FilterException
#addBetween(String, java.util.Calendar, java.util.Calendar, DateTools.Resolution)} but now negated
public void addEqualTo(String fieldAttributeName, Object value) throws FilterException
Filter
fieldAttributeName
is equal to value
addEqualTo
in interface Filter
fieldAttributeName
- the name of the attribute, eg "example:author"value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
or value
is of invalid type/value or is null
public void addEqualTo(String fieldAttributeName, Calendar calendar, org.hippoecm.repository.util.DateTools.Resolution resolution) throws FilterException
Filter
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.addEqualTo
in interface Filter
FilterException
public void addNotEqualTo(String fieldAttributeName, Object value) throws FilterException
Filter
fieldAttributeName
is NOT equal to value
addNotEqualTo
in interface Filter
fieldAttributeName
- the name of the attribute, eg "example:author"value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
or value
is of invalid type/value or is null
public void addNotEqualTo(String fieldAttributeName, Calendar calendar, org.hippoecm.repository.util.DateTools.Resolution resolution) throws FilterException
addNotEqualTo
in interface Filter
FilterException
#addEqualTo(String, java.util.Calendar, DateTools.Resolution)} only now negated
public void addGreaterOrEqualThan(String fieldAttributeName, Object value) throws FilterException
Filter
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 Filter.addGreaterOrEqualThan(String, 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'
addGreaterOrEqualThan
in interface Filter
fieldAttributeName
- the name of the attribute, eg "example:date"value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
or value
is of invalid type/value or is null
public void addGreaterOrEqualThan(String fieldAttributeName, Calendar calendar, org.hippoecm.repository.util.DateTools.Resolution resolution) throws FilterException
addGreaterOrEqualThan
in interface Filter
FilterException
#addBetween(String, java.util.Calendar, java.util.Calendar, DateTools.Resolution)}
but now no upper bound
public void addGreaterThan(String fieldAttributeName, Object value) throws FilterException
Filter
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 Filter.addGreaterThan(String, 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'
addGreaterThan
in interface Filter
fieldAttributeName
- the name of the attribute, eg "example:date"value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
or value
is of invalid type/value or is null
public void addGreaterThan(String fieldAttributeName, Calendar calendar, org.hippoecm.repository.util.DateTools.Resolution resolution) throws FilterException
addGreaterThan
in interface Filter
FilterException
#addBetween(String, java.util.Calendar, java.util.Calendar, DateTools.Resolution)}
but now no upper bound and lower bound not included
public void addLessOrEqualThan(String fieldAttributeName, Object value) throws FilterException
Filter
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 Filter.addLessOrEqualThan(String, 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'
addLessOrEqualThan
in interface Filter
fieldAttributeName
- the name of the attribute, eg "example:date"value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
or value
is of invalid type/value or is null
public void addLessOrEqualThan(String fieldAttributeName, Calendar calendar, org.hippoecm.repository.util.DateTools.Resolution resolution) throws FilterException
addLessOrEqualThan
in interface Filter
FilterException
#addBetween(String, java.util.Calendar, java.util.Calendar, DateTools.Resolution)}
but now no lower bound
public void addLessThan(String fieldAttributeName, Object value) throws FilterException
Filter
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 Filter.addLessThan(String, 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'
addLessThan
in interface Filter
fieldAttributeName
- the name of the attribute, eg "example:date"value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
or value
is of invalid type/value or is null
public void addLessThan(String fieldAttributeName, Calendar calendar, org.hippoecm.repository.util.DateTools.Resolution resolution) throws FilterException
addLessThan
in interface Filter
FilterException
#addBetween(String, java.util.Calendar, java.util.Calendar, DateTools.Resolution)}
but now no lower bound and upper bound not included
public void addLike(String fieldAttributeName, Object value) throws FilterException
Filter
fieldAttributeName
matches *value
* where * is a any patternaddLike
in interface Filter
fieldAttributeName
- the name of the attribute, eg "example:author"value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
or value
is of invalid type/value or is null
public void addNotLike(String fieldAttributeName, Object value) throws FilterException
Filter
fieldAttributeName
does not match *value
* where * is a any patternaddNotLike
in interface Filter
fieldAttributeName
- the name of the attribute, eg "example:author"value
- object that must be of type String, Boolean, Long, Double, Calendar
or Date
FilterException
- when fieldAttributeName
or value
is of invalid type/value or is null
public void addNotNull(String fieldAttributeName) throws FilterException
Filter
fieldAttributeName
, regardless its valueaddNotNull
in interface Filter
fieldAttributeName
- the name of the attribute, eg "example:author"FilterException
- when fieldAttributeName
is null
public void addIsNull(String fieldAttributeName) throws FilterException
Filter
fieldAttributeName
addIsNull
in interface Filter
fieldAttributeName
- the name of the attribute, eg "example:author"FilterException
- when fieldAttributeName
is null
public void addJCRExpression(String jcrExpression)
Filter
jcrExpression
as constraint. See jsr-170 spec for the xpath formataddJCRExpression
in interface Filter
public Filter addOrFilter(BaseFilter filter)
addOrFilter
in interface Filter
filter
- to OR addedpublic Filter addAndFilter(BaseFilter filter)
addAndFilter
in interface Filter
filter
- to AND addedpublic String getJcrExpression()
getJcrExpression
in interface BaseFilter
public String getStringValue(Object value) throws FilterException
FilterException
Copyright © 2008-2013 Hippo B.V. (http://www.onehippo.com). All Rights Reserved.