You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Przemyslaw Pakulski <pr...@cognifide.com> on 2005/11/16 23:02:30 UTC
How to clone single node only ?
Hi,
It is possible to clone node without all subtree ?
Maybe I missed something, but I can't find any method to do that using
JCR API.
Any ideas how to solve this issue ?
I wonder if exportDocumentView, importXML methods is a good workaround
to clone single node into other workspace ?
Regards
Przemo
Re: How to clone single node only ?
Posted by Gennady Azarenkov <ga...@gmail.com>.
if you do not have corresp node you have to clone it - no other way AFAIK.
in this case you can clone and remove children as suggested before :)
regards,
Gennady Azarenkov
eXo platform
----- Original Message -----
From: "Przemyslaw Pakulski" <pp...@o2.pl>
To: <ja...@incubator.apache.org>
Sent: Thursday, November 17, 2005 1:05 PM
Subject: Re: How to clone single node only ?
>> looks like you need to copy the corresponding node's property only right?
>> why do not just get corresponding node from source workspace
>> (using getCorrespondingPath()), remove all properties
>> from target and replace them with source node's properties if so
>> (and maybe to do the same with mixin types ;) )
>
> yes, i need to copy properties, but how to create corresponding node (with
> the same uuid) in target workspace ?
>
> Regards
> Przemo
>
Re: How to clone single node only ?
Posted by Przemyslaw Pakulski <pp...@o2.pl>.
> looks like you need to copy the corresponding node's property only right?
> why do not just get corresponding node from source workspace
> (using getCorrespondingPath()), remove all properties
> from target and replace them with source node's properties if so
> (and maybe to do the same with mixin types ;) )
yes, i need to copy properties, but how to create corresponding node
(with the same uuid) in target workspace ?
Regards
Przemo
Re: How to clone single node only ?
Posted by Gennady Azarenkov <ga...@gmail.com>.
looks like you need to copy the corresponding node's property only right?
why do not just get corresponding node from source workspace
(using getCorrespondingPath()), remove all properties
from target and replace them with source node's properties if so
(and maybe to do the same with mixin types ;) )
regards,
Gennady Azarenkov
eXo platform
----- Original Message -----
From: "Przemyslaw Pakulski" <pr...@cognifide.com>
To: <ja...@incubator.apache.org>
Sent: Thursday, November 17, 2005 12:02 AM
Subject: How to clone single node only ?
> Hi,
>
> It is possible to clone node without all subtree ?
> Maybe I missed something, but I can't find any method to do that using
> JCR API.
>
> Any ideas how to solve this issue ?
> I wonder if exportDocumentView, importXML methods is a good workaround
> to clone single node into other workspace ?
>
> Regards
> Przemo
>
Re: How to clone single node only ?
Posted by Przemyslaw Pakulski <pr...@cognifide.com>.
> Another option is copy the node to the destination workspace and remove all
> the children. You can remove the children before (copy it first to a
> temporary directory on the first workspace) or after copying the node.
I need to create corresponding node with the same UUID, so I can't use
copy methods.
Cloning subtree and then removing children is not acceptable too,
because in target workspace already can exists corresponding nodes from
cloning subtree. Then Workspoace.clone method throws exception or can
remove existing nodes. Any of this possibilities don't solve my problem.
Regards
Przemo
Re: How to clone single node only ?
Posted by Martin Perez <mp...@gmail.com>.
good point!
On 11/17/05, Marcel Reutegger <ma...@gmx.net> wrote:
>
> Martin Perez wrote:
> > Another option is copy the node to the destination workspace and remove
> all
> > the children. You can remove the children before (copy it first to a
> > temporary directory on the first workspace) or after copying the node.
>
> please note, that copying a node and cloning a node is not the same!
> When you clone a node it will have the same uuid as the original node.
> When you copy a node it will get a new uuid and if it is versionable it
> will have a different version history than the original node.
>
> regards
> marcel
>
Re: How to clone single node only ?
Posted by Marcel Reutegger <ma...@gmx.net>.
Martin Perez wrote:
> Another option is copy the node to the destination workspace and remove all
> the children. You can remove the children before (copy it first to a
> temporary directory on the first workspace) or after copying the node.
please note, that copying a node and cloning a node is not the same!
When you clone a node it will have the same uuid as the original node.
When you copy a node it will get a new uuid and if it is versionable it
will have a different version history than the original node.
regards
marcel
Re: How to clone single node only ?
Posted by Martin Perez <mp...@gmail.com>.
Hi.
Well, I think that you can use import/export methods, but if you have read
the recent messages you'll know that the document view must not necessary to
be complete.
Another option is copy the node to the destination workspace and remove all
the children. You can remove the children before (copy it first to a
temporary directory on the first workspace) or after copying the node.
Regards.
Martin
On 11/16/05, Przemyslaw Pakulski <pr...@cognifide.com> wrote:
>
> Hi,
>
> It is possible to clone node without all subtree ?
> Maybe I missed something, but I can't find any method to do that using
> JCR API.
>
> Any ideas how to solve this issue ?
> I wonder if exportDocumentView, importXML methods is a good workaround
> to clone single node into other workspace ?
>
> Regards
> Przemo
>
>