@Override protected void onSearch(AjaxRequestTarget target) { target.add(feedbackPanel); // Set study in context Long studyId = (Long) SecurityUtils.getSubject() .getSession() .getAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID); // Get a list of all Fields for the Study in context Study study = iArkCommonService.getStudy(studyId); Upload searchUpload = getModelObject().getUpload(); searchUpload.setStudy(study); searchUpload.setArkFunction( iArkCommonService.getArkFunctionByName(Constants.FUNCTION_KEY_VALUE_DATA_DICTIONARY)); Collection<Upload> uploadCollection = iArkCommonService.searchUploads(searchUpload); if (uploadCollection != null && uploadCollection.size() == 0) { this.info("Uploads with the specified criteria does not exist in the system."); target.add(feedbackPanel); } getModelObject().setUploadCollection(uploadCollection); listView.removeAll(); arkCrudContainerVO.getSearchResultPanelContainer().setVisible(true); target.add(arkCrudContainerVO.getSearchResultPanelContainer()); }
private AjaxButton buildDownloadReportButton(final Upload upload) { AjaxButton ajaxButton = new AjaxButton(au.org.theark.phenotypic.web.Constants.UPLOADVO_UPLOAD_UPLOAD_REPORT) { private static final long serialVersionUID = 1L; @Override protected void onSubmit(AjaxRequestTarget target, Form<?> form) { // Attempt to download the Blob as an array of bytes byte[] data = upload.getUploadReport(); log.warn("buildDownloadReportButton onsubmit get blob"); getRequestCycle() .scheduleRequestHandlerAfterCurrent( new ByteDataResourceRequestHandler( "text/plain", data, "uploadReport" + upload.getId() + ".txt")); } @Override protected void onError(AjaxRequestTarget target, Form<?> form) { this.error("Unexpected Error: Could not process download upload report request"); }; }; ajaxButton.setVisible(true); ajaxButton.setDefaultFormProcessing(false); if (upload.getUploadReport() == null) ajaxButton.setVisible(false); return ajaxButton; }
/** @param upload */ private void updateModelAndVarifyForDeleteUpload(Upload upload) { confirmModal.setContent( new YesNoPanel( confirmModal.getContentId(), modalText.replace("*", " [" + upload.getId() + "] " + upload.getFilename()), "Delete upload record.", confirmModal, confirmationAnswer)); confirmModal.setWindowClosedCallback( new ModalWindow.WindowClosedCallback() { private static final long serialVersionUID = 1L; public void onClose(AjaxRequestTarget target) { if (confirmationAnswer.isAnswer()) { iArkCommonService.deleteUpload(upload); target.add(me); } else { // if no nothing be done.Just close I guess } } }); addOrReplace(confirmModal); }