Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Obs getObs (Obs obs,String view){
- File file = getComplexDataFile(obs);
- log.debug("value complex: " + obs.getValueComplex());
- log.debug("file path: " + file.getAbsolutePath());
- ComplexData complexData = null;
- // to handle problem with downloading/saving files with blank spaces or commas in their names
- // also need to remove the "file" text appended to the end of the file name
- String[] names = obs.getValueComplex().split("\\|");
- String originalFilename = names[0];
- if ("download".equals(view)) {
- originalFilename = originalFilename.replaceAll(",", "").replaceAll(" ", "").replaceAll("file$", "");
- }
- try {
- complexData = new ComplexData(originalFilename, OpenmrsUtil.getFileAsString(file).toCharArray());
- }
- catch (IOException e) {
- log.error("Trying to read file: " + file.getAbsolutePath(), e);
- }
- obs.setComplexData(complexData);
- return obs;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement