org.openmrs.obs
Interface ComplexObsHandler

All Known Implementing Classes:
ImageHandler, TextHandler

public interface ComplexObsHandler

Interface for handling complex obs. Implementing classes are responsible for the storage and retrieval of ComplexData associated with an Obs that is complex -- where Obs.isComplex() returns true.

These handler classes are delegated to by the ObsService and should never be called directly.

Use case:

   Obs complexObs = Context.getObsService().getComplexObs(123, OpenmrsConstants.RAW_VIEW);
   ComplexData complexData = complexObs.getComplexData();
   Object largeStoredObject = complexData.getData();
 

Since:
1.5

Method Summary
 Obs getObs(Obs obs, java.lang.String view)
          Fetches the ComplexData from the location indicated from Obs.value_complex, attaches ComplexData onto the Obs and returns the Obs.
 boolean purgeComplexData(Obs obs)
          Completely removes the ComplexData Object from its storage location.
 Obs saveObs(Obs obs)
          Save a complex obs.
 

Method Detail

saveObs

Obs saveObs(Obs obs)
            throws APIException
Save a complex obs. This extracts the ComplexData from an Obs, stores it to a location determined by the hander, and returns the Obs with the ComplexData nullified.

Parameters:
obs -
Returns:
the Obs with the ComplexData nullified
Throws:
APIException

getObs

Obs getObs(Obs obs,
           java.lang.String view)
Fetches the ComplexData from the location indicated from Obs.value_complex, attaches ComplexData onto the Obs and returns the Obs.
The ComplexData is returned in the format specified by the view (which can be null).
This view is typically a contract between the view and the handler that has been registered, so they those two know the types of views that can be handled.

Parameters:
obs - an obs without complex data filled in
view - nullable view type. This is defined by the ui and view/handler
Returns:
the obs with complex data filled in
See Also:
OpenmrsConstants

purgeComplexData

boolean purgeComplexData(Obs obs)
Completely removes the ComplexData Object from its storage location.

TODO: If we cannot delete the complex data object because of an error, do we want to return the Obs, a boolean false, or an Exception?

Parameters:
obs -

OpenMRS-1.7.x

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