/** GET /articles/:id -> get the "id" article. */ @RequestMapping( value = "/articles/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Article> getArticle(@PathVariable Long id) { log.debug("REST request to get Article : {}", id); Article article = articleRepository.findOne(id); if (article != null) { article.resolveTraduction(); if (article.getCategory() != null) article.getCategory().resolveTraduction(); } return Optional.ofNullable(article) .map(result -> new ResponseEntity<>(result, HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND)); }