1 43 package net.jforum.dao.generic; 44 45 import java.sql.PreparedStatement ; 46 import java.sql.ResultSet ; 47 import java.util.ArrayList ; 48 import java.util.List ; 49 50 import net.jforum.JForumExecutionContext; 51 import net.jforum.util.GroupNode; 52 import net.jforum.util.preferences.SystemGlobals; 53 54 58 public class GenericTreeGroupDAO implements net.jforum.dao.TreeGroupDAO 59 { 60 63 public List selectGroups(int parentId) throws Exception 64 { 65 List list = new ArrayList (); 66 67 PreparedStatement p = JForumExecutionContext.getConnection().prepareStatement(SystemGlobals.getSql("TreeGroup.selectGroup")); 68 p.setInt(1, parentId); 69 70 ResultSet rs = p.executeQuery(); 71 72 while (rs.next()) { 73 GroupNode n = new GroupNode(); 74 n.setName(rs.getString("group_name")); 75 n.setId(rs.getInt("group_id")); 76 77 list.add(n); 78 } 79 80 rs.close(); 81 p.close(); 82 83 return list; 84 } 85 } 86 | Popular Tags |