org.openmrs.api.handler
Class AuditableSaveHandler

java.lang.Object
  extended by org.openmrs.api.handler.AuditableSaveHandler
All Implemented Interfaces:
RequiredDataHandler<Auditable>, SaveHandler<Auditable>

@Handler(supports=Auditable.class)
public class AuditableSaveHandler
extends java.lang.Object
implements SaveHandler<Auditable>

This class deals with any object that implements Auditable. When an Auditable is saved (via a save* method in a service), this handler is automatically called by the RequiredDataAdvice AOP class.

This sets the changedBy and dateChanged on the object if it has been saved previously (aka, it has an id).

Since:
1.5
See Also:
RequiredDataHandler

Constructor Summary
AuditableSaveHandler()
           
 
Method Summary
 void handle(Auditable auditable, User currentUser, java.util.Date currentDate, java.lang.String reason)
          This sets the changedBy and dateChanged on the object if it has been saved already (aka, it has an id).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuditableSaveHandler

public AuditableSaveHandler()
Method Detail

handle

public void handle(Auditable auditable,
                   User currentUser,
                   java.util.Date currentDate,
                   java.lang.String reason)
This sets the changedBy and dateChanged on the object if it has been saved already (aka, it has an id).

Specified by:
handle in interface RequiredDataHandler<Auditable>
Specified by:
handle in interface SaveHandler<Auditable>
Parameters:
auditable - an OpenmrsObject that needs to have some required data set
currentUser - the user who is saving this object
currentDate - the datetime this object is being saved
reason - (optional) would be the second argument in the save method, if exists
See Also:
RequiredDataHandler.handle(org.openmrs.OpenmrsObject, org.openmrs.User, java.util.Date, java.lang.String)
Expected behavior:
set creator if null, not set creator if non null, set dateCreated if null, not set dateCreated if non null

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change