public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    try {
      // Common XML Attributes
      String attrId = null;
      String attrRevision = null;
      // SecForm Attributes
      String attrClusterId = null;
      String attrSecFormId = null;
      String attrSecAppId = null;
      String attrJEEServletMapName = 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("RspnSecFormLocked");

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

      ICFSecuritySchemaObj 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("ClusterId")) {
          if (attrClusterId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrClusterId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("SecFormId")) {
          if (attrSecFormId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrSecFormId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("SecAppId")) {
          if (attrSecAppId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrSecAppId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("JEEServletMapName")) {
          if (attrJEEServletMapName != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrJEEServletMapName = 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 ((attrClusterId == null) || (attrClusterId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "ClusterId");
      }
      if ((attrSecFormId == null) || (attrSecFormId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "SecFormId");
      }
      if ((attrSecAppId == null) || (attrSecAppId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "SecAppId");
      }
      if (attrJEEServletMapName == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "JEEServletMapName");
      }
      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

      long natClusterId = Long.parseLong(attrClusterId);

      int natSecFormId = Integer.parseInt(attrSecFormId);

      int natSecAppId = Integer.parseInt(attrSecAppId);

      String natJEEServletMapName = attrJEEServletMapName;

      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);
      }
      // Instantiate a buffer for the parsed information
      ICFSecuritySecFormObj obj =
          (ICFSecuritySecFormObj) schemaObj.getSecFormTableObj().newInstance();
      CFSecuritySecFormBuff dataBuff = obj.getSecFormBuff();
      dataBuff.setRequiredClusterId(natClusterId);
      dataBuff.setRequiredSecFormId(natSecFormId);
      dataBuff.setRequiredSecAppId(natSecAppId);
      dataBuff.setRequiredJEEServletMapName(natJEEServletMapName);
      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);
      }
      obj.copyBuffToPKey();
      ICFSecuritySecFormObj realized = (ICFSecuritySecFormObj) 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 void updateSecForm(CFSecurityAuthorization Authorization, CFSecuritySecFormBuff Buff) {
    CFSecuritySecFormPKey pkey = schema.getFactorySecForm().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredSecFormId(Buff.getRequiredSecFormId());
    CFSecuritySecFormBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      throw CFLib.getDefaultExceptionFactory()
          .newStaleCacheDetectedException(
              getClass(), "updateSecForm", "Existing record not found", "SecForm", pkey);
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "updateSecForm", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFSecuritySecFormByClusterIdxKey existingKeyClusterIdx =
        schema.getFactorySecForm().newClusterIdxKey();
    existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    CFSecuritySecFormByClusterIdxKey newKeyClusterIdx =
        schema.getFactorySecForm().newClusterIdxKey();
    newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

    CFSecuritySecFormBySecAppIdxKey existingKeySecAppIdx =
        schema.getFactorySecForm().newSecAppIdxKey();
    existingKeySecAppIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId());

    CFSecuritySecFormBySecAppIdxKey newKeySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey();
    newKeySecAppIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeySecAppIdx.setRequiredSecAppId(Buff.getRequiredSecAppId());

    CFSecuritySecFormByUJEEServletIdxKey existingKeyUJEEServletIdx =
        schema.getFactorySecForm().newUJEEServletIdxKey();
    existingKeyUJEEServletIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId());
    existingKeyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName());

    CFSecuritySecFormByUJEEServletIdxKey newKeyUJEEServletIdx =
        schema.getFactorySecForm().newUJEEServletIdxKey();
    newKeyUJEEServletIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyUJEEServletIdx.setRequiredSecAppId(Buff.getRequiredSecAppId());
    newKeyUJEEServletIdx.setRequiredJEEServletMapName(Buff.getRequiredJEEServletMapName());

    // Check unique indexes

    if (!existingKeyUJEEServletIdx.equals(newKeyUJEEServletIdx)) {
      if (dictByUJEEServletIdx.containsKey(newKeyUJEEServletIdx)) {
        throw CFLib.getDefaultExceptionFactory()
            .newUniqueIndexViolationException(
                getClass(), "updateSecForm", "SecFormUJEEServletIdx", newKeyUJEEServletIdx);
      }
    }

    // Validate foreign keys

    {
      boolean allNull = true;

      if (allNull) {
        if (null
            == schema
                .getTableCluster()
                .readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), "updateSecForm", "Owner", "SecFormCluster", "Cluster", null);
        }
      }
    }

    {
      boolean allNull = true;

      if (allNull) {
        if (null
            == schema
                .getTableSecApp()
                .readDerivedByIdIdx(
                    Authorization, Buff.getRequiredClusterId(), Buff.getRequiredSecAppId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), "updateSecForm", "Container", "SecFormApplication", "SecApp", null);
        }
      }
    }

    // Update is valid

    Map<CFSecuritySecFormPKey, CFSecuritySecFormBuff> subdict;

    dictByPKey.remove(pkey);
    dictByPKey.put(pkey, Buff);

    subdict = dictByClusterIdx.get(existingKeyClusterIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictByClusterIdx.containsKey(newKeyClusterIdx)) {
      subdict = dictByClusterIdx.get(newKeyClusterIdx);
    } else {
      subdict = new HashMap<CFSecuritySecFormPKey, CFSecuritySecFormBuff>();
      dictByClusterIdx.put(newKeyClusterIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictBySecAppIdx.get(existingKeySecAppIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictBySecAppIdx.containsKey(newKeySecAppIdx)) {
      subdict = dictBySecAppIdx.get(newKeySecAppIdx);
    } else {
      subdict = new HashMap<CFSecuritySecFormPKey, CFSecuritySecFormBuff>();
      dictBySecAppIdx.put(newKeySecAppIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByUJEEServletIdx.remove(existingKeyUJEEServletIdx);
    dictByUJEEServletIdx.put(newKeyUJEEServletIdx, Buff);
  }