jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r581636 - in /jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: SessionImpl.java WorkspaceImpl.java operation/Move.java
Date Wed, 03 Oct 2007 15:43:49 GMT
Author: angela
Date: Wed Oct  3 08:43:48 2007
New Revision: 581636

URL: http://svn.apache.org/viewvc?rev=581636&view=rev
Log:
Omit check for existing prop/node upon Workspace.move()

Modified:
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java?rev=581636&r1=581635&r2=581636&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
Wed Oct  3 08:43:48 2007
@@ -304,7 +304,7 @@
         Path destPath = getQPath(destAbsPath);
 
         // all validation is performed by Move Operation and state-manager
-        Operation op = Move.create(srcPath, destPath, getHierarchyManager(), getNamespaceResolver());
+        Operation op = Move.create(srcPath, destPath, getHierarchyManager(), getNamespaceResolver(),
true);
         itemStateManager.execute(op);
     }
 

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java?rev=581636&r1=581635&r2=581636&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
Wed Oct  3 08:43:48 2007
@@ -233,7 +233,7 @@
         Path srcPath = session.getQPath(srcAbsPath);
         Path destPath = session.getQPath(destAbsPath);
 
-        Operation op = Move.create(srcPath, destPath, getHierarchyManager(), getNamespaceResolver());
+        Operation op = Move.create(srcPath, destPath, getHierarchyManager(), getNamespaceResolver(),
false);
         getUpdatableItemStateManager().execute(op);
     }
 

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java?rev=581636&r1=581635&r2=581636&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Move.java
Wed Oct  3 08:43:48 2007
@@ -123,7 +123,9 @@
 
     //------------------------------------------------------------< Factory >---
     public static Operation create(Path srcPath, Path destPath,
-                                   HierarchyManager hierMgr, NamespaceResolver nsResolver)
+                                   HierarchyManager hierMgr,
+                                   NamespaceResolver nsResolver,
+                                   boolean sessionMove)
         throws ItemExistsException, NoSuchNodeTypeException, RepositoryException {
         // src must not be ancestor of destination
         try {
@@ -158,21 +160,24 @@
         NodeState destParentState = getNodeState(destPath.getAncestor(1), hierMgr, nsResolver);
         QName destName = destElement.getName();
 
-        // lazy check for existing items at destination. since the hierarchy
-        // may not be complete it is possible that an conflict is only detected
-        // upon saving the 'move'.
+        // for session-move perform a lazy check for existing items at destination.
+        // since the hierarchy may not be complete it is possible that an conflict
+        // is only detected upon saving the 'move'.
         NodeEntry destEntry = (NodeEntry) destParentState.getHierarchyEntry();
-        if (destEntry.hasPropertyEntry(destName)) {
-            throw new ItemExistsException("Move destination already exists (Property).");
-        } else if (destEntry.hasNodeEntry(destName)) {
-            NodeEntry existing = destEntry.getNodeEntry(destName, Path.INDEX_DEFAULT);
-            if (existing != null) {
-                try {
-                    if (!existing.getNodeState().getDefinition().allowsSameNameSiblings())
{
-                        throw new ItemExistsException("Node existing at move destination
does not allow same name siblings.");
+        if (sessionMove) {
+            if (destEntry.hasPropertyEntry(destName)) {
+                throw new ItemExistsException("Move destination already exists (Property).");
+            }
+            if (destEntry.hasNodeEntry(destName)) {
+                NodeEntry existing = destEntry.getNodeEntry(destName, Path.INDEX_DEFAULT);
+                if (existing != null) {
+                    try {
+                        if (!existing.getNodeState().getDefinition().allowsSameNameSiblings())
{
+                            throw new ItemExistsException("Node existing at move destination
does not allow same name siblings.");
+                        }
+                    } catch (ItemNotFoundException e) {
+                        // existing apparent not valid any more -> probably no conflict
                     }
-                } catch (ItemNotFoundException e) {
-                    // existing apparent not valid any more -> probably no conflict
                 }
             }
         }



Mime
View raw message