@Handler(supports=Retireable.class) public class BaseRetireHandler extends Object implements RetireHandler<Retireable>
RequiredDataAdvice
class uses AOP around each method in every service to check to see if
its a retire* method. If it is a retire* method, this class is called to handle setting the
Retireable.getRetired()
, Retireable.setRetireReason(String)
,
Retireable.setRetiredBy(User)
, and Retireable.setDateRetired(Date)
. Retireable
that are themselves a Retireable
are looped
over and also retired by the RequiredDataAdvice
class.RequiredDataAdvice
Constructor and Description |
---|
BaseRetireHandler() |
Modifier and Type | Method and Description |
---|---|
void |
handle(Retireable retireableObject,
User retiringUser,
Date retireDate,
String retireReason)
This method sets "retired" to true, the retired reason, and the retiredBy/dateRetired (if
those are null).
|
public void handle(Retireable retireableObject, User retiringUser, Date retireDate, String retireReason)
handle
in interface RequiredDataHandler<Retireable>
handle
in interface RetireHandler<Retireable>
retireableObject
- an OpenmrsObject
that needs to have some required data setretiringUser
- the currently authenticated User
retireDate
- the current Date
retireReason
- (optional) would be the second argument in the save/void/unvoid/etc method, if
existsShould set the retired bit
Should set the retireReason
Should set retired by
Should not set retired by if non null
Should set dateRetired
Should not set dateRetired if non null
Should not set the retireReason if already voided
Should set retiredBy even if retired bit is set but retiredBy is null
Copyright © 2024 OpenMRS Inc.. All rights reserved.