@Transactional @RequestMapping( value = "/proposalDevelopment", params = {"methodToCall=viewUserAttachedFormPDF"}) public ModelAndView viewUserAttachedFormPDF( ProposalDevelopmentDocumentForm form, HttpServletResponse response, @RequestParam("selectedLine") String selectedLine) throws Exception { DevelopmentProposal developmentProposal = form.getDevelopmentProposal(); List<S2sUserAttachedForm> s2sAttachedForms = developmentProposal.getS2sUserAttachedForms(); S2sUserAttachedForm selectedForm = s2sAttachedForms.get(Integer.parseInt(selectedLine)); S2sUserAttachedFormFileContract userAttachedFormFile = getUserAttachedFormService().findUserAttachedFormFile(selectedForm); if (userAttachedFormFile != null) { ControllerFileUtils.streamToResponse( userAttachedFormFile.getFormFile(), selectedForm.getFormFileName(), CONTENT_TYPE_PDF, response); } else { return getModelAndViewService().getModelAndView(form); } return null; }
@Transactional @RequestMapping( value = "/proposalDevelopment", params = {"methodToCall=deleteUserAttachedForm"}) public ModelAndView deleteUserAttachedForm( ProposalDevelopmentDocumentForm form, HttpServletResponse response, @RequestParam("selectedLine") String selectedLine) throws Exception { S2sUserAttachedForm deleteForm = form.getDevelopmentProposal() .getS2sUserAttachedForms() .remove(Integer.parseInt(selectedLine)); getDataObjectService().delete(deleteForm); getS2sUserAttachedFormService() .resetFormAvailability(form.getProposalDevelopmentDocument(), deleteForm.getNamespace()); return getModelAndViewService().getModelAndView(form); }
@Transactional @RequestMapping( value = "/proposalDevelopment", params = {"methodToCall=addUserAttachedForm"}) public ModelAndView addUserAttachedForm( @ModelAttribute("KualiForm") ProposalDevelopmentDocumentForm form) throws Exception { S2sUserAttachedForm s2sUserAttachedForm = form.getS2sUserAttachedForm(); ProposalDevelopmentDocument proposalDevelopmentDocument = form.getProposalDevelopmentDocument(); MultipartFile userAttachedFormFile = s2sUserAttachedForm.getNewFormFile(); s2sUserAttachedForm.setNewFormFileBytes(userAttachedFormFile.getBytes()); s2sUserAttachedForm.setFormFileName(userAttachedFormFile.getOriginalFilename()); s2sUserAttachedForm.setProposalNumber( proposalDevelopmentDocument.getDevelopmentProposal().getProposalNumber()); try { List<S2sUserAttachedForm> userAttachedForms = getS2sUserAttachedFormService() .extractNSaveUserAttachedForms(proposalDevelopmentDocument, s2sUserAttachedForm); proposalDevelopmentDocument .getDevelopmentProposal() .getS2sUserAttachedForms() .addAll(userAttachedForms); form.setS2sUserAttachedForm(new S2sUserAttachedForm()); } catch (S2SException ex) { LOG.error(ex.getMessage(), ex); if (ex.getTabErrorKey() != null) { if (getGlobalVariableService() .getMessageMap() .getErrorMessagesForProperty(ex.getTabErrorKey()) == null) { getGlobalVariableService() .getMessageMap() .putError(ex.getTabErrorKey(), ex.getErrorKey(), ex.getParams()); } } else { getGlobalVariableService() .getMessageMap() .putError(Constants.NO_FIELD, ex.getErrorKey(), ex.getMessageWithParams()); } } return super.save(form); }