EntityPropertyChangeSubscriber

SPI called for each pre-post change to a property of a domain entity during a result of the transaction. The callback is therefore quite fine-grained and will be called many (many) times for within any given transaction.

Only those properties of entities that have publishing enabled (using * DomainObject#entityChangePublishing() ) are included.

API

EntityPropertyChangeSubscriber.java
interface EntityPropertyChangeSubscriber {
  void onChanging(EntityPropertyChange entityPropertyChange)     (1)
  void onChanging(Can<EntityPropertyChange> entityPropertyChanges)     (2)
}
1 onChanging(EntityPropertyChange)

Receives a single property change event for changing entities (with publishing enabled using DomainObject#entityChangePublishing() ) as an instance of EntityPropertyChange .

2 onChanging(Can)

Receives a collection of EntityPropertyChange property change event s for the changing entities.

Members

onChanging(EntityPropertyChange)

Receives a single property change event for changing entities (with publishing enabled using DomainObject#entityChangePublishing() ) as an instance of EntityPropertyChange .

The callback is called (multiple times) at the end of the transaction, during the pre-commit phase.

onChanging(Can)

Receives a collection of EntityPropertyChange property change event s for the changing entities.

The default implementation simply delegates to #onChanging(EntityPropertyChange) for each, but subclasses could override in order to perform work in bulk.

Implementation

This is an SPI, but the framework provides a simple implementation, o.a.c.applib.services.publishing.log.EntityPropertyChangeLogger, that just logs events as they are received.