Class OrderQueryNode
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.query.QueryNode
-
- org.apache.jackrabbit.spi.commons.query.OrderQueryNode
-
public class OrderQueryNode extends QueryNode
Implements a query node that defines the order of nodes according to the values of properties.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OrderQueryNode.OrderSpec
Implements a single order specification.
-
Field Summary
-
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Object
accept(QueryNodeVisitor visitor, java.lang.Object data)
Accepts aQueryNodeVisitor
and calls the appropriatevisit
method on the visitor depending on the concrete implementation of thisQueryNode
.void
addOrderSpec(OrderQueryNode.OrderSpec spec)
Adds an order specification to this query node.void
addOrderSpec(Name property, boolean ascending)
Deprecated.useaddOrderSpec(Path , boolean)
instead.void
addOrderSpec(Path property, boolean ascending)
Adds an order specification to this query node.boolean
equals(java.lang.Object obj)
Returnstrue
ifobj
is the same type ofQueryNode
asthis
node and is equal tothis
node.OrderQueryNode.OrderSpec[]
getOrderSpecs()
Returns aOrderSpec
array that contains order by specifications.int
getType()
Returns the type of this node.boolean
isAscending(int i)
Returnstrue
if the propertyi
should be ordered ascending.boolean
isValid()
Checks whether all order specifications of this query node have at least its path specified (i.e.boolean
needsSystemTree()
Returnstrue
if this query node needs items under /jcr:system to be queried.void
newOrderSpec()
Create and add a new (empty) order specification to this query node.void
setAscending(boolean value)
Set the last order specification of this query node to ascending/descendingvoid
setFunction(java.lang.String name)
Set the function of the last order specification of this query node.void
setPath(Path path)
Set the path of the last order specification of this query node.
-
-
-
Method Detail
-
getType
public int getType()
Returns the type of this node.
-
newOrderSpec
public void newOrderSpec()
Create and add a new (empty) order specification to this query node.
-
setAscending
public void setAscending(boolean value)
Set the last order specification of this query node to ascending/descending- Parameters:
value
-true
for ascending andfalse
for descending.- Throws:
java.lang.IllegalStateException
- if no order specification is set- See Also:
OrderQueryNode.OrderSpec.setAscending(boolean)
-
setPath
public void setPath(Path path)
Set the path of the last order specification of this query node.- Parameters:
path
- a path- Throws:
java.lang.IllegalStateException
- if no order specification is set- See Also:
OrderQueryNode.OrderSpec.setPath(org.apache.jackrabbit.spi.Path)
-
setFunction
public void setFunction(java.lang.String name)
Set the function of the last order specification of this query node.- Parameters:
name
- a function name- Throws:
java.lang.IllegalStateException
- if no order specification is set- See Also:
OrderQueryNode.OrderSpec.setFunction(String)
-
isValid
public boolean isValid()
Checks whether all order specifications of this query node have at least its path specified (i.e. nonnull
.)- Returns:
true
iff all order specification of this query node are valid.
-
addOrderSpec
public void addOrderSpec(Name property, boolean ascending)
Deprecated.useaddOrderSpec(Path , boolean)
instead.Adds an order specification to this query node.- Parameters:
property
- the name of the property.ascending
- iftrue
values of this properties are ordered ascending; descending iffalse
.
-
addOrderSpec
public void addOrderSpec(Path property, boolean ascending)
Adds an order specification to this query node.- Parameters:
property
- the relative path of the property.ascending
- iftrue
values of this properties are ordered ascending; descending iffalse
.
-
addOrderSpec
public void addOrderSpec(OrderQueryNode.OrderSpec spec)
Adds an order specification to this query node.- Parameters:
spec
- the order spec.
-
accept
public java.lang.Object accept(QueryNodeVisitor visitor, java.lang.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
-
isAscending
public boolean isAscending(int i) throws java.lang.IndexOutOfBoundsException
Returnstrue
if the propertyi
should be ordered ascending. Iffalse
the property is ordered descending.- Parameters:
i
- index of the property- Returns:
- the order spec for the property
i
. - Throws:
java.lang.IndexOutOfBoundsException
- if there is no property with indexi
.
-
getOrderSpecs
public OrderQueryNode.OrderSpec[] getOrderSpecs()
Returns aOrderSpec
array that contains order by specifications.- Returns:
- order by specs.
-
equals
public boolean equals(java.lang.Object obj)
Returnstrue
ifobj
is the same type ofQueryNode
asthis
node and is equal tothis
node.
-
needsSystemTree
public boolean needsSystemTree()
Returnstrue
if this query node needs items under /jcr:system to be queried.- Specified by:
needsSystemTree
in classQueryNode
- Returns:
true
if this query node needs content under /jcr:system to be queried;false
otherwise.
-
-