private DbORColumn getLogicalSuperColumn() throws DbException {
    DbORColumn logicalSuperColumn = null;
    DbORTable t1 = (DbORTable) m_column.getCompositeOfType(DbORTable.metaClass);
    boolean rubrique = isRubrique(t1);

    if (rubrique) {
      DbORTable t2 = findParentTable(t1);
      DbORTable t0 = (t2 == null) ? null : (DbORTable) t2.getSuperCopy();
      logicalSuperColumn = (t0 == null) ? null : findColumn(t0, t1.getName());
    }

    return logicalSuperColumn;
  }
  private boolean isRubrique(DbORTable table) {
    boolean rubrique;

    try {
      String tableName = table.getName();
      DbSMSStereotype stereotype = table.getUmlStereotype();
      rubrique = (tableName == null) ? false : tableName.endsWith(RUBRIQUE_SUFFIX);
      rubrique |= (stereotype == null) ? false : RUBRIQUE_STEREOTYPE.equals(stereotype.getName());
    } catch (DbException ex) {
      rubrique = false;
    }

    return rubrique;
  }
  DbColumnWrapper getSuperColumn(DbProjectWrapper project) throws DbException {
    DbORColumn sc = (DbORColumn) m_column.getSuperCopy(); // physical super-column

    // if no physical super-column, look for logical super-column
    if (sc == null) {
      sc = getLogicalSuperColumn();
    }

    // if neither physical nor logical super-column, return null
    if (sc == null) {
      return null;
    }

    DbORTable t = (DbORTable) sc.getCompositeOfType(DbORTable.metaClass);
    DbORDataModel dm = (DbORDataModel) t.getCompositeOfType(DbORDataModel.metaClass);
    DbDataModelWrapper dataModel = project.getDataModel(dm);
    DbTableWrapper table = dataModel.getTable(t);
    DbColumnWrapper superColumn = new DbColumnWrapper(table, sc);
    return superColumn;
  }
  // find, if any, the column of 'table' whose name is 'columnName'
  private DbORColumn findColumn(DbORTable table, String columnName) throws DbException {
    DbORColumn namedColumn = null;
    DbRelationN relN = table.getComponents();
    DbEnumeration enu = relN.elements(DbORColumn.metaClass);
    while (enu.hasMoreElements()) {
      DbORColumn c = (DbORColumn) enu.nextElement();
      if (columnName.equals(c.getName())) {
        namedColumn = c;
        break;
      }
    } // end while
    enu.close();

    return namedColumn;
  }
  private DbORTable findParentTable(DbORTable t1) throws DbException {
    DbORTable parent = null;
    DbRelationN relN = t1.getAssociationEnds();
    DbEnumeration enu = relN.elements(DbORAssociationEnd.metaClass);
    while (enu.hasMoreElements()) {
      DbORAssociationEnd end = (DbORAssociationEnd) enu.nextElement();
      int mult = end.getMultiplicity().getValue();
      if (mult == SMSMultiplicity.EXACTLY_ONE) {
        DbORAssociationEnd oppEnd = end.getOppositeEnd();
        DbORAbsTable t = oppEnd.getClassifier();

        if (t instanceof DbORTable) {
          parent = (DbORTable) t;
          break;
        }
      } // end if
    } // end while
    enu.close();

    return parent;
  }