org.pentaho.di.trans.TransMeta Java Examples

The following examples show how to use org.pentaho.di.trans.TransMeta. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: pentaho-kettle   Author: pentaho   File: SimpleMappingDialog.java    License: Apache License 2.0 6 votes vote down vote up
public static String[] getMappingSteps( TransMeta mappingTransMeta, boolean mappingInput ) {
  List<StepMeta> steps = new ArrayList<StepMeta>();
  for ( StepMeta stepMeta : mappingTransMeta.getSteps() ) {
    if ( mappingInput && stepMeta.getStepID().equals( "MappingInput" ) ) {
      steps.add( stepMeta );
    }
    if ( !mappingInput && stepMeta.getStepID().equals( "MappingOutput" ) ) {
      steps.add( stepMeta );
    }
  }
  String[] stepnames = new String[ steps.size() ];
  for ( int i = 0; i < stepnames.length; i++ ) {
    stepnames[ i ] = steps.get( i ).getName();
  }

  return stepnames;

}
 
Example #2
Source Project: kettle-beam   Author: mattcasters   File: RunBeamTransExecutionPoint.java    License: Apache License 2.0 6 votes vote down vote up
private TransMeta copyCleanTransMeta( TransMeta transMeta, Repository repository, IMetaStore metaStore, VariableSpace space ) throws KettleException {

    try {
      String transMetaXml = transMeta.getXML();
      TransMeta copy = new TransMeta();
      copy.setMetaStore( metaStore );
      copy.loadXML( XMLHandler.loadXMLString( transMetaXml, TransMeta.XML_TAG ), null, metaStore, repository, true, space, null );

      for ( StepMeta stepMeta : copy.getSteps() ) {
        stepMeta.setCopies( 1 );

        DummyTransMeta dummyTransMeta = new DummyTransMeta();

        // Replace all stepMeta with a Dummy with the same name
        //
        stepMeta.setStepID( "Dummy" );
        stepMeta.setStepMetaInterface( dummyTransMeta );
      }

      return copy;

    } catch ( Exception e ) {
      throw new KettleException( "Error copying/cleaning transformation metadata", e );
    }
  }
 
Example #3
Source Project: pentaho-kettle   Author: pentaho   File: ValidatorDialog.java    License: Apache License 2.0 6 votes vote down vote up
public ValidatorDialog( Shell parent, Object in, TransMeta tr, String sname ) {
  super( parent, (BaseStepMeta) in, tr, sname );
  input = (ValidatorMeta) in;

  // Just to make sure everything is nicely in sync...
  //
  java.util.List<StreamInterface> infoStreams = input.getStepIOMeta().getInfoStreams();
  for ( int i = 0; i < infoStreams.size(); i++ ) {
    input.getValidations().get( i ).setSourcingStepName( infoStreams.get( i ).getStepname() );
  }

  selectedField = null;
  selectionList = new ArrayList<Validation>();

  // Copy the data from the input into the map...
  //
  for ( Validation field : input.getValidations() ) {
    selectionList.add( field.clone() );
  }
}
 
Example #4
Source Project: pentaho-kettle   Author: pentaho   File: CsvInputFileEncodingTransformIT.java    License: Apache License 2.0 6 votes vote down vote up
@Before
protected void setUp() throws Exception {
  super.setUp();
  KettleEnvironment.init();

  //
  // Create a new transformation...
  //
  transMeta = new TransMeta();
  transMeta.setName( "csvinput1" );

  registry = PluginRegistry.getInstance();

  fileName = writeInputFile();

  injectorStep = createInjectorStep( transMeta, registry );
  csvInputStep = createCsvInputStep( transMeta, registry, "\"", false );
}
 
Example #5
Source Project: pentaho-kettle   Author: pentaho   File: LoadSaveBase.java    License: Apache License 2.0 6 votes vote down vote up
public T createMeta() {
  try {
    T meta = clazz.newInstance();
    if ( meta instanceof BaseStepMeta ) {
      StepMeta mockParentStepMeta = mock( StepMeta.class );
      ( (BaseStepMeta) meta ).setParentStepMeta( mockParentStepMeta );
      TransMeta mockTransMeta = mock( TransMeta.class );
      NamedClusterEmbedManager embedManager = mock( NamedClusterEmbedManager.class );
      when( mockParentStepMeta.getParentTransMeta() ).thenReturn( mockTransMeta );
      when( mockTransMeta.getNamedClusterEmbedManager() ).thenReturn( embedManager );
    }
    return meta;
  } catch ( Exception e ) {
    throw new RuntimeException( "Unable to create meta of class " + clazz.getCanonicalName(), e );
  }
}
 
Example #6
Source Project: pentaho-kettle   Author: pentaho   File: IngresVectorwiseLoaderDialog.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * @param parent
 * @param in
 * @param tr
 * @param sname
 */
public IngresVectorwiseLoaderDialog( Shell parent, Object in, TransMeta tr, String sname ) {
  super( parent, (BaseStepMeta) in, tr, sname );
  input = (IngresVectorwiseLoaderMeta) in;

  lsMod = new ModifyListener() {
    public void modifyText( ModifyEvent e ) {
      input.setChanged();
    }
  };

  lsSelMod = new SelectionAdapter() {
    public void widgetSelected( SelectionEvent arg0 ) {
      input.setChanged();
    }
  };
}
 
Example #7
Source Project: pentaho-kettle   Author: pentaho   File: MappingInputFieldsTest.java    License: Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {
  meta = new MappingInputMeta();
  meta.setFieldName( new String[] { "n2", "n4" } );
  meta.setFieldType( new int[] { ValueMetaInterface.TYPE_INTEGER, ValueMetaInterface.TYPE_INTEGER } );
  meta.setFieldLength( new int[] { 0, 0 } );
  meta.setFieldPrecision( new int[] { 0, 0 } );

  StepMeta sm = new StepMeta( "MappingInput", "SubTrans", meta );
  TransMeta tm = new TransMeta();
  tm.addStep( sm );
  LoggingObjectInterface loi = new SimpleLoggingObject( "lo", LoggingObjectType.STEP, null );
  Trans tr = new Trans( tm, loi );

  step = new MappingInput( sm, null, 0, tm, tr );
  step.getTrans().setRunning( true );
}
 
Example #8
Source Project: pentaho-kettle   Author: pentaho   File: StreamToTransNodeConverter.java    License: Apache License 2.0 5 votes vote down vote up
@VisibleForTesting
TransMeta filterPrivateDatabases( TransMeta transMeta ) {
  Set<String> privateDatabases = transMeta.getPrivateDatabases();
  if ( privateDatabases != null ) {
    // keep only private transformation databases
    for ( Iterator<DatabaseMeta> it = transMeta.getDatabases().iterator(); it.hasNext(); ) {
      DatabaseMeta databaseMeta = it.next();
      String databaseName = databaseMeta.getName();
      if ( !privateDatabases.contains( databaseName ) && !transMeta.isDatabaseConnectionUsed( databaseMeta ) ) {
        it.remove();
      }
    }
  }
  return transMeta;
}
 
Example #9
Source Project: pentaho-kettle   Author: pentaho   File: SharedObjectSyncUtilTest.java    License: Apache License 2.0 5 votes vote down vote up
private TransMeta createTransMeta() throws KettleException {
  TransMeta transMeta = new TransMeta();
  transMeta.setName( UUID.randomUUID().toString() );
  transMeta.setFilename( UUID.randomUUID().toString() );
  RepositoryDirectory repositoryDirectory = mock( RepositoryDirectory.class );
  doCallRealMethod().when( repositoryDirectory ).setName( anyString() );
  doCallRealMethod().when( repositoryDirectory ).getName();
  transMeta.setRepositoryDirectory( repositoryDirectory );
  initSharedObjects( transMeta, SHARED_OBJECTS_FILE );
  when( spoon.getActiveMeta() ).thenReturn( transMeta );
  return transMeta;
}
 
Example #10
Source Project: pentaho-kettle   Author: pentaho   File: SpoonPartitionsDelegate.java    License: Apache License 2.0 5 votes vote down vote up
public void newPartitioningSchema( TransMeta transMeta ) {
  PartitionSchema partitionSchema = new PartitionSchema();

  PartitionSchemaDialog dialog =
      new PartitionSchemaDialog( spoon.getShell(), partitionSchema, transMeta.getPartitionSchemas(), transMeta
          .getDatabases(), transMeta );
  if ( dialog.open() ) {
    List<PartitionSchema> partitions = transMeta.getPartitionSchemas();
    if ( isDuplicate( partitions, partitionSchema ) ) {
      new ErrorDialog(
        spoon.getShell(), getMessage( "Spoon.Dialog.ErrorSavingPartition.Title" ), getMessage(
        "Spoon.Dialog.ErrorSavingPartition.Message", partitionSchema.getName() ),
        new KettleException( getMessage( "Spoon.Dialog.ErrorSavingPartition.NotUnique" ) ) );
      return;
    }

    partitions.add( partitionSchema );

    if ( spoon.rep != null ) {
      try {
        if ( !spoon.rep.getSecurityProvider().isReadOnly() ) {
          spoon.rep.save( partitionSchema, Const.VERSION_COMMENT_INITIAL_VERSION, null );
          if ( sharedObjectSyncUtil != null ) {
            sharedObjectSyncUtil.reloadTransformationRepositoryObjects( false );
          }
        } else {
          throw new KettleException( BaseMessages.getString(
            PKG, "Spoon.Dialog.Exception.ReadOnlyRepositoryUser" ) );
        }
      } catch ( KettleException e ) {
        showSaveErrorDialog( partitionSchema, e );
      }
    }

    refreshTree();
  }
}
 
Example #11
Source Project: pentaho-kettle   Author: pentaho   File: SpoonTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testTransToXMLFileSaveFileAsFailed() throws Exception {
  TransMeta mockTransMeta = mock( TransMeta.class );

  //passing a invalid type so not running GUIResource class
  prepareSetSaveTests( spoon, log, mockSpoonPerspective, mockTransMeta, true, true, "NotMainSpoonPerspective", true,
      false, "Invalid TYPE", null, true, true );

  doCallRealMethod().when( spoon ).saveFileAs( mockTransMeta );
  assertFalse( spoon.saveFileAs( mockTransMeta ) );
  verify( mockTransMeta ).setRepository( spoon.rep );
  verify( mockTransMeta ).setMetaStore( spoon.metaStore );

  verify( spoon ).enableMenus();
}
 
Example #12
Source Project: pentaho-kettle   Author: pentaho   File: MetaInject.java    License: Apache License 2.0 5 votes vote down vote up
private static Set<String> getUsedStepsForReferencendTransformation( TransMeta transMeta ) {
  Set<String> usedStepNames = new HashSet<String>();
  for ( StepMeta currentStep : transMeta.getUsedSteps() ) {
    usedStepNames.add( currentStep.getName().toUpperCase() );
  }
  return usedStepNames;
}
 
Example #13
Source Project: kettle-beam   Author: mattcasters   File: TransMetaPipelineConverter.java    License: Apache License 2.0 5 votes vote down vote up
public TransMetaPipelineConverter( TransMeta transMeta, IMetaStore metaStore, List<String> stepPluginClasses, List<String> xpPluginClasses, BeamJobConfig beamJobConfig ) throws MetaStoreException {
  this();
  this.transMeta = transMeta;
  this.metaStore = new SerializableMetaStore( metaStore );
  this.metaStoreJson = this.metaStore.toJson();
  this.stepPluginClasses = stepPluginClasses;
  this.xpPluginClasses = xpPluginClasses;
  this.beamJobConfig = beamJobConfig;

  addDefaultStepHandlers();
}
 
Example #14
Source Project: pentaho-hadoop-shims   Author: pentaho   File: MRUtil.java    License: Apache License 2.0 5 votes vote down vote up
public static Trans getTrans( final Configuration conf, final String transXml, boolean singleThreaded )
  throws KettleException {
  initKettleEnvironment( conf );

  TransConfiguration transConfiguration = TransConfiguration.fromXML( transXml );
  TransMeta transMeta = transConfiguration.getTransMeta();
  String carteObjectId = UUID.randomUUID().toString();
  SimpleLoggingObject servletLoggingObject =
    new SimpleLoggingObject( "HADOOP_MAPPER", LoggingObjectType.CARTE, null ); //$NON-NLS-1$
  servletLoggingObject.setContainerObjectId( carteObjectId );
  TransExecutionConfiguration executionConfiguration = transConfiguration.getTransExecutionConfiguration();
  servletLoggingObject.setLogLevel( executionConfiguration.getLogLevel() );

  if ( singleThreaded ) {
    // Set the type to single threaded in case the user forgot...
    //
    transMeta.setTransformationType( TransformationType.SingleThreaded );

    // Disable thread priority management as it will slow things down needlessly.
    // The single threaded engine doesn't use threads and doesn't need row locking.
    //
    transMeta.setUsingThreadPriorityManagment( false );
  } else {
    transMeta.setTransformationType( TransformationType.Normal );
  }

  return new Trans( transMeta, servletLoggingObject );
}
 
Example #15
Source Project: pentaho-mongodb-plugin   Author: pentaho   File: MongoDbModel.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Retrieve the list of database names from MongoDB based on what the user entered for hostname, port,etc.
 * NOTE: Much of this could move to the MongoDbInputData class, as it is copied almost verbatim from the
 * Spoon MongoDbInputDialog class.
 *
 * @return Vector<String> list of database names
 * @throws Exception Should anything go wrong connecting to MongoDB, it will be reported with this exception
 */
public Vector<String> getDatabaseNamesFromMongo() throws Exception {
  Vector<String> dbs = new Vector<String>();

  if ( Const.isEmpty( hostname ) ) {
    log.logBasic( "Fetching database names aborted. Missing hostname." );
    return dbs;
  }

  final MongoDbInputMeta meta = new MongoDbInputMeta();
  final TransMeta transMeta = new TransMeta();
  saveMeta( meta );
  try {
    MongoClientWrapper wrapper = MongoWrapperUtil.createMongoClientWrapper( meta, transMeta, log );
    List<String> dbNames = null;
    try {
      dbNames = wrapper.getDatabaseNames();
    } finally {
      wrapper.dispose();
    }

    for ( String s : dbNames ) {
      dbs.add( s );
    }
    return dbs;
  } catch ( Exception e ) {
    log.logError( "Unexpected error retrieving database names from MongoDb. Check your connection details.", meta );
    throw new MongoDbException(
        "Unexpected error retrieving database names from MongoDb. Check your connection details.", e );
  }
}
 
Example #16
Source Project: pentaho-kettle   Author: pentaho   File: JaninoDialog.java    License: Apache License 2.0 5 votes vote down vote up
public JaninoDialog( Shell parent, Object in, TransMeta tr, String sname ) {
  super( parent, (BaseStepMeta) in, tr, sname );

  // The order here is important... currentMeta is looked at for changes
  currentMeta = (JaninoMeta) in;
  originalMeta = (JaninoMeta) currentMeta.clone();
  inputFields = new HashMap<String, Integer>();
}
 
Example #17
Source Project: pentaho-kettle   Author: pentaho   File: SharedObjectSyncUtilTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void synchronizePartitionSchemasDeleteFromRepository() throws Exception {
  try {
    spoon.rep = repository;
    when( spoon.getRepository() ).thenReturn( repository );

    final String objectId = "object-id";
    final String partitionName = "partsch";

    TransMeta trans1 = createTransMeta();
    trans1.setRepository( repository );
    trans1.setSharedObjects( createSharedObjects( SHARED_OBJECTS_FILE ) );
    PartitionSchema part1 = createPartitionSchema( partitionName, false );
    part1.setObjectId( new StringObjectId( objectId ) );
    trans1.addOrReplacePartitionSchema( part1 );
    spoon.delegates.trans.addTransformation( trans1 );

    TransMeta trans2 = createTransMeta();
    trans2.setRepository( repository );
    trans2.setSharedObjects( createSharedObjects( SHARED_OBJECTS_FILE ) );
    PartitionSchema part2 = createPartitionSchema( partitionName, false );
    part2.setObjectId( new StringObjectId( objectId ) );
    trans2.addOrReplacePartitionSchema( part2 );
    spoon.delegates.trans.addTransformation( trans2 );

    assertFalse( trans1.getPartitionSchemas().isEmpty() );
    spoon.delegates.partitions.delPartitionSchema( trans2, part2 );
    verify( repository ).deletePartitionSchema( part2.getObjectId() );
    assertTrue( trans1.getPartitionSchemas().isEmpty() );
  } finally {
    spoon.rep = null;
    when( spoon.getRepository() ).thenReturn( null );
  }
}
 
Example #18
Source Project: pentaho-kettle   Author: pentaho   File: WidgetUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * creates a ComboVar populated with fields from the previous step.
 * @param parentComposite - the composite in which the widget will be placed
 * @param props - PropsUI props for L&F
 * @param stepMeta - stepMeta of the current step
 * @param formData - FormData to use for placement
 */
public static ComboVar createFieldDropDown(
  Composite parentComposite, PropsUI props, BaseStepMeta stepMeta, FormData formData ) {
  TransMeta transMeta = stepMeta.getParentStepMeta().getParentTransMeta();
  ComboVar fieldDropDownCombo = new ComboVar( transMeta, parentComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  props.setLook( fieldDropDownCombo );
  fieldDropDownCombo.addModifyListener( e -> stepMeta.setChanged() );

  fieldDropDownCombo.setLayoutData( formData );
  Listener focusListener = e -> {
    String current = fieldDropDownCombo.getText();
    fieldDropDownCombo.getCComboWidget().removeAll();
    fieldDropDownCombo.setText( current );

    try {
      RowMetaInterface rmi = transMeta.getPrevStepFields( stepMeta.getParentStepMeta().getName() );
      List ls = rmi.getValueMetaList();
      for ( Object l : ls ) {
        ValueMetaBase vmb = (ValueMetaBase) l;
        fieldDropDownCombo.add( vmb.getName() );
      }
    } catch ( KettleStepException ex ) {
      // can be ignored, since previous step may not be set yet.
      stepMeta.logDebug( ex.getMessage(), ex );
    }
  };
  fieldDropDownCombo.getCComboWidget().addListener( SWT.FocusIn, focusListener );
  return fieldDropDownCombo;
}
 
Example #19
Source Project: pentaho-pdi-dataset   Author: mattcasters   File: DataSetHelper.java    License: Apache License 2.0 5 votes vote down vote up
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;
  }
  if ( checkTestPresent( spoon, transMeta ) ) {
    return;
  }

  try {
    TransUnitTest currentUnitTest = getCurrentUnitTest( transMeta );

    TransUnitTestSetLocation inputLocation = currentUnitTest.findInputLocation( stepMeta.getName() );
    if ( inputLocation != null ) {
      currentUnitTest.getInputDataSets().remove( inputLocation );
    }

    saveUnitTest( getHierarchy().getTestFactory(), currentUnitTest, transMeta );

    transGraph.redraw();
  } catch ( Exception e ) {
    new ErrorDialog( spoon.getShell(), "Error", "Error saving unit test", e );
  }
}
 
Example #20
Source Project: pentaho-kettle   Author: pentaho   File: TextFileInputCSVImportProgressDialogTest.java    License: Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
  shell = mock( Shell.class );
  meta = mock( CsvInputMeta.class );
  transMeta = mock( TransMeta.class );
  monitor = mock( IProgressMonitor.class );
}
 
Example #21
Source Project: pentaho-kettle   Author: pentaho   File: MappingIT.java    License: Apache License 2.0 5 votes vote down vote up
public void testMapping_WhenSharingPreviousStepWithAnother() throws Exception {
  KettleEnvironment.init();

  TransMeta transMeta = new TransMeta( "src/it/resources/org/pentaho/di/trans/steps/mapping/pdi-13435/PDI-13435-main.ktr" );
  transMeta.setTransformationType( TransMeta.TransformationType.Normal );

  Trans trans = new Trans( transMeta );
  trans.prepareExecution( null );
  trans.startThreads();
  trans.waitUntilFinished();

  assertEquals( 0, trans.getErrors() );
}
 
Example #22
Source Project: pentaho-kettle   Author: pentaho   File: StreamToTransNodeConverterTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void filterPrivateDatabasesWithOnePrivateDatabaseAndOneInUseTest() {
  IUnifiedRepository purMock = mock( IUnifiedRepository.class );
  TransMeta transMeta = spy( TransMeta.class );
  transMeta.setDatabases( getDummyDatabases() );
  Set<String> privateDatabases = new HashSet<>(  );
  privateDatabases.add( "database2" );
  transMeta.setPrivateDatabases( privateDatabases );
  when( transMeta.isDatabaseConnectionUsed( getDummyDatabases().get( 0 ) ) ).thenReturn( true );
  StreamToTransNodeConverter transConverter = new StreamToTransNodeConverter( purMock );
  assertEquals( 2, transConverter.filterPrivateDatabases( transMeta ).getDatabases().size() );
}
 
Example #23
Source Project: pentaho-kettle   Author: pentaho   File: MergeRowsIT.java    License: Apache License 2.0 5 votes vote down vote up
void createRowGenerator(
  TransMeta transMeta, PluginRegistry registry,
  String stepName, String[] values,
  StepMeta mergeRowsStep, MergeRowsMeta mergeRowsMeta,
  int index
) {
  RowGeneratorMeta rowGeneratorMeta = new RowGeneratorMeta();
  String rowGeneratorPid = registry.getPluginId( StepPluginType.class, rowGeneratorMeta );
  StepMeta rowGeneratorStep = new StepMeta( rowGeneratorPid, stepName, rowGeneratorMeta );
  transMeta.addStep( rowGeneratorStep );

  rowGeneratorMeta.setDefault();
  rowGeneratorMeta.setFieldName( fieldName );
  rowGeneratorMeta.setFieldType( type );
  rowGeneratorMeta.setFieldLength( intDummies );
  rowGeneratorMeta.setFieldPrecision( intDummies );
  rowGeneratorMeta.setRowLimit( "1" );
  rowGeneratorMeta.setFieldFormat( fieldFormat );
  rowGeneratorMeta.setGroup( group );
  rowGeneratorMeta.setDecimal( decimal );
  rowGeneratorMeta.setCurrency( currency );
  rowGeneratorMeta.setEmptyString( setEmptystring );

  rowGeneratorMeta.setValue( values );

  TransHopMeta hi1 = new TransHopMeta( rowGeneratorStep, mergeRowsStep );
  transMeta.addTransHop( hi1 );

  List<StreamInterface> infoStreams = mergeRowsMeta.getStepIOMeta().getInfoStreams();
  StreamInterface infoStream = infoStreams.get( index );
  infoStream.setStepMeta( transMeta.findStep( stepName ) );
}
 
Example #24
Source Project: knowbi-pentaho-pdi-neo4j-output   Author: knowbi   File: Neo4JOutputDialog.java    License: Apache License 2.0 5 votes vote down vote up
public Neo4JOutputDialog( Shell parent, Object in, TransMeta transMeta, String sname ) {
  super( parent, (BaseStepMeta) in, transMeta, sname );
  input = (Neo4JOutputMeta) in;

  // Hack the metastore...
  //
  metaStore = Spoon.getInstance().getMetaStore();
}
 
Example #25
Source Project: pentaho-kettle   Author: pentaho   File: XMLJoinMeta.java    License: Apache License 2.0 5 votes vote down vote up
public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep,
    VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException {

  ValueMetaInterface v = new ValueMeta( this.getValueXMLfield(), ValueMetaInterface.TYPE_STRING );
  v.setOrigin( name );

  TransMeta transMeta = (TransMeta) space;
  try {
    // Row should only include fields from the target and not the source. During the preview table generation
    // the fields from all previous steps (source and target) are included in the row so lets remove the
    // source fields.
    List<String> targetFieldNames = null;
    RowMetaInterface targetRowMeta = transMeta.getStepFields( transMeta.findStep( getTargetXMLstep() ),
      null,
      null );
    if ( targetRowMeta != null ) {
      targetFieldNames = Arrays.asList( targetRowMeta.getFieldNames() );
    }
    for ( String fieldName : transMeta.getStepFields( transMeta.findStep( getSourceXMLstep() ),
                                                                          null,
                                                                          null ).getFieldNames() ) {
      if ( targetFieldNames == null || !targetFieldNames.contains( fieldName ) ) {
        row.removeValueMeta( fieldName );
      }
    }
  } catch ( KettleValueException e ) {
    // Pass
  }

  row.addValueMeta( v );
}
 
Example #26
Source Project: pentaho-kettle   Author: pentaho   File: CreditCardValidator.java    License: Apache License 2.0 4 votes vote down vote up
public CreditCardValidator( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr,
  TransMeta transMeta, Trans trans ) {
  super( stepMeta, stepDataInterface, copyNr, transMeta, trans );
}
 
Example #27
Source Project: kettle-beam   Author: mattcasters   File: BeamTimestampStepHandler.java    License: Apache License 2.0 4 votes vote down vote up
public BeamTimestampStepHandler( BeamJobConfig beamJobConfig, IMetaStore metaStore, TransMeta transMeta, List<String> stepPluginClasses, List<String> xpPluginClasses ) {
  super( beamJobConfig, false, false, metaStore, transMeta, stepPluginClasses, xpPluginClasses );
}
 
Example #28
Source Project: pentaho-kettle   Author: pentaho   File: MailValidator.java    License: Apache License 2.0 4 votes vote down vote up
public MailValidator( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
  Trans trans ) {
  super( stepMeta, stepDataInterface, copyNr, transMeta, trans );
}
 
Example #29
Source Project: pentaho-kettle   Author: pentaho   File: SingleThreaderMeta.java    License: Apache License 2.0 4 votes vote down vote up
public static final synchronized TransMeta loadSingleThreadedTransMeta( SingleThreaderMeta mappingMeta,
                                                                        Repository rep, VariableSpace space ) throws KettleException {
  return loadMappingMeta( mappingMeta, rep, null, space );
}
 
Example #30
Source Project: pentaho-kettle   Author: pentaho   File: PurRepositoryProxy.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public TransMeta loadTransformation( String s, RepositoryDirectoryInterface repositoryDirectoryInterface, ProgressMonitorListener progressMonitorListener, boolean b, String s1 ) throws KettleException {
  return getDelegate().loadTransformation( s, repositoryDirectoryInterface, progressMonitorListener, b, s1 );
}