Package io.jmix.audit
Interface EntityLog
- All Known Implementing Classes:
EntityLogImpl
public interface EntityLog
Logs lifecycle events (create, modify, delete) of JPA entities.
Configured by LoggedEntity and
LoggedAttribute entities.
-
Method Summary
Modifier and TypeMethodDescriptionvoidFlush records accumulated by invocations ofregisterCreate(Object)and other registration methods to the database.voidInvalidates configuration cache.booleanbooleanvoidprocessLoggingForCurrentThread(boolean enabled) Disables/enables entity logging for the current thread.voidregisterCreate(Object entity) Logs creation of an entity which is configured for manual logging (LoggedEntity.auto == false).voidregisterCreate(Object entity, boolean auto) Logs creation of an entity which is configured for auto or manual logging.voidregisterDelete(Object entity) Logs deletion of an entity which is configured for manual logging (LoggedEntity.auto == false).voidregisterDelete(Object entity, boolean auto) Logs deletion of an entity which is configured for auto or manual logging Should be called within an active transaction.voidregisterModify(Object entity) Logs modification of an entity which is configured for manual logging (LoggedEntity.auto == false).voidregisterModify(Object entity, boolean auto) Logs modification of an entity which is configured for auto or manual logging.voidregisterModify(Object entity, boolean auto, AttributeChanges changes) Logs modification of an entity which is configured for auto or manual logging.voidsetEnabled(boolean enabled) Enables/disables entity logging globally.
-
Method Details
-
isEnabled
boolean isEnabled()- Returns:
- whether entity logging is enabled globally and for the current thread (see
processLoggingForCurrentThread(boolean))
-
setEnabled
void setEnabled(boolean enabled) Enables/disables entity logging globally. By default, takes the value from thejmix.audit.enabledapplication property. -
registerCreate
Logs creation of an entity which is configured for manual logging (LoggedEntity.auto == false). Should be called within an active transaction.- Parameters:
entity- entity instance
-
registerCreate
Logs creation of an entity which is configured for auto or manual logging. Should be called within an active transaction.- Parameters:
entity- entity instanceauto- should match the entity configuration for auto (true) or manual (false) logging
-
registerModify
Logs modification of an entity which is configured for manual logging (LoggedEntity.auto == false). Should be called within an active transaction.- Parameters:
entity- entity instance in managed state
-
registerModify
Logs modification of an entity which is configured for auto or manual logging. Should be called within an active transaction.- Parameters:
entity- entity instance in managed stateauto- should match the entity configuration for auto (true) or manual (false) logging
-
registerModify
Logs modification of an entity which is configured for auto or manual logging. Should be called within an active transaction.- Parameters:
entity- entity instance in managed stateauto- should match the entity configuration for auto (true) or manual (false) loggingchanges- attribute changes provided by caller
-
registerDelete
Logs deletion of an entity which is configured for manual logging (LoggedEntity.auto == false). Should be called within an active transaction. -
registerDelete
Logs deletion of an entity which is configured for auto or manual logging Should be called within an active transaction.- Parameters:
entity- entity instanceauto- should match the entity configuration for auto logging (true) or manual logging (false)
-
invalidateCache
void invalidateCache()Invalidates configuration cache. The configuration will be recreated from the database on next lifecycle event. -
processLoggingForCurrentThread
void processLoggingForCurrentThread(boolean enabled) Disables/enables entity logging for the current thread. Enabled by default.- Parameters:
enabled- entity logging disabled if false, enabled otherwise.
-
isLoggingForCurrentThread
boolean isLoggingForCurrentThread()- Returns:
- whether logging for the current thread is enabled
- See Also:
-
flush
Flush records accumulated by invocations ofregisterCreate(Object)and other registration methods to the database.
-