当前位置: 首页>>代码示例>>Java>>正文


Java Spoon.getActiveTransGraph方法代码示例

本文整理汇总了Java中org.pentaho.di.ui.spoon.Spoon.getActiveTransGraph方法的典型用法代码示例。如果您正苦于以下问题:Java Spoon.getActiveTransGraph方法的具体用法?Java Spoon.getActiveTransGraph怎么用?Java Spoon.getActiveTransGraph使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pentaho.di.ui.spoon.Spoon的用法示例。


在下文中一共展示了Spoon.getActiveTransGraph方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: detachUnitTest

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public void detachUnitTest() {
  Spoon spoon = ( (Spoon) SpoonFactory.getInstance() );
  try {
    TransGraph transGraph = spoon.getActiveTransGraph();
    if ( transGraph == null ) {
      return;
    }
    TransMeta transMeta = spoon.getActiveTransformation();
    if (transMeta == null ) {
      return;
    }

    transMeta.setAttribute( DataSetConst.ATTR_GROUP_DATASET, DataSetConst.ATTR_TRANS_SELECTED_UNIT_TEST_NAME, null );
    transMeta.setChanged();
    
    DataSetConst.clearStepDataSetIndicators( transMeta );
    
    spoon.refreshGraph();
  } catch ( Exception e ) {
    new ErrorDialog( spoon.getShell(), "Error", "Error detaching unit test", e );
  }
}
 
开发者ID:mattcasters,项目名称:pentaho-pdi-dataset,代码行数:23,代码来源:DataSetHelper.java

示例2: clearInputDataSet

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public void clearInputDataSet() {
  Spoon spoon = ( (Spoon) SpoonFactory.getInstance() );
  TransGraph transGraph = spoon.getActiveTransGraph();
  TransMeta transMeta = spoon.getActiveTransformation();
  StepMeta stepMeta = transGraph.getCurrentStep();
  if ( transGraph == null || transMeta == null || stepMeta == null ) {
    return;
  }

  stepMeta.setAttribute( DataSetConst.ATTR_GROUP_DATASET, DataSetConst.ATTR_STEP_DATASET_INPUT, null );
  transGraph.redraw();
}
 
开发者ID:mattcasters,项目名称:pentaho-pdi-dataset,代码行数:13,代码来源:DataSetHelper.java

示例3: clearGoldenDataSet

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public void clearGoldenDataSet() {
  Spoon spoon = ( (Spoon) SpoonFactory.getInstance() );
  TransGraph transGraph = spoon.getActiveTransGraph();
  TransMeta transMeta = spoon.getActiveTransformation();
  StepMeta stepMeta = transGraph.getCurrentStep();
  if ( transGraph == null || transMeta == null || stepMeta == null ) {
    return;
  }

  stepMeta.setAttribute( DataSetConst.ATTR_GROUP_DATASET, DataSetConst.ATTR_STEP_DATASET_GOLDEN, null );
  transGraph.redraw();
}
 
开发者ID:mattcasters,项目名称:pentaho-pdi-dataset,代码行数:13,代码来源:DataSetHelper.java

示例4: createDataSetFromStep

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的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 );
  }
}
 
开发者ID:mattcasters,项目名称:pentaho-pdi-dataset,代码行数:40,代码来源:DataSetHelper.java

示例5: selectUnitTest

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public void selectUnitTest() {
  
  Spoon spoon = ( (Spoon) SpoonFactory.getInstance() );
  try {
    TransGraph transGraph = spoon.getActiveTransGraph();
    IMetaStore metaStore = spoon.getMetaStore();
    if ( transGraph == null ) {
      return;
    }
    TransMeta transMeta = spoon.getActiveTransformation();
    if ( transMeta == null ) {
      return;
    }

    MetaStoreFactory<TransUnitTest> testFactory = new MetaStoreFactory<TransUnitTest>( TransUnitTest.class, metaStore, PentahoDefaults.NAMESPACE);
    List<String> testNames = testFactory.getElementNames();
    String[] names = testNames.toArray( new String[testNames.size()] );
    Arrays.sort( names );
    EnterSelectionDialog esd = new EnterSelectionDialog( spoon.getShell(), names, "Select a unit test", "Select the unit test to use" );
    String testName = esd.open();
    if ( testName != null ) {
      
      TransUnitTest unitTest = testFactory.loadElement( testName );
      if (unitTest==null) {
        throw new KettleException( "Unit test '"+testName+"' could not be found (deleted)?" );
      }

      selectUnitTest(transMeta, unitTest);
      Spoon.getInstance().refreshGraph();
    }
  } catch ( Exception e ) {
    new ErrorDialog( spoon.getShell(), "Error", "Error selecting a new transformation unit test", e );
  }
}
 
开发者ID:mattcasters,项目名称:pentaho-pdi-dataset,代码行数:35,代码来源:DataSetHelper.java

示例6: tweakUnitTestStep

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的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

示例7: getCurrentStep

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public static StepMeta getCurrentStep() {
    Spoon spoon = ((Spoon) SpoonFactory.getInstance());
    TransMeta transMeta = spoon.getActiveTransformation();
    if (transMeta == null || spoon.getActiveTransGraph() == null) {
        return null;
    }
    StepMeta stepMeta = spoon.getActiveTransGraph().getCurrentStep();
    return stepMeta;
}
 
开发者ID:datacleaner,项目名称:pdi-datacleaner,代码行数:10,代码来源:ModelerHelper.java

示例8: getCurrentStepMeta

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
/**
 * Get the current step from the transformation graph if it is currently "active".
 *
 * @param spoon Spoon instance to get look up current step from
 * @return Current step if the transformation graph is active
 */
protected static StepMeta getCurrentStepMeta(Spoon spoon) {
  if (spoon.getActiveTransGraph() == null) {
    return null;
  }
  return spoon.getActiveTransGraph().getCurrentStep();
}
 
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:13,代码来源:ModelerHelper.java

示例9: createUnitTest

import org.pentaho.di.ui.spoon.Spoon; //导入方法依赖的package包/类
public void createUnitTest() {
  Spoon spoon = ( (Spoon) SpoonFactory.getInstance() );
  Repository repository = spoon.getRepository();
  try {
    TransGraph transGraph = spoon.getActiveTransGraph();
    IMetaStore metaStore = spoon.getMetaStore();
    if ( transGraph == null ) {
      return;
    }
    TransMeta transMeta = transGraph.getTransMeta();
    
    EnterStringDialog stringDialog = new EnterStringDialog( spoon.getShell(), "", "Enter unit test name", "Unit test name: " );
    String testName = stringDialog.open();
    if (testName==null) {
      return;
    }
    
    MetaStoreFactory<TransUnitTest> testFactory = new MetaStoreFactory<TransUnitTest>( TransUnitTest.class, metaStore, PentahoDefaults.NAMESPACE);
    if (testFactory.loadElement( testName )!=null) {
      MessageBox box = new MessageBox( spoon.getShell(), SWT.YES | SWT.NO  );
      box.setText( "A test with that name exists" );
      box.setMessage( "A test with that name already exists.  Would you like to use and edit this test in this transformation?" );
      int answer = box.open();
      if ((answer&SWT.YES)!=0) {
        transMeta.setAttribute( DataSetConst.ATTR_GROUP_DATASET, DataSetConst.ATTR_TRANS_SELECTED_UNIT_TEST_NAME, testName );
        transGraph.redraw();
      }
      return;
    }
    
    TransUnitTest test = new TransUnitTest();
    test.setName( testName );
    
    if ( repository != null ) {
      test.setTransRepositoryPath( transMeta.getRepositoryDirectory().getPath() + RepositoryDirectory.DIRECTORY_SEPARATOR + transMeta.getName() );
      if ( repository.getRepositoryMeta().getRepositoryCapabilities().supportsReferences() ) {
        test.setTransObjectId( transMeta.getObjectId().toString() );
      } else {
        test.setTransRepositoryPath( transMeta.getRepositoryDirectory().getPath() + "/" + transMeta.getName() );
      }
    } else {
      test.setTransFilename( transMeta.getFilename() );
    }

    testFactory.saveElement( test );
    transMeta.setAttribute( DataSetConst.ATTR_GROUP_DATASET, DataSetConst.ATTR_TRANS_SELECTED_UNIT_TEST_NAME, testName );
    
    // Don't carry on old indicators...
    //
    DataSetConst.clearStepDataSetIndicators( transMeta );
    
    spoon.refreshGraph();
    
  } catch ( Exception e ) {
    new ErrorDialog( spoon.getShell(), "Error", "Error creating a new transformation unit test", e );
  }
}
 
开发者ID:mattcasters,项目名称:pentaho-pdi-dataset,代码行数:58,代码来源:DataSetHelper.java


注:本文中的org.pentaho.di.ui.spoon.Spoon.getActiveTransGraph方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。