org.openmrs.api.handler
Class RequireVoidReasonSaveHandler

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

@Handler(supports={Patient.class,Encounter.class})
public class RequireVoidReasonSaveHandler
extends java.lang.Object
implements SaveHandler<Voidable>

This handler makes sure the when a voided object is saved, that the reason field is entered for supported objects Note: Obs is not included in the supported types because the ObsService handles this explicitly

Since:
1.5
See Also:
RequiredDataAdvice, SaveHandler, RequiredDataAdvice

Constructor Summary
RequireVoidReasonSaveHandler()
           
 
Method Summary
 void handle(Voidable voidableObject, User currentUser, java.util.Date currentDate, java.lang.String notUsed)
          Validates that the voidReason is non-null and non-empty for supported objects
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequireVoidReasonSaveHandler

public RequireVoidReasonSaveHandler()
Method Detail

handle

public void handle(Voidable voidableObject,
                   User currentUser,
                   java.util.Date currentDate,
                   java.lang.String notUsed)
Validates that the voidReason is non-null and non-empty for supported objects

Specified by:
handle in interface RequiredDataHandler<Voidable>
Specified by:
handle in interface SaveHandler<Voidable>
Parameters:
voidableObject - 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
notUsed - (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:
throw APIException if Patient voidReason is null, throw APIException if Encounter voidReason is empty, throw APIException if Encounter voidReason is blank, not throw Exception if voidReason is not blank, not throw Exception if voidReason is null for unsupported types

OpenMRS-1.7.x

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