当前位置: 首页>>代码示例>>Java>>正文


Java LogicalModel.setPhysicalModel方法代码示例

本文整理汇总了Java中org.pentaho.metadata.model.LogicalModel.setPhysicalModel方法的典型用法代码示例。如果您正苦于以下问题:Java LogicalModel.setPhysicalModel方法的具体用法?Java LogicalModel.setPhysicalModel怎么用?Java LogicalModel.setPhysicalModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.metadata.model.LogicalModel的用法示例。


在下文中一共展示了LogicalModel.setPhysicalModel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generatePhysicalMetadataModel

import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
public Domain generatePhysicalMetadataModel() throws KettleException {
  
  // First do some checking and lookups...
  //
  String targetDatabaseName = ConceptUtil.getString(logicalDomain, DefaultIDs.DOMAIN_TARGET_DATABASE);
  if (Const.isEmpty(targetDatabaseName)) {
    throw new KettleException("Please specify a target database!");
  }
  DatabaseMeta targetDatabaseMeta = DatabaseMeta.findDatabase(databases, targetDatabaseName);
  if (targetDatabaseMeta==null) {
    throw new KettleException("Target database with name '"+targetDatabaseName+"' can't be found!");
  }

  // Now start creation of a new domain with physical underpinning.
  //
  Domain domain = new Domain();
  
  // Copy the domain information...
  //
  domain.setId( createId("DOMAIN", null, domain) );
  domain.setName(logicalDomain.getName());
  domain.setDescription(logicalDomain.getDescription());
  
  // Now copy all the models...
  //
  for (LogicalModel logicalModel : logicalDomain.getLogicalModels()) {
    // Copy model information...
    //
    LogicalModel model = new LogicalModel();
    model.setId( createId("MODEL", domain, model));
    model.setName(logicalModel.getName());
    model.setDescription(logicalModel.getDescription());
    
    // Create a physical model...
    //
    SqlPhysicalModel sqlModel = new SqlPhysicalModel();
    sqlModel.setDatasource(createSqlDataSource(targetDatabaseMeta));
    model.setPhysicalModel(sqlModel);
    
    for (LogicalTable logicalTable : logicalModel.getLogicalTables()) {
      LogicalTable table = new LogicalTable();
      table.setId( createId("LOGICAL_TABLE", logicalModel, logicalTable) );
      table.setName(logicalTable.getName());
      table.setDescription(logicalTable.getDescription());
      
      String targetTable = ConceptUtil.getString(logicalTable, DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME);
      
      SqlPhysicalTable sqlTable = new SqlPhysicalTable(sqlModel);
      table.setPhysicalTable(sqlTable);
      
      // Copy name & description from physical level...
      //
      sqlTable.setId( createId("PHYSICAL_TABLE", logicalModel, logicalTable));
      sqlTable.setName(logicalTable.getName());
      sqlTable.setDescription(logicalTable.getDescription());
      sqlTable.setTableType(ConceptUtil.getTableType(logicalTable));
      sqlTable.setTargetSchema(targetDatabaseMeta.getPreferredSchemaName());
      sqlTable.setTargetTable(targetTable);
      
      
    }
  }
  
  return domain;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:66,代码来源:MetadataGenerator.java

示例2: generatePhysicalMetadataModel

import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
public Domain generatePhysicalMetadataModel() throws KettleException {

    // First do some checking and lookups...
    //
    String targetDatabaseName = ConceptUtil.getString(logicalDomain, DefaultIDs.DOMAIN_TARGET_DATABASE);
    if (Utils.isEmpty(targetDatabaseName)) {
      throw new KettleException("Please specify a target database!");
    }
    DatabaseMeta targetDatabaseMeta = DatabaseMeta.findDatabase(databases, targetDatabaseName);
    if (targetDatabaseMeta==null) {
      throw new KettleException("Target database with name '"+targetDatabaseName+"' can't be found!");
    }

    // Now start creation of a new domain with physical underpinning.
    //
    Domain domain = new Domain();

    // Copy the domain information...
    //
    domain.setId( createId("DOMAIN", null, domain) );
    domain.setName(logicalDomain.getName());
    domain.setDescription(logicalDomain.getDescription());

    // Now copy all the models...
    //
    for (LogicalModel logicalModel : logicalDomain.getLogicalModels()) {
      // Copy model information...
      //
      LogicalModel model = new LogicalModel();
      model.setId( createId("MODEL", domain, model));
      model.setName(logicalModel.getName());
      model.setDescription(logicalModel.getDescription());

      // Create a physical model...
      //
      SqlPhysicalModel sqlModel = new SqlPhysicalModel();
      sqlModel.setDatasource(createSqlDataSource(targetDatabaseMeta));
      model.setPhysicalModel(sqlModel);

      for (LogicalTable logicalTable : logicalModel.getLogicalTables()) {
        LogicalTable table = new LogicalTable();
        table.setId( createId("LOGICAL_TABLE", logicalModel, logicalTable) );
        table.setName(logicalTable.getName());
        table.setDescription(logicalTable.getDescription());

        String targetTable = ConceptUtil.getString(logicalTable, DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME);

        SqlPhysicalTable sqlTable = new SqlPhysicalTable(sqlModel);
        table.setPhysicalTable(sqlTable);

        // Copy name & description from physical level...
        //
        sqlTable.setId( createId("PHYSICAL_TABLE", logicalModel, logicalTable));
        sqlTable.setName(logicalTable.getName());
        sqlTable.setDescription(logicalTable.getDescription());
        sqlTable.setTableType(ConceptUtil.getTableType(logicalTable));
        sqlTable.setTargetSchema(targetDatabaseMeta.getPreferredSchemaName());
        sqlTable.setTargetTable(targetTable);


      }
    }

    return domain;
  }
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:66,代码来源:MetadataGenerator.java


注:本文中的org.pentaho.metadata.model.LogicalModel.setPhysicalModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。