isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1359404 - in /incubator/isis/trunk/framework: core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ runtimes/dflt/runtime/src/main/java/org/apache/isis/run...
Date Mon, 09 Jul 2012 21:13:42 GMT
Author: danhaywood
Date: Mon Jul  9 21:13:41 2012
New Revision: 1359404

URL: http://svn.apache.org/viewvc?rev=1359404&view=rev
Log:
ISIS-14: ResolveState simplifications; combining SERIALIZING_TRANSIENT with TRANSIENT.

Modified:
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveState.java
    incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_GetEndStateTest.java
    incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsDestroyedTest.java
    incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsGhostTest.java
    incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsNewTest.java
    incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsPersistentTest.java
    incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvedTest.java
    incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvingTest.java
    incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsTransientTest.java
    incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsValidToChangeToTest.java
    incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_RespondToChangesInPersistentObjectsTest.java
    incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java

Modified: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveState.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveState.java?rev=1359404&r1=1359403&r2=1359404&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveState.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ResolveState.java Mon Jul  9 21:13:41 2012
@@ -67,10 +67,10 @@ public final class ResolveState {
     public static final ResolveState DESTROYED             = new ResolveState("Destroyed",             "D~~", null,      CANNOT_TRANSITION_FROM, RESPONDS_TO_CHANGES,         DOES_NOT_REPRESENT_TRANSIENT, DOES_NOT_REPRESENT_PERSISTENT);
     public static final ResolveState VALUE                 = new ResolveState("Value",                 "V~~", null,      CANNOT_TRANSITION_FROM, RESPONDS_TO_CHANGES,         DOES_NOT_REPRESENT_TRANSIENT, DOES_NOT_REPRESENT_PERSISTENT);
 
-    /**
-     * 20120709: used only in <tt>Memento</tt>, when recreating a transient object.
-     */
-    public static final ResolveState SERIALIZING_TRANSIENT = new ResolveState("Serializing Transient", "T~S", TRANSIENT, CANNOT_TRANSITION_FROM, DOES_NOT_RESPOND_TO_CHANGES, REPRESENTS_TRANSIENT,         DOES_NOT_REPRESENT_PERSISTENT);
+    // 20120709: used only in <tt>Memento</tt>, when recreating a transient object.
+    // however, analysis is that could equally set to TRANSIENT, rendering this state
+    // surplus to requirements.
+    // public static final ResolveState SERIALIZING_TRANSIENT = new ResolveState("Serializing Transient", "T~S", TRANSIENT, CANNOT_TRANSITION_FROM, DOES_NOT_RESPOND_TO_CHANGES, REPRESENTS_TRANSIENT,         DOES_NOT_REPRESENT_PERSISTENT);
 
     // no longer seem to be used
 
@@ -113,12 +113,13 @@ public final class ResolveState {
             // previously also RESOLVING_PART and SERIALIZING_GHOST
             put(GHOST, new ResolveState[] { DESTROYED, RESOLVING, UPDATING });
             put(NEW, new ResolveState[] { TRANSIENT, GHOST, VALUE });
-            put(TRANSIENT, new ResolveState[] { RESOLVED, SERIALIZING_TRANSIENT });
+            // previously also SERIALIZING_TRANSIENT
+            put(TRANSIENT, new ResolveState[] { RESOLVED });
             put(RESOLVING, new ResolveState[] { RESOLVED });
             // previously also SERIALIZING_RESOLVED
             put(RESOLVED, new ResolveState[] { GHOST, UPDATING, DESTROYED });
             //put(SERIALIZING_RESOLVED, new ResolveState[] { RESOLVED });
-            put(SERIALIZING_TRANSIENT, new ResolveState[] { TRANSIENT });
+            //put(SERIALIZING_TRANSIENT, new ResolveState[] { TRANSIENT });
             put(UPDATING, new ResolveState[] { RESOLVED });
             put(DESTROYED, new ResolveState[] {});
             put(VALUE, new ResolveState[] {});

Modified: incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_GetEndStateTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_GetEndStateTest.java?rev=1359404&r1=1359403&r2=1359404&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_GetEndStateTest.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_GetEndStateTest.java Mon Jul  9 21:13:41 2012
@@ -24,7 +24,6 @@ import static org.apache.isis.core.metam
 import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.SERIALIZING_TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
@@ -44,14 +43,21 @@ public class ResolveState_GetEndStateTes
 
     @Parameters
     public static Collection<Object[]> data() {
-        return Arrays.asList(new Object[][] { { NEW, null }, { GHOST, null }, { TRANSIENT, null },
+        return Arrays.asList(new Object[][] { { NEW, null }, //
+                { GHOST, null }, //
+                { TRANSIENT, null }, //
                 // { RESOLVING_PART, PART_RESOLVED },
                 // { PART_RESOLVED, null },
-                { RESOLVING, RESOLVED }, { RESOLVED, null }, { UPDATING, RESOLVED }, { SERIALIZING_TRANSIENT, TRANSIENT },
+                { RESOLVING, RESOLVED }, //
+                { RESOLVED, null }, //
+                { UPDATING, RESOLVED }, //
+                // { SERIALIZING_TRANSIENT, TRANSIENT },
                 // { SERIALIZING_PART_RESOLVED, PART_RESOLVED },
                 // { SERIALIZING_GHOST, GHOST },
-                // { SERIALIZING_RESOLVED, RESOLVED }, 
-                { VALUE, null }, { DESTROYED, null }, });
+                // { SERIALIZING_RESOLVED, RESOLVED },
+                { VALUE, null }, //
+                { DESTROYED, null }, //
+        });
     }
 
     private final ResolveState from;

Modified: incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsDestroyedTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsDestroyedTest.java?rev=1359404&r1=1359403&r2=1359404&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsDestroyedTest.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsDestroyedTest.java Mon Jul  9 21:13:41 2012
@@ -24,7 +24,6 @@ import static org.apache.isis.core.metam
 import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.SERIALIZING_TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
@@ -54,7 +53,7 @@ public class ResolveState_IsDestroyedTes
                 { false, TRANSIENT }, //
                 { true, DESTROYED }, //
                 { false, UPDATING }, //
-                { false, SERIALIZING_TRANSIENT },
+                // { false, SERIALIZING_TRANSIENT },
                 // { false, SERIALIZING_GHOST },
                 // { false, SERIALIZING_PART_RESOLVED },
                 // { false, SERIALIZING_RESOLVED }, 

Modified: incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsGhostTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsGhostTest.java?rev=1359404&r1=1359403&r2=1359404&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsGhostTest.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsGhostTest.java Mon Jul  9 21:13:41 2012
@@ -24,7 +24,6 @@ import static org.apache.isis.core.metam
 import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.SERIALIZING_TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
@@ -54,7 +53,7 @@ public class ResolveState_IsGhostTest {
                 { false, TRANSIENT }, // 
                 { false, DESTROYED }, //
                 { false, UPDATING }, //
-                { false, SERIALIZING_TRANSIENT }, //
+                // { false, SERIALIZING_TRANSIENT }, //
                 // { false, SERIALIZING_GHOST },
                 // { false, SERIALIZING_PART_RESOLVED },
                 // { false, SERIALIZING_RESOLVED }, 

Modified: incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsNewTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsNewTest.java?rev=1359404&r1=1359403&r2=1359404&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsNewTest.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsNewTest.java Mon Jul  9 21:13:41 2012
@@ -24,7 +24,6 @@ import static org.apache.isis.core.metam
 import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.SERIALIZING_TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
@@ -44,8 +43,7 @@ public class ResolveState_IsNewTest {
 
     @Parameters
     public static Collection<Object[]> data() {
-        return Arrays.asList(new Object[][] { 
-                { false, GHOST }, //
+        return Arrays.asList(new Object[][] { { false, GHOST }, //
                 { true, NEW }, //
                 // { false, PART_RESOLVED },
                 { false, RESOLVED }, //
@@ -54,12 +52,12 @@ public class ResolveState_IsNewTest {
                 { false, TRANSIENT }, //
                 { false, DESTROYED }, //
                 { false, UPDATING }, //
-                { false, SERIALIZING_TRANSIENT }, //
+                // { false, SERIALIZING_TRANSIENT }, //
                 // { false, SERIALIZING_GHOST },
                 // { false, SERIALIZING_PART_RESOLVED },
-                // { false, SERIALIZING_RESOLVED }, 
+                // { false, SERIALIZING_RESOLVED },
                 { false, VALUE }, //
-                });
+        });
     }
 
     private final boolean whetherIs;

Modified: incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsPersistentTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsPersistentTest.java?rev=1359404&r1=1359403&r2=1359404&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsPersistentTest.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsPersistentTest.java Mon Jul  9 21:13:41 2012
@@ -24,7 +24,6 @@ import static org.apache.isis.core.metam
 import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.SERIALIZING_TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
@@ -44,8 +43,7 @@ public class ResolveState_IsPersistentTe
 
     @Parameters
     public static Collection<Object[]> data() {
-        return Arrays.asList(new Object[][] { 
-                { true, GHOST }, //
+        return Arrays.asList(new Object[][] { { true, GHOST }, //
                 { false, NEW }, //
                 // { true, PART_RESOLVED },
                 { true, RESOLVED }, //
@@ -54,12 +52,12 @@ public class ResolveState_IsPersistentTe
                 { false, TRANSIENT }, //
                 { false, DESTROYED }, //
                 { true, UPDATING }, //
-                { false, SERIALIZING_TRANSIENT }, //
+                // { false, SERIALIZING_TRANSIENT }, //
                 // { true, SERIALIZING_GHOST },
                 // { true, SERIALIZING_PART_RESOLVED },
-                // { true, SERIALIZING_RESOLVED }, 
+                // { true, SERIALIZING_RESOLVED },
                 { false, VALUE }, //
-                });
+        });
     }
 
     private final boolean whetherIs;

Modified: incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvedTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvedTest.java?rev=1359404&r1=1359403&r2=1359404&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvedTest.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvedTest.java Mon Jul  9 21:13:41 2012
@@ -24,7 +24,6 @@ import static org.apache.isis.core.metam
 import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.SERIALIZING_TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
@@ -44,8 +43,7 @@ public class ResolveState_IsResolvedTest
 
     @Parameters
     public static Collection<Object[]> data() {
-        return Arrays.asList(new Object[][] { 
-                { false, GHOST }, //
+        return Arrays.asList(new Object[][] { { false, GHOST }, //
                 { false, NEW }, //
                 // { false, PART_RESOLVED },
                 { true, RESOLVED }, //
@@ -54,12 +52,12 @@ public class ResolveState_IsResolvedTest
                 { false, TRANSIENT }, //
                 { false, DESTROYED }, //
                 { false, UPDATING }, //
-                { false, SERIALIZING_TRANSIENT }, //
+                // { false, SERIALIZING_TRANSIENT }, //
                 // { false, SERIALIZING_GHOST },
                 // { false, SERIALIZING_PART_RESOLVED },
-                // { false, SERIALIZING_RESOLVED }, 
+                // { false, SERIALIZING_RESOLVED },
                 { false, VALUE }, //
-                });
+        });
     }
 
     private final boolean whetherIs;

Modified: incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvingTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvingTest.java?rev=1359404&r1=1359403&r2=1359404&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvingTest.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsResolvingTest.java Mon Jul  9 21:13:41 2012
@@ -24,7 +24,6 @@ import static org.apache.isis.core.metam
 import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.SERIALIZING_TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
@@ -44,8 +43,7 @@ public class ResolveState_IsResolvingTes
 
     @Parameters
     public static Collection<Object[]> data() {
-        return Arrays.asList(new Object[][] { 
-                { false, GHOST }, //
+        return Arrays.asList(new Object[][] { { false, GHOST }, //
                 { false, NEW }, //
                 // { false, PART_RESOLVED },
                 { false, RESOLVED }, //
@@ -53,12 +51,13 @@ public class ResolveState_IsResolvingTes
                 // { true, RESOLVING_PART },
                 { false, TRANSIENT }, //
                 { false, DESTROYED }, //
-                { false, UPDATING }, { false, SERIALIZING_TRANSIENT },
+                { false, UPDATING }, //
+                // { false, SERIALIZING_TRANSIENT },
                 // { false, SERIALIZING_GHOST },
                 // { false, SERIALIZING_PART_RESOLVED },
-                // { false, SERIALIZING_RESOLVED }, 
+                // { false, SERIALIZING_RESOLVED },
                 { false, VALUE }, //
-                });
+        });
     }
 
     private final boolean whetherIs;

Modified: incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsTransientTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsTransientTest.java?rev=1359404&r1=1359403&r2=1359404&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsTransientTest.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsTransientTest.java Mon Jul  9 21:13:41 2012
@@ -24,7 +24,6 @@ import static org.apache.isis.core.metam
 import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.SERIALIZING_TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
@@ -44,8 +43,7 @@ public class ResolveState_IsTransientTes
 
     @Parameters
     public static Collection<Object[]> data() {
-        return Arrays.asList(new Object[][] { 
-                { false, GHOST }, //
+        return Arrays.asList(new Object[][] { { false, GHOST }, //
                 { false, NEW }, //
                 // { false, PART_RESOLVED },
                 { false, RESOLVED }, //
@@ -54,12 +52,12 @@ public class ResolveState_IsTransientTes
                 { true, TRANSIENT }, //
                 { false, DESTROYED }, //
                 { false, UPDATING }, //
-                { true, SERIALIZING_TRANSIENT }, //
+                // { true, SERIALIZING_TRANSIENT },
                 // { false, SERIALIZING_GHOST },
                 // { false, SERIALIZING_PART_RESOLVED },
-                // { false, SERIALIZING_RESOLVED }, 
+                // { false, SERIALIZING_RESOLVED },
                 { false, VALUE }, //
-                });
+        });
     }
 
     private final boolean whetherIs;

Modified: incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsValidToChangeToTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsValidToChangeToTest.java?rev=1359404&r1=1359403&r2=1359404&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsValidToChangeToTest.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_IsValidToChangeToTest.java Mon Jul  9 21:13:41 2012
@@ -24,7 +24,6 @@ import static org.apache.isis.core.metam
 import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.SERIALIZING_TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
@@ -53,7 +52,7 @@ public class ResolveState_IsValidToChang
                 { true, NEW, TRANSIENT },//
                 { false, NEW, DESTROYED },//
                 { false, NEW, UPDATING },//
-                { false, NEW, SERIALIZING_TRANSIENT },//
+                // { false, NEW, SERIALIZING_TRANSIENT },
                 // { false, NEW, SERIALIZING_GHOST },
                 // { false, NEW, SERIALIZING_PART_RESOLVED },
                 // { false, NEW, SERIALIZING_RESOLVED },//
@@ -68,7 +67,7 @@ public class ResolveState_IsValidToChang
                 { false, GHOST, TRANSIENT },//
                 { true, GHOST, DESTROYED },//
                 { true, GHOST, UPDATING },//
-                { false, GHOST, SERIALIZING_TRANSIENT },//
+                // { false, GHOST, SERIALIZING_TRANSIENT },
                 // { true, GHOST, SERIALIZING_GHOST },
                 // { false, GHOST, SERIALIZING_PART_RESOLVED },
                 // { false, GHOST, SERIALIZING_RESOLVED }, //
@@ -83,7 +82,7 @@ public class ResolveState_IsValidToChang
                 { false, TRANSIENT, TRANSIENT },//
                 { false, TRANSIENT, DESTROYED },//
                 { false, TRANSIENT, UPDATING },//
-                { true, TRANSIENT, SERIALIZING_TRANSIENT },//
+                // { true, TRANSIENT, SERIALIZING_TRANSIENT },
                 // { false, TRANSIENT, SERIALIZING_GHOST },
                 // { false, TRANSIENT, SERIALIZING_PART_RESOLVED },
                 // { false, TRANSIENT, SERIALIZING_RESOLVED },//
@@ -128,7 +127,7 @@ public class ResolveState_IsValidToChang
                 { false, RESOLVING, TRANSIENT },//
                 { false, RESOLVING, DESTROYED },//
                 { false, RESOLVING, UPDATING },//
-                { false, RESOLVING, SERIALIZING_TRANSIENT },//
+                // { false, RESOLVING, SERIALIZING_TRANSIENT },
                 // { false, RESOLVING, SERIALIZING_GHOST },
                 // { false, RESOLVING, SERIALIZING_PART_RESOLVED },
                 // { false, RESOLVING, SERIALIZING_RESOLVED },//
@@ -143,7 +142,7 @@ public class ResolveState_IsValidToChang
                 { false, RESOLVED, TRANSIENT },//
                 { true, RESOLVED, DESTROYED },//
                 { true, RESOLVED, UPDATING },//
-                { false, RESOLVED, SERIALIZING_TRANSIENT },//
+                // { false, RESOLVED, SERIALIZING_TRANSIENT },
                 // { false, RESOLVED, SERIALIZING_GHOST },
                 // { false, RESOLVED, SERIALIZING_PART_RESOLVED },
                 // { true, RESOLVED, SERIALIZING_RESOLVED }, //
@@ -158,26 +157,27 @@ public class ResolveState_IsValidToChang
                 { false, UPDATING, TRANSIENT },//
                 { false, UPDATING, DESTROYED },//
                 { false, UPDATING, UPDATING },//
-                { false, UPDATING, SERIALIZING_TRANSIENT },//
+                // { false, UPDATING, SERIALIZING_TRANSIENT },
                 // { false, UPDATING, SERIALIZING_GHOST },
                 // { false, UPDATING, SERIALIZING_PART_RESOLVED },
                 // { false, UPDATING, SERIALIZING_RESOLVED }, //
                 { false, UPDATING, VALUE },//
 
-                { false, SERIALIZING_TRANSIENT, GHOST },//
-                { false, SERIALIZING_TRANSIENT, NEW }, //
-                // { false, SERIALIZING_TRANSIENT, PART_RESOLVED }, //
-                { false, SERIALIZING_TRANSIENT, RESOLVED }, //
-                { false, SERIALIZING_TRANSIENT, RESOLVING }, //
-                // { false, SERIALIZING_TRANSIENT, RESOLVING_PART },
-                { true, SERIALIZING_TRANSIENT, TRANSIENT }, //
-                { false, SERIALIZING_TRANSIENT, DESTROYED }, //
-                { false, SERIALIZING_TRANSIENT, UPDATING }, //
-                { false, SERIALIZING_TRANSIENT, SERIALIZING_TRANSIENT },//
-                // { false, SERIALIZING_TRANSIENT, SERIALIZING_GHOST },
-                // { false, SERIALIZING_TRANSIENT, SERIALIZING_PART_RESOLVED },
-                // { false, SERIALIZING_TRANSIENT, SERIALIZING_RESOLVED }, //
-                { false, SERIALIZING_TRANSIENT, VALUE },//
+                // { false, SERIALIZING_TRANSIENT, GHOST },//
+                // { false, SERIALIZING_TRANSIENT, NEW }, //
+                // // { false, SERIALIZING_TRANSIENT, PART_RESOLVED }, //
+                // { false, SERIALIZING_TRANSIENT, RESOLVED }, //
+                // { false, SERIALIZING_TRANSIENT, RESOLVING }, //
+                // // { false, SERIALIZING_TRANSIENT, RESOLVING_PART },
+                // { true, SERIALIZING_TRANSIENT, TRANSIENT }, //
+                // { false, SERIALIZING_TRANSIENT, DESTROYED }, //
+                // { false, SERIALIZING_TRANSIENT, UPDATING }, //
+                // { false, SERIALIZING_TRANSIENT, SERIALIZING_TRANSIENT },//
+                // // { false, SERIALIZING_TRANSIENT, SERIALIZING_GHOST },
+                // // { false, SERIALIZING_TRANSIENT, SERIALIZING_PART_RESOLVED
+                // },
+                // // { false, SERIALIZING_TRANSIENT, SERIALIZING_RESOLVED }, //
+                // { false, SERIALIZING_TRANSIENT, VALUE },//
 
                 // { false, SERIALIZING_PART_RESOLVED, GHOST }, { false,
                 // SERIALIZING_PART_RESOLVED, NEW }, { true,
@@ -194,20 +194,21 @@ public class ResolveState_IsValidToChang
                 // }, { false, SERIALIZING_PART_RESOLVED, SERIALIZING_RESOLVED
                 // }, { false, SERIALIZING_PART_RESOLVED, VALUE },
 
-//                { false, SERIALIZING_RESOLVED, GHOST }, //
-//                { false, SERIALIZING_RESOLVED, NEW }, //
-//                // { false, SERIALIZING_RESOLVED, PART_RESOLVED }, //
-//                { true, SERIALIZING_RESOLVED, RESOLVED }, //
-//                { false, SERIALIZING_RESOLVED, RESOLVING }, //
-//                // { false, SERIALIZING_RESOLVED, RESOLVING_PART }, //
-//                { false, SERIALIZING_RESOLVED, TRANSIENT }, //
-//                { false, SERIALIZING_RESOLVED, DESTROYED }, //
-//                { false, SERIALIZING_RESOLVED, UPDATING }, //
-//                { false, SERIALIZING_RESOLVED, SERIALIZING_TRANSIENT },
-//                // { false, SERIALIZING_RESOLVED, SERIALIZING_GHOST },
-//                // { false, SERIALIZING_RESOLVED, SERIALIZING_PART_RESOLVED },
-//                { false, SERIALIZING_RESOLVED, SERIALIZING_RESOLVED }, //
-//                { false, SERIALIZING_RESOLVED, VALUE },
+                // { false, SERIALIZING_RESOLVED, GHOST }, //
+                // { false, SERIALIZING_RESOLVED, NEW }, //
+                // // { false, SERIALIZING_RESOLVED, PART_RESOLVED }, //
+                // { true, SERIALIZING_RESOLVED, RESOLVED }, //
+                // { false, SERIALIZING_RESOLVED, RESOLVING }, //
+                // // { false, SERIALIZING_RESOLVED, RESOLVING_PART }, //
+                // { false, SERIALIZING_RESOLVED, TRANSIENT }, //
+                // { false, SERIALIZING_RESOLVED, DESTROYED }, //
+                // { false, SERIALIZING_RESOLVED, UPDATING }, //
+                // { false, SERIALIZING_RESOLVED, SERIALIZING_TRANSIENT },
+                // // { false, SERIALIZING_RESOLVED, SERIALIZING_GHOST },
+                // // { false, SERIALIZING_RESOLVED, SERIALIZING_PART_RESOLVED
+                // },
+                // { false, SERIALIZING_RESOLVED, SERIALIZING_RESOLVED }, //
+                // { false, SERIALIZING_RESOLVED, VALUE },
 
                 // { true, SERIALIZING_GHOST, GHOST }, { false,
                 // SERIALIZING_GHOST, NEW }, { false, SERIALIZING_GHOST,
@@ -232,7 +233,7 @@ public class ResolveState_IsValidToChang
                 { false, VALUE, TRANSIENT }, //
                 { false, VALUE, DESTROYED }, //
                 { false, VALUE, UPDATING }, //
-                { false, VALUE, SERIALIZING_TRANSIENT },
+                // { false, VALUE, SERIALIZING_TRANSIENT },
                 // { false, VALUE, SERIALIZING_GHOST },
                 // { false, VALUE, SERIALIZING_PART_RESOLVED },
                 // { false, VALUE, SERIALIZING_RESOLVED }, //
@@ -247,7 +248,7 @@ public class ResolveState_IsValidToChang
                 { false, DESTROYED, TRANSIENT }, //
                 { false, DESTROYED, DESTROYED }, //
                 { false, DESTROYED, UPDATING }, //
-                { false, DESTROYED, SERIALIZING_TRANSIENT },
+                // { false, DESTROYED, SERIALIZING_TRANSIENT },
                 // { false, DESTROYED, SERIALIZING_GHOST },
                 // { false, DESTROYED, SERIALIZING_PART_RESOLVED },
                 // { false, DESTROYED, SERIALIZING_RESOLVED }, //

Modified: incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_RespondToChangesInPersistentObjectsTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_RespondToChangesInPersistentObjectsTest.java?rev=1359404&r1=1359403&r2=1359404&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_RespondToChangesInPersistentObjectsTest.java (original)
+++ incubator/isis/trunk/framework/core/metamodel/src/test/java/org/apache/isis/core/metamodel/adapter/ResolveState_RespondToChangesInPersistentObjectsTest.java Mon Jul  9 21:13:41 2012
@@ -24,7 +24,6 @@ import static org.apache.isis.core.metam
 import static org.apache.isis.core.metamodel.adapter.ResolveState.NEW;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVED;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.RESOLVING;
-import static org.apache.isis.core.metamodel.adapter.ResolveState.SERIALIZING_TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.TRANSIENT;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.UPDATING;
 import static org.apache.isis.core.metamodel.adapter.ResolveState.VALUE;
@@ -44,22 +43,21 @@ public class ResolveState_RespondToChang
 
     @Parameters
     public static Collection<Object[]> data() {
-        return Arrays.asList(new Object[][] { 
-                { true, GHOST }, //
-                { false, NEW }, // 
-                // { true, PART_RESOLVED }, 
+        return Arrays.asList(new Object[][] { { true, GHOST }, //
+                { false, NEW }, //
+                // { true, PART_RESOLVED },
                 { true, RESOLVED }, //
                 { false, RESOLVING }, //
                 // { false, RESOLVING_PART },
                 { false, TRANSIENT }, //
                 { true, DESTROYED }, //
                 { false, UPDATING }, //
-                { false, SERIALIZING_TRANSIENT }, //
+                // { false, SERIALIZING_TRANSIENT },
                 // { false, SERIALIZING_GHOST },
                 // { false, SERIALIZING_PART_RESOLVED },
-                // { false, SERIALIZING_RESOLVED }, 
+                // { false, SERIALIZING_RESOLVED },
                 { true, VALUE }, //
-                });
+        });
     }
 
     private final boolean whetherIs;

Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java?rev=1359404&r1=1359403&r2=1359404&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java Mon Jul  9 21:13:41 2012
@@ -65,15 +65,15 @@ public class Memento implements Serializ
 
     private final List<Oid> transientObjects = Lists.newArrayList();
 
-    private Data state;
+    private Data data;
 
 
     ////////////////////////////////////////////////
     // constructor, Encodeable
     ////////////////////////////////////////////////
 
-    public Memento(final ObjectAdapter object) {
-        state = object == null ? null : createData(object);
+    public Memento(final ObjectAdapter adapter) {
+        data = adapter == null ? null : createData(adapter);
         if (LOG.isDebugEnabled()) {
             LOG.debug("created memento for " + this);
         }
@@ -84,80 +84,80 @@ public class Memento implements Serializ
     // createData
     ////////////////////////////////////////////////
 
-    private Data createData(final ObjectAdapter object) {
-        if (object.getSpecification().isParentedOrFreeCollection()) {
-            return createCollectionData(object);
+    private Data createData(final ObjectAdapter adapter) {
+        if (adapter.getSpecification().isParentedOrFreeCollection()) {
+            return createCollectionData(adapter);
         } else {
-            return createObjectData(object);
+            return createObjectData(adapter);
         }
     }
 
-    private Data createCollectionData(final ObjectAdapter object) {
-        final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(object);
-        final Data[] collData = new Data[facet.size(object)];
+    private Data createCollectionData(final ObjectAdapter adapter) {
+        final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(adapter);
+        final Data[] collData = new Data[facet.size(adapter)];
         int i = 0;
-        for (final ObjectAdapter ref : facet.iterable(object)) {
+        for (final ObjectAdapter ref : facet.iterable(adapter)) {
             collData[i++] = createReferenceData(ref);
         }
-        final String elementTypeSpecName = object.getSpecification().getFullIdentifier();
-        return new CollectionData(object.getOid(), object.getResolveState(), elementTypeSpecName, collData);
+        final String elementTypeSpecName = adapter.getSpecification().getFullIdentifier();
+        return new CollectionData(adapter.getOid(), adapter.getResolveState(), elementTypeSpecName, collData);
     }
 
     private ObjectData createObjectData(final ObjectAdapter adapter) {
         transientObjects.add(adapter.getOid());
         final ObjectSpecification cls = adapter.getSpecification();
-        final List<ObjectAssociation> fields = cls.getAssociations();
+        final List<ObjectAssociation> associations = cls.getAssociations();
         final ObjectData data = new ObjectData(adapter.getOid(), adapter.getResolveState().name(), cls.getFullIdentifier());
-        for (int i = 0; i < fields.size(); i++) {
-            if (fields.get(i).isNotPersisted()) {
-                if (fields.get(i).isOneToManyAssociation()) {
+        for (int i = 0; i < associations.size(); i++) {
+            if (associations.get(i).isNotPersisted()) {
+                if (associations.get(i).isOneToManyAssociation()) {
                     continue;
                 }
-                if (fields.get(i).containsFacet(PropertyOrCollectionAccessorFacet.class) && !fields.get(i).containsFacet(PropertySetterFacet.class)) {
-                    LOG.debug("ignoring not-settable field " + fields.get(i).getName());
+                if (associations.get(i).containsFacet(PropertyOrCollectionAccessorFacet.class) && !associations.get(i).containsFacet(PropertySetterFacet.class)) {
+                    LOG.debug("ignoring not-settable field " + associations.get(i).getName());
                     continue;
                 }
             }
-            createFieldData(adapter, data, fields.get(i));
+            createAssociationData(adapter, data, associations.get(i));
         }
         return data;
     }
 
-    private void createFieldData(final ObjectAdapter object, final ObjectData data, final ObjectAssociation field) {
-        Object fieldData;
-        if (field.isOneToManyAssociation()) {
-            final ObjectAdapter coll = field.get(object);
-            fieldData = createCollectionData(coll);
-        } else if (field.getSpecification().isEncodeable()) {
-            final EncodableFacet facet = field.getSpecification().getFacet(EncodableFacet.class);
-            final ObjectAdapter value = field.get(object);
-            fieldData = facet.toEncodedString(value);
-        } else if (field.isOneToOneAssociation()) {
-            final ObjectAdapter ref = ((OneToOneAssociation) field).get(object);
-            fieldData = createReferenceData(ref);
+    private void createAssociationData(final ObjectAdapter adapter, final ObjectData data, final ObjectAssociation objectAssoc) {
+        Object assocData;
+        if (objectAssoc.isOneToManyAssociation()) {
+            final ObjectAdapter collAdapter = objectAssoc.get(adapter);
+            assocData = createCollectionData(collAdapter);
+        } else if (objectAssoc.getSpecification().isEncodeable()) {
+            final EncodableFacet facet = objectAssoc.getSpecification().getFacet(EncodableFacet.class);
+            final ObjectAdapter value = objectAssoc.get(adapter);
+            assocData = facet.toEncodedString(value);
+        } else if (objectAssoc.isOneToOneAssociation()) {
+            final ObjectAdapter referencedAdapter = ((OneToOneAssociation) objectAssoc).get(adapter);
+            assocData = createReferenceData(referencedAdapter);
         } else {
-            throw new UnknownTypeException(field);
+            throw new UnknownTypeException(objectAssoc);
         }
-        data.addField(field.getId(), fieldData);
+        data.addField(objectAssoc.getId(), assocData);
     }
 
-    private Data createReferenceData(final ObjectAdapter ref) {
-        if (ref == null) {
+    private Data createReferenceData(final ObjectAdapter referencedAdapter) {
+        if (referencedAdapter == null) {
             return null;
         }
 
-        final Oid refOid = ref.getOid();
+        final Oid refOid = referencedAdapter.getOid();
         if (refOid == null) {
-            return createStandaloneData(ref);
+            return createStandaloneData(referencedAdapter);
         }
 
-        if ((ref.getSpecification().isParented() || refOid.isTransient()) && !transientObjects.contains(refOid)) {
+        if ((referencedAdapter.getSpecification().isParented() || refOid.isTransient()) && !transientObjects.contains(refOid)) {
             transientObjects.add(refOid);
-            return createObjectData(ref);
+            return createObjectData(referencedAdapter);
         }
 
-        final String resolvedState = ref.getResolveState().name();
-        final String specification = ref.getSpecification().getFullIdentifier();
+        final String resolvedState = referencedAdapter.getResolveState().name();
+        final String specification = referencedAdapter.getSpecification().getFullIdentifier();
         return new Data(refOid, resolvedState, specification);
 
     }
@@ -171,11 +171,11 @@ public class Memento implements Serializ
     ////////////////////////////////////////////////
 
     public Oid getOid() {
-        return state.getOid();
+        return data.getOid();
     }
 
     protected Data getData() {
-        return state;
+        return data;
     }
     
     ////////////////////////////////////////////////
@@ -183,40 +183,43 @@ public class Memento implements Serializ
     ////////////////////////////////////////////////
 
     public ObjectAdapter recreateObject() {
-        if (state == null) {
+        if (data == null) {
             return null;
         }
-        final ObjectSpecification spec = getSpecificationLoader().loadSpecification(state.getClassName());
+        final ObjectSpecification spec = getSpecificationLoader().loadSpecification(data.getClassName());
 
         ObjectAdapter adapter;
         ResolveState targetState;
         if (getOid().isTransient()) {
             adapter = getHydrator().recreateAdapter(spec, getOid());
-            targetState = ResolveState.SERIALIZING_TRANSIENT;
+            // was previously SERIALIZING_TRANSIENT; however #updateFieldsAndResolveState()
+            // seems to be written such that setting to TRANSIENT would also be ok.
+            targetState = ResolveState.TRANSIENT;
         } else {
             adapter = getHydrator().recreateAdapter(spec, getOid());
             targetState = ResolveState.UPDATING;
         }
         
         if (adapter.getSpecification().isParentedOrFreeCollection()) {
-            populateCollection(adapter, (CollectionData) state, targetState);
+            populateCollection(adapter, (CollectionData) data, targetState);
         } else {
-            updateObject(adapter, state, targetState);
+            updateObject(adapter, data, targetState);
         }
+
         if (LOG.isDebugEnabled()) {
             LOG.debug("recreated object " + adapter.getOid());
         }
         return adapter;
     }
 
-    private void populateCollection(final ObjectAdapter collection, final CollectionData state, final ResolveState targetState) {
+    private void populateCollection(final ObjectAdapter collectionAdapter, final CollectionData state, final ResolveState targetState) {
         final ObjectAdapter[] initData = new ObjectAdapter[state.elements.length];
         int i = 0;
         for (final Data elementData : state.elements) {
             initData[i++] = recreateReference(elementData);
         }
-        final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);
-        facet.init(collection, initData);
+        final CollectionFacet facet = collectionAdapter.getSpecification().getFacet(CollectionFacet.class);
+        facet.init(collectionAdapter, initData);
     }
 
     private ObjectAdapter recreateReference(final Data data) {
@@ -230,18 +233,17 @@ public class Memento implements Serializ
             if (oid == null) {
                 return null;
             }
-            ObjectAdapter ref;
-            ref = getHydrator().recreateAdapter(spec, oid);
+            ObjectAdapter referencedAdapter = getHydrator().recreateAdapter(spec, oid);
             if (data instanceof ObjectData) {
                 if (oid.isTransient() || spec.isParented()) {
                     final ResolveState resolveState = spec.isParented() ? ResolveState.GHOST : ResolveState.TRANSIENT;
-                    if (ref.getResolveState().isValidToChangeTo(resolveState)) {
-                        ref.changeState(resolveState);
+                    if (referencedAdapter.getResolveState().isValidToChangeTo(resolveState)) {
+                        referencedAdapter.changeState(resolveState);
                     }
-                    updateObject(ref, data, resolveState);
+                    updateObject(referencedAdapter, data, resolveState);
                 }
             }
-            return ref;
+            return referencedAdapter;
         }
     }
 
@@ -258,39 +260,37 @@ public class Memento implements Serializ
      *             if the memento was created from different logical object to
      *             the one specified (i.e. its oid differs).
      */
-    public void updateObject(final ObjectAdapter object) {
-        updateObject(object, state, ResolveState.RESOLVING);
+    public void updateObject(final ObjectAdapter adapter) {
+        updateObject(adapter, data, ResolveState.RESOLVING);
     }
 
-    private void updateObject(final ObjectAdapter object, final Data state, final ResolveState resolveState) {
-        final Object oid = object.getOid();
-        if (oid != null && !oid.equals(state.getOid())) {
-            throw new IllegalArgumentException("This memento can only be used to update the ObjectAdapter with the Oid " + state.getOid() + " but is " + oid);
-
-        } else {
-            if (!(state instanceof ObjectData)) {
-                throw new IsisException("Expected an ObjectData but got " + state.getClass());
-            } else {
-                updateObject(object, resolveState, state);
-            }
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("object updated " + object.getOid());
-            }
+    private void updateObject(final ObjectAdapter adapter, final Data data, final ResolveState targetState) {
+        final Object oid = adapter.getOid();
+        if (oid != null && !oid.equals(data.getOid())) {
+            throw new IllegalArgumentException("This memento can only be used to update the ObjectAdapter with the Oid " + data.getOid() + " but is " + oid);
+        } 
+        if (!(data instanceof ObjectData)) {
+            throw new IsisException("Expected an ObjectData but got " + data.getClass());
+        }
+        
+        updateFieldsAndResolveState(adapter, data, targetState);
+        
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("object updated " + adapter.getOid());
         }
-
     }
 
-    private void updateObject(final ObjectAdapter objectAdapter, final ResolveState targetResolveState, final Data state) {
-        if (objectAdapter.getResolveState().isValidToChangeTo(targetResolveState)) {
-            PersistorUtil.startStateTransition(objectAdapter, targetResolveState);
-            updateFields(objectAdapter, state);
+    private void updateFieldsAndResolveState(final ObjectAdapter objectAdapter, final Data data, final ResolveState targetState) {
+        if (objectAdapter.getResolveState().isValidToChangeTo(targetState)) {
+            PersistorUtil.startStateTransition(objectAdapter, targetState);
+            updateFields(objectAdapter, data);
             PersistorUtil.endStateTransition(objectAdapter);
-        } else if (objectAdapter.isTransient() && targetResolveState == ResolveState.TRANSIENT) {
-            updateFields(objectAdapter, state);
+        } else if (objectAdapter.isTransient() && targetState == ResolveState.TRANSIENT) {
+            updateFields(objectAdapter, data);
         } else if (objectAdapter.isParented()) {
-            updateFields(objectAdapter, state);
+            updateFields(objectAdapter, data);
         } else {
-            final ObjectData od = (ObjectData) state;
+            final ObjectData od = (ObjectData) data;
             if (od.containsField()) {
                 throw new IsisException("Resolve state (for " + objectAdapter + ") inconsistent with fact that data exists for fields");
             }
@@ -314,24 +314,24 @@ public class Memento implements Serializ
         }
     }
 
-    private void updateField(final ObjectAdapter object, final ObjectData od, final ObjectAssociation field) {
-        final Object fieldData = od.getEntry(field.getId());
+    private void updateField(final ObjectAdapter objectAdapter, final ObjectData objectData, final ObjectAssociation objectAssoc) {
+        final Object fieldData = objectData.getEntry(objectAssoc.getId());
 
-        if (field.isOneToManyAssociation()) {
-            updateOneToManyAssociation(object, (OneToManyAssociation) field, (CollectionData) fieldData);
+        if (objectAssoc.isOneToManyAssociation()) {
+            updateOneToManyAssociation(objectAdapter, (OneToManyAssociation) objectAssoc, (CollectionData) fieldData);
 
-        } else if (field.getSpecification().containsFacet(EncodableFacet.class)) {
-            final EncodableFacet facet = field.getSpecification().getFacet(EncodableFacet.class);
+        } else if (objectAssoc.getSpecification().containsFacet(EncodableFacet.class)) {
+            final EncodableFacet facet = objectAssoc.getSpecification().getFacet(EncodableFacet.class);
             final ObjectAdapter value = facet.fromEncodedString((String) fieldData);
-            ((OneToOneAssociation) field).initAssociation(object, value);
+            ((OneToOneAssociation) objectAssoc).initAssociation(objectAdapter, value);
 
-        } else if (field.isOneToOneAssociation()) {
-            updateOneToOneAssociation(object, (OneToOneAssociation) field, (Data) fieldData);
+        } else if (objectAssoc.isOneToOneAssociation()) {
+            updateOneToOneAssociation(objectAdapter, (OneToOneAssociation) objectAssoc, (Data) fieldData);
         }
     }
 
-    private void updateOneToManyAssociation(final ObjectAdapter object, final OneToManyAssociation field, final CollectionData collectionData) {
-        final ObjectAdapter collection = field.get(object);
+    private void updateOneToManyAssociation(final ObjectAdapter objectAdapter, final OneToManyAssociation otma, final CollectionData collectionData) {
+        final ObjectAdapter collection = otma.get(objectAdapter);
         final CollectionFacet facet = CollectionFacetUtils.getCollectionFacetFromSpec(collection);
         final List<ObjectAdapter> original = Lists.newArrayList();
         for (final ObjectAdapter adapter : facet.iterable(collection)) {
@@ -340,35 +340,35 @@ public class Memento implements Serializ
 
         final Data[] elements = collectionData.elements;
         for (final Data data : elements) {
-            final ObjectAdapter element = recreateReference(data);
-            if (!facet.contains(collection, element)) {
+            final ObjectAdapter elementAdapter = recreateReference(data);
+            if (!facet.contains(collection, elementAdapter)) {
                 if (LOG.isDebugEnabled()) {
-                    LOG.debug("  association " + field + " changed, added " + element.getOid());
+                    LOG.debug("  association " + otma + " changed, added " + elementAdapter.getOid());
                 }
-                field.addElement(object, element);
+                otma.addElement(objectAdapter, elementAdapter);
             } else {
-                field.removeElement(object, element);
+                otma.removeElement(objectAdapter, elementAdapter);
             }
         }
 
         for (final ObjectAdapter element : original) {
             if (LOG.isDebugEnabled()) {
-                LOG.debug("  association " + field + " changed, removed " + element.getOid());
+                LOG.debug("  association " + otma + " changed, removed " + element.getOid());
             }
-            field.removeElement(object, element);
+            otma.removeElement(objectAdapter, element);
         }
     }
 
-    private void updateOneToOneAssociation(final ObjectAdapter object, final OneToOneAssociation field, final Data fieldData) {
-        if (fieldData == null) {
-            field.initAssociation(object, null);
+    private void updateOneToOneAssociation(final ObjectAdapter objectAdapter, final OneToOneAssociation otoa, final Data assocData) {
+        if (assocData == null) {
+            otoa.initAssociation(objectAdapter, null);
         } else {
-            final ObjectAdapter ref = recreateReference(fieldData);
-            if (field.get(object) != ref) {
+            final ObjectAdapter ref = recreateReference(assocData);
+            if (otoa.get(objectAdapter) != ref) {
                 if (LOG.isDebugEnabled()) {
-                    LOG.debug("  association " + field + " changed to " + ref.getOid());
+                    LOG.debug("  association " + otoa + " changed to " + ref.getOid());
                 }
-                field.initAssociation(object, ref);
+                otoa.initAssociation(objectAdapter, ref);
             }
         }
     }
@@ -378,11 +378,11 @@ public class Memento implements Serializ
     ////////////////////////////////////////////////
 
     public void encodedData(final DataOutputStreamExtended outputImpl) throws IOException {
-        outputImpl.writeEncodable(state);
+        outputImpl.writeEncodable(data);
     }
     
     public void restore(final DataInputStreamExtended input) throws IOException {
-        state = input.readEncodable(Data.class);
+        data = input.readEncodable(Data.class);
     }
 
 
@@ -399,12 +399,12 @@ public class Memento implements Serializ
 
     @Override
     public String toString() {
-        return "[" + (state == null ? null : state.getClassName() + "/" + state.getOid() + state) + "]";
+        return "[" + (data == null ? null : data.getClassName() + "/" + data.getOid() + data) + "]";
     }
 
     public void debug(final DebugBuilder debug) {
-        if (state != null) {
-            state.debug(debug);
+        if (data != null) {
+            data.debug(debug);
         }
     }
 



Mime
View raw message