public void createSecSession(
      CFSecurityAuthorization Authorization, CFSecuritySecSessionBuff Buff) {
    final String S_ProcName = "createSecSession";
    CFSecuritySecSessionPKey pkey = schema.getFactorySecSession().newPKey();
    pkey.setRequiredSecSessionId(schema.nextSecSessionIdGen());
    Buff.setRequiredSecSessionId(pkey.getRequiredSecSessionId());
    CFSecuritySecSessionBySecUserIdxKey keySecUserIdx =
        schema.getFactorySecSession().newSecUserIdxKey();
    keySecUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId());

    CFSecuritySecSessionBySecDevIdxKey keySecDevIdx =
        schema.getFactorySecSession().newSecDevIdxKey();
    keySecDevIdx.setRequiredSecUserId(Buff.getRequiredSecUserId());
    keySecDevIdx.setOptionalSecDevName(Buff.getOptionalSecDevName());

    CFSecuritySecSessionByStartIdxKey keyStartIdx = schema.getFactorySecSession().newStartIdxKey();
    keyStartIdx.setRequiredSecUserId(Buff.getRequiredSecUserId());
    keyStartIdx.setRequiredStart(Buff.getRequiredStart());

    CFSecuritySecSessionByFinishIdxKey keyFinishIdx =
        schema.getFactorySecSession().newFinishIdxKey();
    keyFinishIdx.setRequiredSecUserId(Buff.getRequiredSecUserId());
    keyFinishIdx.setOptionalFinish(Buff.getOptionalFinish());

    CFSecuritySecSessionBySecProxyIdxKey keySecProxyIdx =
        schema.getFactorySecSession().newSecProxyIdxKey();
    keySecProxyIdx.setOptionalSecProxyId(Buff.getOptionalSecProxyId());

    // Validate unique indexes

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

    if (dictByStartIdx.containsKey(keyStartIdx)) {
      throw CFLib.getDefaultExceptionFactory()
          .newUniqueIndexViolationException(getClass(), S_ProcName, "SessionStartIdx", keyStartIdx);
    }

    // Validate foreign keys

    {
      boolean allNull = true;
      allNull = false;
      if (!allNull) {
        if (null
            == schema
                .getTableSecUser()
                .readDerivedByIdIdx(Authorization, Buff.getRequiredSecUserId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), S_ProcName, "Container", "SecSessionUser", "SecUser", null);
        }
      }
    }

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    Map<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff> subdictSecUserIdx;
    if (dictBySecUserIdx.containsKey(keySecUserIdx)) {
      subdictSecUserIdx = dictBySecUserIdx.get(keySecUserIdx);
    } else {
      subdictSecUserIdx = new HashMap<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff>();
      dictBySecUserIdx.put(keySecUserIdx, subdictSecUserIdx);
    }
    subdictSecUserIdx.put(pkey, Buff);

    Map<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff> subdictSecDevIdx;
    if (dictBySecDevIdx.containsKey(keySecDevIdx)) {
      subdictSecDevIdx = dictBySecDevIdx.get(keySecDevIdx);
    } else {
      subdictSecDevIdx = new HashMap<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff>();
      dictBySecDevIdx.put(keySecDevIdx, subdictSecDevIdx);
    }
    subdictSecDevIdx.put(pkey, Buff);

    dictByStartIdx.put(keyStartIdx, Buff);

    Map<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff> subdictFinishIdx;
    if (dictByFinishIdx.containsKey(keyFinishIdx)) {
      subdictFinishIdx = dictByFinishIdx.get(keyFinishIdx);
    } else {
      subdictFinishIdx = new HashMap<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff>();
      dictByFinishIdx.put(keyFinishIdx, subdictFinishIdx);
    }
    subdictFinishIdx.put(pkey, Buff);

    Map<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff> subdictSecProxyIdx;
    if (dictBySecProxyIdx.containsKey(keySecProxyIdx)) {
      subdictSecProxyIdx = dictBySecProxyIdx.get(keySecProxyIdx);
    } else {
      subdictSecProxyIdx = new HashMap<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff>();
      dictBySecProxyIdx.put(keySecProxyIdx, subdictSecProxyIdx);
    }
    subdictSecProxyIdx.put(pkey, Buff);
  }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    try {
      // Common XML Attributes
      String attrId = null;
      String attrRevision = null;
      // SecSession Attributes
      String attrSecSessionId = null;
      String attrSecUserId = null;
      String attrSecDevName = null;
      String attrStart = null;
      String attrFinish = null;
      String attrSecProxyId = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RspnSecSessionLocked");

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

      ICFFreeSwitchSchemaObj 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("SecSessionId")) {
          if (attrSecSessionId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrSecSessionId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("SecUserId")) {
          if (attrSecUserId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrSecUserId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("SecDevName")) {
          if (attrSecDevName != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrSecDevName = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("Start")) {
          if (attrStart != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrStart = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("Finish")) {
          if (attrFinish != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrFinish = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("SecProxyId")) {
          if (attrSecProxyId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrSecProxyId = 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 ((attrSecSessionId == null) || (attrSecSessionId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "SecSessionId");
      }
      if ((attrSecUserId == null) || (attrSecUserId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "SecUserId");
      }
      if ((attrStart == null) || (attrStart.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Start");
      }
      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

      UUID natSecSessionId = UUID.fromString(attrSecSessionId);

      UUID natSecUserId = UUID.fromString(attrSecUserId);

      String natSecDevName = attrSecDevName;

      Calendar natStart;
      try {
        natStart = CFLibXmlUtil.parseTimestamp(attrStart);
      } catch (RuntimeException e) {
        throw CFLib.getDefaultExceptionFactory()
            .newInvalidArgumentException(getClass(), S_ProcName, 0, "Start", attrStart, e);
      }

      Calendar natFinish;
      if ((attrFinish == null) || (attrFinish.length() <= 0)) {
        natFinish = null;
      } else {
        try {
          natFinish = CFLibXmlUtil.parseTimestamp(attrFinish);
        } catch (RuntimeException e) {
          throw CFLib.getDefaultExceptionFactory()
              .newInvalidArgumentException(getClass(), S_ProcName, 0, "Finish", attrFinish, e);
        }
      }

      UUID natSecProxyId;
      if ((attrSecProxyId == null) || (attrSecProxyId.length() <= 0)) {
        natSecProxyId = null;
      } else {
        natSecProxyId = UUID.fromString(attrSecProxyId);
      }

      int natRevision = Integer.parseInt(attrRevision);
      // Instantiate a buffer for the parsed information
      ICFFreeSwitchSecSessionObj obj =
          (ICFFreeSwitchSecSessionObj) schemaObj.getSecSessionTableObj().newInstance();
      CFSecuritySecSessionBuff dataBuff = obj.getSecSessionBuff();
      dataBuff.setRequiredSecSessionId(natSecSessionId);
      dataBuff.setRequiredSecUserId(natSecUserId);
      dataBuff.setOptionalSecDevName(natSecDevName);
      dataBuff.setRequiredStart(natStart);
      dataBuff.setOptionalFinish(natFinish);
      dataBuff.setOptionalSecProxyId(natSecProxyId);
      dataBuff.setRequiredRevision(natRevision);
      obj.copyBuffToPKey();
      ICFFreeSwitchSecSessionObj realized = (ICFFreeSwitchSecSessionObj) 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);
    }
  }