public void copyBuffToOrig() {
   CFDbTestEnumTypeBuff origBuff = getOrigAsEnumType().getEnumTypeBuff();
   CFDbTestEnumTypeBuff myBuff = getEnumTypeBuff();
   origBuff.set(myBuff);
 }
 public void copyOrigToBuff() {
   CFDbTestEnumTypeBuff origBuff = getOrigAsEnumType().getEnumTypeBuff();
   CFDbTestEnumTypeBuff myBuff = getEnumTypeBuff();
   myBuff.set(origBuff);
 }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    try {
      // Common XML Attributes
      String attrId = null;
      String attrRevision = null;
      // Value Attributes
      String attrTenantId = null;
      String attrScopeId = null;
      String attrName = null;
      String attrDefaultVisibility = null;
      String attrPrevTenantId = null;
      String attrPrevId = null;
      String attrNextTenantId = null;
      String attrNextId = null;
      String attrCreatedAt = null;
      String attrCreatedBy = null;
      String attrUpdatedAt = null;
      String attrUpdatedBy = null;
      // Atom Attributes
      // Int16Def Attributes
      // EnumDef Attributes
      // EnumType Attributes
      String attrSchemaDefId = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("EnumType");

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

      ICFDbTestSchemaObj 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("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("TenantId")) {
          if (attrTenantId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrTenantId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("ScopeId")) {
          if (attrScopeId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrScopeId = 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("DefaultVisibility")) {
          if (attrDefaultVisibility != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrDefaultVisibility = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("PrevTenantId")) {
          if (attrPrevTenantId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrPrevTenantId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("PrevId")) {
          if (attrPrevId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrPrevId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("NextTenantId")) {
          if (attrNextTenantId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrNextTenantId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("NextId")) {
          if (attrNextId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrNextId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("SchemaDefId")) {
          if (attrSchemaDefId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrSchemaDefId = 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 ((attrTenantId == null) || (attrTenantId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId");
      }
      if ((attrScopeId == null) || (attrScopeId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "ScopeId");
      }
      if ((attrId == null) || (attrId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Id");
      }
      if (attrName == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Name");
      }
      if ((attrDefaultVisibility == null) || (attrDefaultVisibility.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "DefaultVisibility");
      }
      if ((attrSchemaDefId == null) || (attrSchemaDefId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "SchemaDefId");
      }

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

      // Convert string attributes to native Java types

      long natTenantId = Long.parseLong(attrTenantId);

      long natScopeId = Long.parseLong(attrScopeId);

      long natId = Long.parseLong(attrId);

      String natName = attrName;

      boolean natDefaultVisibility;
      if (attrDefaultVisibility.equals("true")
          || attrDefaultVisibility.equals("yes")
          || attrDefaultVisibility.equals("1")) {
        natDefaultVisibility = true;
      } else if (attrDefaultVisibility.equals("false")
          || attrDefaultVisibility.equals("no")
          || attrDefaultVisibility.equals("0")) {
        natDefaultVisibility = false;
      } else {
        throw CFLib.getDefaultExceptionFactory()
            .newUsageException(
                getClass(),
                S_ProcName,
                "Unexpected DefaultVisibility value, must be one of true, false, yes, no, 1, or 0, not \""
                    + attrDefaultVisibility
                    + "\"");
      }

      Long natPrevTenantId;
      if ((attrPrevTenantId == null) || (attrPrevTenantId.length() <= 0)) {
        natPrevTenantId = null;
      } else {
        natPrevTenantId = new Long(Long.parseLong(attrPrevTenantId));
      }

      Long natPrevId;
      if ((attrPrevId == null) || (attrPrevId.length() <= 0)) {
        natPrevId = null;
      } else {
        natPrevId = new Long(Long.parseLong(attrPrevId));
      }

      Long natNextTenantId;
      if ((attrNextTenantId == null) || (attrNextTenantId.length() <= 0)) {
        natNextTenantId = null;
      } else {
        natNextTenantId = new Long(Long.parseLong(attrNextTenantId));
      }

      Long natNextId;
      if ((attrNextId == null) || (attrNextId.length() <= 0)) {
        natNextId = null;
      } else {
        natNextId = new Long(Long.parseLong(attrNextId));
      }

      int natRevision = Integer.parseInt(attrRevision);
      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);
      }
      long natSchemaDefId = Long.parseLong(attrSchemaDefId);

      // Get the parent context
      CFLibXmlCoreContext parentContext = curContext.getPrevContext();
      // Instantiate a buffer for the parsed information
      ICFDbTestEnumTypeObj obj =
          (ICFDbTestEnumTypeObj) (schemaObj.getEnumTypeTableObj().newInstance());
      CFDbTestEnumTypeBuff dataBuff = obj.getEnumTypeBuff();
      dataBuff.setRequiredTenantId(natTenantId);
      dataBuff.setRequiredScopeId(natScopeId);
      dataBuff.setRequiredId(natId);
      dataBuff.setRequiredName(natName);
      dataBuff.setRequiredDefaultVisibility(natDefaultVisibility);
      dataBuff.setOptionalPrevTenantId(natPrevTenantId);
      dataBuff.setOptionalPrevId(natPrevId);
      dataBuff.setOptionalNextTenantId(natNextTenantId);
      dataBuff.setOptionalNextId(natNextId);
      dataBuff.setRequiredRevision(natRevision);
      if (createdBy != null) {
        dataBuff.setCreatedByUserId(createdBy);
      }
      if (createdAt != null) {
        dataBuff.setCreatedAt(createdAt);
      }
      if (updatedBy != null) {
        dataBuff.setUpdatedByUserId(updatedBy);
      }
      if (updatedAt != null) {
        dataBuff.setUpdatedAt(updatedAt);
      }
      dataBuff.setRequiredSchemaDefId(natSchemaDefId);
      obj.copyBuffToPKey();
      @SuppressWarnings("unchecked")
      List<ICFDbTestValueObj> list = (List<ICFDbTestValueObj>) xmsgRspnHandler.getListOfObjects();
      ICFDbTestEnumTypeObj realized = (ICFDbTestEnumTypeObj) obj.realize();
      xmsgRspnHandler.setLastObjectProcessed(realized);
      if (list != null) {
        list.add(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);
    }
  }