Return-Path: Delivered-To: apmail-jackrabbit-users-archive@locus.apache.org Received: (qmail 47435 invoked from network); 10 Jul 2007 14:27:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Jul 2007 14:27:56 -0000 Received: (qmail 84895 invoked by uid 500); 10 Jul 2007 14:27:57 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 84880 invoked by uid 500); 10 Jul 2007 14:27:57 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 84867 invoked by uid 99); 10 Jul 2007 14:27:57 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jul 2007 07:27:57 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [89.149.215.132] (HELO europe.computation.de) (89.149.215.132) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jul 2007 07:27:53 -0700 Received: (qmail 21773 invoked by uid 89); 10 Jul 2007 14:27:38 -0000 Received: from unknown (HELO hendrik) (88.65.172.19) by 0 with SMTP; 10 Jul 2007 14:27:38 -0000 From: "Hendrik Beck \(camunda\)" To: Subject: RE: Can you copy/clone/duplicate a node structure in JR? Date: Tue, 10 Jul 2007 21:27:32 +0700 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 In-Reply-To: <62A1225A562C114FA7D70C58B5D35A42028C217A@mailer.totalsoft.local> Thread-Index: AcfC8dIxvUL0WdkdTnK65RPCcQWmtwAB8AoAAABIxTAAAJ0yQA== X-Virus-Checked: Checked by ClamAV on apache.org Message-Id: <20070710142754.67DC010FB033@herse.apache.org> 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 );