- public static Collection<String> getGroupsByClassfication(String classfication) {\r
- List<String> list = new ArrayList<>();\r
- String sql = "select * from GROUPS where classification = ?";\r
- try {\r
- DB db = new DB();\r
- @SuppressWarnings("resource")\r
- Connection conn = db.getConnection();\r
- try(PreparedStatement stmt = conn.prepareStatement(sql)) {\r
- stmt.setString(1, classfication);\r
- try(ResultSet rs = stmt.executeQuery()) {\r
- while (rs.next()) {\r
- int groupid = rs.getInt("groupid");\r
-\r
- }\r
- }\r
- }\r
- db.release(conn);\r
- } catch (SQLException e) {\r
- e.printStackTrace();\r
- }\r
- return list;\r
- }\r
-\r
- /**\r
- * Return a count of the number of active subscriptions in the DB.\r
- *\r
- * @return the count\r
- */\r
- public static int countActiveSubscriptions() {\r
- int count = 0;\r
- try {\r
- DB db = new DB();\r
- @SuppressWarnings("resource")\r
- Connection conn = db.getConnection();\r
- try(Statement stmt = conn.createStatement()) {\r
- try(ResultSet rs = stmt.executeQuery("select count(*) from SUBSCRIPTIONS")) {\r
- if (rs.next()) {\r
- count = rs.getInt(1);\r
- }\r
- }\r
- }\r
- db.release(conn);\r
- } catch (SQLException e) {\r
- intlogger.warn("PROV0008 countActiveSubscriptions: " + e.getMessage());\r
- e.printStackTrace();\r
- }\r
- return count;\r
- }\r
-\r