You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2016/05/01 10:16:51 UTC

[14/35] isis git commit: ISIS-1396: detaching an EntityModel should cascade the detach to all child property ScalarModels.

ISIS-1396: detaching an EntityModel should cascade the detach to all child property ScalarModels.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/18b54eba
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/18b54eba
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/18b54eba

Branch: refs/heads/ISIS-1291
Commit: 18b54ebadad9978698f4d67127a6d1ffdbbb1c96
Parents: 7f44c5c
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Fri Apr 29 14:55:28 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Fri Apr 29 14:55:28 2016 +0100

----------------------------------------------------------------------
 .../isis/viewer/wicket/model/models/EntityModel.java   | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/18b54eba/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
index d665ff2..ec180d2 100644
--- a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
+++ b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/EntityModel.java
@@ -451,9 +451,20 @@ public class EntityModel extends BookmarkableModel<ObjectAdapter> implements UiH
         return this;
     }
 
+    // //////////////////////////////////////////////////////////
+    // detach
+    // //////////////////////////////////////////////////////////
 
+    @Override
+    protected void onDetach() {
+        super.onDetach();
+        for (PropertyMemento propertyMemento : propertyScalarModels.keySet()) {
+            final ScalarModel scalarModel = propertyScalarModels.get(propertyMemento);
+            scalarModel.detach();
+        }
+        propertyScalarModels.clear();
+    }
 
-    
     // //////////////////////////////////////////////////////////
     // concurrency exceptions
     // //////////////////////////////////////////////////////////