public void loadData(boolean forceReload) {
   ICFFreeSwitchSchemaObj schemaObj = swingSchema.getSchema();
   if ((containingCluster == null) || forceReload) {
     CFSecurityAuthorization auth = schemaObj.getAuthorization();
     long containingClusterId = auth.getSecClusterId();
     containingCluster = schemaObj.getClusterTableObj().readClusterByIdIdx(containingClusterId);
   }
   if ((listOfTenant == null) || forceReload) {
     arrayOfTenant = null;
     listOfTenant =
         schemaObj
             .getTenantTableObj()
             .readTenantByClusterIdx(containingCluster.getRequiredId(), swingIsInitializing);
     if (listOfTenant != null) {
       Object objArray[] = listOfTenant.toArray();
       if (objArray != null) {
         int len = objArray.length;
         arrayOfTenant = new ICFSecurityTenantObj[len];
         for (int i = 0; i < len; i++) {
           arrayOfTenant[i] = (ICFSecurityTenantObj) objArray[i];
         }
         Arrays.sort(arrayOfTenant, compareTenantByQualName);
       }
     }
   }
 }
 public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   Container cont;
   JDesktopPane desktop;
   ICFFreeSwitchSchemaObj schemaObj = swingSchema.getSchema();
   ICFFreeSwitchPbxIvrMenuObj focus = getSwingFocusAsPbxIvrMenu();
   ICFFreeSwitchPbxIvrMenuEditObj editObj = (ICFFreeSwitchPbxIvrMenuEditObj) focus.getEdit();
   if (editObj != null) {
     focus = editObj;
   }
   ICFFreeSwitchTenantObj referencedObj =
       (ICFFreeSwitchTenantObj) focus.getRequiredContainerTenant(swingIsInitializing);
   java.util.List<ICFSecurityTenantObj> listOfTenant = null;
   CFSecurityAuthorization auth = schemaObj.getAuthorization();
   long containingClusterId = auth.getSecClusterId();
   listOfTenant = schemaObj.getTenantTableObj().readTenantByClusterIdx(containingClusterId);
   if (listOfTenant == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "listOfTenant");
   }
   Collection<ICFSecurityTenantObj> cltn = listOfTenant;
   JInternalFrame frame =
       swingSchema
           .getTenantFactory()
           .newPickerJInternalFrame(
               referencedObj, null, cltn, new CallbackPbxIvrMenuTenantChosen());
   ((ICFFreeSwitchSwingTenantJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View);
   cont = getParent();
   while ((cont != null) && (!(cont instanceof JInternalFrame))) {
     cont = cont.getParent();
   }
   if (cont != null) {
     JInternalFrame myInternalFrame = (JInternalFrame) cont;
     myInternalFrame.getDesktopPane().add(frame);
     frame.setVisible(true);
     frame.show();
   }
 }
  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);
    }
  }