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 2016/05/01 10:17:04 UTC

[27/35] isis git commit: ISIS-1370: removing unused code from IsisTransaction

ISIS-1370: removing unused code from IsisTransaction


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

Branch: refs/heads/ISIS-1291
Commit: 144aefa2dfd89bc2ab7a69a173635db2ea76dea8
Parents: 08d87c0
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Sun May 1 06:54:51 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Sun May 1 06:54:51 2016 +0100

----------------------------------------------------------------------
 .../system/transaction/IsisTransaction.java     | 63 ++------------------
 .../transaction/IsisTransactionManager.java     |  3 +-
 2 files changed, 5 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/144aefa2/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
index 3bc0aec..0f29521 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
@@ -45,7 +45,6 @@ import org.apache.isis.applib.clock.Clock;
 import org.apache.isis.applib.services.actinvoc.ActionInvocationContext;
 import org.apache.isis.applib.services.audit.AuditingService3;
 import org.apache.isis.applib.services.bookmark.Bookmark;
-import org.apache.isis.applib.services.clock.ClockService;
 import org.apache.isis.applib.services.command.Command;
 import org.apache.isis.applib.services.command.Command2;
 import org.apache.isis.applib.services.command.Command3;
@@ -53,17 +52,12 @@ import org.apache.isis.applib.services.command.CommandContext;
 import org.apache.isis.applib.services.command.spi.CommandService;
 import org.apache.isis.applib.services.iactn.Interaction;
 import org.apache.isis.applib.services.iactn.InteractionContext;
-import org.apache.isis.applib.services.publish.EventSerializer;
-import org.apache.isis.applib.services.publish.ObjectStringifier;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.authentication.MessageBroker;
 import org.apache.isis.core.commons.components.TransactionScopedComponent;
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.ensure.Ensure;
 import org.apache.isis.core.commons.exceptions.IsisException;
 import org.apache.isis.core.commons.util.ToString;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
 import org.apache.isis.core.metamodel.adapter.oid.RootOid;
 import org.apache.isis.core.metamodel.consent.InteractionInitiatedBy;
 import org.apache.isis.core.metamodel.facets.actions.action.invocation.CommandUtil;
@@ -214,36 +208,23 @@ public class IsisTransaction implements TransactionScopedComponent {
 
     private static final Logger LOG = LoggerFactory.getLogger(IsisTransaction.class);
 
-    private final IsisTransactionManager.PersistenceSessionTransactionManagement persistenceSession;
     private final List<PersistenceCommand> persistenceCommands = Lists.newArrayList();
     private final IsisTransactionManager transactionManager;
     private final MessageBroker messageBroker;
 
     private final ServicesInjector servicesInjector;
 
-    /**
-     * the 'owning' command, (if service configured).
-     */
-    private final Command command;
-
     private final CommandContext commandContext;
     private final CommandService commandService;
 
     private final InteractionContext interactionContext;
+    private final PublishingServiceInternal publishingServiceInternal;
 
-    private final ClockService clockService;
     /**
      * could be null if none has been registered.
      */
     private final AuditingService3 auditingServiceIfAny;
-    /**
-     * could be null if none has been registered
-     */
-    private final PublishingServiceInternal publishingServiceInternal;
 
-    /**
-     * Will be that of the {@link #command} if not <tt>null</tt>, otherwise will be randomly created.
-     */
     private final UUID transactionId;
         
     private State state;
@@ -255,7 +236,6 @@ public class IsisTransaction implements TransactionScopedComponent {
     public IsisTransaction(
             final IsisTransactionManager transactionManager,
             final MessageBroker messageBroker,
-            final IsisTransactionManager.PersistenceSessionTransactionManagement persistenceSession,
             final ServicesInjector servicesInjector,
             final UUID transactionId) {
         
@@ -271,29 +251,20 @@ public class IsisTransaction implements TransactionScopedComponent {
         this.commandService = lookupService(CommandService.class);
 
         this.interactionContext = lookupService(InteractionContext.class);
-        this.clockService = lookupService(ClockService.class);
 
         this.auditingServiceIfAny = lookupServiceIfAny(AuditingService3.class);
         this.publishingServiceInternal = lookupService(PublishingServiceInternal.class);
 
-        // determine whether this xactn is taking place in the context of an
-        // existing command in which a previous xactn has already occurred.
-        // if so, reuse that transactionId.
-        command = commandContext.getCommand();
 
         this.transactionId = transactionId;
 
         this.state = State.IN_PROGRESS;
 
-        this.persistenceSession = persistenceSession;
         if (LOG.isDebugEnabled()) {
             LOG.debug("new transaction " + this);
         }
     }
 
-    protected EventSerializer newSimpleEventSerializer() {
-        return new EventSerializer.Simple();
-    }
 
     // ////////////////////////////////////////////////////////////////
     // GUID
@@ -552,7 +523,7 @@ public class IsisTransaction implements TransactionScopedComponent {
                     Collections.unmodifiableSet(
                             Sets.filter(processedObjectProperties.entrySet(), PreAndPostValues.Predicates.CHANGED));
 
-            ensureCommandsPersistedIfDirtyXactnAndAnySafeSemanticsHonoured(changedObjectProperties);
+            ensureCommandsPersistedIfDirtyXactn(changedObjectProperties);
 
             preCommitServices(changedObjectProperties);
 
@@ -563,7 +534,8 @@ public class IsisTransaction implements TransactionScopedComponent {
         }
     }
 
-    private void ensureCommandsPersistedIfDirtyXactnAndAnySafeSemanticsHonoured(final Set<Entry<AdapterAndProperty, PreAndPostValues>> changedObjectProperties) {
+    private void ensureCommandsPersistedIfDirtyXactn(
+            final Set<Entry<AdapterAndProperty, PreAndPostValues>> changedObjectProperties) {
 
         final Command command = commandContext.getCommand();
 
@@ -681,14 +653,7 @@ public class IsisTransaction implements TransactionScopedComponent {
     // handle exceptions on load, flush or commit
     /////////////////////////////////////////////////////////////////////////
 
-    // SEEMINGLY UNUSED
-    @Deprecated
-    public void ensureNoAbortCause() {
-        Ensure.ensureThatArg(abortCause, is(nullValue()), "abort cause has been set");
-    }
 
-    
-    
     /**
      * Indicate that the transaction must be aborted, and that there is
      * an unhandled exception to be rendered somehow.
@@ -863,9 +828,6 @@ public class IsisTransaction implements TransactionScopedComponent {
             return bookmarkStr + " , " + getProperty().getId();
         }
 
-        protected OidMarshaller getMarshaller() {
-            return new OidMarshaller();
-        }
 
         private Object getPropertyValue() {
             ObjectAdapter referencedAdapter = property.get(objectAdapter, InteractionInitiatedBy.FRAMEWORK);
@@ -969,8 +931,6 @@ public class IsisTransaction implements TransactionScopedComponent {
     private final Map<ObjectAdapter,ChangeKind> changeKindByEnlistedAdapter = Maps.newLinkedHashMap();
     private final Map<AdapterAndProperty, PreAndPostValues> changedObjectProperties = Maps.newLinkedHashMap();
 
-    private ObjectStringifier objectStringifier;
-
 
 
 
@@ -1112,20 +1072,5 @@ public class IsisTransaction implements TransactionScopedComponent {
         return servicesInjector.lookupService(serviceType);
     }
 
-    ////////////////////////////////////////////////////////////////////////
-    // Dependencies (from constructor)
-    ////////////////////////////////////////////////////////////////////////
-
-    protected OidMarshaller getOidMarshaller() {
-        return IsisContext.getOidMarshaller();
-    }
-
-    protected IsisConfiguration getConfiguration() {
-        return IsisContext.getConfiguration();
-    }
-
-    protected IsisTransactionManager.PersistenceSessionTransactionManagement getPersistenceSession() {
-        return persistenceSession;
-    }
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/144aefa2/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
index 031048d..23d759c 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
@@ -299,8 +299,7 @@ public class IsisTransactionManager implements SessionScopedComponent {
             initOtherApplibServicesIfConfigured();
 
             final MessageBroker messageBroker = MessageBroker.acquire(getAuthenticationSession());
-            this.transaction = new IsisTransaction(
-                    this, messageBroker, persistenceSession, servicesInjector, transactionId);
+            this.transaction = new IsisTransaction(this, messageBroker, servicesInjector, transactionId);
             transactionLevel = 0;
 
             persistenceSession.startTransaction();