You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by David Kennedy <da...@us.ibm.com> on 2006/06/22 20:26:00 UTC
Finding copies of nodes
I have a parent node of a nodetype with a childNodeDefinition that allows
same-name siblings. I want to copy one of the children of the parent node
to the same parent (with the same name...just different index). The copy
method does not return the copied node. Is there a better way to get the
copy other than the following?
lock parent
get parent child nodes
get size of child nodes....storing last index
copy child to same parent
get node at stored index + 1
unlock parent
Why doesn't copy return the copied node? Another candidate for an
extension?
David
Re: Finding copies of nodes
Posted by Stefan Guggisberg <st...@gmail.com>.
On 6/22/06, David Kennedy <da...@us.ibm.com> wrote:
> I have a parent node of a nodetype with a childNodeDefinition that allows
> same-name siblings. I want to copy one of the children of the parent node
> to the same parent (with the same name...just different index). The copy
> method does not return the copied node. Is there a better way to get the
> copy other than the following?
>
> lock parent
> get parent child nodes
> get size of child nodes....storing last index
> copy child to same parent
> get node at stored index + 1
> unlock parent
>
> Why doesn't copy return the copied node? Another candidate for an
> extension?
this issue is already addressed in jsr-283:
https://jsr-283.dev.java.net/issues/show_bug.cgi?id=33
cheers
stefan
>
> David
>
Re: Finding copies of nodes
Posted by Tobias Bocanegra <to...@day.com>.
imo, the use of samename siblings is should be avoided. afaik was it
only introduced in order to be able to import xml documents. real
applications will have a more sophisticated datamodel.
but i agree, the 'copy' case is anoying.
regards, toby
On 6/22/06, David Kennedy <da...@us.ibm.com> wrote:
> I have a parent node of a nodetype with a childNodeDefinition that allows
> same-name siblings. I want to copy one of the children of the parent node
> to the same parent (with the same name...just different index). The copy
> method does not return the copied node. Is there a better way to get the
> copy other than the following?
>
> lock parent
> get parent child nodes
> get size of child nodes....storing last index
> copy child to same parent
> get node at stored index + 1
> unlock parent
>
> Why doesn't copy return the copied node? Another candidate for an
> extension?
>
> David
>
--
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---