public void deleteAuditAction(
     CFSecurityAuthorization Authorization, CFSecurityAuditActionBuff Buff) {
   final String S_ProcName = "deleteAuditAction";
   Connection cnx = schema.getCnx();
   CallableStatement stmtDeleteByPKey = null;
   try {
     ICFSecuritySchema.AuditActionEnum AuditActionId = Buff.getRequiredAuditActionId();
     stmtDeleteByPKey =
         cnx.prepareCall(
             "begin "
                 + schema.getLowerDbSchemaName()
                 + ".dl_auditaction( ?, ?, ?, ?, ?"
                 + ", "
                 + "?"
                 + ", "
                 + "?"
                 + " ); end;");
     int argIdx = 1;
     stmtDeleteByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtDeleteByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtDeleteByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtDeleteByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtDeleteByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtDeleteByPKey.setShort(argIdx++, (short) AuditActionId.ordinal());
     stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision());
     ;
     stmtDeleteByPKey.execute();
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (stmtDeleteByPKey != null) {
       try {
         stmtDeleteByPKey.close();
       } catch (SQLException e) {
       }
       stmtDeleteByPKey = null;
     }
   }
 }
  public long nextTSecGroupMemberIdGen(
      CFSecurityAuthorization Authorization, CFSecurityTenantPKey PKey) {
    final String S_ProcName = "nextTSecGroupMemberIdGen";
    if (!schema.isTransactionOpen()) {
      throw CFLib.getDefaultExceptionFactory()
          .newUsageException(getClass(), S_ProcName, "Not in a transaction");
    }
    Connection cnx = schema.getCnx();
    long Id = PKey.getRequiredId();

    CallableStatement stmtSelectNextTSecGroupMemberIdGen = null;
    try {
      String sql = "{ call sp_next_tsecgroupmemberidgen( ?" + ", " + "?" + " ) }";
      stmtSelectNextTSecGroupMemberIdGen = cnx.prepareCall(sql);
      int argIdx = 1;
      stmtSelectNextTSecGroupMemberIdGen.registerOutParameter(argIdx++, java.sql.Types.BIGINT);
      stmtSelectNextTSecGroupMemberIdGen.setLong(argIdx++, Id);
      stmtSelectNextTSecGroupMemberIdGen.execute();
      long nextId = stmtSelectNextTSecGroupMemberIdGen.getLong(1);
      return (nextId);
    } catch (SQLException e) {
      throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
      if (stmtSelectNextTSecGroupMemberIdGen != null) {
        try {
          stmtSelectNextTSecGroupMemberIdGen.close();
        } catch (SQLException e) {
        }
        stmtSelectNextTSecGroupMemberIdGen = null;
      }
    }
  }
 public void updateAuditAction(
     CFSecurityAuthorization Authorization, CFSecurityAuditActionBuff Buff) {
   final String S_ProcName = "updateAuditAction";
   ResultSet resultSet = null;
   Connection cnx = schema.getCnx();
   CallableStatement stmtUpdateByPKey = null;
   List<CFSecurityAuditActionBuff> buffList = new LinkedList<CFSecurityAuditActionBuff>();
   try {
     ICFSecuritySchema.AuditActionEnum AuditActionId = Buff.getRequiredAuditActionId();
     String Description = Buff.getRequiredDescription();
     int Revision = Buff.getRequiredRevision();
     stmtUpdateByPKey =
         cnx.prepareCall(
             "begin "
                 + schema.getLowerDbSchemaName()
                 + ".upd_auditaction( ?, ?, ?, ?, ?, ?, ?"
                 + ", "
                 + "?"
                 + ", "
                 + "?"
                 + ", "
                 + "? ); end;");
     int argIdx = 1;
     stmtUpdateByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
     stmtUpdateByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtUpdateByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtUpdateByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtUpdateByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtUpdateByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtUpdateByPKey.setString(argIdx++, "AUDT");
     stmtUpdateByPKey.setShort(argIdx++, (short) AuditActionId.ordinal());
     stmtUpdateByPKey.setString(argIdx++, Description);
     stmtUpdateByPKey.setInt(argIdx++, Revision);
     stmtUpdateByPKey.execute();
     resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
     if (resultSet != null) {
       try {
         if (resultSet.next()) {
           CFSecurityAuditActionBuff updatedBuff = unpackAuditActionResultSetToBuff(resultSet);
           if (resultSet.next()) {
             resultSet.last();
             throw CFLib.getDefaultExceptionFactory()
                 .newRuntimeException(
                     getClass(),
                     S_ProcName,
                     "Did not expect multi-record response, "
                         + resultSet.getRow()
                         + " rows selected");
           }
           Buff.setRequiredDescription(updatedBuff.getRequiredDescription());
           Buff.setRequiredRevision(updatedBuff.getRequiredRevision());
         } 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, "upd_auditaction() did not return a valid result cursor");
       } finally {
         if (resultSet != null) {
           try {
             resultSet.close();
           } catch (SQLException e) {
           }
           resultSet = null;
         }
       }
     } else {
       throw CFLib.getDefaultExceptionFactory()
           .newRuntimeException(
               getClass(), S_ProcName, "upd_auditaction() did not return a result cursor");
     }
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
     if (stmtUpdateByPKey != null) {
       try {
         stmtUpdateByPKey.close();
       } catch (SQLException e) {
       }
       stmtUpdateByPKey = null;
     }
   }
 }
 public CFSecurityAuditActionBuff readBuffByUDescrIdx(
     CFSecurityAuthorization Authorization, String Description) {
   final String S_ProcName = "readBuffByUDescrIdx";
   ResultSet resultSet = null;
   Connection cnx = schema.getCnx();
   CallableStatement stmtReadBuffByUDescrIdx = null;
   try {
     stmtReadBuffByUDescrIdx =
         cnx.prepareCall(
             "begin "
                 + schema.getLowerDbSchemaName()
                 + ".rd_auditactionbyudescridx( ?, ?, ?, ?, ?, ?"
                 + ", "
                 + "?"
                 + " ); end;");
     int argIdx = 1;
     stmtReadBuffByUDescrIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
     stmtReadBuffByUDescrIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByUDescrIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtReadBuffByUDescrIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtReadBuffByUDescrIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByUDescrIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtReadBuffByUDescrIdx.setString(argIdx++, Description);
     stmtReadBuffByUDescrIdx.execute();
     resultSet = (ResultSet) stmtReadBuffByUDescrIdx.getObject(1);
     if (resultSet == null) {
       return (null);
     }
     try {
       if (resultSet.next()) {
         CFSecurityAuditActionBuff buff = unpackAuditActionResultSetToBuff(resultSet);
         if (resultSet.next()) {
           resultSet.last();
           throw CFLib.getDefaultExceptionFactory()
               .newRuntimeException(
                   getClass(),
                   S_ProcName,
                   "Did not expect multi-record response, "
                       + resultSet.getRow()
                       + " rows selected");
         }
         return (buff);
       } else {
         return (null);
       }
     } catch (SQLException e) {
       return (null);
     }
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
     if (stmtReadBuffByUDescrIdx != null) {
       try {
         stmtReadBuffByUDescrIdx.close();
       } catch (SQLException e) {
       }
       stmtReadBuffByUDescrIdx = null;
     }
   }
 }
 public CFSecurityAuditActionBuff[] readAllBuff(CFSecurityAuthorization Authorization) {
   final String S_ProcName = "readAllBuff";
   if (!schema.isTransactionOpen()) {
     throw CFLib.getDefaultExceptionFactory()
         .newUsageException(getClass(), S_ProcName, "Transaction not open");
   }
   ResultSet resultSet = null;
   Connection cnx = schema.getCnx();
   CallableStatement stmtReadAllBuff = null;
   try {
     CFSecurityAuditActionBuff buff = null;
     List<CFSecurityAuditActionBuff> buffList = new LinkedList<CFSecurityAuditActionBuff>();
     stmtReadAllBuff =
         cnx.prepareCall(
             "begin "
                 + schema.getLowerDbSchemaName()
                 + ".rd_auditactionall( ?, ?, ?, ?, ?, ? ) ); end;");
     int argIdx = 1;
     stmtReadAllBuff.registerOutParameter(argIdx++, OracleTypes.CURSOR);
     stmtReadAllBuff.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadAllBuff.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtReadAllBuff.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtReadAllBuff.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadAllBuff.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtReadAllBuff.execute();
     resultSet = (ResultSet) stmtReadAllBuff.getObject(1);
     if (resultSet != null) {
       try {
         while (resultSet.next()) {
           buff = unpackAuditActionResultSetToBuff(resultSet);
           buffList.add(buff);
         }
       } catch (SQLException e) {
         // Oracle may return an invalid resultSet if the rowset is empty
       }
     }
     int idx = 0;
     CFSecurityAuditActionBuff[] retBuff = new CFSecurityAuditActionBuff[buffList.size()];
     Iterator<CFSecurityAuditActionBuff> iter = buffList.iterator();
     while (iter.hasNext()) {
       retBuff[idx++] = iter.next();
     }
     return (retBuff);
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
     if (stmtReadAllBuff != null) {
       try {
         stmtReadAllBuff.close();
       } catch (SQLException e) {
       }
       stmtReadAllBuff = null;
     }
   }
 }
  public CFSecurityAuditActionBuff lockBuff(
      CFSecurityAuthorization Authorization, CFSecurityAuditActionPKey PKey) {
    final String S_ProcName = "lockBuff";
    if (!schema.isTransactionOpen()) {
      throw CFLib.getDefaultExceptionFactory()
          .newUsageException(getClass(), S_ProcName, "Transaction not open");
    }
    ResultSet resultSet = null;
    Connection cnx = schema.getCnx();
    CallableStatement stmtLockBuffByPKey = null;
    try {
      ICFSecuritySchema.AuditActionEnum AuditActionId = PKey.getRequiredAuditActionId();

      stmtLockBuffByPKey =
          cnx.prepareCall(
              "begin "
                  + schema.getLowerDbSchemaName()
                  + ".lck_auditaction( ?, ?, ?, ?, ?, ?"
                  + ", "
                  + "?"
                  + " ); end;");
      int argIdx = 1;
      stmtLockBuffByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR);
      stmtLockBuffByPKey.setLong(
          argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
      stmtLockBuffByPKey.setString(
          argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
      stmtLockBuffByPKey.setString(
          argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
      stmtLockBuffByPKey.setLong(
          argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
      stmtLockBuffByPKey.setLong(
          argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
      stmtLockBuffByPKey.setShort(argIdx++, (short) AuditActionId.ordinal());
      stmtLockBuffByPKey.execute();
      resultSet = (ResultSet) stmtLockBuffByPKey.getObject(1);
      if (resultSet == null) {
        return (null);
      }
      try {
        if (resultSet.next()) {
          CFSecurityAuditActionBuff buff = unpackAuditActionResultSetToBuff(resultSet);
          if (resultSet.next()) {
            resultSet.last();
            throw CFLib.getDefaultExceptionFactory()
                .newRuntimeException(
                    getClass(),
                    S_ProcName,
                    "Did not expect multi-record response, "
                        + resultSet.getRow()
                        + " rows selected");
          }
          return (buff);
        } else {
          return (null);
        }
      } catch (SQLException e) {
        return (null);
      }
    } catch (SQLException e) {
      throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
      if (resultSet != null) {
        try {
          resultSet.close();
        } catch (SQLException e) {
        }
        resultSet = null;
      }
      if (stmtLockBuffByPKey != null) {
        try {
          stmtLockBuffByPKey.close();
        } catch (SQLException e) {
        }
        stmtLockBuffByPKey = null;
      }
    }
  }
 public CFSecuritySecGroupBuff[] readBuffByClusterIdx(
     CFSecurityAuthorization Authorization, long ClusterId) {
   final String S_ProcName = "readBuffByClusterIdx";
   ResultSet resultSet = null;
   Connection cnx = schema.getCnx();
   CallableStatement stmtReadBuffByClusterIdx = null;
   List<CFSecuritySecGroupBuff> buffList = new LinkedList<CFSecuritySecGroupBuff>();
   try {
     stmtReadBuffByClusterIdx =
         cnx.prepareCall(
             "begin "
                 + schema.getLowerDbSchemaName()
                 + ".rd_secgrpbyclusteridx( ?, ?, ?, ?, ?, ?"
                 + ", "
                 + "?"
                 + " ); end;");
     int argIdx = 1;
     stmtReadBuffByClusterIdx.registerOutParameter(argIdx++, OracleTypes.CURSOR);
     stmtReadBuffByClusterIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByClusterIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtReadBuffByClusterIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtReadBuffByClusterIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByClusterIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtReadBuffByClusterIdx.setLong(argIdx++, ClusterId);
     stmtReadBuffByClusterIdx.execute();
     resultSet = (ResultSet) stmtReadBuffByClusterIdx.getObject(1);
     if (resultSet != null) {
       try {
         while (resultSet.next()) {
           CFSecuritySecGroupBuff buff = unpackSecGroupResultSetToBuff(resultSet);
           buffList.add(buff);
         }
         try {
           resultSet.close();
         } catch (SQLException e) {
         }
         resultSet = null;
       } catch (SQLException e) {
       }
     }
     int idx = 0;
     CFSecuritySecGroupBuff[] retBuff = new CFSecuritySecGroupBuff[buffList.size()];
     Iterator<CFSecuritySecGroupBuff> iter = buffList.iterator();
     while (iter.hasNext()) {
       retBuff[idx++] = iter.next();
     }
     return (retBuff);
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
     if (stmtReadBuffByClusterIdx != null) {
       try {
         stmtReadBuffByClusterIdx.close();
       } catch (SQLException e) {
       }
       stmtReadBuffByClusterIdx = null;
     }
   }
 }
 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;
     }
   }
 }