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 18:12:22 UTC
[22/34] isis git commit: ISIS-1194: law of demeter for
FrameworkSynchronizer and TransactionManager - call PersistenceSession
instead.
ISIS-1194: law of demeter for FrameworkSynchronizer and TransactionManager - call PersistenceSession instead.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/17cd7bc2
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/17cd7bc2
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/17cd7bc2
Branch: refs/heads/ISIS-1194
Commit: 17cd7bc2aa6eac117c0d38f771d22db832cc3c19
Parents: b208837
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 10 16:27:42 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 10 16:27:42 2015 +0100
----------------------------------------------------------------------
.../persistence/FrameworkSynchronizer.java | 29 ++++----------------
.../system/persistence/PersistenceSession.java | 9 +++++-
2 files changed, 14 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/17cd7bc2/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/FrameworkSynchronizer.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/FrameworkSynchronizer.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/FrameworkSynchronizer.java
index ed51221..5a4e321 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/FrameworkSynchronizer.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/FrameworkSynchronizer.java
@@ -115,9 +115,9 @@ public class FrameworkSynchronizer {
if(ConcurrencyChecking.isCurrentlyEnabled()) {
LOG.info("concurrency conflict detected on " + thisOid + " (" + otherVersion + ")");
- final String currentUser = getAuthenticationSession().getUserName();
+ final String currentUser = authenticationSession.getUserName();
final ConcurrencyException abortCause = new ConcurrencyException(currentUser, thisOid, thisVersion, otherVersion);
- getCurrentTransaction().setAbortCause(abortCause);
+ persistenceSession.getCurrentTransaction().setAbortCause(abortCause);
} else {
LOG.warn("concurrency conflict detected but suppressed, on " + thisOid + " (" + otherVersion + ")");
@@ -208,7 +208,7 @@ public class FrameworkSynchronizer {
CallbackFacet.Util.callCallback(adapter, PersistedCallbackFacet.class);
- final IsisTransaction transaction = getCurrentTransaction();
+ final IsisTransaction transaction = persistenceSession.getCurrentTransaction();
transaction.enlistCreated(adapter);
} else {
// updating;
@@ -253,7 +253,7 @@ public class FrameworkSynchronizer {
CallbackFacet.Util.callCallback(adapter, UpdatingCallbackFacet.class);
- final IsisTransaction transaction = getCurrentTransaction();
+ final IsisTransaction transaction = persistenceSession.getCurrentTransaction();
transaction.enlistUpdating(adapter);
ensureRootObject(pojo);
@@ -283,7 +283,7 @@ public class FrameworkSynchronizer {
public void run() {
ObjectAdapter adapter = persistenceSession.adapterFor(pojo);
- final IsisTransaction transaction = getCurrentTransaction();
+ final IsisTransaction transaction = persistenceSession.getCurrentTransaction();
transaction.enlistDeleting(adapter);
CallbackFacet.Util.callCallback(adapter, RemovingCallbackFacet.class);
@@ -365,7 +365,7 @@ public class FrameworkSynchronizer {
}
private Version getVersionIfAny(final Persistable pojo) {
- return Utils.getVersionIfAny(pojo, getAuthenticationSession());
+ return Utils.getVersionIfAny(pojo, authenticationSession);
}
@SuppressWarnings("unused")
@@ -378,21 +378,4 @@ public class FrameworkSynchronizer {
}
-
- // /////////////////////////////////////////////////////////
- // Dependencies (from context)
- // /////////////////////////////////////////////////////////
-
- protected AuthenticationSession getAuthenticationSession() {
- return authenticationSession;
- }
-
- protected PersistenceSession getPersistenceSession() {
- return persistenceSession;
- }
-
- protected IsisTransaction getCurrentTransaction() {
- return persistenceSession.getTransactionManager().getTransaction();
- }
-
}
http://git-wip-us.apache.org/repos/asf/isis/blob/17cd7bc2/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 0ba7341..9e7baf1 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
@@ -1184,7 +1184,14 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
}
//endregion
-
+
+ //region > TransactionManager delegate methods
+ protected IsisTransaction getCurrentTransaction() {
+ return transactionManager.getTransaction();
+ }
+ //endregion
+
+
}