jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r398968 - /jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
Date Tue, 02 May 2006 15:43:37 GMT
Author: tripod
Date: Tue May  2 08:43:35 2006
New Revision: 398968

URL: http://svn.apache.org/viewcvs?rev=398968&view=rev
Log:
JCR-423 Node.restore() fails for existing non-versioned OPV=Version child nodes

Modified:
    jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java

Modified: jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewcvs/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=398968&r1=398967&r2=398968&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java Tue
May  2 08:43:35 2006
@@ -3784,9 +3784,8 @@
         while (iter.hasNext()) {
             NodeImpl n = (NodeImpl) iter.nextNode();
             if (!freeze.hasFrozenHistory(n.internalGetUUID())) {
-                if (n.getDefinition().getOnParentVersion() == OnParentVersionAction.COPY
-                        || n.getDefinition().getOnParentVersion() == OnParentVersionAction.VERSION)
{
-                    // only remove OPV=Copy or OPV=Version nodes
+                if (n.getDefinition().getOnParentVersion() == OnParentVersionAction.COPY)
{
+                    // only remove OPV=Copy nodes
                     n.internalRemove(true);
                 }
             }
@@ -3826,18 +3825,18 @@
                 // check if representing versionable already exists somewhere
                 if (itemMgr.itemExists(nodeId)) {
                     NodeImpl n = session.getNodeById(nodeId);
-                    if (n.getParent().isSame(this)) {
-                        // so order at end
-                        // orderBefore(n.getName(), "");
-                    } else if (removeExisting) {
+                    if (removeExisting) {
                         session.move(n.getPath(), getPath() + "/" + n.getName());
+                    } else if (n.getParent().isSame(this)) {
+                        n.internalRemove(true);
                     } else {
                         // since we delete the OPV=Copy children beforehand, all
                         // found nodes must be outside of this tree
                         throw new ItemExistsException("Unable to restore node, item already
exists outside of restored tree: "
                                 + n.safeGetJCRPath());
                     }
-                } else {
+                }
+                if (!itemMgr.itemExists(nodeId)) {
                     // get desired version from version selector
                     AbstractVersion v = (AbstractVersion) vsel.select(history);
                     NodeImpl node = addNode(child.getName(), v.getFrozenNode());



Mime
View raw message