protected synchronized RedirectView handleSaveAndContinue(ProjectWrapper pw) throws Exception { Project p = pw.getProject(); Integer pidOld = p.getId(); Integer pid = pidOld; ProjectWrapper pwNew = this.tempProjectManager.get(pidOld); pwNew.setProject(p); if (this.isProjectValid(pwNew)) { pwNew.setErrorMessage(""); if (pidOld < 0) { String projectCode = this.projectDao.getNextProjectCode(p.getHostInstitution()); pw.getProject().setProjectCode(projectCode); pid = this.projectDao.createProjectWrapper(pwNew); pwNew.getProject().setId(pid); this.tempProjectManager.register(pwNew); this.tempProjectManager.unregister(pidOld); } else { this.tempProjectManager.update(pidOld, pwNew); this.projectDao.updateProjectWrapper(pidOld, pwNew); } } else { // save error message this.tempProjectManager.update(pid, pwNew); } return new RedirectView("editproject?id=" + pid); }
protected RedirectView handleUpdate(ProjectWrapper pwCommand) throws Exception { Project p = pwCommand.getProject(); String redirect = pwCommand.getRedirect(); Integer pid = p.getId(); ProjectWrapper pwTemp = this.tempProjectManager.get(pid); pwTemp.setProject(p); pwTemp.setErrorMessage(""); this.tempProjectManager.update(pid, pwTemp); return new RedirectView(redirect); }