當前位置: 首頁>>代碼示例>>Java>>正文


Java StepMeta.getName方法代碼示例

本文整理匯總了Java中org.pentaho.di.trans.step.StepMeta.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java StepMeta.getName方法的具體用法?Java StepMeta.getName怎麽用?Java StepMeta.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.pentaho.di.trans.step.StepMeta的用法示例。


在下文中一共展示了StepMeta.getName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: tweakUnitTestStep

import org.pentaho.di.trans.step.StepMeta; //導入方法依賴的package包/類
private void tweakUnitTestStep(TransTweak stepTweak, boolean enable) {
  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 {
    TransUnitTest unitTest = getCurrentUnitTest(transMeta);
    if (unitTest==null) {
      return;
    }
    TransUnitTestTweak unitTestTweak = unitTest.findTweak(stepMeta.getName());
    if (unitTestTweak!=null) {
      unitTest.getTweaks().remove(unitTestTweak);
      stepMeta.setAttribute(DataSetConst.ATTR_GROUP_DATASET, DataSetConst.ATTR_STEP_TWEAK, null);
    }
    if (enable) {
      unitTest.getTweaks().add(new TransUnitTestTweak(stepTweak, stepMeta.getName()));
      stepMeta.setAttribute(DataSetConst.ATTR_GROUP_DATASET, DataSetConst.ATTR_STEP_TWEAK, stepTweak.name());
    }
    
    new MetaStoreFactory<TransUnitTest>(TransUnitTest.class, metaStore, PentahoDefaults.NAMESPACE)
      .saveElement(unitTest);
    
    spoon.refreshGraph();
    
  } catch(Exception exception) {
    new ErrorDialog( spoon.getShell(), "Error", "Error tweaking transformation unit test on step '"+stepMeta.getName()+"' with operation "+stepTweak.name(), exception );
  }
}
 
開發者ID:mattcasters,項目名稱:pentaho-pdi-dataset,代碼行數:38,代碼來源:DataSetHelper.java

示例2: injectDataSetIntoStep

import org.pentaho.di.trans.step.StepMeta; //導入方法依賴的package包/類
private void injectDataSetIntoStep( final Trans trans, final TransMeta transMeta,
  final String dataSetName, final MetaStoreFactory<DataSet> dataSetFactory,
  final Repository repository, final IMetaStore metaStore, final StepMeta stepMeta, 
  TransUnitTestSetLocation inputLocation ) throws MetaStoreException, KettleException {

  final DataSet dataSet = dataSetFactory.loadElement( dataSetName );
  final DataSetGroup group = dataSet.getGroup();
  final Database database = new Database( trans, group.getDatabaseMeta() );
  final LogChannelInterface log = trans.getLogChannel();
  
  final RowMetaInterface injectRowMeta = DataSetConst.getStepOutputFields(log, transMeta, stepMeta, dataSet, inputLocation);    
  final RowProducer rowProducer = trans.addRowProducer( stepMeta.getName(), 0 );

  // Look for the step into which we'll inject rows...
  //
  StepMetaDataCombi combi = null;
  for ( StepMetaDataCombi step : trans.getSteps() ) {
    if ( step.stepname.equals( stepMeta.getName() ) ) {
      combi = step;
      break;
    }
  }

  if ( combi != null ) {

    log.logBasic( "Injecting data set '" + dataSetName + "' into step '" + stepMeta.getName() + "', fields: "+injectRowMeta.toStringMeta() );
    final List<Object[]> rows = dataSet.getAllRows(log, inputLocation, injectRowMeta);
    
    // Pass rows
    try {
      Runnable runnable = new Runnable() {
        @Override
        public void run() {
          try {
            
            for( Object[] row : rows ) {
              // pass the row with the external names
              //
              rowProducer.putRow( injectRowMeta, row );                
            }
            rowProducer.finished();
            
          } catch ( Exception e ) {
            throw new RuntimeException( "Problem injecting data set '" + dataSetName + "' row into step '" + stepMeta.getName() + "'", e );
          }
        }
      };
      Thread thread = new Thread( runnable );
      thread.start();

    } finally {
      database.disconnect();
    }
  }
}
 
開發者ID:mattcasters,項目名稱:pentaho-pdi-dataset,代碼行數:56,代碼來源:InjectDataSetIntoTransExtensionPoint.java


注:本文中的org.pentaho.di.trans.step.StepMeta.getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。