Example #1
0
  /** @see com.mob.forum.dao.LuceneDAO#getPostsToIndex(LuceneReindexArgs, int, int) */
  public List getPostsToIndex(int fromPostId, int toPostId) {
    List l = new ArrayList();

    PreparedStatement p = null;
    ResultSet rs = null;

    try {
      p =
          JForumExecutionContext.getConnection()
              .prepareStatement(SystemGlobals.getSql("SearchModel.getPostsToIndexForLucene"));

      p.setInt(1, fromPostId);
      p.setInt(2, toPostId);

      rs = p.executeQuery();

      while (rs.next()) {
        l.add(this.makePost(rs));
      }
    } catch (SQLException e) {
      throw new DatabaseException(e);
    } finally {
      DbUtils.close(rs, p);
    }

    return l;
  }
Example #2
0
  // Permissions
  public void permissions() {
    int id = this.request.getIntParameter("group_id");

    PermissionControl pc = new PermissionControl();
    pc.setRoles(DataAccessDriver.getInstance().newGroupSecurityDAO().loadRoles(id));

    String xmlconfig = SystemGlobals.getValue(ConfigKeys.CONFIG_DIR) + "/permissions.xml";
    List sections = new XMLPermissionControl(pc).loadConfigurations(xmlconfig);

    GroupDAO gm = DataAccessDriver.getInstance().newGroupDAO();

    this.context.put("sections", sections);
    this.context.put("group", gm.selectById(id));
    this.setTemplateName(TemplateKeys.GROUP_PERMISSIONS);
  }
Example #3
0
  /** @see com.mob.forum.dao.LuceneDAO#getPostsData(int[]) */
  public List getPostsData(int[] postIds, String orderDir) {
    if (postIds.length == 0) {
      return new ArrayList();
    }

    List l = new ArrayList();

    PreparedStatement p = null;
    ResultSet rs = null;

    try {
      String sql = SystemGlobals.getSql("SearchModel.getPostsDataForLucene");
      sql = sql.replaceAll(":posts:", this.buildInClause(postIds));

      if ("ASC".equals(orderDir)) {
        sql = sql + " ORDER BY p.post_id";
      } else {
        sql = sql + " ORDER BY p.post_id DESC";
      }

      p = JForumExecutionContext.getConnection().prepareStatement(sql);
      rs = p.executeQuery();

      while (rs.next()) {
        Post post = this.makePost(rs);
        post.setPostUsername(rs.getString("username"));
        l.add(post);
      }
    } catch (SQLException e) {
      throw new DatabaseException(e);
    } finally {
      DbUtils.close(rs, p);
    }

    return l;
  }
Example #4
0
 /** @see com.mob.forum.dao.LuceneDAO#firstPostIdByDate(java.util.Date) */
 public int firstPostIdByDate(Date date) {
   return this.getPostIdByDate(date, SystemGlobals.getSql("SearchModel.firstPostIdByDate"));
 }