You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by rm...@apache.org on 2011/03/25 18:32:48 UTC
svn commit: r1085481 -
/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java
Author: rmatthews
Date: Fri Mar 25 17:32:48 2011
New Revision: 1085481
URL: http://svn.apache.org/viewvc?rev=1085481&view=rev
Log:
Memento was not restoring a graph with cyclic references
Modified:
incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java
Modified: incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java?rev=1085481&r1=1085480&r2=1085481&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java (original)
+++ incubator/isis/trunk/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/memento/Memento.java Fri Mar 25 17:32:48 2011
@@ -205,28 +205,24 @@ public class Memento implements Serializ
if (data instanceof StandaloneData) {
StandaloneData standaloneData = (StandaloneData) data;
return standaloneData.getAdapter();
- }
-
- final Oid oid = data.getOid();
- if (oid == null) {
- return null;
- }
-
- ObjectAdapter ref;
- if (oid.isTransient() && !spec.isAggregated()) {
- ref = getHydrator().recreateAdapter(oid, spec);
} else {
- ref = getHydrator().recreateAdapter(oid, spec);
- ResolveState resolveState = spec.isAggregated() ? ResolveState.TRANSIENT : ResolveState.GHOST;
- if (ref.getResolveState().isValidToChangeTo(resolveState)) {
- ref.changeState(resolveState);
+ final Oid oid = data.getOid();
+ if (oid == null) {
+ return null;
}
- // REVIEW is this needed, or is the object set up at this point
+ ObjectAdapter ref;
+ ref = getHydrator().recreateAdapter(oid, spec);
if (data instanceof ObjectData) {
- updateObject(ref, data, resolveState);
+ if (oid.isTransient() || spec.isAggregated()) {
+ ResolveState resolveState = spec.isAggregated() ? ResolveState.GHOST : ResolveState.TRANSIENT ;
+ if (ref.getResolveState().isValidToChangeTo(resolveState)) {
+ ref.changeState(resolveState);
+ }
+ updateObject(ref, data, resolveState);
+ }
}
+ return ref;
}
- return ref;
}
/**