jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r157554 - in incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state: ChangeLog.java SharedItemStateManager.java
Date Tue, 15 Mar 2005 15:46:06 GMT
Author: tripod
Date: Tue Mar 15 07:46:06 2005
New Revision: 157554

URL: http://svn.apache.org/viewcvs?view=rev&rev=157554
Log:
- fixing remove/add issue

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/ChangeLog.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/ChangeLog.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/ChangeLog.java?view=diff&r1=157553&r2=157554
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/ChangeLog.java (original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/ChangeLog.java Tue
Mar 15 07:46:06 2005
@@ -186,15 +186,15 @@
      * items we have.
      */
     public void push() {
-        Iterator iter = addedStates();
+        Iterator iter = modifiedStates();
         while (iter.hasNext()) {
             ((ItemState) iter.next()).push();
         }
-        iter = modifiedStates();
+        iter = deletedStates();
         while (iter.hasNext()) {
             ((ItemState) iter.next()).push();
         }
-        iter = deletedStates();
+        iter = addedStates();
         while (iter.hasNext()) {
             ((ItemState) iter.next()).push();
         }
@@ -205,13 +205,7 @@
      * internal states and notify listeners.
      */
     public void persisted() {
-        Iterator iter = addedStates();
-        while (iter.hasNext()) {
-            ItemState state = (ItemState) iter.next();
-            state.setStatus(ItemState.STATUS_EXISTING);
-            state.notifyStateCreated();
-        }
-        iter = modifiedStates();
+        Iterator iter = modifiedStates();
         while (iter.hasNext()) {
             ItemState state = (ItemState) iter.next();
             state.setStatus(ItemState.STATUS_EXISTING);
@@ -224,6 +218,12 @@
             state.notifyStateDestroyed();
             state.discard();
         }
+        iter = addedStates();
+        while (iter.hasNext()) {
+            ItemState state = (ItemState) iter.next();
+            state.setStatus(ItemState.STATUS_EXISTING);
+            state.notifyStateCreated();
+        }
     }
 
     /**
@@ -244,11 +244,7 @@
      * @param parent parent manager that will hold current data
      */
     public void undo(ItemStateManager parent) {
-        Iterator iter = addedStates();
-        while (iter.hasNext()) {
-            ((ItemState) iter.next()).discard();
-        }
-        iter = modifiedStates();
+        Iterator iter = modifiedStates();
         while (iter.hasNext()) {
             ItemState state = (ItemState) iter.next();
             try {
@@ -267,6 +263,10 @@
             } catch (ItemStateException e) {
                 state.discard();
             }
+        }
+        iter = addedStates();
+        while (iter.hasNext()) {
+            ((ItemState) iter.next()).discard();
         }
         reset();
     }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java?view=diff&r1=157553&r2=157554
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
Tue Mar 15 07:46:06 2005
@@ -431,12 +431,6 @@
          * respective shared item and add the shared items to a
          * new change log.
          */
-        iter = local.addedStates();
-        while (iter.hasNext()) {
-            ItemState state = (ItemState) iter.next();
-            state.connect(createInstance(state));
-            shared.added(state.getOverlayedState());
-        }
         iter = local.modifiedStates();
         while (iter.hasNext()) {
             ItemState state = (ItemState) iter.next();
@@ -448,6 +442,12 @@
             ItemState state = (ItemState) iter.next();
             state.connect(getItemState(state.getId()));
             shared.deleted(state.getOverlayedState());
+        }
+        iter = local.addedStates();
+        while (iter.hasNext()) {
+            ItemState state = (ItemState) iter.next();
+            state.connect(createInstance(state));
+            shared.added(state.getOverlayedState());
         }
 
         /* prepare the events */



Mime
View raw message