org.openmrs.obs.handler
Class ImageHandler

java.lang.Object
  extended by org.openmrs.obs.handler.AbstractHandler
      extended by org.openmrs.obs.handler.ImageHandler
All Implemented Interfaces:
ComplexObsHandler

public class ImageHandler
extends AbstractHandler
implements ComplexObsHandler

Handler for storing basic images for complex obs to the file system. The image mime type used is taken from the image name. if the .* image name suffix matches ImageIO.getWriterFormatNames() then that mime type will be used to save the image. Images are stored in the location specified by the global property: "obs.complex_obs_dir"

Since:
1.5
See Also:
OpenmrsConstants.GLOBAL_PROPERTY_COMPLEX_OBS_DIR

Field Summary
static org.apache.commons.logging.Log log
           
 
Fields inherited from class org.openmrs.obs.handler.AbstractHandler
longfmt, nf
 
Constructor Summary
ImageHandler()
          Constructor initializes formats for alternative file names to protect from unintentionally overwriting existing files.
 
Method Summary
 Obs getObs(Obs obs, java.lang.String view)
          Currently supports all views and puts the Image file data into the ComplexData object
 Obs saveObs(Obs obs)
          Save a complex obs.
 
Methods inherited from class org.openmrs.obs.handler.AbstractHandler
getComplexDataFile, getExtension, getOutputFileToWrite, purgeComplexData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openmrs.obs.ComplexObsHandler
purgeComplexData
 

Field Detail

log

public static final org.apache.commons.logging.Log log
Constructor Detail

ImageHandler

public ImageHandler()
Constructor initializes formats for alternative file names to protect from unintentionally overwriting existing files.

Method Detail

getObs

public Obs getObs(Obs obs,
                  java.lang.String view)
Currently supports all views and puts the Image file data into the ComplexData object

Specified by:
getObs in interface ComplexObsHandler
Overrides:
getObs in class AbstractHandler
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:
ComplexObsHandler.getObs(org.openmrs.Obs, java.lang.String)

saveObs

public Obs saveObs(Obs obs)
            throws APIException
Description copied from interface: ComplexObsHandler
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.

Specified by:
saveObs in interface ComplexObsHandler
Returns:
the Obs with the ComplexData nullified
Throws:
APIException
See Also:
ComplexObsHandler.saveObs(org.openmrs.Obs)

OpenMRS-1.7.x

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