@Handler(supports=Retireable.class) public class RetireSaveHandler extends Object implements SaveHandler<Retireable>
RequiredDataAdviceclass uses AOP around each method in every service to check to see if its a save* method. If it is a save* method, and the object being saved implements
Retireable, this class is called to handle setting the
Retireable.setDateRetired(Date)if not set already.
RequiredDataAdviceclass will loop over child collections on this
Retireablethat are themselves a
Retireableand retiredBy/dateRetired are set, but ONLY IF the retired bit was set on them as well. Using the associated retire* method in the service on the parent instance is preferred so that all child objects are indeed retired.
|Constructor and Description|
|Modifier and Type||Method and Description|
This method does not set "retired" to true, but rather only sets the retiredBy/dateRetired if they are null and retired==true.
public void handle(Retireable retireableObject, User currentUser, Date currentDate, String notUsed)
retireableObject- 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
RequiredDataHandler.handle(org.openmrs.OpenmrsObject, org.openmrs.User, java.util.Date, java.lang.String)
Copyright © 2017 OpenMRS Inc.. All rights reserved.