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 2015/09/10 14:07:22 UTC

[23/50] [abbrv] isis git commit: ISIS-1194: inlining PersistenceSession#getOidForServiceFromPersistenceLayer

ISIS-1194: inlining PersistenceSession#getOidForServiceFromPersistenceLayer


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

Branch: refs/heads/ISIS-1194
Commit: 5077be0eee56acd42b82ffcaaa4e8d26c778a810
Parents: 036b029
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 10 09:26:20 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 10 09:26:20 2015 +0100

----------------------------------------------------------------------
 .../system/persistence/PersistenceSession.java   | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/5077be0e/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
index f784a20..10568f3 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
@@ -245,7 +245,6 @@ public class PersistenceSession implements SessionScopedComponent, DebuggableWit
 
             if (existingOid == null) {
                 final RootOid persistentOid = (RootOid) serviceAdapter.getOid();
-                ensureOpened();
                 this.registeredServices.put(persistentOid.getObjectSpecId(), persistentOid);
             }
         }
@@ -476,7 +475,13 @@ public class PersistenceSession implements SessionScopedComponent, DebuggableWit
      * session.
      */
     protected RootOid getOidForService(final ObjectSpecification serviceSpec) {
-        return getOidForServiceFromPersistenceLayer(serviceSpec);
+        final ObjectSpecId objectSpecId = serviceSpec.getSpecId();
+        RootOid oid = servicesByObjectType.get(objectSpecId);
+        if (oid == null) {
+            oid = objectStoreGetOidForService(serviceSpec);
+            servicesByObjectType.put(objectSpecId, oid);
+        }
+        return oid;
     }
 
     private RootOid objectStoreGetOidForService(ObjectSpecification serviceSpec) {
@@ -504,16 +509,6 @@ public class PersistenceSession implements SessionScopedComponent, DebuggableWit
         return serviceAdapter;
     }
 
-    private RootOid getOidForServiceFromPersistenceLayer(final ObjectSpecification serviceSpecification) {
-        final ObjectSpecId objectSpecId = serviceSpecification.getSpecId();
-        RootOid oid = servicesByObjectType.get(objectSpecId);
-        if (oid == null) {
-            oid = objectStoreGetOidForService(serviceSpecification);
-            servicesByObjectType.put(objectSpecId, oid);
-        }
-        return oid;
-    }
-
     //endregion
 
     //region > fixture installation