本文整理汇总了Java中org.pentaho.metadata.model.LogicalModel.setName方法的典型用法代码示例。如果您正苦于以下问题:Java LogicalModel.setName方法的具体用法?Java LogicalModel.setName怎么用?Java LogicalModel.setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.metadata.model.LogicalModel
的用法示例。
在下文中一共展示了LogicalModel.setName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newModel
import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
/**
* Create a new model in the domain
*
* @param domain the domain to create the new model in
*/
private boolean newModel(Shell shell, StarDomain starDomain) {
LogicalModel model = new LogicalModel();
model.setName(new LocalizedString(defaultLocale, "Model"));
StarModelDialog dialog = new StarModelDialog(shell, model, defaultLocale);
if (dialog.open()!=null) {
starDomain.getDomain().getLogicalModels().add(model);
starDomain.setChanged(true);
return true;
}
return false;
}
示例2: buildLogicalModel
import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
/**
* Inflate a logical model from a metastore element.
*
* @param metaStore The metastore to read from
* @param element The element to read from
* @return The Logical Model
* @throws MetaStoreException in case something goes wrong
*/
public static LogicalModel buildLogicalModel(IMetaStore metaStore, IMetaStoreElement element) throws MetaStoreException {
try {
LogicalModel model = new LogicalModel();
model.setName(new LocalizedString(defaultLocale, element.getName()));
model.setDescription(new LocalizedString(defaultLocale, getChildString(element, Attribute.ID_MODEL_DESCRIPTION.id)));
return model;
} catch(Exception e) {
throw new MetaStoreException("Unable to inflate logical model from metastore element", e);
}
}
示例3: 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;
}
示例4: setup
import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
@Before
public void setup() {
String locale = LocaleHelper.getLocale().toString();
SqlPhysicalModel model = new SqlPhysicalModel();
SqlDataSource dataSource = new SqlDataSource();
dataSource.setDatabaseName( "SampleData" );
model.setDatasource( dataSource );
SqlPhysicalTable table = new SqlPhysicalTable( model );
model.getPhysicalTables().add( table );
table.setTargetTableType( TargetTableType.INLINE_SQL );
table.setTargetTable( "select * from customers" );
table.setId( "customers" );
SqlPhysicalColumn column = new SqlPhysicalColumn( table );
column.setTargetColumn( "customername" );
column.setName( new LocalizedString( locale, "Customer Name" ) );
column.setDescription( new LocalizedString( locale, "Customer Name Desc" ) );
column.setDataType( DataType.STRING );
column.setId( "cutomer_customername" );
table.getPhysicalColumns().add( column );
LogicalModel logicalModel = new LogicalModel();
model.setId( "MODEL" );
model.setName( new LocalizedString( locale, "My Model" ) );
model.setDescription( new LocalizedString( locale, "A Description of the Model" ) );
LogicalTable logicalTable = new LogicalTable();
logicalTable.setId( "BT_CUSTOMERS" );
logicalTable.setPhysicalTable( table );
logicalModel.getLogicalTables().add( logicalTable );
logicalModel.setName( new LocalizedString( locale, "My Model" ) );
logicalColumn1 = new LogicalColumn();
logicalColumn1.setId( "LC_CUSTOMERNAME" );
logicalColumn1.setPhysicalColumn( column );
logicalColumn1.setAggregationType( AggregationType.COUNT );
logicalColumn1.setLogicalTable( logicalTable );
logicalColumn1.setDataType( DataType.STRING );
logicalColumn2 = new LogicalColumn();
logicalColumn2.setId( "LC_CUSTOMERNUMBER" );
logicalColumn2.setAggregationType( AggregationType.COUNT );
logicalColumn2.setPhysicalColumn( column );
logicalColumn2.setLogicalTable( logicalTable );
logicalColumn2.setDataType( DataType.NUMERIC );
logicalTable.addLogicalColumn( logicalColumn1 );
logicalTable.addLogicalColumn( logicalColumn2 );
domain = new Domain();
domain.addPhysicalModel( model );
domain.addLogicalModel( logicalModel );
physicalColumn = column;
SqlPhysicalColumn column2 = new SqlPhysicalColumn( table );
column2.setTargetColumn( "customername" );
column2.setName( new LocalizedString( locale, "Customer Number" ) );
column2.setDescription( new LocalizedString( locale, "Customer Number" ) );
column2.setDataType( DataType.NUMERIC );
column2.setId( "customer_customernumber" );
physicalColumn2 = column2;
table.getPhysicalColumns().add( physicalColumn2 );
}
示例5: getTestModel
import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
private LogicalModel getTestModel( TargetTableType tableType, String targetTable, String targetSchema,
boolean hiddenMembers ) {
List<OlapDimension> dimensions = new ArrayList<OlapDimension>();
OlapDimension dimension = new OlapDimension();
dimension.setName( "Dim1" );
List<OlapHierarchy> hierarchies = new ArrayList<OlapHierarchy>();
OlapHierarchy hierarchy = new OlapHierarchy();
hierarchy.setName( "Hier1" );
List<OlapHierarchyLevel> hierarchyLevels = new ArrayList<OlapHierarchyLevel>();
OlapHierarchyLevel level = new OlapHierarchyLevel();
level.setName( "Lvl1" );
level.setHidden( hiddenMembers );
hierarchyLevels.add( level );
hierarchy.setHierarchyLevels( hierarchyLevels );
hierarchies.add( hierarchy );
dimension.setHierarchies( hierarchies );
dimensions.add( dimension );
List<OlapCube> cubes = new ArrayList<OlapCube>();
OlapCube cube = new OlapCube();
cube.setName( "Cube1" );
cubes.add( cube );
List<OlapMeasure> measures = new ArrayList<OlapMeasure>();
OlapMeasure measure = new OlapMeasure();
measure.setName( "Meas1" );
measures.add( measure );
measure.setHidden( hiddenMembers );
cube.setOlapMeasures( measures );
List<OlapDimensionUsage> dimensionUsages = new ArrayList<OlapDimensionUsage>();
OlapDimensionUsage dimUsage = new OlapDimensionUsage();
dimensionUsages.add( dimUsage );
cube.setOlapDimensionUsages( dimensionUsages );
dimUsage.setName( "Dim1" );
dimUsage.setOlapDimension( dimension );
LogicalModel businessModel = TestHelper.buildDefaultModel();
LogicalTable logicalTable = businessModel.getLogicalTables().get( 0 );
hierarchy.setLogicalTable( logicalTable );
List<LogicalColumn> logicalColumns = new ArrayList<LogicalColumn>();
level.setReferenceColumn( logicalTable.getLogicalColumns().get( 0 ) );
level.setLogicalColumns( new ArrayList<LogicalColumn>() );
logicalTable.setProperty( SqlPhysicalTable.TARGET_TABLE, targetTable );
logicalTable.setProperty( SqlPhysicalTable.TARGET_SCHEMA, targetSchema );
LogicalColumn m = logicalTable.getLogicalColumns().get( 0 );
m.setAggregationType( AggregationType.SUM );
measure.setLogicalColumn( m );
businessModel.getLogicalTables().get( 0 ).setProperty( SqlPhysicalTable.TARGET_TABLE_TYPE, tableType );
cube.setLogicalTable( businessModel.getLogicalTables().get( 0 ) );
businessModel.setProperty( "olap_dimensions", dimensions );
businessModel.setProperty( "olap_cubes", cubes );
businessModel.setName( new LocalizedString( "en_US", "model" ) );
return businessModel;
}
示例6: getBasicDomain
import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
public static Domain getBasicDomain() {
String locale = LocaleHelper.getLocale().toString();
SqlPhysicalModel model = new SqlPhysicalModel();
SqlDataSource dataSource = new SqlDataSource();
dataSource.setDatabaseName( "SampleData" );
model.setDatasource( dataSource );
SqlPhysicalTable table = new SqlPhysicalTable( model );
table.setId( "PT1" );
model.getPhysicalTables().add( table );
table.setTargetTableType( TargetTableType.INLINE_SQL );
table.setTargetTable( "select * from customers" );
SqlPhysicalColumn column = new SqlPhysicalColumn( table );
column.setId( "PC1" );
column.setTargetColumn( "customername" );
column.setName( new LocalizedString( locale, "Customer Name" ) );
column.setDescription( new LocalizedString( locale, "Customer Name Desc" ) );
column.setDataType( DataType.STRING );
table.getPhysicalColumns().add( column );
LogicalModel logicalModel = new LogicalModel();
logicalModel.setId( "MODEL" );
logicalModel.setName( new LocalizedString( locale, "My Model" ) );
logicalModel.setDescription( new LocalizedString( locale, "A Description of the Model" ) );
LogicalTable logicalTable = new LogicalTable();
logicalTable.setId( "LT" );
logicalTable.setPhysicalTable( table );
logicalTable.setLogicalModel( logicalModel );
logicalModel.getLogicalTables().add( logicalTable );
LogicalColumn logicalColumn = new LogicalColumn();
logicalColumn.setId( "LC_CUSTOMERNAME" );
logicalColumn.setPhysicalColumn( column );
logicalColumn.setLogicalTable( logicalTable );
logicalTable.addLogicalColumn( logicalColumn );
Category mainCategory = new Category( logicalModel );
mainCategory.setId( "CATEGORY" );
mainCategory.setName( new LocalizedString( locale, "Category" ) );
mainCategory.addLogicalColumn( logicalColumn );
logicalModel.getCategories().add( mainCategory );
Domain domain = new Domain();
domain.setId( "DOMAIN" );
domain.addPhysicalModel( model );
domain.addLogicalModel( logicalModel );
return domain;
}
示例7: 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;
}