Java Code Examples for org.pentaho.di.core.exception.KettleStepException
The following examples show how to use
org.pentaho.di.core.exception.KettleStepException.
These examples are extracted from open source projects.
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: BaseStep.java License: Apache License 2.0 | 6 votes |
/** * Opens socket connections to the remote input steps of this step. <br> * This method should be used by steps that don't call getRow() first in which it is executed automatically. <br> * <b>This method should be called before any data is read from previous steps.</b> <br> * This action is executed only once. * * @throws KettleStepException */ protected void openRemoteInputStepSocketsOnce() throws KettleStepException { if ( !remoteInputSteps.isEmpty() ) { if ( !remoteInputStepsInitialized ) { // Loop over the remote steps and open client sockets to them // Just be careful in case we're dealing with a partitioned clustered step. // A partitioned clustered step has only one. (see dispatch()) // inputRowSetsLock.writeLock().lock(); try { for ( RemoteStep remoteStep : remoteInputSteps ) { try { BlockingRowSet rowSet = remoteStep.openReaderSocket( this ); inputRowSets.add( rowSet ); } catch ( Exception e ) { throw new KettleStepException( "Error opening reader socket to remote step '" + remoteStep + "'", e ); } } } finally { inputRowSetsLock.writeLock().unlock(); } remoteInputStepsInitialized = true; } } }
Example #2
Source Project: pentaho-kettle Author: pentaho File: OpenERPObjectDeleteDialog.java License: Apache License 2.0 | 6 votes |
private String[] getSteamFieldsNames( boolean showError ) { String[] fields = null; // Set stream fields RowMetaInterface row; try { row = transMeta.getPrevStepFields( stepMeta ); fields = new String[row.size()]; for ( int i = 0; i < row.size(); i++ ) { fields[i] = row.getValueMeta( i ).getName(); } } catch ( KettleStepException e ) { if ( showError ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "OpenERPObjectOutputDialog.UnableToFindStreamFieldsTitle" ), BaseMessages .getString( PKG, "OpenERPObjectOutputDialog.UnableToFindStreamFieldsMessage" ), e ); } return null; } return fields; }
Example #3
Source Project: pentaho-reporting Author: pentaho File: TableProducerTest.java License: GNU Lesser General Public License v2.1 | 6 votes |
@Test public void rowWrittenEvent_boolean() throws KettleStepException, ReportDataFactoryException, KettleValueException { Boolean[] row = new Boolean[] { true }; RowMetaInterface rowMetaInterface = mock( RowMetaInterface.class ); when( rowMetaInterface.size() ).thenReturn( 1 ); ValueMetaInterface valueMeta1 = mock( ValueMetaInterface.class ); when( valueMeta1.getName() ).thenReturn( "COLUMN_1" ); when( valueMeta1.getType() ).thenReturn( ValueMetaInterface.TYPE_BOOLEAN ); when( rowMetaInterface.getValueMeta( eq( 0 ) ) ).thenReturn( valueMeta1 ); when( rowMetaInterface.getBoolean( eq( row ), eq( 0 ) ) ).thenReturn( row[0] ); TableProducer tableProducer = new TableProducer( rowMetaInterface, 0, true ); tableProducer.rowWrittenEvent( rowMetaInterface, row ); TypedTableModel expectedModel = new TypedTableModel( new String[] { "COLUMN_1" }, new Class[] { Boolean.class } ); expectedModel.addRow( true ); assertEquals( expectedModel, tableProducer.getTableModel() ); }
Example #4
Source Project: pentaho-reporting Author: pentaho File: TableProducerTest.java License: GNU Lesser General Public License v2.1 | 6 votes |
@Test public void rowWrittenEvent_bignumber() throws KettleStepException, ReportDataFactoryException, KettleValueException { BigDecimal[] row = new BigDecimal[] { new BigDecimal( 1 ) }; RowMetaInterface rowMetaInterface = mock( RowMetaInterface.class ); when( rowMetaInterface.size() ).thenReturn( 1 ); ValueMetaInterface valueMeta1 = mock( ValueMetaInterface.class ); when( valueMeta1.getName() ).thenReturn( "COLUMN_1" ); when( valueMeta1.getType() ).thenReturn( ValueMetaInterface.TYPE_BIGNUMBER ); when( rowMetaInterface.getValueMeta( eq( 0 ) ) ).thenReturn( valueMeta1 ); when( rowMetaInterface.getBigNumber( eq( row ), eq( 0 ) ) ).thenReturn( row[0] ); TableProducer tableProducer = new TableProducer( rowMetaInterface, 0, true ); tableProducer.rowWrittenEvent( rowMetaInterface, row ); TypedTableModel expectedModel = new TypedTableModel( new String[] { "COLUMN_1" }, new Class[] { BigDecimal.class } ); expectedModel.addRow( new BigDecimal( 1 ) ); assertEquals( expectedModel, tableProducer.getTableModel() ); }
Example #5
Source Project: pentaho-reporting Author: pentaho File: TableProducerTest.java License: GNU Lesser General Public License v2.1 | 6 votes |
@Test public void rowWrittenEvent_date() throws KettleStepException, ReportDataFactoryException, KettleValueException { Date[] row = new Date[] { new Date( 1 ) }; RowMetaInterface rowMetaInterface = mock( RowMetaInterface.class ); when( rowMetaInterface.size() ).thenReturn( 1 ); ValueMetaInterface valueMeta1 = mock( ValueMetaInterface.class ); when( valueMeta1.getName() ).thenReturn( "COLUMN_1" ); when( valueMeta1.getType() ).thenReturn( ValueMetaInterface.TYPE_DATE ); when( rowMetaInterface.getValueMeta( eq( 0 ) ) ).thenReturn( valueMeta1 ); when( rowMetaInterface.getDate( eq( row ), eq( 0 ) ) ).thenReturn( row[0] ); TableProducer tableProducer = new TableProducer( rowMetaInterface, 0, true ); tableProducer.rowWrittenEvent( rowMetaInterface, row ); TypedTableModel expectedModel = new TypedTableModel( new String[] { "COLUMN_1" }, new Class[] { BigDecimal.class } ); expectedModel.addRow( new Date( 1 ) ); assertEquals( expectedModel, tableProducer.getTableModel() ); }
Example #6
Source Project: pentaho-reporting Author: pentaho File: TableProducerTest.java License: GNU Lesser General Public License v2.1 | 6 votes |
@Test public void rowWrittenEvent_none() throws KettleStepException, ReportDataFactoryException, KettleValueException { String[] row = new String[] { "NONE" }; RowMetaInterface rowMetaInterface = mock( RowMetaInterface.class ); when( rowMetaInterface.size() ).thenReturn( 1 ); ValueMetaInterface valueMeta1 = mock( ValueMetaInterface.class ); when( valueMeta1.getName() ).thenReturn( "COLUMN_1" ); when( valueMeta1.getType() ).thenReturn( ValueMetaInterface.TYPE_NONE ); when( rowMetaInterface.getValueMeta( eq( 0 ) ) ).thenReturn( valueMeta1 ); when( rowMetaInterface.getString( eq( row ), eq( 0 ) ) ).thenReturn( row[0] ); TableProducer tableProducer = new TableProducer( rowMetaInterface, 0, true ); tableProducer.rowWrittenEvent( rowMetaInterface, row ); TypedTableModel expectedModel = new TypedTableModel( new String[] { "COLUMN_1" }, new Class[] { String.class } ); expectedModel.addRow( "NONE" ); assertEquals( expectedModel, tableProducer.getTableModel() ); }
Example #7
Source Project: pentaho-kettle Author: pentaho File: TransMetaTest.java License: Apache License 2.0 | 6 votes |
@Test public void infoStepFieldsAreNotIncludedInGetStepFields() throws KettleStepException { // validates that the fields from info steps are not included in the resulting step fields for a stepMeta. // This is important with steps like StreamLookup and Append, where the previous steps may or may not // have their fields included in the current step. TransMeta transMeta = new TransMeta( new Variables() ); StepMeta toBeAppended1 = testStep( "toBeAppended1", emptyList(), // no info steps asList( "field1", "field2" ) // names of fields from this step ); StepMeta toBeAppended2 = testStep( "toBeAppended2", emptyList(), asList( "field1", "field2" ) ); StepMeta append = testStep( "append", asList( "toBeAppended1", "toBeAppended2" ), // info step names singletonList( "outputField" ) // output field of this step ); StepMeta after = new StepMeta( "after", new DummyTransMeta() ); wireUpTestTransMeta( transMeta, toBeAppended1, toBeAppended2, append, after ); RowMetaInterface results = transMeta.getStepFields( append, after, mock( ProgressMonitorListener.class ) ); assertThat( 1, equalTo( results.size() ) ); assertThat( "outputField", equalTo( results.getFieldNames()[ 0 ] ) ); }
Example #8
Source Project: pentaho-kettle Author: pentaho File: FieldSplitterTest.java License: Apache License 2.0 | 6 votes |
private FieldSplitterMeta mockProcessRowMeta() throws KettleStepException { FieldSplitterMeta processRowMeta = smh.processRowsStepMetaInterface; doReturn( "field to split" ).when( processRowMeta ).getSplitField(); doCallRealMethod().when( processRowMeta ).getFields( any( RowMetaInterface.class ), anyString(), any( RowMetaInterface[].class ), any( StepMeta.class ), any( VariableSpace.class ), any( Repository.class ), any( IMetaStore.class ) ); doReturn( new String[] { "a", "b" } ).when( processRowMeta ).getFieldName(); doReturn( new int[] { ValueMetaInterface.TYPE_STRING, ValueMetaInterface.TYPE_STRING } ).when( processRowMeta ) .getFieldType(); doReturn( new String[] { "a=", "b=" } ).when( processRowMeta ).getFieldID(); doReturn( new boolean[] { false, false } ).when( processRowMeta ).getFieldRemoveID(); doReturn( new int[] { -1, -1 } ).when( processRowMeta ).getFieldLength(); doReturn( new int[] { -1, -1 } ).when( processRowMeta ).getFieldPrecision(); doReturn( new int[] { 0, 0 } ).when( processRowMeta ).getFieldTrimType(); doReturn( new String[] { null, null } ).when( processRowMeta ).getFieldFormat(); doReturn( new String[] { null, null } ).when( processRowMeta ).getFieldDecimal(); doReturn( new String[] { null, null } ).when( processRowMeta ).getFieldGroup(); doReturn( new String[] { null, null } ).when( processRowMeta ).getFieldCurrency(); doReturn( new String[] { null, null } ).when( processRowMeta ).getFieldNullIf(); doReturn( new String[] { null, null } ).when( processRowMeta ).getFieldIfNull(); doReturn( ";" ).when( processRowMeta ).getDelimiter(); doReturn( 2 ).when( processRowMeta ).getFieldsCount(); return processRowMeta; }
Example #9
Source Project: pentaho-kettle Author: pentaho File: SpoonJobDelegate.java License: Apache License 2.0 | 6 votes |
private String getSQLString( DatabaseMeta sourceDbInfo, TableInputMeta tii, TransMeta transMeta ) throws InvocationTargetException { // First set the limit to 1 to speed things up! String tmpSql = tii.getSQL(); tii.setSQL( tii.getSQL() + sourceDbInfo.getLimitClause( 1 ) ); String sql; try { sql = transMeta.getSQLStatementsString(); } catch ( KettleStepException kse ) { throw new InvocationTargetException( kse, BaseMessages.getString( PKG, "Spoon.RipDB.Exception.ErrorGettingSQLFromTransformation" ) + transMeta + "] : " + kse.getMessage() ); } // remove the limit tii.setSQL( tmpSql ); return sql; }
Example #10
Source Project: pentaho-kettle Author: pentaho File: BaseStep.java License: Apache License 2.0 | 6 votes |
/** * Find output row set. * * @param targetStep the target step * @return the row set * @throws KettleStepException the kettle step exception */ public RowSet findOutputRowSet( String targetStep ) throws KettleStepException { // Check to see that "targetStep" only runs in a single copy // Otherwise you'll see problems during execution. // StepMeta targetStepMeta = transMeta.findStep( targetStep ); if ( targetStepMeta == null ) { throw new KettleStepException( BaseMessages.getString( PKG, "BaseStep.Exception.TargetStepToWriteToDoesntExist", targetStep ) ); } if ( targetStepMeta.getCopies() > 1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "BaseStep.Exception.TargetStepToWriteToCantRunInMultipleCopies", targetStep, Integer .toString( targetStepMeta.getCopies() ) ) ); } return findOutputRowSet( getStepname(), getCopy(), targetStep, 0 ); }
Example #11
Source Project: pentaho-kettle Author: pentaho File: DatabaseJoinMeta.java License: Apache License 2.0 | 6 votes |
@Override public void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository, IMetaStore metaStore ) throws KettleStepException { // Find the lookupfields... // RowMetaInterface out = prev.clone(); getFields( out, stepMeta.getName(), new RowMetaInterface[] { info, }, null, transMeta, repository, metaStore ); if ( out != null ) { for ( int i = 0; i < out.size(); i++ ) { ValueMetaInterface outvalue = out.getValueMeta( i ); DatabaseImpact di = new DatabaseImpact( DatabaseImpact.TYPE_IMPACT_READ, transMeta.getName(), stepMeta.getName(), databaseMeta.getDatabaseName(), "", outvalue.getName(), outvalue.getName(), stepMeta.getName(), transMeta.environmentSubstitute( sql ), BaseMessages.getString( PKG, "DatabaseJoinMeta.DatabaseImpact.Title" ) ); impact.add( di ); } } }
Example #12
Source Project: pentaho-kettle Author: pentaho File: OpenERPObjectInputMeta.java License: Apache License 2.0 | 6 votes |
public void getFields( final RowMetaInterface row, final String origin, final RowMetaInterface[] info, final StepMeta nextStep, final VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( databaseMeta == null ) { throw new KettleStepException( "There is no OpenERP database server connection defined" ); } final OpenERPHelper helper = new OpenERPHelper( databaseMeta ); try { helper.StartSession(); final RowMetaInterface rowMeta = this.getRowMeta(); row.addRowMeta( rowMeta ); } catch ( Exception e ) { throw new KettleStepException( e ); } }
Example #13
Source Project: pentaho-kettle Author: pentaho File: ElasticSearchBulk.java License: Apache License 2.0 | 6 votes |
private void initFieldIndexes() throws KettleStepException { if ( isJsonInsert ) { Integer idx = getFieldIdx( data.inputRowMeta, environmentSubstitute( meta.getJsonField() ) ); if ( idx != null ) { jsonFieldIdx = idx.intValue(); } else { throw new KettleStepException( BaseMessages.getString( PKG, "ElasticSearchBulk.Error.NoJsonField" ) ); } } idOutFieldName = environmentSubstitute( meta.getIdOutField() ); if ( StringUtils.isNotBlank( meta.getIdInField() ) ) { idFieldIndex = getFieldIdx( data.inputRowMeta, environmentSubstitute( meta.getIdInField() ) ); if ( idFieldIndex == null ) { throw new KettleStepException( BaseMessages.getString( PKG, "ElasticSearchBulk.Error.InvalidIdField" ) ); } } else { idFieldIndex = null; } }
Example #14
Source Project: pentaho-kettle Author: pentaho File: SymmetricCryptoTransMeta.java License: Apache License 2.0 | 6 votes |
public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( !Utils.isEmpty( getResultfieldname() ) ) { int type = ValueMetaInterface.TYPE_STRING; if ( isOutputResultAsBinary() ) { type = ValueMetaInterface.TYPE_BINARY; } try { ValueMetaInterface v = ValueMetaFactory.createValueMeta( getResultfieldname(), type ); v.setOrigin( origin ); rowMeta.addValueMeta( v ); } catch ( Exception e ) { throw new KettleStepException( e ); } } }
Example #15
Source Project: pentaho-kettle Author: pentaho File: WsdlOpParameterList.java License: Apache License 2.0 | 6 votes |
/** * Generate a WsdlOpParameter from the message part. * * @param part * A list of message part. * @param requesPart * true if part from request message. */ private List<WsdlOpParameter> getParameter( Part part, boolean requesPart ) throws KettleStepException { List<WsdlOpParameter> params = new ArrayList<WsdlOpParameter>(); if ( part.getElementName() != null ) { if ( WsdlUtils.isWrappedParameterStyle( _operation.getName(), !requesPart, part.getName() ) ) { _parameterStyle = WsdlOperation.SOAPParameterStyle.WRAPPED; } params.addAll( resolvePartElement( part ) ); } else { params.add( new WsdlOpParameter( part.getName(), part.getTypeName(), _wsdlTypes.findNamedType( part .getTypeName() ), _wsdlTypes ) ); } return params; }
Example #16
Source Project: kettle-beam Author: mattcasters File: BeamOutputStepHandler.java License: Apache License 2.0 | 5 votes |
private FileDefinition getDefaultFileDefition( StepMeta beamOutputStepMeta ) throws KettleStepException { FileDefinition fileDefinition = new FileDefinition(); fileDefinition.setName( "Default" ); fileDefinition.setEnclosure( "\"" ); fileDefinition.setSeparator( "," ); return fileDefinition; }
Example #17
Source Project: pentaho-kettle Author: pentaho File: RowGeneratorUnitTest.java License: Apache License 2.0 | 5 votes |
@Test public void doesNotWriteRowOnTimeWhenStopped() throws KettleException, InterruptedException { TransMeta transMeta = new TransMeta( getClass().getResource( "safe-stop.ktr" ).getPath() ); Trans trans = new Trans( transMeta ); trans.prepareExecution( new String[] {} ); trans.getSteps().get( 1 ).step.addRowListener( new RowAdapter() { @Override public void rowWrittenEvent( RowMetaInterface rowMeta, Object[] row ) throws KettleStepException { trans.safeStop(); } } ); trans.startThreads(); trans.waitUntilFinished(); assertEquals( 1, trans.getSteps().get( 0 ).step.getLinesWritten() ); assertEquals( 1, trans.getSteps().get( 1 ).step.getLinesRead() ); }
Example #18
Source Project: kettle-beam Author: mattcasters File: BeamTimestampMeta.java License: Apache License 2.0 | 5 votes |
@Override public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( readingTimestamp ) { ValueMetaDate valueMeta = new ValueMetaDate( fieldName ); valueMeta.setOrigin( name ); inputRowMeta.addValueMeta( valueMeta ); } }
Example #19
Source Project: kettle-beam Author: mattcasters File: BeamProduceMeta.java License: Apache License 2.0 | 5 votes |
@Override public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // No output // inputRowMeta.clear(); }
Example #20
Source Project: kettle-beam Author: mattcasters File: BeamInputMeta.java License: Apache License 2.0 | 5 votes |
public FileDefinition loadFileDefinition(IMetaStore metaStore) throws KettleStepException { if (StringUtils.isEmpty(fileDescriptionName)) { throw new KettleStepException("No file description name provided"); } FileDefinition fileDefinition; try { MetaStoreFactory<FileDefinition> factory = new MetaStoreFactory<>( FileDefinition.class, metaStore, PentahoDefaults.NAMESPACE ); fileDefinition = factory.loadElement( fileDescriptionName ); } catch(Exception e) { throw new KettleStepException( "Unable to load file description '"+fileDescriptionName+"' from the metastore", e ); } return fileDefinition; }
Example #21
Source Project: knowbi-pentaho-pdi-neo4j-output Author: knowbi File: Neo4JOutputMeta.java License: Apache License 2.0 | 5 votes |
@Override public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if (returningGraph) { ValueMetaInterface valueMetaGraph = new ValueMetaGraph( Const.NVL(returnGraphField, "graph") ); valueMetaGraph.setOrigin( name ); inputRowMeta.addValueMeta( valueMetaGraph ); } }
Example #22
Source Project: pentaho-kettle Author: pentaho File: MetaInjectMeta.java License: Apache License 2.0 | 5 votes |
@Override public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { rowMeta.clear(); // No defined output is expected from this step. if ( !Utils.isEmpty( sourceStepName ) ) { for ( MetaInjectOutputField field : sourceOutputFields ) { try { rowMeta.addValueMeta( field.createValueMeta() ); } catch ( KettlePluginException e ) { throw new KettleStepException( "Error creating value meta for output field '" + field.getName() + "'", e ); } } } }
Example #23
Source Project: pentaho-kettle Author: pentaho File: FuzzyMatch.java License: Apache License 2.0 | 5 votes |
private Object[] lookupValues( RowMetaInterface rowMeta, Object[] row ) throws KettleException { if ( first ) { first = false; data.outputRowMeta = getInputRowMeta().clone(); meta.getFields( data.outputRowMeta, getStepname(), new RowMetaInterface[] { data.infoMeta }, null, this, repository, metaStore ); // Check lookup field data.indexOfMainField = getInputRowMeta().indexOfValue( environmentSubstitute( meta.getMainStreamField() ) ); if ( data.indexOfMainField < 0 ) { // The field is unreachable ! throw new KettleException( BaseMessages.getString( PKG, "FuzzyMatch.Exception.CouldnotFindMainField", meta .getMainStreamField() ) ); } } Object[] add = null; if ( row[ data.indexOfMainField ] == null ) { add = buildEmptyRow(); } else { try { add = getFromCache( row ); } catch ( Exception e ) { throw new KettleStepException( e ); } } return RowDataUtil.addRowData( row, rowMeta.size(), add ); }
Example #24
Source Project: pentaho-kettle Author: pentaho File: WidgetUtils.java License: Apache License 2.0 | 5 votes |
/** * 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 #25
Source Project: pentaho-kettle Author: pentaho File: CalculatorMeta.java License: Apache License 2.0 | 5 votes |
@Override public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( CalculatorMetaFunction fn : calculation ) { if ( !fn.isRemovedFromResult() ) { if ( !Utils.isEmpty( fn.getFieldName() ) ) { // It's a new field! ValueMetaInterface v = getValueMeta( fn, origin ); row.addValueMeta( v ); } } } }
Example #26
Source Project: pentaho-kettle Author: pentaho File: InjectorMeta.java License: Apache License 2.0 | 5 votes |
public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( int i = 0; i < this.fieldname.length; i++ ) { ValueMetaInterface v; try { v = ValueMetaFactory.createValueMeta( this.fieldname[i], type[i], length[i], precision[i] ); inputRowMeta.addValueMeta( v ); } catch ( KettlePluginException e ) { throw new KettleStepException( e ); } } }
Example #27
Source Project: pentaho-kettle Author: pentaho File: AppendMeta.java License: Apache License 2.0 | 5 votes |
public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // We don't have any input fields here in "r" as they are all info fields. // So we just take the info fields. // if ( info != null ) { if ( info.length > 0 && info[0] != null ) { r.mergeRowMeta( info[0] ); } } }
Example #28
Source Project: pentaho-kettle Author: pentaho File: UserDefinedJavaClass.java License: Apache License 2.0 | 5 votes |
public void openRemoteOutputStepSocketsOnce() throws KettleStepException { if ( child == null ) { openRemoteOutputStepSocketsOnceImpl(); } else { child.openRemoteOutputStepSocketsOnce(); } }
Example #29
Source Project: pentaho-kettle Author: pentaho File: ConcatFieldsMeta.java License: Apache License 2.0 | 5 votes |
@Override public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // do not call the super class from TextFileOutputMeta since it modifies the source meta data // see getFieldsModifyInput() instead // remove selected fields from the stream when true if ( removeSelectedFields ) { if ( getOutputFields().length > 0 ) { for ( int i = 0; i < getOutputFields().length; i++ ) { TextFileField field = getOutputFields()[ i ]; try { row.removeValueMeta( field.getName() ); } catch ( KettleValueException e ) { // just ignore exceptions since missing fields are handled in the ConcatFields class } } } else { // no output fields selected, take them all, remove them all row.clear(); } } // Check Target Field Name if ( Utils.isEmpty( targetFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "ConcatFieldsMeta.CheckResult.TargetFieldNameMissing" ) ); } // add targetFieldName ValueMetaInterface vValue = new ValueMetaString( targetFieldName ); vValue.setLength( targetFieldLength, 0 ); vValue.setOrigin( name ); if ( !Utils.isEmpty( getEncoding() ) ) { vValue.setStringEncoding( getEncoding() ); } row.addValueMeta( vValue ); }
Example #30
Source Project: pentaho-kettle Author: pentaho File: NormalExecutionIT.java License: Apache License 2.0 | 5 votes |
@Override public void errorRowWrittenEvent( RowMetaInterface rowMeta, Object[] row ) throws KettleStepException { if ( !isListening() ) { ignoredError++; } else { error++; } }