本文整理匯總了Java中org.pentaho.di.trans.TransMeta.setName方法的典型用法代碼示例。如果您正苦於以下問題:Java TransMeta.setName方法的具體用法?Java TransMeta.setName怎麽用?Java TransMeta.setName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.pentaho.di.trans.TransMeta
的用法示例。
在下文中一共展示了TransMeta.setName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: TransformTest
import org.pentaho.di.trans.TransMeta; //導入方法依賴的package包/類
public TransformTest( int id ) throws Exception {
this.id = id;
KettleEnvironment.init();
PluginRegistry registry = PluginRegistry.getInstance();
tm = new TransMeta();
tm.setName( "TransformTest Transformation " + this.id );
// Credit Card Generator
RandomCCNumberGeneratorMeta ccardMeta = new RandomCCNumberGeneratorMeta();
String ccardId = registry.getPluginId( StepPluginType.class, ccardMeta );
String ccardName = "Generate Random Credit Cards";
StepMeta ccardStep = new StepMeta( ccardId, ccardName, ccardMeta );
ccardMeta.setCardLengthFieldName( "Card length" );
ccardMeta.setCardNumberFieldName( "Card number" );
ccardMeta.setCardTypeFieldName( "Card type" );
ccardMeta.allocate( 1 );
ccardMeta.setFieldCCType( new String[]{ "American Express" } );
//http://jira.pentaho.com/browse/PDI-13299
ccardMeta.getFieldCCLength()[0] = "15";
ccardMeta.getFieldCCSize()[0] = "10";
tm.addStep( ccardStep );
WriteToLogMeta writeLogMeta = new WriteToLogMeta();
writeLogMeta.setDefault();
String writeLogId = registry.getPluginId( StepPluginType.class, writeLogMeta );
String writeLogName = "Write to Log";
StepMeta writeLogStep = new StepMeta( writeLogId, writeLogName, writeLogMeta );
tm.addStep( writeLogStep );
// Hops
TransHopMeta hopCCardWriteLog = new TransHopMeta( ccardStep, writeLogStep );
tm.addTransHop( hopCCardWriteLog );
// Make pretty for Spoon
ccardStep.setLocation(100, 50);
writeLogStep.setLocation(200, 50);
ccardStep.setDraw(true);
writeLogStep.setDraw(true);
}
示例2: test
import org.pentaho.di.trans.TransMeta; //導入方法依賴的package包/類
/**
* Runs the transformation with the below input parameters
* @param inputData JSON string
* @param ignoreMissingPath boolean
* @param defaultPathLeafToNull boolean
* @return Transformation Results
*/
private List<RowMetaAndData> test(String inputData, boolean ignoreMissingPath, boolean defaultPathLeafToNull)
throws Exception {
KettleEnvironment.init();
// Create a new transformation
TransMeta transMeta = new TransMeta();
transMeta.setName("testFastJsonInput");
PluginRegistry registry = PluginRegistry.getInstance();
// Create Injector
String injectorStepName = "injector step";
StepMeta injectorStep = TestUtilities.createInjectorStep(injectorStepName, registry);
transMeta.addStep(injectorStep);
// Create a FastJsonInput step
String fastJsonInputName = "FastJsonInput step";
StepMeta fastJsonInputStep = createFastJsonInputStep(fastJsonInputName, registry, ignoreMissingPath,
defaultPathLeafToNull);
transMeta.addStep(fastJsonInputStep);
// TransHopMeta between injector step and FastJsonInput
TransHopMeta injector_hop_fjis = new TransHopMeta(injectorStep, fastJsonInputStep);
transMeta.addTransHop(injector_hop_fjis);
// Create a dummy step
String dummyStepName = "dummy step";
StepMeta dummyStep = TestUtilities.createDummyStep(dummyStepName, registry);
transMeta.addStep(dummyStep);
// TransHopMeta between FastJsonInput and Dummy
TransHopMeta fjis_hop_dummy = new TransHopMeta(fastJsonInputStep, dummyStep);
transMeta.addTransHop(fjis_hop_dummy);
// Execute the transformation
Trans trans = new Trans(transMeta);
trans.prepareExecution(null);
// Create a row collector and add it to the dummy step interface
StepInterface si = trans.getStepInterface(dummyStepName, 0);
RowStepCollector dummyRowCollector = new RowStepCollector();
si.addRowListener(dummyRowCollector);
// Create a row producer
RowProducer rowProducer = trans.addRowProducer(injectorStepName, 0);
trans.startThreads();
// create the rows
List<RowMetaAndData> inputList = createInputData(inputData);
for (RowMetaAndData rowMetaAndData : inputList) {
rowProducer.putRow(rowMetaAndData.getRowMeta(), rowMetaAndData.getData());
}
rowProducer.finished();
trans.waitUntilFinished();
return dummyRowCollector.getRowsWritten();
}