public CFSecuritySecSessionBuff lockBuff(
     CFSecurityAuthorization Authorization, CFSecuritySecSessionPKey PKey) {
   final String S_ProcName = "lockBuff";
   CFSecuritySecSessionBuff buff = readDerived(Authorization, PKey);
   if ((buff != null) && (!buff.getClassCode().equals("SESS"))) {
     buff = null;
   }
   return (buff);
 }
 public CFSecuritySecSessionBuff readBuffByStartIdx(
     CFSecurityAuthorization Authorization, UUID SecUserId, Calendar Start) {
   final String S_ProcName = "CFSecurityRamSecSession.readBuffByStartIdx() ";
   CFSecuritySecSessionBuff buff = readDerivedByStartIdx(Authorization, SecUserId, Start);
   if ((buff != null) && buff.getClassCode().equals("SESS")) {
     return ((CFSecuritySecSessionBuff) buff);
   } else {
     return (null);
   }
 }
 public CFSecuritySecSessionBuff[] readAllBuff(CFSecurityAuthorization Authorization) {
   final String S_ProcName = "CFSecurityRamSecSession.readAllBuff";
   CFSecuritySecSessionBuff buff;
   ArrayList<CFSecuritySecSessionBuff> filteredList = new ArrayList<CFSecuritySecSessionBuff>();
   CFSecuritySecSessionBuff[] buffList = readAllDerived(Authorization);
   for (int idx = 0; idx < buffList.length; idx++) {
     buff = buffList[idx];
     if ((buff != null) && buff.getClassCode().equals("SESS")) {
       filteredList.add(buff);
     }
   }
   return (filteredList.toArray(new CFSecuritySecSessionBuff[0]));
 }
 public CFSecuritySecSessionBuff[] readBuffByFinishIdx(
     CFSecurityAuthorization Authorization, UUID SecUserId, Calendar Finish) {
   final String S_ProcName = "CFSecurityRamSecSession.readBuffByFinishIdx() ";
   CFSecuritySecSessionBuff buff;
   ArrayList<CFSecuritySecSessionBuff> filteredList = new ArrayList<CFSecuritySecSessionBuff>();
   CFSecuritySecSessionBuff[] buffList = readDerivedByFinishIdx(Authorization, SecUserId, Finish);
   for (int idx = 0; idx < buffList.length; idx++) {
     buff = buffList[idx];
     if ((buff != null) && buff.getClassCode().equals("SESS")) {
       filteredList.add((CFSecuritySecSessionBuff) buff);
     }
   }
   return (filteredList.toArray(new CFSecuritySecSessionBuff[0]));
 }
 public static String formatSecSessionRqstDelete(String separator, CFSecuritySecSessionBuff buff) {
   String retval =
       "<RqstSecSessionDelete "
           + formatSecSessionPKeyAttributes(separator, buff)
           + CFLibXmlUtil.formatRequiredInt32(separator, "Revision", buff.getRequiredRevision())
           + " />";
   return (retval);
 }
 public static String formatSecSessionBuffAttributes(
     String separator, CFSecuritySecSessionBuff buff) {
   String retval =
       CFFreeSwitchXMsgSecSessionMessageFormatter.formatSecSessionPKeyAttributes(separator, buff)
           + CFLibXmlUtil.formatRequiredInt32(separator, "Revision", buff.getRequiredRevision())
           + CFLibXmlUtil.formatRequiredUuid(separator, "SecUserId", buff.getRequiredSecUserId())
           + CFLibXmlUtil.formatOptionalXmlString(
               separator, "SecDevName", buff.getOptionalSecDevName())
           + CFLibXmlUtil.formatRequiredTimestamp(separator, "Start", buff.getRequiredStart())
           + CFLibXmlUtil.formatOptionalTimestamp(separator, "Finish", buff.getOptionalFinish())
           + CFLibXmlUtil.formatOptionalUuid(
               separator, "SecProxyId", buff.getOptionalSecProxyId());
   return (retval);
 }
  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 deleteSecSession(
      CFSecurityAuthorization Authorization, CFSecuritySecSessionBuff Buff) {
    final String S_ProcName = "CFSecurityRamSecSessionTable.deleteSecSession() ";
    CFSecuritySecSessionPKey pkey = schema.getFactorySecSession().newPKey();
    pkey.setRequiredSecSessionId(Buff.getRequiredSecSessionId());
    CFSecuritySecSessionBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      return;
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "deleteSecSession", pkey);
    }
    CFSecuritySecSessionBySecUserIdxKey keySecUserIdx =
        schema.getFactorySecSession().newSecUserIdxKey();
    keySecUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId());

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

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

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

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

    // Validate reverse foreign keys

    // Delete is valid

    Map<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictBySecUserIdx.get(keySecUserIdx);
    subdict.remove(pkey);

    subdict = dictBySecDevIdx.get(keySecDevIdx);
    subdict.remove(pkey);

    dictByStartIdx.remove(keyStartIdx);

    subdict = dictByFinishIdx.get(keyFinishIdx);
    subdict.remove(pkey);

    subdict = dictBySecProxyIdx.get(keySecProxyIdx);
    subdict.remove(pkey);
  }
  public void updateSecSession(
      CFSecurityAuthorization Authorization, CFSecuritySecSessionBuff Buff) {
    CFSecuritySecSessionPKey pkey = schema.getFactorySecSession().newPKey();
    pkey.setRequiredSecSessionId(Buff.getRequiredSecSessionId());
    CFSecuritySecSessionBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      throw CFLib.getDefaultExceptionFactory()
          .newStaleCacheDetectedException(
              getClass(), "updateSecSession", "Existing record not found", "SecSession", pkey);
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "updateSecSession", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFSecuritySecSessionBySecUserIdxKey existingKeySecUserIdx =
        schema.getFactorySecSession().newSecUserIdxKey();
    existingKeySecUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId());

    CFSecuritySecSessionBySecUserIdxKey newKeySecUserIdx =
        schema.getFactorySecSession().newSecUserIdxKey();
    newKeySecUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId());

    CFSecuritySecSessionBySecDevIdxKey existingKeySecDevIdx =
        schema.getFactorySecSession().newSecDevIdxKey();
    existingKeySecDevIdx.setRequiredSecUserId(existing.getRequiredSecUserId());
    existingKeySecDevIdx.setOptionalSecDevName(existing.getOptionalSecDevName());

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

    CFSecuritySecSessionByStartIdxKey existingKeyStartIdx =
        schema.getFactorySecSession().newStartIdxKey();
    existingKeyStartIdx.setRequiredSecUserId(existing.getRequiredSecUserId());
    existingKeyStartIdx.setRequiredStart(existing.getRequiredStart());

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

    CFSecuritySecSessionByFinishIdxKey existingKeyFinishIdx =
        schema.getFactorySecSession().newFinishIdxKey();
    existingKeyFinishIdx.setRequiredSecUserId(existing.getRequiredSecUserId());
    existingKeyFinishIdx.setOptionalFinish(existing.getOptionalFinish());

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

    CFSecuritySecSessionBySecProxyIdxKey existingKeySecProxyIdx =
        schema.getFactorySecSession().newSecProxyIdxKey();
    existingKeySecProxyIdx.setOptionalSecProxyId(existing.getOptionalSecProxyId());

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

    // Check unique indexes

    if (!existingKeyStartIdx.equals(newKeyStartIdx)) {
      if (dictByStartIdx.containsKey(newKeyStartIdx)) {
        throw CFLib.getDefaultExceptionFactory()
            .newUniqueIndexViolationException(
                getClass(), "updateSecSession", "SessionStartIdx", newKeyStartIdx);
      }
    }

    // Validate foreign keys

    {
      boolean allNull = true;

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

    // Update is valid

    Map<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff> subdict;

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

    subdict = dictBySecUserIdx.get(existingKeySecUserIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictBySecUserIdx.containsKey(newKeySecUserIdx)) {
      subdict = dictBySecUserIdx.get(newKeySecUserIdx);
    } else {
      subdict = new HashMap<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff>();
      dictBySecUserIdx.put(newKeySecUserIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictBySecDevIdx.get(existingKeySecDevIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictBySecDevIdx.containsKey(newKeySecDevIdx)) {
      subdict = dictBySecDevIdx.get(newKeySecDevIdx);
    } else {
      subdict = new HashMap<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff>();
      dictBySecDevIdx.put(newKeySecDevIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByStartIdx.remove(existingKeyStartIdx);
    dictByStartIdx.put(newKeyStartIdx, Buff);

    subdict = dictByFinishIdx.get(existingKeyFinishIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictByFinishIdx.containsKey(newKeyFinishIdx)) {
      subdict = dictByFinishIdx.get(newKeyFinishIdx);
    } else {
      subdict = new HashMap<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff>();
      dictByFinishIdx.put(newKeyFinishIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictBySecProxyIdx.get(existingKeySecProxyIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictBySecProxyIdx.containsKey(newKeySecProxyIdx)) {
      subdict = dictBySecProxyIdx.get(newKeySecProxyIdx);
    } else {
      subdict = new HashMap<CFSecuritySecSessionPKey, CFSecuritySecSessionBuff>();
      dictBySecProxyIdx.put(newKeySecProxyIdx, subdict);
    }
    subdict.put(pkey, Buff);
  }
  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;
      // 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("RqstSecSessionCreate");

      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 an edit buffer for the parsed information
      ICFInternetSecSessionEditObj editBuff =
          (ICFInternetSecSessionEditObj)
              schemaObj.getSecSessionTableObj().newInstance().beginEdit();
      CFSecuritySecSessionBuff dataBuff = (CFSecuritySecSessionBuff) editBuff.getSecSessionBuff();
      // 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("schemaLocation")) {
          // ignored
        } 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 {
          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");
      }

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

      // Convert string attributes to native Java types
      // and apply the converted attributes to the editBuff.
      UUID natSecUserId = UUID.fromString(attrSecUserId);

      dataBuff.setRequiredSecUserId(natSecUserId);

      String natSecDevName = attrSecDevName;

      dataBuff.setOptionalSecDevName(natSecDevName);

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

      dataBuff.setRequiredStart(natStart);

      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);
        }
      }

      dataBuff.setOptionalFinish(natFinish);

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

      dataBuff.setOptionalSecProxyId(natSecProxyId);

      //	Attempt the create
      editBuff.copyBuffToPKey(); // Allow for predefined ids
      ICFInternetSecSessionObj created = (ICFInternetSecSessionObj) editBuff.create();
      editBuff.endEdit();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFInternetXMsgSecSessionMessageFormatter.formatSecSessionRspnCreated(
                  "\n\t\t\t", created.getSecSessionBuff())
              + "\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 {
    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);
    }
  }
 public static String formatSecSessionPKeyAttributes(
     String separator, CFSecuritySecSessionBuff buff) {
   String retval =
       CFLibXmlUtil.formatRequiredUuid(separator, "SecSessionId", buff.getRequiredSecSessionId());
   return (retval);
 }