本文整理汇总了Java中org.pentaho.metadata.model.LogicalModel.addLogicalTable方法的典型用法代码示例。如果您正苦于以下问题:Java LogicalModel.addLogicalTable方法的具体用法?Java LogicalModel.addLogicalTable怎么用?Java LogicalModel.addLogicalTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.metadata.model.LogicalModel
的用法示例。
在下文中一共展示了LogicalModel.addLogicalTable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: StarModelDialog
import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
public StarModelDialog(Shell parent, LogicalModel logicalModel, String locale) {
super(parent, SWT.DIALOG_TRIM);
this.logicalModel = logicalModel;
this.props = PropsUI.getInstance();
this.locale = locale;
List<LogicalTable> factTables = ConceptUtil.findLogicalTables(logicalModel, TableType.FACT);
if (factTables.isEmpty()) {
this.factTable = new LogicalTable();
this.factTable.setId(UUID.randomUUID().toString());
this.factTable.setProperty(DefaultPropertyID.TABLE_TYPE.getId(), TableType.FACT);
logicalModel.addLogicalTable(this.factTable);
} else {
this.factTable = factTables.get(0);
}
}
示例2: copyTable
import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
protected boolean copyTable(Shell shell, LogicalModel logicalModel, String tableName) {
LogicalTable originalTable = findLogicalTable(tableName);
if (originalTable!=null) {
// Copy
//
LogicalTable logicalTable = new LogicalTable();
logicalTable.setId(UUID.randomUUID().toString());
logicalTable.setName(new LocalizedString(locale, ConceptUtil.getName(originalTable, locale)+" (Copy)"));
logicalTable.setDescription(new LocalizedString(locale, ConceptUtil.getDescription(originalTable, locale)+" (Copy)"));
logicalTable.setProperty(DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME, originalTable.getProperty(DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME));
logicalTable.setProperty(DefaultPropertyID.TABLE_TYPE.getId(), originalTable.getProperty(DefaultPropertyID.TABLE_TYPE.getId()));
for (LogicalColumn column : originalTable.getLogicalColumns()) {
logicalTable.getLogicalColumns().add((LogicalColumn) column.clone());
}
DimensionTableDialog dialog = new DimensionTableDialog(shell, logicalTable, locale);
if (dialog.open()!=null) {
logicalModel.addLogicalTable(logicalTable);
return true;
}
}
return false;
}
示例3: StarModelDialog
import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
public StarModelDialog(Shell parent, LogicalModel logicalModel, String locale) {
super(parent, SWT.DIALOG_TRIM);
this.logicalModel = logicalModel;
this.props = PropsUI.getInstance();
this.locale = locale;
List<LogicalTable> factTables = ConceptUtil.findLogicalTables(logicalModel, TableType.FACT);
if (factTables.isEmpty()) {
this.factTable = new LogicalTable();
this.factTable.setId(UUID.randomUUID().toString());
this.factTable.setProperty(DefaultPropertyID.TABLE_TYPE.getId(), TableType.FACT);
logicalModel.addLogicalTable(this.factTable);
} else {
this.factTable = factTables.get(0);
}
}
示例4: copyTable
import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
protected boolean copyTable(Shell shell, LogicalModel logicalModel, String tableName) {
LogicalTable originalTable = findLogicalTable(tableName);
if (originalTable!=null) {
// Copy
//
LogicalTable logicalTable = new LogicalTable();
logicalTable.setId(UUID.randomUUID().toString());
logicalTable.setName(new LocalizedString(locale, ConceptUtil.getName(originalTable, locale)+" (Copy)"));
logicalTable.setDescription(new LocalizedString(locale, ConceptUtil.getDescription(originalTable, locale)+" (Copy)"));
logicalTable.setProperty(DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME, originalTable.getProperty(DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME));
logicalTable.setProperty(DefaultPropertyID.TABLE_TYPE.getId(), originalTable.getProperty(DefaultPropertyID.TABLE_TYPE.getId()));
for (LogicalColumn column : originalTable.getLogicalColumns()) {
logicalTable.getLogicalColumns().add((LogicalColumn) column.clone());
}
DimensionTableDialog dialog = new DimensionTableDialog(shell, logicalTable, locale);
if (dialog.open()!=null) {
logicalModel.addLogicalTable(logicalTable);
return true;
}
}
return false;
}
示例5: newTable
import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
protected boolean newTable(Shell shell, LogicalModel logicalModel) {
LogicalTable logicalTable = new LogicalTable(logicalModel, null);
logicalTable.setId(UUID.randomUUID().toString());
logicalTable.setName(new LocalizedString(locale, "New table"));
logicalTable.setDescription(new LocalizedString(locale, "New table description"));
DimensionTableDialog dialog = new DimensionTableDialog(shell, logicalTable, locale);
if (dialog.open()!=null) {
logicalModel.addLogicalTable(logicalTable);
return true;
}
return false;
}
示例6: createLogicalTable
import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
private LogicalTable createLogicalTable( String tblId, LogicalModel model, Category mainCat ) throws Exception {
LogicalTable rtn = new LogicalTable();
rtn.setId( "bt_" + tblId );
rtn.setProperty( SqlPhysicalTable.TARGET_TABLE, "pt_" + tblId ); //$NON-NLS-1$
createBusinessKeyColumn( tblId, "keya", rtn, mainCat ); // 0
createBusinessKeyColumn( tblId, "keyb", rtn, mainCat ); // 1
createBusinessKeyColumn( tblId, "keyc", rtn, mainCat ); // 2
createBusinessKeyColumn( tblId, "keyd", rtn, mainCat ); // 3
createBusinessKeyColumn( tblId, "keye", rtn, mainCat ); // 4
createBusinessKeyColumn( tblId, "keyf", rtn, mainCat ); // 5
createBusinessKeyColumn( tblId, "keyg", rtn, mainCat ); // 6
createBusinessKeyColumn( tblId, "keyh", rtn, mainCat ); // 7
createBusinessKeyColumn( tblId, "keyi", rtn, mainCat ); // 8
createBusinessKeyColumn( tblId, "keyj", rtn, mainCat ); // 9
createBusinessKeyColumn( tblId, "keyk", rtn, mainCat ); // 10
createBusinessKeyColumn( tblId, "keyl", rtn, mainCat ); // 11
LogicalColumn bcs1 = new LogicalColumn();
bcs1.setId( "bcs_" + tblId );
bcs1.setProperty( SqlPhysicalColumn.TARGET_COLUMN, "pc_" + tblId ); //$NON-NLS-1$
bcs1.setProperty( IPhysicalColumn.AGGREGATIONTYPE_PROPERTY, AggregationType.SUM );
bcs1.setLogicalTable( rtn );
rtn.addLogicalColumn( bcs1 );
mainCat.addLogicalColumn( bcs1 );
model.addLogicalTable( rtn );
return rtn;
}
示例7: newTable
import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
protected boolean newTable(Shell shell, LogicalModel logicalModel) {
LogicalTable logicalTable = new LogicalTable(logicalModel, null);
logicalTable.setId(UUID.randomUUID().toString());
logicalTable.setName(new LocalizedString(locale, "New table"));
logicalTable.setDescription(new LocalizedString(locale, "New table description"));
DimensionTableDialog dialog = new DimensionTableDialog(shell, logicalTable, locale);
if (dialog.open()!=null) {
logicalModel.addLogicalTable(logicalTable);
return true;
}
return false;
}
示例8: generateDomain
import org.pentaho.metadata.model.LogicalModel; //导入方法依赖的package包/类
public Domain generateDomain( final ImportStrategy importStrategy ) throws PentahoMetadataException {
Domain domain = new Domain();
domain.setId( modelName );
List<LocaleType> locales = new ArrayList<LocaleType>();
locales.add( new LocaleType( "en_US", "English (US)" ) ); //$NON-NLS-1$ //$NON-NLS-2$
domain.setLocales( locales );
SqlPhysicalModel physicalModel = new SqlPhysicalModel();
physicalModel.setId( databaseMeta.getName() );
physicalModel.setDatasource( ThinModelConverter.convertFromLegacy( databaseMeta ) );
Database database = database();
try {
// Add the database connection to the empty schema...
//
domain.addPhysicalModel( physicalModel );
// Also add a model with the same name as the model name...
//
String bmID = Util.getLogicalModelIdPrefix() + "_" + modelName.replaceAll( " ", "_" ).toUpperCase(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
LogicalModel logicalModel = new LogicalModel();
logicalModel.setId( bmID );
domain.addLogicalModel( logicalModel );
// Connect to the database...
//
database.connect();
// clear the cache
DBCache.getInstance().clear( databaseMeta.getName() );
for ( int i = 0; i < tableNames.length; i++ ) {
SchemaTable schemaTable = tableNames[i];
// Import the specified tables and turn them into PhysicalTable
// objects...
//
SqlPhysicalTable physicalTable =
PhysicalTableImporter.importTableDefinition( database, schemaTable.getSchemaName(), schemaTable
.getTableName(), locale, importStrategy );
physicalModel.addPhysicalTable( physicalTable );
// At the same time, we will create a business table and add that to the
// business model...
//
LogicalTable businessTable = createBusinessTable( physicalTable, locale );
logicalModel.addLogicalTable( businessTable );
}
} catch ( Exception e ) {
// For the unexpected stuff, just throw the exception upstairs.
//
throw new PentahoMetadataException( e );
} finally {
// Make sure to close the connection
//
database.disconnect();
}
return domain;
}