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:39 UTC
[40/50] [abbrv] isis git commit: ISIS-1194: inlined
PersistenceSession#getInstances
ISIS-1194: inlined PersistenceSession#getInstances
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/1bb1aa0d
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/1bb1aa0d
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/1bb1aa0d
Branch: refs/heads/ISIS-1194
Commit: 1bb1aa0d197755340444882f9f52c6dbd49a1b78
Parents: 7a1d886
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 10 10:13:02 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 10 10:13:02 2015 +0100
----------------------------------------------------------------------
.../system/persistence/PersistenceSession.java | 38 +++++++++-----------
1 file changed, 17 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/1bb1aa0d/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 365c8c4..b412845 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
@@ -437,41 +437,37 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
* if the criteria is not support by this persistor
*/
public ObjectAdapter findInstances(final PersistenceQuery persistenceQuery) {
- final List<ObjectAdapter> instances = getInstances(persistenceQuery);
- final ObjectSpecification specification = persistenceQuery.getSpecification();
- final FreeStandingList results = new FreeStandingList(specification, instances);
- return getAdapterManager().adapterFor(results);
- }
-
- /**
- * Converts the {@link Query applib representation of a query} into the
- * {@link PersistenceQuery NOF-internal representation}.
- */
- protected final PersistenceQuery createPersistenceQueryFor(final Query<?> query, final QueryCardinality cardinality) {
- return persistenceQueryFactory.createPersistenceQueryFor(query, cardinality);
- }
-
-
- protected List<ObjectAdapter> getInstances(final PersistenceQuery persistenceQuery) {
if (LOG.isDebugEnabled()) {
LOG.debug("getInstances matching " + persistenceQuery);
}
- return getTransactionManager().executeWithinTransaction(
+ final List<ObjectAdapter> instances = getTransactionManager().executeWithinTransaction(
new TransactionalClosureWithReturn<List<ObjectAdapter>>() {
@Override
public List<ObjectAdapter> execute() {
- ensureOpened();
- ensureInTransaction();
+ PersistenceSession.this.ensureOpened();
+ PersistenceSession.this.ensureInTransaction();
final PersistenceQueryProcessor<? extends PersistenceQuery> processor =
- persistenceQueryProcessorByClass.get(persistenceQuery.getClass());
+ PersistenceSession.this.persistenceQueryProcessorByClass
+ .get(persistenceQuery.getClass());
if (processor == null) {
throw new UnsupportedFindException(MessageFormat.format(
"Unsupported criteria type: {0}", persistenceQuery.getClass().getName()));
}
- return processPersistenceQuery(processor, persistenceQuery);
+ return PersistenceSession.this.processPersistenceQuery(processor, persistenceQuery);
}
});
+ final ObjectSpecification specification = persistenceQuery.getSpecification();
+ final FreeStandingList results = new FreeStandingList(specification, instances);
+ return getAdapterManager().adapterFor(results);
+ }
+
+ /**
+ * Converts the {@link Query applib representation of a query} into the
+ * {@link PersistenceQuery NOF-internal representation}.
+ */
+ protected final PersistenceQuery createPersistenceQueryFor(final Query<?> query, final QueryCardinality cardinality) {
+ return persistenceQueryFactory.createPersistenceQueryFor(query, cardinality);
}
//endregion