本文整理匯總了Java中org.pentaho.di.trans.TransMeta.getStepFields方法的典型用法代碼示例。如果您正苦於以下問題:Java TransMeta.getStepFields方法的具體用法?Java TransMeta.getStepFields怎麽用?Java TransMeta.getStepFields使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.pentaho.di.trans.TransMeta
的用法示例。
在下文中一共展示了TransMeta.getStepFields方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDataSetFromStep
import org.pentaho.di.trans.TransMeta; //導入方法依賴的package包/類
/**
* Create a new data set with the output from
*/
public void createDataSetFromStep() {
Spoon spoon = ( (Spoon) SpoonFactory.getInstance() );
TransGraph transGraph = spoon.getActiveTransGraph();
IMetaStore metaStore = spoon.getMetaStore();
if ( transGraph == null ) {
return;
}
StepMeta stepMeta = transGraph.getCurrentStep();
TransMeta transMeta = spoon.getActiveTransformation();
if ( stepMeta == null || transMeta == null ) {
return;
}
try {
MetaStoreFactory<DataSetGroup> groupFactory = new MetaStoreFactory<DataSetGroup>( DataSetGroup.class, metaStore, PentahoDefaults.NAMESPACE );
List<DatabaseMeta> databases = getAvailableDatabases( spoon.getRepository() );
groupFactory.addNameList( DataSetConst.DATABASE_LIST_KEY, databases );
List<DataSetGroup> groups = groupFactory.getElements();
MetaStoreFactory<DataSet> setFactory = new MetaStoreFactory<DataSet>( DataSet.class, metaStore, PentahoDefaults.NAMESPACE );
setFactory.addNameList( DataSetConst.GROUP_LIST_KEY, groups );
DataSet dataSet = new DataSet();
RowMetaInterface rowMeta = transMeta.getStepFields( stepMeta );
for ( int i = 0; i < rowMeta.size(); i++ ) {
ValueMetaInterface valueMeta = rowMeta.getValueMeta( i );
DataSetField field = new DataSetField( valueMeta.getName(), "field" + i, valueMeta.getType(), valueMeta.getLength(), valueMeta.getPrecision(), valueMeta.getComments() );
dataSet.getFields().add( field );
}
editDataSet( spoon, dataSet, groups, setFactory, null );
} catch ( Exception e ) {
new ErrorDialog( spoon.getShell(), "Error", "Error creating a new data set", e );
}
}