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 2017/10/16 13:37:12 UTC

[isis] 06/08: ISIS-1742: removes empty legacy branch from BackgroundCommandExecution; removes unused mementoService

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch dev/2.0.0/ISIS-1742-remove-deprecations
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 0824e2df9f1bdcd2f30801f97602766100c28e3c
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Mon Oct 16 14:32:40 2017 +0100

    ISIS-1742: removes empty legacy branch from BackgroundCommandExecution; removes unused mementoService
---
 .../background/BackgroundCommandExecution.java     | 97 +++++++++-------------
 1 file changed, 40 insertions(+), 57 deletions(-)

diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/background/BackgroundCommandExecution.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/background/BackgroundCommandExecution.java
index 4503199..6e5ee19 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/background/BackgroundCommandExecution.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/background/BackgroundCommandExecution.java
@@ -41,7 +41,6 @@ import org.apache.isis.core.metamodel.spec.feature.Contributed;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
-import org.apache.isis.core.runtime.services.memento.MementoServiceDefault;
 import org.apache.isis.core.runtime.sessiontemplate.AbstractIsisSessionTemplate;
 import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
 import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
@@ -68,16 +67,8 @@ import org.apache.isis.schema.utils.CommonDtoUtils;
  */
 public abstract class BackgroundCommandExecution extends AbstractIsisSessionTemplate {
 
-    private final MementoServiceDefault mementoService;
 
-    public BackgroundCommandExecution() {
-        // same as configured by BackgroundServiceDefault
-        mementoService = new MementoServiceDefault().withNoEncoding();
-    }
-    
-    // //////////////////////////////////////
 
-    
     protected void doExecute(Object context) {
 
         final PersistenceSession persistenceSession = getPersistenceSession();
@@ -121,72 +112,64 @@ public abstract class BackgroundCommandExecution extends AbstractIsisSessionTemp
                 try {
                     backgroundCommand.setExecutor(Executor.BACKGROUND);
 
-                    final boolean legacy = false; // memento.startsWith("<memento");
-                    if(legacy) {
-
-
-                    } else {
-
-                        final CommandDto dto = jaxbService.fromXml(CommandDto.class, memento);
+                    final CommandDto dto = jaxbService.fromXml(CommandDto.class, memento);
 
-                        final MemberDto memberDto = dto.getMember();
-                        final String memberId = memberDto.getMemberIdentifier();
+                    final MemberDto memberDto = dto.getMember();
+                    final String memberId = memberDto.getMemberIdentifier();
 
-                        final OidsDto oidsDto = CommandDtoUtils.targetsFor(dto);
-                        final List<OidDto> targetOidDtos = oidsDto.getOid();
+                    final OidsDto oidsDto = CommandDtoUtils.targetsFor(dto);
+                    final List<OidDto> targetOidDtos = oidsDto.getOid();
 
-                        final InteractionType interactionType = memberDto.getInteractionType();
-                        if(interactionType == InteractionType.ACTION_INVOCATION) {
+                    final InteractionType interactionType = memberDto.getInteractionType();
+                    if(interactionType == InteractionType.ACTION_INVOCATION) {
 
-                            final ActionDto actionDto = (ActionDto) memberDto;
+                        final ActionDto actionDto = (ActionDto) memberDto;
 
-                            for (OidDto targetOidDto : targetOidDtos) {
+                        for (OidDto targetOidDto : targetOidDtos) {
 
-                                final ObjectAdapter targetAdapter = adapterFor(targetOidDto);
-                                final ObjectAction objectAction = findObjectAction(targetAdapter, memberId);
+                            final ObjectAdapter targetAdapter = adapterFor(targetOidDto);
+                            final ObjectAction objectAction = findObjectAction(targetAdapter, memberId);
 
-                                // we pass 'null' for the mixedInAdapter; if this action _is_ a mixin then
-                                // it will switch the targetAdapter to be the mixedInAdapter transparently
-                                final ObjectAdapter[] argAdapters = argAdaptersFor(actionDto);
-                                final ObjectAdapter resultAdapter = objectAction.execute(
-                                        targetAdapter, null, argAdapters, InteractionInitiatedBy.FRAMEWORK);
+                            // we pass 'null' for the mixedInAdapter; if this action _is_ a mixin then
+                            // it will switch the targetAdapter to be the mixedInAdapter transparently
+                            final ObjectAdapter[] argAdapters = argAdaptersFor(actionDto);
+                            final ObjectAdapter resultAdapter = objectAction.execute(
+                                    targetAdapter, null, argAdapters, InteractionInitiatedBy.FRAMEWORK);
 
-                                //
-                                // for the result adapter, we could alternatively have used...
-                                // (priorExecution populated by the push/pop within the interaction object)
-                                //
-                                // final Interaction.Execution priorExecution = backgroundInteraction.getPriorExecution();
-                                // Object unused = priorExecution.getReturned();
-                                //
+                            //
+                            // for the result adapter, we could alternatively have used...
+                            // (priorExecution populated by the push/pop within the interaction object)
+                            //
+                            // final Interaction.Execution priorExecution = backgroundInteraction.getPriorExecution();
+                            // Object unused = priorExecution.getReturned();
+                            //
 
-                                // REVIEW: this doesn't really make sense if >1 action
-                                // in any case, the capturing of the action interaction should be the
-                                // responsibility of auditing/profiling
-                                if(resultAdapter != null) {
-                                    Bookmark resultBookmark = CommandUtil.bookmarkFor(resultAdapter);
-                                    backgroundCommand.setResult(resultBookmark);
-                                }
+                            // REVIEW: this doesn't really make sense if >1 action
+                            // in any case, the capturing of the action interaction should be the
+                            // responsibility of auditing/profiling
+                            if(resultAdapter != null) {
+                                Bookmark resultBookmark = CommandUtil.bookmarkFor(resultAdapter);
+                                backgroundCommand.setResult(resultBookmark);
                             }
-                        } else {
+                        }
+                    } else {
 
-                            final PropertyDto propertyDto = (PropertyDto) memberDto;
+                        final PropertyDto propertyDto = (PropertyDto) memberDto;
 
-                            for (OidDto targetOidDto : targetOidDtos) {
+                        for (OidDto targetOidDto : targetOidDtos) {
 
-                                final Bookmark bookmark = Bookmark.from(targetOidDto);
-                                final Object targetObject = bookmarkService.lookup(bookmark);
+                            final Bookmark bookmark = Bookmark.from(targetOidDto);
+                            final Object targetObject = bookmarkService.lookup(bookmark);
 
-                                final ObjectAdapter targetAdapter = adapterFor(targetObject);
+                            final ObjectAdapter targetAdapter = adapterFor(targetObject);
 
-                                final OneToOneAssociation property = findOneToOneAssociation(targetAdapter, memberId);
+                            final OneToOneAssociation property = findOneToOneAssociation(targetAdapter, memberId);
 
-                                final ObjectAdapter newValueAdapter = newValueAdapterFor(propertyDto);
+                            final ObjectAdapter newValueAdapter = newValueAdapterFor(propertyDto);
 
-                                property.set(targetAdapter, newValueAdapter, InteractionInitiatedBy.FRAMEWORK);
-                                // there is no return value for property modifications.
-                            }
+                            property.set(targetAdapter, newValueAdapter, InteractionInitiatedBy.FRAMEWORK);
+                            // there is no return value for property modifications.
                         }
-
                     }
 
                 } catch (RuntimeException e) {

-- 
To stop receiving notification emails like this one, please contact
"commits@isis.apache.org" <co...@isis.apache.org>.