@Test public void testGetFields() throws Exception { StringOperationsMeta meta = new StringOperationsMeta(); meta.allocate( 1 ); meta.setFieldInStream( new String[] { "field1" } ); RowMetaInterface rowMetaInterface = new RowMeta(); ValueMetaInterface valueMeta = new ValueMetaString( "field1" ); valueMeta.setStorageMetadata( new ValueMetaString( "field1" ) ); valueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_BINARY_STRING ); rowMetaInterface.addValueMeta( valueMeta ); VariableSpace space = mock( VariableSpace.class ); meta.getFields( rowMetaInterface, "STRING_OPERATIONS", null, null, space, null, null ); RowMetaInterface expectedRowMeta = new RowMeta(); expectedRowMeta.addValueMeta( new ValueMetaString( "field1" ) ); assertEquals( expectedRowMeta.toString(), rowMetaInterface.toString() ); }
@Override 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; String outputField = space.environmentSubstitute( fieldOutStream[i] ); if ( !Utils.isEmpty( outputField ) ) { v = new ValueMetaString( outputField ); 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 ); int paddingType = getPaddingType()[i]; if ( paddingType == PADDING_LEFT || paddingType == PADDING_RIGHT ) { int padLen = Const.toInt( space.environmentSubstitute( getPadLen()[i] ), 0 ); if ( padLen > v.getLength() ) { v.setLength( padLen ); } } } } }
StringOperationsMeta extends BaseStepMeta implements StepMetaInterface { @Override 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; String outputField = space.environmentSubstitute( fieldOutStream[i] ); if ( !Utils.isEmpty( outputField ) ) { v = new ValueMetaString( outputField ); 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 ); int paddingType = getPaddingType()[i]; if ( paddingType == PADDING_LEFT || paddingType == PADDING_RIGHT ) { int padLen = Const.toInt( space.environmentSubstitute( getPadLen()[i] ), 0 ); if ( padLen > v.getLength() ) { v.setLength( padLen ); } } } } } }
StringOperationsMeta extends BaseStepMeta implements StepMetaInterface { @Override 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; String outputField = space.environmentSubstitute( fieldOutStream[i] ); if ( !Utils.isEmpty( outputField ) ) { v = new ValueMetaString( outputField ); 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 ); int paddingType = getPaddingType()[i]; if ( paddingType == PADDING_LEFT || paddingType == PADDING_RIGHT ) { int padLen = Const.toInt( space.environmentSubstitute( getPadLen()[i] ), 0 ); if ( padLen > v.getLength() ) { v.setLength( padLen ); } } } } } StringOperationsMeta(); }
StringOperationsMeta extends BaseStepMeta implements StepMetaInterface { @Override 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; String outputField = space.environmentSubstitute( fieldOutStream[i] ); if ( !Utils.isEmpty( outputField ) ) { v = new ValueMetaString( outputField ); 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 ); int paddingType = getPaddingType()[i]; if ( paddingType == PADDING_LEFT || paddingType == PADDING_RIGHT ) { int padLen = Const.toInt( space.environmentSubstitute( getPadLen()[i] ), 0 ); if ( padLen > v.getLength() ) { v.setLength( padLen ); } } } } } StringOperationsMeta(); String[] getFieldInStream(); void setFieldInStream( String[] keyStream ); String[] getFieldOutStream(); void setFieldOutStream( String[] keyStream ); String[] getPadLen(); void setPadLen( String[] value ); String[] getPadChar(); void setPadChar( String[] value ); int[] getTrimType(); void setTrimType( int[] trimType ); int[] getLowerUpper(); void setLowerUpper( int[] lowerUpper ); int[] getInitCap(); void setInitCap( int[] value ); int[] getMaskXML(); void setMaskXML( int[] value ); int[] getDigits(); void setDigits( int[] value ); int[] getRemoveSpecialCharacters(); void setRemoveSpecialCharacters( int[] value ); int[] getPaddingType(); void setPaddingType( int[] value ); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrkeys ); @Override Object clone(); @Override void setDefault(); @Override String getXML(); @Override void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); @Override void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep,
    VariableSpace space, Repository repository, IMetaStore metaStore ); @Override void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepinfo,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space,
    Repository repository, IMetaStore metaStore ); @Override StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr,
    TransMeta transMeta, Trans trans ); @Override StepDataInterface getStepData(); @Override boolean supportsErrorHandling(); static String getTrimTypeDesc( int i ); static String getLowerUpperDesc( int i ); static String getInitCapDesc( int i ); static String getMaskXMLDesc( int i ); static String getDigitsDesc( int i ); static String getRemoveSpecialCharactersDesc( int i ); static String getPaddingDesc( int i ); static int getTrimTypeByDesc( String tt ); static int getLowerUpperByDesc( String tt ); static int getInitCapByDesc( String tt ); static int getMaskXMLByDesc( String tt ); static int getDigitsByDesc( String tt ); static int getRemoveSpecialCharactersByDesc( String tt ); static int getPaddingByDesc( String tt ); }
StringOperationsMeta extends BaseStepMeta implements StepMetaInterface { @Override 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; String outputField = space.environmentSubstitute( fieldOutStream[i] ); if ( !Utils.isEmpty( outputField ) ) { v = new ValueMetaString( outputField ); 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 ); int paddingType = getPaddingType()[i]; if ( paddingType == PADDING_LEFT || paddingType == PADDING_RIGHT ) { int padLen = Const.toInt( space.environmentSubstitute( getPadLen()[i] ), 0 ); if ( padLen > v.getLength() ) { v.setLength( padLen ); } } } } } StringOperationsMeta(); String[] getFieldInStream(); void setFieldInStream( String[] keyStream ); String[] getFieldOutStream(); void setFieldOutStream( String[] keyStream ); String[] getPadLen(); void setPadLen( String[] value ); String[] getPadChar(); void setPadChar( String[] value ); int[] getTrimType(); void setTrimType( int[] trimType ); int[] getLowerUpper(); void setLowerUpper( int[] lowerUpper ); int[] getInitCap(); void setInitCap( int[] value ); int[] getMaskXML(); void setMaskXML( int[] value ); int[] getDigits(); void setDigits( int[] value ); int[] getRemoveSpecialCharacters(); void setRemoveSpecialCharacters( int[] value ); int[] getPaddingType(); void setPaddingType( int[] value ); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrkeys ); @Override Object clone(); @Override void setDefault(); @Override String getXML(); @Override void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); @Override void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep,
    VariableSpace space, Repository repository, IMetaStore metaStore ); @Override void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepinfo,
    RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space,
    Repository repository, IMetaStore metaStore ); @Override StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr,
    TransMeta transMeta, Trans trans ); @Override StepDataInterface getStepData(); @Override boolean supportsErrorHandling(); static String getTrimTypeDesc( int i ); static String getLowerUpperDesc( int i ); static String getInitCapDesc( int i ); static String getMaskXMLDesc( int i ); static String getDigitsDesc( int i ); static String getRemoveSpecialCharactersDesc( int i ); static String getPaddingDesc( int i ); static int getTrimTypeByDesc( String tt ); static int getLowerUpperByDesc( String tt ); static int getInitCapByDesc( String tt ); static int getMaskXMLByDesc( String tt ); static int getDigitsByDesc( String tt ); static int getRemoveSpecialCharactersByDesc( String tt ); static int getPaddingByDesc( String tt ); static final String[] trimTypeCode; static final int TRIM_NONE; static final int TRIM_LEFT; static final int TRIM_RIGHT; static final int TRIM_BOTH; static final String[] trimTypeDesc; static final String[] lowerUpperCode; static final int LOWER_UPPER_NONE; static final int LOWER_UPPER_LOWER; static final int LOWER_UPPER_UPPER; static final String[] lowerUpperDesc; static final String[] initCapDesc; static final String[] initCapCode; static final int INIT_CAP_NO; static final int INIT_CAP_YES; static final String[] digitsCode; static final int DIGITS_NONE; static final int DIGITS_ONLY; static final int DIGITS_REMOVE; static final String[] digitsDesc; static final String[] maskXMLDesc; static final String[] maskXMLCode; static final int MASK_NONE; static final int MASK_ESCAPE_XML; static final int MASK_CDATA; static final int MASK_UNESCAPE_XML; static final int MASK_ESCAPE_SQL; static final int MASK_ESCAPE_HTML; static final int MASK_UNESCAPE_HTML; static final String[] removeSpecialCharactersCode; static final int REMOVE_SPECIAL_CHARACTERS_NONE; static final int REMOVE_SPECIAL_CHARACTERS_CR; static final int REMOVE_SPECIAL_CHARACTERS_LF; static final int REMOVE_SPECIAL_CHARACTERS_CRLF; static final int REMOVE_SPECIAL_CHARACTERS_TAB; static final int REMOVE_SPECIAL_CHARACTERS_ESPACE; static final String[] removeSpecialCharactersDesc; static final String[] paddingDesc; static final String[] paddingCode; static final int PADDING_NONE; static final int PADDING_LEFT; static final int PADDING_RIGHT; }