I'm trying to change the name of a JCR node, but I have no idea how? Has someone of you some hints?
Many thanks.
Adobe Experience Manager Sites & Moreif you use JCR query, you have a QueryResult object; on this you can execute "getNodes" to retrieve a NodeIterator object. Use this to get the actual nodes, and on the node you can call . getName(). I am using ACS-COMMONS page report tool page to generate a report for pages.
To access the CQ repository, you use the Java Content Repository (JCR) API. You can use the Java JCR API to perform create, replace, update, and delete (CRUD) operations on content located within the Adobe CQ repository. For more information about the Java JCR API, see https://jackrabbit.apache.org/jcr/jcr-api.html.
The Jackrabbit Wiki provides an example:
void rename(Node node, String newName) throws RepositoryException
{
node.getSession().move(node.getPath(), node.getParent().getPath() + "/" + newName);
// Don't forget - not necessarily here at this place:
// node.getSession().save();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With