jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r497021 - /jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java
Date Wed, 17 Jan 2007 13:56:40 GMT
Author: angela
Date: Wed Jan 17 05:56:39 2007
New Revision: 497021

URL: http://svn.apache.org/viewvc?view=rev&rev=497021
Log:
work in progress

- resolve todo: remove add-operations if new item gets removed again


Modified:
    jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java

Modified: jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java?view=diff&rev=497021&r1=497020&r2=497021
==============================================================================
--- jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java
(original)
+++ jackrabbit/trunk/contrib/spi/jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ChangeLog.java
Wed Jan 17 05:56:39 2007
@@ -17,6 +17,8 @@
 package org.apache.jackrabbit.jcr2spi.state;
 
 import org.apache.jackrabbit.jcr2spi.operation.Operation;
+import org.apache.jackrabbit.jcr2spi.operation.AddNode;
+import org.apache.jackrabbit.jcr2spi.operation.AddProperty;
 import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 
 import javax.jcr.nodetype.ConstraintViolationException;
@@ -232,9 +234,20 @@
                 if (previousStatus == Status.NEW) {
                     // was new and now removed again
                     addedStates.remove(state);
-                    // TODO: remove 'addNode' or 'setProperty' operation
                     deletedStates.remove(state);
+                    // remove operations performed on the removed state
                     removeAffectedOperations(state);
+                    // remove add-operation (parent affected) as well
+                    NodeState parent = state.getParent();
+                    if (parent != null && parent.getStatus() != Status.REMOVED) {
+                        for (Iterator it = operations.iterator(); it.hasNext();) {
+                            Operation op = (Operation) it.next();
+                            if ((op instanceof AddNode || op instanceof AddProperty)
+                                && op.getAffectedItemStates().contains(parent)) {
+                                it.remove();
+                            }
+                        }
+                    }
                 } else if (previousStatus == Status.EXISTING_REMOVED) {
                     // was removed and is now saved
                     deletedStates.remove(state);



Mime
View raw message