protected CFSecuritySecGroupBuff unpackSecGroupResultSetToBuff(ResultSet resultSet)
      throws SQLException {
    final String S_ProcName = "unpackSecGroupResultSetToBuff";
    int idxcol = 1;
    CFSecuritySecGroupBuff buff = schema.getFactorySecGroup().newBuff();
    {
      String colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedByUserId(null);
      } else {
        buff.setCreatedByUserId(UUID.fromString(colString));
      }
      idxcol++;

      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setCreatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setCreatedAt(null);
      } else {
        buff.setCreatedAt(CFAccOracleSchema.convertTimestampString(colString));
      }
      idxcol++;
      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedByUserId(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedByUserId(null);
      } else {
        buff.setUpdatedByUserId(UUID.fromString(colString));
      }
      idxcol++;

      colString = resultSet.getString(idxcol);
      if (resultSet.wasNull()) {
        buff.setUpdatedAt(null);
      } else if ((colString == null) || (colString.length() <= 0)) {
        buff.setUpdatedAt(null);
      } else {
        buff.setUpdatedAt(CFAccOracleSchema.convertTimestampString(colString));
      }
      idxcol++;
    }
    buff.setRequiredClusterId(resultSet.getLong(idxcol));
    idxcol++;
    buff.setRequiredSecGroupId(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredName(resultSet.getString(idxcol));
    idxcol++;
    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
  }
 public void createSecGroup(CFSecurityAuthorization Authorization, CFSecuritySecGroupBuff Buff) {
   final String S_ProcName = "createSecGroup";
   if (!schema.isTransactionOpen()) {
     throw CFLib.getDefaultExceptionFactory()
         .newUsageException(getClass(), S_ProcName, "Transaction not open");
   }
   ResultSet resultSet = null;
   CallableStatement stmtCreateByPKey = null;
   try {
     long ClusterId = Buff.getRequiredClusterId();
     String Name = Buff.getRequiredName();
     Connection cnx = schema.getCnx();
     stmtCreateByPKey =
         cnx.prepareCall(
             "begin "
                 + schema.getLowerDbSchemaName()
                 + ".crt_secgrp( ?, ?, ?, ?, ?, ?, ?"
                 + ", "
                 + "?"
                 + ", "
                 + "?"
                 + " ); end;");
     int argIdx = 1;
     stmtCreateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
     stmtCreateByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtCreateByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtCreateByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtCreateByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtCreateByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtCreateByPKey.setString(argIdx++, "SGRP");
     stmtCreateByPKey.setLong(argIdx++, ClusterId);
     stmtCreateByPKey.setString(argIdx++, Name);
     stmtCreateByPKey.execute();
     resultSet = (ResultSet) stmtCreateByPKey.getObject(1);
     if (resultSet == null) {
       throw CFLib.getDefaultExceptionFactory()
           .newRuntimeException(
               getClass(), S_ProcName, "crt_secgrp() did not return a result set");
     }
     try {
       if (resultSet.next()) {
         CFSecuritySecGroupBuff createdBuff = unpackSecGroupResultSetToBuff(resultSet);
         if (resultSet.next()) {
           resultSet.last();
           throw CFLib.getDefaultExceptionFactory()
               .newRuntimeException(
                   getClass(),
                   S_ProcName,
                   "Did not expect multi-record response, "
                       + resultSet.getRow()
                       + " rows selected");
         }
         Buff.setRequiredClusterId(createdBuff.getRequiredClusterId());
         Buff.setRequiredSecGroupId(createdBuff.getRequiredSecGroupId());
         Buff.setRequiredName(createdBuff.getRequiredName());
         Buff.setRequiredRevision(createdBuff.getRequiredRevision());
         Buff.setCreatedByUserId(createdBuff.getCreatedByUserId());
         Buff.setCreatedAt(createdBuff.getCreatedAt());
         Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId());
         Buff.setUpdatedAt(createdBuff.getUpdatedAt());
       } else {
         throw CFLib.getDefaultExceptionFactory()
             .newRuntimeException(
                 getClass(),
                 S_ProcName,
                 "Expected a single-record response, " + resultSet.getRow() + " rows selected");
       }
     } catch (SQLException e) {
       throw CFLib.getDefaultExceptionFactory()
           .newRuntimeException(
               getClass(), S_ProcName, "crt_secgrp() did not return a valid result set");
     }
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
     if (stmtCreateByPKey != null) {
       try {
         stmtCreateByPKey.close();
       } catch (SQLException e) {
       }
       stmtCreateByPKey = null;
     }
   }
 }