Class AuditingEntityCallback
java.lang.Object
org.springframework.data.couchbase.core.mapping.event.AuditingEntityCallback
- All Implemented Interfaces:
Ordered
,AfterConvertCallback<Object>
,BeforeConvertCallback<Object>
,EntityCallback<Object>
public class AuditingEntityCallback
extends Object
implements BeforeConvertCallback<Object>, AfterConvertCallback<Object>, Ordered
EntityCallback
to populate auditing related fields on an entity about to be saved.- Since:
- 4.2
- Author:
- Jorge Rodríguez Martín
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionAuditingEntityCallback
(ObjectFactory<IsNewAwareAuditingHandler> auditingHandlerFactory) Creates a newAuditingEntityCallback
using the givenMappingContext
andAuditingHandler
provided by the givenObjectFactory
. -
Method Summary
Modifier and TypeMethodDescriptionint
getOrder()
onAfterConvert
(Object entity, CouchbaseDocument document, String collection) Entity callback method invoked after a domain object is materialized from aCouchbaseDocument
.onBeforeConvert
(Object entity, String collection) Entity callback method invoked before a domain object is converted to be persisted.
-
Constructor Details
-
AuditingEntityCallback
Creates a newAuditingEntityCallback
using the givenMappingContext
andAuditingHandler
provided by the givenObjectFactory
.- Parameters:
auditingHandlerFactory
- must not be null.
-
-
Method Details
-
onBeforeConvert
Description copied from interface:BeforeConvertCallback
Entity callback method invoked before a domain object is converted to be persisted. Can return either the same or a modified instance of the domain object.- Specified by:
onBeforeConvert
in interfaceBeforeConvertCallback<Object>
- Parameters:
entity
- the domain object to save.collection
- name of the collection.- Returns:
- the domain object to be persisted.
-
onAfterConvert
Description copied from interface:AfterConvertCallback
Entity callback method invoked after a domain object is materialized from aCouchbaseDocument
. Can return either the same or a modified instance of the domain object.- Specified by:
onAfterConvert
in interfaceAfterConvertCallback<Object>
- Parameters:
entity
- the domain object (the result of the conversion).document
- must not be null.collection
- name of the collection.- Returns:
- the domain object that is the result of reading it from the
CouchbaseDocument
.
-
getOrder
public int getOrder()
-