public static String formatSecGroupPKeyAttributes(String separator, CFSecuritySecGroupBuff buff) {
   String retval =
       CFLibXmlUtil.formatRequiredInt64(separator, "ClusterId", buff.getRequiredClusterId())
           + CFLibXmlUtil.formatRequiredInt32(
               separator, "SecGroupId", buff.getRequiredSecGroupId());
   return (retval);
 }
 public void deleteSecGroup(CFSecurityAuthorization Authorization, CFSecuritySecGroupBuff Buff) {
   final String S_ProcName = "deleteSecGroup";
   Connection cnx = schema.getCnx();
   CallableStatement stmtDeleteByPKey = null;
   try {
     long ClusterId = Buff.getRequiredClusterId();
     int SecGroupId = Buff.getRequiredSecGroupId();
     stmtDeleteByPKey =
         cnx.prepareCall(
             "begin "
                 + schema.getLowerDbSchemaName()
                 + ".dl_secgrp( ?, ?, ?, ?, ?"
                 + ", "
                 + "?"
                 + ", "
                 + "?"
                 + ", "
                 + "?"
                 + " ); 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.setLong(argIdx++, ClusterId);
     stmtDeleteByPKey.setInt(argIdx++, SecGroupId);
     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 static String formatSecGroupRqstDelete(String separator, CFSecuritySecGroupBuff buff) {
   String retval =
       "<RqstSecGroupDelete "
           + formatSecGroupPKeyAttributes(separator, buff)
           + CFLibXmlUtil.formatRequiredInt32(separator, "Revision", buff.getRequiredRevision())
           + " />";
   return (retval);
 }
 public static String formatSecGroupBuffAttributes(String separator, CFSecuritySecGroupBuff buff) {
   String retval =
       CFAsteriskXMsgSecGroupMessageFormatter.formatSecGroupPKeyAttributes(separator, buff)
           + CFLibXmlUtil.formatRequiredInt32(separator, "Revision", buff.getRequiredRevision())
           + CFLibXmlUtil.formatOptionalUuid(separator, "CreatedBy", buff.getCreatedByUserId())
           + CFLibXmlUtil.formatOptionalTimestamp(separator, "CreatedAt", buff.getCreatedAt())
           + CFLibXmlUtil.formatOptionalUuid(separator, "UpdatedBy", buff.getUpdatedByUserId())
           + CFLibXmlUtil.formatOptionalTimestamp(separator, "UpdatedAt", buff.getUpdatedAt())
           + CFLibXmlUtil.formatRequiredXmlString(separator, "Name", buff.getRequiredName())
           + CFLibXmlUtil.formatRequiredBoolean(
               separator, "IsVisible", buff.getRequiredIsVisible());
   return (retval);
 }
 public void updateSecGroup(CFSecurityAuthorization Authorization, CFSecuritySecGroupBuff Buff) {
   final String S_ProcName = "updateSecGroup";
   ResultSet resultSet = null;
   Connection cnx = schema.getCnx();
   CallableStatement stmtUpdateByPKey = null;
   List<CFSecuritySecGroupBuff> buffList = new LinkedList<CFSecuritySecGroupBuff>();
   try {
     long ClusterId = Buff.getRequiredClusterId();
     int SecGroupId = Buff.getRequiredSecGroupId();
     String Name = Buff.getRequiredName();
     int Revision = Buff.getRequiredRevision();
     stmtUpdateByPKey =
         cnx.prepareCall(
             "begin "
                 + schema.getLowerDbSchemaName()
                 + ".upd_secgrp( ?, ?, ?, ?, ?, ?, ?"
                 + ", "
                 + "?"
                 + ", "
                 + "?"
                 + ", "
                 + "?"
                 + ", "
                 + "? ); 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++, "SGRP");
     stmtUpdateByPKey.setLong(argIdx++, ClusterId);
     stmtUpdateByPKey.setInt(argIdx++, SecGroupId);
     stmtUpdateByPKey.setString(argIdx++, Name);
     stmtUpdateByPKey.setInt(argIdx++, Revision);
     stmtUpdateByPKey.execute();
     resultSet = (ResultSet) stmtUpdateByPKey.getObject(1);
     if (resultSet != null) {
       try {
         if (resultSet.next()) {
           CFSecuritySecGroupBuff updatedBuff = 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.setRequiredName(updatedBuff.getRequiredName());
           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_secgrp() 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_secgrp() 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;
     }
   }
 }
  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);
  }