@RequestMapping(params = "methodToCall=" + KRADConstants.Maintenance.METHOD_TO_CALL_EDIT) public ModelAndView maintenanceEdit( @ModelAttribute("KualiForm") MaintenanceDocumentForm form, BindingResult result, HttpServletRequest request, HttpServletResponse response) throws Exception { setupMaintenance(form, request, KRADConstants.MAINTENANCE_EDIT_ACTION); OlePersistableBusinessObjectBase olePersistableBusinessObjectBase = (OlePersistableBusinessObjectBase) form.getDocument().getNewMaintainableObject().getDataObject(); olePersistableBusinessObjectBase.setAlertBoList( alertService.retrieveAlertList(form.getDocument().getDocumentNumber())); return getUIFModelAndView(form); }
@Override @RequestMapping(params = "methodToCall=docHandler") public ModelAndView docHandler( @ModelAttribute("KualiForm") DocumentFormBase formBase, BindingResult result, HttpServletRequest request, HttpServletResponse response) throws Exception { // TODO getting double view if we call base, not sure how to handle // so pasting in superclass code // super.docHandler(formBase, request, response); // * begin copy/paste from the base MaintenanceDocumentForm form = (MaintenanceDocumentForm) formBase; // in all of the following cases we want to load the document if (ArrayUtils.contains(DOCUMENT_LOAD_COMMANDS, form.getCommand()) && form.getDocId() != null) { try { loadDocument(form); OlePersistableBusinessObjectBase olePersistableBusinessObjectBase = (OlePersistableBusinessObjectBase) form.getDocument().getNewMaintainableObject().getDataObject(); olePersistableBusinessObjectBase.setAlertBoList( alertService.retrieveAlertList(form.getDocument().getDocumentNumber())); } catch (UnknownDocumentIdException udie) { ConfigurationService kualiConfigurationService = CoreApiServiceLocator.getKualiConfigurationService(); StringBuffer sb = new StringBuffer(); sb.append(kualiConfigurationService.getPropertyValueAsString(KRADConstants.KRAD_URL_KEY)); sb.append( kualiConfigurationService.getPropertyValueAsString( KRADConstants.KRAD_INITIATED_DOCUMENT_URL_KEY)); Properties props = new Properties(); props.put(UifParameters.METHOD_TO_CALL, UifConstants.MethodToCallNames.START); GlobalVariables.getUifFormManager().removeSessionForm(form); // removeForm(form); return performRedirect(new InitiatedDocumentInfoForm(), sb.toString(), props); } } else if (KewApiConstants.INITIATE_COMMAND.equals(form.getCommand())) { createDocument(form); } else { LOG.error("docHandler called with invalid parameters"); throw new IllegalArgumentException("docHandler called with invalid parameters"); } // * end copy/paste from the base if (KewApiConstants.ACTIONLIST_COMMAND.equals(form.getCommand()) || KewApiConstants.DOCSEARCH_COMMAND.equals(form.getCommand()) || KewApiConstants.SUPERUSER_COMMAND.equals(form.getCommand()) || KewApiConstants.HELPDESK_ACTIONLIST_COMMAND.equals(form.getCommand()) && form.getDocId() != null) { // TODO: set state in view // form.setReadOnly(true); form.setMaintenanceAction( (form.getDocument()).getNewMaintainableObject().getMaintenanceAction()); // Retrieving the FileName from BO table Maintainable tmpMaintainable = form.getDocument().getNewMaintainableObject(); if (tmpMaintainable.getDataObject() instanceof PersistableAttachment) { PersistableAttachment bo = (PersistableAttachment) getBusinessObjectService() .retrieve((PersistableBusinessObject) tmpMaintainable.getDataObject()); if (bo != null) { request.setAttribute("fileName", bo.getFileName()); } } } else if (KewApiConstants.INITIATE_COMMAND.equals(form.getCommand())) { // form.setReadOnly(false); setupMaintenance(form, request, KRADConstants.MAINTENANCE_NEW_ACTION); } else { LOG.error("We should never have gotten to here"); throw new IllegalArgumentException("docHandler called with invalid parameters"); } return getUIFModelAndView(form); }