コード例 #1
0
  private void importField(DbJVClass dbClaz, Field field) throws DbException {
    if (dbClaz == null) {
      return;
    }

    DbJVDataMember member = new DbJVDataMember(dbClaz);
    member.setName(field.getName());

    // set field type
    Type type = field.getType();
    member.setType(toAdt(type));
    member.setTypeUse(toTypeUse(type));

    // set field modifiers
    member.setFinal(field.isFinal());
    member.setStatic(field.isStatic());
    member.setTransient(field.isTransient());
    member.setVisibility(toVisibility(field));
    member.setVolatile(field.isVolatile());
  }
コード例 #2
0
  private void propagateCommonItemValues(
      DbORCommonItem item, DbObject concept, boolean isObjectOriented, int options)
      throws DbException {

    m_changesmade = true;

    // get mandatory properties
    DbORTypeClassifier type = item.getType();
    Integer len = item.getLength();
    Integer dec = item.getNbDecimal();
    boolean isNull = item.getNull();

    // get optional properties
    String name = item.getName();
    String physicalName = item.getPhysicalName();
    String alias = item.getAlias();
    String desc = item.getDescription();
    DbSMSStereotype stereotype = item.getUmlStereotype();

    if (!isObjectOriented) {
      DbORColumn column = (DbORColumn) concept;
      column.setType(type);
      column.setLength(len);
      column.setNbDecimal(dec);
      column.setNull(Boolean.valueOf(isNull));

      // set optional properties
      if ((options & NAME) != 0) {
        column.setName(name);
      }

      if ((options & PHYSICAL_NAME) != 0) {
        column.setPhysicalName(physicalName);
      }

      if ((options & ALIAS) != 0) {
        column.setAlias(alias);
      }

      if ((options & DESCRIPTION) != 0) {
        column.setDescription(desc);
      }

      if ((options & STEREOTYPE) != 0) {
        column.setUmlStereotype(stereotype);
      }
    } // end while
    else {

      // get object properties
      DbOOAdt ooType = item.getOoType();
      String typeUse = item.getTypeUse();
      OOTypeUseStyle style = item.getTypeUseStyle();
      JVVisibility visib = (JVVisibility) item.getVisibility();
      boolean isStatic = item.isStatic();
      boolean isFinal = item.isFinal();
      boolean isTransient = item.isTransient();
      boolean isVolatile = item.isVolatile();

      // set mandatory oo properties
      DbJVDataMember field = (DbJVDataMember) concept;
      field.setType(ooType);
      field.setTypeUse(typeUse);
      field.setTypeUseStyle(style);
      field.setVisibility(visib);
      field.setStatic(Boolean.valueOf(isStatic));
      field.setFinal(new Boolean(isFinal));
      field.setTransient(new Boolean(isTransient));
      field.setVolatile(new Boolean(isVolatile));

      // set optional properties
      if ((options & NAME) != 0) {
        field.setName(name);
      }

      if ((options & ALIAS) != 0) {
        field.setAlias(alias);
      }

      if ((options & DESCRIPTION) != 0) {
        field.setDescription(desc);
      }

      if ((options & STEREOTYPE) != 0) {
        field.setUmlStereotype(stereotype);
      }
    } // end while
  }
コード例 #3
0
  private void propagateCommonItemValues(DbORCommonItem item, int options) throws DbException {

    // get mandatory properties
    DbORTypeClassifier type = item.getType();
    Integer len = item.getLength();
    Integer dec = item.getNbDecimal();
    boolean isNull = item.getNull();

    // get optional properties
    String name = item.getName();
    String physicalName = item.getPhysicalName();
    String alias = item.getAlias();
    String desc = item.getDescription();
    DbSMSStereotype stereotype = item.getUmlStereotype();

    // for each column
    DbRelationN relN = item.getColumns();
    DbEnumeration dbEnum = relN.elements(DbORColumn.metaClass);
    while (dbEnum.hasMoreElements()) {

      m_changesmade = true;

      // set mandatory properties
      DbORColumn column = (DbORColumn) dbEnum.nextElement();
      column.setType(type);
      column.setLength(len);
      column.setNbDecimal(dec);
      column.setNull(Boolean.valueOf(isNull));

      // set optional properties
      if ((options & NAME) != 0) {
        column.setName(name);
      }

      if ((options & PHYSICAL_NAME) != 0) {
        column.setPhysicalName(physicalName);
      }

      if ((options & ALIAS) != 0) {
        column.setAlias(alias);
      }

      if ((options & DESCRIPTION) != 0) {
        column.setDescription(desc);
      }

      if ((options & STEREOTYPE) != 0) {
        column.setUmlStereotype(stereotype);
      }
    } // end while
    dbEnum.close();

    // get object properties
    DbOOAdt ooType = item.getOoType();
    String typeUse = item.getTypeUse();
    OOTypeUseStyle style = item.getTypeUseStyle();
    JVVisibility visib = (JVVisibility) item.getVisibility();
    boolean isStatic = item.isStatic();
    boolean isFinal = item.isFinal();
    boolean isTransient = item.isTransient();
    boolean isVolatile = item.isVolatile();

    // for each field
    relN = item.getFields();
    dbEnum = relN.elements(DbJVDataMember.metaClass);
    while (dbEnum.hasMoreElements()) {

      m_changesmade = true;

      // set mandatory oo properties
      DbJVDataMember field = (DbJVDataMember) dbEnum.nextElement();
      field.setType(ooType);
      field.setTypeUse(typeUse);
      field.setTypeUseStyle(style);
      field.setVisibility(visib);
      field.setStatic(Boolean.valueOf(isStatic));
      field.setFinal(new Boolean(isFinal));
      field.setTransient(new Boolean(isTransient));
      field.setVolatile(new Boolean(isVolatile));

      // set optional properties
      if ((options & NAME) != 0) {
        field.setName(name);
      }

      if ((options & ALIAS) != 0) {
        field.setAlias(alias);
      }

      if ((options & DESCRIPTION) != 0) {
        field.setDescription(desc);
      }

      if ((options & STEREOTYPE) != 0) {
        field.setUmlStereotype(stereotype);
      }
    } // end while
    dbEnum.close();
  } // end propagateCommonItemValues()
コード例 #4
0
  //
  // PRIVATE METHODS
  //
  private void propagateCommonItems() {
    g_options = getOptions();

    m_changesmade = false;

    try {
      m_semObjs[0].getDb().beginWriteTrans(m_title);
      int nb = m_semObjs.length;
      for (int i = 0; i < nb; i++) {
        DbObject semObj = m_semObjs[i];
        if (semObj instanceof DbORCommonItemModel) {
          DbORCommonItemModel model = (DbORCommonItemModel) semObj;
          propagateCommonItemValues(model, g_options);
        } else if (semObj instanceof DbORCommonItem) {
          DbORCommonItem item = (DbORCommonItem) semObj;
          propagateCommonItemValues(item, g_options);
        } // end if
        else if (semObj instanceof DbORDataModel) {
          DbObject tableOrView = null;
          DbEnumeration orTableEnum = semObj.getComponents().elements(DbORAbsTable.metaClass);
          while (orTableEnum.hasMoreElements()) {
            tableOrView = orTableEnum.nextElement();
            DbEnumeration orColumnEnum = tableOrView.getComponents().elements(DbORColumn.metaClass);
            DbORCommonItem item = null;
            while (orColumnEnum.hasMoreElements()) {
              DbORColumn parm = (DbORColumn) orColumnEnum.nextElement();
              item = (DbORCommonItem) parm.get(DbORColumn.fCommonItem);
              if (item != null) propagateCommonItemValues(item, parm, false, g_options);
            }
            orColumnEnum.close();
          }
          orTableEnum.close();
        } else if (semObj instanceof DbORColumn) {
          DbORCommonItem item = (DbORCommonItem) semObj.get(DbORColumn.fCommonItem);
          if (item != null) propagateCommonItemValues(item, semObj, false, g_options);
        } else if (semObj instanceof DbORAbsTable) {
          DbEnumeration orColumnEnum = semObj.getComponents().elements(DbORColumn.metaClass);
          DbORCommonItem item = null;
          while (orColumnEnum.hasMoreElements()) {
            DbORColumn parm = (DbORColumn) orColumnEnum.nextElement();
            item = (DbORCommonItem) parm.get(DbORColumn.fCommonItem);
            if (item != null) propagateCommonItemValues(item, parm, false, g_options);
          }
          orColumnEnum.close();
        } else if (semObj instanceof DbOOClassModel) {
          DbObject tableOrView = null;
          DbEnumeration orTableEnum = semObj.getComponents().elements(DbOOClass.metaClass);
          while (orTableEnum.hasMoreElements()) {
            tableOrView = orTableEnum.nextElement();
            DbEnumeration orColumnEnum =
                tableOrView.getComponents().elements(DbJVDataMember.metaClass);
            DbORCommonItem item = null;
            while (orColumnEnum.hasMoreElements()) {
              DbJVDataMember parm = (DbJVDataMember) orColumnEnum.nextElement();
              item = (DbORCommonItem) parm.get(DbJVDataMember.fCommonItem);
              if (item != null) propagateCommonItemValues(item, parm, true, g_options);
            }
            orColumnEnum.close();
          }
          orTableEnum.close();
        } else if (semObj instanceof DbOOClass) {
          DbEnumeration orColumnEnum = semObj.getComponents().elements(DbJVDataMember.metaClass);
          DbORCommonItem item = null;
          while (orColumnEnum.hasMoreElements()) {
            DbJVDataMember parm = (DbJVDataMember) orColumnEnum.nextElement();
            item = (DbORCommonItem) parm.get(DbJVDataMember.fCommonItem);
            if (item != null) propagateCommonItemValues(item, parm, true, g_options);
          }
          orColumnEnum.close();
        } else if (semObj instanceof DbJVDataMember) {
          DbORCommonItem item = (DbORCommonItem) semObj.get(DbJVDataMember.fCommonItem);
          if (item != null) propagateCommonItemValues(item, semObj, true, g_options);
        }
      } // end for
      m_semObjs[0].getDb().commitTrans();

      if (m_changesmade == false)
        JOptionPane.showMessageDialog(
            this,
            LocaleMgr.screen.getString("NoCommonItemToPropagate"),
            ApplicationContext.getApplicationName(),
            JOptionPane.INFORMATION_MESSAGE);

    } catch (Exception e) {
      org.modelsphere.jack.util.ExceptionHandler.processUncatchedException(
          ApplicationContext.getDefaultMainFrame(), e);
    }
  } // end propagateCommonItems()