jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hendrik Beck \(camunda\)" <hendrik.b...@camunda.com>
Subject RE: Can you copy/clone/duplicate a node structure in JR?
Date Tue, 10 Jul 2007 14:27:32 GMT
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:manescu@totalsoft.ro]
> Sent: Tuesday, July 10, 2007 9:04 PM
> To: users@jackrabbit.apache.org
> 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 );


Mime
View raw message