public void actionPerformed(ActionEvent e) {
   final String S_ProcName = "actionPerformed";
   ICFInternetSchemaObj schemaObj = swingSchema.getSchema();
   ICFInternetMinorVersionObj obj =
       (ICFInternetMinorVersionObj) schemaObj.getMinorVersionTableObj().newInstance();
   JInternalFrame frame = swingSchema.getMinorVersionFactory().newViewEditJInternalFrame(obj);
   frame.addInternalFrameListener(getViewEditInternalFrameListener());
   ICFInternetMinorVersionEditObj edit = (ICFInternetMinorVersionEditObj) (obj.beginEdit());
   if (edit == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "edit");
   }
   ICFSecurityTenantObj secTenant = schemaObj.getSecTenant();
   edit.setRequiredOwnerTenant(secTenant);
   ICFInternetMajorVersionObj container = (ICFInternetMajorVersionObj) (getSwingContainer());
   if (container == null) {
     throw CFLib.getDefaultExceptionFactory()
         .newNullArgumentException(getClass(), S_ProcName, 0, "SwingContainer");
   }
   edit.setRequiredContainerMajorVersion(container);
   ICFInternetSwingMinorVersionJPanelCommon jpanelCommon =
       (ICFInternetSwingMinorVersionJPanelCommon) frame;
   jpanelCommon.setPanelMode(CFJPanel.PanelMode.Add);
   Container 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 int compare(ICFInternetMinorVersionObj lhs, ICFInternetMinorVersionObj rhs) {
   if (lhs == null) {
     if (rhs == null) {
       return (0);
     } else {
       return (-1);
     }
   } else if (rhs == null) {
     return (1);
   } else {
     String lhsValue = lhs.getObjQualifiedName();
     String rhsValue = rhs.getObjQualifiedName();
     if (lhsValue == null) {
       if (rhsValue == null) {
         return (0);
       } else {
         return (-1);
       }
     } else if (rhsValue == null) {
       return (1);
     } else {
       return (lhsValue.compareTo(rhsValue));
     }
   }
 }
 public Object getValueAt(int row, int column) {
   if ((row < 0) || (column < -1)) {
     return (null);
   }
   if (arrayOfMinorVersion == null) {
     return (null);
   }
   int len = arrayOfMinorVersion.length;
   if (row >= len) {
     return (null);
   }
   ICFInternetMinorVersionObj obj = arrayOfMinorVersion[row];
   if (obj == null) {
     return (null);
   }
   Object retval;
   switch (column) {
     case COLID_ROW_HEADER:
       retval = obj;
       break;
     case COLID_OBJQUALIFIEDNAME:
       retval = obj.getObjQualifiedName();
       break;
     case COLID_ID:
       retval = new Long(obj.getRequiredId());
       break;
     case COLID_DESCRIPTION:
       retval = obj.getOptionalDescription();
       if (retval == null) {
         retval = "";
       }
       break;
     case COLID_NAME:
       retval = obj.getRequiredName();
       if (retval == null) {
         retval = "";
       }
       break;
     default:
       retval = null;
       break;
   }
   return (retval);
 }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    try {
      // Common XML Attributes
      String attrId = null;
      // DomainBase Attributes
      String attrDescription = null;
      // DomainBase References
      ICFInternetTenantObj refTenant = null;
      // ProjectBase Attributes
      // ProjectBase References
      // Version Attributes
      // Version References
      // MinorVersion Attributes
      String attrName = null;
      // MinorVersion References
      ICFInternetMajorVersionObj refMajorVersion = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("MinorVersion");

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

      ICFInternetSchemaObj schemaObj = saxLoader.getSchemaObj();
      if (schemaObj == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()");
      }

      // Instantiate an edit buffer for the parsed information
      ICFInternetMinorVersionEditObj editBuff =
          (ICFInternetMinorVersionEditObj)
              schemaObj.getMinorVersionTableObj().newInstance().beginEdit();

      // 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("Description")) {
          if (attrDescription != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrDescription = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("Name")) {
          if (attrName != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrName = 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 (attrName == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Name");
      }

      // Save named attributes to context
      CFLibXmlCoreContext curContext = getParser().getCurContext();
      curContext.putNamedValue("Id", attrId);
      curContext.putNamedValue("Description", attrDescription);
      curContext.putNamedValue("Name", attrName);

      // Convert string attributes to native Java types
      // and apply the converted attributes to the editBuff.

      Integer natId;
      if ((attrId != null) && (attrId.length() > 0)) {
        natId = new Integer(Integer.parseInt(attrId));
      } else {
        natId = null;
      }
      String natDescription = attrDescription;
      editBuff.setOptionalDescription(natDescription);

      String natName = attrName;
      editBuff.setRequiredName(natName);

      // Get the scope/container object

      CFLibXmlCoreContext parentContext = curContext.getPrevContext();
      Object scopeObj;
      if (parentContext != null) {
        scopeObj = parentContext.getNamedValue("Object");
      } else {
        scopeObj = null;
      }

      // Resolve and apply required Container reference

      if (scopeObj == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "scopeObj");
      } else if (scopeObj instanceof ICFInternetMajorVersionObj) {
        refMajorVersion = (ICFInternetMajorVersionObj) scopeObj;
        editBuff.setRequiredContainerMajorVersion(refMajorVersion);
        refTenant = (ICFInternetTenantObj) editBuff.getRequiredOwnerTenant();
      } else {
        throw CFLib.getDefaultExceptionFactory()
            .newUnsupportedClassException(
                getClass(), S_ProcName, "scopeObj", scopeObj, "ICFInternetMajorVersionObj");
      }

      // Resolve and apply Owner reference

      if (refTenant == null) {
        if (scopeObj instanceof ICFInternetTenantObj) {
          refTenant = (ICFInternetTenantObj) scopeObj;
          editBuff.setRequiredOwnerTenant(refTenant);
        } else {
          throw CFLib.getDefaultExceptionFactory()
              .newNullArgumentException(getClass(), S_ProcName, 0, "Owner<Tenant>");
        }
      }

      CFInternetSaxLoader.LoaderBehaviourEnum loaderBehaviour =
          saxLoader.getMinorVersionLoaderBehaviour();
      ICFInternetMinorVersionEditObj editMinorVersion = null;
      ICFInternetMinorVersionObj origMinorVersion =
          (ICFInternetMinorVersionObj)
              schemaObj
                  .getMinorVersionTableObj()
                  .readMinorVersionByNameIdx(
                      refMajorVersion.getRequiredTenantId(),
                      refMajorVersion.getRequiredId(),
                      editBuff.getRequiredName());
      if (origMinorVersion == null) {
        editMinorVersion = editBuff;
      } else {
        switch (loaderBehaviour) {
          case Insert:
            break;
          case Update:
            editMinorVersion = (ICFInternetMinorVersionEditObj) origMinorVersion.beginEdit();
            editMinorVersion.setOptionalDescription(editBuff.getOptionalDescription());
            editMinorVersion.setRequiredName(editBuff.getRequiredName());
            break;
          case Replace:
            editMinorVersion = (ICFInternetMinorVersionEditObj) origMinorVersion.beginEdit();
            editMinorVersion.delete();
            editMinorVersion.endEdit();
            origMinorVersion = null;
            editMinorVersion = editBuff;
            break;
        }
      }

      if (editMinorVersion != null) {
        if (origMinorVersion != null) {
          editMinorVersion.update();
        } else {
          origMinorVersion = (ICFInternetMinorVersionObj) editMinorVersion.create();
        }
        editMinorVersion.endEdit();
      }

      curContext.putNamedValue("Object", origMinorVersion);
    } 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 void startElement(
		String		uri,
		String		localName,
		String		qName,
		Attributes	attrs )
	throws SAXException
	{
		CFAsteriskXMsgSchemaMessageFormatter schemaFormatter = null;
		try {
			// Common XML Attributes
			String	attrId = null;
			String attrTenantId = null;
			String attrMajorId = null;
			// Attribute Extraction
			String	attrLocalName;
			int		numAttrs;
			int		idxAttr;
			final String S_ProcName = "startElement";
			final String S_LocalName = "LocalName";

			assert qName.equals( "RqstMinorVersionReadByMajorIdx" );

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

			schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();

			ICFAsteriskSchemaObj 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( "TenantId" ) ) {
					if( attrTenantId != null ) {
						throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException( getClass(),
							S_ProcName,
							S_LocalName,
							attrLocalName );
					}
					attrTenantId = attrs.getValue( idxAttr );
				}
				else if( attrLocalName.equals( "MajorId" ) ) {
					if( attrMajorId != null ) {
						throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException( getClass(),
							S_ProcName,
							S_LocalName,
							attrLocalName );
					}
					attrMajorId = 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( ( attrTenantId == null ) || ( attrTenantId.length() <= 0 ) ) {
				throw CFLib.getDefaultExceptionFactory().newNullArgumentException( getClass(),
					S_ProcName,
					0,
					"TenantId" );
			}
			if( ( attrMajorId == null ) || ( attrMajorId.length() <= 0 ) ) {
				throw CFLib.getDefaultExceptionFactory().newNullArgumentException( getClass(),
					S_ProcName,
					0,
					"MajorId" );
			}

			// Save named attributes to context
			CFLibXmlCoreContext curContext = getParser().getCurContext();
			// Convert string attributes to native Java types
			// and apply the converted attributes to the editBuff.

			long natTenantId;
			natTenantId = Long.parseLong( attrTenantId );

			long natMajorId;
			natMajorId = Long.parseLong( attrMajorId );

			// Read the objects
			List<ICFInternetMinorVersionObj> list = schemaObj.getMinorVersionTableObj().readMinorVersionByMajorIdx( natTenantId,
				natMajorId );
			String responseOpening = schemaFormatter.formatRspnXmlPreamble() + "\n"
				+	"\t" + CFAsteriskXMsgMinorVersionMessageFormatter.formatMinorVersionRspnListOpenTag();
			xmsgRqstHandler.appendResponse( responseOpening );
			Iterator<ICFInternetMinorVersionObj> iter = list.iterator();
			ICFInternetMinorVersionObj cur;
			String subxml;
			while( iter.hasNext() ) {
				cur = iter.next();
				subxml = CFAsteriskXMsgMinorVersionMessageFormatter.formatMinorVersionRspnDerivedRec( "\n\t\t", cur.getMinorVersionBuff() );
				xmsgRqstHandler.appendResponse( subxml );
			}
			String responseClosing =
				 	"\n"
				+	"\t" + CFAsteriskXMsgMinorVersionMessageFormatter.formatMinorVersionRspnListCloseTag()
				+	schemaFormatter.formatRspnXmlPostamble();
			xmsgRqstHandler.appendResponse( responseClosing );
		}
		catch( RuntimeException e ) {
			CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler)getParser());
			schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
			String response = schemaFormatter.formatRspnXmlPreamble() + "\n"
				+	"\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException( "\n\t\t\t", e )
				+	"\n"
				+	schemaFormatter.formatRspnXmlPostamble();
			xmsgRqstHandler.resetResponse();
			xmsgRqstHandler.appendResponse( response );
			xmsgRqstHandler.setCaughtException( true );
		}
		catch( Error e ) {
			CFAsteriskXMsgRqstHandler xmsgRqstHandler = ((CFAsteriskXMsgRqstHandler)getParser());
			schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
			String response = schemaFormatter.formatRspnXmlPreamble() + "\n"
				+	"\t" + CFAsteriskXMsgSchemaMessageFormatter.formatRspnException( "\n\t\t\t", e )
				+	"\n"
				+	schemaFormatter.formatRspnXmlPostamble();
			xmsgRqstHandler.resetResponse();
			xmsgRqstHandler.appendResponse( response );
			xmsgRqstHandler.setCaughtException( true );
		}
	}