org.apache.jackrabbit.core.security.user
Class XPathQueryBuilder

java.lang.Object
  extended by org.apache.jackrabbit.core.security.user.XPathQueryBuilder
All Implemented Interfaces:
QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>

public class XPathQueryBuilder
extends Object
implements QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.jackrabbit.api.security.user.QueryBuilder
QueryBuilder.Direction
 
Constructor Summary
XPathQueryBuilder()
           
 
Method Summary
 org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition and(org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition condition1, org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition condition2)
          Return a condition which holds iff both sub conditions hold.
 org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition contains(String relPath, String searchExpr)
          Create a full text search condition.
 org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition eq(String relPath, Value value)
          Create a condition which holds iff the node of an Authorizable has a property at relPath which is equal to value.
 org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition exists(String relPath)
          Create a condition which holds iff the node of an Authorizable has a property at relPath.
 org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition ge(String relPath, Value value)
          Create a condition which holds iff the node of an Authorizable has a property at relPath which is greater than or equal to value.
 String getGroupName()
           
 org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition gt(String relPath, Value value)
          Create a condition which holds iff the node of an Authorizable has a property at relPath which is greater than value.
 org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition impersonates(String name)
          Create a condition which holds for Authorizables which can impersonate as name.
 boolean isDeclaredMembersOnly()
           
 org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition le(String relPath, Value value)
          Create a condition which holds iff the node of an Authorizable has a property at relPath which is smaller than or equal to value.
 org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition like(String relPath, String pattern)
          Create a condition which holds iff the node of an Authorizable has a property at relPath which matches the pattern in pattern.
 org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition lt(String relPath, Value value)
          Create a condition which holds iff the node of an Authorizable has a property at relPath which is smaller than value.
 org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition nameMatches(String pattern)
          Create a condition which holds iff the name of the Authorizable matches a pattern.
 org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition neq(String relPath, Value value)
          Create a condition which holds iff the node of an Authorizable has a property at relPath which is not equal to value.
 org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition not(org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition condition)
          Return a condition which holds iff condition does not hold.
 org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition or(org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition condition1, org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition condition2)
          Return a condition which holds iff any of the two sub conditions hold.
 org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition property(String relPath, org.apache.jackrabbit.core.security.user.XPathQueryBuilder.RelationOp op, Value value)
           
 void setCondition(org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition condition)
          Set the condition for the query.
 void setLimit(long offset, long maxCount)
          Set limits for the query.
 void setLimit(Value bound, long maxCount)
          Set limits for the query.
 void setScope(String groupName, boolean declaredOnly)
          Set the scope for the query.
 void setSelector(Class<? extends Authorizable> selector)
          Set the selector for the query.
 void setSortOrder(String propertyName, QueryBuilder.Direction direction)
          Set the sort order of the Authorizables returned by the query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XPathQueryBuilder

public XPathQueryBuilder()
Method Detail

getGroupName

public String getGroupName()

isDeclaredMembersOnly

public boolean isDeclaredMembersOnly()

setSelector

public void setSelector(Class<? extends Authorizable> selector)
Description copied from interface: QueryBuilder
Set the selector for the query. The selector determines whether the query returns all Authorizables or just Users respectively Groups.

Specified by:
setSelector in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
selector - The selector for the query

setScope

public void setScope(String groupName,
                     boolean declaredOnly)
Description copied from interface: QueryBuilder
Set the scope for the query. If set, the query will only return members of a specific group.

Specified by:
setScope in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
groupName - Name of the group to restrict the query to.
declaredOnly - If true only declared members of the groups are returned. Otherwise indirect memberships are also considered.

setCondition

public void setCondition(org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition condition)
Description copied from interface: QueryBuilder
Set the condition for the query. The query only includes Authorizables for which this condition holds.

Specified by:
setCondition in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
condition - Condition upon which Authorizables are included in the query result

setSortOrder

public void setSortOrder(String propertyName,
                         QueryBuilder.Direction direction)
Description copied from interface: QueryBuilder
Set the sort order of the Authorizables returned by the query. The format of the propertyName 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.

Specified by:
setSortOrder in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
propertyName - The name of the property to sort on
direction - Direction to sort. Either QueryBuilder.Direction.ASCENDING or QueryBuilder.Direction.DESCENDING

setLimit

public void setLimit(Value bound,
                     long maxCount)
Description copied from interface: QueryBuilder
Set limits for the query. The limits consists of a bound and a maximal number of results. The bound refers to the value of the sort order property. The query returns at most maxCount Authorizables whose values of the sort order property follow bound in the sort direction. This method has no effect if the sort order is not specified.

Specified by:
setLimit in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
bound - Bound from where to start returning results. null for no bound
maxCount - Maximal number of results to return. -1 for no limit.

setLimit

public void setLimit(long offset,
                     long maxCount)
Description copied from interface: QueryBuilder
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 of Authorizables to skip. maxCount sets the maximum size of the result set expressed in terms of the number of authorizables to return.

Specified by:
setLimit in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
offset - Offset from where to start returning results. 0 for no offset.
maxCount - Maximal number of results to return. -1 for no limit.

property

public org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition property(String relPath,
                                                                                     org.apache.jackrabbit.core.security.user.XPathQueryBuilder.RelationOp op,
                                                                                     Value value)

nameMatches

public org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition nameMatches(String pattern)
Description copied from interface: QueryBuilder
Create a condition which holds iff the name of the Authorizable matches a pattern. 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 the id and the principal.

Specified by:
nameMatches in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
pattern - Pattern to match the property at relPath against
Returns:
A condition

neq

public org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition neq(String relPath,
                                                                                Value value)
Description copied from interface: QueryBuilder
Create a condition which holds iff the node of an Authorizable has a property at relPath which is not equal to value. The format of the relPath argument is the same as in XPath: @attributeName for an attribute on this node and relative/path/@attributeName for an attribute of a descendant node.

Specified by:
neq in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
relPath - Relative path from the authorizable's node to the property
value - Value to compare the property at relPath to
Returns:
A condition

eq

public org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition eq(String relPath,
                                                                               Value value)
Description copied from interface: QueryBuilder
Create a condition which holds iff the node of an Authorizable has a property at relPath which is equal to value. The format of the relPath argument is the same as in XPath: @attributeName for an attribute on this node and relative/path/@attributeName for an attribute of a descendant node.

Specified by:
eq in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
relPath - Relative path from the authorizable's node to the property
value - Value to compare the property at relPath to
Returns:
A condition

lt

public org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition lt(String relPath,
                                                                               Value value)
Description copied from interface: QueryBuilder
Create a condition which holds iff the node of an Authorizable has a property at relPath which is smaller than value. The format of the relPath argument is the same as in XPath: @attributeName for an attribute on this node and relative/path/@attributeName for an attribute of a descendant node.

Specified by:
lt in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
relPath - Relative path from the authorizable's node to the property
value - Value to compare the property at relPath to
Returns:
A condition

le

public org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition le(String relPath,
                                                                               Value value)
Description copied from interface: QueryBuilder
Create a condition which holds iff the node of an Authorizable has a property at relPath which is smaller than or equal to value. The format of the relPath argument is the same as in XPath: @attributeName for an attribute on this node and relative/path/@attributeName for an attribute of a descendant node.

Specified by:
le in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
relPath - Relative path from the authorizable's node to the property
value - Value to compare the property at relPath to
Returns:
A condition

gt

public org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition gt(String relPath,
                                                                               Value value)
Description copied from interface: QueryBuilder
Create a condition which holds iff the node of an Authorizable has a property at relPath which is greater than value. The format of the relPath argument is the same as in XPath: @attributeName for an attribute on this node and relative/path/@attributeName for an attribute of a descendant node.

Specified by:
gt in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
relPath - Relative path from the authorizable's node to the property
value - Value to compare the property at relPath to
Returns:
A condition

ge

public org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition ge(String relPath,
                                                                               Value value)
Description copied from interface: QueryBuilder
Create a condition which holds iff the node of an Authorizable has a property at relPath which is greater than or equal to value. The format of the relPath argument is the same as in XPath: @attributeName for an attribute on this node and relative/path/@attributeName for an attribute of a descendant node.

Specified by:
ge in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
relPath - Relative path from the authorizable's node to the property
value - Value to compare the property at relPath to
Returns:
A condition

exists

public org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition exists(String relPath)
Description copied from interface: QueryBuilder
Create a condition which holds iff the node of an Authorizable has a property at relPath. The format of the relPath argument is the same as in XPath: @attributeName for an attribute on this node and relative/path/@attributeName for an attribute of a descendant node.

Specified by:
exists in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
relPath - Relative path from the authorizable's node to the property
Returns:
A condition

like

public org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition like(String relPath,
                                                                                 String pattern)
Description copied from interface: QueryBuilder
Create a condition which holds iff the node of an Authorizable has a property at relPath which matches the pattern in pattern. 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 the relPath argument is the same as in XPath: @attributeName for an attribute on this node and relative/path/@attributeName for an attribute of a descendant node.

Specified by:
like in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
relPath - Relative path from the authorizable's node to the property
pattern - Pattern to match the property at relPath against
Returns:
A condition

contains

public org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition contains(String relPath,
                                                                                     String searchExpr)
Description copied from interface: QueryBuilder
Create a full text search condition. The condition holds iff the node of an Authorizable has a property at relPath for which searchExpr yields results. The format of the relPath 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 and relative/path/@attributeName searches the attributeName property of the descendant node at relative/path. The syntax of searchExpr is
[-]value { [OR] [-]value }
.

Specified by:
contains in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
relPath - Relative path from the authorizable's node to the property
searchExpr - A full text search expression
Returns:
A condition

impersonates

public org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition impersonates(String name)
Description copied from interface: QueryBuilder
Create a condition which holds for Authorizables which can impersonate as name.

Specified by:
impersonates in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
name - Name of an authorizable
Returns:
A condition

not

public org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition not(org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition condition)
Description copied from interface: QueryBuilder
Return a condition which holds iff condition does not hold.

Specified by:
not in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
condition - Condition to negate
Returns:
A condition

and

public org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition and(org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition condition1,
                                                                                org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition condition2)
Description copied from interface: QueryBuilder
Return a condition which holds iff both sub conditions hold.

Specified by:
and in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
condition1 - first sub condition
condition2 - second sub condition
Returns:
A condition

or

public org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition or(org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition condition1,
                                                                               org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition condition2)
Description copied from interface: QueryBuilder
Return a condition which holds iff any of the two sub conditions hold.

Specified by:
or in interface QueryBuilder<org.apache.jackrabbit.core.security.user.XPathQueryBuilder.Condition>
Parameters:
condition1 - first sub condition
condition2 - second sub condition
Returns:
A condition


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.