public boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFSecuritySysClusterHBuff) {
     CFSecuritySysClusterHBuff rhs = (CFSecuritySysClusterHBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredSingletonId() != rhs.getRequiredSingletonId()) {
       return (false);
     }
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecuritySysClusterBuff) {
     CFSecuritySysClusterBuff rhs = (CFSecuritySysClusterBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredSingletonId() != rhs.getRequiredSingletonId()) {
       return (false);
     }
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecuritySysClusterByClusterIdxKey) {
     CFSecuritySysClusterByClusterIdxKey rhs = (CFSecuritySysClusterByClusterIdxKey) obj;
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecuritySysClusterHPKey) {
     CFSecuritySysClusterHPKey rhs = (CFSecuritySysClusterHPKey) 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 (getRequiredSingletonId() != rhs.getRequiredSingletonId()) {
       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 CFSecuritySysClusterPKey) {
     CFSecuritySysClusterPKey rhs = (CFSecuritySysClusterPKey) obj;
     if (getRequiredSingletonId() != rhs.getRequiredSingletonId()) {
       return (false);
     }
     return (true);
   } else {
     return (super.equals(obj));
   }
 }
 public static String formatSysClusterBuffAttributes(
     String separator, CFSecuritySysClusterBuff buff) {
   String retval =
       CFInternetXMsgSysClusterMessageFormatter.formatSysClusterPKeyAttributes(separator, buff)
           + CFLibXmlUtil.formatRequiredInt32(separator, "Revision", buff.getRequiredRevision())
           + CFLibXmlUtil.formatRequiredInt64(separator, "ClusterId", buff.getRequiredClusterId());
   return (retval);
 }
  public void deleteSysCluster(
      CFSecurityAuthorization Authorization, CFSecuritySysClusterBuff Buff) {
    final String S_ProcName = "deleteSysCluster";
    ResultSet resultSet = null;
    try {
      Connection cnx = schema.getCnx();
      int SingletonId = Buff.getRequiredSingletonId();

      final String sql = "CALL sp_delete_sysclus( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )";
      if (stmtDeleteByPKey == null) {
        stmtDeleteByPKey = cnx.prepareStatement(sql);
      }
      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.setInt(argIdx++, SingletonId);
      stmtDeleteByPKey.setInt(argIdx++, Buff.getRequiredRevision());
      ;
      resultSet = stmtDeleteByPKey.executeQuery();
      if (resultSet.next()) {
        int deleteFlag = resultSet.getInt(1);
        if (resultSet.next()) {
          resultSet.last();
          throw CFLib.getDefaultExceptionFactory()
              .newRuntimeException(
                  getClass(),
                  S_ProcName,
                  "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
        }
      } else {
        throw CFLib.getDefaultExceptionFactory()
            .newRuntimeException(
                getClass(),
                S_ProcName,
                "Expected 1 record result set to be returned by delete, not 0 rows");
      }
    } catch (SQLException e) {
      throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
      if (resultSet != null) {
        try {
          resultSet.close();
        } catch (SQLException e) {
        }
        resultSet = null;
      }
    }
  }
  protected CFSecuritySysClusterBuff unpackSysClusterResultSetToBuff(ResultSet resultSet)
      throws SQLException {
    final String S_ProcName = "unpackSysClusterResultSetToBuff";
    int idxcol = 1;
    CFSecuritySysClusterBuff buff = schema.getFactorySysCluster().newBuff();
    buff.setRequiredSingletonId(resultSet.getInt(idxcol));
    idxcol++;
    buff.setRequiredClusterId(resultSet.getLong(idxcol));
    idxcol++;

    buff.setRequiredRevision(resultSet.getInt(idxcol));
    return (buff);
  }
 public void copyPKeyToBuff() {
   if (buff != null) {
     buff.setRequiredSingletonId(getPKey().getRequiredSingletonId());
   }
   if (edit != null) {
     edit.copyPKeyToBuff();
   }
 }
 public static String formatSysClusterRqstDelete(String separator, CFSecuritySysClusterBuff buff) {
   String retval =
       "<RqstSysClusterDelete "
           + formatSysClusterPKeyAttributes(separator, buff)
           + CFLibXmlUtil.formatRequiredInt32(separator, "Revision", buff.getRequiredRevision())
           + " />";
   return (retval);
 }
 public void setSysClusterBuff(CFSecuritySysClusterBuff src) {
   setRequiredSingletonId(src.getRequiredSingletonId());
   setRequiredClusterId(src.getRequiredClusterId());
   setRequiredRevision(src.getRequiredRevision());
 }
 public void copyBuffToPKey() {
   getPKey().setRequiredSingletonId(buff.getRequiredSingletonId());
 }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    CFAsteriskXMsgSchemaMessageFormatter schemaFormatter = null;
    try {
      // Common XML Attributes
      String attrId = null;
      String attrRevision = null;
      // SysCluster Attributes
      String attrSingletonId = null;
      String attrClusterId = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RqstSysClusterCreate");

      CFAsteriskXMsgRqstHandler xmsgRqstHandler = (CFAsteriskXMsgRqstHandler) getParser();
      if (xmsgRqstHandler == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()");
      }

      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();

      ICFAsteriskSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj();
      if (schemaObj == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()");
      }

      // Instantiate an edit buffer for the parsed information
      ICFAsteriskSysClusterEditObj editBuff =
          (ICFAsteriskSysClusterEditObj)
              schemaObj.getSysClusterTableObj().newInstance().beginEdit();
      CFSecuritySysClusterBuff dataBuff = (CFSecuritySysClusterBuff) editBuff.getSysClusterBuff();
      // Extract Attributes
      numAttrs = attrs.getLength();
      for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
        attrLocalName = attrs.getLocalName(idxAttr);
        if (attrLocalName.equals("Id")) {
          if (attrId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("schemaLocation")) {
          // ignored
        } else if (attrLocalName.equals("Revision")) {
          if (attrRevision != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrRevision = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("SingletonId")) {
          if (attrSingletonId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrSingletonId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("ClusterId")) {
          if (attrClusterId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrClusterId = attrs.getValue(idxAttr);
        } else {
          throw CFLib.getDefaultExceptionFactory()
              .newUnrecognizedAttributeException(
                  getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName);
        }
      }

      // Ensure that required attributes have values
      if ((attrSingletonId == null) || (attrSingletonId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "SingletonId");
      }
      if ((attrClusterId == null) || (attrClusterId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "ClusterId");
      }

      // Save named attributes to context
      CFLibXmlCoreContext curContext = getParser().getCurContext();

      // Convert string attributes to native Java types
      // and apply the converted attributes to the editBuff.
      int natSingletonId = Integer.parseInt(attrSingletonId);

      dataBuff.setRequiredSingletonId(natSingletonId);

      long natClusterId = Long.parseLong(attrClusterId);

      dataBuff.setRequiredClusterId(natClusterId);

      //	Attempt the create
      editBuff.copyBuffToPKey(); // Allow for predefined ids
      ICFAsteriskSysClusterObj created = (ICFAsteriskSysClusterObj) editBuff.create();
      editBuff.endEdit();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFAsteriskXMsgSysClusterMessageFormatter.formatSysClusterRspnCreated(
                  "\n\t\t\t", created.getSysClusterBuff())
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      ((CFAsteriskXMsgRqstHandler) getParser()).appendResponse(response);
    } catch (RuntimeException e) {
      CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
      CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    }
  }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    try {
      // Common XML Attributes
      String attrId = null;
      String attrRevision = null;
      // SysCluster Attributes
      String attrSingletonId = null;
      String attrClusterId = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RspnSysClusterLocked");

      CFBamXMsgRspnHandler xmsgRspnHandler = (CFBamXMsgRspnHandler) getParser();
      if (xmsgRspnHandler == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()");
      }

      ICFBamSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj();
      if (schemaObj == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()");
      }

      // Extract Attributes
      numAttrs = attrs.getLength();
      for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
        attrLocalName = attrs.getLocalName(idxAttr);
        if (attrLocalName.equals("Id")) {
          if (attrId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("Revision")) {
          if (attrRevision != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrRevision = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("SingletonId")) {
          if (attrSingletonId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrSingletonId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("ClusterId")) {
          if (attrClusterId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrClusterId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("schemaLocation")) {
          // ignored
        } else {
          throw CFLib.getDefaultExceptionFactory()
              .newUnrecognizedAttributeException(
                  getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName);
        }
      }

      // Ensure that required attributes have values
      if ((attrSingletonId == null) || (attrSingletonId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "SingletonId");
      }
      if ((attrClusterId == null) || (attrClusterId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "ClusterId");
      }
      if ((attrRevision == null) || (attrRevision.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Revision");
      }

      // Save named attributes to context
      CFLibXmlCoreContext curContext = getParser().getCurContext();

      // Convert string attributes to native Java types

      int natSingletonId = Integer.parseInt(attrSingletonId);

      long natClusterId = Long.parseLong(attrClusterId);

      int natRevision = Integer.parseInt(attrRevision);
      // Instantiate a buffer for the parsed information
      ICFBamSysClusterObj obj =
          (ICFBamSysClusterObj) schemaObj.getSysClusterTableObj().newInstance();
      CFSecuritySysClusterBuff dataBuff = obj.getSysClusterBuff();
      dataBuff.setRequiredSingletonId(natSingletonId);
      dataBuff.setRequiredClusterId(natClusterId);
      dataBuff.setRequiredRevision(natRevision);
      obj.copyBuffToPKey();
      ICFBamSysClusterObj realized = (ICFBamSysClusterObj) obj.realize();
      xmsgRspnHandler.setLastObjectProcessed(realized);
    } catch (RuntimeException e) {
      throw new RuntimeException(
          "Near "
              + getParser().getLocationInfo()
              + ": Caught and rethrew "
              + e.getClass().getName()
              + " - "
              + e.getMessage(),
          e);
    } catch (Error e) {
      throw new Error(
          "Near "
              + getParser().getLocationInfo()
              + ": Caught and rethrew "
              + e.getClass().getName()
              + " - "
              + e.getMessage(),
          e);
    }
  }
 public static String formatSysClusterPKeyAttributes(
     String separator, CFSecuritySysClusterBuff buff) {
   String retval =
       CFLibXmlUtil.formatRequiredInt32(separator, "SingletonId", buff.getRequiredSingletonId());
   return (retval);
 }
 public void createSysCluster(
     CFSecurityAuthorization Authorization, CFSecuritySysClusterBuff Buff) {
   final String S_ProcName = "createSysCluster";
   if (!schema.isTransactionOpen()) {
     throw CFLib.getDefaultExceptionFactory()
         .newUsageException(getClass(), S_ProcName, "Transaction not open");
   }
   ResultSet resultSet = null;
   try {
     int SingletonId = Buff.getRequiredSingletonId();
     long ClusterId = Buff.getRequiredClusterId();
     Connection cnx = schema.getCnx();
     final String sql =
         "CALL sp_create_sysclus( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )";
     if (stmtCreateByPKey == null) {
       stmtCreateByPKey = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     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++, "SYSC");
     stmtCreateByPKey.setInt(argIdx++, SingletonId);
     stmtCreateByPKey.setLong(argIdx++, ClusterId);
     resultSet = stmtCreateByPKey.executeQuery();
     if (resultSet.next()) {
       CFSecuritySysClusterBuff createdBuff = unpackSysClusterResultSetToBuff(resultSet);
       if (resultSet.next()) {
         resultSet.last();
         throw CFLib.getDefaultExceptionFactory()
             .newRuntimeException(
                 getClass(),
                 S_ProcName,
                 "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
       }
       Buff.setRequiredSingletonId(createdBuff.getRequiredSingletonId());
       Buff.setRequiredClusterId(createdBuff.getRequiredClusterId());
       Buff.setRequiredRevision(createdBuff.getRequiredRevision());
     } else {
       throw CFLib.getDefaultExceptionFactory()
           .newRuntimeException(
               getClass(),
               S_ProcName,
               "Expected a single-record response, " + resultSet.getRow() + " rows selected");
     }
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
   }
 }