Class AbstractAuditableListener
java.lang.Object
org.broadleafcommerce.common.audit.AbstractAuditableListener
- Direct Known Subclasses:
AuditableListener
Implements behavior shared by auditable listener implementations
- Author:
- Chris Kittrell (ckittrell)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringGathers the auditable field name.abstract voidsetAuditCreationAndUpdateData(Object entity) Method that will be invoked in a registered listener to set the entity's creation data.protected voidsetAuditCreationData(Object entity, Object auditableObject) Sets the value of the dateCreated, createdBy, and dateUpdated fields.protected voidsetAuditData(Object entity, Object auditableObject, String dateField, String userField) abstract voidsetAuditUpdateData(Object entity) Method that will be invoked in a registered listener to set the entity's update data.protected voidsetAuditUpdateData(Object entity, Object auditableObject) Sets the value of the dateUpdated and updatedBy fields.protected abstract voidsetAuditValueAgent(Field field, Object entity) Method that sets the user-related data.protected voidsetAuditValueTemporal(Field field, Object entity) Used to set the timestamp for dateCreated and dateUpdated.
-
Constructor Details
-
AbstractAuditableListener
public AbstractAuditableListener()
-
-
Method Details
-
setAuditCreationAndUpdateData
Method that will be invoked in a registered listener to set the entity's creation data. In most cases, callingsetAuditCreationData(Object, Object)should suffice.- Parameters:
entity-- Throws:
Exception
-
setAuditUpdateData
Method that will be invoked in a registered listener to set the entity's update data. In most cases, callingsetAuditUpdateData(Object, Object)should suffice.- Parameters:
entity-- Throws:
Exception
-
setAuditValueAgent
protected abstract void setAuditValueAgent(Field field, Object entity) throws IllegalArgumentException, IllegalAccessException Method that sets the user-related data.- Parameters:
field-entity-- Throws:
IllegalArgumentExceptionIllegalAccessException
-
setAuditCreationData
Sets the value of the dateCreated, createdBy, and dateUpdated fields.- Parameters:
entity-auditableObject-- Throws:
Exception
-
setAuditUpdateData
Sets the value of the dateUpdated and updatedBy fields.- Parameters:
entity-auditableObject-- Throws:
Exception
-
setAuditData
protected void setAuditData(Object entity, Object auditableObject, String dateField, String userField) throws Exception - Throws:
Exception
-
setAuditValueTemporal
protected void setAuditValueTemporal(Field field, Object entity) throws IllegalArgumentException, IllegalAccessException Used to set the timestamp for dateCreated and dateUpdated.- Parameters:
field-entity-- Throws:
IllegalArgumentExceptionIllegalAccessException
-
getAuditableFieldName
Gathers the auditable field name. The major purpose of this method is to provide a hook point for extensions to declare a different field name.- Returns:
- the name of the auditable field
-