Example #1
0
 public void addComment(Comment comment) {
   if (!comment.isCommentSet()) {
     List<Comment> commentList = getComments();
     commentList.add(comment);
     comment.commentSet = true;
   }
 }
Example #2
0
  @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);
  }
Example #3
0
  /**
   * 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;
  }
Example #4
0
 /** 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());
 }
Example #5
0
File: Post.java Project: chrde/toys
 public void addComment(Comment comment) {
   comments.add(comment);
   comment.setPost(this);
 }
Example #6
0
 /**
  * @return
  * @see models.AbstractPosting#getComments()
  */
 @Transient
 public List<? extends Comment> getComments() {
   Collections.sort(comments, Comment.comparator());
   return comments;
 }