@Handler(supports=Voidable.class) public class BaseVoidHandler extends Object implements VoidHandler<Voidable>
RequiredDataAdvice
class uses AOP around each method in every service to check to see if
its a void* method. If it is a void* method, this class is called to handle setting the
Voidable.getVoided()
, Voidable.setVoidReason(String)
,
Voidable.setVoidedBy(User)
, and Voidable.setDateVoided(Date)
. Voidable
that are themselves a Voidable
are looped over
and also voided by the RequiredDataAdvice
class.RequiredDataAdvice
,
UnvoidHandler
Constructor and Description |
---|
BaseVoidHandler() |
Modifier and Type | Method and Description |
---|---|
void |
handle(Voidable voidableObject,
User voidingUser,
Date voidedDate,
String voidReason)
Sets all void attributes to the given parameters.
|
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
existsShould set the voided bit
Should set the voidReason
Should set voidedBy
Should not set voidedBy if non null
Should set dateVoided
Should not set dateVoided if non null
Should not set the voidReason if already voided
Should set voidedBy even if voided bit is set but voidedBy is null
Copyright © 2024 OpenMRS Inc.. All rights reserved.