Пример #1
0
  protected Post makePost(ResultSet rs) throws SQLException {
    Post post = new Post();
    post.setId(rs.getInt("post_id"));
    post.setTopicId(rs.getInt("topic_id"));
    post.setForumId(rs.getInt("forum_id"));
    post.setUserId(rs.getInt("user_id"));

    Timestamp postTime = rs.getTimestamp("post_time");
    post.setTime(new Date(postTime.getTime()));
    post.setUserIp(rs.getString("poster_ip"));
    post.setBbCodeEnabled(rs.getInt("enable_bbcode") > 0);
    post.setHtmlEnabled(rs.getInt("enable_html") > 0);
    post.setSmiliesEnabled(rs.getInt("enable_smilies") > 0);
    post.setSignatureEnabled(rs.getInt("enable_sig") > 0);
    post.setEditCount(rs.getInt("post_edit_count"));

    Timestamp editTime = rs.getTimestamp("post_edit_time");
    post.setEditTime(editTime != null ? new Date(editTime.getTime()) : null);

    post.setSubject(rs.getString("post_subject"));
    post.setText(this.getPostTextFromResultSet(rs));
    post.setPostUsername(rs.getString("username"));
    post.hasAttachments(rs.getInt("attach") > 0);
    post.setModerate(rs.getInt("need_moderate") == 1);

    SimpleDateFormat df = new SimpleDateFormat(SystemGlobals.getValue(ConfigKeys.DATE_TIME_FORMAT));
    post.setFormatedTime(df.format(postTime));

    post.setKarma(DataAccessDriver.getInstance().newKarmaDAO().getPostKarma(post.getId()));

    return post;
  }
Пример #2
0
  private Post buildPostForRSS(ResultSet rs) throws SQLException {
    Post post = new Post();

    post.setId(rs.getInt("post_id"));
    post.setSubject(rs.getString("subject"));
    post.setText(rs.getString("post_text"));
    post.setTopicId(rs.getInt("topic_id"));
    post.setForumId(rs.getInt("forum_id"));
    post.setUserId(rs.getInt("user_id"));
    post.setPostUsername(rs.getString("username"));
    post.setTime(new Date(rs.getTimestamp("post_time").getTime()));

    return post;
  }