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:37 UTC

[38/50] [abbrv] isis git commit: ISIS-1194: inlined PersistenceSessio#loadInstancesAndAdapt

ISIS-1194: inlined PersistenceSessio#loadInstancesAndAdapt


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

Branch: refs/heads/ISIS-1194
Commit: 853114d0282c114726aa3f8d9075d4e1410784b1
Parents: f44dee7
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 10 10:11:56 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 10 10:11:56 2015 +0100

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


http://git-wip-us.apache.org/repos/asf/isis/blob/853114d0/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 8a2bb37..479dfab 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
@@ -464,26 +464,21 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
                 new TransactionalClosureWithReturn<List<ObjectAdapter>>() {
                     @Override
                     public List<ObjectAdapter> execute() {
-                        return loadInstancesAndAdapt(persistenceQuery);
+                        ensureOpened();
+                        ensureInTransaction();
+
+                        final PersistenceQueryProcessor<? extends PersistenceQuery> processor =
+                                persistenceQueryProcessorByClass.get(persistenceQuery.getClass());
+                        if (processor == null) {
+                            throw new UnsupportedFindException(MessageFormat.format(
+                                    "Unsupported criteria type: {0}", persistenceQuery.getClass().getName()));
+                        }
+                        return processPersistenceQuery(processor, persistenceQuery);
                     }
                 });
     }
     //endregion
 
-    //region > loadInstancesAndAdapt
-    public List<ObjectAdapter> loadInstancesAndAdapt(final PersistenceQuery persistenceQuery) {
-        ensureOpened();
-        ensureInTransaction();
-
-        final PersistenceQueryProcessor<? extends PersistenceQuery> processor =
-                persistenceQueryProcessorByClass.get(persistenceQuery.getClass());
-        if (processor == null) {
-            throw new UnsupportedFindException(MessageFormat.format(
-                    "Unsupported criteria type: {0}", persistenceQuery.getClass().getName()));
-        }
-        return processPersistenceQuery(processor, persistenceQuery);
-    }
-
     @SuppressWarnings("unchecked")
     private <Q extends PersistenceQuery> List<ObjectAdapter> processPersistenceQuery(final PersistenceQueryProcessor<Q> persistenceQueryProcessor, final PersistenceQuery persistenceQuery) {
         return persistenceQueryProcessor.process((Q) persistenceQuery);
@@ -750,8 +745,7 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
     }
 
     /**
-     * Not API; provides the ability to force a reload (refresh in JDO terms)
-     * of the domain object wrapped in the {@link ObjectAdapter}.
+     * Forces a reload (refresh in JDO terminology) of the domain object wrapped in the {@link ObjectAdapter}.
      */
     public void refreshRoot(final ObjectAdapter adapter) {
 
@@ -770,7 +764,6 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
         // possibly redundant because also called in the post-load event
         // listener, but (with JPA impl) found it was required if we were ever to
         // get an eager left-outer-join as the result of a refresh (sounds possible).
-
         frameworkSynchronizer.postLoadProcessingFor((Persistable) domainObject,
                 FrameworkSynchronizer.CalledFrom.OS_RESOLVE);
     }
@@ -849,7 +842,7 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
 
     //endregion
 
-    //region > createXxxCommand
+    //region > newXxxCommand
     /**
      * Makes an {@link ObjectAdapter} persistent. The specified object should be
      * stored away via this object store's persistence mechanism, and have an