Hey Mihai,

Look at the Workspace object, it contains methods for
copying/moving/cloning. Something like that could do the job:


String nodePath = "account/account-1/hub-1"
String newNodePath = "account/account-1/hub-2"

Workspace workspace = session.getWorkspace();
Workspace.copy( nodePath, newNodePath );


Please note, that you have to use absoulute paths (e.g. "/account/...") for
these operations.


For more detailed explanation of these functions you could also have a look
at the specification or at the apidoc, e.g. here:
http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/Workspace.htm


BR
Hendrik


> -----Original Message-----
> From: Mihai Anescu [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 10, 2007 9:04 PM
> To: [email protected]
> Subject: Can you copy/clone/duplicate a node structure in JR?
> 
> Hello,
> 
> I need some help.
> 
> I have a node; I get it by the path. Now I want to copy/clone/duplicate
> that node and all that are children of the node to another location
> (path). Something like this:
> 
> String nodePath = "account/account-1/hub-1"
> Node node = getNode( nodePath );
> 
> String newNodePath = "account/account-1/hub-2"
> 
> //this is what I would need:
> copuyNode( node, newNodePath );

Reply via email to