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

[33/50] [abbrv] isis git commit: ISIS-1194: PersistenceSession, renamed createCreateObjectcommand; inlined transaction mgmt methods.

ISIS-1194: PersistenceSession, renamed createCreateObjectcommand; inlined transaction mgmt methods.


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

Branch: refs/heads/ISIS-1194
Commit: 0db608e0abed4b1cb4f25e503fc59cba4d85a04b
Parents: f54bcc5
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Sep 10 10:06:42 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Sep 10 10:06:42 2015 +0100

----------------------------------------------------------------------
 .../system/persistence/PersistenceSession.java  | 30 ++++++--------------
 1 file changed, 8 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/0db608e0/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 5c12a30..35bf038 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
@@ -277,9 +277,8 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
      *
      * <p>
      * Automatically {@link IsisTransactionManager#endTransaction() ends
-     * (commits)} the current (Isis) {@link IsisTransaction}. This in turn
-     * {@link PersistenceSession#commitJdoTransaction() commits the underlying
-     * JDO transaction}.
+     * (commits)} the current (Isis) {@link IsisTransaction}. This in turn commits the underlying
+     * JDO transaction.
      *
      * <p>
      * The corresponding DataNucleus entity is then closed.
@@ -879,7 +878,7 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
      * </p>
      *
      */
-    public CreateObjectCommand createCreateObjectCommand(final ObjectAdapter adapter) {
+    public CreateObjectCommand newCreateObjectCommand(final ObjectAdapter adapter) {
         ensureOpened();
         ensureInSession();
 
@@ -948,31 +947,18 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
     }
 
     /**
-     * Uses the {@link ObjectStore} to
-     * {@link #createCreateObjectCommand(ObjectAdapter) create} a
-     * {@link CreateObjectCommand}, and adds to the
+     * {@link #newCreateObjectCommand(ObjectAdapter) Create}s a {@link CreateObjectCommand}, and adds to the
      * {@link IsisTransactionManager}.
      */
     public void addCreateObjectCommand(final ObjectAdapter object) {
-        getTransactionManager().addCommand(createCreateObjectCommand(object));
+        final CreateObjectCommand createObjectCommand = newCreateObjectCommand(object);
+        transactionManager.addCommand(createObjectCommand);
     }
 
     //endregion
 
     //region > transactions
     public void startTransaction() {
-        beginJdoTransaction();
-    }
-
-    public void endTransaction() {
-        commitJdoTransaction();
-    }
-
-    public void abortTransaction() {
-        rollbackJdoTransaction();
-    }
-
-    private void beginJdoTransaction() {
         final javax.jdo.Transaction transaction = persistenceManager.currentTransaction();
         if (transaction.isActive()) {
             throw new IllegalStateException("Transaction already active");
@@ -980,14 +966,14 @@ public class PersistenceSession implements TransactionalResource, SessionScopedC
         transaction.begin();
     }
 
-    private void commitJdoTransaction() {
+    public void endTransaction() {
         final javax.jdo.Transaction transaction = persistenceManager.currentTransaction();
         if (transaction.isActive()) {
             transaction.commit();
         }
     }
 
-    private void rollbackJdoTransaction() {
+    public void abortTransaction() {
         final javax.jdo.Transaction transaction = persistenceManager.currentTransaction();
         if (transaction.isActive()) {
             transaction.rollback();