本文整理汇总了Java中org.pentaho.di.trans.steps.tableinput.TableInputMeta类的典型用法代码示例。如果您正苦于以下问题:Java TableInputMeta类的具体用法?Java TableInputMeta怎么用?Java TableInputMeta使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TableInputMeta类属于org.pentaho.di.trans.steps.tableinput包,在下文中一共展示了TableInputMeta类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getTableInputStep
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
private StepMeta getTableInputStep(GraphConfigurationInfo configurationInfo)
throws GraphGeneratorException {
TableInputMeta tableInput = new TableInputMeta();
tableInput.setDatabaseMeta(getDatabaseMeta(configurationInfo));
tableInput.setSQL(configurationInfo.getTableInputSqlQuery());
//
StepMeta tableInputStep =
new StepMeta(GraphGeneratorConstants.TABLE_INPUT, (StepMetaInterface) tableInput);
xAxixLocation += 120;
tableInputStep.setLocation(xAxixLocation, yAxixLocation);
//
tableInputStep.setDraw(true);
tableInputStep
.setDescription("Read Data From Fact Table: " + GraphGeneratorConstants.TABLE_INPUT);
return tableInputStep;
}
开发者ID:carbondata,项目名称:carbondata,代码行数:18,代码来源:GraphGenerator.java
示例2: getInfo
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
private void getInfo(TableInputMeta meta)
{
meta.setSQL( wSQL.getText() );
meta.setDatabaseMeta( transMeta.findDatabase(wConnection.getText()) );
meta.setRowLimit( Const.toInt(wLimit.getText(), 0) );
meta.setLookupFromStep( transMeta.findStep( wDatefrom.getText() ) );
meta.setExecuteEachInputRow(wEachRow.getSelection());
meta.setVariableReplacementActive(wVariables.getSelection());
meta.setLazyConversionActive(wLazyConversion.getSelection());
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:11,代码来源:TableInputDialog.java
示例3: preview
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
/**
* Preview the data generated by this step.
* This generates a transformation using this step & a dummy and previews it.
*
*/
private void preview()
{
// Create the table input reader step...
TableInputMeta oneMeta = new TableInputMeta();
getInfo(oneMeta);
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), Messages.getString("TableInputDialog.EnterPreviewSize"), Messages.getString("TableInputDialog.NumberOfRowsToPreview")); //$NON-NLS-1$ //$NON-NLS-2$
int previewSize = numberDialog.open();
if (previewSize>0)
{
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize } );
progressDialog.open();
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (!progressDialog.isCancelled())
{
if (trans.getResult()!=null && trans.getResult().getNrErrors()>0)
{
EnterTextDialog etd = new EnterTextDialog(shell, Messages.getString("System.Dialog.PreviewError.Title"),
Messages.getString("System.Dialog.PreviewError.Message"), loggingText, true );
etd.setReadOnly();
etd.open();
}
}
PreviewRowsDialog prd =new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
prd.open();
}
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:39,代码来源:TableInputDialog.java
示例4: getInfo
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
private void getInfo(TableInputMeta meta, boolean preview)
{
meta.setSQL(preview && !Const.isEmpty(wSQL.getSelectionText())?wSQL.getSelectionText():wSQL.getText());
meta.setDatabaseMeta( transMeta.findDatabase(wConnection.getText()) );
meta.setRowLimit( wLimit.getText() );
StreamInterface infoStream = input.getStepIOMeta().getInfoStreams().get(0);
infoStream.setStepMeta( transMeta.findStep( wDatefrom.getText() ) );
meta.setExecuteEachInputRow(wEachRow.getSelection());
meta.setVariableReplacementActive(wVariables.getSelection());
meta.setLazyConversionActive(wLazyConversion.getSelection());
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:12,代码来源:TableInputDialog.java
示例5: preview
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
/**
* Preview the data generated by this step.
* This generates a transformation using this step & a dummy and previews it.
*
*/
private void preview()
{
// Create the table input reader step...
TableInputMeta oneMeta = new TableInputMeta();
getInfo(oneMeta, true);
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "TableInputDialog.EnterPreviewSize"), BaseMessages.getString(PKG, "TableInputDialog.NumberOfRowsToPreview")); //$NON-NLS-1$ //$NON-NLS-2$
int previewSize = numberDialog.open();
if (previewSize>0)
{
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize } );
progressDialog.open();
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (!progressDialog.isCancelled())
{
if (trans.getResult()!=null && trans.getResult().getNrErrors()>0)
{
EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"),
BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true );
etd.setReadOnly();
etd.open();
}
else
{
PreviewRowsDialog prd =new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
prd.open();
}
}
}
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:42,代码来源:TableInputDialog.java
示例6: getInfo
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
private void getInfo(TableInputMeta meta, boolean preview) {
meta.setSQL(preview && !Const.isEmpty(wSQL.getSelectionText()) ? wSQL.getSelectionText() : wSQL.getText());
meta.setDatabaseMeta(transMeta.findDatabase(wConnection.getText()));
meta.setRowLimit(wLimit.getText());
StreamInterface infoStream = input.getStepIOMeta().getInfoStreams().get(0);
infoStream.setStepMeta(transMeta.findStep(wDatefrom.getText()));
meta.setExecuteEachInputRow(wEachRow.getSelection());
meta.setVariableReplacementActive(wVariables.getSelection());
meta.setLazyConversionActive(wLazyConversion.getSelection());
}
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:11,代码来源:TableInputDialog.java
示例7: preview
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
/**
* Preview the data generated by this step. This generates a transformation
* using this step & a dummy and previews it.
*
*/
private void preview() {
// Create the table input reader step...
TableInputMeta oneMeta = new TableInputMeta();
getInfo(oneMeta, true);
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "TableInputDialog.EnterPreviewSize"), BaseMessages.getString(PKG, "TableInputDialog.NumberOfRowsToPreview")); //$NON-NLS-1$ //$NON-NLS-2$
int previewSize = numberDialog.open();
if (previewSize > 0) {
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
progressDialog.open();
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (!progressDialog.isCancelled()) {
if (trans.getResult() != null && trans.getResult().getNrErrors() > 0) {
EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
etd.setReadOnly();
etd.open();
} else {
PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
prd.open();
}
}
}
}
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:35,代码来源:TableInputDialog.java
示例8: lazyConversionTurnedOff
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
@Test
public void lazyConversionTurnedOff() throws KettleException {
KettleEnvironment.init();
TransMeta transMeta = new TransMeta();
CsvInputMeta csvInputMeta = new CsvInputMeta();
csvInputMeta.setLazyConversionActive( true );
StepMeta csvInput = new StepMeta( "Csv", csvInputMeta );
transMeta.addStep( csvInput );
TableInputMeta tableInputMeta = new TableInputMeta();
tableInputMeta.setLazyConversionActive( true );
StepMeta tableInput = new StepMeta( "Table", tableInputMeta );
transMeta.addStep( tableInput );
Transformation trans = TransMetaConverter.convert( transMeta );
TransMeta cloneMeta;
String transMetaXml = (String) trans.getConfig().get( TransMetaConverter.TRANS_META_CONF_KEY );
Document doc;
try {
doc = XMLHandler.loadXMLString( transMetaXml );
Node stepNode = XMLHandler.getSubNode( doc, "transformation" );
cloneMeta = new TransMeta( stepNode, null );
} catch ( KettleXMLException | KettleMissingPluginsException e ) {
throw new RuntimeException( e );
}
assertThat( ( (CsvInputMeta) cloneMeta.findStep( "Csv" ).getStepMetaInterface() ).isLazyConversionActive(),
is( false ) );
assertThat( ( (TableInputMeta) cloneMeta.findStep( "Table" ).getStepMetaInterface() ).isLazyConversionActive(),
is( false ) );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:36,代码来源:TransMetaConverterTest.java
示例9: getInfo
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
private void getInfo( TableInputMeta meta, boolean preview ) {
meta.setSQL( preview && !Utils.isEmpty( wSQL.getSelectionText() ) ? wSQL.getSelectionText() : wSQL.getText() );
meta.setDatabaseMeta( transMeta.findDatabase( wConnection.getText() ) );
meta.setRowLimit( wLimit.getText() );
StreamInterface infoStream = input.getStepIOMeta().getInfoStreams().get( 0 );
infoStream.setStepMeta( transMeta.findStep( wDatefrom.getText() ) );
meta.setExecuteEachInputRow( wEachRow.getSelection() );
meta.setVariableReplacementActive( wVariables.getSelection() );
meta.setLazyConversionActive( wLazyConversion.getSelection() );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:11,代码来源:TableInputDialog.java
示例10: get
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
private void get()
{
Table table = wFields.table;
for (int i=0;i<transMeta.nrSteps();i++)
{
StepMeta stepMeta = transMeta.getStep(i);
String con=null;
String tab=null;
TableItem item=null;
StepMetaInterface sii = stepMeta.getStepMetaInterface();
if (sii instanceof TableInputMeta)
{
TableInputMeta tii = (TableInputMeta)stepMeta.getStepMetaInterface();
if (tii.getDatabaseMeta()==null)
{
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(Messages.getString("TransDialog.DatabaseMetaNotSet.Text"));
mb.open();
return;
}
con = tii.getDatabaseMeta().getName();
tab = getTableFromSQL(tii.getSQL());
if (tab==null) tab=stepMeta.getName();
}
if (sii instanceof DatabaseLookupMeta)
{
DatabaseLookupMeta dvli = (DatabaseLookupMeta)stepMeta.getStepMetaInterface();
con = dvli.getDatabaseMeta().getName();
tab = dvli.getTablename();
if (tab==null) tab=stepMeta.getName();
break;
}
if (tab!=null || con!=null)
{
item = new TableItem(table, SWT.NONE);
if (con!=null) item.setText(1, con);
if (tab!=null) item.setText(2, tab);
}
}
wFields.setRowNums();
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:44,代码来源:TransDialog.java
示例11: TableInputDialog
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
public TableInputDialog(Shell parent, Object in, TransMeta transMeta, String sname)
{
super(parent, (BaseStepMeta)in, transMeta, sname);
input=(TableInputMeta)in;
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:6,代码来源:TableInputDialog.java
示例12: testCombinationLookup
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
/**
* Test case for Combination lookup/update.
*/
public void testCombinationLookup() throws Exception
{
EnvUtil.environmentInit();
try
{
//
// Create a new transformation...
//
TransMeta transMeta = new TransMeta();
transMeta.setName("transname");
// Add the database connections
for (int i=0;i<databasesXML.length;i++)
{
DatabaseMeta databaseMeta = new DatabaseMeta(databasesXML[i]);
transMeta.addDatabase(databaseMeta);
}
DatabaseMeta lookupDBInfo = transMeta.findDatabase("lookup");
// Execute our setup SQLs in the database.
Database lookupDatabase = new Database(lookupDBInfo);
lookupDatabase.connect();
createTables(lookupDatabase);
createData(lookupDatabase);
StepLoader steploader = StepLoader.getInstance();
//
// create the source step...
//
String fromstepname = "read from [" + source_table + "]";
TableInputMeta tii = new TableInputMeta();
tii.setDatabaseMeta(transMeta.findDatabase("lookup"));
String selectSQL = "SELECT "+Const.CR;
selectSQL+="DLR_CD, DLR_NM, DLR_DESC ";
selectSQL+="FROM " + source_table + " ORDER BY ORDNO;";
tii.setSQL(selectSQL);
String fromstepid = steploader.getStepPluginID(tii);
StepMeta fromstep = new StepMeta(fromstepid, fromstepname, (StepMetaInterface) tii);
fromstep.setLocation(150, 100);
fromstep.setDraw(true);
fromstep.setDescription("Reads information from table [" + source_table + "] on database [" + lookupDBInfo + "]");
transMeta.addStep(fromstep);
//
// create the combination lookup/update step...
//
String lookupstepname = "lookup from [lookup]";
CombinationLookupMeta clm = new CombinationLookupMeta();
String lookupKey[] = { "DLR_CD" };
clm.setTablename(target_table);
clm.setKeyField(lookupKey);
clm.setKeyLookup(lookupKey);
clm.setTechnicalKeyField("ID");
clm.setTechKeyCreation(CombinationLookupMeta.CREATION_METHOD_TABLEMAX);
clm.setDatabaseMeta(lookupDBInfo);
String lookupstepid = steploader.getStepPluginID(clm);
StepMeta lookupstep = new StepMeta(lookupstepid, lookupstepname, (StepMetaInterface) clm);
lookupstep.setDescription("Looks up information from table [lookup] on database [" + lookupDBInfo + "]");
transMeta.addStep(lookupstep);
TransHopMeta hi = new TransHopMeta(fromstep, lookupstep);
transMeta.addTransHop(hi);
// Now execute the transformation...
Trans trans = new Trans(transMeta);
trans.execute(null);
trans.waitUntilFinished();
checkResults(lookupDatabase);
}
finally {}
}
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:81,代码来源:CombinationLookupTest.java
示例13: get
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
private void get()
{
Table table = wFields.table;
for (int i=0;i<transMeta.nrSteps();i++)
{
StepMeta stepMeta = transMeta.getStep(i);
String con=null;
String tab=null;
TableItem item=null;
StepMetaInterface sii = stepMeta.getStepMetaInterface();
if (sii instanceof TableInputMeta)
{
TableInputMeta tii = (TableInputMeta)stepMeta.getStepMetaInterface();
if (tii.getDatabaseMeta()==null)
{
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "TransDialog.DatabaseMetaNotSet.Text"));
mb.open();
return;
}
con = tii.getDatabaseMeta().getName();
tab = getTableFromSQL(tii.getSQL());
if (tab==null) tab=stepMeta.getName();
}
if (sii instanceof DatabaseLookupMeta)
{
DatabaseLookupMeta dvli = (DatabaseLookupMeta)stepMeta.getStepMetaInterface();
con = dvli.getDatabaseMeta().getName();
tab = dvli.getTablename();
if (tab==null) tab=stepMeta.getName();
break;
}
if (tab!=null || con!=null)
{
item = new TableItem(table, SWT.NONE);
if (con!=null) item.setText(1, con);
if (tab!=null) item.setText(2, tab);
}
}
wFields.setRowNums();
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:44,代码来源:TransDialog.java
示例14: testCombinationLookup
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
/**
* Test case for Combination lookup/update.
*/
public void testCombinationLookup() throws Exception
{
KettleEnvironment.init();
try
{
//
// Create a new transformation...
//
TransMeta transMeta = new TransMeta();
transMeta.setName("transname");
// Add the database connections
for (int i=0;i<databasesXML.length;i++)
{
DatabaseMeta databaseMeta = new DatabaseMeta(databasesXML[i]);
transMeta.addDatabase(databaseMeta);
}
DatabaseMeta lookupDBInfo = transMeta.findDatabase("lookup");
// Execute our setup SQLs in the database.
Database lookupDatabase = new Database(transMeta, lookupDBInfo);
lookupDatabase.connect();
createTables(lookupDatabase);
createData(lookupDatabase);
PluginRegistry registry = PluginRegistry.getInstance();
//
// create the source step...
//
String fromstepname = "read from [" + source_table + "]";
TableInputMeta tii = new TableInputMeta();
tii.setDatabaseMeta(transMeta.findDatabase("lookup"));
String selectSQL = "SELECT "+Const.CR;
selectSQL+="DLR_CD, DLR_NM, DLR_DESC ";
selectSQL+="FROM " + source_table + " ORDER BY ORDNO;";
tii.setSQL(selectSQL);
String fromstepid = registry.getPluginId(StepPluginType.class, tii);
StepMeta fromstep = new StepMeta(fromstepid, fromstepname, (StepMetaInterface) tii);
fromstep.setLocation(150, 100);
fromstep.setDraw(true);
fromstep.setDescription("Reads information from table [" + source_table + "] on database [" + lookupDBInfo + "]");
transMeta.addStep(fromstep);
//
// create the combination lookup/update step...
//
String lookupstepname = "lookup from [lookup]";
CombinationLookupMeta clm = new CombinationLookupMeta();
String lookupKey[] = { "DLR_CD" };
clm.setTablename(target_table);
clm.setKeyField(lookupKey);
clm.setKeyLookup(lookupKey);
clm.setTechnicalKeyField("ID");
clm.setTechKeyCreation(CombinationLookupMeta.CREATION_METHOD_TABLEMAX);
clm.setDatabaseMeta(lookupDBInfo);
String lookupstepid = registry.getPluginId(StepPluginType.class, clm);
StepMeta lookupstep = new StepMeta(lookupstepid, lookupstepname, (StepMetaInterface) clm);
lookupstep.setDescription("Looks up information from table [lookup] on database [" + lookupDBInfo + "]");
transMeta.addStep(lookupstep);
TransHopMeta hi = new TransHopMeta(fromstep, lookupstep);
transMeta.addTransHop(hi);
// Now execute the transformation...
Trans trans = new Trans(transMeta);
trans.execute(null);
trans.waitUntilFinished();
checkResults(lookupDatabase);
}
finally {}
}
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:82,代码来源:CombinationLookupTest.java
示例15: generateDimensionTransformation
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
/**
* Generates a template
* @param databaseMeta
* @param logicalModel
* @return
*/
public TransMeta generateDimensionTransformation(DatabaseMeta databaseMeta, LogicalTable logicalTable) {
TransMeta transMeta = new TransMeta();
String tableName = ConceptUtil.getName(logicalTable, locale);
String tableDescription = ConceptUtil.getDescription(logicalTable, locale);
DimensionType dimensionType = ConceptUtil.getDimensionType(logicalTable);
transMeta.setName("Update dimension '"+tableName+"'");
transMeta.setDescription(tableDescription);
// Let's not forget to add the target database
//
transMeta.addDatabase(databaseMeta);
Point location = new Point(GRAPH_LEFT, GRAPH_TOP);
// Find all the source columns and source tables and put them into a table input step...
//
StepMeta inputStep = generateTableInputStepFromLogicalTable(logicalTable);
DatabaseMeta sourceDatabaseMeta = ((TableInputMeta)inputStep.getStepMetaInterface()).getDatabaseMeta();
if (sourceDatabaseMeta!=null) transMeta.addOrReplaceDatabase(sourceDatabaseMeta);
inputStep.setLocation(location.x, location.y);
nextLocation(location);
transMeta.addStep(inputStep);
StepMeta lastStep = inputStep;
// Generate an dimension lookup/update step for each table
//
StepMeta dimensionStep;
if (dimensionType==DimensionType.SLOWLY_CHANGING_DIMENSION) {
dimensionStep = generateDimensionLookupStepFromLogicalTable(databaseMeta, logicalTable);
} else {
dimensionStep = generateCombinationLookupStepFromLogicalTable(databaseMeta, logicalTable);
}
dimensionStep.setLocation(location.x, location.y);
nextLocation(location);
transMeta.addStep(dimensionStep);
TransHopMeta transHop = new TransHopMeta(lastStep, dimensionStep);
transMeta.addTransHop(transHop);
return transMeta;
}
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:50,代码来源:JobGenerator.java
示例16: generateTableInputStepFromLogicalTable
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的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;
}
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:61,代码来源:JobGenerator.java
示例17: testCombinationLookup
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
/**
* Test case for Combination lookup/update.
*/
public void testCombinationLookup() throws Exception {
//
// Create a new transformation...
//
TransMeta transMeta = new TransMeta();
transMeta.setName( "transname" );
// Add the database connections
for ( int i = 0; i < databasesXML.length; i++ ) {
DatabaseMeta databaseMeta = new DatabaseMeta( databasesXML[i] );
transMeta.addDatabase( databaseMeta );
}
DatabaseMeta lookupDBInfo = transMeta.findDatabase( "lookup" );
// Execute our setup SQLs in the database.
Database lookupDatabase = new Database( transMeta, lookupDBInfo );
lookupDatabase.connect();
createTables( lookupDatabase );
createData( lookupDatabase );
PluginRegistry registry = PluginRegistry.getInstance();
//
// create the source step...
//
String fromstepname = "read from [" + source_table + "]";
TableInputMeta tii = new TableInputMeta();
tii.setDatabaseMeta( transMeta.findDatabase( "lookup" ) );
String selectSQL = "SELECT " + Const.CR;
selectSQL += "DLR_CD, DLR_NM, DLR_DESC ";
selectSQL += "FROM " + source_table + " ORDER BY ORDNO;";
tii.setSQL( selectSQL );
String fromstepid = registry.getPluginId( StepPluginType.class, tii );
StepMeta fromstep = new StepMeta( fromstepid, fromstepname, tii );
fromstep.setLocation( 150, 100 );
fromstep.setDraw( true );
fromstep.setDescription( "Reads information from table ["
+ source_table + "] on database [" + lookupDBInfo + "]" );
transMeta.addStep( fromstep );
//
// create the combination lookup/update step...
//
String lookupstepname = "lookup from [lookup]";
CombinationLookupMeta clm = new CombinationLookupMeta();
String[] lookupKey = { "DLR_CD" };
clm.setTablename( target_table );
clm.setKeyField( lookupKey );
clm.setKeyLookup( lookupKey );
clm.setTechnicalKeyField( "ID" );
clm.setTechKeyCreation( CombinationLookupMeta.CREATION_METHOD_TABLEMAX );
clm.setDatabaseMeta( lookupDBInfo );
String lookupstepid = registry.getPluginId( StepPluginType.class, clm );
StepMeta lookupstep = new StepMeta( lookupstepid, lookupstepname, clm );
lookupstep.setDescription( "Looks up information from table [lookup] on database [" + lookupDBInfo + "]" );
transMeta.addStep( lookupstep );
TransHopMeta hi = new TransHopMeta( fromstep, lookupstep );
transMeta.addTransHop( hi );
// Now execute the transformation...
Trans trans = new Trans( transMeta );
trans.execute( null );
trans.waitUntilFinished();
checkResults( lookupDatabase );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:75,代码来源:CombinationLookupIT.java
示例18: disableLazyConversion
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
private static void disableLazyConversion( TransMeta transMeta ) {
transMeta.getSteps().stream().filter( step -> "CsvInput".equals( step.getStepID() ) )
.forEach( step -> ( (CsvInputMeta) step.getStepMetaInterface() ).setLazyConversionActive( false ) );
transMeta.getSteps().stream().filter( step -> "TableInput".equals( step.getStepID() ) )
.forEach( step -> ( (TableInputMeta) step.getStepMetaInterface() ).setLazyConversionActive( false ) );
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:7,代码来源:TransMetaConverter.java
示例19: get
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
private void get() {
Table table = wFields.table;
for ( int i = 0; i < transMeta.nrSteps(); i++ ) {
StepMeta stepMeta = transMeta.getStep( i );
String con = null;
String tab = null;
TableItem item = null;
StepMetaInterface sii = stepMeta.getStepMetaInterface();
if ( sii instanceof TableInputMeta ) {
TableInputMeta tii = (TableInputMeta) stepMeta.getStepMetaInterface();
if ( tii.getDatabaseMeta() == null ) {
MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
mb.setMessage( BaseMessages.getString( PKG, "TransDialog.DatabaseMetaNotSet.Text" ) );
mb.open();
return;
}
con = tii.getDatabaseMeta().getName();
tab = getTableFromSQL( tii.getSQL() );
if ( tab == null ) {
tab = stepMeta.getName();
}
}
if ( sii instanceof DatabaseLookupMeta ) {
DatabaseLookupMeta dvli = (DatabaseLookupMeta) stepMeta.getStepMetaInterface();
con = dvli.getDatabaseMeta().getName();
tab = dvli.getTablename();
if ( tab == null ) {
tab = stepMeta.getName();
}
break;
}
if ( tab != null || con != null ) {
item = new TableItem( table, SWT.NONE );
if ( con != null ) {
item.setText( 1, con );
}
if ( tab != null ) {
item.setText( 2, tab );
}
}
}
wFields.setRowNums();
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:46,代码来源:TransDialog.java
示例20: TableInputDialog
import org.pentaho.di.trans.steps.tableinput.TableInputMeta; //导入依赖的package包/类
public TableInputDialog( Shell parent, Object in, TransMeta transMeta, String sname ) {
super( parent, (BaseStepMeta) in, transMeta, sname );
input = (TableInputMeta) in;
}
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:5,代码来源:TableInputDialog.java
注:本文中的org.pentaho.di.trans.steps.tableinput.TableInputMeta类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论