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/01/22 17:56:47 UTC
[19/50] [abbrv] isis git commit: ISIS-970: changing 'interaction' to
'domainEvent', with...
ISIS-970: changing 'interaction' to 'domainEvent', with...
... corresponding new XxxDomainEvent classes deprecating XxxInteractionEvent
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/e4e41868
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/e4e41868
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/e4e41868
Branch: refs/heads/master
Commit: e4e41868b8e0b458e58432f25f4d39428a7f817a
Parents: a4fbecb
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Fri Jan 9 09:42:27 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Jan 22 16:32:35 2015 +0000
----------------------------------------------------------------------
.../apache/isis/applib/annotation/Action.java | 10 +-
.../applib/annotation/ActionInteraction.java | 4 +-
.../isis/applib/annotation/Collection.java | 8 +-
.../annotation/CollectionInteraction.java | 4 +-
.../annotation/PostsActionInvokedEvent.java | 2 +-
.../annotation/PostsCollectionAddedToEvent.java | 4 +-
.../PostsCollectionRemovedFromEvent.java | 4 +-
.../annotation/PostsPropertyChangedEvent.java | 4 +-
.../apache/isis/applib/annotation/Property.java | 10 +-
.../applib/annotation/PropertyInteraction.java | 4 +-
.../isis/applib/services/command/Command2.java | 39 +++-
.../isis/applib/services/command/Command3.java | 71 +++++++
.../applib/services/command/CommandDefault.java | 73 ++++++--
.../services/eventbus/AbstractDomainEvent.java | 183 +++++++++++++++++++
.../eventbus/AbstractInteractionEvent.java | 164 +----------------
.../services/eventbus/ActionDomainEvent.java | 138 ++++++++++++++
.../eventbus/ActionInteractionEvent.java | 89 +--------
.../eventbus/CollectionDomainEvent.java | 126 +++++++++++++
.../eventbus/CollectionInteractionEvent.java | 83 +--------
.../services/eventbus/PropertyChangedEvent.java | 2 +-
.../services/eventbus/PropertyDomainEvent.java | 99 ++++++++++
.../eventbus/PropertyInteractionEvent.java | 60 +-----
.../metamodel/facets/InteractionHelper.java | 97 +++++-----
...tionInteractionFacetForActionAnnotation.java | 4 +-
.../ActionInteractionFacetAbstract.java | 20 +-
.../ActionInteractionFacetAnnotation.java | 4 +-
.../ActionInteractionFacetDefault.java | 4 +-
.../ActionInteractionFacetFactory.java | 12 +-
...tionFacetForActionInteractionAnnotation.java | 4 +-
...ocationFacetForActionInteractionDefault.java | 4 +-
...onInvocationFacetForInteractionAbstract.java | 20 +-
...cetForPostsActionInvokedEventAnnotation.java | 6 +-
...InteractionFacetForCollectionAnnotation.java | 6 +-
...FacetForCollectionInteractionAnnotation.java | 12 +-
...dToFacetForCollectionInteractionDefault.java | 12 +-
...lectionAddToFacetForInteractionAbstract.java | 30 +--
...orPostsCollectionAddedToEventAnnotation.java | 10 +-
.../CollectionInteractionFacetAbstract.java | 25 +--
.../CollectionInteractionFacetAnnotation.java | 4 +-
.../CollectionInteractionFacetDefault.java | 4 +-
.../CollectionInteractionFacetFactory.java | 11 +-
...FacetForCollectionInteractionAnnotation.java | 12 +-
...romFacetForCollectionInteractionDefault.java | 12 +-
...onRemoveFromFacetForInteractionAbstract.java | 32 ++--
...stsCollectionRemovedFromEventAnnotation.java | 12 +-
...ropertyClearFacetForInteractionAbstract.java | 26 +--
...tForPostsPropertyChangedEventAnnotation.java | 6 +-
...arFacetForPropertyInteractionAnnotation.java | 4 +-
...ClearFacetForPropertyInteractionDefault.java | 4 +-
.../PropertyInteractionFacetAbstract.java | 12 +-
.../PropertyInteractionFacetAnnotation.java | 4 +-
.../PropertyInteractionFacetDefault.java | 4 +-
.../PropertyInteractionFacetFactory.java | 26 +--
...opertySetterFacetForInteractionAbstract.java | 23 +--
...tForPostsPropertyChangedEventAnnotation.java | 6 +-
...erFacetForPropertyInteractionAnnotation.java | 4 +-
...etterFacetForPropertyInteractionDefault.java | 4 +-
...tyInteractionFacetForPropertyAnnotation.java | 4 +-
...ractionHelper_newActionInteractionEvent.java | 16 +-
...er_newCollectionInteractionEvent_forAdd.java | 24 +--
...newCollectionInteractionEvent_forRemove.java | 24 +--
...er_newPropertyInteractionEvent_forClear.java | 12 +-
...r_newPropertyInteractionEvent_forModify.java | 12 +-
.../eventbus/EventBusServiceDefault.java | 4 +-
.../system/transaction/IsisTransaction.java | 18 +-
.../dom/src/main/java/dom/todo/ToDoItem.java | 18 +-
.../java/dom/todo/ToDoItemSubscriptions.java | 18 +-
.../integration/tests/ToDoItemIntegTest.java | 32 ++--
68 files changed, 1117 insertions(+), 726 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/annotation/Action.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/Action.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/Action.java
index a9b6dea..ed56e54 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/Action.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/Action.java
@@ -24,7 +24,7 @@ import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import org.apache.isis.applib.services.eventbus.ActionInteractionEvent;
+import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
/**
* Domain semantics for domain object collection.
@@ -38,15 +38,15 @@ public @interface Action {
/**
* Indicates that an invocation of the action should be posted to the
* {@link org.apache.isis.applib.services.eventbus.EventBusService event bus} using a custom (subclass of)
- * {@link org.apache.isis.applib.services.eventbus.ActionInteractionEvent}.
+ * {@link org.apache.isis.applib.services.eventbus.ActionDomainEvent}.
*
* <p>For example:
* </p>
*
* <pre>
- * public static class StartDateChangedEvent extends ActionInvokedEvent {}
+ * public static class StartDateChangedEvent extends ActionDomainEvent { ... }
*
- * @PostsActionInvokedEvent(StartDateChangedEvent.class)
+ * @Action(domainEvent=StartDateChangedEvent.class)
* public void changeStartDate(final Date startDate) { ...}
* </pre>
*
@@ -60,7 +60,7 @@ public @interface Action {
* This subclass must provide a no-arg constructor; the fields are set reflectively.
* </p>
*/
- Class<? extends ActionInteractionEvent<?>> interaction() default ActionInteractionEvent.Default.class;
+ Class<? extends ActionDomainEvent<?>> domainEvent() default ActionDomainEvent.Default.class;
// //////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/annotation/ActionInteraction.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/ActionInteraction.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/ActionInteraction.java
index 32354b2..c9e1b31 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/ActionInteraction.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/ActionInteraction.java
@@ -26,7 +26,7 @@ import java.lang.annotation.Target;
import org.apache.isis.applib.services.eventbus.ActionInteractionEvent;
/**
- * @deprecated - see {@link Action#interaction()}.
+ * @deprecated - see {@link Action#domainEvent()}.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
@@ -34,7 +34,7 @@ import org.apache.isis.applib.services.eventbus.ActionInteractionEvent;
public @interface ActionInteraction {
/**
- * @deprecated - see {@link Action#interaction()}.
+ * @deprecated - see {@link Action#domainEvent()}.
*/
@Deprecated
Class<? extends ActionInteractionEvent<?>> value() default ActionInteractionEvent.Default.class;
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/annotation/Collection.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/Collection.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/Collection.java
index f18288b..cfa0f46 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/Collection.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/Collection.java
@@ -24,7 +24,7 @@ import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import org.apache.isis.applib.services.eventbus.CollectionInteractionEvent;
+import org.apache.isis.applib.services.eventbus.CollectionDomainEvent;
/**
* Domain semantics for domain object collection.
@@ -37,13 +37,13 @@ public @interface Collection {
/**
* Indicates that changes to the collection that should be posted to the
* {@link org.apache.isis.applib.services.eventbus.EventBusService event bus} using a custom (subclass of)
- * {@link org.apache.isis.applib.services.eventbus.CollectionInteractionEvent}.
+ * {@link org.apache.isis.applib.services.eventbus.CollectionDomainEvent}.
*
* <p>For example:
* </p>
* <pre>
* public class Order {
- * public static class OrderLineItems extends CollectionInteractionEvent {}
+ * public static class OrderLineItems extends CollectionDomainEvent { ... }
*
* @CollectionInteraction(OrderLineItems.class)
* public SortedSet<OrderLine> getLineItems() { ...}
@@ -60,7 +60,7 @@ public @interface Collection {
* This subclass must provide a no-arg constructor; the fields are set reflectively.
* </p>
*/
- Class<? extends CollectionInteractionEvent<?,?>> interaction() default CollectionInteractionEvent.Default.class;
+ Class<? extends CollectionDomainEvent<?,?>> domainEvent() default CollectionDomainEvent.Default.class;
// //////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/annotation/CollectionInteraction.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/CollectionInteraction.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/CollectionInteraction.java
index 6aaa304..41d62d4 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/CollectionInteraction.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/CollectionInteraction.java
@@ -26,7 +26,7 @@ import java.lang.annotation.Target;
import org.apache.isis.applib.services.eventbus.CollectionInteractionEvent;
/**
- * @deprecated - see {@link Collection#interaction()}.
+ * @deprecated - see {@link Collection#domainEvent()}.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
@@ -34,7 +34,7 @@ import org.apache.isis.applib.services.eventbus.CollectionInteractionEvent;
public @interface CollectionInteraction {
/**
- * @deprecated - see {@link Collection#interaction()}.
+ * @deprecated - see {@link Collection#domainEvent()}.
*/
@Deprecated
Class<? extends CollectionInteractionEvent<?,?>> value() default CollectionInteractionEvent.Default.class;
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsActionInvokedEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsActionInvokedEvent.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsActionInvokedEvent.java
index 7f749c0..67daa9a 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsActionInvokedEvent.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsActionInvokedEvent.java
@@ -26,7 +26,7 @@ import java.lang.annotation.Target;
import org.apache.isis.applib.services.eventbus.ActionInvokedEvent;
/**
- * @deprecated - use instead {@link org.apache.isis.applib.annotation.Action#interaction()}.
+ * @deprecated - use instead {@link org.apache.isis.applib.annotation.Action#domainEvent()}.
*/
@Deprecated
@Retention(RetentionPolicy.RUNTIME)
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsCollectionAddedToEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsCollectionAddedToEvent.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsCollectionAddedToEvent.java
index 4e673dc..5196675 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsCollectionAddedToEvent.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsCollectionAddedToEvent.java
@@ -26,7 +26,7 @@ import java.lang.annotation.Target;
import org.apache.isis.applib.services.eventbus.CollectionAddedToEvent;
/**
- * @deprecated - use instead {@link Collection#interaction()}
+ * @deprecated - use instead {@link Collection#domainEvent()}
*/
@Deprecated
@Retention(RetentionPolicy.RUNTIME)
@@ -34,7 +34,7 @@ import org.apache.isis.applib.services.eventbus.CollectionAddedToEvent;
public @interface PostsCollectionAddedToEvent {
/**
- * @deprecated - use {@link Collection#interaction()} instead.
+ * @deprecated - use {@link Collection#domainEvent()} instead.
*/
@Deprecated
Class<? extends CollectionAddedToEvent<?,?>> value() default CollectionAddedToEvent.Default.class;
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsCollectionRemovedFromEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsCollectionRemovedFromEvent.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsCollectionRemovedFromEvent.java
index 842d000..7121a13 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsCollectionRemovedFromEvent.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsCollectionRemovedFromEvent.java
@@ -27,7 +27,7 @@ import java.lang.annotation.Target;
import org.apache.isis.applib.services.eventbus.CollectionRemovedFromEvent;
/**
- * @deprecated - use instead {@link Collection#interaction()}
+ * @deprecated - use instead {@link Collection#domainEvent()}
*/
@Deprecated
@Retention(RetentionPolicy.RUNTIME)
@@ -35,7 +35,7 @@ import org.apache.isis.applib.services.eventbus.CollectionRemovedFromEvent;
public @interface PostsCollectionRemovedFromEvent {
/**
- * @deprecated - use {@link Collection#interaction()} instead.
+ * @deprecated - use {@link Collection#domainEvent()} instead.
*/
@Deprecated
Class<? extends CollectionRemovedFromEvent<?,?>> value() default CollectionRemovedFromEvent.Default.class;
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsPropertyChangedEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsPropertyChangedEvent.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsPropertyChangedEvent.java
index 3af13b5..e9ec821 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsPropertyChangedEvent.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/PostsPropertyChangedEvent.java
@@ -27,7 +27,7 @@ import java.lang.annotation.Target;
import org.apache.isis.applib.services.eventbus.PropertyChangedEvent;
/**
- * @deprecated - use instead {@link org.apache.isis.applib.annotation.Property#interaction()}.
+ * @deprecated - use instead {@link org.apache.isis.applib.annotation.Property#domainEvent()}.
*/
@Deprecated
@Retention(RetentionPolicy.RUNTIME)
@@ -35,7 +35,7 @@ import org.apache.isis.applib.services.eventbus.PropertyChangedEvent;
public @interface PostsPropertyChangedEvent {
/**
- * @deprecated - use instead {@link org.apache.isis.applib.annotation.Property#interaction()}.
+ * @deprecated - use instead {@link org.apache.isis.applib.annotation.Property#domainEvent()}.
*/
@Deprecated
Class<? extends PropertyChangedEvent<?,?>> value() default PropertyChangedEvent.Default.class;
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/annotation/Property.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/Property.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/Property.java
index b125123..ccfc6af 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/Property.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/Property.java
@@ -24,7 +24,7 @@ import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import org.apache.isis.applib.services.eventbus.PropertyInteractionEvent;
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
import org.apache.isis.applib.spec.Specification;
/**
@@ -38,15 +38,15 @@ public @interface Property {
/**
* Indicates that changes to the property that should be posted to the
* {@link org.apache.isis.applib.services.eventbus.EventBusService event bus} using a custom (subclass of)
- * {@link org.apache.isis.applib.services.eventbus.PropertyInteractionEvent}.
+ * {@link org.apache.isis.applib.services.eventbus.PropertyDomainEvent}.
*
* <p>For example:
* </p>
*
* <pre>
- * public static class StartDateChanged extends PropertyInteractionEvent {}
+ * public static class StartDateChanged extends PropertyDomainEvent { ... }
*
- * @PropertyInteraction(StartDateChanged.class)
+ * @Property(domainEvent=StartDateChanged.class)
* public LocalDate getStartDate() { ...}
* </pre>
*
@@ -60,7 +60,7 @@ public @interface Property {
* This subclass must provide a no-arg constructor; the fields are set reflectively.
* </p>
*/
- Class<? extends PropertyInteractionEvent<?,?>> interaction() default PropertyInteractionEvent.Default.class;
+ Class<? extends PropertyDomainEvent<?,?>> domainEvent() default PropertyDomainEvent.Default.class;
// //////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/annotation/PropertyInteraction.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/annotation/PropertyInteraction.java b/core/applib/src/main/java/org/apache/isis/applib/annotation/PropertyInteraction.java
index 80959da..5ee1c96 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/annotation/PropertyInteraction.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/annotation/PropertyInteraction.java
@@ -26,7 +26,7 @@ import java.lang.annotation.Target;
import org.apache.isis.applib.services.eventbus.PropertyInteractionEvent;
/**
- * @deprecated - use {@link Property#interaction()} instead.
+ * @deprecated - use {@link Property#domainEvent()} instead.
*/
@Deprecated
@Retention(RetentionPolicy.RUNTIME)
@@ -34,7 +34,7 @@ import org.apache.isis.applib.services.eventbus.PropertyInteractionEvent;
public @interface PropertyInteraction {
/**
- * @deprecated - use {@link Property#interaction()} instead.
+ * @deprecated - use {@link Property#domainEvent()} instead.
*/
@Deprecated
Class<? extends PropertyInteractionEvent<?,?>> value() default PropertyInteractionEvent.Default.class;
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/services/command/Command2.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/command/Command2.java b/core/applib/src/main/java/org/apache/isis/applib/services/command/Command2.java
index f558be4..35ac53b 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/command/Command2.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/command/Command2.java
@@ -24,21 +24,22 @@ import org.apache.isis.applib.services.eventbus.ActionInteractionEvent;
* An extension to {@link org.apache.isis.applib.services.command.Command} that makes the
* relationship with {@link org.apache.isis.applib.services.eventbus.ActionInteractionEvent} bi-directional.
*/
+@Deprecated
public interface Command2 extends Command {
/**
* The current (most recently pushed) {@link org.apache.isis.applib.services.eventbus.ActionInteractionEvent}.
*
* <p>
- * Note that the {@link org.apache.isis.applib.services.eventbus.ActionInteractionEvent} itself is mutable,
- * as its {@link org.apache.isis.applib.services.eventbus.ActionInteractionEvent#getPhase() phase} changes from
- * {@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#EXECUTING executing} to
- * {@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#EXECUTED executed}. The
- * event returned from this method will always be in one or other of these phases.
+ * Deprecation note: this will throw an exception if the most recently pushed event was a
+ * {@link org.apache.isis.applib.services.eventbus.ActionDomainEvent} but not a
+ * {@link org.apache.isis.applib.services.eventbus.ActionInteractionEvent}.
* </p>
- * @return
+ *
+ * @deprecated - use {@link Command3#peekActionDomainEvent()} instead.
*/
@Programmatic
+ @Deprecated
ActionInteractionEvent<?> peekActionInteractionEvent();
/**
@@ -48,7 +49,10 @@ public interface Command2 extends Command {
* Push a new {@link org.apache.isis.applib.services.eventbus.ActionInteractionEvent}
* onto the stack of events held by the command.
* </p>
+ *
+ * @deprecated - use {@link org.apache.isis.applib.services.command.Command3#pushActionDomainEvent(org.apache.isis.applib.services.eventbus.ActionDomainEvent)} instead.
*/
+ @Deprecated
@Programmatic
void pushActionInteractionEvent(ActionInteractionEvent<?> event);
@@ -56,17 +60,36 @@ public interface Command2 extends Command {
* <b>NOT API</b>: intended to be called only by the framework.
*
* <p>
- * Push a new {@link org.apache.isis.applib.services.eventbus.ActionInteractionEvent}
- * onto the stack of events held by the command.
+ * Pops a new {@link org.apache.isis.applib.services.eventbus.ActionInteractionEvent}
+ * from the stack of events held by the command.
+ * </p>
+ *
+ * <p>
+ * Deprecation note: this will throw an exception if the most recently pushed event was a
+ * {@link org.apache.isis.applib.services.eventbus.ActionDomainEvent} but not a
+ * {@link org.apache.isis.applib.services.eventbus.ActionInteractionEvent}.
* </p>
+ *
+ * @deprecated - use {@link Command3#popActionDomainEvent()} instead.
*/
+ @Deprecated
@Programmatic
ActionInteractionEvent<?> popActionInteractionEvent();
/**
* Returns the {@link org.apache.isis.applib.services.eventbus.ActionInteractionEvent}s in the order that they
* were {@link #pushActionInteractionEvent(org.apache.isis.applib.services.eventbus.ActionInteractionEvent) pushed}.
+ *
+ * <p>
+ * Deprecation note: this will throw an exception if any of the list are
+ * {@link org.apache.isis.applib.services.eventbus.ActionDomainEvent} but not a
+ * {@link org.apache.isis.applib.services.eventbus.ActionInteractionEvent}.
+ * </p>
+ *
+ * @deprecated - use {@link Command3#flushActionDomainEvents()} instead.
*/
+ @Deprecated
@Programmatic
List<ActionInteractionEvent<?>> flushActionInteractionEvents();
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/services/command/Command3.java
----------------------------------------------------------------------
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
new file mode 100644
index 0000000..5fcb720
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/command/Command3.java
@@ -0,0 +1,71 @@
+/**
+ * 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;
+
+/**
+ * An extension to {@link Command} that makes the
+ * relationship with {@link org.apache.isis.applib.services.eventbus.ActionDomainEvent} bi-directional.
+ */
+public interface Command3 extends Command2 {
+
+ /**
+ * The current (most recently pushed) {@link org.apache.isis.applib.services.eventbus.ActionDomainEvent}.
+ *
+ * <p>
+ * Note that the {@link org.apache.isis.applib.services.eventbus.ActionDomainEvent} itself is mutable,
+ * as its {@link org.apache.isis.applib.services.eventbus.ActionDomainEvent#getPhase() phase} changes from
+ * {@link org.apache.isis.applib.services.eventbus.AbstractDomainEvent.Phase#EXECUTING executing} to
+ * {@link org.apache.isis.applib.services.eventbus.AbstractDomainEvent.Phase#EXECUTED executed}. The
+ * event returned from this method will always be in one or other of these phases.
+ * </p>
+ */
+ @Programmatic
+ ActionDomainEvent<?> peekActionDomainEvent();
+
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ *
+ * <p>
+ * Push a new {@link org.apache.isis.applib.services.eventbus.ActionDomainEvent}
+ * onto the stack of events held by the command.
+ * </p>
+ */
+ @Programmatic
+ void pushActionDomainEvent(ActionDomainEvent<?> event);
+
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ *
+ * <p>
+ * Push a new {@link org.apache.isis.applib.services.eventbus.ActionDomainEvent}
+ * onto the stack of events held by the command.
+ * </p>
+ */
+ @Programmatic
+ ActionDomainEvent<?> popActionDomainEvent();
+
+ /**
+ * Returns the {@link org.apache.isis.applib.services.eventbus.ActionDomainEvent}s in the order that they
+ * were {@link #pushActionDomainEvent(org.apache.isis.applib.services.eventbus.ActionDomainEvent) pushed}.
+ */
+ @Programmatic
+ List<ActionDomainEvent<?>> flushActionDomainEvents();
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/services/command/CommandDefault.java
----------------------------------------------------------------------
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 95e2f50..357e780 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
@@ -17,7 +17,11 @@
package org.apache.isis.applib.services.command;
import java.sql.Timestamp;
-import java.util.*;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@@ -25,10 +29,11 @@ import org.apache.isis.applib.annotation.Command.ExecuteIn;
import org.apache.isis.applib.annotation.Command.Persistence;
import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.services.bookmark.Bookmark;
+import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
import org.apache.isis.applib.services.eventbus.ActionInteractionEvent;
import org.apache.isis.applib.util.ObjectContracts;
-public class CommandDefault implements Command2 {
+public class CommandDefault implements Command2, Command3 {
public CommandDefault() {
setExecutor(Executor.OTHER);
@@ -186,31 +191,75 @@ public class CommandDefault implements Command2 {
// actionInteractionEvent (property)
// //////////////////////////////////////
- private final LinkedList<ActionInteractionEvent<?>> actionInteractionEvents = Lists.newLinkedList();
+ @Deprecated
@Override
public ActionInteractionEvent<?> peekActionInteractionEvent() {
- return actionInteractionEvents.isEmpty()? null: actionInteractionEvents.getLast();
+ final ActionDomainEvent<?> actionDomainEvent = peekActionDomainEvent();
+ if (!(actionDomainEvent instanceof ActionInteractionEvent)) {
+ throw new IllegalStateException("Most recently pushed event was not an instance of ActionInteractionEvent; use either ActionDomainEvent or the (deprecated) ActionInteractionEvent consistently");
+ }
+ return (ActionInteractionEvent<?>) actionDomainEvent;
}
+ @Deprecated
@Override
public void pushActionInteractionEvent(ActionInteractionEvent<?> event) {
- if(peekActionInteractionEvent() == event) {
- return;
- }
- this.actionInteractionEvents.add(event);
+ pushActionDomainEvent(event);
}
+ @Deprecated
@Override
public ActionInteractionEvent popActionInteractionEvent() {
- return !actionInteractionEvents.isEmpty() ? actionInteractionEvents.removeLast() : null;
+ final ActionDomainEvent<?> actionDomainEvent = popActionDomainEvent();
+ if (!(actionDomainEvent instanceof ActionInteractionEvent)) {
+ throw new IllegalStateException("Most recently pushed event was not an instance of ActionInteractionEvent; use either ActionDomainEvent or the (deprecated) ActionInteractionEvent consistently");
+ }
+ return (ActionInteractionEvent<?>) actionDomainEvent;
}
+ @Deprecated
@Programmatic
public List<ActionInteractionEvent<?>> flushActionInteractionEvents() {
- final List<ActionInteractionEvent<?>> events =
- Collections.unmodifiableList(Lists.newArrayList(actionInteractionEvents));
- actionInteractionEvents.clear();
+ final List<ActionDomainEvent<?>> actionDomainEvents = flushActionDomainEvents();
+ for (ActionDomainEvent<?> actionDomainEvent : actionDomainEvents) {
+ if (!(actionDomainEvent instanceof ActionInteractionEvent)) {
+ throw new IllegalStateException("List of events includes at least one event that is not an instance of ActionInteractionEvent; use either ActionDomainEvent or the (deprecated) ActionInteractionEvent consistently");
+ }
+ }
+ return (List)actionDomainEvents;
+ }
+
+
+ // //////////////////////////////////////
+ // actionDomainEvent (property)
+ // //////////////////////////////////////
+
+ private final LinkedList<ActionDomainEvent<?>> actionDomainEvents = Lists.newLinkedList();
+
+ @Override
+ public ActionDomainEvent<?> peekActionDomainEvent() {
+ return actionDomainEvents.isEmpty()? null: actionDomainEvents.getLast();
+ }
+
+ @Override
+ public void pushActionDomainEvent(ActionDomainEvent<?> event) {
+ if(peekActionDomainEvent() == event) {
+ return;
+ }
+ this.actionDomainEvents.add(event);
+ }
+
+ @Override
+ public ActionDomainEvent popActionDomainEvent() {
+ return !actionDomainEvents.isEmpty() ? actionDomainEvents.removeLast() : null;
+ }
+
+ @Programmatic
+ public List<ActionDomainEvent<?>> flushActionDomainEvents() {
+ final List<ActionDomainEvent<?>> events =
+ Collections.unmodifiableList(Lists.newArrayList(actionDomainEvents));
+ actionDomainEvents.clear();
return events;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/AbstractDomainEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/AbstractDomainEvent.java b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/AbstractDomainEvent.java
new file mode 100644
index 0000000..836272c
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/AbstractDomainEvent.java
@@ -0,0 +1,183 @@
+/*
+ * 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.eventbus;
+
+import java.util.Map;
+import com.google.common.collect.Maps;
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.util.ObjectContracts;
+
+public abstract class AbstractDomainEvent<S> extends java.util.EventObject {
+
+ private static final long serialVersionUID = 1L;
+
+ public AbstractDomainEvent(
+ final S source,
+ final Identifier identifier) {
+ super(source);
+ this.identifier = identifier;
+ }
+
+ //region > Phase
+
+ public enum Phase {
+ HIDE,
+ DISABLE,
+ VALIDATE,
+ EXECUTING,
+ EXECUTED;
+
+ /**
+ * The significance being that at this point the proposed values/arguments are known, and so the event can be
+ * fully populated.
+ */
+ public boolean isValidatingOrLater() {
+ return this == VALIDATE || isExecutingOrLater();
+ }
+
+ /**
+ * When the {@link org.apache.isis.applib.services.command.Command} is made available on the {@link org.apache.isis.applib.services.eventbus.ActionInteractionEvent}
+ * via {@link org.apache.isis.applib.services.eventbus.ActionInteractionEvent#getCommand()}.
+ */
+ public boolean isExecutingOrLater() {
+ return this == EXECUTING || this == EXECUTED;
+ }
+ }
+
+ private Phase phase;
+
+ /**
+ * Whether the framework is checking visibility, enablement, validity or actually executing (invoking action,
+ * updating property or collection).
+ */
+ public Phase getPhase() {
+ return phase;
+ }
+
+ /**
+ * Not API, set by the framework.
+ */
+ public void setPhase(Phase phase) {
+ this.phase = phase;
+ }
+ //endregion
+
+ //region > source (downcast to S)
+ @Override
+ @SuppressWarnings("unchecked")
+ public S getSource() {
+ return (S)source;
+ }
+ //endregion
+
+ //region > identifier
+ private final Identifier identifier;
+ public Identifier getIdentifier() {
+ return identifier;
+ }
+ //endregion
+
+ //region > hide, isHidden
+ private boolean hidden;
+ public boolean isHidden() {
+ return hidden;
+ }
+
+ public void hide() {
+ this.hidden = true;
+ }
+ //endregion
+
+ //region > disable, isDisabled, getDisabledReason
+ private String disabledReason;
+ public boolean isDisabled() {
+ return disabledReason != null;
+ }
+ public String getDisabledReason() {
+ return disabledReason;
+ }
+ public void disable(final String reason) {
+ this.disabledReason = reason;
+ }
+ //endregion
+
+ //region > invalidate, isInvalid, getInvalidityReason
+ private String invalidatedReason;
+ public boolean isInvalid() {
+ return invalidatedReason != null;
+ }
+ public String getInvalidityReason() {
+ return invalidatedReason;
+ }
+ public void invalidate(final String reason) {
+ this.invalidatedReason = reason;
+ }
+ //endregion
+
+ //region > veto
+
+ /**
+ * Use instead of {@link #hide()}, {@link #disable(String)} and {@link #invalidate(String)}; just delegates to
+ * appropriate vetoing method based upon the {@link #getPhase()}.
+ *
+ * <p>
+ * If hiding, just pass <tt>null</tt> for the parameter.
+ * </p>
+ *
+ * @param reason - reason why the interaction is being invalidated (ignored if in {@link org.apache.isis.applib.services.eventbus.AbstractDomainEvent.Phase#HIDE hide} phase).
+ */
+ public void veto(final String reason) {
+ switch (getPhase()) {
+ case HIDE:
+ hide();
+ case DISABLE:
+ disable(reason);
+ case VALIDATE:
+ invalidate(reason);
+ }
+ }
+ //endregion
+
+ //region > userData
+ /**
+ * Provides a mechanism to pass data to the next {@link #getPhase() phase}.
+ */
+ private final Map<Object, Object> userData = Maps.newHashMap();
+
+ /**
+ * Obtain user-data, as set by a previous {@link #getPhase() phase}.
+ */
+ public Object get(Object key) {
+ return userData.get(key);
+ }
+ /**
+ * Set user-data, for the use of a subsequent {@link #getPhase() phase}.
+ */
+ public void put(Object key, Object value) {
+ userData.put(key, value);
+ }
+ //endregion
+
+ //region > toString
+ @Override
+ public String toString() {
+ return ObjectContracts.toString(this, "source,identifier,mode");
+ }
+ //endregion
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/AbstractInteractionEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/AbstractInteractionEvent.java b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/AbstractInteractionEvent.java
index d52d9ef..e2cbab8 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/AbstractInteractionEvent.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/AbstractInteractionEvent.java
@@ -18,169 +18,19 @@
*/
package org.apache.isis.applib.services.eventbus;
-import java.util.Map;
-import com.google.common.collect.Maps;
import org.apache.isis.applib.Identifier;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.util.ObjectContracts;
-public abstract class AbstractInteractionEvent<S> extends java.util.EventObject {
-
- private static final long serialVersionUID = 1L;
+/**
+ * @deprecated - replaced by {@link org.apache.isis.applib.services.eventbus.AbstractDomainEvent}.
+ * @param <S>
+ */
+@Deprecated
+public abstract class AbstractInteractionEvent<S> extends AbstractDomainEvent<S> {
public AbstractInteractionEvent(
final S source,
final Identifier identifier) {
- super(source);
- this.identifier = identifier;
- }
-
- //region > Phase
-
- public enum Phase {
- HIDE,
- DISABLE,
- VALIDATE,
- EXECUTING,
- EXECUTED;
-
- /**
- * The significance being that at this point the proposed values/arguments are known, and so the event can be
- * fully populated.
- */
- public boolean isValidatingOrLater() {
- return this == VALIDATE || isExecutingOrLater();
- }
-
- /**
- * When the {@link org.apache.isis.applib.services.command.Command} is made available on the {@link ActionInteractionEvent}
- * via {@link ActionInteractionEvent#getCommand()}.
- */
- public boolean isExecutingOrLater() {
- return this == EXECUTING || this == EXECUTED;
- }
- }
-
- private Phase phase;
-
- /**
- * Whether the framework is checking visibility, enablement, validity or actually executing (invoking action,
- * updating property or collection).
- */
- public Phase getPhase() {
- return phase;
- }
-
- /**
- * Not API, set by the framework.
- */
- public void setPhase(Phase phase) {
- this.phase = phase;
- }
- //endregion
-
- //region > source (downcast to S)
- @Override
- @SuppressWarnings("unchecked")
- public S getSource() {
- return (S)source;
- }
- //endregion
-
- //region > identifier
- private final Identifier identifier;
- public Identifier getIdentifier() {
- return identifier;
- }
- //endregion
-
- //region > hide, isHidden
- private boolean hidden;
- public boolean isHidden() {
- return hidden;
+ super(source, identifier);
}
- public void hide() {
- this.hidden = true;
- }
- //endregion
-
- //region > disable, isDisabled, getDisabledReason
- private String disabledReason;
- public boolean isDisabled() {
- return disabledReason != null;
- }
- public String getDisabledReason() {
- return disabledReason;
- }
- public void disable(final String reason) {
- this.disabledReason = reason;
- }
- //endregion
-
- //region > invalidate, isInvalid, getInvalidityReason
- private String invalidatedReason;
- public boolean isInvalid() {
- return invalidatedReason != null;
- }
- public String getInvalidityReason() {
- return invalidatedReason;
- }
- public void invalidate(final String reason) {
- this.invalidatedReason = reason;
- }
- //endregion
-
- //region > veto
-
- /**
- * Use instead of {@link #hide()}, {@link #disable(String)} and {@link #invalidate(String)}; just delegates to
- * appropriate vetoing method based upon the {@link #getPhase()}.
- *
- * <p>
- * If hiding, just pass <tt>null</tt> for the parameter.
- * </p>
- *
- * @param reason - reason why the interaction is being invalidated (ignored if in {@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#HIDE hide} phase).
- * @param args
- */
- @Programmatic
- public void veto(final String reason, final Object... args) {
- switch (getPhase()) {
- case HIDE:
- hide();
- case DISABLE:
- disable(String.format(reason, args));
- case VALIDATE:
- invalidate(String.format(reason, args));
- }
- }
- //endregion
-
- //region > userData
- /**
- * Provides a mechanism to pass data to the next {@link #getPhase() phase}.
- */
- private final Map<Object, Object> userData = Maps.newHashMap();
-
- /**
- * Obtain user-data, as set by a previous {@link #getPhase() phase}.
- */
- public Object get(Object key) {
- return userData.get(key);
- }
- /**
- * Set user-data, for the use of a subsequent {@link #getPhase() phase}.
- */
- public void put(Object key, Object value) {
- userData.put(key, value);
- }
- //endregion
-
- //region > toString
- @Override
- public String toString() {
- return ObjectContracts.toString(this, "source,identifier,mode");
- }
- //endregion
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ActionDomainEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ActionDomainEvent.java b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ActionDomainEvent.java
new file mode 100644
index 0000000..6321228
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ActionDomainEvent.java
@@ -0,0 +1,138 @@
+/*
+ * 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.eventbus;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.annotation.ActionSemantics;
+import org.apache.isis.applib.services.command.Command;
+import org.apache.isis.applib.util.ObjectContracts;
+
+public abstract class ActionDomainEvent<S> extends AbstractInteractionEvent<S> {
+
+ private static final long serialVersionUID = 1L;
+
+ //region > Default class
+
+ /**
+ * Propagated if no custom subclass was specified using
+ * {@link org.apache.isis.applib.annotation.Action#domainEvent()} annotation attribute.
+ */
+ public static class Default extends ActionInteractionEvent<Object> {
+ private static final long serialVersionUID = 1L;
+ public Default(Object source, Identifier identifier, Object... arguments) {
+ super(source, identifier, arguments);
+ }
+ }
+ //endregion
+
+ //region > constructors
+ public ActionDomainEvent(
+ final S source,
+ final Identifier identifier) {
+ super(source, identifier);
+ }
+
+ public ActionDomainEvent(
+ final S source,
+ final Identifier identifier,
+ final Object... arguments) {
+ this(source, identifier, arguments != null? Arrays.asList(arguments): Collections.emptyList());
+ }
+
+ public ActionDomainEvent(
+ final S source,
+ final Identifier identifier,
+ final List<Object> arguments) {
+ this(source, identifier);
+ this.arguments = Collections.unmodifiableList(arguments);
+ }
+ //endregion
+
+ //region > command
+ private Command command;
+
+ /**
+ * The {@link org.apache.isis.applib.services.command.Command} for this action.
+ *
+ * <p>
+ * Set when in {@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#EXECUTING} and {@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#EXECUTED}, but not for earlier phases.
+ *
+ * <p>
+ * The command is set by the framework based on the configured
+ * {@link org.apache.isis.applib.services.command.CommandContext}) service). Ths command may or may not be
+ * persisted, depending on the which implementation of
+ * {@link org.apache.isis.applib.services.command.spi.CommandService} service is configured.
+ */
+ public Command getCommand() {
+ return command;
+ }
+
+ /**
+ * Not API - set by the framework.
+ */
+ public void setCommand(Command command) {
+ this.command = command;
+ }
+ //endregion
+
+
+ //region > actionSemantics
+ private ActionSemantics.Of actionSemantics;
+ public ActionSemantics.Of getActionSemantics() {
+ return actionSemantics;
+ }
+
+ /**
+ * Not API - set by the framework.
+ */
+ public void setActionSemantics(ActionSemantics.Of actionSemantics) {
+ this.actionSemantics = actionSemantics;
+ }
+
+ //endregion
+
+ //region > arguments
+ private List<Object> arguments;
+ /**
+ * The arguments being used to invoke the action; populated at {@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#VALIDATE} and subsequent phases
+ * (but null for {@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#HIDE hidden} and {@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#DISABLE disable} phases).
+ */
+ public List<Object> getArguments() {
+ return arguments;
+ }
+
+ /**
+ * Not API - set by the framework.
+ */
+ public void setArguments(List<Object> arguments) {
+ this.arguments = arguments;
+ }
+ //endregion
+
+ //region > toString
+ @Override
+ public String toString() {
+ return ObjectContracts.toString(this, "source,identifier,phase");
+ }
+ //endregion
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ActionInteractionEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ActionInteractionEvent.java b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ActionInteractionEvent.java
index 40091d6..7afb412 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ActionInteractionEvent.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/ActionInteractionEvent.java
@@ -18,25 +18,24 @@
*/
package org.apache.isis.applib.services.eventbus;
-import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import org.apache.isis.applib.Identifier;
-import org.apache.isis.applib.annotation.ActionSemantics;
-import org.apache.isis.applib.services.command.Command;
-import org.apache.isis.applib.util.ObjectContracts;
-public abstract class ActionInteractionEvent<S> extends AbstractInteractionEvent<S> {
+/**
+ * @deprecated - use {@link org.apache.isis.applib.services.eventbus.ActionDomainEvent} instead.
+ */
+@Deprecated
+public abstract class ActionInteractionEvent<S> extends ActionDomainEvent<S> {
private static final long serialVersionUID = 1L;
//region > Default class
/**
- * Propagated if no custom subclass was specified using
- * {@link org.apache.isis.applib.annotation.ActionInteraction} annotation.
+ * @deprecated - use {@link org.apache.isis.applib.services.eventbus.ActionDomainEvent.Default} instead.
*/
- public static class Default extends ActionInteractionEvent<Object> {
+ @Deprecated
+ public static class Default extends ActionDomainEvent.Default {
private static final long serialVersionUID = 1L;
public Default(Object source, Identifier identifier, Object... arguments) {
super(source, identifier, arguments);
@@ -55,84 +54,16 @@ public abstract class ActionInteractionEvent<S> extends AbstractInteractionEvent
final S source,
final Identifier identifier,
final Object... arguments) {
- this(source, identifier, arguments != null? Arrays.asList(arguments): Collections.emptyList());
+ super(source, identifier, arguments);
}
public ActionInteractionEvent(
final S source,
final Identifier identifier,
final List<Object> arguments) {
- this(source, identifier);
- this.arguments = Collections.unmodifiableList(arguments);
- }
- //endregion
-
- //region > command
- private Command command;
-
- /**
- * The {@link org.apache.isis.applib.services.command.Command} for this action.
- *
- * <p>
- * Set when in {@link Phase#EXECUTING} and {@link Phase#EXECUTED}, but not for earlier phases.
- *
- * <p>
- * The command is set by the framework based on the configured
- * {@link org.apache.isis.applib.services.command.CommandContext}) service). Ths command may or may not be
- * persisted, depending on the which implementation of
- * {@link org.apache.isis.applib.services.command.spi.CommandService} service is configured.
- */
- public Command getCommand() {
- return command;
- }
-
- /**
- * Not API - set by the framework.
- */
- public void setCommand(Command command) {
- this.command = command;
+ super(source, identifier, arguments);
}
//endregion
- //region > actionSemantics
- private ActionSemantics.Of actionSemantics;
- public ActionSemantics.Of getActionSemantics() {
- return actionSemantics;
- }
-
- /**
- * Not API - set by the framework.
- */
- public void setActionSemantics(ActionSemantics.Of actionSemantics) {
- this.actionSemantics = actionSemantics;
- }
-
- //endregion
-
- //region > arguments
- private List<Object> arguments;
- /**
- * The arguments being used to invoke the action; populated at {@link Phase#VALIDATE} and subsequent phases
- * (but null for {@link Phase#HIDE hidden} and {@link Phase#DISABLE disable} phases).
- */
- public List<Object> getArguments() {
- return arguments;
- }
-
- /**
- * Not API - set by the framework.
- */
- public void setArguments(List<Object> arguments) {
- this.arguments = arguments;
- }
- //endregion
-
- //region > toString
- @Override
- public String toString() {
- return ObjectContracts.toString(this, "source,identifier,phase");
- }
- //endregion
-
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/CollectionDomainEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/CollectionDomainEvent.java b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/CollectionDomainEvent.java
new file mode 100644
index 0000000..9b6d567
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/CollectionDomainEvent.java
@@ -0,0 +1,126 @@
+/*
+ * 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.eventbus;
+
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.util.ObjectContracts;
+
+public abstract class CollectionDomainEvent<S,T> extends AbstractInteractionEvent<S> {
+
+ private static final long serialVersionUID = 1L;
+
+ //region > Default class
+ /**
+ * Propagated if no custom subclass was specified using
+ * {@link org.apache.isis.applib.annotation.Collection#domainEvent()} annotation attribute.
+ */
+ public static class Default extends CollectionInteractionEvent<Object, Object> {
+ private static final long serialVersionUID = 1L;
+ public Default(
+ final Object source,
+ final Identifier identifier,
+ final Of of,
+ final Object value) {
+ super(source, identifier, of, value);
+ }
+ }
+ //endregion
+
+ //region > constructors
+ public CollectionDomainEvent(
+ final S source,
+ final Identifier identifier,
+ final Of of) {
+ super(source, identifier);
+ this.of = of;
+ }
+
+ public CollectionDomainEvent(
+ final S source,
+ final Identifier identifier,
+ final Of of,
+ final T value) {
+ this(source, identifier, of);
+ this.value = value;
+ }
+ //endregion
+
+ //region > value
+ private T value;
+
+ /**
+ * The proposed reference to either add or remove (per {@link #getOf()}), populated at {@link org.apache.isis.applib.services.eventbus.AbstractDomainEvent.Phase#VALIDATE}
+ * and subsequent phases (is null for {@link org.apache.isis.applib.services.eventbus.AbstractDomainEvent.Phase#HIDE hidden} and {@link org.apache.isis.applib.services.eventbus.AbstractDomainEvent.Phase#DISABLE disable} phases).
+ */
+ public T getValue() {
+ return value;
+ }
+ /**
+ * Not API, set by the framework.
+ */
+ public void setValue(T value) {
+ this.value = value;
+ }
+ //endregion
+
+ //region > Of
+ public static enum Of {
+ /**
+ * The collection is being accessed
+ * ({@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#HIDE hide} and
+ * {@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#DISABLE disable}) checks.
+ */
+ ACCESS,
+ /**
+ * The collection is being added to
+ * ({@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#VALIDATE validity} check and
+ * {@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#EXECUTED execution}).
+ */
+ ADD_TO,
+ /**
+ * The collection is being removed from
+ * ({@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#VALIDATE validity} check and
+ * {@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#EXECUTED execution}).
+ */
+ REMOVE_FROM
+ }
+
+ private Of of;
+
+ public Of getOf() {
+ return of;
+ }
+
+ /**
+ * Not API; updates from {@link Of#ACCESS} to either {@link Of#ADD_TO} or {@link Of#REMOVE_FROM} when hits the
+ * {@link org.apache.isis.applib.services.eventbus.AbstractDomainEvent.Phase#VALIDATE validation phase}.
+ */
+ public void setOf(Of of) {
+ this.of = of;
+ }
+
+ //endregion
+
+ //region > toString
+ @Override
+ public String toString() {
+ return ObjectContracts.toString(this, "source,identifier,phase,of,value");
+ }
+ //endregion
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/CollectionInteractionEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/CollectionInteractionEvent.java b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/CollectionInteractionEvent.java
index f615ea3..bd78959 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/CollectionInteractionEvent.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/CollectionInteractionEvent.java
@@ -19,18 +19,19 @@
package org.apache.isis.applib.services.eventbus;
import org.apache.isis.applib.Identifier;
-import org.apache.isis.applib.util.ObjectContracts;
-public abstract class CollectionInteractionEvent<S,T> extends AbstractInteractionEvent<S> {
-
- private static final long serialVersionUID = 1L;
+/**
+ * @deprecated - use {@link org.apache.isis.applib.services.eventbus.CollectionDomainEvent} instead.
+ */
+@Deprecated
+public abstract class CollectionInteractionEvent<S,T> extends CollectionDomainEvent<S,T> {
//region > Default class
/**
- * Propagated if no custom subclass was specified using
- * {@link org.apache.isis.applib.annotation.ActionInteraction} annotation.
+ * @deprecated - use {@link org.apache.isis.applib.services.eventbus.CollectionDomainEvent.Default} instead.
*/
- public static class Default extends CollectionInteractionEvent<Object, Object> {
+ @Deprecated
+ public static class Default extends CollectionDomainEvent.Default {
private static final long serialVersionUID = 1L;
public Default(
final Object source,
@@ -47,8 +48,7 @@ public abstract class CollectionInteractionEvent<S,T> extends AbstractInteractio
final S source,
final Identifier identifier,
final Of of) {
- super(source, identifier);
- this.of = of;
+ super(source, identifier, of);
}
public CollectionInteractionEvent(
@@ -56,71 +56,8 @@ public abstract class CollectionInteractionEvent<S,T> extends AbstractInteractio
final Identifier identifier,
final Of of,
final T value) {
- this(source, identifier, of);
- this.value = value;
- }
- //endregion
-
- //region > value
- private T value;
-
- /**
- * The proposed reference to either add or remove (per {@link #getOf()}), populated at {@link Phase#VALIDATE}
- * and subsequent phases (is null for {@link Phase#HIDE hidden} and {@link Phase#DISABLE disable} phases).
- */
- public T getValue() {
- return value;
- }
- /**
- * Not API, set by the framework.
- */
- public void setValue(T value) {
- this.value = value;
- }
- //endregion
-
- //region > Of
- public static enum Of {
- /**
- * The collection is being accessed
- * ({@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#HIDE hide} and
- * {@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#DISABLE disable}) checks.
- */
- ACCESS,
- /**
- * The collection is being added to
- * ({@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#VALIDATE validity} check and
- * {@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#EXECUTED execution}).
- */
- ADD_TO,
- /**
- * The collection is being removed from
- * ({@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#VALIDATE validity} check and
- * {@link org.apache.isis.applib.services.eventbus.AbstractInteractionEvent.Phase#EXECUTED execution}).
- */
- REMOVE_FROM
- }
-
- private Of of;
-
- public Of getOf() {
- return of;
- }
-
- /**
- * Not API; updates from {@link Of#ACCESS} to either {@link Of#ADD_TO} or {@link Of#REMOVE_FROM} when hits the
- * {@link Phase#VALIDATE validation phase}.
- */
- public void setOf(Of of) {
- this.of = of;
+ super(source, identifier, of, value);
}
-
//endregion
- //region > toString
- @Override
- public String toString() {
- return ObjectContracts.toString(this, "source,identifier,phase,of,value");
- }
- //endregion
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/PropertyChangedEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/PropertyChangedEvent.java b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/PropertyChangedEvent.java
index 7d1f0cc..15fad7b 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/PropertyChangedEvent.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/PropertyChangedEvent.java
@@ -21,7 +21,7 @@ package org.apache.isis.applib.services.eventbus;
import org.apache.isis.applib.Identifier;
/**
- * @deprecated - use instead {@link PropertyInteractionEvent}
+ * @deprecated - use instead {@link PropertyDomainEvent}
*/
@Deprecated
public abstract class PropertyChangedEvent<S,T> extends PropertyInteractionEvent<S,T> {
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/PropertyDomainEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/PropertyDomainEvent.java b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/PropertyDomainEvent.java
new file mode 100644
index 0000000..76a2883
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/PropertyDomainEvent.java
@@ -0,0 +1,99 @@
+/*
+ * 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.eventbus;
+
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.util.ObjectContracts;
+
+public abstract class PropertyDomainEvent<S,T> extends AbstractInteractionEvent<S> {
+
+ private static final long serialVersionUID = 1L;
+
+ //region > Default class
+ /**
+ * Propagated if no custom subclass was specified using
+ * {@link org.apache.isis.applib.annotation.Property#domainEvent()} annotation attribute.
+ */
+ public static class Default extends PropertyInteractionEvent<Object, Object> {
+ private static final long serialVersionUID = 1L;
+ public Default(Object source, Identifier identifier, Object oldValue, Object newValue) {
+ super(source, identifier, oldValue, newValue);
+ }
+ }
+ //endregion
+
+ //region > constructors
+ public PropertyDomainEvent(
+ final S source,
+ final Identifier identifier) {
+ super(source, identifier);
+ }
+
+ public PropertyDomainEvent(
+ final S source,
+ final Identifier identifier,
+ final T oldValue, final T newValue) {
+ this(source, identifier);
+ this.oldValue = oldValue;
+ this.newValue = newValue;
+ }
+ //endregion
+
+ //region > oldValue
+ private T oldValue;
+
+ /**
+ * The current (pre-modification) value of the property; populated at {@link org.apache.isis.applib.services.eventbus.AbstractDomainEvent.Phase#VALIDATE} and subsequent phases
+ * (but null for {@link org.apache.isis.applib.services.eventbus.AbstractDomainEvent.Phase#HIDE hidden} and {@link org.apache.isis.applib.services.eventbus.AbstractDomainEvent.Phase#DISABLE disable} phases).
+ */
+ public T getOldValue() {
+ return oldValue;
+ }
+ /**
+ * Not API; for framework use only.
+ */
+ public void setOldValue(T oldValue) {
+ this.oldValue = oldValue;
+ }
+ //endregion
+
+ //region > newValue
+ private T newValue;
+ /**
+ * The proposed (post-modification) value of the property; populated at {@link org.apache.isis.applib.services.eventbus.AbstractDomainEvent.Phase#VALIDATE} and subsequent phases
+ * (but null for {@link org.apache.isis.applib.services.eventbus.AbstractDomainEvent.Phase#HIDE hidden} and {@link org.apache.isis.applib.services.eventbus.AbstractDomainEvent.Phase#DISABLE disable} phases).
+ */
+ public T getNewValue() {
+ return newValue;
+ }
+ /**
+ * Not API; for framework use only.
+ */
+ public void setNewValue(T newValue) {
+ this.newValue = newValue;
+ }
+ //endregion
+
+ //region > toString
+ @Override
+ public String toString() {
+ return ObjectContracts.toString(this, "source,identifier,phase,oldValue,newValue");
+ }
+ //endregion
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/PropertyInteractionEvent.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/PropertyInteractionEvent.java b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/PropertyInteractionEvent.java
index eaefa21..9afedaa 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/PropertyInteractionEvent.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/eventbus/PropertyInteractionEvent.java
@@ -19,18 +19,19 @@
package org.apache.isis.applib.services.eventbus;
import org.apache.isis.applib.Identifier;
-import org.apache.isis.applib.util.ObjectContracts;
-public abstract class PropertyInteractionEvent<S,T> extends AbstractInteractionEvent<S> {
-
- private static final long serialVersionUID = 1L;
+/**
+ * @deprecated - use {@link org.apache.isis.applib.services.eventbus.PropertyDomainEvent} instead.
+ */
+@Deprecated
+public abstract class PropertyInteractionEvent<S,T> extends PropertyDomainEvent<S,T> {
//region > Default class
/**
- * Propagated if no custom subclass was specified using
- * {@link org.apache.isis.applib.annotation.ActionInteraction} annotation.
+ * @deprecated - use {@link org.apache.isis.applib.services.eventbus.PropertyDomainEvent.Default} instead.
*/
- public static class Default extends PropertyInteractionEvent<Object, Object> {
+ @Deprecated
+ public static class Default extends PropertyDomainEvent.Default {
private static final long serialVersionUID = 1L;
public Default(Object source, Identifier identifier, Object oldValue, Object newValue) {
super(source, identifier, oldValue, newValue);
@@ -49,51 +50,8 @@ public abstract class PropertyInteractionEvent<S,T> extends AbstractInteractionE
final S source,
final Identifier identifier,
final T oldValue, final T newValue) {
- this(source, identifier);
- this.oldValue = oldValue;
- this.newValue = newValue;
- }
- //endregion
-
- //region > oldValue
- private T oldValue;
-
- /**
- * The current (pre-modification) value of the property; populated at {@link Phase#VALIDATE} and subsequent phases
- * (but null for {@link Phase#HIDE hidden} and {@link Phase#DISABLE disable} phases).
- */
- public T getOldValue() {
- return oldValue;
- }
- /**
- * Not API; for framework use only.
- */
- public void setOldValue(T oldValue) {
- this.oldValue = oldValue;
+ super(source, identifier, oldValue, newValue);
}
//endregion
- //region > newValue
- private T newValue;
- /**
- * The proposed (post-modification) value of the property; populated at {@link Phase#VALIDATE} and subsequent phases
- * (but null for {@link Phase#HIDE hidden} and {@link Phase#DISABLE disable} phases).
- */
- public T getNewValue() {
- return newValue;
- }
- /**
- * Not API; for framework use only.
- */
- public void setNewValue(T newValue) {
- this.newValue = newValue;
- }
- //endregion
-
- //region > toString
- @Override
- public String toString() {
- return ObjectContracts.toString(this, "source,identifier,phase,oldValue,newValue");
- }
- //endregion
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/e4e41868/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/InteractionHelper.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/InteractionHelper.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/InteractionHelper.java
index 4e9ee49..eb79f1b 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/InteractionHelper.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/InteractionHelper.java
@@ -26,7 +26,13 @@ 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.Command2;
-import org.apache.isis.applib.services.eventbus.*;
+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.ActionInteractionEvent;
+import org.apache.isis.applib.services.eventbus.CollectionDomainEvent;
+import org.apache.isis.applib.services.eventbus.EventBusService;
+import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.facetapi.IdentifiedHolder;
import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
@@ -42,13 +48,13 @@ public class InteractionHelper {
this.servicesInjector = servicesInjector;
}
- //region > postEventForAction, newActionInteractionEvent
+ //region > postEventForAction, newActionDomainEvent
@SuppressWarnings({ "rawtypes" })
- public ActionInteractionEvent<?> postEventForAction(
+ public ActionDomainEvent<?> postEventForAction(
final Class eventType,
- final ActionInteractionEvent<?> existingEvent,
+ final ActionDomainEvent<?> existingEvent,
final Command command,
- final AbstractInteractionEvent.Phase phase,
+ final AbstractDomainEvent.Phase phase,
final IdentifiedHolder identified,
final ObjectAdapter targetAdapter,
final ObjectAdapter[] argumentAdapters) {
@@ -57,7 +63,7 @@ public class InteractionHelper {
return null;
}
try {
- final ActionInteractionEvent<?> event;
+ final ActionDomainEvent<?> event;
if (existingEvent != null && phase.isValidatingOrLater()) {
event = existingEvent;
final Object[] arguments = ObjectAdapter.Util.unwrap(argumentAdapters);
@@ -66,17 +72,22 @@ public class InteractionHelper {
// current event always references the command (originally created by the xactn)
event.setCommand(command);
- if(command != null && command instanceof Command2) {
- final Command2 command2 = (Command2) command;
-
- command2.pushActionInteractionEvent(event);
+ if(command != null) {
+ if(command instanceof Command3) {
+ final Command3 command3 = (Command3) command;
+ command3.pushActionDomainEvent(event);
+ } else if(command instanceof Command2 && event instanceof ActionInteractionEvent) {
+ final Command2 command2 = (Command3) command;
+ final ActionInteractionEvent<?> aie = (ActionInteractionEvent<?>) event;
+ command2.pushActionInteractionEvent(aie);
+ }
}
}
} else {
final Object source = ObjectAdapter.Util.unwrap(targetAdapter);
final Object[] arguments = ObjectAdapter.Util.unwrap(argumentAdapters);
final Identifier identifier = identified.getIdentifier();
- event = newActionInteractionEvent(eventType, identifier, source, arguments);
+ event = newActionDomainEvent(eventType, identifier, source, arguments);
}
if(identified instanceof ObjectAction) {
@@ -94,8 +105,8 @@ public class InteractionHelper {
}
@SuppressWarnings("unchecked")
- static <S> ActionInteractionEvent<S> newActionInteractionEvent(
- final Class<? extends ActionInteractionEvent<S>> type,
+ static <S> ActionDomainEvent<S> newActionDomainEvent(
+ final Class<? extends ActionDomainEvent<S>> type,
final Identifier identifier,
final S source,
final Object... arguments) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
@@ -115,17 +126,17 @@ public class InteractionHelper {
continue;
}
final Object event = constructor.newInstance(source, identifier, arguments);
- return (ActionInteractionEvent<S>) event;
+ return (ActionDomainEvent<S>) event;
}
throw new NoSuchMethodException(type.getName()+".<init>(? super " + source.getClass().getName() + ", " + Identifier.class.getName() + ", [Ljava.lang.Object;)");
}
//endregion
//region > postEventForProperty, newPropertyInteraction
- public PropertyInteractionEvent<?, ?> postEventForProperty(
+ public PropertyDomainEvent<?, ?> postEventForProperty(
final Class eventType,
- final PropertyInteractionEvent<?, ?> existingEvent,
- final AbstractInteractionEvent.Phase phase,
+ final PropertyDomainEvent<?, ?> existingEvent,
+ final AbstractDomainEvent.Phase phase,
final IdentifiedHolder identified,
final ObjectAdapter targetAdapter,
final Object oldValue,
@@ -134,7 +145,7 @@ public class InteractionHelper {
return null;
}
try {
- final PropertyInteractionEvent<?, ?> event;
+ final PropertyDomainEvent<?, ?> event;
if(existingEvent != null && phase.isValidatingOrLater()) {
event = existingEvent;
setEventOldValue(event, oldValue);
@@ -142,7 +153,7 @@ public class InteractionHelper {
} else {
final Object source = ObjectAdapter.Util.unwrap(targetAdapter);
final Identifier identifier = identified.getIdentifier();
- event = newPropertyInteractionEvent(eventType, identifier, source, oldValue, newValue);
+ event = newPropertyDomainEvent(eventType, identifier, source, oldValue, newValue);
}
event.setPhase(phase);
getEventBusService().post(event);
@@ -152,17 +163,17 @@ public class InteractionHelper {
}
}
- private static <S,T> void setEventOldValue(PropertyInteractionEvent<S, T> event, Object oldValue) {
+ private static <S,T> void setEventOldValue(PropertyDomainEvent<S, T> event, Object oldValue) {
event.setOldValue((T) oldValue);
}
- private static <S,T> void setEventNewValue(PropertyInteractionEvent<S, T> event, Object newValue) {
+ private static <S,T> void setEventNewValue(PropertyDomainEvent<S, T> event, Object newValue) {
event.setNewValue((T) newValue);
}
@SuppressWarnings("unchecked")
- static <S,T> PropertyInteractionEvent<S,T> newPropertyInteractionEvent(
- final Class<? extends PropertyInteractionEvent<S, T>> type,
+ static <S,T> PropertyDomainEvent<S,T> newPropertyDomainEvent(
+ final Class<? extends PropertyDomainEvent<S, T>> type,
final Identifier identifier,
final S source,
final T oldValue,
@@ -187,28 +198,28 @@ public class InteractionHelper {
continue;
}
final Object event = constructor.newInstance(source, identifier, oldValue, newValue);
- return (PropertyInteractionEvent<S, T>) event;
+ return (PropertyDomainEvent<S, T>) event;
}
throw new NoSuchMethodException(type.getName()+".<init>(? super " + source.getClass().getName() + ", " + Identifier.class.getName() + ", java.lang.Object, java.lang.Object)");
}
//endregion
- //region > postEventForCollection, newCollectionInteractionEvent
+ //region > postEventForCollection, newCollectionDomainEvent
- public CollectionInteractionEvent<?, ?> postEventForCollection(
+ public CollectionDomainEvent<?, ?> postEventForCollection(
final Class eventType,
- final CollectionInteractionEvent<?, ?> existingEvent,
- AbstractInteractionEvent.Phase phase,
+ final CollectionDomainEvent<?, ?> existingEvent,
+ AbstractDomainEvent.Phase phase,
final IdentifiedHolder identified,
final ObjectAdapter targetAdapter,
- final CollectionInteractionEvent.Of of,
+ final CollectionDomainEvent.Of of,
final Object reference) {
if(!hasEventBusService()) {
return null;
}
try {
- final CollectionInteractionEvent<?, ?> event;
+ final CollectionDomainEvent<?, ?> event;
if (existingEvent != null && phase.isValidatingOrLater()) {
event = existingEvent;
event.setOf(of);
@@ -216,7 +227,7 @@ public class InteractionHelper {
} else {
final Object source = ObjectAdapter.Util.unwrap(targetAdapter);
final Identifier identifier = identified.getIdentifier();
- event = newCollectionInteractionEvent(eventType, phase, identifier, source, of, reference);
+ event = newCollectionDomainEvent(eventType, phase, identifier, source, of, reference);
}
event.setPhase(phase);
getEventBusService().post(event);
@@ -226,17 +237,17 @@ public class InteractionHelper {
}
}
- private static <T,S> void setEventValue(CollectionInteractionEvent<T, S> event, Object reference) {
+ private static <T,S> void setEventValue(CollectionDomainEvent<T, S> event, Object reference) {
event.setValue((S) reference);
}
@SuppressWarnings("unchecked")
- <S, T> CollectionInteractionEvent<S, T> newCollectionInteractionEvent(
- final Class<? extends CollectionInteractionEvent<S, T>> type,
- final AbstractInteractionEvent.Phase phase,
+ <S, T> CollectionDomainEvent<S, T> newCollectionDomainEvent(
+ final Class<? extends CollectionDomainEvent<S, T>> type,
+ final AbstractDomainEvent.Phase phase,
final Identifier identifier,
final S source,
- final CollectionInteractionEvent.Of of,
+ final CollectionDomainEvent.Of of,
final T value)
throws NoSuchMethodException, SecurityException, InstantiationException,
IllegalAccessException, IllegalArgumentException, InvocationTargetException {
@@ -255,18 +266,18 @@ public class InteractionHelper {
if(!parameterTypes[1].isAssignableFrom(Identifier.class)) {
continue;
}
- if(!parameterTypes[2].isAssignableFrom(CollectionInteractionEvent.Of.class)) {
+ if(!parameterTypes[2].isAssignableFrom(CollectionDomainEvent.Of.class)) {
continue;
}
if(value != null && !parameterTypes[3].isAssignableFrom(value.getClass())) {
continue;
}
final Object event = constructor.newInstance(source, identifier, of, value);
- return (CollectionInteractionEvent<S, T>) event;
+ return (CollectionDomainEvent<S, T>) event;
}
- if(phase == AbstractInteractionEvent.Phase.EXECUTED) {
- if(of == CollectionInteractionEvent.Of.ADD_TO) {
+ if(phase == AbstractDomainEvent.Phase.EXECUTED) {
+ if(of == CollectionDomainEvent.Of.ADD_TO) {
// support for @PostsCollectionAddedTo annotation:
// search for constructor accepting source, identifier, value
for (final Constructor<?> constructor : constructors) {
@@ -284,9 +295,9 @@ public class InteractionHelper {
continue;
}
final Object event = constructor.newInstance(source, identifier, value);
- return (CollectionInteractionEvent<S, T>) event;
+ return (CollectionDomainEvent<S, T>) event;
}
- } else if(of == CollectionInteractionEvent.Of.REMOVE_FROM) {
+ } else if(of == CollectionDomainEvent.Of.REMOVE_FROM) {
// support for @PostsCollectionRemovedFrom annotation:
// search for constructor accepting source, identifier, value
for (final Constructor<?> constructor : constructors) {
@@ -305,7 +316,7 @@ public class InteractionHelper {
}
final Object event = constructor.newInstance(
source, identifier, value);
- return (CollectionInteractionEvent<S, T>) event;
+ return (CollectionDomainEvent<S, T>) event;
}
}
}