Dan Haywood (JIRA)
2018-11-21 10:14:00 UTC
Dan Haywood created ISIS-2043:
---------------------------------
Summary: Allow domain events to be specified at @DomainObject, and make mixins aware of this.
Key: ISIS-2043
URL: https://issues.apache.org/jira/browse/ISIS-2043
Project: Isis
Issue Type: New Feature
Affects Versions: 1.16.2
Reporter: Dan Haywood
Assignee: Dan Haywood
Fix For: 1.16.3
Thus:
{code:java}
@DomainObject(
...,
actionDomainEvent=IncomingInvoice.ActionDomainEvent.class,
propertyDomainEvent=IncomingInvoice.PropertyDomainEvent.class,
collectionDomainEVent=IncomingInvoice.CollectionDomainEvent.class
)
public class IncomingInvoice {
public static class ActionDomainEvent
extends o.a.i.applib.services.eventbus.ActionDomainEvent {}
// etc
}{code}
then, for this domain event would be used as the default for any actions etc.
Two refinements to this:
a) for mixins, the event type emitted by a mixin action should be that of its mixee if possible. This does mean that the domain event must use <Object> as its generic type, because the source could either be the regular domain object or a mixin. This seems reasonable, the subscriber can just call ev.getMixee() to determine the original source.
b) as a metamodel validation, if there are members that already define their own event types, then these event types should inherit from the types defined in @DomainObject. However, not sure exactly how well this plays with requirement from (a) that the generic type is <Object>.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------
Summary: Allow domain events to be specified at @DomainObject, and make mixins aware of this.
Key: ISIS-2043
URL: https://issues.apache.org/jira/browse/ISIS-2043
Project: Isis
Issue Type: New Feature
Affects Versions: 1.16.2
Reporter: Dan Haywood
Assignee: Dan Haywood
Fix For: 1.16.3
Thus:
{code:java}
@DomainObject(
...,
actionDomainEvent=IncomingInvoice.ActionDomainEvent.class,
propertyDomainEvent=IncomingInvoice.PropertyDomainEvent.class,
collectionDomainEVent=IncomingInvoice.CollectionDomainEvent.class
)
public class IncomingInvoice {
public static class ActionDomainEvent
extends o.a.i.applib.services.eventbus.ActionDomainEvent {}
// etc
}{code}
then, for this domain event would be used as the default for any actions etc.
Two refinements to this:
a) for mixins, the event type emitted by a mixin action should be that of its mixee if possible. This does mean that the domain event must use <Object> as its generic type, because the source could either be the regular domain object or a mixin. This seems reasonable, the subscriber can just call ev.getMixee() to determine the original source.
b) as a metamodel validation, if there are members that already define their own event types, then these event types should inherit from the types defined in @DomainObject. However, not sure exactly how well this plays with requirement from (a) that the generic type is <Object>.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)