Found a similar thread here: Need java code to convert the page names to lower case which a staff member posted this bit of code:
void rename(Node node, String newName) throws RepositoryException
{
node.getSession().move(node.getPath(), node.getParent().getPath() + "/" + newName.toLowerCase()); //
node.getSession().save();
}
which is close to what I need except that when its executed the node structure is changed and the newly named node is pushed to the bottom and I need it to maintain position in the structure.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
There is no explicit method to rename node in JCR, It can be done only by move method.
Since move method change the order of node but It can be reorder.
JCR 2.0: 23 Orderable Child Nodes (Content Repository for Java Technology API v2.0)
Views
Replies
Total Likes
See this thread here - it may help. I have never tried renaming a node via code.
java - How can you change the name of a JCR node? - Stack Overflow
Hope this helps...
Views
Replies
Total Likes
Hi,
There is no explicit method to rename node in JCR, It can be done only by move method.
Since move method change the order of node but It can be reorder.
JCR 2.0: 23 Orderable Child Nodes (Content Repository for Java Technology API v2.0)
Views
Replies
Total Likes
Yeah there is too many nodes to change manual for us so we us groovy scripts to do so. This code in your link is the same i have posted above. Which apparently is the only way to do it but I have found a way to reorder after the fact.
Views
Replies
Total Likes
Thank you the Node.OrderBefore(String srcChildRelPath, String destChildRelPath)
is exactly what I needed.
Views
Replies
Total Likes
Views
Likes
Replies