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