/** PUT /articles -> Updates an existing article. */
  @RequestMapping(
      value = "/articles",
      method = RequestMethod.PUT,
      produces = MediaType.APPLICATION_JSON_VALUE)
  @Timed
  public ResponseEntity<Article> updateArticle(@RequestBody Article article)
      throws URISyntaxException {
    log.debug("REST request to update Article : {}", article);
    if (article.getId() == null) {
      return createArticle(article);
    }

    Article result = articleRepository.findOne(article.getId());
    result.setI18nTitle(I18n.setTranslationText(result.getI18nTitle(), article.getTitle()));
    result.setI18nText(I18n.setTranslationText(result.getI18nText(), article.getText()));
    result.setTitle(article.getTitle());
    result.setText(article.getText());

    result = articleRepository.save(result);

    return ResponseEntity.ok()
        .headers(HeaderUtil.createEntityUpdateAlert("article", article.getId().toString()))
        .body(result);
  }