Search in sources :

Example 1 with GroupNode

use of net.jforum.util.GroupNode in project jforum2 by rafaelsteil.

the class GenericTreeGroupDAO method selectGroups.

/**
	 * @see net.jforum.dao.TreeGroupDAO#selectGroups(int)
	 */
public List selectGroups(int parentId) {
    List list = new ArrayList();
    PreparedStatement p = null;
    ResultSet rs = null;
    try {
        p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("TreeGroup.selectGroup"));
        p.setInt(1, parentId);
        rs = p.executeQuery();
        while (rs.next()) {
            GroupNode n = new GroupNode();
            n.setName(rs.getString("group_name"));
            n.setId(rs.getInt("group_id"));
            list.add(n);
        }
        return list;
    } catch (SQLException e) {
        throw new DatabaseException(e);
    } finally {
        DbUtils.close(rs, p);
    }
}
Also used : SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) ResultSet(java.sql.ResultSet) List(java.util.List) ArrayList(java.util.ArrayList) PreparedStatement(java.sql.PreparedStatement) GroupNode(net.jforum.util.GroupNode) DatabaseException(net.jforum.exceptions.DatabaseException)

Aggregations

PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 DatabaseException (net.jforum.exceptions.DatabaseException)1 GroupNode (net.jforum.util.GroupNode)1