Tried to configure like the example.

What I did:
- added EventBusServiceJdo to isis.properties
- added @PropertyInteraction for the following property

@PropertyInteraction()
    @Column(name = "klantreferentie", allowsNull = "true")
    public String getCustomerReference()
    {
        return this.customerReference;
    }

- created a subscriptions class like ToDoItemSubscriptions with injected EventBusService and with the following method

@Programmatic
    @Subscribe
    public void on(PropertyInteractionEvent<?,?> ev) {
        recordEvent(ev);
        switch(ev.getPhase()) {........

When I edit the entity and change the value of CustomerReference, above mentioned method isn't called. It ís called however when I just open the entity page. Do I need to configure anything else?

Thanks,
Erik



On 09/26/2014 10:24 AM, Dan Haywood wrote:
Hi Eric,

as Martin says... the @PostsPropertyChangedEvent is deprecated, similarly
so are @PostsCollectionAddedToEvent, @PostsCollectionRemovedFromEvent,
@ActionInvokedEvent.

Instead they have been replaced by the more powerful @PropertyInteraction,
@CollectionInteraction and @ActionInteraction annotations.  The primary
difference is that these new annotations cause an event to be fired not
just once after-the-fact, but in fact FIVE times: hide, disable, validate,
executing (before) and executed (after).

The hide/disable/validate allow the subscriber to effectively veto the
interaction: a very powerful concept.   In Estatio for example we use
subscribers to veto the deletion of an object that has dependent entities
(makes for better error messages than a referential integrity error thrown
up by the DBMS).

For each of these annotations you can either use the generic event or
create a subclass.  The latter allows the subscribers to be more targeted.

For an example of using the generic events (with a property), see [1], [2]
For an example of using the specific events (with an action), see [3], [4]

HTH
Dan

[1]
https://github.com/apache/isis/blob/8cbe55c5c91e9300e9a8c0bf197f5166329a298a/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.java#L138
[2]
https://github.com/apache/isis/blob/8cbe55c5c91e9300e9a8c0bf197f5166329a298a/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItemSubscriptions.java#L162

[3]
https://github.com/apache/isis/blob/8cbe55c5c91e9300e9a8c0bf197f5166329a298a/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.java#L287
[4]
https://github.com/apache/isis/blob/8cbe55c5c91e9300e9a8c0bf197f5166329a298a/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItemSubscriptions.java#L106


On 26 September 2014 09:01, Martin Grigorov <[email protected]> wrote:

Hi,

Looking at the code it is deprecated and the refers
to org.apache.isis.applib.annotation.PropertyInteraction
See its javadoc and TodoApp for usage.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Sep 26, 2014 at 9:57 AM, Erik de Hair <[email protected]> wrote:

Hi,

I need to do some maintenance (the user doesn't need to know about) after
some property changed. I thought I might do this with the event bus and I
found @PostsPropertyChangedEvent but no example of how to configure this.
Is there any example available?

Thanks,
Erik


Reply via email to