public class AuditingHandler extends Object implements InitializingBean
Constructor and Description |
---|
AuditingHandler(MappingContext<? extends PersistentEntity<?,?>,? extends PersistentProperty<?>> mappingContext)
Deprecated.
use
AuditingHandler(PersistentEntities) instead. |
AuditingHandler(PersistentEntities entities)
Creates a new
AuditableBeanWrapper using the given PersistentEntities when looking up auditing
metadata via reflection. |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
protected boolean |
isAuditable(Object source)
Returns whether the given source is considered to be auditable in the first place
|
<T> T |
markCreated(T source)
Marks the given object as created.
|
<T> T |
markModified(T source)
Marks the given object as modified.
|
void |
setAuditorAware(AuditorAware<?> auditorAware)
Setter to inject a
AuditorAware component to retrieve the current auditor. |
void |
setDateTimeForNow(boolean dateTimeForNow)
Setter do determine if
Auditable#setCreatedDate(DateTime) and
Auditable#setLastModifiedDate(DateTime) shall be filled with the current Java time. |
void |
setDateTimeProvider(DateTimeProvider dateTimeProvider)
Sets the
DateTimeProvider to be used to determine the dates to be set. |
void |
setModifyOnCreation(boolean modifyOnCreation)
Set this to true if you want to treat entity creation as modification and thus setting the current date as
modification date during creation, too.
|
@Deprecated public AuditingHandler(MappingContext<? extends PersistentEntity<?,?>,? extends PersistentProperty<?>> mappingContext)
AuditingHandler(PersistentEntities)
instead.AuditableBeanWrapper
using the given MappingContext
when looking up auditing metadata
via reflection.mappingContext
- must not be null.public AuditingHandler(PersistentEntities entities)
AuditableBeanWrapper
using the given PersistentEntities
when looking up auditing
metadata via reflection.entities
- must not be null.public void setAuditorAware(AuditorAware<?> auditorAware)
AuditorAware
component to retrieve the current auditor.auditorAware
- must not be null.public void setDateTimeForNow(boolean dateTimeForNow)
Auditable#setCreatedDate(DateTime)
and
Auditable#setLastModifiedDate(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 setDateTimeProvider(DateTimeProvider dateTimeProvider)
DateTimeProvider
to be used to determine the dates to be set.dateTimeProvider
- public <T> T markCreated(T source)
source
- public <T> T markModified(T source)
source
- protected final boolean isAuditable(Object source)
source
- must not be null.public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.