EntityChangeTracker
Responsible for collecting the details of all changes to domain objects within a transaction.
API
interface EntityChangeTracker {
void enlistCreated(ManagedObject entity) (1)
void enlistUpdating(ManagedObject entity, Function<ManagedObject, Can<PropertyChangeRecord>> propertyChangeRecordSupplier) (2)
void enlistDeleting(ManagedObject entity) (3)
void incrementLoaded(ManagedObject entity) (4)
}
1 | enlistCreated(ManagedObject)
Publishing support: for object stores to enlist an object that has just been created, capturing a dummy value |
2 | enlistUpdating(ManagedObject, Function)
Publishing support: for object stores to enlist an object that is about to be updated, capturing the pre-modification values of the properties of the ManagedObject . |
3 | enlistDeleting(ManagedObject)
Publishing support: for object stores to enlist an object that is about to be deleted, capturing the pre-deletion value of the properties of the ManagedObject . |
4 | incrementLoaded(ManagedObject)
Not strictly part of the concern of entity tracking, but allows the default implementation to also implement the org.apache.causeway.applib.services.metrics.MetricsService . |
Members
enlistCreated(ManagedObject)
Publishing support: for object stores to enlist an object that has just been created, capturing a dummy value '[NEW]'
for the pre-modification value.
The post-modification values are captured when the transaction commits.
enlistUpdating(ManagedObject, Function)
Publishing support: for object stores to enlist an object that is about to be updated, capturing the pre-modification values of the properties of the ManagedObject .
The post-modification values are captured when the transaction commits.
Overload as an optimization for ORMs (specifically, JPA) where already have access to the changed records by accessing the ORM-specific data structures ( EntityManager
's unit-of-work).
enlistDeleting(ManagedObject)
Publishing support: for object stores to enlist an object that is about to be deleted, capturing the pre-deletion value of the properties of the ManagedObject .
The post-modification values are captured when the transaction commits. In the case of deleted objects, a dummy value '[DELETED]'
is used as the post-modification value.