Class OrderQueryNode
java.lang.Object
org.apache.jackrabbit.spi.commons.query.QueryNode
org.apache.jackrabbit.spi.commons.query.OrderQueryNode
Implements a query node that defines the order of nodes according to the
values of properties.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
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
Modifier and TypeMethodDescriptionaccept
(QueryNodeVisitor visitor, Object data) Accepts aQueryNodeVisitor
and calls the appropriatevisit
method on the visitor depending on the concrete implementation of thisQueryNode
.void
Adds an order specification to this query node.void
addOrderSpec
(Name property, boolean ascending) Deprecated.void
addOrderSpec
(Path property, boolean ascending) Adds an order specification to this query node.boolean
Returnstrue
ifobj
is the same type ofQueryNode
asthis
node and is equal tothis
node.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
Returnstrue
if this query node needs items under /jcr:system to be queried.void
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
(String name) Set the function of the last order specification of this query node.void
Set the path of the last order specification of this query node.
-
Method Details
-
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:
IllegalStateException
- if no order specification is set- See Also:
-
setPath
Set the path of the last order specification of this query node.- Parameters:
path
- a path- Throws:
IllegalStateException
- if no order specification is set- See Also:
-
setFunction
Set the function of the last order specification of this query node.- Parameters:
name
- a function name- Throws:
IllegalStateException
- if no order specification is set- See Also:
-
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
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
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
Adds an order specification to this query node.- Parameters:
spec
- the order spec.
-
accept
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
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:
IndexOutOfBoundsException
- if there is no property with indexi
.
-
getOrderSpecs
Returns aOrderSpec
array that contains order by specifications.- Returns:
- order by specs.
-
equals
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.
-
addOrderSpec(Path, boolean)
instead.