public void addComment(Comment comment) { if (!comment.isCommentSet()) { List<Comment> commentList = getComments(); commentList.add(comment); comment.commentSet = true; } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Comment comment = (Comment) o; if (id != null ? !id.equals(comment.id) : comment.id != null) return false; if (comment != null ? !comment.equals(comment.comment) : comment.comment != null) return false; return !(timeAdded != null ? !timeAdded.equals(comment.timeAdded) : comment.timeAdded != null); }
/** * Removes the Comment specified by the commentId. * * @param commentId id of Comment to remove * @return removed Comment or null if one was not found with the id */ public Comment removeComment(final long commentId) { Comment removedComment = null; if (comments != null) { for (int index = comments.size() - 1; index >= 0; --index) { Comment currentComment = comments.get(index); if (currentComment.getId() == commentId) { removedComment = comments.remove(index); break; } } } return removedComment; }
/** Copies the contents of the specified bean into this bean. */ public void copy(Comment that) { setId(that.getId()); setContent(that.getContent()); setReleaseDate(that.getReleaseDate()); setArticleId(that.getArticleId()); setUserId(that.getUserId()); setState(that.getState()); setSysDate(that.getSysDate()); setCheckState(that.getCheckState()); }
public void addComment(Comment comment) { comments.add(comment); comment.setPost(this); }
/** * @return * @see models.AbstractPosting#getComments() */ @Transient public List<? extends Comment> getComments() { Collections.sort(comments, Comment.comparator()); return comments; }