@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(); }
@Override public String addArticle(Article article) { article.setViewCount(0); article.setCreateDate(new Date()); return dao.add(article); }