public void addComment(CommentDTO dto) throws Exception { Suggestion s = new Suggestion(); s.setId(dto.getSuggestionId()); Comment comment = new Comment(); comment.setSuggestion(s); comment.setComments(dto.getComments()); comment.setLastModified(dto.getLastModified()); comment.setCommentedBy(dto.getCommentedBy()); dao.addComment(comment); }
private List<CommentDTO> convertEntityToDTO(List<Comment> comment) { List<CommentDTO> dtoList = new ArrayList<CommentDTO>(); for (Comment c : comment) { CommentDTO dto = new CommentDTO(); dto.setId(c.getId()); dto.setComments(c.getComments()); dto.setLastModified(c.getLastModified()); dto.setCommentedBy(c.getCommentedBy()); dtoList.add(dto); } return dtoList; }