@RequestMapping( value = RequestTarget.STORY_UPDATE + "/" + RequestConstants.ID, method = RequestMethod.GET) public String update(@PathVariable String id, ModelMap model) { StoryForm data = new StoryForm(); data.loadFromStory(projectService.loadStoryWithProject(id)); model.addAttribute("story", data); return RequestTarget.STORY_UPDATE; }
@RequestMapping(RequestTarget.STORY_CREATE + "/" + RequestConstants.PROJECT_ID) public String create(@PathVariable String projectId, ModelMap model) { Story story = new Story(); story.setProject(projectService.loadProject(projectId)); StoryForm form = new StoryForm(); form.loadFromStory(story); model.addAttribute(ModelConstants.STORY, form); return RequestTarget.STORY_CREATE; }
@RequestMapping( value = RequestTarget.STORY_CREATE, method = {RequestMethod.POST}) public String create( @ModelAttribute(ModelConstants.STORY) @Valid StoryForm form, BindingResult result) { if (result.hasErrors()) { return RequestTarget.STORY_CREATE; } Story story = form.asStory(); projectService.createStory(story); return "redirect:" + RequestTarget.PROJECT_SHOW + "/" + story.getProject().getId(); }
@RequestMapping(RequestTarget.STORY_START + "/" + RequestConstants.ID) public String start(@PathVariable String id) { Story story = projectService.loadStoryWithProject(id); projectService.startStory(story); return redirect(RequestTarget.PROJECT_SHOW + "/" + story.getProject().getId()); }