public boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFInternetMimeTypeHPKey) {
     CFInternetMimeTypeHPKey rhs = (CFInternetMimeTypeHPKey) obj;
     if (getRequiredMimeTypeId() != rhs.getRequiredMimeTypeId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFInternetMimeTypePKey) {
     CFInternetMimeTypePKey rhs = (CFInternetMimeTypePKey) obj;
     if (getRequiredMimeTypeId() != rhs.getRequiredMimeTypeId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFInternetMimeTypeHBuff) {
     CFInternetMimeTypeHBuff rhs = (CFInternetMimeTypeHBuff) obj;
     if (getRequiredMimeTypeId() != rhs.getRequiredMimeTypeId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFInternetMimeTypeBuff) {
     CFInternetMimeTypeBuff rhs = (CFInternetMimeTypeBuff) obj;
     if (getRequiredMimeTypeId() != rhs.getRequiredMimeTypeId()) {
       return (false);
     }
     return (true);
   } else {
     return (false);
   }
 }
 public int compareTo(Object obj) {
   if (obj == null) {
     return (-1);
   } else if (obj instanceof CFInternetMimeTypeHPKey) {
     CFInternetMimeTypeHPKey rhs = (CFInternetMimeTypeHPKey) obj;
     if (getRequiredMimeTypeId() < rhs.getRequiredMimeTypeId()) {
       return (-1);
     } else if (getRequiredMimeTypeId() > rhs.getRequiredMimeTypeId()) {
       return (1);
     }
     return (0);
   } else if (obj instanceof CFInternetMimeTypePKey) {
     CFInternetMimeTypePKey rhs = (CFInternetMimeTypePKey) obj;
     if (getRequiredMimeTypeId() < rhs.getRequiredMimeTypeId()) {
       return (-1);
     } else if (getRequiredMimeTypeId() > rhs.getRequiredMimeTypeId()) {
       return (1);
     }
     return (0);
   } else if (obj instanceof CFInternetMimeTypeBuff) {
     CFInternetMimeTypeBuff rhs = (CFInternetMimeTypeBuff) obj;
     if (getRequiredMimeTypeId() < rhs.getRequiredMimeTypeId()) {
       return (-1);
     } else if (getRequiredMimeTypeId() > rhs.getRequiredMimeTypeId()) {
       return (1);
     }
     return (0);
   } else if (obj instanceof CFInternetMimeTypeHBuff) {
     CFInternetMimeTypeHBuff rhs = (CFInternetMimeTypeHBuff) obj;
     if (getRequiredMimeTypeId() < rhs.getRequiredMimeTypeId()) {
       return (-1);
     } else if (getRequiredMimeTypeId() > rhs.getRequiredMimeTypeId()) {
       return (1);
     }
     return (0);
   } else {
     throw CFLib.getDefaultExceptionFactory()
         .newUnsupportedClassException(
             getClass(),
             "compareTo",
             "obj",
             obj,
             "CFInternetMimeTypePKey, CFInternetMimeTypeBuff");
   }
 }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    CFInternetXMsgSchemaMessageFormatter schemaFormatter = null;
    try {
      // Common XML Attributes
      String attrId = null;
      String attrRevision = null;
      // MimeType Attributes
      String attrMimeTypeId = null;
      String attrName = null;
      String attrFileTypes = null;
      String attrCreatedAt = null;
      String attrCreatedBy = null;
      String attrUpdatedAt = null;
      String attrUpdatedBy = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RqstMimeTypeUpdate");

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

      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();

      ICFInternetSchemaObj schemaObj = xmsgRqstHandler.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("CreatedAt")) {
          if (attrCreatedAt != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrCreatedAt = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("CreatedBy")) {
          if (attrCreatedBy != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrCreatedBy = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("UpdatedAt")) {
          if (attrUpdatedAt != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrUpdatedAt = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("UpdatedBy")) {
          if (attrUpdatedBy != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrUpdatedBy = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("MimeTypeId")) {
          if (attrMimeTypeId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrMimeTypeId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("Name")) {
          if (attrName != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrName = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("FileTypes")) {
          if (attrFileTypes != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrFileTypes = 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 ((attrMimeTypeId == null) || (attrMimeTypeId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "MimeTypeId");
      }
      if (attrName == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Name");
      }
      if (attrFileTypes == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "FileTypes");
      }
      if ((attrRevision == null) || (attrRevision.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Revision");
      }
      if ((attrCreatedAt == null) || (attrCreatedAt.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "CreatedAt");
      }
      if ((attrCreatedBy == null) || (attrCreatedBy.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "CreatedBy");
      }
      if ((attrUpdatedAt == null) || (attrUpdatedAt.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedAt");
      }
      if ((attrUpdatedBy == null) || (attrUpdatedBy.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedBy");
      }

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

      // Instantiate a PKey buffer for the parsed information
      CFInternetMimeTypePKey pkey =
          ((ICFInternetSchema) schemaObj.getBackingStore()).getFactoryMimeType().newPKey();

      int natMimeTypeId;
      natMimeTypeId = Integer.parseInt(attrMimeTypeId);
      pkey.setRequiredMimeTypeId(natMimeTypeId);
      // Read the instance
      ICFInternetMimeTypeObj origBuff =
          ((ICFInternetMimeTypeObj) schemaObj.getMimeTypeTableObj().readMimeType(pkey));
      if (origBuff == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(
                getClass(), S_ProcName, 0, "getMimeTypeTableObj().readMimeType()");
      } else {
        // Edit the instance
        ICFInternetMimeTypeEditObj editBuff = (ICFInternetMimeTypeEditObj) origBuff.beginEdit();
        CFInternetMimeTypeBuff dataBuff = editBuff.getMimeTypeBuff();
        // Convert string attributes to native Java types
        // and apply the converted attributes to the editBuff.
        String natName = attrName;

        dataBuff.setRequiredName(natName);

        String natFileTypes = attrFileTypes;

        dataBuff.setRequiredFileTypes(natFileTypes);

        int natRevision = Integer.parseInt(attrRevision);
        dataBuff.setRequiredRevision(natRevision);
        UUID createdBy = null;
        if (attrCreatedBy != null) {
          createdBy = UUID.fromString(attrCreatedBy);
        }
        Calendar createdAt = null;
        if (attrCreatedAt != null) {
          createdAt = CFLibXmlUtil.parseTimestamp(attrCreatedAt);
        }
        UUID updatedBy = null;
        if (attrUpdatedBy != null) {
          updatedBy = UUID.fromString(attrUpdatedBy);
        }
        Calendar updatedAt = null;
        if (attrUpdatedAt != null) {
          updatedAt = CFLibXmlUtil.parseTimestamp(attrUpdatedAt);
        }
        if (createdBy != null) {
          dataBuff.setCreatedByUserId(createdBy);
        }
        if (createdAt != null) {
          dataBuff.setCreatedAt(createdAt);
        }
        if (updatedBy != null) {
          dataBuff.setUpdatedByUserId(updatedBy);
        }
        if (updatedAt != null) {
          dataBuff.setUpdatedAt(updatedAt);
        }
        //	Attempt the update
        editBuff.update();
        editBuff.endEdit();
        String response =
            schemaFormatter.formatRspnXmlPreamble()
                + "\n"
                + "\t"
                + CFInternetXMsgMimeTypeMessageFormatter.formatMimeTypeRspnUpdated(
                    "\n\t\t\t", origBuff.getMimeTypeBuff())
                + "\n"
                + schemaFormatter.formatRspnXmlPostamble();
        ((CFInternetXMsgRqstHandler) getParser()).appendResponse(response);
      }
    } catch (RuntimeException e) {
      CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFInternetXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
      CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFInternetXMsgSchemaMessageFormatter.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 {
    CFInternetXMsgSchemaMessageFormatter schemaFormatter = null;
    try {
      // Common XML Attributes
      String attrId = null;
      // Primary Key Attributes for Constant Enum support
      String attrMimeTypeId = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RqstMimeTypeRead");

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

      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();

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

      // Instantiate a PKey buffer for the parsed information
      CFInternetMimeTypePKey pkey =
          ((ICFInternetSchema) schemaObj.getBackingStore()).getFactoryMimeType().newPKey();

      // 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("MimeTypeId")) {
          if (attrMimeTypeId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrMimeTypeId = 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 ((attrMimeTypeId == null) || (attrMimeTypeId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "MimeTypeId");
      }

      // Get current context
      CFLibXmlCoreContext curContext = getParser().getCurContext();
      // Convert string attributes to native Java types
      // and apply the converted attributes to the editBuff.

      int natMimeTypeId;
      natMimeTypeId = Integer.parseInt(attrMimeTypeId);
      pkey.setRequiredMimeTypeId(natMimeTypeId);

      pkey.setRequiredMimeTypeId(natMimeTypeId);
      // Read the object and prepare the XML response
      ICFInternetMimeTypeObj read =
          ((ICFInternetMimeTypeObj) schemaObj.getMimeTypeTableObj().readMimeType(pkey, true));
      if (read != null) {
        String response =
            schemaFormatter.formatRspnXmlPreamble()
                + "\n"
                + "\t"
                + CFInternetXMsgMimeTypeMessageFormatter.formatMimeTypeRspnSingleOpenTag()
                + CFInternetXMsgMimeTypeMessageFormatter.formatMimeTypeRspnDerivedRec(
                    "\n\t\t", read.getMimeTypeBuff())
                + "\n"
                + "\t"
                + CFInternetXMsgMimeTypeMessageFormatter.formatMimeTypeRspnSingleCloseTag()
                + schemaFormatter.formatRspnXmlPostamble();
        xmsgRqstHandler.appendResponse(response);
      } else {
        String response =
            schemaFormatter.formatRspnXmlPreamble()
                + "\n"
                + "\t"
                + CFInternetXMsgSchemaMessageFormatter.formatRspnNoDataFound()
                + "\n"
                + schemaFormatter.formatRspnXmlPostamble();
        xmsgRqstHandler.appendResponse(response);
      }
    } catch (RuntimeException e) {
      CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFInternetXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
      CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFInternetXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    }
  }
 public static String formatMimeTypePKeyAttributes(String separator, CFInternetMimeTypePKey pkey) {
   String retval =
       CFLibXmlUtil.formatRequiredInt32(null, "MimeTypeId", pkey.getRequiredMimeTypeId());
   return (retval);
 }