protected void onBtnCaptureImportClick() throws ims.framework.exceptions.PresentationLogicException { clear(); PatientWoundAppDBImAndCommentVo tempVo = new PatientWoundAppDBImAndCommentVo(); tempVo.setComment(form.txtComment().getValue()); form.getGlobalContext().Core.setPatientWoundAppDBImAndComment(tempVo); form.ccWoundAuthoring().initializeComponent(); engine.open(form.getForms().Core.WoundImageSelection, new Object[]{null}); }
protected void onBtnSaveClick() throws ims.framework.exceptions.PresentationLogicException { String imageFilename = form.getLocalContext().getSelectedFile(); if (imageFilename == null || imageFilename.equals("")) { engine.showMessage("Image cannot be saved with no file name specified"); return; } try { String uploadFileName = getBaseName(imageFilename); ByteArrayOutputStream baos = new ByteArrayOutputStream(); BufferedImage originalImage = ImageIO.read(new File(EnvironmentConfig.getBaseUri() + ConfigFlag.GEN.FILE_UPLOAD_DIR.getValue() + "/" + uploadFileName)); baos = new ByteArrayOutputStream(); ImageIO.write(originalImage, "png", baos); byte[] content = baos.toByteArray(); String encodedResizeImage = encodeToBase64(content); AppDBImageVo dbImageVo = new AppDBImageVo(); dbImageVo.setImageData(encodedResizeImage); dbImageVo.setImageType(getImageType(getFileType())); PatientWoundAppDBImAndCommentVo tempVo = new PatientWoundAppDBImAndCommentVo(); tempVo.setWoundImage(dbImageVo); tempVo.setComment(form.txtComment().getValue()); form.getGlobalContext().Core.setPatientWoundAppDBImAndComment(tempVo); engine.close(DialogResult.OK); } catch (IOException err) { engine.showMessage(err.getMessage()); return; } }