- Timestamp:
- 05/15/08 20:28:28 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs/branches/complex-obs/src/api/org/openmrs/obs/handler/ImageHandler.java
r4166 r4232 19 19 import java.text.SimpleDateFormat; 20 20 import java.util.Date; 21 import java.util.HashMap; 22 import java.util.Map; 21 23 22 24 import javax.imageio.ImageIO; … … 37 39 public Log log = LogFactory.getLog(this.getClass()); 38 40 39 /** 40 * @see org.openmrs.obs.ComplexDataHandler#getValueAsString() 41 */ 42 public String getValueAsString() { 43 // TODO Auto-generated method stub 44 return null; 41 private Map<String, ComplexObsHandler> handlers; 42 43 public ImageHandler( ) { 44 handlers = new HashMap<String, ComplexObsHandler>(); 45 45 } 46 46 47 47 /** 48 48 * @see org.openmrs.obs.ComplexDataHandler#renderObs() … … 51 51 // TODO Auto-generated method stub 52 52 53 } 54 55 public Obs saveObs(Obs obs, String context) { 56 if (this.handlers.containsKey(context)) { 57 return this.handlers.get(context).saveObs(obs); 58 } 59 return this.saveObs(obs); 60 } 61 62 public Obs getObs(Obs obs, String context) { 63 if (this.handlers.containsKey(context)) { 64 return this.handlers.get(context).getObs(obs); 65 } 66 return this.getObs(obs); 53 67 } 54 68 … … 86 100 87 101 // Set the Title and URI for the valueComplex 88 obs.setValueComplex("JPG Image |" + outputfile.getAbsolutePath()); 102 //obs.setValueComplex("JPG Image |" + outputfile.getAbsolutePath()); 103 obs.setValueComplex("JPG Image |" + outputfile.getName()); 89 104 90 105 // TODO: Will the ComplexData instance remain in memory or be gc'd? … … 110 125 } 111 126 127 /** 128 * TODO: Implement this method! 129 * 130 * @param obs 131 * @return 132 */ 112 133 public Obs purgeObs(Obs obs) { 113 134 return obs; 114 135 } 115 136 137 public void putHandler(String context, ComplexObsHandler handler) { 138 this.handlers.put(context, handler); 139 } 140 141 public ComplexObsHandler getHandler(String context) { 142 return this.handlers.get(context); 143 } 144 145 public void putAllHandlers(Map<String, ComplexObsHandler> handlers) { 146 this.handlers.putAll(handlers); 147 } 148 149 public Map<String, ComplexObsHandler> getAllHandlers( ) { 150 return this.handlers; 151 } 152 153 public void removeHandler(String context) { 154 this.handlers.remove(context); 155 } 156 157 public boolean containsContext(String context) { 158 return this.handlers.containsKey(context); 159 } 160 161 public boolean containsHandler(ComplexObsHandler handler) { 162 return this.handlers.containsKey(handler); 163 } 164 116 165 }