public int getUserCount() throws IOException{ Connection con=null; PreparedStatement ps = null; ResultSet rs = null; int count; try { con = getConnection(); ps = getDMLStatement("users.count",con); rs = ps.executeQuery(); rs.next(); count=rs.getInt(1); } catch (SQLException ex) { throw new IOException(ex); } finally { closeFinally(con, ps, rs); } return count; }
public int getGroupCount() throws IOException{ Connection con=null; PreparedStatement ps = null; ResultSet rs = null; int count; try { con = getConnection(); ps = getDMLStatement("groups.count",con); rs = ps.executeQuery(); rs.next(); count=rs.getInt(1); } catch (SQLException ex) { throw new IOException(ex); } finally { closeFinally(con, ps, rs); } return count; }
/** * @see org.geoserver.security.GeoServerUserGroupService#getUserGroups() */ public SortedSet<GeoServerUserGroup> getUserGroups() throws IOException{ Connection con=null; PreparedStatement ps = null; ResultSet rs = null; Collection<GeoServerUserGroup> tmp = new ArrayList<GeoServerUserGroup>(); try { con = getConnection(); ps = getDMLStatement("groups.all",con); rs = ps.executeQuery(); while (rs.next()) { String groupname = rs.getString(1); String enabledString = rs.getString(2); boolean isEnabled= convertFromString(enabledString); GeoServerUserGroup g = createGroupObject(groupname, isEnabled); tmp.add(g); } } catch (SQLException ex) { throw new IOException(ex); } finally { closeFinally(con, ps, rs); } SortedSet<GeoServerUserGroup> groups = new TreeSet<GeoServerUserGroup>(); groups.addAll(tmp); return Collections.unmodifiableSortedSet(groups); }
throw new IOException(ex); } finally { closeFinally(con, ps, rs);
/** * @see org.geoserver.security.GeoServerUserGroupService#getGroupByGroupname(java.lang.String) */ public GeoServerUserGroup getGroupByGroupname(String groupname) throws IOException { Connection con=null; PreparedStatement ps = null; ResultSet rs = null; GeoServerUserGroup g =null; try { con = getConnection(); ps = getDMLStatement("groups.keyed",con); ps.setString(1, groupname); rs = ps.executeQuery(); if (rs.next()) { String enabledString = rs.getString(1); boolean isEnabled= convertFromString(enabledString); g = createGroupObject(groupname, isEnabled); } } catch (SQLException ex) { throw new IOException(ex); } finally { closeFinally(con, ps, rs); } return g; }
throw new IOException(ex); } finally { closeFinally(con, ps, rs);
throw new IOException(ex); } finally { closeFinally(null, ps2, rs2); closeFinally(con, ps, rs);
throw new IOException(ex); } finally { closeFinally(null, ps2, rs2); closeFinally(con, ps, rs);