You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Tanju Erinmez <ta...@gmail.com> on 2006/06/22 17:00:26 UTC

Problem with child order after restoring of parent

Greetings,

I'm using the latest trunk version and tried the following sequence
which leads to swapped child nodes (this worked in 1.0.1).
Specifically:

Add nodes:
  parent
    childA
    childB

Remove childA:
  parent
    childB

Restore initial version:
  parent
    childB
    childA

The parent node is of type nt:unstructured which carries an
OrderableChildNodes=true so I assumed that upon restoring the order
would be preserved.

What would be the correct behavior for this?

Cheers,
Tanju

--------------

TESTCASE used with both Derby & InMemPMs (boiled down beyond sense :)

// Add parent & childA, childB
Node parent = session.getRootNode().addNode("parent", "nt:unstructured");
parent.addMixin("mix:versionable");
Node c1 = parent.addNode("childA", "nt:unstructured");
c1.addMixin("mix:versionable");
Node c2 = parent.addNode("childB", "nt:unstructured");
c2.addMixin("mix:versionable");
session.save();
c1.checkin();
c2.checkin();
Version v1 = parent.checkin();
// OK : parent.getNodes() -> childA, childB

// Remove childA
parent = session.getRootNode().getNode("parent");
parent.checkout();
c1 = parent.getNodes().nextNode();
c1.checkout();
c1.remove();
session.save();
Version v2 = parent.checkin();
// OK : parent.getNodes() -> childA, childB

// Remove childA
parent = session.getRootNode().getNode("parent");
parent.restore(v1, true);
// Not OK : parent.getNodes() -> childB, childA

Re: Problem with child order after restoring of parent

Posted by Tobias Bocanegra <to...@day.com>.
this might be a bug. can you file a jira issue?

thanks.

regards, toby

On 6/22/06, Tanju Erinmez <ta...@gmail.com> wrote:
> Greetings,
>
> I'm using the latest trunk version and tried the following sequence
> which leads to swapped child nodes (this worked in 1.0.1).
> Specifically:
>
> Add nodes:
>   parent
>     childA
>     childB
>
> Remove childA:
>   parent
>     childB
>
> Restore initial version:
>   parent
>     childB
>     childA
>
> The parent node is of type nt:unstructured which carries an
> OrderableChildNodes=true so I assumed that upon restoring the order
> would be preserved.
>
> What would be the correct behavior for this?
>
> Cheers,
> Tanju
>
> --------------
>
> TESTCASE used with both Derby & InMemPMs (boiled down beyond sense :)
>
> // Add parent & childA, childB
> Node parent = session.getRootNode().addNode("parent", "nt:unstructured");
> parent.addMixin("mix:versionable");
> Node c1 = parent.addNode("childA", "nt:unstructured");
> c1.addMixin("mix:versionable");
> Node c2 = parent.addNode("childB", "nt:unstructured");
> c2.addMixin("mix:versionable");
> session.save();
> c1.checkin();
> c2.checkin();
> Version v1 = parent.checkin();
> // OK : parent.getNodes() -> childA, childB
>
> // Remove childA
> parent = session.getRootNode().getNode("parent");
> parent.checkout();
> c1 = parent.getNodes().nextNode();
> c1.checkout();
> c1.remove();
> session.save();
> Version v2 = parent.checkin();
> // OK : parent.getNodes() -> childA, childB
>
> // Remove childA
> parent = session.getRootNode().getNode("parent");
> parent.restore(v1, true);
> // Not OK : parent.getNodes() -> childB, childA
>


-- 
-----------------------------------------< 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 >---