Java JCR how to change order of nodes?
I am using Jackrabbit with JCR, how can I开发者_JAVA百科 change the order of the nodes?
There are a number of ways;
1) Create a parent node type with the option "orderable".
[ns:NodeType] > ns:ParentType1 orderable
....
..
Now you can use the [orderBefore][1] method to order the nodes.
2) Use can use a SQL/XPATH query to order the nodes returned. e.g.
//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)
精彩评论