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/04/14 12:11:35 UTC
[26/31] isis git commit: ISIS-1291: added guard in
CommandMementoServiceDefault,
can only create for commands that represent actions (not property edits).
ISIS-1291: added guard in CommandMementoServiceDefault, can only create for commands that represent actions (not property edits).
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/d4c9875d
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/d4c9875d
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/d4c9875d
Branch: refs/heads/ISIS-1291
Commit: d4c9875df22e2b865a433f0ff6ba32eb78d5bb40
Parents: 8fb9dc4
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Apr 14 09:47:06 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Apr 14 09:47:06 2016 +0100
----------------------------------------------------------------------
.../services/command/CommandMementoServiceDefault.java | 8 ++++++++
1 file changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/d4c9875d/core/runtime/src/main/java/org/apache/isis/core/runtime/services/command/CommandMementoServiceDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/command/CommandMementoServiceDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/command/CommandMementoServiceDefault.java
index baefd29..5b6399f 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/command/CommandMementoServiceDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/command/CommandMementoServiceDefault.java
@@ -20,6 +20,7 @@ import java.lang.reflect.Method;
import java.sql.Timestamp;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
import javax.annotation.PostConstruct;
@@ -150,6 +151,13 @@ public class CommandMementoServiceDefault implements CommandMementoService {
public EventMetadata newEventMetadata(
final Command command,
final String currentUser, final Timestamp timestamp, final String sequenceName) {
+
+ if(command.getTargetAction().equals(Command.TARGET_ACTION_FOR_EDIT)) {
+ throw new IllegalArgumentException(String.format(
+ "EventMetadata can only be created for commands that represent actions, not property edits; object: %s, member: %s",
+ command.getTarget(), command.getMemberIdentifier()));
+ }
+
throw new RuntimeException("not yet implemented");
}