@Override public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { ValueMetaInterface mcValue = new ValueMetaString( outputField ); mcValue.setOrigin( name ); mcValue.setLength( 255 ); row.addValueMeta( mcValue ); }
public static ValueMetaInterface createValueMeta( String name, int type, int length, int precision ) throws KettlePluginException { PluginInterface stringPlugin = pluginRegistry.getPlugin( ValueMetaPluginType.class, String.valueOf( type ) ); if ( stringPlugin == null ) { throw new KettlePluginException( "Unable to locate value meta plugin of type (id) " + type ); } ValueMetaInterface valueMeta = pluginRegistry.loadClass( stringPlugin, ValueMetaInterface.class ); valueMeta.setName( name ); valueMeta.setLength( length, precision ); return valueMeta; }
@Override public void setDefault() { value = new ValueMetaAndData( new ValueMetaNumber( "valuename" ), new Double( 123.456 ) ); value.getValueMeta().setLength( 12 ); value.getValueMeta().setPrecision( 4 ); }
@Override public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) { if ( !Utils.isEmpty( resultfieldName ) ) { ValueMetaInterface v = new ValueMetaInteger( resultfieldName ); v.setLength( ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0 ); v.setOrigin( name ); r.addValueMeta( v ); } }
public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) { // No values are added to the row in this type of step // However, in case of Fixed length records, // the field precisions and lengths are altered! for ( int i = 0; i < outputFields.length; i++ ) { XMLField field = outputFields[i]; ValueMetaInterface v = row.searchValueMeta( field.getFieldName() ); if ( v != null ) { v.setLength( field.getLength(), field.getPrecision() ); } } }
public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { ValueMetaInterface v = new ValueMetaInteger( space.environmentSubstitute( rowsCountFieldName ) ); v.setLength( ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0 ); v.setOrigin( name ); r.addValueMeta( v ); if ( includeFilesCount ) { v = new ValueMetaInteger( space.environmentSubstitute( filesCountFieldName ) ); v.setLength( ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0 ); v.setOrigin( name ); r.addValueMeta( v ); } }
public List<RowMetaInterface> getRecommendedIndexes() { List<RowMetaInterface> indexes = new ArrayList<RowMetaInterface>(); LogTableField keyField = getKeyField(); if ( keyField.isEnabled() ) { RowMetaInterface batchIndex = new RowMeta(); ValueMetaInterface keyMeta = new ValueMetaBase( keyField.getFieldName(), keyField.getDataType() ); keyMeta.setLength( keyField.getLength() ); batchIndex.addValueMeta( keyMeta ); indexes.add( batchIndex ); } return indexes; } }
public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { if ( !Utils.isEmpty( linenumfield ) ) { ValueMetaInterface v = new ValueMetaInteger( space.environmentSubstitute( linenumfield ) ); v.setLength( ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0 ); v.setOrigin( name ); inputRowMeta.addValueMeta( v ); } }
public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { String realfieldname = space.environmentSubstitute( getSalesforceIDFieldName() ); if ( !Utils.isEmpty( realfieldname ) ) { ValueMetaInterface v = new ValueMetaString( realfieldname ); v.setLength( 18 ); v.setOrigin( name ); r.addValueMeta( v ); } }
public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { String realfieldname = space.environmentSubstitute( getSalesforceIDFieldName() ); if ( !Utils.isEmpty( realfieldname ) ) { ValueMetaInterface v = new ValueMetaString( realfieldname ); v.setLength( 18 ); v.setOrigin( name ); r.addValueMeta( v ); } }
public StringEvaluationResult build() { ValueMetaInterface meta = new ValueMeta( name, type ); meta.setConversionMask( format ); meta.setTrimType( trimType ); meta.setDecimalSymbol( decimalSymbol ); meta.setGroupingSymbol( groupingSymbol ); meta.setLength( length ); meta.setPrecision( precision ); return new StringEvaluationResult( meta ); }
@Override public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { // change the case insensitive flag too for ( int i = 0; i < compareFields.length; i++ ) { int idx = row.indexOfValue( compareFields[i] ); if ( idx >= 0 ) { row.getValueMeta( idx ).setCaseInsensitive( caseInsensitive[i] ); } } if ( countRows ) { ValueMetaInterface v = new ValueMetaInteger( countField ); v.setLength( ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0 ); v.setOrigin( name ); row.addValueMeta( v ); } }
@Override public void getFields( RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { ValueMetaInterface v = new ValueMetaInteger( technicalKeyField ); v.setLength( 10 ); v.setPrecision( 0 ); v.setOrigin( origin ); row.addValueMeta( v ); if ( replaceFields ) { for ( int i = 0; i < keyField.length; i++ ) { int idx = row.indexOfValue( keyField[ i ] ); if ( idx >= 0 ) { row.removeValueMeta( idx ); } } } }
public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { ValueMetaInterface v = new ValueMetaString( newFieldname ); v.setOrigin( name ); row.addValueMeta( v ); // include row number if ( includeRowNumber ) { v = new ValueMetaInteger( space.environmentSubstitute( rowNumberField ) ); v.setLength( ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0 ); v.setOrigin( name ); row.addValueMeta( v ); } }
@SuppressWarnings( "unchecked" ) public static void getFields( boolean clearResultFields, RowMetaInterface row, String originStepname, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, List<?> fields ) throws KettleStepException { if ( clearResultFields ) { row.clear(); } for ( FieldInfo fi : (List<FieldInfo>) fields ) { try { ValueMetaInterface v = ValueMetaFactory.createValueMeta( fi.name, fi.type ); v.setLength( fi.length ); v.setPrecision( fi.precision ); v.setOrigin( originStepname ); row.addValueMeta( v ); } catch ( Exception e ) { throw new KettleStepException( e ); } } }
public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( int i = 0; i < fieldOutStream.length; i++ ) { ValueMetaInterface v; if ( !Utils.isEmpty( fieldOutStream[i] ) ) { v = new ValueMetaString( space.environmentSubstitute( fieldOutStream[i] ) ); v.setLength( 100, -1 ); v.setOrigin( name ); inputRowMeta.addValueMeta( v ); } else { v = inputRowMeta.searchValueMeta( fieldInStream[i] ); if ( v == null ) { continue; } v.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); } } }
private ValueMetaAndData getValue( String valuename ) throws KettleValueException { try { int valtype = ValueMetaFactory.getIdForValueMeta( wValueType.getText() ); ValueMetaAndData val = new ValueMetaAndData( valuename, wInputString.getText() ); ValueMetaInterface valueMeta = ValueMetaFactory.cloneValueMeta( val.getValueMeta(), valtype ); Object valueData = val.getValueData(); int formatIndex = wFormat.getSelectionIndex(); valueMeta.setConversionMask( formatIndex >= 0 ? wFormat.getItem( formatIndex ) : wFormat.getText() ); valueMeta.setLength( Const.toInt( wLength.getText(), -1 ) ); valueMeta.setPrecision( Const.toInt( wPrecision.getText(), -1 ) ); val.setValueMeta( valueMeta ); ValueMetaInterface stringValueMeta = new ValueMetaString( valuename ); stringValueMeta.setConversionMetadata( valueMeta ); Object targetData = stringValueMeta.convertDataUsingConversionMetaData( valueData ); val.setValueData( targetData ); return val; } catch ( Exception e ) { throw new KettleValueException( e ); } }
public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { ValueMetaInterface v = new ValueMetaString( cardNumberFieldName ); v.setOrigin( name ); row.addValueMeta( v ); if ( !Utils.isEmpty( getCardTypeFieldName() ) ) { v = new ValueMetaString( cardTypeFieldName ); v.setOrigin( name ); row.addValueMeta( v ); } if ( !Utils.isEmpty( getCardLengthFieldName() ) ) { v = new ValueMetaInteger( cardLengthFieldName ); v.setLength( ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0 ); v.setOrigin( name ); row.addValueMeta( v ); } }
@Override public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( SasInputField field : outputFields ) { try { ValueMetaInterface valueMeta = ValueMetaFactory.createValueMeta( field.getRename(), field.getType() ); valueMeta.setLength( field.getLength(), field.getPrecision() ); valueMeta.setDecimalSymbol( field.getDecimalSymbol() ); valueMeta.setGroupingSymbol( field.getGroupingSymbol() ); valueMeta.setConversionMask( field.getConversionMask() ); valueMeta.setTrimType( field.getTrimType() ); valueMeta.setOrigin( name ); row.addValueMeta( valueMeta ); } catch ( Exception e ) { throw new KettleStepException( e ); } } }
public ValueMetaInterface toValueMeta( String fieldOriginStepName, VariableSpace vspace ) throws KettlePluginException { int type = getType(); if ( type == ValueMetaInterface.TYPE_NONE ) { type = ValueMetaInterface.TYPE_STRING; } ValueMetaInterface v = ValueMetaFactory.createValueMeta( vspace != null ? vspace.environmentSubstitute( getName() ) : getName(), type ); v.setLength( getLength() ); v.setPrecision( getPrecision() ); v.setOrigin( fieldOriginStepName ); v.setConversionMask( getFormat() ); v.setDecimalSymbol( getDecimalSymbol() ); v.setGroupingSymbol( getGroupSymbol() ); v.setCurrencySymbol( getCurrencySymbol() ); v.setTrimType( getTrimType() ); return v; }