예제 #1
0
 /**
  * 构建引用参照
  *
  * @param factTable 事实表名称
  * @param dimension 维度定义
  * @param level 级别
  * @return
  */
 private ReferenceDefine buildReference(String factTable, Dimension dimension, Level level) {
   ReferenceDefine reference = new ReferenceDefine();
   reference.setMajorColumn(dimension.getFacttableColumn());
   reference.setSalveColumn(level.getPrimaryKey());
   reference.setMajorTable(factTable); // 事实表名称
   return reference;
 }
예제 #2
0
  /**
   * 构建维度表定义
   *
   * @param dimension 维度
   * @return 维度表定义
   */
  private DimTableMetaDefine getDimTableDefineWithLevelType(String factTable, Dimension dimension) {
    Level level = getLevel(dimension);
    if (level == null) {
      throw new RuntimeException("dimension's level is empty : " + dimension);
    }
    switch (level.getType()) {
      case REGULAR:
        {
          StandardDimTableMetaDefine dimTable = new StandardDimTableMetaDefine();
          dimTable.setName(dimension.getTableName());
          ReferenceDefine reference = buildReference(factTable, dimension, level);
          dimTable.setReference(reference);
          dimTable.addColumn(buildColumn(level));
          return dimTable;
        }
      case CALL_BACK:
        {
          CallbackDimTableMetaDefine dimTable = buildCallDimTable(factTable, dimension, level);
          return dimTable;
        }
      case PARENT_CHILD:
        // TODO 目前没有处理
        return null;
      case USER_CUSTOM:
        {
          // TODO 目前没有处理
          //                UserDefineDimTableMetaDefine dimTable = buildUserDefineTable(factTable,
          // dimension,
          //                    level);
          //                return dimTable;
          return null;
        }
      default:
        break;
    }

    return buildTimeDimTable(factTable, dimension, level);
  }
예제 #3
0
 /**
  * 构建列的元定义
  *
  * @param level
  * @return 列的元定义
  */
 private ColumnMetaDefine buildColumn(Level level) {
   ColumnMetaDefine column = new ColumnMetaDefine();
   if (level != null) {
     column.setCaption(level.getCaption());
     // modify by jiangyichao at 2014-10-15
     String source = null;
     if (level instanceof CallbackLevel) {
       source = ((CallbackLevel) level).getFactTableColumn();
     } else {
       source = ((MiniCubeLevel) level).getSource();
     }
     column.setName(source);
     // TODO 如果是时间维度,需要特殊处理
     // column.setType(level.getType());
   }
   return column;
 }