@Handler(supports={Patient.class,Encounter.class,Obs.class,Cohort.class,Order.class}, order=1) public class RequireVoidReasonVoidHandler extends Object implements VoidHandler<Voidable>
RequiredDataAdvice
,
UnvoidHandler
Constructor and Description |
---|
RequireVoidReasonVoidHandler() |
Modifier and Type | Method and Description |
---|---|
void |
handle(Voidable voidableObject,
User voidingUser,
Date voidedDate,
String voidReason)
Validates that the voidReason is non-null and non-empty for supported objects
Should throw IllegalArgumentException if Patient voidReason is null
Should throw IllegalArgumentException if Encounter voidReason is empty
Should throw IllegalArgumentException if Obs voidReason is blank
Should not throw Exception if voidReason is not blank
Should not throw Exception if voidReason is null for unsupported types
|
public void handle(Voidable voidableObject, User voidingUser, Date voidedDate, String voidReason)
handle
in interface RequiredDataHandler<Voidable>
handle
in interface VoidHandler<Voidable>
voidableObject
- an OpenmrsObject
that needs to have some required data setvoidingUser
- the currently authenticated User
voidedDate
- the current Date
voidReason
- (optional) would be the second argument in the save/void/unvoid/etc method, if
existsRequiredDataHandler.handle(org.openmrs.OpenmrsObject,
org.openmrs.User, java.util.Date, java.lang.String)
Copyright © 2024 OpenMRS Inc.. All rights reserved.