Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you change the name of a JCR node?

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.

like image 613
joksy82 Avatar asked Nov 12 '10 13:11

joksy82


People also ask

How do you name a node in AEM?

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.

How do I access JCR content?

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.


1 Answers

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();
    }
like image 93
stacker Avatar answered Oct 03 '22 08:10

stacker