public void deleteSecGroupFormByIdIdx(
     CFSecurityAuthorization Authorization, long argClusterId, long argSecGroupFormId) {
   CFSecuritySecGroupFormPKey key = schema.getFactorySecGroupForm().newPKey();
   key.setRequiredClusterId(argClusterId);
   key.setRequiredSecGroupFormId(argSecGroupFormId);
   deleteSecGroupFormByIdIdx(Authorization, key);
 }
  public void deleteSecGroupForm(
      CFSecurityAuthorization Authorization, CFSecuritySecGroupFormBuff Buff) {
    final String S_ProcName = "CFInternetRamSecGroupFormTable.deleteSecGroupForm() ";
    CFSecuritySecGroupFormPKey pkey = schema.getFactorySecGroupForm().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredSecGroupFormId(Buff.getRequiredSecGroupFormId());
    CFSecuritySecGroupFormBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      return;
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "deleteSecGroupForm", pkey);
    }
    CFSecuritySecGroupFormByClusterIdxKey keyClusterIdx =
        schema.getFactorySecGroupForm().newClusterIdxKey();
    keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    CFSecuritySecGroupFormByGroupIdxKey keyGroupIdx =
        schema.getFactorySecGroupForm().newGroupIdxKey();
    keyGroupIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keyGroupIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());

    CFSecuritySecGroupFormByAppIdxKey keyAppIdx = schema.getFactorySecGroupForm().newAppIdxKey();
    keyAppIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keyAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId());

    CFSecuritySecGroupFormByFormIdxKey keyFormIdx = schema.getFactorySecGroupForm().newFormIdxKey();
    keyFormIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keyFormIdx.setRequiredSecFormId(existing.getRequiredSecFormId());

    CFSecuritySecGroupFormByUFormIdxKey keyUFormIdx =
        schema.getFactorySecGroupForm().newUFormIdxKey();
    keyUFormIdx.setRequiredClusterId(existing.getRequiredClusterId());
    keyUFormIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());
    keyUFormIdx.setRequiredSecFormId(existing.getRequiredSecFormId());

    // Validate reverse foreign keys

    // Delete is valid

    Map<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByClusterIdx.get(keyClusterIdx);
    subdict.remove(pkey);

    subdict = dictByGroupIdx.get(keyGroupIdx);
    subdict.remove(pkey);

    subdict = dictByAppIdx.get(keyAppIdx);
    subdict.remove(pkey);

    subdict = dictByFormIdx.get(keyFormIdx);
    subdict.remove(pkey);

    dictByUFormIdx.remove(keyUFormIdx);
  }
 public CFSecuritySecGroupFormBuff lockDerived(
     CFSecurityAuthorization Authorization, CFSecuritySecGroupFormPKey PKey) {
   final String S_ProcName = "CFInternetRamSecGroupForm.readDerived";
   CFSecuritySecGroupFormPKey key = schema.getFactorySecGroupForm().newPKey();
   key.setRequiredClusterId(PKey.getRequiredClusterId());
   key.setRequiredSecGroupFormId(PKey.getRequiredSecGroupFormId());
   CFSecuritySecGroupFormBuff buff;
   if (dictByPKey.containsKey(key)) {
     buff = dictByPKey.get(key);
   } else {
     buff = null;
   }
   return (buff);
 }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    CFDbTestXMsgSchemaMessageFormatter schemaFormatter = null;
    try {
      // Common XML Attributes
      String attrId = null;
      String attrRevision = null;
      // Primary Key Attributes for Constant Enum support
      String attrClusterId = null;
      String attrSecGroupFormId = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RqstSecGroupFormDelete");

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

      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();

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

      // Instantiate a PKey buffer for the parsed information
      CFSecuritySecGroupFormPKey pkey =
          ((ICFDbTestSchema) schemaObj.getBackingStore()).getFactorySecGroupForm().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("Revision")) {
          if (attrRevision != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrRevision = 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("SecGroupFormId")) {
          if (attrSecGroupFormId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrSecGroupFormId = 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 ((attrSecGroupFormId == null) || (attrSecGroupFormId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "SecGroupFormId");
      }
      if ((attrRevision == null) || (attrRevision.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Revision");
      }

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

      long natClusterId;
      natClusterId = Long.parseLong(attrClusterId);
      pkey.setRequiredClusterId(natClusterId);

      pkey.setRequiredClusterId(natClusterId);
      long natSecGroupFormId;
      natSecGroupFormId = Long.parseLong(attrSecGroupFormId);
      pkey.setRequiredSecGroupFormId(natSecGroupFormId);

      pkey.setRequiredSecGroupFormId(natSecGroupFormId);
      int natRevision = Integer.parseInt(attrRevision);
      // Delete the object
      ICFDbTestSecGroupFormObj read =
          ((ICFDbTestSecGroupFormObj) schemaObj.getSecGroupFormTableObj().readSecGroupForm(pkey));
      if (read != null) {
        if (read.getSecGroupFormBuff().getRequiredRevision() > natRevision) {
          throw CFLib.getDefaultExceptionFactory()
              .newCollisionDetectedException(
                  getClass(), S_ProcName, "Collision detected preparing to delete SecGroupForm");
        } else {
          ICFDbTestSecGroupFormEditObj editBuff = (ICFDbTestSecGroupFormEditObj) read.beginEdit();
          if (editBuff != null) {
            editBuff.delete();
            editBuff.endEdit();
            String response =
                schemaFormatter.formatRspnXmlPreamble()
                    + "\n"
                    + "\t"
                    + CFDbTestXMsgSecGroupFormMessageFormatter.formatSecGroupFormRspnDeleted()
                    + "\n"
                    + schemaFormatter.formatRspnXmlPostamble();
            ((CFDbTestXMsgRqstHandler) getParser()).appendResponse(response);
          } else {
            throw CFLib.getDefaultExceptionFactory()
                .newNullArgumentException(getClass(), S_ProcName, 0, "read.beginEdit()");
          }
        }
      } else {
        String response =
            schemaFormatter.formatRspnXmlPreamble()
                + "\n"
                + "\t"
                + CFDbTestXMsgSchemaMessageFormatter.formatRspnNoDataFound()
                + "\n"
                + schemaFormatter.formatRspnXmlPostamble();
        ((CFDbTestXMsgRqstHandler) getParser()).appendResponse(response);
      }
    } catch (RuntimeException e) {
      CFDbTestXMsgRqstHandler xmsgRqstHandler = ((CFDbTestXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFDbTestXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
      CFDbTestXMsgRqstHandler xmsgRqstHandler = ((CFDbTestXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFDbTestXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    }
  }
  public void createSecGroupForm(
      CFSecurityAuthorization Authorization, CFSecuritySecGroupFormBuff Buff) {
    final String S_ProcName = "createSecGroupForm";
    CFSecuritySecGroupFormPKey pkey = schema.getFactorySecGroupForm().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredSecGroupFormId(
        ((CFInternetRamClusterTable) schema.getTableCluster())
            .nextSecGroupFormIdGen(Authorization, Buff.getRequiredClusterId()));
    Buff.setRequiredClusterId(pkey.getRequiredClusterId());
    Buff.setRequiredSecGroupFormId(pkey.getRequiredSecGroupFormId());
    CFSecuritySecGroupFormByClusterIdxKey keyClusterIdx =
        schema.getFactorySecGroupForm().newClusterIdxKey();
    keyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

    CFSecuritySecGroupFormByGroupIdxKey keyGroupIdx =
        schema.getFactorySecGroupForm().newGroupIdxKey();
    keyGroupIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    keyGroupIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());

    CFSecuritySecGroupFormByAppIdxKey keyAppIdx = schema.getFactorySecGroupForm().newAppIdxKey();
    keyAppIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    keyAppIdx.setRequiredSecAppId(Buff.getRequiredSecAppId());

    CFSecuritySecGroupFormByFormIdxKey keyFormIdx = schema.getFactorySecGroupForm().newFormIdxKey();
    keyFormIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    keyFormIdx.setRequiredSecFormId(Buff.getRequiredSecFormId());

    CFSecuritySecGroupFormByUFormIdxKey keyUFormIdx =
        schema.getFactorySecGroupForm().newUFormIdxKey();
    keyUFormIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    keyUFormIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());
    keyUFormIdx.setRequiredSecFormId(Buff.getRequiredSecFormId());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
      throw CFLib.getDefaultExceptionFactory()
          .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey);
    }

    if (dictByUFormIdx.containsKey(keyUFormIdx)) {
      throw CFLib.getDefaultExceptionFactory()
          .newUniqueIndexViolationException(
              getClass(), S_ProcName, "SecGroupFormUFormIdx", keyUFormIdx);
    }

    // Validate foreign keys

    {
      boolean allNull = true;
      allNull = false;
      if (!allNull) {
        if (null
            == schema
                .getTableCluster()
                .readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), S_ProcName, "Owner", "SecGroupFormCluster", "Cluster", null);
        }
      }
    }

    {
      boolean allNull = true;
      allNull = false;
      allNull = false;
      if (!allNull) {
        if (null
            == schema
                .getTableSecGroup()
                .readDerivedByIdIdx(
                    Authorization, Buff.getRequiredClusterId(), Buff.getRequiredSecGroupId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), S_ProcName, "Container", "SecGroupFormGroup", "SecGroup", null);
        }
      }
    }

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    Map<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff> subdictClusterIdx;
    if (dictByClusterIdx.containsKey(keyClusterIdx)) {
      subdictClusterIdx = dictByClusterIdx.get(keyClusterIdx);
    } else {
      subdictClusterIdx = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>();
      dictByClusterIdx.put(keyClusterIdx, subdictClusterIdx);
    }
    subdictClusterIdx.put(pkey, Buff);

    Map<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff> subdictGroupIdx;
    if (dictByGroupIdx.containsKey(keyGroupIdx)) {
      subdictGroupIdx = dictByGroupIdx.get(keyGroupIdx);
    } else {
      subdictGroupIdx = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>();
      dictByGroupIdx.put(keyGroupIdx, subdictGroupIdx);
    }
    subdictGroupIdx.put(pkey, Buff);

    Map<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff> subdictAppIdx;
    if (dictByAppIdx.containsKey(keyAppIdx)) {
      subdictAppIdx = dictByAppIdx.get(keyAppIdx);
    } else {
      subdictAppIdx = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>();
      dictByAppIdx.put(keyAppIdx, subdictAppIdx);
    }
    subdictAppIdx.put(pkey, Buff);

    Map<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff> subdictFormIdx;
    if (dictByFormIdx.containsKey(keyFormIdx)) {
      subdictFormIdx = dictByFormIdx.get(keyFormIdx);
    } else {
      subdictFormIdx = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>();
      dictByFormIdx.put(keyFormIdx, subdictFormIdx);
    }
    subdictFormIdx.put(pkey, Buff);

    dictByUFormIdx.put(keyUFormIdx, Buff);
  }
  public void updateSecGroupForm(
      CFSecurityAuthorization Authorization, CFSecuritySecGroupFormBuff Buff) {
    CFSecuritySecGroupFormPKey pkey = schema.getFactorySecGroupForm().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredSecGroupFormId(Buff.getRequiredSecGroupFormId());
    CFSecuritySecGroupFormBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      throw CFLib.getDefaultExceptionFactory()
          .newStaleCacheDetectedException(
              getClass(), "updateSecGroupForm", "Existing record not found", "SecGroupForm", pkey);
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "updateSecGroupForm", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFSecuritySecGroupFormByClusterIdxKey existingKeyClusterIdx =
        schema.getFactorySecGroupForm().newClusterIdxKey();
    existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    CFSecuritySecGroupFormByClusterIdxKey newKeyClusterIdx =
        schema.getFactorySecGroupForm().newClusterIdxKey();
    newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

    CFSecuritySecGroupFormByGroupIdxKey existingKeyGroupIdx =
        schema.getFactorySecGroupForm().newGroupIdxKey();
    existingKeyGroupIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyGroupIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());

    CFSecuritySecGroupFormByGroupIdxKey newKeyGroupIdx =
        schema.getFactorySecGroupForm().newGroupIdxKey();
    newKeyGroupIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyGroupIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());

    CFSecuritySecGroupFormByAppIdxKey existingKeyAppIdx =
        schema.getFactorySecGroupForm().newAppIdxKey();
    existingKeyAppIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId());

    CFSecuritySecGroupFormByAppIdxKey newKeyAppIdx = schema.getFactorySecGroupForm().newAppIdxKey();
    newKeyAppIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyAppIdx.setRequiredSecAppId(Buff.getRequiredSecAppId());

    CFSecuritySecGroupFormByFormIdxKey existingKeyFormIdx =
        schema.getFactorySecGroupForm().newFormIdxKey();
    existingKeyFormIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyFormIdx.setRequiredSecFormId(existing.getRequiredSecFormId());

    CFSecuritySecGroupFormByFormIdxKey newKeyFormIdx =
        schema.getFactorySecGroupForm().newFormIdxKey();
    newKeyFormIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyFormIdx.setRequiredSecFormId(Buff.getRequiredSecFormId());

    CFSecuritySecGroupFormByUFormIdxKey existingKeyUFormIdx =
        schema.getFactorySecGroupForm().newUFormIdxKey();
    existingKeyUFormIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyUFormIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId());
    existingKeyUFormIdx.setRequiredSecFormId(existing.getRequiredSecFormId());

    CFSecuritySecGroupFormByUFormIdxKey newKeyUFormIdx =
        schema.getFactorySecGroupForm().newUFormIdxKey();
    newKeyUFormIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyUFormIdx.setRequiredSecGroupId(Buff.getRequiredSecGroupId());
    newKeyUFormIdx.setRequiredSecFormId(Buff.getRequiredSecFormId());

    // Check unique indexes

    if (!existingKeyUFormIdx.equals(newKeyUFormIdx)) {
      if (dictByUFormIdx.containsKey(newKeyUFormIdx)) {
        throw CFLib.getDefaultExceptionFactory()
            .newUniqueIndexViolationException(
                getClass(), "updateSecGroupForm", "SecGroupFormUFormIdx", newKeyUFormIdx);
      }
    }

    // Validate foreign keys

    {
      boolean allNull = true;

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

    {
      boolean allNull = true;

      if (allNull) {
        if (null
            == schema
                .getTableSecGroup()
                .readDerivedByIdIdx(
                    Authorization, Buff.getRequiredClusterId(), Buff.getRequiredSecGroupId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(),
                  "updateSecGroupForm",
                  "Container",
                  "SecGroupFormGroup",
                  "SecGroup",
                  null);
        }
      }
    }

    // Update is valid

    Map<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff> 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<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>();
      dictByClusterIdx.put(newKeyClusterIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByGroupIdx.get(existingKeyGroupIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictByGroupIdx.containsKey(newKeyGroupIdx)) {
      subdict = dictByGroupIdx.get(newKeyGroupIdx);
    } else {
      subdict = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>();
      dictByGroupIdx.put(newKeyGroupIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByAppIdx.get(existingKeyAppIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictByAppIdx.containsKey(newKeyAppIdx)) {
      subdict = dictByAppIdx.get(newKeyAppIdx);
    } else {
      subdict = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>();
      dictByAppIdx.put(newKeyAppIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByFormIdx.get(existingKeyFormIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictByFormIdx.containsKey(newKeyFormIdx)) {
      subdict = dictByFormIdx.get(newKeyFormIdx);
    } else {
      subdict = new HashMap<CFSecuritySecGroupFormPKey, CFSecuritySecGroupFormBuff>();
      dictByFormIdx.put(newKeyFormIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByUFormIdx.remove(existingKeyUFormIdx);
    dictByUFormIdx.put(newKeyUFormIdx, Buff);
  }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    CFCrmXMsgSchemaMessageFormatter schemaFormatter = null;
    try {
      // Common XML Attributes
      String attrId = null;
      String attrRevision = null;
      // SecGroupForm Attributes
      String attrClusterId = null;
      String attrSecGroupFormId = null;
      String attrSecGroupId = null;
      String attrSecAppId = null;
      String attrSecFormId = 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("RqstSecGroupFormUpdate");

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

      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();

      ICFCrmSchemaObj 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("ClusterId")) {
          if (attrClusterId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrClusterId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("SecGroupFormId")) {
          if (attrSecGroupFormId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrSecGroupFormId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("SecGroupId")) {
          if (attrSecGroupId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrSecGroupId = 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("SecFormId")) {
          if (attrSecFormId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrSecFormId = 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 ((attrSecGroupFormId == null) || (attrSecGroupFormId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "SecGroupFormId");
      }
      if ((attrSecGroupId == null) || (attrSecGroupId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "SecGroupId");
      }
      if ((attrSecAppId == null) || (attrSecAppId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "SecAppId");
      }
      if ((attrSecFormId == null) || (attrSecFormId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "SecFormId");
      }
      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
      CFSecuritySecGroupFormPKey pkey =
          ((ICFCrmSchema) schemaObj.getBackingStore()).getFactorySecGroupForm().newPKey();

      long natClusterId;
      natClusterId = Long.parseLong(attrClusterId);
      pkey.setRequiredClusterId(natClusterId);
      long natSecGroupFormId;
      natSecGroupFormId = Long.parseLong(attrSecGroupFormId);
      pkey.setRequiredSecGroupFormId(natSecGroupFormId);
      // Read the instance
      ICFCrmSecGroupFormObj origBuff =
          ((ICFCrmSecGroupFormObj) schemaObj.getSecGroupFormTableObj().readSecGroupForm(pkey));
      if (origBuff == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(
                getClass(), S_ProcName, 0, "getSecGroupFormTableObj().readSecGroupForm()");
      } else {
        // Edit the instance
        ICFCrmSecGroupFormEditObj editBuff = (ICFCrmSecGroupFormEditObj) origBuff.beginEdit();
        CFSecuritySecGroupFormBuff dataBuff = editBuff.getSecGroupFormBuff();
        // Convert string attributes to native Java types
        // and apply the converted attributes to the editBuff.
        int natSecGroupId = Integer.parseInt(attrSecGroupId);

        dataBuff.setRequiredSecGroupId(natSecGroupId);

        int natSecAppId = Integer.parseInt(attrSecAppId);

        dataBuff.setRequiredSecAppId(natSecAppId);

        int natSecFormId = Integer.parseInt(attrSecFormId);

        dataBuff.setRequiredSecFormId(natSecFormId);

        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"
                + CFCrmXMsgSecGroupFormMessageFormatter.formatSecGroupFormRspnUpdated(
                    "\n\t\t\t", origBuff.getSecGroupFormBuff())
                + "\n"
                + schemaFormatter.formatRspnXmlPostamble();
        ((CFCrmXMsgRqstHandler) getParser()).appendResponse(response);
      }
    } catch (RuntimeException e) {
      CFCrmXMsgRqstHandler xmsgRqstHandler = ((CFCrmXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFCrmXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
      CFCrmXMsgRqstHandler xmsgRqstHandler = ((CFCrmXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFCrmXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    }
  }