Пример #1
0
  @Override
  public String modify(Article oldArticle, Article newArticle) {
    if (newArticle != null) {
      oldArticle.setAuthor(newArticle.getAuthor());
      oldArticle.setContent(newArticle.getContent());
      oldArticle.setCreateDate(newArticle.getCreateDate());
      oldArticle.setIsOpen(newArticle.getIsOpen());
      oldArticle.setSource(newArticle.getSource());
      oldArticle.setTitle(newArticle.getTitle());
      oldArticle.setViewCount(0);
    }

    dao.modify(oldArticle);
    return oldArticle.getId();
  }
Пример #2
0
 @Override
 public String addArticle(Article article) {
   article.setViewCount(0);
   article.setCreateDate(new Date());
   return dao.add(article);
 }