public void logout() {
   if ((authorization == null) || (backingStore == null)) {
     return;
   }
   try {
     boolean transactionStarted = beginTransaction();
     if (!transactionStarted) {
       rollback();
       transactionStarted = beginTransaction();
       if (!transactionStarted) {
         setAuthorization(null);
         return;
       }
     }
     UUID secSessionId = authorization.getSecSessionId();
     if (secSessionId != null) {
       ICFSecuritySecSessionObj secSession =
           getSecSessionTableObj().readSecSessionByIdIdx(secSessionId);
       if (secSession != null) {
         if (secSession.getOptionalFinish() == null) {
           ICFSecuritySecSessionEditObj editSecSession = secSession.beginEdit();
           editSecSession.setOptionalFinish(Calendar.getInstance());
           editSecSession.update();
           editSecSession.endEdit();
         }
       }
     }
     commit();
   } finally {
     setAuthorization(null);
     minimizeMemory();
   }
 }
  public void postFields() {
    final String S_ProcName = "postFields";
    ICFSecuritySecSessionObj focus = getSwingFocusAsSecSession();
    ICFSecuritySecSessionEditObj editObj;
    if (focus != null) {
      editObj = (ICFSecuritySecSessionEditObj) (focus.getEdit());
    } else {
      editObj = null;
    }
    if (editObj == null) {
      throw CFLib.getDefaultExceptionFactory()
          .newUsageException(
              getClass(), S_ProcName, "Panel is unfocused or is not editing the focus object");
    }
    // You are not allowed to edit the Container or Owner references, so they're not retrieved

    swingParentSecProxyObj =
        (ICFDbTestSecUserObj) (swingReferenceParentSecProxy.getReferencedObject());
    editObj.setRequiredParentSecProxy(swingParentSecProxyObj);

    editObj.setOptionalSecDevName(getSwingEditorSecDevName().getStringValue());

    editObj.setRequiredStart(getSwingEditorStart().getTimestampValue());

    editObj.setOptionalFinish(getSwingEditorFinish().getTimestampValue());
  }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    CFFreeSwitchXMsgSchemaMessageFormatter schemaFormatter = null;
    try {
      // Common XML Attributes
      String attrId = null;
      // Request Attributes
      String attrSecSessionId = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RqstLogOut");

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

      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();

      ICFFreeSwitchSchemaObj 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("SecSessionId")) {
          if (attrSecSessionId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrSecSessionId = 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");
      }

      UUID secSessionId = UUID.fromString(attrSecSessionId);
      if (secSessionId == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "converted-secSessionId");
      }
      if (schemaObj.getAuthorization() == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newRuntimeException(getClass(), S_ProcName, "Already disconnected from the database");
      }
      ICFSecuritySecSessionObj secSession = schemaObj.getSecSession();
      if (secSession == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newRuntimeException(
                getClass(), S_ProcName, "Security session does not exist for this schema");
      }
      if (!secSessionId.equals(secSession.getRequiredSecSessionId())) {
        throw CFLib.getDefaultExceptionFactory()
            .newRuntimeException(
                getClass(),
                S_ProcName,
                "Security session id does not match the one established by this schema");
      }
      if (secSession.getOptionalFinish() == null) {
        schemaObj.rollback();
        schemaObj.beginTransaction();
        ICFSecuritySecSessionEditObj editSecSession = secSession.beginEdit();
        editSecSession.setOptionalFinish(Calendar.getInstance());
        editSecSession.update();
        editSecSession.endEdit();
        schemaObj.commit();
      }
      schemaObj.disconnect(false);
      schemaObj.setAuthorization(null);
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnLoggedOut("\n\t\t\t", secSessionId)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      ((CFFreeSwitchXMsgRqstHandler) getParser()).appendResponse(response);
    } catch (RuntimeException e) {
      CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
      CFFreeSwitchXMsgRqstHandler xmsgRqstHandler = ((CFFreeSwitchXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFFreeSwitchXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    }
  }