Java JCR how to reorder nodes?

I am using Jackrabbit with JCR, how can I reorder the nodes?

+3
source share
1 answer

There are several ways:

1) Create a parent node type with the "orderable" option.

[ns:NodeType] > ns:ParentType1 orderable
....
..

Now you can use the [orderBefore] [1] method to order nodes.

2) Use the SQL / XPATH query to order returned nodes. eg

//element( *, blabla:nodes) order by
@blabla:title descending

[1]: http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/Node.html#orderBefore(java.lang.String , java.lang.String)

+5
source

Source: https://habr.com/ru/post/1727482/


All Articles