Example #1
0
 @Override
 public void saveComment(CommentDTO commentDTO) throws Exception {
   CommentModel commentModel = new CommentModel();
   commentModel.setAuthor(commentDTO.getAuthor());
   commentModel.setText(commentDTO.getText());
   commentDAO.saveComment(commentModel);
 }
Example #2
0
 @Override
 public List<CommentDTO> getCommentList() throws Exception {
   List<CommentDTO> commentList = new ArrayList<>();
   List<CommentModel> results = commentDAO.getCommentList();
   for (CommentModel commentModel : results) {
     CommentDTO commentDTO = new CommentDTO();
     commentDTO.setCommentId(commentModel.getCommentId());
     commentDTO.setAuthor(commentModel.getAuthor());
     commentDTO.setText(commentModel.getText());
     commentList.add(commentDTO);
   }
   return commentList;
 }