private Feed findOrThrowException(Long id) { Feed feed = feedRepository.findOne(id); if (feed == null) { throw new ResourceNotFoundException(); } return feed; }
@RequestMapping(value = "", method = GET) public FeedGetResponse get(@PathVariable("id") Long id) { Feed feed = feedRepository.findOne(id); if (feed != null) { return resourceAssemblers.toResource(feed, FeedGetResponse.class); } else { return new FeedGetResponse(); } }