예제 #1
0
  private void upConvertMeasuresAndDimensions() {
    if (domain.getLogicalModels().size() == 1) {
      return;
    }
    LogicalModel model = domain.getLogicalModels().get(1);

    // clean out the tables, we'll recreate the logical columns
    for (LogicalTable table : model.getLogicalTables()) {
      table.getLogicalColumns().clear();
    }

    // set the dimension logical column references to the new olap columns
    for (DimensionMetaData dim : getModel().getDimensions()) {
      for (HierarchyMetaData hier : dim) {
        for (LevelMetaData level : hier) {
          // create new logical columns
          AvailableField field = new AvailableField(level.getLogicalColumn().getPhysicalColumn());
          ColumnBackedNode node = createColumnBackedNode(field, ModelerPerspective.ANALYSIS);
          level.setLogicalColumn(node.getLogicalColumn());
        }
      }
    }

    // set the measure logical column references to the new olap columns
    for (MeasureMetaData measure : getModel().getMeasures()) {
      AvailableField field = new AvailableField(measure.getLogicalColumn().getPhysicalColumn());
      ColumnBackedNode node = createColumnBackedNode(field, ModelerPerspective.ANALYSIS);
      measure.setLogicalColumn(node.getLogicalColumn());
    }

    // make sure the relationships are set too
    ModelerConversionUtil.duplicateRelationshipsForOlap(domain.getLogicalModels().get(0), model);

    return;
  }
예제 #2
0
 public MemberPropertyMetaData createMemberPropertyForParentWithNode(
     LevelMetaData parent, ColumnBackedNode obj) {
   MemberPropertyMetaData memberProp = new MemberPropertyMetaData(parent, obj.getName());
   memberProp.setParent(parent);
   memberProp.setLogicalColumn(obj.getLogicalColumn());
   return memberProp;
 }
예제 #3
0
 public LevelMetaData createLevelForParentWithNode(
     HierarchyMetaData parent, ColumnBackedNode obj) {
   LevelMetaData level = new LevelMetaData(parent, obj.getName());
   level.setParent(parent);
   level.setLogicalColumn(obj.getLogicalColumn());
   return level;
 }
예제 #4
0
  public MeasureMetaData createMeasureForNode(AvailableField selectedField) {

    MeasureMetaData meta =
        new MeasureMetaData(
            selectedField.getName(),
            "",
            selectedField.getDisplayName(),
            workspaceHelper.getLocale()); // $NON-NLS-1$
    ColumnBackedNode node = createColumnBackedNode(selectedField, ModelerPerspective.ANALYSIS);
    meta.setLogicalColumn(node.getLogicalColumn());
    return meta;
  }
예제 #5
0
 public FieldMetaData createFieldForParentWithNode(
     CategoryMetaData parent, AvailableField selectedField) {
   FieldMetaData field =
       new FieldMetaData(
           parent,
           selectedField.getName(),
           "",
           selectedField.getDisplayName(),
           workspaceHelper.getLocale()); // $NON-NLS-1$
   ColumnBackedNode node = createColumnBackedNode(selectedField, ModelerPerspective.REPORTING);
   field.setLogicalColumn(node.getLogicalColumn());
   field.setFieldTypeDesc(node.getLogicalColumn().getDataType().getName());
   return field;
 }
예제 #6
0
 public DimensionMetaData createDimensionFromNode(ColumnBackedNode obj) {
   DimensionMetaData dimension = new DimensionMetaData(obj.getName());
   dimension.setExpanded(true);
   HierarchyMetaData hierarchy = createHierarchyForParentWithNode(dimension, obj);
   hierarchy.setParent(dimension);
   hierarchy.setExpanded(true);
   dimension.add(hierarchy);
   return dimension;
 }
예제 #7
0
  public ColumnBackedNode createColumnBackedNode(
      AvailableField field, ModelerPerspective perspective) {
    String locale = workspaceHelper.getLocale();
    ColumnBackedNode node = new BaseColumnBackedMetaData(field.getName());
    LogicalTable lTab = findLogicalTable(field.getPhysicalColumn().getPhysicalTable(), perspective);
    LogicalColumn lCol = null;

    if (lCol == null) {
      lCol = new LogicalColumn();
      lCol.setLogicalTable(lTab);
      // lCol.setParentConcept(lTab);
      lCol.setPhysicalColumn(field.getPhysicalColumn());
      lCol.setDataType(field.getPhysicalColumn().getDataType());
      if (field.getPhysicalColumn().getAggregationList() != null) {
        lCol.setAggregationList(field.getPhysicalColumn().getAggregationList());
      }
      if (field.getPhysicalColumn().getAggregationType() != null) {
        lCol.setAggregationType(field.getPhysicalColumn().getAggregationType());
      }
      lCol.setName(new LocalizedString(locale, field.getPhysicalColumn().getName(locale)));
      String colId =
          "LC_"
              + toId(lTab.getPhysicalTable().getName(locale))
              + "_"
              + toId(field.getPhysicalColumn().getId());

      // lCol.setDescription(new LocalizedString(locale,
      // field.getPhysicalColumn().getName(locale)));

      if (perspective == ModelerPerspective.ANALYSIS) {
        colId += BaseModelerWorkspaceHelper.OLAP_SUFFIX;
      }

      colId = BaseModelerWorkspaceHelper.uniquify(colId, lTab.getLogicalColumns());
      lCol.setId(colId);

      lTab.addLogicalColumn(lCol);
    }

    node.setLogicalColumn(lCol);
    return node;
  }
예제 #8
0
 public HierarchyMetaData createHierarchyForParentWithNode(
     DimensionMetaData parent, ColumnBackedNode obj) {
   HierarchyMetaData hier = new HierarchyMetaData(obj.getName());
   hier.setParent(parent);
   hier.setExpanded(true);
   if (obj != null) {
     LevelMetaData level = createLevelForParentWithNode(hier, obj);
     hier.add(level);
   }
   return hier;
 }