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
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.
Implementations
This is an SPI, and the framework provides several implementations.
If multiple implementations of this service are registered, all will be called. |
Applib (Log4j2)
The applib provides a simple implementation, EntityPropertyChangeLogger, that just logs events as they are received.
Audit Trail
The Audit Trail module also provides an implementation, EntityPropertyChangeSubscriberForAuditTrail. This implementation persists an instance of the AuditTrailEntry entity for each event.