isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik de Hair <e.deh...@pocos.nl>
Subject Expected multiple ObjectUpdatedEvents but only 1 catched
Date Wed, 09 May 2018 10:14:57 GMT
Hi,

For the following scenario I expected an UpdatedEvent for each entity 
being updated but I only receive one for the last updated entity. Is 
that by design?

Example classes:

@PersistenceCapable(table = "entities")
@DomainObject(updatedLifecycleEvent = Entity.UpdatedEvent.class)
public class Entity {
     public static class UpdatedEvent extends 
org.apache.isis.applib.services.eventbus.ObjectUpdatedEvent<Entity>{ }

     @Column(name = "activated", allowsNull = "false")
     @Getter @Setter
     private boolean activated;

     public void activate(){
         setActivated(true);
     }
}

@DomainService(nature=NatureOfService.DOMAIN)
public class EntitySubscriber extends AbstractSubscriber {

     @Subscribe
     public void on(Entity.UpdatedEvent ev) {
         // do something
     }
}

@DomainService(nature = NatureOfService.DOMAIN)
public class EntityService {

     public void activateAll(){
         List<Entity> entities = <query result>;

         for (Entity entity : entities) {
             entity.activate();
         }
     }
}

Thanks,
Erik



Mime
View raw message