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

[41/50] [abbrv] isis git commit: ISIS-1194: minor refactoring of PersistenceSession#findInstances

ISIS-1194: minor refactoring of PersistenceSession#findInstances


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

Branch: refs/heads/ISIS-1194
Commit: dfdd5696ddb6d96ae5400d6d1b9c4547744bb740
Parents: 1bb1aa0
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 10 10:14:50 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 10 10:14:50 2015 +0100

----------------------------------------------------------------------
 .../system/persistence/PersistenceSession.java  | 21 ++++++++++----------
 1 file changed, 10 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/dfdd5696/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 b412845..74d9774 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
@@ -440,21 +440,20 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
         if (LOG.isDebugEnabled()) {
             LOG.debug("getInstances matching " + persistenceQuery);
         }
+
+        final PersistenceQueryProcessor<? extends PersistenceQuery> processor =
+                PersistenceSession.this.persistenceQueryProcessorByClass
+                        .get(persistenceQuery.getClass());
+        if (processor == null) {
+            throw new UnsupportedFindException(MessageFormat.format(
+                    "Unsupported criteria type: {0}", persistenceQuery.getClass().getName()));
+        }
+
         final List<ObjectAdapter> instances = getTransactionManager().executeWithinTransaction(
                 new TransactionalClosureWithReturn<List<ObjectAdapter>>() {
                     @Override
                     public List<ObjectAdapter> execute() {
-                        PersistenceSession.this.ensureOpened();
-                        PersistenceSession.this.ensureInTransaction();
-
-                        final PersistenceQueryProcessor<? extends PersistenceQuery> processor =
-                                PersistenceSession.this.persistenceQueryProcessorByClass
-                                        .get(persistenceQuery.getClass());
-                        if (processor == null) {
-                            throw new UnsupportedFindException(MessageFormat.format(
-                                    "Unsupported criteria type: {0}", persistenceQuery.getClass().getName()));
-                        }
-                        return PersistenceSession.this.processPersistenceQuery(processor, persistenceQuery);
+                        return processPersistenceQuery(processor, persistenceQuery);
                     }
                 });
         final ObjectSpecification specification = persistenceQuery.getSpecification();