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 populateFields() {
    ICFSecuritySecSessionObj popObj;
    ICFSecuritySecSessionObj focus = getSwingFocusAsSecSession();
    if (focus != null) {
      popObj = (ICFSecuritySecSessionObj) (focus.getEdit());
      if (popObj == null) {
        popObj = focus;
      }
    } else {
      popObj = null;
    }
    if (getPanelMode() == CFJPanel.PanelMode.Unknown) {
      popObj = null;
    }
    if (popObj == null) {
      swingContainerSecUserObj = null;
    } else {
      swingContainerSecUserObj =
          (ICFDbTestSecUserObj) popObj.getRequiredContainerSecUser(swingIsInitializing);
    }
    if (swingReferenceContainerSecUser != null) {
      swingReferenceContainerSecUser.setReferencedObject(swingContainerSecUserObj);
    }

    if (popObj == null) {
      swingParentSecProxyObj = null;
    } else {
      swingParentSecProxyObj =
          (ICFDbTestSecUserObj) popObj.getRequiredParentSecProxy(swingIsInitializing);
    }
    if (swingReferenceParentSecProxy != null) {
      swingReferenceParentSecProxy.setReferencedObject(swingParentSecProxyObj);
    }

    if (popObj == null) {
      getSwingEditorSecSessionId().setUuidValue(null);
    } else {
      getSwingEditorSecSessionId().setUuidValue(popObj.getRequiredSecSessionId());
    }

    if (popObj == null) {
      getSwingEditorSecDevName().setStringValue(null);
    } else {
      getSwingEditorSecDevName().setStringValue(popObj.getOptionalSecDevName());
    }

    if (popObj == null) {
      getSwingEditorStart().setTimestampValue(null);
    } else {
      getSwingEditorStart().setTimestampValue(popObj.getRequiredStart());
    }

    if (popObj == null) {
      getSwingEditorFinish().setTimestampValue(null);
    } else {
      getSwingEditorFinish().setTimestampValue(popObj.getOptionalFinish());
    }
  }
  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);
    }
  }