Class LocationStepQueryNode
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.query.QueryNode
-
- org.apache.jackrabbit.spi.commons.query.NAryQueryNode<QueryNode>
-
- org.apache.jackrabbit.spi.commons.query.LocationStepQueryNode
-
- Direct Known Subclasses:
DerefQueryNode
public class LocationStepQueryNode extends NAryQueryNode<QueryNode>
Defines a location step for querying the path of a node./foo -> descendants = false, nameTest = foo
//foo -> descendants = true, nameTest = foo
//* -> descendants = true, nameTest = null
/* -> descendants = false, nameTest = null
/ -> descendants = false, nameTest = ""
-
-
Field Summary
Fields Modifier and Type Field Description static Name
EMPTY_NAME
The empty name used in matching the root node.static int
LAST
Constant value for position index = last()static int
NONE
Constant value to indicate no position index-
Fields inherited from class org.apache.jackrabbit.spi.commons.query.NAryQueryNode
operands
-
Fields inherited from class org.apache.jackrabbit.spi.commons.query.QueryNode
TYPE_AND, TYPE_DEREF, TYPE_EXACT, TYPE_LOCATION, TYPE_NODETYPE, TYPE_NOT, TYPE_OR, TYPE_ORDER, TYPE_PATH, TYPE_PROP_FUNCTION, TYPE_RELATION, TYPE_ROOT, TYPE_TEXTSEARCH
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
LocationStepQueryNode(QueryNode parent)
Creates a newLocationStepQueryNode
that matches only the empty name (the repository root).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
accept(QueryNodeVisitor visitor, Object data)
Accepts aQueryNodeVisitor
and calls the appropriatevisit
method on the visitor depending on the concrete implementation of thisQueryNode
.void
addPredicate(QueryNode predicate)
Adds a predicate node to this location step.boolean
equals(Object obj)
Returnstrue
ifobj
is the same type ofQueryNode
asthis
node and is equal tothis
node.boolean
getIncludeDescendants()
Returnstrue
if this location step uses the descendant-or-self axis,false
if this step uses the child axis.int
getIndex()
Returns the position index for this step.Name
getNameTest()
Returns the label of the node for this location step, ornull
if the name test is '*'.QueryNode[]
getPredicates()
Returns the predicate nodes for this location step.int
getType()
Returns the type of this query node.void
setIncludeDescendants(boolean include)
Sets a new value for the includeDescendants property.void
setIndex(int index)
Sets the position index for this step.void
setNameTest(Name nameTest)
Sets a new name test.-
Methods inherited from class org.apache.jackrabbit.spi.commons.query.NAryQueryNode
acceptOperands, addOperand, getNumOperands, getOperands, needsSystemTree, removeOperand
-
-
-
-
Field Detail
-
LAST
public static final int LAST
Constant value for position index = last()- See Also:
- Constant Field Values
-
NONE
public static final int NONE
Constant value to indicate no position index- See Also:
- Constant Field Values
-
EMPTY_NAME
public static final Name EMPTY_NAME
The empty name used in matching the root node. This is an implementation specific constant as the empty name is not a valid JCR name. TODO: The root location step should be refactored somehow
-
-
Constructor Detail
-
LocationStepQueryNode
protected LocationStepQueryNode(QueryNode parent)
Creates a newLocationStepQueryNode
that matches only the empty name (the repository root). The created location step uses only the child axis.- Parameters:
parent
- the parent of this query node.
-
-
Method Detail
-
getNameTest
public Name getNameTest()
Returns the label of the node for this location step, ornull
if the name test is '*'.- Returns:
- the label of the node for this location step.
-
setNameTest
public void setNameTest(Name nameTest)
Sets a new name test.- Parameters:
nameTest
- the name test ornull
to match all names.
-
getIncludeDescendants
public boolean getIncludeDescendants()
Returnstrue
if this location step uses the descendant-or-self axis,false
if this step uses the child axis.- Returns:
true
if this step uses the descendant-or-self axis.
-
setIncludeDescendants
public void setIncludeDescendants(boolean include)
Sets a new value for the includeDescendants property.- Parameters:
include
- the new value.- See Also:
getIncludeDescendants()
-
addPredicate
public void addPredicate(QueryNode predicate)
Adds a predicate node to this location step.- Parameters:
predicate
- the node to add.
-
getPredicates
public QueryNode[] getPredicates()
Returns the predicate nodes for this location step. This method may also return a position predicate.- Returns:
- the predicate nodes or an empty array if there are no predicates for this location step.
-
setIndex
public void setIndex(int index)
Sets the position index for this step. A value ofNONE
indicates that this location step has no position index assigned. That is, the step selects all same name siblings.- Parameters:
index
- the position index.
-
getIndex
public int getIndex()
Returns the position index for this step. A value ofNONE
indicates that this location step has no position index assigned. That is, the step selects all same name siblings.- Returns:
- the position index for this step.
-
accept
public Object accept(QueryNodeVisitor visitor, Object data) throws RepositoryException
Accepts aQueryNodeVisitor
and calls the appropriatevisit
method on the visitor depending on the concrete implementation of thisQueryNode
.- Specified by:
accept
in classQueryNode
- Parameters:
visitor
- the visitor to call back.data
- arbitrary data for the visitor.- Returns:
- the return value of the
visitor.visit()
call. - Throws:
RepositoryException
-
getType
public int getType()
Returns the type of this query node.
-
equals
public boolean equals(Object obj)
Returnstrue
ifobj
is the same type ofQueryNode
asthis
node and is equal tothis
node.- Overrides:
equals
in classNAryQueryNode<QueryNode>
- Parameters:
obj
- the reference object with which to compare.- Returns:
true
ifobj
is equal tothis
;false
otherwise.
-
-