public CFSecuritySecAppBuff readBuff(
     CFSecurityAuthorization Authorization, CFSecuritySecAppPKey PKey) {
   final String S_ProcName = "readBuff";
   if (!schema.isTransactionOpen()) {
     throw CFLib.getDefaultExceptionFactory()
         .newUsageException(getClass(), S_ProcName, "Transaction not open");
   }
   ResultSet resultSet = null;
   try {
     Connection cnx = schema.getCnx();
     long ClusterId = PKey.getRequiredClusterId();
     int SecAppId = PKey.getRequiredSecAppId();
     String sql = "{ call sp_read_secapp( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ) }";
     if (stmtReadBuffByPKey == null) {
       stmtReadBuffByPKey = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtReadBuffByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtReadBuffByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtReadBuffByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtReadBuffByPKey.setLong(argIdx++, ClusterId);
     stmtReadBuffByPKey.setInt(argIdx++, SecAppId);
     resultSet = stmtReadBuffByPKey.executeQuery();
     if ((resultSet != null) && resultSet.next()) {
       CFSecuritySecAppBuff buff = unpackSecAppResultSetToBuff(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) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
   }
 }
 public ICFSecuritySecAppObj readSecApp(CFSecuritySecAppPKey pkey, boolean forceRead) {
   ICFSecuritySecAppObj obj = null;
   if ((!forceRead) && members.containsKey(pkey)) {
     obj = members.get(pkey);
   } else {
     CFSecuritySecAppBuff readBuff =
         ((ICFCrmSchema) schema.getBackingStore())
             .getTableSecApp()
             .readDerivedByIdIdx(
                 schema.getAuthorization(),
                 pkey.getRequiredClusterId(),
                 pkey.getRequiredSecAppId());
     if (readBuff != null) {
       obj = schema.getSecAppTableObj().newInstance();
       obj.setPKey(((ICFCrmSchema) schema.getBackingStore()).getFactorySecApp().newPKey());
       obj.setBuff(readBuff);
       obj = (ICFSecuritySecAppObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       members.put(pkey, null);
     }
   }
   return (obj);
 }
 public void deleteSecAppByIdIdx(
     CFSecurityAuthorization Authorization, CFSecuritySecAppPKey argKey) {
   deleteSecAppByIdIdx(Authorization, argKey.getRequiredClusterId(), argKey.getRequiredSecAppId());
 }
  public int compareTo(Object obj) {
    if (obj == null) {
      return (-1);
    } else if (obj instanceof CFSecuritySecAppBuff) {
      CFSecuritySecAppBuff rhs = (CFSecuritySecAppBuff) obj;
      int retval = super.compareTo(rhs);
      if (retval != 0) {
        return (retval);
      }
      return (0);
    } else if (obj instanceof CFSecuritySecAppByClusterIdxKey) {
      CFSecuritySecAppByClusterIdxKey rhs = (CFSecuritySecAppByClusterIdxKey) obj;

      if (getRequiredClusterId() < rhs.getRequiredClusterId()) {
        return (-1);
      } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) {
        return (1);
      }
      return (0);
    } else if (obj instanceof CFSecuritySecAppByUJEEMountIdxKey) {
      CFSecuritySecAppByUJEEMountIdxKey rhs = (CFSecuritySecAppByUJEEMountIdxKey) obj;

      if (getRequiredClusterId() < rhs.getRequiredClusterId()) {
        return (-1);
      } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) {
        return (1);
      }
      {
        int cmp = getRequiredJEEMountName().compareTo(rhs.getRequiredJEEMountName());
        if (cmp != 0) {
          return (cmp);
        }
      }
      return (0);
    } else if (obj instanceof CFSecuritySecAppHBuff) {
      CFSecuritySecAppHBuff rhs = (CFSecuritySecAppHBuff) obj;

      int retval = 0;
      {
        long lhsAuditClusterId = getAuditClusterId();
        long rhsAuditClusterId = rhs.getAuditClusterId();
        if (lhsAuditClusterId < rhsAuditClusterId) {
          return (-1);
        } else if (lhsAuditClusterId > rhsAuditClusterId) {
          return (1);
        }
      }
      {
        Calendar lhsAuditStamp = getAuditStamp();
        Calendar rhsAuditStamp = rhs.getAuditStamp();
        if (lhsAuditStamp == null) {
          if (rhsAuditStamp != null) {
            return (-1);
          }
        } else if (rhsAuditStamp == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      {
        short lhsAuditActionId = getAuditActionId();
        short rhsAuditActionId = rhs.getAuditActionId();
        if (lhsAuditActionId < rhsAuditActionId) {
          return (-1);
        } else if (lhsAuditActionId > rhsAuditActionId) {
          return (1);
        }
      }
      {
        int lhsRequiredRevision = getRequiredRevision();
        int rhsRequiredRevision = rhs.getRequiredRevision();
        if (lhsRequiredRevision < rhsRequiredRevision) {
          return (-1);
        } else if (lhsRequiredRevision > rhsRequiredRevision) {
          return (1);
        }
      }
      {
        UUID lhsAuditSessionId = getAuditSessionId();
        UUID rhsAuditSessionId = rhs.getAuditSessionId();
        if (lhsAuditSessionId == null) {
          if (rhsAuditSessionId != null) {
            return (-1);
          }
        } else if (rhsAuditSessionId == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      {
        long lhsAuditClusterId = getAuditClusterId();
        long rhsAuditClusterId = rhs.getAuditClusterId();
        if (lhsAuditClusterId < rhsAuditClusterId) {
          return (-1);
        } else if (lhsAuditClusterId > rhsAuditClusterId) {
          return (1);
        }
      }
      {
        Calendar lhsAuditStamp = getAuditStamp();
        Calendar rhsAuditStamp = rhs.getAuditStamp();
        if (lhsAuditStamp == null) {
          if (rhsAuditStamp != null) {
            return (-1);
          }
        } else if (rhsAuditStamp == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      {
        short lhsAuditActionId = getAuditActionId();
        short rhsAuditActionId = rhs.getAuditActionId();
        if (lhsAuditActionId < rhsAuditActionId) {
          return (-1);
        } else if (lhsAuditActionId > rhsAuditActionId) {
          return (1);
        }
      }
      {
        int lhsRequiredRevision = getRequiredRevision();
        int rhsRequiredRevision = rhs.getRequiredRevision();
        if (lhsRequiredRevision < rhsRequiredRevision) {
          return (-1);
        } else if (lhsRequiredRevision > rhsRequiredRevision) {
          return (1);
        }
      }
      {
        UUID lhsAuditSessionId = getAuditSessionId();
        UUID rhsAuditSessionId = rhs.getAuditSessionId();
        if (lhsAuditSessionId == null) {
          if (rhsAuditSessionId != null) {
            return (-1);
          }
        } else if (rhsAuditSessionId == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      if (getRequiredClusterId() < rhs.getRequiredClusterId()) {
        return (-1);
      } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) {
        return (1);
      }
      if (getRequiredSecAppId() < rhs.getRequiredSecAppId()) {
        return (-1);
      } else if (getRequiredSecAppId() > rhs.getRequiredSecAppId()) {
        return (1);
      }
      {
        int cmp = getRequiredJEEMountName().compareTo(rhs.getRequiredJEEMountName());
        if (cmp != 0) {
          return (cmp);
        }
      }
      return (0);
    } else if (obj instanceof CFSecuritySecAppHPKey) {
      CFSecuritySecAppHPKey rhs = (CFSecuritySecAppHPKey) obj;
      {
        long lhsAuditClusterId = getAuditClusterId();
        long rhsAuditClusterId = rhs.getAuditClusterId();
        if (lhsAuditClusterId < rhsAuditClusterId) {
          return (-1);
        } else if (lhsAuditClusterId > rhsAuditClusterId) {
          return (1);
        }
      }
      {
        Calendar lhsAuditStamp = getAuditStamp();
        Calendar rhsAuditStamp = rhs.getAuditStamp();
        if (lhsAuditStamp == null) {
          if (rhsAuditStamp != null) {
            return (-1);
          }
        } else if (rhsAuditStamp == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      {
        short lhsAuditActionId = getAuditActionId();
        short rhsAuditActionId = rhs.getAuditActionId();
        if (lhsAuditActionId < rhsAuditActionId) {
          return (-1);
        } else if (lhsAuditActionId > rhsAuditActionId) {
          return (1);
        }
      }
      {
        int lhsRequiredRevision = getRequiredRevision();
        int rhsRequiredRevision = rhs.getRequiredRevision();
        if (lhsRequiredRevision < rhsRequiredRevision) {
          return (-1);
        } else if (lhsRequiredRevision > rhsRequiredRevision) {
          return (1);
        }
      }
      {
        UUID lhsAuditSessionId = getAuditSessionId();
        UUID rhsAuditSessionId = rhs.getAuditSessionId();
        if (lhsAuditSessionId == null) {
          if (rhsAuditSessionId != null) {
            return (-1);
          }
        } else if (rhsAuditSessionId == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      if (getRequiredClusterId() < rhs.getRequiredClusterId()) {
        return (-1);
      } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) {
        return (1);
      }
      if (getRequiredSecAppId() < rhs.getRequiredSecAppId()) {
        return (-1);
      } else if (getRequiredSecAppId() > rhs.getRequiredSecAppId()) {
        return (1);
      }
      return (0);
    } else if (obj instanceof CFSecuritySecAppPKey) {
      CFSecuritySecAppPKey rhs = (CFSecuritySecAppPKey) obj;
      if (getRequiredClusterId() < rhs.getRequiredClusterId()) {
        return (-1);
      } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) {
        return (1);
      }
      if (getRequiredSecAppId() < rhs.getRequiredSecAppId()) {
        return (-1);
      } else if (getRequiredSecAppId() > rhs.getRequiredSecAppId()) {
        return (1);
      }
      return (0);
    } else if (obj instanceof CFSecurityHPKey) {
      CFSecurityHPKey rhs = (CFSecurityHPKey) obj;
      {
        int lhsRequiredRevision = getRequiredRevision();
        int rhsRequiredRevision = rhs.getRequiredRevision();
        if (lhsRequiredRevision < rhsRequiredRevision) {
          return (-1);
        } else if (lhsRequiredRevision > rhsRequiredRevision) {
          return (1);
        }
      }
      return (0);
    } else {
      return (super.compareTo(obj));
    }
  }
 public boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFSecuritySecAppHBuff) {
     CFSecuritySecAppHBuff rhs = (CFSecuritySecAppHBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     if (getRequiredSecAppId() != rhs.getRequiredSecAppId()) {
       return (false);
     }
     if (!getRequiredJEEMountName().equals(rhs.getRequiredJEEMountName())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecuritySecAppBuff) {
     CFSecuritySecAppBuff rhs = (CFSecuritySecAppBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     if (getRequiredSecAppId() != rhs.getRequiredSecAppId()) {
       return (false);
     }
     if (!getRequiredJEEMountName().equals(rhs.getRequiredJEEMountName())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecuritySecAppByClusterIdxKey) {
     CFSecuritySecAppByClusterIdxKey rhs = (CFSecuritySecAppByClusterIdxKey) obj;
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecuritySecAppByUJEEMountIdxKey) {
     CFSecuritySecAppByUJEEMountIdxKey rhs = (CFSecuritySecAppByUJEEMountIdxKey) obj;
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     if (!getRequiredJEEMountName().equals(rhs.getRequiredJEEMountName())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecuritySecAppHPKey) {
     CFSecuritySecAppHPKey rhs = (CFSecuritySecAppHPKey) obj;
     {
       long lhsClusterId = getAuditClusterId();
       long rhsClusterId = rhs.getAuditClusterId();
       if (lhsClusterId != rhsClusterId) {
         return (false);
       }
     }
     {
       Calendar lhsAuditStamp = getAuditStamp();
       Calendar rhsAuditStamp = rhs.getAuditStamp();
       if (lhsAuditStamp != null) {
         if (rhsAuditStamp != null) {
           if (!lhsAuditStamp.equals(rhsAuditStamp)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     {
       short lhsActionId = getAuditActionId();
       short rhsActionId = rhs.getAuditActionId();
       if (lhsActionId != rhsActionId) {
         return (false);
       }
     }
     {
       int lhsRevision = getRequiredRevision();
       int rhsRevision = rhs.getRequiredRevision();
       if (lhsRevision != rhsRevision) {
         return (false);
       }
     }
     {
       UUID lhsAuditSessionId = getAuditSessionId();
       UUID rhsAuditSessionId = rhs.getAuditSessionId();
       if (lhsAuditSessionId != null) {
         if (rhsAuditSessionId != null) {
           if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     if (getRequiredSecAppId() != rhs.getRequiredSecAppId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityHPKey) {
     CFSecurityHPKey rhs = (CFSecurityHPKey) obj;
     {
       long lhsClusterId = getAuditClusterId();
       long rhsClusterId = rhs.getAuditClusterId();
       if (lhsClusterId != rhsClusterId) {
         return (false);
       }
     }
     {
       Calendar lhsAuditStamp = getAuditStamp();
       Calendar rhsAuditStamp = rhs.getAuditStamp();
       if (lhsAuditStamp != null) {
         if (rhsAuditStamp != null) {
           if (!lhsAuditStamp.equals(rhsAuditStamp)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     {
       short lhsActionId = getAuditActionId();
       short rhsActionId = rhs.getAuditActionId();
       if (lhsActionId != rhsActionId) {
         return (false);
       }
     }
     {
       int lhsRevision = getRequiredRevision();
       int rhsRevision = rhs.getRequiredRevision();
       if (lhsRevision != rhsRevision) {
         return (false);
       }
     }
     {
       UUID lhsAuditSessionId = getAuditSessionId();
       UUID rhsAuditSessionId = rhs.getAuditSessionId();
       if (lhsAuditSessionId != null) {
         if (rhsAuditSessionId != null) {
           if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFSecuritySecAppPKey) {
     CFSecuritySecAppPKey rhs = (CFSecuritySecAppPKey) obj;
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     if (getRequiredSecAppId() != rhs.getRequiredSecAppId()) {
       return (false);
     }
     return (true);
   } else {
     return (super.equals(obj));
   }
 }
  public CFSecuritySecAppBuff lockBuff(
      CFSecurityAuthorization Authorization, CFSecuritySecAppPKey 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 SecAppId = PKey.getRequiredSecAppId();

      stmtLockBuffByPKey =
          cnx.prepareCall(
              "begin "
                  + schema.getLowerDbSchemaName()
                  + ".lck_secapp( ?, ?, ?, ?, ?, ?"
                  + ", "
                  + "?"
                  + ", "
                  + "?"
                  + " ); 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++, SecAppId);
      stmtLockBuffByPKey.execute();
      resultSet = (ResultSet) stmtLockBuffByPKey.getObject(1);
      if (resultSet == null) {
        return (null);
      }
      try {
        if (resultSet.next()) {
          CFSecuritySecAppBuff buff = unpackSecAppResultSetToBuff(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;
      }
    }
  }