Пример #1
0
 @Bindable
 public void setModelName(String modelName) {
   String prevVal = model.getName();
   model.setName(modelName);
   setDirty(true);
   this.firePropertyChange("modelName", prevVal, modelName); // $NON-NLS-1$
 }
Пример #2
0
 @Bindable
 public List<String> getValidationMessages() {
   Set<String> modelMsg = model.getValidationMessages();
   Set<String> relModelMsg = relationalModel.getValidationMessages();
   modelMsg.addAll(relModelMsg);
   return new ArrayList<String>(modelMsg);
 }
Пример #3
0
 public void setModelIsChanging(boolean changing, boolean fireChanged) {
   this.modelIsChanging = changing;
   if (!changing && fireChanged) {
     fireTablesChanged();
     model.validateTree();
     isValid();
     fireModelChanged();
   }
 }
Пример #4
0
  @Bindable
  public void setModel(MainModelNode model) {
    this.model = model;
    model.addPropertyChangeListener(
        "children",
        new PropertyChangeListener() { //$NON-NLS-1$

          public void propertyChange(PropertyChangeEvent arg0) {
            if (!modelIsChanging) {
              fireModelChanged();
            }
          }
        });
    model.addPropertyChangeListener(
        "valid",
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent evt) {
            isValid();
          }
        });
  }
Пример #5
0
 public boolean equals(MainModelNode obj) {
   if (this == obj) {
     return true;
   }
   if (obj == null) {
     return false;
   }
   if (getClass() != obj.getClass()) {
     return false;
   }
   MainModelNode other = obj;
   if (dimensions == null) {
     if (other.dimensions != null) {
       return false;
     }
   } else if (!dimensions.equals(other.dimensions)) {
     return false;
   }
   if (listener == null) {
     if (other.listener != null) {
       return false;
     }
   } else if (!listener.equals(other.listener)) {
     return false;
   }
   if (measures == null) {
     if (other.measures != null) {
       return false;
     }
   } else if (!measures.equals(other.measures)) {
     return false;
   }
   if (name == null) {
     if (other.name != null) {
       return false;
     }
   } else if (!name.equals(other.name)) {
     return false;
   }
   return true;
 }
Пример #6
0
  public void refresh(Domain newDomain) throws ModelerException {

    List<IAvailableItem> items = new ArrayList<IAvailableItem>();
    for (IPhysicalTable table : newDomain.getPhysicalModels().get(0).getPhysicalTables()) {
      boolean isFact =
          table.getProperty("FACT_TABLE") != null
              ? (Boolean) table.getProperty("FACT_TABLE")
              : false;
      items.add(new AvailableTable(table, isFact));
    }

    availableTables.setChildren(items);

    setModelIsChanging(true);
    setRelationalModelIsChanging(true);

    // Set the type of modeling session. This will propigate to the UI
    if (supportsOlap(newDomain)) {
      this.setModellingMode(ModelerMode.ANALYSIS_AND_REPORTING);
    } else {
      this.setModellingMode(ModelerMode.REPORTING_ONLY);
      // clear out OLAP side of the existing model
      model.getDimensions().clear();
    }
    List<AvailableTable> tablesList = availableTables.getAsAvailableTablesList();

    fireTablesChanged();

    // replace the domain with the new domain, which
    // makes sure the physical and logical columns are accurate
    domain = newDomain;

    for (MeasureMetaData measure : model.getMeasures()) {
      boolean found = false;
      if (measure.getLogicalColumn() != null) {
        inner:
        for (AvailableTable table : tablesList) {
          for (AvailableField f : table.getAvailableFields()) {
            if (f.getPhysicalColumn()
                    .getId()
                    .equals(measure.getLogicalColumn().getPhysicalColumn().getId())
                && f.getPhysicalColumn()
                    .getPhysicalTable()
                    .getId()
                    .equals(
                        measure
                            .getLogicalColumn()
                            .getPhysicalColumn()
                            .getPhysicalTable()
                            .getId())) {
              // the physical column backing this measure is still available, set it to the new one
              measure.setLogicalColumn(
                  createColumnBackedNode(f, currentModelerPerspective).getLogicalColumn());
              found = true;
              break inner;
            }
          }
        }
        if (!found) {
          // the physical column that backed this measure no longer exists in the model.
          // therefore, we must invalidate it's logical column
          measure.setLogicalColumn(null);
        }
      }
    }

    try {
      for (DimensionMetaData dm : model.getDimensions()) {
        for (HierarchyMetaData hm : dm) {
          for (LevelMetaData lm : hm) {
            boolean found = false;
            if (lm.getLogicalColumn() != null) {
              inner:
              for (AvailableTable table : tablesList) {
                for (AvailableField f : table.getAvailableFields()) {
                  if (f.getPhysicalColumn()
                          .getId()
                          .equals(lm.getLogicalColumn().getPhysicalColumn().getId())
                      && f.getPhysicalColumn()
                          .getPhysicalTable()
                          .getId()
                          .equals(
                              lm.getLogicalColumn()
                                  .getPhysicalColumn()
                                  .getPhysicalTable()
                                  .getId())) {
                    // the physical column backing this level is still available, it is ok

                    lm.setLogicalColumn(
                        createColumnBackedNode(f, currentModelerPerspective).getLogicalColumn());
                    found = true;
                    break inner;
                  }
                }
              }
            }
            if (!found) {
              // the physical column that backed this level no longer exists in the model.
              // therefore, we must invalidate it's logical column
              lm.setLogicalColumn(null);
            }
          }
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    for (CategoryMetaData category : relationalModel.getCategories()) {
      for (FieldMetaData field : category) {
        boolean found = false;
        if (field.getLogicalColumn() != null) {
          inner:
          for (AvailableTable table : tablesList) {
            for (AvailableField f : table.getAvailableFields()) {
              if (f.getPhysicalColumn()
                      .getId()
                      .equals(field.getLogicalColumn().getPhysicalColumn().getId())
                  && f.getPhysicalColumn()
                      .getPhysicalTable()
                      .getId()
                      .equals(
                          field
                              .getLogicalColumn()
                              .getPhysicalColumn()
                              .getPhysicalTable()
                              .getId())) {

                // the physical column backing this field is still available, it is ok
                found = true;
                break inner;
              }
            }
          }
          if (!found) {
            // the physical column that backed this field no longer exists in the model.
            // therefore, we must invalidate it's logical column
            field.setLogicalColumn(null);
          }
        }
      }
    }

    // If the new model was previously "auto-modeled" we need to clean that now
    LogicalModel newLModel = getLogicalModel(ModelerPerspective.ANALYSIS);
    if (newLModel != null) {
      List<OlapDimension> theDimensions =
          (List) newLModel.getProperty("olap_dimensions"); // $NON-NLS-1$
      if (theDimensions != null) {
        theDimensions.clear();
      }
      List<OlapCube> theCubes = (List) newLModel.getProperty("olap_cubes"); // $NON-NLS-1$
      if (theCubes != null) {
        theCubes.clear();
      }
    }

    setModelIsChanging(false);
    setRelationalModelIsChanging(false);
  }
Пример #7
0
 @Bindable
 public String getModelName() {
   return model.getName();
 }