Package com.apress.prospring.domain

Examples of com.apress.prospring.domain.Comment


    bm.saveEntry(new Entry(), null);
    performAssert();
  }

  public void testSaveComment() {
    bm.saveComment(new Comment(), new User());
    performAssert();
  }
View Full Code Here


  /**
   * Tests Insert/Delete operation
   *
   */
  public void testInsertDelete() {
    Comment c = new Comment();
    c.setBody("cb");
    c.setEntry(1);
    c.setPostDate(new Date());
    c.setPostedBy(null);
    c.setReplyTo(null);
    c.setSubject("subj");
  }
View Full Code Here

    auditServiceControl.replay();
    bm.saveEntry(entry, null);
  }

  public void testSaveComment() {
    Comment comment = new Comment();
    auditService.writeAuditMessage("Comment " + comment + " saved.", null);
    auditServiceControl.replay();
    bm.saveComment(comment, null);
  }
View Full Code Here

    public void attachToComment(Attachment attachment, int commentId) {
        attachmentDao.insertCommentAttachment(attachment, commentId);
    }

    public Comment getComment(int commentId) {
        Comment comment = commentDao.getById(commentId);
        // comment.setAttachments(attachmentDao.getByComment(commentId));
       
        return comment;
    }
View Full Code Here

  /* (non-Javadoc)
   * @see org.springframework.validation.Validator#validate(java.lang.Object, org.springframework.validation.Errors)
   */
  public void validate(Object obj, Errors errors) {
    Comment comment = (Comment)obj;
    if (comment.getSubject() == null || comment.getSubject().length() == 0) {
      errors.rejectValue("subject", "required", null, "required");
    }
    if (comment.getBody() == null || comment.getBody().length() == 0) {
      errors.rejectValue("body", "required", null, "required");
    }
  }
View Full Code Here

  /* (non-Javadoc)
   * @see com.apress.prospring.data.CommentDao#delete(int)
   */
  public void delete(int commentId) {
    Comment comment = new Comment();
    comment.setCommentId(commentId);
    getHibernateTemplate().delete(comment);
  }
View Full Code Here

    /* (non-Javadoc)
     * @see org.springframework.jdbc.object.MappingSqlQuery#mapRow(java.sql.ResultSet, int)
     */
    protected Object mapRow(ResultSet rs, int rowNum) throws SQLException {
      Comment comment = new Comment();

      comment.setBody(rs.getString("Body"));
      comment.setCommentId(rs.getInt("CommentId"));
      comment.setPostDate(rs.getTimestamp("PostDate"));
      comment.setReplyTo(new Integer(rs.getInt("ReplyTo")));
      if (rs.wasNull()) comment.setReplyTo(null);
      comment.setEntry(rs.getInt("Entry"));
      comment.setSubject(rs.getString("Subject"));

      User user = new User();
      user.setEmail(rs.getString("Email"));
      user.setPassword(rs.getString("Password"));
      user.setType(rs.getInt("Type"));
      user.setUserId(rs.getInt("UserId"));
      user.setUsername(rs.getString("Username"));

      comment.setPostedBy(user);

      return comment;
    }
View Full Code Here

    if (commentId == 0) {
      comment.setPostedBy(User.ROOT);
      comment.setPostDate(new Date());
      comment.setEntry(RequestUtils.getRequiredIntParameter(request, "entry"));
    } else {
      Comment c = getBlogManager().getComment(commentId);
      comment.setBody(c.getBody());
      comment.setCommentId(c.getCommentId());
      comment.setEntry(c.getEntry());
      comment.setPostDate(c.getPostDate());
      comment.setPostedBy(c.getPostedBy());
      comment.setReplyTo(c.getReplyTo());
      comment.setSubject(c.getSubject());
    }

    return comment;
  }
View Full Code Here

TOP

Related Classes of com.apress.prospring.domain.Comment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.