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/17 04:20:51 UTC

[isis] 03/03: ISIS-1742: rolls Command3 up into Command

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 d609fd95089b9fe17decdde25a6072ccb6f17047
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Mon Oct 16 22:55:15 2017 +0100

    ISIS-1742: rolls Command3 up into Command
---
 .../isis/applib/services/command/Command.java      | 32 +++++++++++-
 .../isis/applib/services/command/Command3.java     | 58 ----------------------
 .../applib/services/command/CommandDefault.java    |  2 +-
 ...tract.java => CommandContractTestAbstract.java} |  6 +--
 .../services/command/CommandDefaultTest.java       |  4 +-
 .../core/metamodel/facets/DomainEventHelper.java   |  6 +--
 .../system/persistence/PersistenceSession.java     |  6 +--
 todo-deprecation-list.txt                          |  6 ++-
 8 files changed, 42 insertions(+), 78 deletions(-)

diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java b/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java
index a876261..d42f8ad 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java
@@ -17,6 +17,7 @@
 package org.apache.isis.applib.services.command;
 
 import java.sql.Timestamp;
+import java.util.List;
 
 import javax.annotation.Nullable;
 
@@ -45,8 +46,7 @@ import org.apache.isis.schema.cmd.v1.CommandDto;
  *     The {@link Command} interface also captures details of the corresponding action invocation (or property edit),
  *     specifically when that action/edit {@link Command#getStartedAt() started} or
  *     {@link Command#getCompletedAt() completed}, and its result, either a {@link Command#getResult() return value}
- *     or an {@link Command#getException() exception}.  The {@link Command3} sub-interface also captures the stack
- *     of {@link ActionDomainEvent}s.
+ *     or an {@link Command#getException() exception}.  Also captures a stack of {@link ActionDomainEvent}s.
  * </p>
  *
  * <p>
@@ -229,6 +229,34 @@ public interface Command extends HasTransactionId {
      */
     void setExecuteIn(final CommandExecuteIn executeIn);
 
+    /**
+     * @deprecated - use {@link Interaction#getCurrentExecution()}, {@link Interaction#getPriorExecution()}  and {@link Interaction#getExecutions()} instead.
+     */
+    @Deprecated
+    @Programmatic
+    ActionDomainEvent<?> peekActionDomainEvent();
+
+    /**
+     * @deprecated - replaced by equivalent functionality in {@link Interaction}.
+     */
+    @Deprecated
+    @Programmatic
+    void pushActionDomainEvent(ActionDomainEvent<?> event);
+
+    /**
+     * @deprecated - replaced by equivalent functionality in {@link Interaction}.
+     */
+    @Deprecated
+    @Programmatic
+    ActionDomainEvent<?> popActionDomainEvent();
+
+    /**
+     * @deprecated - use {@link Interaction#getCurrentExecution()}, {@link Interaction#getPriorExecution()}  and {@link Interaction#getExecutions()} instead.
+     */
+    @Deprecated
+    @Programmatic
+    List<ActionDomainEvent<?>> flushActionDomainEvents();
+
     //endregion
 
     //region > executor (property)
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/command/Command3.java b/core/applib/src/main/java/org/apache/isis/applib/services/command/Command3.java
deleted file mode 100644
index a7eeb79..0000000
--- a/core/applib/src/main/java/org/apache/isis/applib/services/command/Command3.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.isis.applib.services.command;
-
-import java.util.List;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
-import org.apache.isis.applib.services.iactn.Interaction;
-import org.apache.isis.applib.services.iactn.InteractionContext;
-
-/**
- * @deprecated - the extensions to {@link Command} in this interface have been replaced by functionality in {@link InteractionContext}.
- */
-@Deprecated
-public interface Command3 extends Command {
-
-    /**
-     * @deprecated - use {@link Interaction#getCurrentExecution()}, {@link Interaction#getPriorExecution()}  and {@link Interaction#getExecutions()} instead.
-     */
-    @Deprecated
-    @Programmatic
-    ActionDomainEvent<?> peekActionDomainEvent();
-
-    /**
-     * @deprecated - replaced by equivalent functionality in {@link Interaction}.
-     */
-    @Deprecated
-    @Programmatic
-    void pushActionDomainEvent(ActionDomainEvent<?> event);
-
-    /**
-     * @deprecated - replaced by equivalent functionality in {@link Interaction}.
-     */
-    @Deprecated
-    @Programmatic
-    ActionDomainEvent<?> popActionDomainEvent();
-
-    /**
-     * @deprecated - use {@link Interaction#getCurrentExecution()}, {@link Interaction#getPriorExecution()}  and {@link Interaction#getExecutions()} instead.
-     */
-    @Deprecated
-    @Programmatic
-    List<ActionDomainEvent<?>> flushActionDomainEvents();
-}
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/command/CommandDefault.java b/core/applib/src/main/java/org/apache/isis/applib/services/command/CommandDefault.java
index d4c8f0f..3a9047d 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/command/CommandDefault.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/command/CommandDefault.java
@@ -34,7 +34,7 @@ import org.apache.isis.applib.services.bookmark.Bookmark;
 import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
 import org.apache.isis.applib.util.ObjectContracts;
 
-public class CommandDefault implements Command3 {
+public class CommandDefault implements Command {
 
     //region > constructor
 
diff --git a/core/applib/src/test/java/org/apache/isis/applib/services/command/Command2ContractTestAbstract.java b/core/applib/src/test/java/org/apache/isis/applib/services/command/CommandContractTestAbstract.java
similarity index 96%
rename from core/applib/src/test/java/org/apache/isis/applib/services/command/Command2ContractTestAbstract.java
rename to core/applib/src/test/java/org/apache/isis/applib/services/command/CommandContractTestAbstract.java
index daadc0f..169ee59 100644
--- a/core/applib/src/test/java/org/apache/isis/applib/services/command/Command2ContractTestAbstract.java
+++ b/core/applib/src/test/java/org/apache/isis/applib/services/command/CommandContractTestAbstract.java
@@ -28,9 +28,9 @@ import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 
-public abstract class Command2ContractTestAbstract {
+public abstract class CommandContractTestAbstract {
 
-    Command3 command;
+    Command command;
 
     ActionDomainEvent<Object> ev1;
     ActionDomainEvent<Object> ev2;
@@ -46,7 +46,7 @@ public abstract class Command2ContractTestAbstract {
         command = newCommand();
     }
 
-    protected abstract Command3 newCommand();
+    protected abstract Command newCommand();
 
     @Test
     public void givenEmpty() throws Exception {
diff --git a/core/applib/src/test/java/org/apache/isis/applib/services/command/CommandDefaultTest.java b/core/applib/src/test/java/org/apache/isis/applib/services/command/CommandDefaultTest.java
index 975a9fb..359e007 100644
--- a/core/applib/src/test/java/org/apache/isis/applib/services/command/CommandDefaultTest.java
+++ b/core/applib/src/test/java/org/apache/isis/applib/services/command/CommandDefaultTest.java
@@ -18,9 +18,9 @@
  */
 package org.apache.isis.applib.services.command;
 
-public class CommandDefaultTest extends Command2ContractTestAbstract {
+public class CommandDefaultTest extends CommandContractTestAbstract {
 
-    protected Command3 newCommand() {
+    protected Command newCommand() {
         return new CommandDefault();
     }
 
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/DomainEventHelper.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/DomainEventHelper.java
index 605c827..351f025 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/DomainEventHelper.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/DomainEventHelper.java
@@ -31,7 +31,6 @@ import com.google.common.collect.Lists;
 import org.apache.isis.applib.FatalException;
 import org.apache.isis.applib.Identifier;
 import org.apache.isis.applib.services.command.Command;
-import org.apache.isis.applib.services.command.Command3;
 import org.apache.isis.applib.services.eventbus.AbstractDomainEvent;
 import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
 import org.apache.isis.applib.services.eventbus.CollectionDomainEvent;
@@ -107,10 +106,7 @@ public class DomainEventHelper {
             // ... and associate command with event
             if(command != null) {
                 if(phase.isExecuting()) {
-                    if(command instanceof Command3) {
-                        final Command3 command3 = (Command3) command;
-                        command3.pushActionDomainEvent(event);
-                    }
+                    command.pushActionDomainEvent(event);
                 }
             }
 
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 ce80c60..e814ce6 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
@@ -44,7 +44,6 @@ import org.apache.isis.applib.services.bookmark.Bookmark;
 import org.apache.isis.applib.services.bookmark.BookmarkService;
 import org.apache.isis.applib.services.clock.ClockService;
 import org.apache.isis.applib.services.command.Command;
-import org.apache.isis.applib.services.command.Command3;
 import org.apache.isis.applib.services.command.CommandContext;
 import org.apache.isis.applib.services.command.spi.CommandService;
 import org.apache.isis.applib.services.eventbus.AbstractLifecycleEvent;
@@ -500,10 +499,7 @@ public class PersistenceSession implements
 
         commandService.complete(command);
 
-        if(command instanceof Command3) {
-            final Command3 command3 = (Command3) command;
-            command3.flushActionDomainEvents();
-        }
+        command.flushActionDomainEvents();
 
         interaction.clear();
     }
diff --git a/todo-deprecation-list.txt b/todo-deprecation-list.txt
index 6f54486..580fb80 100644
--- a/todo-deprecation-list.txt
+++ b/todo-deprecation-list.txt
@@ -143,13 +143,12 @@ org.apache.isis.applib.services.command
         next(String)
         setCompletedAt(Timestamp)
         setStartedAt(Timestamp)
-    Command3.java  - metods for working with domain events (equiv functionality in Interaction)  [suggest we retain for now]
         flushActionDomainEvents()
         peekActionDomainEvent()
         popActionDomainEvent()
         pushActionDomainEvent(ActionDomainEvent<?>)  (
 
-    MemberGroupLayout.java - entire annotation, use Xxx.layout.xml instead
+    MemberGroupsLayout.java - retain
 
 
 
@@ -386,6 +385,9 @@ org.apache.isis.applib.services.command
         popActionInteractionEvent()
         pushActionInteractionEvent(ActionInteractionEvent<?>)
 
+org.apache.isis.applib.services.command
+    Command3 rolled up into Command
+
 
 org.apache.isis.applib.services.eventbus
     AbstractInteractionEvent.java - remove

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