Class BaseRetireHandler

  extended by org.openmrs.api.handler.BaseRetireHandler
All Implemented Interfaces:
RequiredDataHandler<Retireable>, RetireHandler<Retireable>

public class BaseRetireHandler
extends java.lang.Object
implements RetireHandler<Retireable>

This is the default class for all retire* actions that take place on all services. The 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.isRetired(), Retireable.setRetireReason(String), Retireable.setRetiredBy(User), and Retireable.setDateRetired(Date).

Child collections on this Retireable that are themselves a Retireable are looped over and also retired by the RequiredDataAdvice class.

This class will only set the retiredBy and dateRetired attributes if retired is set to false. If retired is set to true it is assumed that this object is in a list of things that is getting retired but that it itself was previously retired. The workaround to this is that if the retired bit is true OR the retiredBy is null, the retiredBy, dateRetired, and retireReason will be set.

See Also:

Constructor Summary
Method Summary
 void handle(Retireable retireableObject, User retiringUser, java.util.Date retireDate, java.lang.String retireReason)
          This method sets "retired" to true, the retired reason, and the retiredBy/dateRetired (if those are null).

TODO do the check here for an empty retireReason?
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public BaseRetireHandler()
Method Detail


public void handle(Retireable retireableObject,
                   User retiringUser,
                   java.util.Date retireDate,
                   java.lang.String retireReason)
This method sets "retired" to true, the retired reason, and the retiredBy/dateRetired (if those are null).

TODO do the check here for an empty retireReason?

Specified by:
handle in interface RequiredDataHandler<Retireable>
Specified by:
handle in interface RetireHandler<Retireable>
retireableObject - an OpenmrsObject that needs to have some required data set
retiringUser - the currently authenticated User
retireDate - the current Date
retireReason - (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:
set the retired bit, set the retireReason, set retired by, not set retired by if non null, set dateRetired, not set dateRetired if non null, not set the retireReason if already voided, set retiredBy even if retired bit is set but retiredBy is null


Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change