public void updateArticle(final String articleId,final JSONObject article) throws ServiceException {
  final Transaction transaction=articleRepository.beginTransaction();
  try {
    final String authorId=article.optString(Article.ARTICLE_AUTHOR_ID);
    final JSONObject author=userRepository.get(authorId);
    article.put(Article.ARTICLE_COMMENTABLE,Boolean.valueOf(article.optBoolean(Article.ARTICLE_COMMENTABLE)));
    final JSONObject oldArticle=articleRepository.get(articleId);
    processTagsForArticleUpdate(oldArticle,article,author);
    String articleTitle=article.optString(Article.ARTICLE_TITLE);
    articleTitle=Emotions.toAliases(articleTitle);
    article.put(Article.ARTICLE_TITLE,articleTitle);
    String articleContent=article.optString(Article.ARTICLE_CONTENT);
    articleContent=Emotions.toAliases(articleContent);
    article.put(Article.ARTICLE_CONTENT,articleContent);
    userRepository.update(author.optString(Keys.OBJECT_ID),author);
    articleRepository.update(articleId,article);
    transaction.commit();
  }
 catch (  final Exception e) {
    if (transaction.isActive()) {
      transaction.rollback();
    }
    LOGGER.log(Level.ERROR,"Updates an article[id=" + articleId + "] failed",e);
    throw new ServiceException(e);
  }
}

public void updateArticle ( final String articleId , final JSONObject article ) throws ServiceException { final Transaction transaction = articleRepository . beginTransaction ( ) ; try { final String authorId = article . optString ( Article . ARTICLE_AUTHOR_ID ) ; final JSONObject author = userRepository . get ( authorId ) ; article . put ( Article . ARTICLE_COMMENTABLE , Boolean . valueOf ( article . optBoolean ( Article . ARTICLE_COMMENTABLE ) ) ) ; final JSONObject oldArticle = articleRepository . get ( articleId ) ; processTagsForArticleUpdate ( oldArticle , article , author ) ; String articleTitle = article . optString ( Article . ARTICLE_TITLE ) ; articleTitle = Emotions . toAliases ( articleTitle ) ; article . put ( Article . ARTICLE_TITLE , articleTitle ) ; String articleContent = article . optString ( Article . ARTICLE_CONTENT ) ; articleContent = Emotions . toAliases ( articleContent ) ; article . put ( Article . ARTICLE_CONTENT , articleContent ) ; userRepository . update ( author . optString ( Keys . OBJECT_ID ) , author ) ; articleRepository . update ( articleId , article ) ; transaction . commit ( ) ; } catch ( final Exception e ) { if ( transaction . isActive ( ) ) { transaction . rollback ( ) ; } LOGGER . log ( Level . ERROR , "Updates an article[id=" + articleId + "] failed" , e ) ; throw new ServiceException ( e ) ; } }
updates the specified article by the given article id .
