-
Type:
Sub-task
-
Status: Closed
-
Priority:
Must
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: OpenMRS 1.9.0
-
Component/s: None
-
Labels:
-
Complexity:High
We should create a new interface for datatype handlers that allow web downloads of their custom value.
Option A:
interface DownloadableDatatypeHandler extends CustomDatatypeHandler { /** * Gets the mime type of downloading the given custom value. * Must not return null. */ String getMimeType(CustomDatatype dt, String valueReference); /** * Gets the filename downloading the given custom value. * May return null, in which case the framework will choose a meaningless filename. */ String getFilename(CustomDatatype dt, String valueReference); /** * Writes the custom value to os. * Implementations should assume that getMimeType and getFilename have been called and applied. * Implementations should assume that os is some sort of BufferedOutputStream */ void writeToStream(OutputStream os); }
Option B:
// I'm not sure why we'd need to give such low-level control to implementations interface DownloadableDatatypeHandler extends CustomDatatypeHandler { /** * */ void writeResponse(HttpServletResponse); } abstract class BaseDownloadableDatatypeHandler implements CustomDatatypeHandler { abstract String getMimeType(CustomDatatype dt, String valueReference); abstract String getFilename(CustomDatatype dt, String valueReference); abstract void writeToStream(OutputStream os); }