Java Code Examples for org.pentaho.di.trans.step.StepMeta#equals()
The following examples show how to use
org.pentaho.di.trans.step.StepMeta#equals() .
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 File: TransExecutorMeta.java From pentaho-kettle with Apache License 2.0 | 6 votes |
@Override public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( nextStep != null ) { if ( nextStep.equals( executionResultTargetStepMeta ) ) { inputRowMeta.clear(); prepareExecutionResultsFields( inputRowMeta, nextStep ); } else if ( nextStep.equals( resultFilesTargetStepMeta ) ) { inputRowMeta.clear(); prepareExecutionResultsFileFields( inputRowMeta, nextStep ); } else if ( nextStep.equals( outputRowsSourceStepMeta ) ) { inputRowMeta.clear(); prepareResultsRowsFields( inputRowMeta ); } // else don't call clear on inputRowMeta, it's the main output and should mimic the input } }
Example 2
Source File: FilterRowsMeta.java From pentaho-kettle with Apache License 2.0 | 6 votes |
/** * When an optional stream is selected, this method is called to handled the ETL metadata implications of that. * * @param stream * The optional stream to handle. */ public void handleStreamSelection( StreamInterface stream ) { // This step targets another step. // Make sure that we don't specify the same step for true and false... // If the user requests false, we blank out true and vice versa // List<StreamInterface> targets = getStepIOMeta().getTargetStreams(); int index = targets.indexOf( stream ); if ( index == 0 ) { // True // StepMeta falseStep = targets.get( 1 ).getStepMeta(); if ( falseStep != null && falseStep.equals( stream.getStepMeta() ) ) { targets.get( 1 ).setStepMeta( null ); } } if ( index == 1 ) { // False // StepMeta trueStep = targets.get( 0 ).getStepMeta(); if ( trueStep != null && trueStep.equals( stream.getStepMeta() ) ) { targets.get( 0 ).setStepMeta( null ); } } }
Example 3
Source File: JoinRowsMeta.java From pentaho-kettle with Apache License 2.0 | 6 votes |
@Override public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( space instanceof TransMeta ) { TransMeta transMeta = (TransMeta) space; StepMeta[] steps = transMeta.getPrevSteps( transMeta.findStep( origin ) ); StepMeta mainStep = transMeta.findStep( getMainStepname() ); rowMeta.clear(); if ( mainStep != null ) { rowMeta.addRowMeta( transMeta.getStepFields( mainStep ) ); } for ( StepMeta step : steps ) { if ( mainStep == null || !step.equals( mainStep ) ) { rowMeta.addRowMeta( transMeta.getStepFields( step ) ); } } } }
Example 4
Source File: TransGraph.java From pentaho-kettle with Apache License 2.0 | 6 votes |
private void detach( StepMeta stepMeta ) { for ( int i = transMeta.nrTransHops() - 1; i >= 0; i-- ) { TransHopMeta hop = transMeta.getTransHop( i ); if ( stepMeta.equals( hop.getFromStep() ) || stepMeta.equals( hop.getToStep() ) ) { // Step is connected with a hop, remove this hop. // spoon.addUndoNew( transMeta, new TransHopMeta[] { hop }, new int[] { i } ); transMeta.removeTransHop( i ); } } /* * TransHopMeta hfrom = transMeta.findTransHopTo(stepMeta); TransHopMeta hto = transMeta.findTransHopFrom(stepMeta); * * if (hfrom != null && hto != null) { if (transMeta.findTransHop(hfrom.getFromStep(), hto.getToStep()) == null) { * TransHopMeta hnew = new TransHopMeta(hfrom.getFromStep(), hto.getToStep()); transMeta.addTransHop(hnew); * spoon.addUndoNew(transMeta, new TransHopMeta[] { hnew }, new int[] { transMeta.indexOfTransHop(hnew) }); * spoon.refreshTree(); } } if (hfrom != null) { int fromidx = transMeta.indexOfTransHop(hfrom); if (fromidx >= 0) { * transMeta.removeTransHop(fromidx); spoon.refreshTree(); } } if (hto != null) { int toidx = * transMeta.indexOfTransHop(hto); if (toidx >= 0) { transMeta.removeTransHop(toidx); spoon.refreshTree(); } } */ spoon.refreshTree(); redraw(); }
Example 5
Source File: MetaInjectMeta.java From pentaho-kettle with Apache License 2.0 | 6 votes |
@Override public void onStepChange( TransMeta transMeta, StepMeta oldMeta, StepMeta newMeta ) { for ( int i = 0; i < transMeta.nrTransHops(); i++ ) { TransHopMeta hopMeta = transMeta.getTransHop( i ); if ( hopMeta.getFromStep().equals( oldMeta ) ) { StepMeta toStepMeta = hopMeta.getToStep(); if ( ( toStepMeta.getStepMetaInterface() instanceof MetaInjectMeta ) && ( toStepMeta.equals( this .getParentStepMeta() ) ) ) { MetaInjectMeta toMeta = (MetaInjectMeta) toStepMeta.getStepMetaInterface(); Map<TargetStepAttribute, SourceStepField> sourceMapping = toMeta.getTargetSourceMapping(); for ( Entry<TargetStepAttribute, SourceStepField> entry : sourceMapping.entrySet() ) { SourceStepField value = entry.getValue(); if ( value.getStepname() != null && value.getStepname().equals( oldMeta.getName() ) ) { value.setStepname( newMeta.getName() ); } } } } } }
Example 6
Source File: JoinRowsMeta.java From pentaho-kettle with Apache License 2.0 | 5 votes |
@Override public boolean cleanAfterHopToRemove( StepMeta fromStep ) { boolean hasChanged = false; // If the hop we're removing comes from a Step that is being used as the main step for the Join, we have to clear // that reference if ( null != fromStep && fromStep.equals( getMainStep() ) ) { setMainStep( null ); setMainStepname( null ); hasChanged = true; } return hasChanged; }
Example 7
Source File: TransGraph.java From pentaho-kettle with Apache License 2.0 | 5 votes |
/** * See if location (x,y) is on a line between two steps: the hop! * * @param x * @param y * @param exclude the step to exclude from the hops (from or to location). Specify null if no step is to be excluded. * @return the transformation hop on the specified location, otherwise: null */ private TransHopMeta findHop( int x, int y, StepMeta exclude ) { int i; TransHopMeta online = null; for ( i = 0; i < transMeta.nrTransHops(); i++ ) { TransHopMeta hi = transMeta.getTransHop( i ); StepMeta fs = hi.getFromStep(); StepMeta ts = hi.getToStep(); if ( fs == null || ts == null ) { return null; } // If either the "from" or "to" step is excluded, skip this hop. // if ( exclude != null && ( exclude.equals( fs ) || exclude.equals( ts ) ) ) { continue; } int[] line = getLine( fs, ts ); if ( pointOnLine( x, y, line ) ) { online = hi; } } return online; }
Example 8
Source File: TransExecutorMeta.java From pentaho-kettle with Apache License 2.0 | 4 votes |
void prepareExecutionResultsFileFields( RowMetaInterface row, StepMeta nextStep ) throws KettleStepException { if ( nextStep != null && resultFilesTargetStepMeta != null && nextStep.equals( resultFilesTargetStepMeta ) ) { addFieldToRow( row, resultFilesFileNameField, ValueMetaInterface.TYPE_STRING ); } }
Example 9
Source File: TransGraph.java From pentaho-kettle with Apache License 2.0 | 4 votes |
private void addCandidateAsHop( int mouseX, int mouseY ) { boolean forward = startHopStep != null; StepMeta fromStep = candidate.getFromStep(); StepMeta toStep = candidate.getToStep(); // See what the options are. // - Does the source step has multiple stream options? // - Does the target step have multiple input stream options? // List<StreamInterface> streams = new ArrayList<>(); StepIOMetaInterface fromIoMeta = fromStep.getStepMetaInterface().getStepIOMeta(); List<StreamInterface> targetStreams = fromIoMeta.getTargetStreams(); if ( forward ) { streams.addAll( targetStreams ); } StepIOMetaInterface toIoMeta = toStep.getStepMetaInterface().getStepIOMeta(); List<StreamInterface> infoStreams = toIoMeta.getInfoStreams(); if ( !forward ) { streams.addAll( infoStreams ); } if ( forward ) { if ( fromIoMeta.isOutputProducer() && toStep.equals( currentStep ) ) { streams.add( new Stream( StreamType.OUTPUT, fromStep, BaseMessages .getString( PKG, "Spoon.Hop.MainOutputOfStep" ), StreamIcon.OUTPUT, null ) ); } if ( fromStep.supportsErrorHandling() && toStep.equals( currentStep ) ) { streams.add( new Stream( StreamType.ERROR, fromStep, BaseMessages.getString( PKG, "Spoon.Hop.ErrorHandlingOfStep" ), StreamIcon.ERROR, null ) ); } } else { if ( toIoMeta.isInputAcceptor() && fromStep.equals( currentStep ) ) { streams.add( new Stream( StreamType.INPUT, toStep, BaseMessages.getString( PKG, "Spoon.Hop.MainInputOfStep" ), StreamIcon.INPUT, null ) ); } if ( fromStep.supportsErrorHandling() && fromStep.equals( currentStep ) ) { streams.add( new Stream( StreamType.ERROR, fromStep, BaseMessages.getString( PKG, "Spoon.Hop.ErrorHandlingOfStep" ), StreamIcon.ERROR, null ) ); } } // Targets can be dynamically added to this step... // if ( forward ) { streams.addAll( fromStep.getStepMetaInterface().getOptionalStreams() ); } else { streams.addAll( toStep.getStepMetaInterface().getOptionalStreams() ); } // Show a list of options on the canvas... // if ( streams.size() > 1 ) { // Show a pop-up menu with all the possible options... // Menu menu = new Menu( canvas ); for ( final StreamInterface stream : streams ) { MenuItem item = new MenuItem( menu, SWT.NONE ); item.setText( Const.NVL( stream.getDescription(), "" ) ); item.setImage( getImageFor( stream ) ); item.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected( SelectionEvent e ) { addHop( stream ); } } ); } menu.setLocation( canvas.toDisplay( mouseX, mouseY ) ); menu.setVisible( true ); return; } if ( streams.size() == 1 ) { addHop( streams.get( 0 ) ); } else { return; } /* * * if (transMeta.findTransHop(candidate) == null) { spoon.newHop(transMeta, candidate); } if (startErrorHopStep) { * addErrorHop(); } if (startTargetHopStream != null) { // Auto-configure the target in the source step... // * startTargetHopStream.setStepMeta(candidate.getToStep()); * startTargetHopStream.setStepname(candidate.getToStep().getName()); startTargetHopStream = null; } */ candidate = null; selectedSteps = null; startHopStep = null; endHopLocation = null; startErrorHopStep = false; // redraw(); }