org.openmrs.api.handler
Class RequireVoidReasonVoidHandler

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

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

This class ensures that the voidReason is non-null for supported object types

Since:
1.5
See Also:
RequiredDataAdvice, UnvoidHandler

Constructor Summary
RequireVoidReasonVoidHandler()
           
 
Method Summary
 void handle(Voidable voidableObject, User voidingUser, java.util.Date voidedDate, java.lang.String voidReason)
          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

RequireVoidReasonVoidHandler

public RequireVoidReasonVoidHandler()
Method Detail

handle

public void handle(Voidable voidableObject,
                   User voidingUser,
                   java.util.Date voidedDate,
                   java.lang.String voidReason)
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 VoidHandler<Voidable>
Parameters:
voidableObject - an OpenmrsObject that needs to have some required data set
voidingUser - the currently authenticated User
voidedDate - the current Date
voidReason - (optional) would be the second argument in the save/void/unvoid/etc method, if exists
See Also:
RequiredDataHandler.handle(org.openmrs.OpenmrsObject, org.openmrs.User, java.util.Date, java.lang.String)
Expected behavior:
throw IllegalArgumentException if Patient voidReason is null, throw IllegalArgumentException if Encounter voidReason is empty, throw IllegalArgumentException if Obs 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