public void deleteSecGroupByIdIdx(long ClusterId, int SecGroupId) {
   CFSecuritySecGroupPKey pkey =
       ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newPKey();
   pkey.setRequiredClusterId(ClusterId);
   pkey.setRequiredSecGroupId(SecGroupId);
   ICFSecuritySecGroupObj obj = readSecGroup(pkey);
   if (obj != null) {
     ICFSecuritySecGroupEditObj editObj = (ICFSecuritySecGroupEditObj) obj.getEdit();
     boolean editStarted;
     if (editObj == null) {
       editObj = (ICFSecuritySecGroupEditObj) obj.beginEdit();
       if (editObj != null) {
         editStarted = true;
       } else {
         editStarted = false;
       }
     } else {
       editStarted = false;
     }
     if (editObj != null) {
       editObj.delete();
       if (editStarted) {
         editObj.endEdit();
       }
     }
     obj.forget(true);
   }
 }
 public static String formatSecGroupPKeyAttributes(String separator, CFSecuritySecGroupPKey pkey) {
   String retval =
       CFLibXmlUtil.formatRequiredInt64(null, "ClusterId", pkey.getRequiredClusterId())
           + CFLibXmlUtil.formatRequiredInt32(
               separator, "SecGroupId", pkey.getRequiredSecGroupId());
   return (retval);
 }
 public ICFSecuritySecGroupObj readSecGroupByIdIdx(
     long ClusterId, int SecGroupId, boolean forceRead) {
   CFSecuritySecGroupPKey pkey =
       ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newPKey();
   pkey.setRequiredClusterId(ClusterId);
   pkey.setRequiredSecGroupId(SecGroupId);
   ICFSecuritySecGroupObj obj = readSecGroup(pkey, forceRead);
   return (obj);
 }
 public void forgetSecGroupByIdIdx(long ClusterId, int SecGroupId) {
   if (members == null) {
     return;
   }
   CFSecuritySecGroupPKey key =
       ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newPKey();
   key.setRequiredClusterId(ClusterId);
   key.setRequiredSecGroupId(SecGroupId);
   if (members.containsKey(key)) {
     ICFSecuritySecGroupObj probed = members.get(key);
     if (probed != null) {
       probed.forget(true);
     }
   }
 }
 public ICFSecuritySecGroupObj readSecGroup(CFSecuritySecGroupPKey pkey, boolean forceRead) {
   ICFSecuritySecGroupObj obj = null;
   if ((!forceRead) && members.containsKey(pkey)) {
     obj = members.get(pkey);
   } else {
     CFSecuritySecGroupBuff readBuff =
         ((ICFSecuritySchema) schema.getBackingStore())
             .getTableSecGroup()
             .readDerivedByIdIdx(
                 schema.getAuthorization(),
                 pkey.getRequiredClusterId(),
                 pkey.getRequiredSecGroupId());
     if (readBuff != null) {
       obj = schema.getSecGroupTableObj().newInstance();
       obj.setPKey(((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newPKey());
       obj.setBuff(readBuff);
       obj = (ICFSecuritySecGroupObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       members.put(pkey, null);
     }
   }
   return (obj);
 }
 public void deleteSecGroupByIdIdx(
     CFSecurityAuthorization Authorization, CFSecuritySecGroupPKey argKey) {
   deleteSecGroupByIdIdx(
       Authorization, argKey.getRequiredClusterId(), argKey.getRequiredSecGroupId());
 }
  public CFSecuritySecGroupBuff lockBuff(
      CFSecurityAuthorization Authorization, CFSecuritySecGroupPKey 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 {
      long ClusterId = PKey.getRequiredClusterId();
      int SecGroupId = PKey.getRequiredSecGroupId();

      stmtLockBuffByPKey =
          cnx.prepareCall(
              "begin "
                  + schema.getLowerDbSchemaName()
                  + ".lck_secgrp( ?, ?, ?, ?, ?, ?"
                  + ", "
                  + "?"
                  + ", "
                  + "?"
                  + " ); 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.setLong(argIdx++, ClusterId);
      stmtLockBuffByPKey.setInt(argIdx++, SecGroupId);
      stmtLockBuffByPKey.execute();
      resultSet = (ResultSet) stmtLockBuffByPKey.getObject(1);
      if (resultSet == null) {
        return (null);
      }
      try {
        if (resultSet.next()) {
          CFSecuritySecGroupBuff buff = unpackSecGroupResultSetToBuff(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;
      }
    }
  }