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

Reply via email to