jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r178395 - in /incubator/jackrabbit/branches/ri-1.0/src/java/org/apache/jackrabbit/core: NodeImpl.java SessionImpl.java
Date Wed, 25 May 2005 07:11:28 GMT
Author: tripod
Date: Wed May 25 00:11:27 2005
New Revision: 178395

URL: http://svn.apache.org/viewcvs?rev=178395&view=rev
Log:
- optimize move operations (finally :-)

Modified:
    incubator/jackrabbit/branches/ri-1.0/src/java/org/apache/jackrabbit/core/NodeImpl.java
    incubator/jackrabbit/branches/ri-1.0/src/java/org/apache/jackrabbit/core/SessionImpl.java

Modified: incubator/jackrabbit/branches/ri-1.0/src/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/branches/ri-1.0/src/java/org/apache/jackrabbit/core/NodeImpl.java?rev=178395&r1=178394&r2=178395&view=diff
==============================================================================
--- incubator/jackrabbit/branches/ri-1.0/src/java/org/apache/jackrabbit/core/NodeImpl.java
(original)
+++ incubator/jackrabbit/branches/ri-1.0/src/java/org/apache/jackrabbit/core/NodeImpl.java
Wed May 25 00:11:27 2005
@@ -553,7 +553,10 @@
         thisState.removeChildNodeEntry(oldName, index);
         thisState.addChildNodeEntry(newName, uuid);
 
-        return (NodeImpl) itemMgr.getItem(new NodeId(uuid));
+        // create transient state of target, so that it gets modified.
+        NodeImpl target = (NodeImpl) itemMgr.getItem(new NodeId(uuid));
+        target.getOrCreateTransientItemState();
+        return target;
     }
 
     protected void removeChildProperty(String propName) throws RepositoryException {

Modified: incubator/jackrabbit/branches/ri-1.0/src/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/branches/ri-1.0/src/java/org/apache/jackrabbit/core/SessionImpl.java?rev=178395&r1=178394&r2=178395&view=diff
==============================================================================
--- incubator/jackrabbit/branches/ri-1.0/src/java/org/apache/jackrabbit/core/SessionImpl.java
(original)
+++ incubator/jackrabbit/branches/ri-1.0/src/java/org/apache/jackrabbit/core/SessionImpl.java
Wed May 25 00:11:27 2005
@@ -911,21 +911,24 @@
         }
 
         // check lock status
-
         srcParentNode.checkLock();
         destParentNode.checkLock();
 
-        // do move operation
-
         String targetUUID = ((NodeState) targetNode.getItemState()).getUUID();
-        // add target to new parent
-        destParentNode.createChildNodeLink(destName.getName(), targetUUID);
-        // remove target from old parent
         int index = srcName.getIndex();
         if (index == 0) {
             index = 1;
         }
-        srcParentNode.removeChildNode(srcName.getName(), index);
+
+        if (srcParentNode.isSame(destParentNode)) {
+            // do rename
+            destParentNode.renameChildNodeLink(srcName.getName(), index, targetUUID, destName.getName());
+        } else {
+            // do move
+            destParentNode.createChildNodeLink(destName.getName(), targetUUID);
+            srcParentNode.removeChildNode(srcName.getName(), index);
+        }
+
         // change definition of target if necessary
         NodeDefinitionImpl oldTargetDef = (NodeDefinitionImpl) targetNode.getDefinition();
         NodeDefId oldTargetDefId = oldTargetDef.unwrap().getId();



Mime
View raw message