Interface QueryBuilder<T>
@ProviderType
public interface QueryBuilder<T>
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
The sort order of the result set of a query. -
Method Summary
Modifier and TypeMethodDescriptionReturn a condition which holds if both sub conditions hold.Create a full text search condition.Create a condition which holds if the node of anAuthorizable
has a property atrelPath
which is equal tovalue
.Create a condition which holds if the node of anAuthorizable
has a property atrelPath
.Create a condition which holds if the node of anAuthorizable
has a property atrelPath
which is greater than or equal tovalue
.Create a condition which holds if the node of anAuthorizable
has a property atrelPath
which is greater thanvalue
.impersonates
(@NotNull String name) Create a condition which holds forAuthorizable
s which can impersonate asname
.Create a condition which holds if the node of anAuthorizable
has a property atrelPath
which is smaller than or equal tovalue
.Create a condition which holds if the node of anAuthorizable
has a property atrelPath
which matches the pattern inpattern
.Create a condition which holds if the node of anAuthorizable
has a property atrelPath
which is smaller thanvalue
.nameMatches
(@NotNull String pattern) Create a condition which holds if the name of theAuthorizable
matches apattern
.Create a condition which holds if the node of anAuthorizable
has a property atrelPath
which is not equal tovalue
.Return a condition which holds ifcondition
does not hold.Return a condition which holds if any of the two sub conditions hold.void
setCondition
(T condition) Set the condition for the query.void
setLimit
(long offset, long maxCount) Set limits for the query.void
Set limits for the query.void
Set the scope for the query.void
setSelector
(@NotNull Class<? extends Authorizable> selector) Set the selector for the query.void
setSortOrder
(@NotNull String propertyName, @NotNull QueryBuilder.Direction direction) Set the sort order of theAuthorizable
s returned by the query.void
setSortOrder
(@NotNull String propertyName, @NotNull QueryBuilder.Direction direction, boolean ignoreCase) Set the sort order of theAuthorizable
s returned by the query.
-
Method Details
-
setSelector
Set the selector for the query. The selector determines whether the query returns allAuthorizable
s or justUser
s respectivelyGroup
s.- Parameters:
selector
- The selector for the query
-
setScope
Set the scope for the query. If set, the query will only return members of a specific group.- Parameters:
groupName
- Name of the group to restrict the query to.declaredOnly
- Iftrue
only declared members of the groups are returned. Otherwise indirect memberships are also considered.
-
setCondition
Set the condition for the query. The query only includesAuthorizable
s for which this condition holds.- Parameters:
condition
- Condition upon whichAuthorizables
are included in the query result
-
setSortOrder
void setSortOrder(@NotNull @NotNull String propertyName, @NotNull @NotNull QueryBuilder.Direction direction, boolean ignoreCase) Set the sort order of theAuthorizable
s returned by the query. The format of thepropertyName
is the same as in XPath:@propertyName
sorts on a property of the current node.relative/path/@propertyName
sorts on a property of a descendant node.- Parameters:
propertyName
- The name of the property to sort ondirection
- Direction to sort. EitherQueryBuilder.Direction.ASCENDING
orQueryBuilder.Direction.DESCENDING
ignoreCase
- Ignore character case in sort iftrue
. Note: Forfalse
sorting is done lexicographically even for non string properties.
-
setSortOrder
void setSortOrder(@NotNull @NotNull String propertyName, @NotNull @NotNull QueryBuilder.Direction direction) Set the sort order of theAuthorizable
s returned by the query. The format of thepropertyName
is the same as in XPath:@propertyName
sorts on a property of the current node.relative/path/@propertyName
sorts on a property of a descendant node. Character case is taken into account for the sort order.- Parameters:
propertyName
- The name of the property to sort ondirection
- Direction to sort. EitherQueryBuilder.Direction.ASCENDING
orQueryBuilder.Direction.DESCENDING
-
setLimit
Set limits for the query. The limits consists of a bound and a maximal number of results. The bound refers to the value of thesort order
property. The query returns at mostmaxCount
Authorizable
s whose values of the sort order property followbound
in the sort direction. This method has no effect if the sort order is not specified.- Parameters:
bound
- Bound from where to start returning results.null
for no boundmaxCount
- Maximal number of results to return. -1 for no limit.
-
setLimit
void setLimit(long offset, long maxCount) Set limits for the query. The limits consists of an offset and a maximal number of results.offset
refers to the offset within the full result set at which the returned result set should start expressed in terms of the number ofAuthorizable
s to skip.maxCount
sets the maximum size of the result set expressed in terms of the number of authorizables to return.- Parameters:
offset
- Offset from where to start returning results.0
for no offset.maxCount
- Maximal number of results to return. -1 for no limit.
-
nameMatches
Create a condition which holds if the name of theAuthorizable
matches apattern
. The percent character "%" represents any string of zero or more characters and the underscore character "_" represents any single character. Any literal use of these characters and the backslash character "\" must be escaped with a backslash character. The pattern is matched against theid
and theprincipal
.- Parameters:
pattern
- Pattern to match the name of an authorizable.- Returns:
- A condition
-
neq
Create a condition which holds if the node of anAuthorizable
has a property atrelPath
which is not equal tovalue
. The format of therelPath
argument is the same as in XPath:@attributeName
for an attribute on this node andrelative/path/@attributeName
for an attribute of a descendant node.- Parameters:
relPath
- Relative path from the authorizable's node to the propertyvalue
- Value to compare the property atrelPath
to- Returns:
- A condition
-
eq
Create a condition which holds if the node of anAuthorizable
has a property atrelPath
which is equal tovalue
. The format of therelPath
argument is the same as in XPath:@attributeName
for an attribute on this node andrelative/path/@attributeName
for an attribute of a descendant node.- Parameters:
relPath
- Relative path from the authorizable's node to the propertyvalue
- Value to compare the property atrelPath
to- Returns:
- A condition
-
lt
Create a condition which holds if the node of anAuthorizable
has a property atrelPath
which is smaller thanvalue
. The format of therelPath
argument is the same as in XPath:@attributeName
for an attribute on this node andrelative/path/@attributeName
for an attribute of a descendant node.- Parameters:
relPath
- Relative path from the authorizable's node to the propertyvalue
- Value to compare the property atrelPath
to- Returns:
- A condition
-
le
Create a condition which holds if the node of anAuthorizable
has a property atrelPath
which is smaller than or equal tovalue
. The format of therelPath
argument is the same as in XPath:@attributeName
for an attribute on this node andrelative/path/@attributeName
for an attribute of a descendant node.- Parameters:
relPath
- Relative path from the authorizable's node to the propertyvalue
- Value to compare the property atrelPath
to- Returns:
- A condition
-
gt
Create a condition which holds if the node of anAuthorizable
has a property atrelPath
which is greater thanvalue
. The format of therelPath
argument is the same as in XPath:@attributeName
for an attribute on this node andrelative/path/@attributeName
for an attribute of a descendant node.- Parameters:
relPath
- Relative path from the authorizable's node to the propertyvalue
- Value to compare the property atrelPath
to- Returns:
- A condition
-
ge
Create a condition which holds if the node of anAuthorizable
has a property atrelPath
which is greater than or equal tovalue
. The format of therelPath
argument is the same as in XPath:@attributeName
for an attribute on this node andrelative/path/@attributeName
for an attribute of a descendant node.- Parameters:
relPath
- Relative path from the authorizable's node to the propertyvalue
- Value to compare the property atrelPath
to- Returns:
- A condition
-
exists
Create a condition which holds if the node of anAuthorizable
has a property atrelPath
. The format of therelPath
argument is the same as in XPath:@attributeName
for an attribute on this node andrelative/path/@attributeName
for an attribute of a descendant node.- Parameters:
relPath
- Relative path from the authorizable's node to the property- Returns:
- A condition
-
like
Create a condition which holds if the node of anAuthorizable
has a property atrelPath
which matches the pattern inpattern
. The percent character "%" represents any string of zero or more characters and the underscore character "_" represents any single character. Any literal use of these characters and the backslash character "\" must be escaped with a backslash character. The format of therelPath
argument is the same as in XPath:@attributeName
for an attribute on this node andrelative/path/@attributeName
for an attribute of a descendant node.- Parameters:
relPath
- Relative path from the authorizable's node to the propertypattern
- Pattern to match the property atrelPath
against- Returns:
- A condition
-
contains
Create a full text search condition. The condition holds if the node of anAuthorizable
has a property atrelPath
for whichsearchExpr
yields results. The format of therelPath
argument is the same as in XPath:.
searches all properties of the current node,@attributeName
searches the attributeName property of the current node,relative/path/.
searches all properties of the descendant node at relative/path andrelative/path/@attributeName
searches the attributeName property of the descendant node at relative/path. The syntax ofsearchExpr
is[-]value { [OR] [-]value }
.- Parameters:
relPath
- Relative path from the authorizable's node to the propertysearchExpr
- A full text search expression- Returns:
- A condition
-
impersonates
Create a condition which holds forAuthorizable
s which can impersonate asname
.- Parameters:
name
- Name of an authorizable- Returns:
- A condition
-
not
Return a condition which holds ifcondition
does not hold.- Parameters:
condition
- Condition to negate- Returns:
- A condition
-
and
Return a condition which holds if both sub conditions hold.- Parameters:
condition1
- first sub conditioncondition2
- second sub condition- Returns:
- A condition
-
or
Return a condition which holds if any of the two sub conditions hold.- Parameters:
condition1
- first sub conditioncondition2
- second sub condition- Returns:
- A condition
-