Interface QueryBuilder<T>
-
@ProviderType public interface QueryBuilder<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classQueryBuilder.DirectionThe sort order of the result set of a query.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Tand(T condition1, T condition2)Return a condition which holds if both sub conditions hold.Tcontains(@NotNull String relPath, @NotNull String searchExpr)Create a full text search condition.Teq(@NotNull String relPath, @NotNull Value value)Create a condition which holds if the node of anAuthorizablehas a property atrelPathwhich is equal tovalue.Texists(@NotNull String relPath)Create a condition which holds if the node of anAuthorizablehas a property atrelPath.Tge(@NotNull String relPath, @NotNull Value value)Create a condition which holds if the node of anAuthorizablehas a property atrelPathwhich is greater than or equal tovalue.Tgt(@NotNull String relPath, @NotNull Value value)Create a condition which holds if the node of anAuthorizablehas a property atrelPathwhich is greater thanvalue.Timpersonates(@NotNull String name)Create a condition which holds forAuthorizables which can impersonate asname.Tle(@NotNull String relPath, @NotNull Value value)Create a condition which holds if the node of anAuthorizablehas a property atrelPathwhich is smaller than or equal tovalue.Tlike(@NotNull String relPath, @NotNull String pattern)Create a condition which holds if the node of anAuthorizablehas a property atrelPathwhich matches the pattern inpattern.Tlt(@NotNull String relPath, @NotNull Value value)Create a condition which holds if the node of anAuthorizablehas a property atrelPathwhich is smaller thanvalue.TnameMatches(@NotNull String pattern)Create a condition which holds if the name of theAuthorizablematches apattern.Tneq(@NotNull String relPath, @NotNull Value value)Create a condition which holds if the node of anAuthorizablehas a property atrelPathwhich is not equal tovalue.Tnot(T condition)Return a condition which holds ifconditiondoes not hold.Tor(T condition1, T condition2)Return a condition which holds if any of the two sub conditions hold.voidsetCondition(T condition)Set the condition for the query.voidsetLimit(long offset, long maxCount)Set limits for the query.voidsetLimit(@Nullable Value bound, long maxCount)Set limits for the query.voidsetScope(@NotNull String groupName, boolean declaredOnly)Set the scope for the query.voidsetSelector(@NotNull Class<? extends Authorizable> selector)Set the selector for the query.voidsetSortOrder(@NotNull String propertyName, @NotNull QueryBuilder.Direction direction)Set the sort order of theAuthorizables returned by the query.voidsetSortOrder(@NotNull String propertyName, @NotNull QueryBuilder.Direction direction, boolean ignoreCase)Set the sort order of theAuthorizables returned by the query.
-
-
-
Method Detail
-
setSelector
void setSelector(@NotNull @NotNull Class<? extends Authorizable> selector)Set the selector for the query. The selector determines whether the query returns allAuthorizables or justUsers respectivelyGroups.- Parameters:
selector- The selector for the query
-
setScope
void setScope(@NotNull @NotNull String groupName, boolean declaredOnly)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- Iftrueonly declared members of the groups are returned. Otherwise indirect memberships are also considered.
-
setCondition
void setCondition(@NotNull T condition)Set the condition for the query. The query only includesAuthorizables for which this condition holds.- Parameters:
condition- Condition upon whichAuthorizablesare included in the query result
-
setSortOrder
void setSortOrder(@NotNull @NotNull String propertyName, @NotNull @NotNull QueryBuilder.Direction direction, boolean ignoreCase)Set the sort order of theAuthorizables returned by the query. The format of thepropertyNameis the same as in XPath:@propertyNamesorts on a property of the current node.relative/path/@propertyNamesorts on a property of a descendant node.- Parameters:
propertyName- The name of the property to sort ondirection- Direction to sort. EitherQueryBuilder.Direction.ASCENDINGorQueryBuilder.Direction.DESCENDINGignoreCase- Ignore character case in sort iftrue. Note: Forfalsesorting 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 theAuthorizables returned by the query. The format of thepropertyNameis the same as in XPath:@propertyNamesorts on a property of the current node.relative/path/@propertyNamesorts 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.ASCENDINGorQueryBuilder.Direction.DESCENDING
-
setLimit
void setLimit(@Nullable @Nullable Value bound, long maxCount)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 orderproperty. The query returns at mostmaxCountAuthorizables whose values of the sort order property followboundin the sort direction. This method has no effect if the sort order is not specified.- Parameters:
bound- Bound from where to start returning results.nullfor 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.offsetrefers to the offset within the full result set at which the returned result set should start expressed in terms of the number ofAuthorizables to skip.maxCountsets 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.0for no offset.maxCount- Maximal number of results to return. -1 for no limit.
-
nameMatches
@NotNull T nameMatches(@NotNull @NotNull String pattern)
Create a condition which holds if the name of theAuthorizablematches 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 theidand theprincipal.- Parameters:
pattern- Pattern to match the name of an authorizable.- Returns:
- A condition
-
neq
@NotNull T neq(@NotNull @NotNull String relPath, @NotNull @NotNull Value value)
Create a condition which holds if the node of anAuthorizablehas a property atrelPathwhich is not equal tovalue. The format of therelPathargument is the same as in XPath:@attributeNamefor an attribute on this node andrelative/path/@attributeNamefor an attribute of a descendant node.- Parameters:
relPath- Relative path from the authorizable's node to the propertyvalue- Value to compare the property atrelPathto- Returns:
- A condition
-
eq
@NotNull T eq(@NotNull @NotNull String relPath, @NotNull @NotNull Value value)
Create a condition which holds if the node of anAuthorizablehas a property atrelPathwhich is equal tovalue. The format of therelPathargument is the same as in XPath:@attributeNamefor an attribute on this node andrelative/path/@attributeNamefor an attribute of a descendant node.- Parameters:
relPath- Relative path from the authorizable's node to the propertyvalue- Value to compare the property atrelPathto- Returns:
- A condition
-
lt
@NotNull T lt(@NotNull @NotNull String relPath, @NotNull @NotNull Value value)
Create a condition which holds if the node of anAuthorizablehas a property atrelPathwhich is smaller thanvalue. The format of therelPathargument is the same as in XPath:@attributeNamefor an attribute on this node andrelative/path/@attributeNamefor an attribute of a descendant node.- Parameters:
relPath- Relative path from the authorizable's node to the propertyvalue- Value to compare the property atrelPathto- Returns:
- A condition
-
le
@NotNull T le(@NotNull @NotNull String relPath, @NotNull @NotNull Value value)
Create a condition which holds if the node of anAuthorizablehas a property atrelPathwhich is smaller than or equal tovalue. The format of therelPathargument is the same as in XPath:@attributeNamefor an attribute on this node andrelative/path/@attributeNamefor an attribute of a descendant node.- Parameters:
relPath- Relative path from the authorizable's node to the propertyvalue- Value to compare the property atrelPathto- Returns:
- A condition
-
gt
@NotNull T gt(@NotNull @NotNull String relPath, @NotNull @NotNull Value value)
Create a condition which holds if the node of anAuthorizablehas a property atrelPathwhich is greater thanvalue. The format of therelPathargument is the same as in XPath:@attributeNamefor an attribute on this node andrelative/path/@attributeNamefor an attribute of a descendant node.- Parameters:
relPath- Relative path from the authorizable's node to the propertyvalue- Value to compare the property atrelPathto- Returns:
- A condition
-
ge
@NotNull T ge(@NotNull @NotNull String relPath, @NotNull @NotNull Value value)
Create a condition which holds if the node of anAuthorizablehas a property atrelPathwhich is greater than or equal tovalue. The format of therelPathargument is the same as in XPath:@attributeNamefor an attribute on this node andrelative/path/@attributeNamefor an attribute of a descendant node.- Parameters:
relPath- Relative path from the authorizable's node to the propertyvalue- Value to compare the property atrelPathto- Returns:
- A condition
-
exists
@NotNull T exists(@NotNull @NotNull String relPath)
Create a condition which holds if the node of anAuthorizablehas a property atrelPath. The format of therelPathargument is the same as in XPath:@attributeNamefor an attribute on this node andrelative/path/@attributeNamefor an attribute of a descendant node.- Parameters:
relPath- Relative path from the authorizable's node to the property- Returns:
- A condition
-
like
@NotNull T like(@NotNull @NotNull String relPath, @NotNull @NotNull String pattern)
Create a condition which holds if the node of anAuthorizablehas a property atrelPathwhich 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 therelPathargument is the same as in XPath:@attributeNamefor an attribute on this node andrelative/path/@attributeNamefor an attribute of a descendant node.- Parameters:
relPath- Relative path from the authorizable's node to the propertypattern- Pattern to match the property atrelPathagainst- Returns:
- A condition
-
contains
@NotNull T contains(@NotNull @NotNull String relPath, @NotNull @NotNull String searchExpr)
Create a full text search condition. The condition holds if the node of anAuthorizablehas a property atrelPathfor whichsearchExpryields results. The format of therelPathargument is the same as in XPath:.searches all properties of the current node,@attributeNamesearches the attributeName property of the current node,relative/path/.searches all properties of the descendant node at relative/path andrelative/path/@attributeNamesearches the attributeName property of the descendant node at relative/path. The syntax ofsearchExpris[-]value { [OR] [-]value }.- Parameters:
relPath- Relative path from the authorizable's node to the propertysearchExpr- A full text search expression- Returns:
- A condition
-
impersonates
@NotNull T impersonates(@NotNull @NotNull String name)
Create a condition which holds forAuthorizables which can impersonate asname.- Parameters:
name- Name of an authorizable- Returns:
- A condition
-
not
@NotNull T not(@NotNull T condition)
Return a condition which holds ifconditiondoes not hold.- Parameters:
condition- Condition to negate- Returns:
- A condition
-
and
@NotNull T and(@NotNull T condition1, @NotNull T condition2)
Return a condition which holds if both sub conditions hold.- Parameters:
condition1- first sub conditioncondition2- second sub condition- Returns:
- A condition
-
-