|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.synyx.hades.domain.auditing.support.AuditingEntityListener<T>
@Configurable public class AuditingEntityListener<T>
JPA entity listener to capture auditing information on persiting and updating
entities. To get this one flying be sure you configure it as entity listener
in your orm.xml as follows:
<persistence-unit-metadata>
<persistence-unit-defaults>
<entity-listeners>
<entity-listener class="org.synyx.hades.domain.auditing.support.AuditingEntityListener" />
</entity-listeners>
</persistence-unit-defaults>
</persistence-unit-metadata>
After that it's just a matter of activating auditing in your Spring config:
<hades:auditing auditor-aware-ref="yourAuditorAwarebean" />
| Constructor Summary | |
|---|---|
AuditingEntityListener()
|
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
|
void |
setAuditorAware(AuditorAware<T> auditorAware)
Setter to inject a AuditorAware component to retrieve the current
auditor. |
void |
setDateTimeForNow(boolean dateTimeForNow)
Setter do determine if Auditable#setCreated(DateTime) and
Auditable#setLastModified(DateTime) shall be filled with the
current Java time. |
void |
setModifyOnCreation(boolean modifyOnCreation)
Set this to false if you want to treat entity creation as modification and thus set the current date as modification date, too. |
void |
touch(java.lang.Object target)
Sets modification and creation date and auditor on the target object in case it implements Auditable. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AuditingEntityListener()
| Method Detail |
|---|
public void setAuditorAware(AuditorAware<T> auditorAware)
AuditorAware component to retrieve the current
auditor.
auditorAware - the auditorAware to setpublic void setDateTimeForNow(boolean dateTimeForNow)
Auditable#setCreated(DateTime) and
Auditable#setLastModified(DateTime) shall be filled with the
current Java time. Defaults to true. One might set this to
false to use database features to set entity time.
dateTimeForNow - the dateTimeForNow to setpublic void setModifyOnCreation(boolean modifyOnCreation)
true.
modifyOnCreation - if modification information shall be set on
creation, toopublic void touch(java.lang.Object target)
Auditable.
target - public void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||