@RequestMapping(value = "/{storyId}/reopen", method = RequestMethod.PUT) @Interceptors({ProjectMemberRequired.class}) @ResponseStatus(HttpStatus.OK) @Caching( evict = { @CacheEvict(value = GET_STORIES_CACHE, key = "#projectId + '*'"), @CacheEvict(value = IterationApiController.ITERATION_CACHE_NAME, key = "#projectId + '*'"), @CacheEvict(value = IterationApiController.ITERATIONS_CACHE_NAME, key = "#projectId + '*'") }) public void reopenStory( @PathVariable("companyId") int companyId, @PathVariable("projectId") int projectId, @PathVariable("storyId") int storyId) { Story story = new Story(); story.setId(storyId); story.setCompleted(false); storyService.updateSelective(story); }
@RequestMapping(value = "/{storyId}/complete", method = RequestMethod.PUT) @Interceptors({ProjectMemberRequired.class}) @ResponseStatus(HttpStatus.OK) @Caching( evict = { @CacheEvict(value = GET_STORIES_CACHE, key = "#projectId + '*'"), @CacheEvict(value = IterationApiController.ITERATION_CACHE_NAME, key = "#projectId + '*'"), @CacheEvict(value = IterationApiController.ITERATIONS_CACHE_NAME, key = "#projectId + '*'") }) public void completeStory( @PathVariable("companyId") int companyId, @PathVariable("projectId") int projectId, @PathVariable("storyId") int storyId) { Story story = storyService.getById(storyId); if (!story.getCompletable()) { throw new NoPermissionException("user cannot complete an uncompletable story!"); } Story newStory = new Story(); newStory.setId(storyId); newStory.setCompleted(true); storyService.updateStoryWithoutChangingParent(newStory); }