Example #1
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;
  }
Example #2
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;
 }
Example #3
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;
  }