本文整理汇总了Java中org.pentaho.di.starmodeler.DefaultIDs类的典型用法代码示例。如果您正苦于以下问题:Java DefaultIDs类的具体用法?Java DefaultIDs怎么用?Java DefaultIDs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultIDs类属于org.pentaho.di.starmodeler包,在下文中一共展示了DefaultIDs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUniqueLogicalTables
import org.pentaho.di.starmodeler.DefaultIDs; //导入依赖的package包/类
/**
* Get a list of all unique physical table names wrapped in their logical tables
* @return
*/
protected List<LogicalTable> getUniqueLogicalTables() {
List<LogicalTable> tables = new ArrayList<LogicalTable>();
List<String> phTabs = new ArrayList<String>();
for (LogicalModel model : domain.getLogicalModels()) {
for (LogicalTable table : model.getLogicalTables()) {
String phTable = ConceptUtil.getString(table, DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME);
if (!Const.isEmpty(phTable)) {
if (!phTabs.contains(phTable)) {
phTabs.add(phTable);
tables.add(table);
}
}
}
}
return tables;
}
示例2: generateDateTransformation
import org.pentaho.di.starmodeler.DefaultIDs; //导入依赖的package包/类
private TransMeta generateDateTransformation(DatabaseMeta databaseMeta, LogicalTable logicalTable) throws KettleException {
// We actually load the transformation from a template and then slightly modify it.
//
String filename = "/org/pentaho/di/resources/Generate date dimension.ktr";
InputStream inputStream = getClass().getResourceAsStream(filename);
TransMeta transMeta = new TransMeta(inputStream, Spoon.getInstance().rep, true, new Variables(), null);
// Find the table output step and inject the target table name and database...
//
StepMeta stepMeta = transMeta.findStep("TARGET");
if (stepMeta!=null) {
TableOutputMeta meta = (TableOutputMeta) stepMeta.getStepMetaInterface();
meta.setDatabaseMeta(databaseMeta);
String phTable = ConceptUtil.getString(logicalTable, DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME);
meta.setTableName(phTable);
}
return transMeta;
}
示例3: generateTimeTransformation
import org.pentaho.di.starmodeler.DefaultIDs; //导入依赖的package包/类
private TransMeta generateTimeTransformation(DatabaseMeta databaseMeta, LogicalTable logicalTable) throws KettleException {
// We actually load the transformation from a template and then slightly modify it.
//
String filename = "/org/pentaho/di/resources/Generate time dimension.ktr";
InputStream inputStream = getClass().getResourceAsStream(filename);
TransMeta transMeta = new TransMeta(inputStream, Spoon.getInstance().rep, true, new Variables(), null);
// Find the table output step and inject the target table name and database...
//
StepMeta stepMeta = transMeta.findStep("TARGET");
if (stepMeta!=null) {
TableOutputMeta meta = (TableOutputMeta) stepMeta.getStepMetaInterface();
meta.setDatabaseMeta(databaseMeta);
String phTable = ConceptUtil.getString(logicalTable, DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME);
meta.setTableName(phTable);
}
return transMeta;
}
示例4: getUniqueLogicalTables
import org.pentaho.di.starmodeler.DefaultIDs; //导入依赖的package包/类
/**
* Get a list of all unique physical table names wrapped in their logical tables
* @return
*/
protected List<LogicalTable> getUniqueLogicalTables() {
List<LogicalTable> tables = new ArrayList<LogicalTable>();
List<String> phTabs = new ArrayList<String>();
for (LogicalModel model : domain.getLogicalModels()) {
for (LogicalTable table : model.getLogicalTables()) {
String phTable = ConceptUtil.getString(table, DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME);
if (!Utils.isEmpty(phTable)) {
if (!phTabs.contains(phTable)) {
phTabs.add(phTable);
tables.add(table);
}
}
}
}
return tables;
}
示例5: generateDateTransformation
import org.pentaho.di.starmodeler.DefaultIDs; //导入依赖的package包/类
private TransMeta generateDateTransformation(DatabaseMeta databaseMeta, LogicalTable logicalTable) throws KettleException {
// We actually load the transformation from a template and then slightly modify it.
//
String filename = "/org/pentaho/di/resources/Generate date dimension.ktr";
InputStream inputStream = getClass().getResourceAsStream(filename);
TransMeta transMeta = new TransMeta(inputStream, Spoon.getInstance().rep, true, new Variables(), null);
// Find the table output step and inject the target table name and database...
//
StepMeta stepMeta = transMeta.findStep("TARGET");
if (stepMeta!=null) {
TableOutputMeta meta = (TableOutputMeta) stepMeta.getStepMetaInterface();
meta.setDatabaseMeta(databaseMeta);
String phTable = ConceptUtil.getString(logicalTable, DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME);
meta.setTableName(phTable);
}
return transMeta;
}
示例6: generateTimeTransformation
import org.pentaho.di.starmodeler.DefaultIDs; //导入依赖的package包/类
private TransMeta generateTimeTransformation(DatabaseMeta databaseMeta, LogicalTable logicalTable) throws KettleException {
// We actually load the transformation from a template and then slightly modify it.
//
String filename = "/org/pentaho/di/resources/Generate time dimension.ktr";
InputStream inputStream = getClass().getResourceAsStream(filename);
TransMeta transMeta = new TransMeta(inputStream, Spoon.getInstance().rep, true, new Variables(), null);
// Find the table output step and inject the target table name and database...
//
StepMeta stepMeta = transMeta.findStep("TARGET");
if (stepMeta!=null) {
TableOutputMeta meta = (TableOutputMeta) stepMeta.getStepMetaInterface();
meta.setDatabaseMeta(databaseMeta);
String phTable = ConceptUtil.getString(logicalTable, DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME);
meta.setTableName(phTable);
}
return transMeta;
}
示例7: setUp
import org.pentaho.di.starmodeler.DefaultIDs; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
final StarDomain starDomain = mock( StarDomain.class );
final Domain domain = mock( Domain.class );
when( domain.getProperty( eq( DefaultIDs.DOMAIN_TARGET_DATABASE ) ) ).thenReturn( "test_domain_target_db" );
when( starDomain.getDomain() ).thenReturn( domain );
final Repository repository = mock( Repository.class );
final RepositoryDirectoryInterface targetDirectory = mock( RepositoryDirectoryInterface.class );
final DatabaseMeta meta = Mockito.mock( DatabaseMeta.class );
Mockito.when( meta.getName() ).thenReturn( "test_domain_target_db" );
final LinkedList<DatabaseMeta> databases = new LinkedList<DatabaseMeta>() {
{
add( meta );
}
};
final String locale = Locale.US.toString();
jobGenerator = new JobGenerator( starDomain, repository, targetDirectory, databases, locale );
}
示例8: testGetUniqueLogicalTables
import org.pentaho.di.starmodeler.DefaultIDs; //导入依赖的package包/类
@Test
public void testGetUniqueLogicalTables() throws Exception {
final LogicalModel logicalModel = mock( LogicalModel.class );
when( jobGenerator.domain.getLogicalModels() ).thenReturn( new LinkedList<LogicalModel>() { {
add( logicalModel );
} } );
final LogicalTable logicalTable = mock( LogicalTable.class );
when( logicalTable.getProperty( eq( DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME ) ) )
.thenReturn( "test_table_name" );
when( logicalModel.getLogicalTables() ).thenReturn( new LinkedList<LogicalTable>() { {
add( logicalTable );
} } );
final List<LogicalTable> uniqueLogicalTables = jobGenerator.getUniqueLogicalTables();
assertNotNull( uniqueLogicalTables );
assertEquals( 1, uniqueLogicalTables.size() );
assertEquals( logicalTable, uniqueLogicalTables.get( 0 ) );
}
示例9: testGenerateDimensionTransformations
import org.pentaho.di.starmodeler.DefaultIDs; //导入依赖的package包/类
@Test
public void testGenerateDimensionTransformations() throws Exception {
final LogicalModel logicalModel = mock( LogicalModel.class );
when( jobGenerator.domain.getLogicalModels() ).thenReturn( new LinkedList<LogicalModel>() { {
add( logicalModel );
} } );
final LogicalTable logicalTable = mock( LogicalTable.class );
when( logicalTable.getProperty( eq( DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME ) ) )
.thenReturn( "test_table_name" );
when( logicalModel.getLogicalTables() ).thenReturn( new LinkedList<LogicalTable>() { {
add( logicalTable );
} } );
when( logicalTable.getProperty( eq( DefaultPropertyID.TABLE_TYPE.getId() ) ) ).thenReturn( TableType.DIMENSION );
when( logicalTable.getProperty( eq( DefaultIDs.LOGICAL_TABLE_DIMENSION_TYPE ) ) ).thenReturn( DimensionType.JUNK_DIMENSION.name() );
final List<TransMeta> transMetas = jobGenerator.generateDimensionTransformations();
assertNotNull( transMetas );
assertEquals( 1, transMetas.size() );
}
示例10: findTargetDatabaseMeta
import org.pentaho.di.starmodeler.DefaultIDs; //导入依赖的package包/类
protected DatabaseMeta findTargetDatabaseMeta() throws KettleException {
String targetDbName = ConceptUtil.getString(starDomain.getDomain(), DefaultIDs.DOMAIN_TARGET_DATABASE);
if (Const.isEmpty(targetDbName)) {
throw new KettleException(BaseMessages.getString(PKG, "LogicalModelerPerspective.MessageBox.NoTargetDBSpecified.Message"));
}
DatabaseMeta databaseMeta = DatabaseMeta.findDatabase(databases, targetDbName);
if (databaseMeta==null) {
throw new KettleException(BaseMessages.getString(PKG, "LogicalModelerPerspective.MessageBox.TargetDBNotFound.Message", targetDbName));
}
return databaseMeta;
}
示例11: getValueForLogicalColumn
import org.pentaho.di.starmodeler.DefaultIDs; //导入依赖的package包/类
private ValueMetaInterface getValueForLogicalColumn(DatabaseMeta databaseMeta, LogicalColumn column) {
String columnName = ConceptUtil.getName(column, locale);
String phColumnName = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_PHYSICAL_COLUMN_NAME);
DataType columnType = column.getDataType();
String lengthString = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_LENGTH);
int length = Const.toInt(lengthString, -1);
String precisionString = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_PRECISION);
int precision = Const.toInt(precisionString, -1);
int type=ValueMetaInterface.TYPE_STRING;
switch(columnType) {
case UNKNOWN:
case URL:
case STRING: precision=-1; break;
case IMAGE:
case BINARY: type = ValueMetaInterface.TYPE_BINARY; precision=-1; break;
case BOOLEAN: type = ValueMetaInterface.TYPE_BOOLEAN; length=-1; precision=-1; break;
case DATE: type = ValueMetaInterface.TYPE_DATE; length=-1; precision=-1; break;
case NUMERIC:
if (precision<=0 && length<15) {
type = ValueMetaInterface.TYPE_INTEGER;
} else {
if (length>=15) {
type = ValueMetaInterface.TYPE_BIGNUMBER;
} else {
type = ValueMetaInterface.TYPE_NUMBER;
}
}
break;
}
ValueMetaInterface value = new ValueMeta(databaseMeta.quoteField(Const.NVL(phColumnName, columnName)), type);
value.setLength(length, precision);
return value;
}
示例12: findTargetDatabaseMeta
import org.pentaho.di.starmodeler.DefaultIDs; //导入依赖的package包/类
protected DatabaseMeta findTargetDatabaseMeta() throws KettleException {
String targetDbName = ConceptUtil.getString(starDomain.getDomain(), DefaultIDs.DOMAIN_TARGET_DATABASE);
if (Utils.isEmpty(targetDbName)) {
throw new KettleException(BaseMessages.getString(PKG, "LogicalModelerPerspective.MessageBox.NoTargetDBSpecified.Message"));
}
DatabaseMeta databaseMeta = DatabaseMeta.findDatabase(databases, targetDbName);
if (databaseMeta==null) {
throw new KettleException(BaseMessages.getString(PKG, "LogicalModelerPerspective.MessageBox.TargetDBNotFound.Message", targetDbName));
}
return databaseMeta;
}
示例13: getValueForLogicalColumn
import org.pentaho.di.starmodeler.DefaultIDs; //导入依赖的package包/类
private ValueMetaInterface getValueForLogicalColumn(DatabaseMeta databaseMeta, LogicalColumn column) {
String columnName = ConceptUtil.getName(column, locale);
String phColumnName = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_PHYSICAL_COLUMN_NAME);
DataType columnType = column.getDataType();
String lengthString = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_LENGTH);
int length = Const.toInt(lengthString, -1);
String precisionString = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_PRECISION);
int precision = Const.toInt(precisionString, -1);
int type=ValueMetaInterface.TYPE_STRING;
switch(columnType) {
case UNKNOWN:
case URL:
case STRING: precision=-1; break;
case IMAGE:
case BINARY: type = ValueMetaInterface.TYPE_BINARY; precision=-1; break;
case BOOLEAN: type = ValueMetaInterface.TYPE_BOOLEAN; length=-1; precision=-1; break;
case DATE: type = ValueMetaInterface.TYPE_DATE; length=-1; precision=-1; break;
case NUMERIC:
if (precision<=0 && length<15) {
type = ValueMetaInterface.TYPE_INTEGER;
} else {
if (length>=15) {
type = ValueMetaInterface.TYPE_BIGNUMBER;
} else {
type = ValueMetaInterface.TYPE_NUMBER;
}
}
break;
default:
break;
}
ValueMetaInterface value = new ValueMeta(databaseMeta.quoteField(Const.NVL(phColumnName, columnName)), type);
value.setLength(length, precision);
return value;
}
示例14: generatePhysicalMetadataModel
import org.pentaho.di.starmodeler.DefaultIDs; //导入依赖的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;
}
示例15: generateTableInputStepFromLogicalTable
import org.pentaho.di.starmodeler.DefaultIDs; //导入依赖的package包/类
private StepMeta generateTableInputStepFromLogicalTable(LogicalTable logicalTable) {
String name = ConceptUtil.getName(logicalTable, locale);
String description = ConceptUtil.getDescription(logicalTable, locale);
TableInputMeta meta = new TableInputMeta();
// Source database, retain first
// Source table, retain first
// Source columns, retain all
//
DatabaseMeta sourceDatabaseMeta = null;
String sourceTable = null;
List<String> sourceColumns = new ArrayList<String>();
for (LogicalColumn column : logicalTable.getLogicalColumns()) {
String phDb = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_DB);
String phTable = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_TABLE);
String phCol = ConceptUtil.getString(column, DefaultIDs.LOGICAL_COLUMN_SOURCE_COLUMN);
if (!Const.isEmpty(phDb) && sourceDatabaseMeta==null) {
sourceDatabaseMeta = DatabaseMeta.findDatabase(databases, phDb);
}
if (!Const.isEmpty(phTable)) {
sourceTable = phDb;
}
if (!Const.isEmpty(phCol)) {
sourceColumns.add(phCol);
}
}
String sql = "SELECT * FROM --< Source query for dimension '"+name+"'";
meta.setDatabaseMeta(sourceDatabaseMeta);
if (sourceDatabaseMeta!=null && !Const.isEmpty(sourceTable)) {
sql = "SELECT ";
if (sourceColumns.isEmpty()) {
sql+=" * ";
} else {
sql+=Const.CR;
}
boolean first=true;
for (String sourceColumn : sourceColumns) {
if (first) {
first=false;
} else {
sql+=" , ";
}
sql+=sourceDatabaseMeta.quoteField(sourceColumn)+Const.CR;
}
sql+="FROM "+sourceDatabaseMeta.getQuotedSchemaTableCombination(null, sourceTable);
}
meta.setSQL(sql);
// Wrap it up...
//
StepMeta stepMeta = new StepMeta("Source data for '"+name+"'", meta);
stepMeta.drawStep();
stepMeta.setDescription("Reads data for '"+name+"' : "+description);
return stepMeta;
}