public void loadRow( Object[] r ) throws Exception { // Store rows for processing Map<String, Object> columns = new Hashtable<String, Object>(); for ( String field : inputRowMeta.getFieldNames() ) { columns.put( field, r[inputRowMeta.indexOfValue( field )] ); } rowList.add( new Row( columns, true ) ); }
private void fillPreviousFieldTableViewColumn() throws KettleException { RowMetaInterface r = transMeta.getPrevStepFields( stepname ); if ( r != null ) { List<String> fieldNameList = Arrays.asList( r.getFieldNames() ); Collections.sort( fieldNameList ); colinf[1] = new ColumnInfo( getLocalizedColumn( 1 ), ColumnInfo.COLUMN_TYPE_CCOMBO, fieldNameList.toArray( new String[0] ), true ); } }
public void run() { if ( inputFields != null ) { String[] fieldNames = inputFields.getFieldNames(); wParent.setItems( fieldNames ); wChild.setItems( fieldNames ); } } } );
private void setFileField() { try { wFilenameField.removeAll(); RowMetaInterface r = transMeta.getPrevStepFields( stepname ); if ( r != null ) { r.getFieldNames(); for ( int i = 0; i < r.getFieldNames().length; i++ ) { wFilenameField.add( r.getFieldNames()[i] ); } } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "GetFilesRowsCountDialog.FailedToGetFields.DialogTitle" ), BaseMessages.getString( PKG, "GetFilesRowsCountDialog.FailedToGetFields.DialogMessage" ), ke ); } }
private void setURLPreviousField() { try { wUrlField.removeAll(); RowMetaInterface r = transMeta.getPrevStepFields( stepname ); if ( r != null ) { r.getFieldNames(); for ( int i = 0; i < r.getFieldNames().length; i++ ) { wUrlField.add( r.getFieldNames()[i] ); } } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "RssInputDialog.FailedToGetFields.DialogTitle" ), BaseMessages .getString( PKG, "RssInputDialog.FailedToGetFields.DialogMessage" ), ke ); } }
private void get() { try { wTableName.removeAll(); RowMetaInterface r = transMeta.getPrevStepFields( stepname ); if ( r != null ) { r.getFieldNames(); for ( int i = 0; i < r.getFieldNames().length; i++ ) { wTableName.add( r.getFieldNames()[i] ); } } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "TableExistsDialog.FailedToGetFields.DialogTitle" ), BaseMessages .getString( PKG, "TableExistsDialog.FailedToGetFields.DialogMessage" ), ke ); } }
private void setXMLStreamField() { try { wYAMLLField.removeAll(); RowMetaInterface r = transMeta.getPrevStepFields( stepname ); if ( r != null ) { r.getFieldNames(); for ( int i = 0; i < r.getFieldNames().length; i++ ) { wYAMLLField.add( r.getFieldNames()[i] ); } } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "YamlInputDialog.FailedToGetFields.DialogTitle" ), BaseMessages .getString( PKG, "YamlInputDialog.FailedToGetFields.DialogMessage" ), ke ); } }
public void run() { try { prevFields = transMeta.getPrevStepFields( stepname ); } catch ( KettleException e ) { prevFields = new RowMeta(); String msg = BaseMessages.getString( PKG, "SapInputDialog.DoMapping.UnableToFindInput" ); logError( msg ); } String[] prevStepFieldNames = prevFields.getFieldNames(); Arrays.sort( prevStepFieldNames ); for ( int i = 0; i < inputFieldColumns.size(); i++ ) { ColumnInfo colInfo = outputFieldColumns.get( i ); colInfo.setComboValues( prevStepFieldNames ); } } };
public void run() { try { prevFields = transMeta.getPrevStepFields( stepname ); } catch ( KettleException e ) { prevFields = new RowMeta(); String msg = BaseMessages.getString( PKG, "SelectValuesDialog.DoMapping.UnableToFindInput" ); logError( msg ); } String[] prevStepFieldNames = prevFields != null ? prevFields.getFieldNames() : new String[0]; Arrays.sort( prevStepFieldNames ); bPreviousFieldsLoaded = true; for ( int i = 0; i < fieldColumns.size(); i++ ) { ColumnInfo colInfo = fieldColumns.get( i ); colInfo.setComboValues( prevStepFieldNames ); } } };
public void run() { try { prevFields = transMeta.getPrevStepFields( stepname ); } catch ( KettleException e ) { prevFields = new RowMeta(); String msg = BaseMessages.getString( PKG, "DatabaseLookupDialog.DoMapping.UnableToFindInput" ); logError( msg ); } String[] prevStepFieldNames = prevFields.getFieldNames(); Arrays.sort( prevStepFieldNames ); for ( ColumnInfo colInfo : fieldColumns ) { colInfo.setComboValues( prevStepFieldNames ); } } };
private void getFields() { if ( !gotPreviousFields ) { try { RowMetaInterface r = transMeta.getPrevStepFields( stepname ); if ( r != null ) { fieldNames = r.getFieldNames(); } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "RssOutputDialog.FailedToGetFields.DialogTitle" ), BaseMessages .getString( PKG, "RssOutputDialog.FailedToGetFields.DialogMessage" ), ke ); } gotPreviousFields = true; } }
private void getFields() { if ( !gotPreviousFields ) { try { RowMetaInterface r = transMeta.getPrevStepFields( stepname ); if ( r != null ) { fieldNames = r.getFieldNames(); } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "PropertyOutputDialog.FailedToGetFields.DialogTitle" ), BaseMessages.getString( PKG, "PropertyOutputDialog.FailedToGetFields.DialogMessage" ), ke ); } gotPreviousFields = true; } }
private String[] getInputFieldNames() { if ( this.fieldNames == null ) { try { RowMetaInterface r = transMeta.getPrevStepFields( stepname ); if ( r != null ) { fieldNames = r.getFieldNames(); } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "ElasticSearchBulkDialog.FailedToGetFields.DialogTitle" ), BaseMessages.getString( PKG, "ElasticSearchBulkDialog.FailedToGetFields.DialogMessage" ), ke ); return new String[0]; } } return fieldNames; }
void prepareForReMap() throws KettleStepException { // prepare for re-map when removeSelectedFields if ( meta.isRemoveSelectedFields() ) { data.remainingFieldsInputOutputMapping = new int[ data.outputRowMeta.size() - 1 ]; // -1: don't need the new // target field String[] fieldNames = data.outputRowMeta.getFieldNames(); for ( int i = 0; i < fieldNames.length - 1; i++ ) { // -1: don't search the new target field data.remainingFieldsInputOutputMapping[ i ] = data.inputRowMetaModified.indexOfValue( fieldNames[ i ] ); if ( data.remainingFieldsInputOutputMapping[ i ] < 0 ) { throw new KettleStepException( BaseMessages.getString( PKG, "ConcatFields.Error.RemainingFieldNotFoundInputStream", "" + fieldNames[ i ] ) ); } } } }
@Test public void prevStepFieldsAreIncludedInGetStepFields() throws KettleStepException { TransMeta transMeta = new TransMeta( new Variables() ); StepMeta prevStep1 = testStep( "prevStep1", emptyList(), asList( "field1", "field2" ) ); StepMeta prevStep2 = testStep( "prevStep2", emptyList(), asList( "field3", "field4", "field5" ) ); StepMeta someStep = testStep( "step", asList( "prevStep1" ), asList( "outputField" ) ); StepMeta after = new StepMeta( "after", new DummyTransMeta() ); wireUpTestTransMeta( transMeta, prevStep1, prevStep2, someStep, after ); RowMetaInterface results = transMeta.getStepFields( someStep, after, mock( ProgressMonitorListener.class ) ); assertThat( 4, equalTo( results.size() ) ); assertThat( new String[] { "field3", "field4", "field5", "outputField" }, equalTo( results.getFieldNames() ) ); }
private void loadComboOptions() { try { String fieldvalue = null; if ( inputFieldControl.getText() != null ) { fieldvalue = inputFieldControl.getText(); } RowMetaInterface r = transMeta.getPrevStepFields( stepname ); if ( r != null ) { inputFieldControl.setItems( r.getFieldNames() ); } if ( fieldvalue != null ) { inputFieldControl.setText( fieldvalue ); } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "NumberRange.TypeLongDesc" ), "Can't get fields", ke ); } }
private void setFieldname() { try { String field = wMessage.getText(); wMessage.removeAll(); RowMetaInterface r = transMeta.getPrevStepFields( stepname ); wMessage.setItems( r.getFieldNames() ); if ( field != null ) { wMessage.setText( field ); } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "SymmetricCryptoTransDialog.FailedToGetFields.DialogTitle" ), BaseMessages.getString( PKG, "SymmetricCryptoTransDialogMod.FailedToGetFields.DialogMessage" ), ke ); } }
private void setSourceStreamField() { try { String value = wFieldValue.getText(); wFieldValue.removeAll(); RowMetaInterface r = transMeta.getPrevStepFields( stepname ); if ( r != null ) { wFieldValue.setItems( r.getFieldNames() ); } if ( value != null ) { wFieldValue.setText( value ); } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "JsonInputDialog.FailedToGetFields.DialogTitle" ), BaseMessages.getString( PKG, "JsonInputDialog.FailedToGetFields.DialogMessage" ), ke ); } }
private void setSourceStreamField() { try { String value = cbSourceField.getText(); cbSourceField.removeAll(); RowMetaInterface r = transMeta.getPrevStepFields( stepname ); if ( r != null ) { cbSourceField.setItems( r.getFieldNames() ); } if ( value != null ) { cbSourceField.setText( value ); } } catch ( KettleException ke ) { new ErrorDialog( shell, BaseMessages.getString( PKG, "XMLInputStreamDialog.FailedToGetFields.DialogTitle" ), BaseMessages.getString( PKG, "XMLInputStreamDialog.FailedToGetFields.DialogMessage" ), ke ); } }
@Test public void testGetValueMetaPlugin() throws KettleStepException { GetVariableMeta meta = new GetVariableMeta(); meta.setDefault(); FieldDefinition field = new FieldDefinition(); field.setFieldName( "outputField" ); field.setVariableString( String.valueOf( 2000000L ) ); field.setFieldType( ValueMetaInterface.TYPE_TIMESTAMP ); meta.setFieldDefinitions( new FieldDefinition[]{ field } ); RowMetaInterface rowMeta = new RowMeta(); meta.getFields( rowMeta, "stepName", null, null, new Variables(), null, null ); assertNotNull( rowMeta ); assertEquals( 1, rowMeta.size() ); assertEquals( "outputField", rowMeta.getFieldNames()[0] ); assertEquals( ValueMetaInterface.TYPE_TIMESTAMP, rowMeta.getValueMeta( 0 ).getType() ); assertTrue( rowMeta.getValueMeta( 0 ) instanceof ValueMetaTimestamp ); }