public void updateGroup(Connection c, Group g) throws AdminException {
    PreparedStatement statement = null;
    String theQuery =
        "update "
            + drvSettings.getGroupTableName()
            + " set "
            + drvSettings.getGroupNameColumnName()
            + " = ?,"
            + drvSettings.getGroupDescriptionColumnName()
            + " = ?"
            + " where "
            + drvSettings.getGroupSpecificIdColumnName()
            + " = ?";

    try {
      SilverTrace.debug("admin", "SQLGroupTable.updateGroup", "root.MSG_QUERY", theQuery);
      statement = c.prepareStatement(theQuery);
      statement.setString(1, drvSettings.trunc(g.getName(), 100));
      statement.setString(2, drvSettings.trunc(g.getDescription(), 400));
      statement.setInt(3, Integer.parseInt(g.getSpecificId()));
      statement.executeUpdate();
    } catch (Exception e) {
      throw new AdminException(
          "SQLGroupTable.updateGroup",
          SilverpeasException.ERROR,
          "root.EX_SQL_QUERY_FAILED",
          "Query = " + theQuery,
          e);
    } finally {
      DBUtil.close(statement);
    }
  }
  public void deleteGroup(Connection c, int groupId) throws AdminException {
    PreparedStatement statement = null;
    String theQuery =
        "delete from "
            + drvSettings.getGroupTableName()
            + " where "
            + drvSettings.getGroupSpecificIdColumnName()
            + " = ?";

    try {
      SilverTrace.debug("admin", "SQLGroupTable.deleteGroup", "root.MSG_QUERY", theQuery);
      statement = c.prepareStatement(theQuery);
      statement.setInt(1, groupId);
      statement.executeUpdate();
    } catch (Exception e) {
      throw new AdminException(
          "SQLGroupTable.deleteGroup",
          SilverpeasException.ERROR,
          "root.EX_SQL_QUERY_FAILED",
          "Query = " + theQuery,
          e);
    } finally {
      DBUtil.close(statement);
    }
  }
 protected String getColumns() {
   return drvSettings.getGroupSpecificIdColumnName()
       + ", "
       + drvSettings.getGroupParentIdColumnName()
       + ", "
       + drvSettings.getGroupNameColumnName()
       + ", "
       + drvSettings.getGroupDescriptionColumnName();
 }
  /** Inserts in the database a new Group row. */
  public int createGroup(Connection c, Group group) throws AdminException {
    PreparedStatement statement = null;
    int nextId = 0;
    String theQuery =
        "insert into "
            + drvSettings.getGroupTableName()
            + "("
            + getColumns()
            + ") values (?,?,?,?)";

    try {
      SilverTrace.debug("admin", "SQLGroupTable.createGroup", "root.MSG_QUERY", theQuery);
      statement = c.prepareStatement(theQuery);
      nextId =
          DBUtil.getNextId(
              drvSettings.getGroupTableName(), drvSettings.getGroupSpecificIdColumnName());
      statement.setInt(1, nextId);
      String gid = group.getSuperGroupId();
      if ((gid == null) || (gid.length() <= 0) || (gid.equals("-1")))
        statement.setNull(2, Types.INTEGER);
      else statement.setInt(2, Integer.parseInt(gid));
      statement.setString(3, drvSettings.trunc(group.getName(), 100));
      statement.setString(4, drvSettings.trunc(group.getDescription(), 400));
      statement.executeUpdate();
    } catch (Exception e) {
      throw new AdminException(
          "SQLGroupTable.createGroup",
          SilverpeasException.ERROR,
          "root.EX_SQL_QUERY_FAILED",
          "Query = " + theQuery,
          e);
    } finally {
      DBUtil.close(statement);
    }
    return nextId;
  }