public int compare(ICFBamRelationObj lhs, ICFBamRelationObj 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 (arrayOfRelation == null) {
     return (null);
   }
   int len = arrayOfRelation.length;
   if (row >= len) {
     return (null);
   }
   ICFBamRelationObj obj = arrayOfRelation[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_NAME:
       retval = obj.getRequiredName();
       if (retval == null) {
         retval = "";
       }
       break;
     case COLID_SHORTNAME:
       retval = obj.getOptionalShortName();
       if (retval == null) {
         retval = "";
       }
       break;
     case COLID_LABEL:
       retval = obj.getOptionalLabel();
       if (retval == null) {
         retval = "";
       }
       break;
     case COLID_SHORTDESCRIPTION:
       retval = obj.getOptionalShortDescription();
       if (retval == null) {
         retval = "";
       }
       break;
     case COLID_DESCRIPTION:
       retval = obj.getOptionalDescription();
       if (retval == null) {
         retval = "";
       }
       break;
     case COLID_DBNAME:
       retval = obj.getOptionalDbName();
       if (retval == null) {
         retval = "";
       }
       break;
     case COLID_SUFFIX:
       retval = obj.getOptionalSuffix();
       if (retval == null) {
         retval = "";
       }
       break;
     case COLID_ISREQUIRED:
       retval = new Boolean(obj.getRequiredIsRequired());
       break;
     case COLID_ISABSTRACT:
       retval = new Boolean(obj.getRequiredIsAbstract());
       break;
     case COLID_ISXSDCONTAINER:
       retval = new Boolean(obj.getRequiredIsXsdContainer());
       break;
     case COLID_DEFAULTVISIBILITY:
       retval = new Boolean(obj.getRequiredDefaultVisibility());
       break;
     case COLID_LOOKUP_RELATIONTYPE:
       retval = obj.getRequiredLookupRelationType();
       break;
     case COLID_LOOKUP_DEFSCHEMA:
       retval = obj.getOptionalLookupDefSchema();
       break;
     case COLID_LOOKUP_FROMINDEX:
       retval = obj.getRequiredLookupFromIndex();
       break;
     case COLID_LOOKUP_TOTABLE:
       retval = obj.getRequiredLookupToTable();
       break;
     case COLID_LOOKUP_TOINDEX:
       retval = obj.getRequiredLookupToIndex();
       break;
     case COLID_LOOKUP_NARROWED:
       retval = obj.getOptionalLookupNarrowed();
       break;
     default:
       retval = null;
       break;
   }
   return (retval);
 }
  /**
   * The core evaluation of ColumnInOwnerRelation is also to determine if an index definition is in
   * an owner relation.
   *
   * <p>WORKING: Yes, I know. This should be a business method instead of copying the code in
   * ICFBamIndexObj and MSIsaGenBindColumnInOwnerRelation.
   *
   * @param genDef to be considered
   * @return True if the column participates in an owner relation.
   */
  public Boolean isColumnInOwnerRelation() {

    ICFLibAnyObj focusDef;
    ICFBamTableObj tableDef;
    final String S_ProcName = "isColumnInOwnerRelation() ";

    if (this instanceof ICFBamAtomObj) {
      ICFBamAtomObj atomDef = (ICFBamAtomObj) this;
      ICFLibAnyObj atomScopeDef = atomDef.getObjScope();
      tableDef = (ICFBamTableObj) atomScopeDef;
      focusDef = this;
    } else if (this instanceof ICFBamTableColObj) {
      ICFBamTableColObj tableColDef = (ICFBamTableColObj) this;
      ICFLibAnyObj tableColScopeDef = tableColDef.getObjScope();
      tableDef = (ICFBamTableObj) tableColScopeDef;
      focusDef = this;
    } else if (this instanceof ICFBamIndexColObj) {
      ICFBamIndexColObj indexColDef = (ICFBamIndexColObj) this;
      focusDef = indexColDef.getRequiredLookupColumn();
      if (focusDef instanceof ICFBamAtomObj) {
        tableDef = (ICFBamTableObj) ((ICFBamAtomObj) focusDef).getObjScope();
      } else if (focusDef instanceof ICFBamTableColObj) {
        tableDef = (ICFBamTableObj) ((ICFBamTableColObj) focusDef).getObjScope();
      } else {
        throw new RuntimeException(
            S_ProcName
                + "genContext.getGenDef().getColumnDef() for a ICFBamIndexColObj did not return a ICFBamAtomObj"
                + " nor a ICFBamTableColObj");
      }
    } else if (this instanceof ICFBamRelationColObj) {
      ICFBamRelationColObj relColDef = (ICFBamRelationColObj) this;
      ICFLibAnyObj columnDef = relColDef.getRequiredLookupFromCol();
      if (columnDef instanceof ICFBamAtomObj) {
        focusDef = columnDef;
        tableDef = (ICFBamTableObj) columnDef.getObjScope();
      } else if (columnDef instanceof ICFBamTableColObj) {
        focusDef = columnDef;
        tableDef = (ICFBamTableObj) columnDef.getObjScope();
      } else {
        throw new RuntimeException(
            S_ProcName
                + "genContext.getGenDef().getFromColumnDef() for a ICFBamIndexColObj did not return a ICFBamAtomObj"
                + " nor a ICFBamTableColObj");
      }
    } else {
      throw new RuntimeException(
          S_ProcName
              + "genContext.getGenDef() did not return a ICFBamAtomObj, ICFBamTableColObj, nor ICFBamIndexColObj instance");
    }

    List<ICFBamRelationObj> ownerRelations = tableDef.getContainerOwnerRelations();
    if ((ownerRelations == null) || ((ownerRelations != null) && (ownerRelations.size() == 0))) {
      return (false);
    }

    ListIterator<ICFBamRelationObj> ownerEnumerator = ownerRelations.listIterator();

    ICFBamRelationObj ownerRelation;
    ICFBamRelationColObj ownerRelationCol;
    Iterator<ICFBamRelationColObj> ownerRelationCols;

    while (ownerEnumerator.hasNext()) {

      ownerRelation = ownerEnumerator.next();
      ownerRelationCols = ownerRelation.getOptionalComponentsColumns().iterator();

      while (ownerRelationCols.hasNext()) {
        ownerRelationCol = ownerRelationCols.next();
        if (ownerRelationCol.getRequiredLookupFromCol() == focusDef) {
          return (true);
        }
      }
    }

    return (false);
  }