org.openmrs.obs.handler
Class AbstractHandler

java.lang.Object
  extended by org.openmrs.obs.handler.AbstractHandler
Direct Known Subclasses:
ImageHandler, TextHandler

public class AbstractHandler
extends java.lang.Object

Abstract handler for some convenience methods Files are stored in the location specified by the global property: "obs.complex_obs_dir"

Since:
1.5

Field Summary
static org.apache.commons.logging.Log log
           
protected  java.text.SimpleDateFormat longfmt
           
protected  java.text.NumberFormat nf
           
 
Constructor Summary
AbstractHandler()
          Constructor initializes formats for alternative file names to protect from unintentionally overwriting existing files.
 
Method Summary
static java.io.File getComplexDataFile(Obs obs)
          Convenience method to create and return a file for the stored ComplexData.data Object
 java.lang.String getExtension(java.lang.String filename)
          Get the extension for a given filename.
 Obs getObs(Obs obs, java.lang.String view)
           
 java.io.File getOutputFileToWrite(Obs obs)
          Returns a File for the given obs complex data to be written to.
 boolean purgeComplexData(Obs obs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

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

nf

protected java.text.NumberFormat nf

longfmt

protected java.text.SimpleDateFormat longfmt
Constructor Detail

AbstractHandler

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

Method Detail

getOutputFileToWrite

public java.io.File getOutputFileToWrite(Obs obs)
                                  throws java.io.IOException
Returns a File for the given obs complex data to be written to. The output file location is determined off of the OpenmrsConstants.GLOBAL_PROPERTY_COMPLEX_OBS_DIR and the file name is determined off the current obs.getComplexData().getTitle().

Parameters:
obs - the Obs with a non-null complex data on it
Returns:
File that the complex data should be written to
Throws:
java.io.IOException

getExtension

public java.lang.String getExtension(java.lang.String filename)
Get the extension for a given filename.
If given "asdf.jpg", will return "jpg".
If given "asdf", will return "asdf".

Parameters:
filename -
Returns:
the filepart after the period in the given filename

getObs

public Obs getObs(Obs obs,
                  java.lang.String view)
See Also:
ComplexObsHandler.getObs(Obs, String)

purgeComplexData

public boolean purgeComplexData(Obs obs)
See Also:
ComplexObsHandler.purgeComplexData(org.openmrs.Obs)

getComplexDataFile

public static java.io.File getComplexDataFile(Obs obs)
Convenience method to create and return a file for the stored ComplexData.data Object

Parameters:
obs -
Returns:
File object

OpenMRS-1.7.x

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