Source:
<code>public String sendEditApplicationForm(@PathVariable("applicationId") Integer applicationId, @ModelAttribute("application") ApplicationForLeaveForm appForm, Errors errors, Model model, RedirectAttributes redirectAttributes) throws UnknownApplicationForLeaveException { final Optional<Application> maybeApplication = applicationInteractionService.get(applicationId); if (maybeApplication.isEmpty()) { throw new UnknownApplicationForLeaveException(applicationId); } final Application application = maybeApplication.get(); if (application.getStatus().compareTo(WAITING) != 0) { return "application/app_notwaiting"; } appForm.setId(application.getId()); applicationForLeaveFormValidator.validate(appForm, errors); if (errors.hasErrors()) { prepareApplicationForLeaveForm(appForm.getPerson(), appForm, model); if (errors.hasGlobalErrors()) { model.addAttribute("errors", errors); } LOG.info("edit application ({}) has errors: {}", appForm, errors); return "application/app_form"; } final Application editedApplication = merge(application, appForm); final Application savedApplicationForLeave; final Person signedInUser = personService.getSignedInUser(); try { savedApplicationForLeave = applicationInteractionService.edit(editedApplication, signedInUser, Optional.ofNullable(appForm.getComment())); } catch (EditApplicationForLeaveNotAllowedException e) { return "application/app_notwaiting"; } <START> <END> LOG.info("Edited application with success applied {}", savedApplicationForLeave); redirectAttributes.addFlashAttribute("editSuccess", true); return "redirect:/web/application/" + savedApplicationForLeave.getId(); }</code><technical_language>app_notwaiting template name</technical_language>

Target:
public String sendEditApplicationForm(@PathVariable("applicationId") Integer applicationId, @ModelAttribute("application") ApplicationForLeaveForm appForm, Errors errors, Model model, RedirectAttributes redirectAttributes) throws UnknownApplicationForLeaveException { final Optional<Application> maybeApplication = applicationInteractionService.get(applicationId); if (maybeApplication.isEmpty()) { throw new UnknownApplicationForLeaveException(applicationId); } final Application application = maybeApplication.get(); if (application.getStatus().compareTo(WAITING) != 0) { redirectAttributes.addFlashAttribute("editError", true); return REDIRECT_WEB_APPLICATION + applicationId; } appForm.setId(application.getId()); applicationForLeaveFormValidator.validate(appForm, errors); if (errors.hasErrors()) { prepareApplicationForLeaveForm(appForm.getPerson(), appForm, model); if (errors.hasGlobalErrors()) { model.addAttribute("errors", errors); } LOG.info("edit application ({}) has errors: {}", appForm, errors); return APP_FORM; } final Application editedApplication = merge(application, appForm); final Application savedApplicationForLeave; final Person signedInUser = personService.getSignedInUser(); try { savedApplicationForLeave = applicationInteractionService.edit(editedApplication, signedInUser, Optional.ofNullable(appForm.getComment())); } catch (EditApplicationForLeaveNotAllowedException e) { return "application/app_notwaiting"; } LOG.info("Edited application with success applied {}", savedApplicationForLeave); redirectAttributes.addFlashAttribute("editSuccess", true); return REDIRECT_WEB_APPLICATION + savedApplicationForLeave.getId(); }