target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test( timeout = 2000 ) public void testNoEndlessLoop() throws KettleValueException { long[] inputData = { 3034, 2085, 1912, 9367, 8442, 783, 2839, 8610, 5152, 7388, 7511, 1251, 3043, 3889, 9543, 9353, 2241, 5416, 2127, 3513, 2171, 8633, 5594, 7228, 2225, 581, 6524, 7171, 5928, 5710, 804, 9535, 3334, 3383, 3113, 248, 4801, 8927, 1815, 2382, 7043, 2962, 8362, 8353, 5883, 4489, 4554, 218, 50, 200, 9519, 6615, 8264, 5797, 3586, 3185, 299, 2334, 1944, 4953, 9829, 5852, 8424, 1046, 918, 3110, 3145, 7828, 2672, 3890, 8661, 8405, 2653, 1514, 856, 8381, 523, 8343, 6566, 9127, 9679, 8667, 3952, 8310, 164, 8947, 822, 778, 7415, 6463, 6576, 849, 4308, 7044, 7549, 6609, 2494, 1594, 4664, 7937, 2788, 6395, 6875, 6480, 7568, 6789, 2864, 5432, 4163, 3164, 9755, 4898, 5639, 5425, 3291, 6811, 149, 8243, 1423, 3869, 1158, 590, 6376, 5665, 629, 7425, 4414, 9882, 6844, 5941, 4815, 7917, 7673, 4153, 4266, 6673, 9082, 8574, 6424, 8245, 8460, 9875, 6946, 9506, 7479, 2138, 2091, 4336, 5657, 77, 2269, 3682, 7421, 2671, 1413, 4430, 2762, 1174, 9153, 4963, 1959, 3165, 7703, 7539, 9833, 5661, 1189, 839, 1310, 382, 9538, 5953, 2448, 2368, 5385, 1847, 5919, 6954, 9685, 7568, 6915, 4009, 3990, 4742, 5196, 126, 693, 5448, 2405, 1853, 8109, 8198, 6761, 350, 4825, 3288, 9778, 7801, 7950, 2754, 4137, 5682, 6611, 858, 9058, 9616, 5261, 5946, 7339, 5296, 1818, 2591, 2949, 147, 4511, 2431, 7376, 8260, 5719, 264, 5649, 1671, 6014, 9714, 5349, 9824, 8063, 9646, 1203, 5800, 9024, 6730, 1645, 7332, 9524, 4672, 2984, 5491, 8, 8492, 6134, 8895, 9105, 6947, 4917, 9552, 3332, 8117, 3949, 9464, 6730, 7707, 5456, 288, 4462, 6444, 9706, 4575, 8890, 7367, 676, 2974, 2721, 2209, 9692, 6968, 9708, 6959, 2382, 7975, 9866, 2260, 7707, 8916, 1811, 5375, 2490, 7478, 1915, 5538, 4217, 1125, 14, 4033, 8474, 8433, 4315, 4426, 9201, 3205 }; LongHashIndex index = new LongHashIndex(); for ( long currentElement : inputData ) { index.put( currentElement, currentElement ); } }
public void put( long key, Long value ) throws KettleValueException { int hashCode = generateHashCode( key ); int indexPointer = indexFor( hashCode, index.length ); LongHashIndexEntry check = index[indexPointer]; LongHashIndexEntry previousCheck = null; while ( check != null ) { if ( check.hashCode == hashCode && check.equalsKey( key ) ) { check.value = value; return; } previousCheck = check; check = check.nextEntry; } if ( previousCheck != null ) { previousCheck.nextEntry = new LongHashIndexEntry( hashCode, key, value, null ); } else { index[indexPointer] = new LongHashIndexEntry( hashCode, key, value, null ); } resize(); }
LongHashIndex { public void put( long key, Long value ) throws KettleValueException { int hashCode = generateHashCode( key ); int indexPointer = indexFor( hashCode, index.length ); LongHashIndexEntry check = index[indexPointer]; LongHashIndexEntry previousCheck = null; while ( check != null ) { if ( check.hashCode == hashCode && check.equalsKey( key ) ) { check.value = value; return; } previousCheck = check; check = check.nextEntry; } if ( previousCheck != null ) { previousCheck.nextEntry = new LongHashIndexEntry( hashCode, key, value, null ); } else { index[indexPointer] = new LongHashIndexEntry( hashCode, key, value, null ); } resize(); } }
LongHashIndex { public void put( long key, Long value ) throws KettleValueException { int hashCode = generateHashCode( key ); int indexPointer = indexFor( hashCode, index.length ); LongHashIndexEntry check = index[indexPointer]; LongHashIndexEntry previousCheck = null; while ( check != null ) { if ( check.hashCode == hashCode && check.equalsKey( key ) ) { check.value = value; return; } previousCheck = check; check = check.nextEntry; } if ( previousCheck != null ) { previousCheck.nextEntry = new LongHashIndexEntry( hashCode, key, value, null ); } else { index[indexPointer] = new LongHashIndexEntry( hashCode, key, value, null ); } resize(); } LongHashIndex( int size ); LongHashIndex(); }
LongHashIndex { public void put( long key, Long value ) throws KettleValueException { int hashCode = generateHashCode( key ); int indexPointer = indexFor( hashCode, index.length ); LongHashIndexEntry check = index[indexPointer]; LongHashIndexEntry previousCheck = null; while ( check != null ) { if ( check.hashCode == hashCode && check.equalsKey( key ) ) { check.value = value; return; } previousCheck = check; check = check.nextEntry; } if ( previousCheck != null ) { previousCheck.nextEntry = new LongHashIndexEntry( hashCode, key, value, null ); } else { index[indexPointer] = new LongHashIndexEntry( hashCode, key, value, null ); } resize(); } LongHashIndex( int size ); LongHashIndex(); int getSize(); boolean isEmpty(); Long get( long key ); void put( long key, Long value ); static int generateHashCode( Long key ); static int indexFor( int hash, int length ); }
LongHashIndex { public void put( long key, Long value ) throws KettleValueException { int hashCode = generateHashCode( key ); int indexPointer = indexFor( hashCode, index.length ); LongHashIndexEntry check = index[indexPointer]; LongHashIndexEntry previousCheck = null; while ( check != null ) { if ( check.hashCode == hashCode && check.equalsKey( key ) ) { check.value = value; return; } previousCheck = check; check = check.nextEntry; } if ( previousCheck != null ) { previousCheck.nextEntry = new LongHashIndexEntry( hashCode, key, value, null ); } else { index[indexPointer] = new LongHashIndexEntry( hashCode, key, value, null ); } resize(); } LongHashIndex( int size ); LongHashIndex(); int getSize(); boolean isEmpty(); Long get( long key ); void put( long key, Long value ); static int generateHashCode( Long key ); static int indexFor( int hash, int length ); }
@Test public void testGet() throws KettleValueException { LongHashIndex index = new LongHashIndex(); index.put( 1L, 1L ); assertThat( "Element has uncorrect value.", index.get( 1L ), equalTo( 1L ) ); }
public Long get( long key ) throws KettleValueException { int hashCode = generateHashCode( key ); int indexPointer = indexFor( hashCode, index.length ); LongHashIndexEntry check = index[indexPointer]; while ( check != null ) { if ( check.hashCode == hashCode && check.equalsKey( key ) ) { return check.value; } check = check.nextEntry; } return null; }
LongHashIndex { public Long get( long key ) throws KettleValueException { int hashCode = generateHashCode( key ); int indexPointer = indexFor( hashCode, index.length ); LongHashIndexEntry check = index[indexPointer]; while ( check != null ) { if ( check.hashCode == hashCode && check.equalsKey( key ) ) { return check.value; } check = check.nextEntry; } return null; } }
LongHashIndex { public Long get( long key ) throws KettleValueException { int hashCode = generateHashCode( key ); int indexPointer = indexFor( hashCode, index.length ); LongHashIndexEntry check = index[indexPointer]; while ( check != null ) { if ( check.hashCode == hashCode && check.equalsKey( key ) ) { return check.value; } check = check.nextEntry; } return null; } LongHashIndex( int size ); LongHashIndex(); }
LongHashIndex { public Long get( long key ) throws KettleValueException { int hashCode = generateHashCode( key ); int indexPointer = indexFor( hashCode, index.length ); LongHashIndexEntry check = index[indexPointer]; while ( check != null ) { if ( check.hashCode == hashCode && check.equalsKey( key ) ) { return check.value; } check = check.nextEntry; } return null; } LongHashIndex( int size ); LongHashIndex(); int getSize(); boolean isEmpty(); Long get( long key ); void put( long key, Long value ); static int generateHashCode( Long key ); static int indexFor( int hash, int length ); }
LongHashIndex { public Long get( long key ) throws KettleValueException { int hashCode = generateHashCode( key ); int indexPointer = indexFor( hashCode, index.length ); LongHashIndexEntry check = index[indexPointer]; while ( check != null ) { if ( check.hashCode == hashCode && check.equalsKey( key ) ) { return check.value; } check = check.nextEntry; } return null; } LongHashIndex( int size ); LongHashIndex(); int getSize(); boolean isEmpty(); Long get( long key ); void put( long key, Long value ); static int generateHashCode( Long key ); static int indexFor( int hash, int length ); }
@Test public void testIsEmpty() throws KettleValueException { LongHashIndex index = new LongHashIndex(); assertThat( "Empty index should return true.", index.isEmpty(), is( true ) ); index.put( 1L, 1L ); assertThat( "Not empty index should return false.", index.isEmpty(), is( false ) ); }
public boolean isEmpty() { return size == 0; }
LongHashIndex { public boolean isEmpty() { return size == 0; } }
LongHashIndex { public boolean isEmpty() { return size == 0; } LongHashIndex( int size ); LongHashIndex(); }
LongHashIndex { public boolean isEmpty() { return size == 0; } LongHashIndex( int size ); LongHashIndex(); int getSize(); boolean isEmpty(); Long get( long key ); void put( long key, Long value ); static int generateHashCode( Long key ); static int indexFor( int hash, int length ); }
LongHashIndex { public boolean isEmpty() { return size == 0; } LongHashIndex( int size ); LongHashIndex(); int getSize(); boolean isEmpty(); Long get( long key ); void put( long key, Long value ); static int generateHashCode( Long key ); static int indexFor( int hash, int length ); }
@Test public void testArraySizeConstructor() { ByteArrayHashIndex obj = new ByteArrayHashIndex( new RowMeta(), 1 ); assertEquals( 1, obj.getSize() ); obj = new ByteArrayHashIndex( new RowMeta(), 2 ); assertEquals( 2, obj.getSize() ); obj = new ByteArrayHashIndex( new RowMeta(), 3 ); assertEquals( 4, obj.getSize() ); obj = new ByteArrayHashIndex( new RowMeta(), 12 ); assertEquals( 16, obj.getSize() ); obj = new ByteArrayHashIndex( new RowMeta(), 99 ); assertEquals( 128, obj.getSize() ); }
public int getSize() { return size; }
ByteArrayHashIndex { public int getSize() { return size; } }
ByteArrayHashIndex { public int getSize() { return size; } ByteArrayHashIndex( RowMetaInterface keyRowMeta, int size ); ByteArrayHashIndex( RowMetaInterface keyRowMeta ); }
ByteArrayHashIndex { public int getSize() { return size; } ByteArrayHashIndex( RowMetaInterface keyRowMeta, int size ); ByteArrayHashIndex( RowMetaInterface keyRowMeta ); int getSize(); boolean isEmpty(); byte[] get( byte[] key ); void put( byte[] key, byte[] value ); static int generateHashCode( byte[] key, RowMetaInterface rowMeta ); }
ByteArrayHashIndex { public int getSize() { return size; } ByteArrayHashIndex( RowMetaInterface keyRowMeta, int size ); ByteArrayHashIndex( RowMetaInterface keyRowMeta ); int getSize(); boolean isEmpty(); byte[] get( byte[] key ); void put( byte[] key, byte[] value ); static int generateHashCode( byte[] key, RowMetaInterface rowMeta ); }
@Test public void testinItializeVariablesFrom() { final Variables variablesMock = mock( Variables.class ); doCallRealMethod().when( variablesMock ).initializeVariablesFrom( any( VariableSpace.class ) ); @SuppressWarnings( "unchecked" ) final Map<String, String> propertiesMock = mock( Map.class ); when( variablesMock.getProperties() ).thenReturn( propertiesMock ); doAnswer( new Answer<Map<String, String>>() { final String keyStub = "key"; @Override public Map<String, String> answer( InvocationOnMock invocation ) throws Throwable { if ( System.getProperty( keyStub ) == null ) { modifySystemproperties(); } if ( invocation.getArguments()[ 1 ] != null ) { propertiesMock.put( (String) invocation.getArguments()[ 0 ], System.getProperties().getProperty( (String) invocation.getArguments()[ 1 ] ) ); } return propertiesMock; } } ).when( propertiesMock ).put( anyString(), anyString() ); variablesMock.initializeVariablesFrom( null ); }
@Override public void initializeVariablesFrom( VariableSpace parent ) { this.parent = parent; Set<String> systemPropertiesNames = System.getProperties().stringPropertyNames(); for ( String key : systemPropertiesNames ) { getProperties().put( key, System.getProperties().getProperty( key ) ); } if ( parent != null ) { copyVariablesFrom( parent ); } if ( injection != null ) { properties.putAll( injection ); injection = null; } initialized = true; }
Variables implements VariableSpace { @Override public void initializeVariablesFrom( VariableSpace parent ) { this.parent = parent; Set<String> systemPropertiesNames = System.getProperties().stringPropertyNames(); for ( String key : systemPropertiesNames ) { getProperties().put( key, System.getProperties().getProperty( key ) ); } if ( parent != null ) { copyVariablesFrom( parent ); } if ( injection != null ) { properties.putAll( injection ); injection = null; } initialized = true; } }
Variables implements VariableSpace { @Override public void initializeVariablesFrom( VariableSpace parent ) { this.parent = parent; Set<String> systemPropertiesNames = System.getProperties().stringPropertyNames(); for ( String key : systemPropertiesNames ) { getProperties().put( key, System.getProperties().getProperty( key ) ); } if ( parent != null ) { copyVariablesFrom( parent ); } if ( injection != null ) { properties.putAll( injection ); injection = null; } initialized = true; } Variables(); }
Variables implements VariableSpace { @Override public void initializeVariablesFrom( VariableSpace parent ) { this.parent = parent; Set<String> systemPropertiesNames = System.getProperties().stringPropertyNames(); for ( String key : systemPropertiesNames ) { getProperties().put( key, System.getProperties().getProperty( key ) ); } if ( parent != null ) { copyVariablesFrom( parent ); } if ( injection != null ) { properties.putAll( injection ); injection = null; } initialized = true; } Variables(); @Override void copyVariablesFrom( VariableSpace space ); @Override VariableSpace getParentVariableSpace(); @Override void setParentVariableSpace( VariableSpace parent ); @Override String getVariable( String variableName, String defaultValue ); @Override String getVariable( String variableName ); @Override boolean getBooleanValueOfVariable( String variableName, boolean defaultValue ); @Override void initializeVariablesFrom( VariableSpace parent ); @Override String[] listVariables(); @Override void setVariable( String variableName, String variableValue ); @Override String environmentSubstitute( String aString ); @Override String fieldSubstitute( String aString, RowMetaInterface rowMeta, Object[] rowData ); @Override String[] environmentSubstitute( String[] string ); @Override void shareVariablesWith( VariableSpace space ); @Override void injectVariables( Map<String, String> prop ); static synchronized VariableSpace getADefaultVariableSpace(); }
Variables implements VariableSpace { @Override public void initializeVariablesFrom( VariableSpace parent ) { this.parent = parent; Set<String> systemPropertiesNames = System.getProperties().stringPropertyNames(); for ( String key : systemPropertiesNames ) { getProperties().put( key, System.getProperties().getProperty( key ) ); } if ( parent != null ) { copyVariablesFrom( parent ); } if ( injection != null ) { properties.putAll( injection ); injection = null; } initialized = true; } Variables(); @Override void copyVariablesFrom( VariableSpace space ); @Override VariableSpace getParentVariableSpace(); @Override void setParentVariableSpace( VariableSpace parent ); @Override String getVariable( String variableName, String defaultValue ); @Override String getVariable( String variableName ); @Override boolean getBooleanValueOfVariable( String variableName, boolean defaultValue ); @Override void initializeVariablesFrom( VariableSpace parent ); @Override String[] listVariables(); @Override void setVariable( String variableName, String variableValue ); @Override String environmentSubstitute( String aString ); @Override String fieldSubstitute( String aString, RowMetaInterface rowMeta, Object[] rowData ); @Override String[] environmentSubstitute( String[] string ); @Override void shareVariablesWith( VariableSpace space ); @Override void injectVariables( Map<String, String> prop ); static synchronized VariableSpace getADefaultVariableSpace(); }
@Test public void testFieldSubstitution() throws KettleValueException { Object[] rowData = new Object[]{ "DataOne", "DataTwo" }; RowMeta rm = new RowMeta(); rm.addValueMeta( new ValueMetaString( "FieldOne" ) ); rm.addValueMeta( new ValueMetaString( "FieldTwo" ) ); Variables vars = new Variables(); assertNull( vars.fieldSubstitute( null, rm, rowData ) ); assertEquals( "", vars.fieldSubstitute( "", rm, rowData ) ); assertEquals( "DataOne", vars.fieldSubstitute( "?{FieldOne}", rm, rowData ) ); assertEquals( "TheDataOne", vars.fieldSubstitute( "The?{FieldOne}", rm, rowData ) ); }
@Override public String fieldSubstitute( String aString, RowMetaInterface rowMeta, Object[] rowData ) throws KettleValueException { if ( aString == null || aString.length() == 0 ) { return aString; } return StringUtil.substituteField( aString, rowMeta, rowData ); }
Variables implements VariableSpace { @Override public String fieldSubstitute( String aString, RowMetaInterface rowMeta, Object[] rowData ) throws KettleValueException { if ( aString == null || aString.length() == 0 ) { return aString; } return StringUtil.substituteField( aString, rowMeta, rowData ); } }
Variables implements VariableSpace { @Override public String fieldSubstitute( String aString, RowMetaInterface rowMeta, Object[] rowData ) throws KettleValueException { if ( aString == null || aString.length() == 0 ) { return aString; } return StringUtil.substituteField( aString, rowMeta, rowData ); } Variables(); }
Variables implements VariableSpace { @Override public String fieldSubstitute( String aString, RowMetaInterface rowMeta, Object[] rowData ) throws KettleValueException { if ( aString == null || aString.length() == 0 ) { return aString; } return StringUtil.substituteField( aString, rowMeta, rowData ); } Variables(); @Override void copyVariablesFrom( VariableSpace space ); @Override VariableSpace getParentVariableSpace(); @Override void setParentVariableSpace( VariableSpace parent ); @Override String getVariable( String variableName, String defaultValue ); @Override String getVariable( String variableName ); @Override boolean getBooleanValueOfVariable( String variableName, boolean defaultValue ); @Override void initializeVariablesFrom( VariableSpace parent ); @Override String[] listVariables(); @Override void setVariable( String variableName, String variableValue ); @Override String environmentSubstitute( String aString ); @Override String fieldSubstitute( String aString, RowMetaInterface rowMeta, Object[] rowData ); @Override String[] environmentSubstitute( String[] string ); @Override void shareVariablesWith( VariableSpace space ); @Override void injectVariables( Map<String, String> prop ); static synchronized VariableSpace getADefaultVariableSpace(); }
Variables implements VariableSpace { @Override public String fieldSubstitute( String aString, RowMetaInterface rowMeta, Object[] rowData ) throws KettleValueException { if ( aString == null || aString.length() == 0 ) { return aString; } return StringUtil.substituteField( aString, rowMeta, rowData ); } Variables(); @Override void copyVariablesFrom( VariableSpace space ); @Override VariableSpace getParentVariableSpace(); @Override void setParentVariableSpace( VariableSpace parent ); @Override String getVariable( String variableName, String defaultValue ); @Override String getVariable( String variableName ); @Override boolean getBooleanValueOfVariable( String variableName, boolean defaultValue ); @Override void initializeVariablesFrom( VariableSpace parent ); @Override String[] listVariables(); @Override void setVariable( String variableName, String variableValue ); @Override String environmentSubstitute( String aString ); @Override String fieldSubstitute( String aString, RowMetaInterface rowMeta, Object[] rowData ); @Override String[] environmentSubstitute( String[] string ); @Override void shareVariablesWith( VariableSpace space ); @Override void injectVariables( Map<String, String> prop ); static synchronized VariableSpace getADefaultVariableSpace(); }
@Test public void testContentChangeListener() throws Exception { ContentChangedListener listener = mock( ContentChangedListener.class ); transMeta.addContentChangedListener( listener ); transMeta.setChanged(); transMeta.setChanged( true ); verify( listener, times( 2 ) ).contentChanged( same( transMeta ) ); transMeta.clearChanged(); transMeta.setChanged( false ); verify( listener, times( 2 ) ).contentSafe( same( transMeta ) ); transMeta.removeContentChangedListener( listener ); transMeta.setChanged(); transMeta.setChanged( true ); verifyNoMoreInteractions( listener ); }
@Override public void clearChanged() { changed_steps = false; changed_hops = false; for ( int i = 0; i < nrSteps(); i++ ) { getStep( i ).setChanged( false ); if ( getStep( i ).getStepPartitioningMeta() != null ) { getStep( i ).getStepPartitioningMeta().hasChanged( false ); } } for ( int i = 0; i < nrTransHops(); i++ ) { getTransHop( i ).setChanged( false ); } for ( int i = 0; i < partitionSchemas.size(); i++ ) { partitionSchemas.get( i ).setChanged( false ); } for ( int i = 0; i < clusterSchemas.size(); i++ ) { clusterSchemas.get( i ).setChanged( false ); } super.clearChanged(); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { @Override public void clearChanged() { changed_steps = false; changed_hops = false; for ( int i = 0; i < nrSteps(); i++ ) { getStep( i ).setChanged( false ); if ( getStep( i ).getStepPartitioningMeta() != null ) { getStep( i ).getStepPartitioningMeta().hasChanged( false ); } } for ( int i = 0; i < nrTransHops(); i++ ) { getTransHop( i ).setChanged( false ); } for ( int i = 0; i < partitionSchemas.size(); i++ ) { partitionSchemas.get( i ).setChanged( false ); } for ( int i = 0; i < clusterSchemas.size(); i++ ) { clusterSchemas.get( i ).setChanged( false ); } super.clearChanged(); } }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { @Override public void clearChanged() { changed_steps = false; changed_hops = false; for ( int i = 0; i < nrSteps(); i++ ) { getStep( i ).setChanged( false ); if ( getStep( i ).getStepPartitioningMeta() != null ) { getStep( i ).getStepPartitioningMeta().hasChanged( false ); } } for ( int i = 0; i < nrTransHops(); i++ ) { getTransHop( i ).setChanged( false ); } for ( int i = 0; i < partitionSchemas.size(); i++ ) { partitionSchemas.get( i ).setChanged( false ); } for ( int i = 0; i < clusterSchemas.size(); i++ ) { clusterSchemas.get( i ).setChanged( false ); } super.clearChanged(); } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { @Override public void clearChanged() { changed_steps = false; changed_hops = false; for ( int i = 0; i < nrSteps(); i++ ) { getStep( i ).setChanged( false ); if ( getStep( i ).getStepPartitioningMeta() != null ) { getStep( i ).getStepPartitioningMeta().hasChanged( false ); } } for ( int i = 0; i < nrTransHops(); i++ ) { getTransHop( i ).setChanged( false ); } for ( int i = 0; i < partitionSchemas.size(); i++ ) { partitionSchemas.get( i ).setChanged( false ); } for ( int i = 0; i < clusterSchemas.size(); i++ ) { clusterSchemas.get( i ).setChanged( false ); } super.clearChanged(); } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); @Override int compare( TransMeta t1, TransMeta t2 ); @Override int compareTo( TransMeta o ); @Override boolean equals( Object obj ); @Override Object clone(); Object realClone( boolean doClear ); @Override void clear(); void addStep( StepMeta stepMeta ); void addOrReplaceStep( StepMeta stepMeta ); void addTransHop( TransHopMeta hi ); void addDependency( TransDependency td ); void addStep( int p, StepMeta stepMeta ); void addTransHop( int p, TransHopMeta hi ); void addDependency( int p, TransDependency td ); List<StepMeta> getSteps(); StepMeta getStep( int i ); TransHopMeta getTransHop( int i ); TransDependency getDependency( int i ); void removeStep( int i ); void removeTransHop( int i ); void removeTransHop( TransHopMeta hop ); void removeDependency( int i ); void removeAllDependencies(); int nrSteps(); int nrTransHops(); int nrDependencies(); int nrStepChangeListeners(); void setStep( int i, StepMeta stepMeta ); void setTransHop( int i, TransHopMeta hi ); List<StepMeta> getUsedSteps(); StepMeta findStep( String name ); StepMeta findStep( String name, StepMeta exclude ); TransHopMeta findTransHop( String name ); TransHopMeta findTransHopFrom( StepMeta fromstep ); List<TransHopMeta> findAllTransHopFrom( StepMeta fromstep ); TransHopMeta findTransHop( TransHopMeta hi ); TransHopMeta findTransHop( StepMeta from, StepMeta to ); TransHopMeta findTransHop( StepMeta from, StepMeta to, boolean disabledToo ); TransHopMeta findTransHopTo( StepMeta tostep ); boolean isStepInformative( StepMeta this_step, StepMeta prev_step ); @Deprecated int findNrPrevSteps( String stepname ); @Deprecated int findNrPrevSteps( String stepname, boolean info ); int findNrPrevSteps( StepMeta stepMeta ); @Deprecated StepMeta findPrevStep( String stepname, int nr ); @Deprecated StepMeta findPrevStep( String stepname, int nr, boolean info ); StepMeta findPrevStep( StepMeta stepMeta, int nr ); @Deprecated int findNrPrevSteps( StepMeta stepMeta, boolean info ); @Deprecated StepMeta findPrevStep( StepMeta stepMeta, int nr, boolean info ); List<StepMeta> findPreviousSteps( StepMeta stepMeta ); List<StepMeta> findPreviousSteps( StepMeta stepMeta, boolean info ); StepMeta[] getInfoStep( StepMeta stepMeta ); int findNrInfoSteps( StepMeta stepMeta ); RowMetaInterface getPrevInfoFields( String stepname ); RowMetaInterface getPrevInfoFields( StepMeta stepMeta ); @Deprecated int findNrNextSteps( StepMeta stepMeta ); @Deprecated StepMeta findNextStep( StepMeta stepMeta, int nr ); StepMeta[] getPrevSteps( StepMeta stepMeta ); String[] getPrevStepNames( String stepname ); String[] getPrevStepNames( StepMeta stepMeta ); @Deprecated StepMeta[] getNextSteps( StepMeta stepMeta ); List<StepMeta> findNextSteps( StepMeta stepMeta ); String[] getNextStepNames( StepMeta stepMeta ); StepMeta getStep( int x, int y, int iconsize ); boolean partOfTransHop( StepMeta stepMeta ); RowMetaInterface getStepFields( String stepname ); RowMetaInterface getStepFields( StepMeta stepMeta ); RowMetaInterface getStepFields( StepMeta[] stepMeta ); RowMetaInterface getStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getStepFields( StepMeta stepMeta, StepMeta targetStep, ProgressMonitorListener monitor ); RowMetaInterface getPrevStepFields( String stepname ); RowMetaInterface getPrevStepFields( StepMeta stepMeta ); RowMetaInterface getPrevStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getThisStepFields( String stepname, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row, ProgressMonitorListener monitor ); boolean isUsingPartitionSchema( PartitionSchema partitionSchema ); boolean isUsingAClusterSchema(); boolean isUsingClusterSchema( ClusterSchema clusterSchema ); boolean isUsingSlaveServer( SlaveServer slaveServer ); boolean isRepReference(); boolean isFileReference(); static boolean isRepReference( String exactFilename, String exactTransname ); static boolean isFileReference( String exactFilename, String exactTransname ); int indexOfTransHop( TransHopMeta hi ); int indexOfStep( StepMeta stepMeta ); @Override String getFileType(); @Override String[] getFilterNames(); @Override String[] getFilterExtensions(); @Override String getDefaultExtension(); @Override String getXML(); String getXML( boolean includeSteps, boolean includeDatabase, boolean includeSlaves, boolean includeClusters, boolean includePartitions ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); byte[] getKey(); void setKey( byte[] key ); boolean isPrivateKey(); void setPrivateKey( boolean privateKey ); @Override boolean loadSharedObject( SharedObjectInterface object ); List<StepMeta> getTransHopSteps( boolean all ); boolean isStepUsedInTransHops( StepMeta stepMeta ); boolean isAnySelectedStepUsedInTransHops(); @Override void clearChanged(); boolean haveStepsChanged(); boolean haveHopsChanged(); boolean havePartitionSchemasChanged(); boolean haveClusterSchemasChanged(); @Override boolean hasChanged(); boolean hasLoop( StepMeta stepMeta ); void selectAll(); void unselectAll(); Point[] getSelectedStepLocations(); Point[] getSelectedNoteLocations(); List<StepMeta> getSelectedSteps(); String[] getSelectedStepNames(); int[] getStepIndexes( List<StepMeta> steps ); Point getMaximum(); Point getMinimum(); String[] getStepNames(); StepMeta[] getStepsArray(); boolean findPrevious( StepMeta startStep, StepMeta stepToFind ); void sortSteps(); void sortHops(); Map<StepMeta, Map<StepMeta, Boolean>> sortStepsNatural(); void sortHopsNatural(); void analyseImpact( List<DatabaseImpact> impact, ProgressMonitorListener monitor ); String getAlternativeStepname( String stepname ); List<SQLStatement> getSQLStatements(); List<SQLStatement> getSQLStatements( ProgressMonitorListener monitor ); String getSQLStatementsString(); @Deprecated void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor ); void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor, VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated List<RowMetaAndData> getResultRows(); @Deprecated void setResultRows( List<RowMetaAndData> resultRows ); String getPathAndName(); @Deprecated String[] getArguments(); @Deprecated void setArguments( String[] arguments ); @Deprecated Hashtable<String, Counter> getCounters(); @Deprecated void setCounters( Hashtable<String, Counter> counters ); List<TransDependency> getDependencies(); void setDependencies( List<TransDependency> dependencies ); DatabaseMeta getMaxDateConnection(); void setMaxDateConnection( DatabaseMeta maxDateConnection ); double getMaxDateDifference(); void setMaxDateDifference( double maxDateDifference ); String getMaxDateField(); void setMaxDateField( String maxDateField ); double getMaxDateOffset(); void setMaxDateOffset( double maxDateOffset ); String getMaxDateTable(); void setMaxDateTable( String maxDateTable ); int getSizeRowset(); void setSizeRowset( int sizeRowset ); DBCache getDbCache(); void setDbCache( DBCache dbCache ); String getTransversion(); void setTransversion( String n ); void setTransstatus( int n ); int getTransstatus(); @Override String toString(); void cancelQueries(); Map<String, String> getUsedArguments( String[] arguments ); int getSleepTimeEmpty(); int getSleepTimeFull(); void setSleepTimeEmpty( int sleepTimeEmpty ); void setSleepTimeFull( int sleepTimeFull ); boolean isDatabaseConnectionUsed( DatabaseMeta databaseMeta ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes, boolean includePasswords ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes ); List<String> getUsedVariables(); @Deprecated Result getPreviousResult(); @Deprecated void setPreviousResult( Result previousResult ); @Deprecated List<ResultFile> getResultFiles(); @Deprecated void setResultFiles( List<ResultFile> resultFiles ); List<PartitionSchema> getPartitionSchemas(); void setPartitionSchemas( List<PartitionSchema> partitionSchemas ); String[] getPartitionSchemasNames(); boolean isFeedbackShown(); void setFeedbackShown( boolean feedbackShown ); int getFeedbackSize(); void setFeedbackSize( int feedbackSize ); boolean isUsingUniqueConnections(); void setUsingUniqueConnections( boolean usingUniqueConnections ); List<ClusterSchema> getClusterSchemas(); void setClusterSchemas( List<ClusterSchema> clusterSchemas ); String[] getClusterSchemaNames(); PartitionSchema findPartitionSchema( String name ); ClusterSchema findClusterSchema( String name ); void addOrReplacePartitionSchema( PartitionSchema partitionSchema ); void addOrReplaceClusterSchema( ClusterSchema clusterSchema ); boolean isUsingThreadPriorityManagment(); void setUsingThreadPriorityManagment( boolean usingThreadPriorityManagment ); void checkRowMixingStatically( StepMeta stepMeta, ProgressMonitorListener monitor ); @Override void setInternalKettleVariables( VariableSpace var ); StepMeta findMappingInputStep( String stepname ); StepMeta findMappingOutputStep( String stepname ); List<ResourceReference> getResourceDependencies(); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); SlaveStepCopyPartitionDistribution getSlaveStepCopyPartitionDistribution(); void setSlaveStepCopyPartitionDistribution( SlaveStepCopyPartitionDistribution slaveStepCopyPartitionDistribution ); ClusterSchema findFirstUsedClusterSchema(); boolean isSlaveTransformation(); void setSlaveTransformation( boolean slaveTransformation ); boolean isCapturingStepPerformanceSnapShots(); void setCapturingStepPerformanceSnapShots( boolean capturingStepPerformanceSnapShots ); long getStepPerformanceCapturingDelay(); void setStepPerformanceCapturingDelay( long stepPerformanceCapturingDelay ); String getStepPerformanceCapturingSizeLimit(); void setStepPerformanceCapturingSizeLimit( String stepPerformanceCapturingSizeLimit ); void clearCaches(); @Override RepositoryObjectType getRepositoryElementType(); LogChannelInterface getLogChannel(); @Override String getLogChannelId(); @Override LoggingObjectType getObjectType(); TransLogTable getTransLogTable(); void setTransLogTable( TransLogTable transLogTable ); PerformanceLogTable getPerformanceLogTable(); void setPerformanceLogTable( PerformanceLogTable performanceLogTable ); StepLogTable getStepLogTable(); void setStepLogTable( StepLogTable stepLogTable ); List<LogTableInterface> getLogTables(); TransformationType getTransformationType(); void setTransformationType( TransformationType transformationType ); void writeXML( String filename ); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); MetricsLogTable getMetricsLogTable(); void setMetricsLogTable( MetricsLogTable metricsLogTable ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging ); void addStepChangeListener( StepMetaChangeListenerInterface listener ); void addStepChangeListener( int p, StepMetaChangeListenerInterface list ); void removeStepChangeListener( StepMetaChangeListenerInterface list ); void notifyAllListeners( StepMeta oldMeta, StepMeta newMeta ); boolean containsStepMeta( StepMeta stepMeta ); List<MissingTrans> getMissingTrans(); void addMissingTrans( MissingTrans trans ); void removeMissingTrans( MissingTrans trans ); @Override boolean hasMissingPlugins(); @Override NamedClusterEmbedManager getNamedClusterEmbedManager( ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { @Override public void clearChanged() { changed_steps = false; changed_hops = false; for ( int i = 0; i < nrSteps(); i++ ) { getStep( i ).setChanged( false ); if ( getStep( i ).getStepPartitioningMeta() != null ) { getStep( i ).getStepPartitioningMeta().hasChanged( false ); } } for ( int i = 0; i < nrTransHops(); i++ ) { getTransHop( i ).setChanged( false ); } for ( int i = 0; i < partitionSchemas.size(); i++ ) { partitionSchemas.get( i ).setChanged( false ); } for ( int i = 0; i < clusterSchemas.size(); i++ ) { clusterSchemas.get( i ).setChanged( false ); } super.clearChanged(); } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); @Override int compare( TransMeta t1, TransMeta t2 ); @Override int compareTo( TransMeta o ); @Override boolean equals( Object obj ); @Override Object clone(); Object realClone( boolean doClear ); @Override void clear(); void addStep( StepMeta stepMeta ); void addOrReplaceStep( StepMeta stepMeta ); void addTransHop( TransHopMeta hi ); void addDependency( TransDependency td ); void addStep( int p, StepMeta stepMeta ); void addTransHop( int p, TransHopMeta hi ); void addDependency( int p, TransDependency td ); List<StepMeta> getSteps(); StepMeta getStep( int i ); TransHopMeta getTransHop( int i ); TransDependency getDependency( int i ); void removeStep( int i ); void removeTransHop( int i ); void removeTransHop( TransHopMeta hop ); void removeDependency( int i ); void removeAllDependencies(); int nrSteps(); int nrTransHops(); int nrDependencies(); int nrStepChangeListeners(); void setStep( int i, StepMeta stepMeta ); void setTransHop( int i, TransHopMeta hi ); List<StepMeta> getUsedSteps(); StepMeta findStep( String name ); StepMeta findStep( String name, StepMeta exclude ); TransHopMeta findTransHop( String name ); TransHopMeta findTransHopFrom( StepMeta fromstep ); List<TransHopMeta> findAllTransHopFrom( StepMeta fromstep ); TransHopMeta findTransHop( TransHopMeta hi ); TransHopMeta findTransHop( StepMeta from, StepMeta to ); TransHopMeta findTransHop( StepMeta from, StepMeta to, boolean disabledToo ); TransHopMeta findTransHopTo( StepMeta tostep ); boolean isStepInformative( StepMeta this_step, StepMeta prev_step ); @Deprecated int findNrPrevSteps( String stepname ); @Deprecated int findNrPrevSteps( String stepname, boolean info ); int findNrPrevSteps( StepMeta stepMeta ); @Deprecated StepMeta findPrevStep( String stepname, int nr ); @Deprecated StepMeta findPrevStep( String stepname, int nr, boolean info ); StepMeta findPrevStep( StepMeta stepMeta, int nr ); @Deprecated int findNrPrevSteps( StepMeta stepMeta, boolean info ); @Deprecated StepMeta findPrevStep( StepMeta stepMeta, int nr, boolean info ); List<StepMeta> findPreviousSteps( StepMeta stepMeta ); List<StepMeta> findPreviousSteps( StepMeta stepMeta, boolean info ); StepMeta[] getInfoStep( StepMeta stepMeta ); int findNrInfoSteps( StepMeta stepMeta ); RowMetaInterface getPrevInfoFields( String stepname ); RowMetaInterface getPrevInfoFields( StepMeta stepMeta ); @Deprecated int findNrNextSteps( StepMeta stepMeta ); @Deprecated StepMeta findNextStep( StepMeta stepMeta, int nr ); StepMeta[] getPrevSteps( StepMeta stepMeta ); String[] getPrevStepNames( String stepname ); String[] getPrevStepNames( StepMeta stepMeta ); @Deprecated StepMeta[] getNextSteps( StepMeta stepMeta ); List<StepMeta> findNextSteps( StepMeta stepMeta ); String[] getNextStepNames( StepMeta stepMeta ); StepMeta getStep( int x, int y, int iconsize ); boolean partOfTransHop( StepMeta stepMeta ); RowMetaInterface getStepFields( String stepname ); RowMetaInterface getStepFields( StepMeta stepMeta ); RowMetaInterface getStepFields( StepMeta[] stepMeta ); RowMetaInterface getStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getStepFields( StepMeta stepMeta, StepMeta targetStep, ProgressMonitorListener monitor ); RowMetaInterface getPrevStepFields( String stepname ); RowMetaInterface getPrevStepFields( StepMeta stepMeta ); RowMetaInterface getPrevStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getThisStepFields( String stepname, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row, ProgressMonitorListener monitor ); boolean isUsingPartitionSchema( PartitionSchema partitionSchema ); boolean isUsingAClusterSchema(); boolean isUsingClusterSchema( ClusterSchema clusterSchema ); boolean isUsingSlaveServer( SlaveServer slaveServer ); boolean isRepReference(); boolean isFileReference(); static boolean isRepReference( String exactFilename, String exactTransname ); static boolean isFileReference( String exactFilename, String exactTransname ); int indexOfTransHop( TransHopMeta hi ); int indexOfStep( StepMeta stepMeta ); @Override String getFileType(); @Override String[] getFilterNames(); @Override String[] getFilterExtensions(); @Override String getDefaultExtension(); @Override String getXML(); String getXML( boolean includeSteps, boolean includeDatabase, boolean includeSlaves, boolean includeClusters, boolean includePartitions ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); byte[] getKey(); void setKey( byte[] key ); boolean isPrivateKey(); void setPrivateKey( boolean privateKey ); @Override boolean loadSharedObject( SharedObjectInterface object ); List<StepMeta> getTransHopSteps( boolean all ); boolean isStepUsedInTransHops( StepMeta stepMeta ); boolean isAnySelectedStepUsedInTransHops(); @Override void clearChanged(); boolean haveStepsChanged(); boolean haveHopsChanged(); boolean havePartitionSchemasChanged(); boolean haveClusterSchemasChanged(); @Override boolean hasChanged(); boolean hasLoop( StepMeta stepMeta ); void selectAll(); void unselectAll(); Point[] getSelectedStepLocations(); Point[] getSelectedNoteLocations(); List<StepMeta> getSelectedSteps(); String[] getSelectedStepNames(); int[] getStepIndexes( List<StepMeta> steps ); Point getMaximum(); Point getMinimum(); String[] getStepNames(); StepMeta[] getStepsArray(); boolean findPrevious( StepMeta startStep, StepMeta stepToFind ); void sortSteps(); void sortHops(); Map<StepMeta, Map<StepMeta, Boolean>> sortStepsNatural(); void sortHopsNatural(); void analyseImpact( List<DatabaseImpact> impact, ProgressMonitorListener monitor ); String getAlternativeStepname( String stepname ); List<SQLStatement> getSQLStatements(); List<SQLStatement> getSQLStatements( ProgressMonitorListener monitor ); String getSQLStatementsString(); @Deprecated void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor ); void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor, VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated List<RowMetaAndData> getResultRows(); @Deprecated void setResultRows( List<RowMetaAndData> resultRows ); String getPathAndName(); @Deprecated String[] getArguments(); @Deprecated void setArguments( String[] arguments ); @Deprecated Hashtable<String, Counter> getCounters(); @Deprecated void setCounters( Hashtable<String, Counter> counters ); List<TransDependency> getDependencies(); void setDependencies( List<TransDependency> dependencies ); DatabaseMeta getMaxDateConnection(); void setMaxDateConnection( DatabaseMeta maxDateConnection ); double getMaxDateDifference(); void setMaxDateDifference( double maxDateDifference ); String getMaxDateField(); void setMaxDateField( String maxDateField ); double getMaxDateOffset(); void setMaxDateOffset( double maxDateOffset ); String getMaxDateTable(); void setMaxDateTable( String maxDateTable ); int getSizeRowset(); void setSizeRowset( int sizeRowset ); DBCache getDbCache(); void setDbCache( DBCache dbCache ); String getTransversion(); void setTransversion( String n ); void setTransstatus( int n ); int getTransstatus(); @Override String toString(); void cancelQueries(); Map<String, String> getUsedArguments( String[] arguments ); int getSleepTimeEmpty(); int getSleepTimeFull(); void setSleepTimeEmpty( int sleepTimeEmpty ); void setSleepTimeFull( int sleepTimeFull ); boolean isDatabaseConnectionUsed( DatabaseMeta databaseMeta ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes, boolean includePasswords ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes ); List<String> getUsedVariables(); @Deprecated Result getPreviousResult(); @Deprecated void setPreviousResult( Result previousResult ); @Deprecated List<ResultFile> getResultFiles(); @Deprecated void setResultFiles( List<ResultFile> resultFiles ); List<PartitionSchema> getPartitionSchemas(); void setPartitionSchemas( List<PartitionSchema> partitionSchemas ); String[] getPartitionSchemasNames(); boolean isFeedbackShown(); void setFeedbackShown( boolean feedbackShown ); int getFeedbackSize(); void setFeedbackSize( int feedbackSize ); boolean isUsingUniqueConnections(); void setUsingUniqueConnections( boolean usingUniqueConnections ); List<ClusterSchema> getClusterSchemas(); void setClusterSchemas( List<ClusterSchema> clusterSchemas ); String[] getClusterSchemaNames(); PartitionSchema findPartitionSchema( String name ); ClusterSchema findClusterSchema( String name ); void addOrReplacePartitionSchema( PartitionSchema partitionSchema ); void addOrReplaceClusterSchema( ClusterSchema clusterSchema ); boolean isUsingThreadPriorityManagment(); void setUsingThreadPriorityManagment( boolean usingThreadPriorityManagment ); void checkRowMixingStatically( StepMeta stepMeta, ProgressMonitorListener monitor ); @Override void setInternalKettleVariables( VariableSpace var ); StepMeta findMappingInputStep( String stepname ); StepMeta findMappingOutputStep( String stepname ); List<ResourceReference> getResourceDependencies(); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); SlaveStepCopyPartitionDistribution getSlaveStepCopyPartitionDistribution(); void setSlaveStepCopyPartitionDistribution( SlaveStepCopyPartitionDistribution slaveStepCopyPartitionDistribution ); ClusterSchema findFirstUsedClusterSchema(); boolean isSlaveTransformation(); void setSlaveTransformation( boolean slaveTransformation ); boolean isCapturingStepPerformanceSnapShots(); void setCapturingStepPerformanceSnapShots( boolean capturingStepPerformanceSnapShots ); long getStepPerformanceCapturingDelay(); void setStepPerformanceCapturingDelay( long stepPerformanceCapturingDelay ); String getStepPerformanceCapturingSizeLimit(); void setStepPerformanceCapturingSizeLimit( String stepPerformanceCapturingSizeLimit ); void clearCaches(); @Override RepositoryObjectType getRepositoryElementType(); LogChannelInterface getLogChannel(); @Override String getLogChannelId(); @Override LoggingObjectType getObjectType(); TransLogTable getTransLogTable(); void setTransLogTable( TransLogTable transLogTable ); PerformanceLogTable getPerformanceLogTable(); void setPerformanceLogTable( PerformanceLogTable performanceLogTable ); StepLogTable getStepLogTable(); void setStepLogTable( StepLogTable stepLogTable ); List<LogTableInterface> getLogTables(); TransformationType getTransformationType(); void setTransformationType( TransformationType transformationType ); void writeXML( String filename ); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); MetricsLogTable getMetricsLogTable(); void setMetricsLogTable( MetricsLogTable metricsLogTable ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging ); void addStepChangeListener( StepMetaChangeListenerInterface listener ); void addStepChangeListener( int p, StepMetaChangeListenerInterface list ); void removeStepChangeListener( StepMetaChangeListenerInterface list ); void notifyAllListeners( StepMeta oldMeta, StepMeta newMeta ); boolean containsStepMeta( StepMeta stepMeta ); List<MissingTrans> getMissingTrans(); void addMissingTrans( MissingTrans trans ); void removeMissingTrans( MissingTrans trans ); @Override boolean hasMissingPlugins(); @Override NamedClusterEmbedManager getNamedClusterEmbedManager( ); static final String XML_TAG; static final String STRING_TRANSMETA; static final RepositoryObjectType REPOSITORY_ELEMENT_TYPE; static final int BORDER_INDENT; static final String[] desc_type_undo; static final String XML_TAG_ORDER; static final String XML_TAG_NOTEPADS; static final String XML_TAG_PARAMETERS; static final String XML_TAG_PARTITIONSCHEMAS; static final String XML_TAG_SLAVESERVERS; static final String XML_TAG_CLUSTERSCHEMAS; static final String XML_TAG_STEP_ERROR_HANDLING; }
@Test public void testSetDeckChildIndex() throws Exception { }
public void setDeckChildIndex() { getControls(); int originalSelection = ( dialogDeck == null ? -1 : dialogDeck.getSelectedIndex() ); boolean passed = true; if ( originalSelection == 3 ) { passed = checkPoolingParameters(); } if ( passed ) { int selected = deckOptionsBox.getSelectedIndex(); if ( selected < 0 ) { selected = 0; deckOptionsBox.setSelectedIndex( 0 ); } dialogDeck.setSelectedIndex( selected ); } else { dialogDeck.setSelectedIndex( originalSelection ); deckOptionsBox.setSelectedIndex( originalSelection ); } }
DataHandler extends AbstractXulEventHandler { public void setDeckChildIndex() { getControls(); int originalSelection = ( dialogDeck == null ? -1 : dialogDeck.getSelectedIndex() ); boolean passed = true; if ( originalSelection == 3 ) { passed = checkPoolingParameters(); } if ( passed ) { int selected = deckOptionsBox.getSelectedIndex(); if ( selected < 0 ) { selected = 0; deckOptionsBox.setSelectedIndex( 0 ); } dialogDeck.setSelectedIndex( selected ); } else { dialogDeck.setSelectedIndex( originalSelection ); deckOptionsBox.setSelectedIndex( originalSelection ); } } }
DataHandler extends AbstractXulEventHandler { public void setDeckChildIndex() { getControls(); int originalSelection = ( dialogDeck == null ? -1 : dialogDeck.getSelectedIndex() ); boolean passed = true; if ( originalSelection == 3 ) { passed = checkPoolingParameters(); } if ( passed ) { int selected = deckOptionsBox.getSelectedIndex(); if ( selected < 0 ) { selected = 0; deckOptionsBox.setSelectedIndex( 0 ); } dialogDeck.setSelectedIndex( selected ); } else { dialogDeck.setSelectedIndex( originalSelection ); deckOptionsBox.setSelectedIndex( originalSelection ); } } DataHandler(); }
DataHandler extends AbstractXulEventHandler { public void setDeckChildIndex() { getControls(); int originalSelection = ( dialogDeck == null ? -1 : dialogDeck.getSelectedIndex() ); boolean passed = true; if ( originalSelection == 3 ) { passed = checkPoolingParameters(); } if ( passed ) { int selected = deckOptionsBox.getSelectedIndex(); if ( selected < 0 ) { selected = 0; deckOptionsBox.setSelectedIndex( 0 ); } dialogDeck.setSelectedIndex( selected ); } else { dialogDeck.setSelectedIndex( originalSelection ); deckOptionsBox.setSelectedIndex( originalSelection ); } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); }
DataHandler extends AbstractXulEventHandler { public void setDeckChildIndex() { getControls(); int originalSelection = ( dialogDeck == null ? -1 : dialogDeck.getSelectedIndex() ); boolean passed = true; if ( originalSelection == 3 ) { passed = checkPoolingParameters(); } if ( passed ) { int selected = deckOptionsBox.getSelectedIndex(); if ( selected < 0 ) { selected = 0; deckOptionsBox.setSelectedIndex( 0 ); } dialogDeck.setSelectedIndex( selected ); } else { dialogDeck.setSelectedIndex( originalSelection ); deckOptionsBox.setSelectedIndex( originalSelection ); } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); static final SortedMap<String, DatabaseInterface> connectionMap; static final Map<String, String> connectionNametoID; }
@Test public void testEnvironmentSubstitute() { Variables vars = new Variables(); vars.setVariable( "VarOne", "DataOne" ); vars.setVariable( "VarTwo", "DataTwo" ); assertNull( vars.environmentSubstitute( (String) null ) ); assertEquals( "", vars.environmentSubstitute( "" ) ); assertEquals( "DataTwo", vars.environmentSubstitute( "${VarTwo}" ) ); assertEquals( "DataTwoEnd", vars.environmentSubstitute( "${VarTwo}End" ) ); assertEquals( 0, vars.environmentSubstitute( new String[0] ).length ); assertArrayEquals( new String[]{ "DataOne", "TheDataOne" }, vars.environmentSubstitute( new String[]{ "${VarOne}", "The${VarOne}" } ) ); }
@Override public String environmentSubstitute( String aString ) { if ( aString == null || aString.length() == 0 ) { return aString; } return StringUtil.environmentSubstitute( aString, properties ); }
Variables implements VariableSpace { @Override public String environmentSubstitute( String aString ) { if ( aString == null || aString.length() == 0 ) { return aString; } return StringUtil.environmentSubstitute( aString, properties ); } }
Variables implements VariableSpace { @Override public String environmentSubstitute( String aString ) { if ( aString == null || aString.length() == 0 ) { return aString; } return StringUtil.environmentSubstitute( aString, properties ); } Variables(); }
Variables implements VariableSpace { @Override public String environmentSubstitute( String aString ) { if ( aString == null || aString.length() == 0 ) { return aString; } return StringUtil.environmentSubstitute( aString, properties ); } Variables(); @Override void copyVariablesFrom( VariableSpace space ); @Override VariableSpace getParentVariableSpace(); @Override void setParentVariableSpace( VariableSpace parent ); @Override String getVariable( String variableName, String defaultValue ); @Override String getVariable( String variableName ); @Override boolean getBooleanValueOfVariable( String variableName, boolean defaultValue ); @Override void initializeVariablesFrom( VariableSpace parent ); @Override String[] listVariables(); @Override void setVariable( String variableName, String variableValue ); @Override String environmentSubstitute( String aString ); @Override String fieldSubstitute( String aString, RowMetaInterface rowMeta, Object[] rowData ); @Override String[] environmentSubstitute( String[] string ); @Override void shareVariablesWith( VariableSpace space ); @Override void injectVariables( Map<String, String> prop ); static synchronized VariableSpace getADefaultVariableSpace(); }
Variables implements VariableSpace { @Override public String environmentSubstitute( String aString ) { if ( aString == null || aString.length() == 0 ) { return aString; } return StringUtil.environmentSubstitute( aString, properties ); } Variables(); @Override void copyVariablesFrom( VariableSpace space ); @Override VariableSpace getParentVariableSpace(); @Override void setParentVariableSpace( VariableSpace parent ); @Override String getVariable( String variableName, String defaultValue ); @Override String getVariable( String variableName ); @Override boolean getBooleanValueOfVariable( String variableName, boolean defaultValue ); @Override void initializeVariablesFrom( VariableSpace parent ); @Override String[] listVariables(); @Override void setVariable( String variableName, String variableValue ); @Override String environmentSubstitute( String aString ); @Override String fieldSubstitute( String aString, RowMetaInterface rowMeta, Object[] rowData ); @Override String[] environmentSubstitute( String[] string ); @Override void shareVariablesWith( VariableSpace space ); @Override void injectVariables( Map<String, String> prop ); static synchronized VariableSpace getADefaultVariableSpace(); }
@Test public void testIsSevere() throws Exception { assertTrue( exception.isSevere() ); }
public boolean isSevere() { return severe; }
LifecycleException extends Exception { public boolean isSevere() { return severe; } }
LifecycleException extends Exception { public boolean isSevere() { return severe; } LifecycleException( boolean severe ); LifecycleException( String message, boolean severe ); LifecycleException( Throwable cause, boolean severe ); LifecycleException( String message, Throwable cause, boolean severe ); }
LifecycleException extends Exception { public boolean isSevere() { return severe; } LifecycleException( boolean severe ); LifecycleException( String message, boolean severe ); LifecycleException( Throwable cause, boolean severe ); LifecycleException( String message, Throwable cause, boolean severe ); boolean isSevere(); }
LifecycleException extends Exception { public boolean isSevere() { return severe; } LifecycleException( boolean severe ); LifecycleException( String message, boolean severe ); LifecycleException( Throwable cause, boolean severe ); LifecycleException( String message, Throwable cause, boolean severe ); boolean isSevere(); }
@Test public void testThrowableMessageCtor() { Throwable t = mock( Throwable.class ); exception = new LifecycleException( "message", t, true ); assertEquals( t, exception.getCause() ); assertEquals( "message", exception.getMessage() ); assertTrue( exception.isSevere() ); }
public boolean isSevere() { return severe; }
LifecycleException extends Exception { public boolean isSevere() { return severe; } }
LifecycleException extends Exception { public boolean isSevere() { return severe; } LifecycleException( boolean severe ); LifecycleException( String message, boolean severe ); LifecycleException( Throwable cause, boolean severe ); LifecycleException( String message, Throwable cause, boolean severe ); }
LifecycleException extends Exception { public boolean isSevere() { return severe; } LifecycleException( boolean severe ); LifecycleException( String message, boolean severe ); LifecycleException( Throwable cause, boolean severe ); LifecycleException( String message, Throwable cause, boolean severe ); boolean isSevere(); }
LifecycleException extends Exception { public boolean isSevere() { return severe; } LifecycleException( boolean severe ); LifecycleException( String message, boolean severe ); LifecycleException( Throwable cause, boolean severe ); LifecycleException( String message, Throwable cause, boolean severe ); boolean isSevere(); }
@Test public void testGetState() throws Exception { assertNull( info.getState() ); info.setState( LifeEventInfo.State.FAIL ); assertEquals( LifeEventInfo.State.FAIL, info.getState() ); }
public State getState() { return state; }
LifeEventInfo { public State getState() { return state; } }
LifeEventInfo { public State getState() { return state; } }
LifeEventInfo { public State getState() { return state; } void setHint( Hint hint ); String getMessage(); void setMessage( String message ); boolean hasHint( Hint h ); State getState(); void setState( State state ); String getName(); void setName( String name ); }
LifeEventInfo { public State getState() { return state; } void setHint( Hint hint ); String getMessage(); void setMessage( String message ); boolean hasHint( Hint h ); State getState(); void setState( State state ); String getName(); void setName( String name ); }
@Test public void testGetName() throws Exception { assertNull( info.getName() ); info.setName( "name" ); assertEquals( "name", info.getName() ); }
public String getName() { return name; }
LifeEventInfo { public String getName() { return name; } }
LifeEventInfo { public String getName() { return name; } }
LifeEventInfo { public String getName() { return name; } void setHint( Hint hint ); String getMessage(); void setMessage( String message ); boolean hasHint( Hint h ); State getState(); void setState( State state ); String getName(); void setName( String name ); }
LifeEventInfo { public String getName() { return name; } void setHint( Hint hint ); String getMessage(); void setMessage( String message ); boolean hasHint( Hint h ); State getState(); void setState( State state ); String getName(); void setName( String name ); }
@Test public void testGetRow() throws KettleFileException, FileSystemException { File tempDir = new File( new TemporaryFolder().toString() ); FileObject tempFile = KettleVFS.createTempFile( "prefix", "suffix", tempDir.toString() ); Date timeBeforeFile = Calendar.getInstance().getTime(); ResultFile resultFile = new ResultFile( ResultFile.FILE_TYPE_GENERAL, tempFile, "myOriginParent", "myOrigin" ); Date timeAfterFile = Calendar.getInstance().getTime(); assertNotNull( resultFile ); RowMetaInterface rm = resultFile.getRow().getRowMeta(); assertEquals( 7, rm.getValueMetaList().size() ); assertEquals( ValueMetaInterface.TYPE_STRING, rm.getValueMeta( 0 ).getType() ); assertEquals( ValueMetaInterface.TYPE_STRING, rm.getValueMeta( 1 ).getType() ); assertEquals( ValueMetaInterface.TYPE_STRING, rm.getValueMeta( 2 ).getType() ); assertEquals( ValueMetaInterface.TYPE_STRING, rm.getValueMeta( 3 ).getType() ); assertEquals( ValueMetaInterface.TYPE_STRING, rm.getValueMeta( 4 ).getType() ); assertEquals( ValueMetaInterface.TYPE_STRING, rm.getValueMeta( 5 ).getType() ); assertEquals( ValueMetaInterface.TYPE_DATE, rm.getValueMeta( 6 ).getType() ); assertEquals( ResultFile.FILE_TYPE_GENERAL, resultFile.getType() ); assertEquals( "myOrigin", resultFile.getOrigin() ); assertEquals( "myOriginParent", resultFile.getOriginParent() ); assertTrue( "ResultFile timestamp is created in the expected window", timeBeforeFile.compareTo( resultFile.getTimestamp() ) <= 0 && timeAfterFile.compareTo( resultFile.getTimestamp() ) >= 0 ); tempFile.delete(); tempDir.delete(); }
public RowMetaAndData getRow() { RowMetaAndData row = new RowMetaAndData(); row.addValue( new ValueMetaString( "type" ), getTypeDesc() ); row.addValue( new ValueMetaString( "filename" ), file.getName().getBaseName() ); row.addValue( new ValueMetaString( "path" ), file.getName().getURI() ); row.addValue( new ValueMetaString( "parentorigin" ), originParent ); row.addValue( new ValueMetaString( "origin" ), origin ); row.addValue( new ValueMetaString( "comment" ), comment ); row.addValue( new ValueMetaDate( "timestamp" ), timestamp ); return row; }
ResultFile implements Cloneable { public RowMetaAndData getRow() { RowMetaAndData row = new RowMetaAndData(); row.addValue( new ValueMetaString( "type" ), getTypeDesc() ); row.addValue( new ValueMetaString( "filename" ), file.getName().getBaseName() ); row.addValue( new ValueMetaString( "path" ), file.getName().getURI() ); row.addValue( new ValueMetaString( "parentorigin" ), originParent ); row.addValue( new ValueMetaString( "origin" ), origin ); row.addValue( new ValueMetaString( "comment" ), comment ); row.addValue( new ValueMetaDate( "timestamp" ), timestamp ); return row; } }
ResultFile implements Cloneable { public RowMetaAndData getRow() { RowMetaAndData row = new RowMetaAndData(); row.addValue( new ValueMetaString( "type" ), getTypeDesc() ); row.addValue( new ValueMetaString( "filename" ), file.getName().getBaseName() ); row.addValue( new ValueMetaString( "path" ), file.getName().getURI() ); row.addValue( new ValueMetaString( "parentorigin" ), originParent ); row.addValue( new ValueMetaString( "origin" ), origin ); row.addValue( new ValueMetaString( "comment" ), comment ); row.addValue( new ValueMetaDate( "timestamp" ), timestamp ); return row; } ResultFile( int type, FileObject file, String originParent, String origin ); ResultFile( Node node ); }
ResultFile implements Cloneable { public RowMetaAndData getRow() { RowMetaAndData row = new RowMetaAndData(); row.addValue( new ValueMetaString( "type" ), getTypeDesc() ); row.addValue( new ValueMetaString( "filename" ), file.getName().getBaseName() ); row.addValue( new ValueMetaString( "path" ), file.getName().getURI() ); row.addValue( new ValueMetaString( "parentorigin" ), originParent ); row.addValue( new ValueMetaString( "origin" ), origin ); row.addValue( new ValueMetaString( "comment" ), comment ); row.addValue( new ValueMetaDate( "timestamp" ), timestamp ); return row; } ResultFile( int type, FileObject file, String originParent, String origin ); ResultFile( Node node ); @Override String toString(); String getComment(); void setComment( String comment ); FileObject getFile(); void setFile( FileObject file ); String getOrigin(); void setOrigin( String origin ); String getOriginParent(); void setOriginParent( String originParent ); int getType(); void setType( int type ); String getTypeDesc(); String getTypeCode(); static final int getType( String typeString ); static final String getTypeCode( int fileType ); static final String getTypeDesc( int fileType ); static final String[] getAllTypeDesc(); Date getTimestamp(); void setTimestamp( Date timestamp ); RowMetaAndData getRow(); String getXML(); }
ResultFile implements Cloneable { public RowMetaAndData getRow() { RowMetaAndData row = new RowMetaAndData(); row.addValue( new ValueMetaString( "type" ), getTypeDesc() ); row.addValue( new ValueMetaString( "filename" ), file.getName().getBaseName() ); row.addValue( new ValueMetaString( "path" ), file.getName().getURI() ); row.addValue( new ValueMetaString( "parentorigin" ), originParent ); row.addValue( new ValueMetaString( "origin" ), origin ); row.addValue( new ValueMetaString( "comment" ), comment ); row.addValue( new ValueMetaDate( "timestamp" ), timestamp ); return row; } ResultFile( int type, FileObject file, String originParent, String origin ); ResultFile( Node node ); @Override String toString(); String getComment(); void setComment( String comment ); FileObject getFile(); void setFile( FileObject file ); String getOrigin(); void setOrigin( String origin ); String getOriginParent(); void setOriginParent( String originParent ); int getType(); void setType( int type ); String getTypeDesc(); String getTypeCode(); static final int getType( String typeString ); static final String getTypeCode( int fileType ); static final String getTypeDesc( int fileType ); static final String[] getAllTypeDesc(); Date getTimestamp(); void setTimestamp( Date timestamp ); RowMetaAndData getRow(); String getXML(); static final int FILE_TYPE_GENERAL; static final int FILE_TYPE_LOG; static final int FILE_TYPE_ERRORLINE; static final int FILE_TYPE_ERROR; static final int FILE_TYPE_WARNING; static final String[] fileTypeCode; static final String[] fileTypeDesc; }
@Test public void shouldOverrideDefaultSSLContextByDefault() throws Exception { System.clearProperty( "javax.net.ssl.keyStore" ); SlaveConnectionManager instance = SlaveConnectionManager.getInstance(); assertNotEquals( defaultContext, SSLContext.getDefault() ); }
public static SlaveConnectionManager getInstance() { if ( slaveConnectionManager == null ) { slaveConnectionManager = new SlaveConnectionManager(); } return slaveConnectionManager; }
SlaveConnectionManager { public static SlaveConnectionManager getInstance() { if ( slaveConnectionManager == null ) { slaveConnectionManager = new SlaveConnectionManager(); } return slaveConnectionManager; } }
SlaveConnectionManager { public static SlaveConnectionManager getInstance() { if ( slaveConnectionManager == null ) { slaveConnectionManager = new SlaveConnectionManager(); } return slaveConnectionManager; } private SlaveConnectionManager(); }
SlaveConnectionManager { public static SlaveConnectionManager getInstance() { if ( slaveConnectionManager == null ) { slaveConnectionManager = new SlaveConnectionManager(); } return slaveConnectionManager; } private SlaveConnectionManager(); static SlaveConnectionManager getInstance(); HttpClient createHttpClient(); HttpClient createHttpClient( String user, String password ); HttpClient createHttpClient( String user, String password, String proxyHost, int proxyPort, AuthScope authScope ); void shutdown(); }
SlaveConnectionManager { public static SlaveConnectionManager getInstance() { if ( slaveConnectionManager == null ) { slaveConnectionManager = new SlaveConnectionManager(); } return slaveConnectionManager; } private SlaveConnectionManager(); static SlaveConnectionManager getInstance(); HttpClient createHttpClient(); HttpClient createHttpClient( String user, String password ); HttpClient createHttpClient( String user, String password, String proxyHost, int proxyPort, AuthScope authScope ); void shutdown(); }
@Test public void shouldNotOverrideDefaultSSLContextIfKeystoreIsSet() throws Exception { System.setProperty( "javax.net.ssl.keyStore", "NONE" ); SlaveConnectionManager instance = SlaveConnectionManager.getInstance(); assertEquals( defaultContext, SSLContext.getDefault() ); }
public static SlaveConnectionManager getInstance() { if ( slaveConnectionManager == null ) { slaveConnectionManager = new SlaveConnectionManager(); } return slaveConnectionManager; }
SlaveConnectionManager { public static SlaveConnectionManager getInstance() { if ( slaveConnectionManager == null ) { slaveConnectionManager = new SlaveConnectionManager(); } return slaveConnectionManager; } }
SlaveConnectionManager { public static SlaveConnectionManager getInstance() { if ( slaveConnectionManager == null ) { slaveConnectionManager = new SlaveConnectionManager(); } return slaveConnectionManager; } private SlaveConnectionManager(); }
SlaveConnectionManager { public static SlaveConnectionManager getInstance() { if ( slaveConnectionManager == null ) { slaveConnectionManager = new SlaveConnectionManager(); } return slaveConnectionManager; } private SlaveConnectionManager(); static SlaveConnectionManager getInstance(); HttpClient createHttpClient(); HttpClient createHttpClient( String user, String password ); HttpClient createHttpClient( String user, String password, String proxyHost, int proxyPort, AuthScope authScope ); void shutdown(); }
SlaveConnectionManager { public static SlaveConnectionManager getInstance() { if ( slaveConnectionManager == null ) { slaveConnectionManager = new SlaveConnectionManager(); } return slaveConnectionManager; } private SlaveConnectionManager(); static SlaveConnectionManager getInstance(); HttpClient createHttpClient(); HttpClient createHttpClient( String user, String password ); HttpClient createHttpClient( String user, String password, String proxyHost, int proxyPort, AuthScope authScope ); void shutdown(); }
@Test public final void testDecodeBase64ZippedString() throws IOException, NoSuchAlgorithmException { String enc64 = this.canonicalBase64Encode( STANDART ); String decoded = HttpUtil.decodeBase64ZippedString( enc64 ); Assert.assertEquals( "Strings are the same after transformation", STANDART, decoded ); }
public static String decodeBase64ZippedString( String loggingString64 ) throws IOException { if ( loggingString64 == null || loggingString64.isEmpty() ) { return ""; } StringWriter writer = new StringWriter(); byte[] bytes64 = Base64.decodeBase64( loggingString64.getBytes() ); ByteArrayInputStream zip = new ByteArrayInputStream( bytes64 ); GZIPInputStream unzip = null; InputStreamReader reader = null; BufferedInputStream in = null; try { unzip = new GZIPInputStream( zip, HttpUtil.ZIP_BUFFER_SIZE ); in = new BufferedInputStream( unzip, HttpUtil.ZIP_BUFFER_SIZE ); reader = new InputStreamReader( in, Const.XML_ENCODING ); writer = new StringWriter(); char[] buff = new char[ HttpUtil.ZIP_BUFFER_SIZE ]; for ( int length = 0; ( length = reader.read( buff ) ) > 0; ) { writer.write( buff, 0, length ); } } finally { if ( reader != null ) { try { reader.close(); } catch ( IOException e ) { } } if ( in != null ) { try { in.close(); } catch ( IOException e ) { } } if ( unzip != null ) { try { unzip.close(); } catch ( IOException e ) { } } } return writer.toString(); }
HttpUtil { public static String decodeBase64ZippedString( String loggingString64 ) throws IOException { if ( loggingString64 == null || loggingString64.isEmpty() ) { return ""; } StringWriter writer = new StringWriter(); byte[] bytes64 = Base64.decodeBase64( loggingString64.getBytes() ); ByteArrayInputStream zip = new ByteArrayInputStream( bytes64 ); GZIPInputStream unzip = null; InputStreamReader reader = null; BufferedInputStream in = null; try { unzip = new GZIPInputStream( zip, HttpUtil.ZIP_BUFFER_SIZE ); in = new BufferedInputStream( unzip, HttpUtil.ZIP_BUFFER_SIZE ); reader = new InputStreamReader( in, Const.XML_ENCODING ); writer = new StringWriter(); char[] buff = new char[ HttpUtil.ZIP_BUFFER_SIZE ]; for ( int length = 0; ( length = reader.read( buff ) ) > 0; ) { writer.write( buff, 0, length ); } } finally { if ( reader != null ) { try { reader.close(); } catch ( IOException e ) { } } if ( in != null ) { try { in.close(); } catch ( IOException e ) { } } if ( unzip != null ) { try { unzip.close(); } catch ( IOException e ) { } } } return writer.toString(); } }
HttpUtil { public static String decodeBase64ZippedString( String loggingString64 ) throws IOException { if ( loggingString64 == null || loggingString64.isEmpty() ) { return ""; } StringWriter writer = new StringWriter(); byte[] bytes64 = Base64.decodeBase64( loggingString64.getBytes() ); ByteArrayInputStream zip = new ByteArrayInputStream( bytes64 ); GZIPInputStream unzip = null; InputStreamReader reader = null; BufferedInputStream in = null; try { unzip = new GZIPInputStream( zip, HttpUtil.ZIP_BUFFER_SIZE ); in = new BufferedInputStream( unzip, HttpUtil.ZIP_BUFFER_SIZE ); reader = new InputStreamReader( in, Const.XML_ENCODING ); writer = new StringWriter(); char[] buff = new char[ HttpUtil.ZIP_BUFFER_SIZE ]; for ( int length = 0; ( length = reader.read( buff ) ) > 0; ) { writer.write( buff, 0, length ); } } finally { if ( reader != null ) { try { reader.close(); } catch ( IOException e ) { } } if ( in != null ) { try { in.close(); } catch ( IOException e ) { } } if ( unzip != null ) { try { unzip.close(); } catch ( IOException e ) { } } } return writer.toString(); } }
HttpUtil { public static String decodeBase64ZippedString( String loggingString64 ) throws IOException { if ( loggingString64 == null || loggingString64.isEmpty() ) { return ""; } StringWriter writer = new StringWriter(); byte[] bytes64 = Base64.decodeBase64( loggingString64.getBytes() ); ByteArrayInputStream zip = new ByteArrayInputStream( bytes64 ); GZIPInputStream unzip = null; InputStreamReader reader = null; BufferedInputStream in = null; try { unzip = new GZIPInputStream( zip, HttpUtil.ZIP_BUFFER_SIZE ); in = new BufferedInputStream( unzip, HttpUtil.ZIP_BUFFER_SIZE ); reader = new InputStreamReader( in, Const.XML_ENCODING ); writer = new StringWriter(); char[] buff = new char[ HttpUtil.ZIP_BUFFER_SIZE ]; for ( int length = 0; ( length = reader.read( buff ) ) > 0; ) { writer.write( buff, 0, length ); } } finally { if ( reader != null ) { try { reader.close(); } catch ( IOException e ) { } } if ( in != null ) { try { in.close(); } catch ( IOException e ) { } } if ( unzip != null ) { try { unzip.close(); } catch ( IOException e ) { } } } return writer.toString(); } static String constructUrl( VariableSpace space, String hostname, String port, String webAppName, String serviceAndArguments ); static String constructUrl( VariableSpace space, String hostname, String port, String webAppName, String serviceAndArguments, boolean isSecure ); static String getPortSpecification( VariableSpace space, String port ); static String decodeBase64ZippedString( String loggingString64 ); static String encodeBase64ZippedString( String in ); }
HttpUtil { public static String decodeBase64ZippedString( String loggingString64 ) throws IOException { if ( loggingString64 == null || loggingString64.isEmpty() ) { return ""; } StringWriter writer = new StringWriter(); byte[] bytes64 = Base64.decodeBase64( loggingString64.getBytes() ); ByteArrayInputStream zip = new ByteArrayInputStream( bytes64 ); GZIPInputStream unzip = null; InputStreamReader reader = null; BufferedInputStream in = null; try { unzip = new GZIPInputStream( zip, HttpUtil.ZIP_BUFFER_SIZE ); in = new BufferedInputStream( unzip, HttpUtil.ZIP_BUFFER_SIZE ); reader = new InputStreamReader( in, Const.XML_ENCODING ); writer = new StringWriter(); char[] buff = new char[ HttpUtil.ZIP_BUFFER_SIZE ]; for ( int length = 0; ( length = reader.read( buff ) ) > 0; ) { writer.write( buff, 0, length ); } } finally { if ( reader != null ) { try { reader.close(); } catch ( IOException e ) { } } if ( in != null ) { try { in.close(); } catch ( IOException e ) { } } if ( unzip != null ) { try { unzip.close(); } catch ( IOException e ) { } } } return writer.toString(); } static String constructUrl( VariableSpace space, String hostname, String port, String webAppName, String serviceAndArguments ); static String constructUrl( VariableSpace space, String hostname, String port, String webAppName, String serviceAndArguments, boolean isSecure ); static String getPortSpecification( VariableSpace space, String port ); static String decodeBase64ZippedString( String loggingString64 ); static String encodeBase64ZippedString( String in ); static final int ZIP_BUFFER_SIZE; }
@Test public void testConstructUrl() throws Exception { Variables variables = new Variables(); String expected = "hostname:1234/webAppName?param=value"; Assert.assertEquals( "http: HttpUtil.constructUrl( variables, "hostname", String.valueOf( 1234 ), "webAppName", "?param=value" ) ); Assert.assertEquals( "http: HttpUtil.constructUrl( variables, "hostname", String.valueOf( 1234 ), "webAppName", "?param=value", false ) ); Assert.assertEquals( "https: HttpUtil.constructUrl( variables, "hostname", String.valueOf( 1234 ), "webAppName", "?param=value", true ) ); }
public static String constructUrl( VariableSpace space, String hostname, String port, String webAppName, String serviceAndArguments ) throws UnsupportedEncodingException { return constructUrl( space, hostname, port, webAppName, serviceAndArguments, false ); }
HttpUtil { public static String constructUrl( VariableSpace space, String hostname, String port, String webAppName, String serviceAndArguments ) throws UnsupportedEncodingException { return constructUrl( space, hostname, port, webAppName, serviceAndArguments, false ); } }
HttpUtil { public static String constructUrl( VariableSpace space, String hostname, String port, String webAppName, String serviceAndArguments ) throws UnsupportedEncodingException { return constructUrl( space, hostname, port, webAppName, serviceAndArguments, false ); } }
HttpUtil { public static String constructUrl( VariableSpace space, String hostname, String port, String webAppName, String serviceAndArguments ) throws UnsupportedEncodingException { return constructUrl( space, hostname, port, webAppName, serviceAndArguments, false ); } static String constructUrl( VariableSpace space, String hostname, String port, String webAppName, String serviceAndArguments ); static String constructUrl( VariableSpace space, String hostname, String port, String webAppName, String serviceAndArguments, boolean isSecure ); static String getPortSpecification( VariableSpace space, String port ); static String decodeBase64ZippedString( String loggingString64 ); static String encodeBase64ZippedString( String in ); }
HttpUtil { public static String constructUrl( VariableSpace space, String hostname, String port, String webAppName, String serviceAndArguments ) throws UnsupportedEncodingException { return constructUrl( space, hostname, port, webAppName, serviceAndArguments, false ); } static String constructUrl( VariableSpace space, String hostname, String port, String webAppName, String serviceAndArguments ); static String constructUrl( VariableSpace space, String hostname, String port, String webAppName, String serviceAndArguments, boolean isSecure ); static String getPortSpecification( VariableSpace space, String port ); static String decodeBase64ZippedString( String loggingString64 ); static String encodeBase64ZippedString( String in ); static final int ZIP_BUFFER_SIZE; }
@Test public void testCompare() throws Exception { TransMeta transMeta = new TransMeta( "aFile", "aName" ); TransMeta transMeta2 = new TransMeta( "aFile", "aName" ); assertEquals( 0, transMeta.compare( transMeta, transMeta2 ) ); transMeta2.setVariable( "myVariable", "myValue" ); assertEquals( 0, transMeta.compare( transMeta, transMeta2 ) ); transMeta2.setFilename( null ); assertEquals( 1, transMeta.compare( transMeta, transMeta2 ) ); assertEquals( -1, transMeta.compare( transMeta2, transMeta ) ); transMeta2.setFilename( "aFile" ); transMeta2.setName( null ); assertEquals( 1, transMeta.compare( transMeta, transMeta2 ) ); assertEquals( -1, transMeta.compare( transMeta2, transMeta ) ); transMeta2.setFilename( "aFile2" ); transMeta2.setName( "aName" ); assertEquals( -1, transMeta.compare( transMeta, transMeta2 ) ); assertEquals( 1, transMeta.compare( transMeta2, transMeta ) ); transMeta2.setFilename( "aFile" ); transMeta2.setName( "aName2" ); assertEquals( -1, transMeta.compare( transMeta, transMeta2 ) ); assertEquals( 1, transMeta.compare( transMeta2, transMeta ) ); transMeta.setFilename( null ); transMeta2.setFilename( null ); transMeta2.setName( "aName" ); assertEquals( 0, transMeta.compare( transMeta, transMeta2 ) ); RepositoryDirectoryInterface path1 = mock( RepositoryDirectoryInterface.class ); transMeta.setRepositoryDirectory( path1 ); when( path1.getPath() ).thenReturn( "aPath2" ); RepositoryDirectoryInterface path2 = mock( RepositoryDirectoryInterface.class ); when( path2.getPath() ).thenReturn( "aPath" ); transMeta2.setRepositoryDirectory( path2 ); assertEquals( 1, transMeta.compare( transMeta, transMeta2 ) ); assertEquals( -1, transMeta.compare( transMeta2, transMeta ) ); when( path1.getPath() ).thenReturn( "aPath" ); assertEquals( 0, transMeta.compare( transMeta, transMeta2 ) ); ObjectRevision revision2 = mock( ObjectRevision.class ); transMeta2.setObjectRevision( revision2 ); assertEquals( -1, transMeta.compare( transMeta, transMeta2 ) ); assertEquals( 1, transMeta.compare( transMeta2, transMeta ) ); ObjectRevision revision1 = mock( ObjectRevision.class ); transMeta.setObjectRevision( revision1 ); when( revision1.getName() ).thenReturn( "aRevision" ); when( revision2.getName() ).thenReturn( "aRevision" ); assertEquals( 0, transMeta.compare( transMeta, transMeta2 ) ); when( revision2.getName() ).thenReturn( "aRevision2" ); assertEquals( -1, transMeta.compare( transMeta, transMeta2 ) ); assertEquals( 1, transMeta.compare( transMeta2, transMeta ) ); }
@Override public int compare( TransMeta t1, TransMeta t2 ) { return super.compare( t1, t2 ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { @Override public int compare( TransMeta t1, TransMeta t2 ) { return super.compare( t1, t2 ); } }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { @Override public int compare( TransMeta t1, TransMeta t2 ) { return super.compare( t1, t2 ); } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { @Override public int compare( TransMeta t1, TransMeta t2 ) { return super.compare( t1, t2 ); } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); @Override int compare( TransMeta t1, TransMeta t2 ); @Override int compareTo( TransMeta o ); @Override boolean equals( Object obj ); @Override Object clone(); Object realClone( boolean doClear ); @Override void clear(); void addStep( StepMeta stepMeta ); void addOrReplaceStep( StepMeta stepMeta ); void addTransHop( TransHopMeta hi ); void addDependency( TransDependency td ); void addStep( int p, StepMeta stepMeta ); void addTransHop( int p, TransHopMeta hi ); void addDependency( int p, TransDependency td ); List<StepMeta> getSteps(); StepMeta getStep( int i ); TransHopMeta getTransHop( int i ); TransDependency getDependency( int i ); void removeStep( int i ); void removeTransHop( int i ); void removeTransHop( TransHopMeta hop ); void removeDependency( int i ); void removeAllDependencies(); int nrSteps(); int nrTransHops(); int nrDependencies(); int nrStepChangeListeners(); void setStep( int i, StepMeta stepMeta ); void setTransHop( int i, TransHopMeta hi ); List<StepMeta> getUsedSteps(); StepMeta findStep( String name ); StepMeta findStep( String name, StepMeta exclude ); TransHopMeta findTransHop( String name ); TransHopMeta findTransHopFrom( StepMeta fromstep ); List<TransHopMeta> findAllTransHopFrom( StepMeta fromstep ); TransHopMeta findTransHop( TransHopMeta hi ); TransHopMeta findTransHop( StepMeta from, StepMeta to ); TransHopMeta findTransHop( StepMeta from, StepMeta to, boolean disabledToo ); TransHopMeta findTransHopTo( StepMeta tostep ); boolean isStepInformative( StepMeta this_step, StepMeta prev_step ); @Deprecated int findNrPrevSteps( String stepname ); @Deprecated int findNrPrevSteps( String stepname, boolean info ); int findNrPrevSteps( StepMeta stepMeta ); @Deprecated StepMeta findPrevStep( String stepname, int nr ); @Deprecated StepMeta findPrevStep( String stepname, int nr, boolean info ); StepMeta findPrevStep( StepMeta stepMeta, int nr ); @Deprecated int findNrPrevSteps( StepMeta stepMeta, boolean info ); @Deprecated StepMeta findPrevStep( StepMeta stepMeta, int nr, boolean info ); List<StepMeta> findPreviousSteps( StepMeta stepMeta ); List<StepMeta> findPreviousSteps( StepMeta stepMeta, boolean info ); StepMeta[] getInfoStep( StepMeta stepMeta ); int findNrInfoSteps( StepMeta stepMeta ); RowMetaInterface getPrevInfoFields( String stepname ); RowMetaInterface getPrevInfoFields( StepMeta stepMeta ); @Deprecated int findNrNextSteps( StepMeta stepMeta ); @Deprecated StepMeta findNextStep( StepMeta stepMeta, int nr ); StepMeta[] getPrevSteps( StepMeta stepMeta ); String[] getPrevStepNames( String stepname ); String[] getPrevStepNames( StepMeta stepMeta ); @Deprecated StepMeta[] getNextSteps( StepMeta stepMeta ); List<StepMeta> findNextSteps( StepMeta stepMeta ); String[] getNextStepNames( StepMeta stepMeta ); StepMeta getStep( int x, int y, int iconsize ); boolean partOfTransHop( StepMeta stepMeta ); RowMetaInterface getStepFields( String stepname ); RowMetaInterface getStepFields( StepMeta stepMeta ); RowMetaInterface getStepFields( StepMeta[] stepMeta ); RowMetaInterface getStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getStepFields( StepMeta stepMeta, StepMeta targetStep, ProgressMonitorListener monitor ); RowMetaInterface getPrevStepFields( String stepname ); RowMetaInterface getPrevStepFields( StepMeta stepMeta ); RowMetaInterface getPrevStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getThisStepFields( String stepname, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row, ProgressMonitorListener monitor ); boolean isUsingPartitionSchema( PartitionSchema partitionSchema ); boolean isUsingAClusterSchema(); boolean isUsingClusterSchema( ClusterSchema clusterSchema ); boolean isUsingSlaveServer( SlaveServer slaveServer ); boolean isRepReference(); boolean isFileReference(); static boolean isRepReference( String exactFilename, String exactTransname ); static boolean isFileReference( String exactFilename, String exactTransname ); int indexOfTransHop( TransHopMeta hi ); int indexOfStep( StepMeta stepMeta ); @Override String getFileType(); @Override String[] getFilterNames(); @Override String[] getFilterExtensions(); @Override String getDefaultExtension(); @Override String getXML(); String getXML( boolean includeSteps, boolean includeDatabase, boolean includeSlaves, boolean includeClusters, boolean includePartitions ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); byte[] getKey(); void setKey( byte[] key ); boolean isPrivateKey(); void setPrivateKey( boolean privateKey ); @Override boolean loadSharedObject( SharedObjectInterface object ); List<StepMeta> getTransHopSteps( boolean all ); boolean isStepUsedInTransHops( StepMeta stepMeta ); boolean isAnySelectedStepUsedInTransHops(); @Override void clearChanged(); boolean haveStepsChanged(); boolean haveHopsChanged(); boolean havePartitionSchemasChanged(); boolean haveClusterSchemasChanged(); @Override boolean hasChanged(); boolean hasLoop( StepMeta stepMeta ); void selectAll(); void unselectAll(); Point[] getSelectedStepLocations(); Point[] getSelectedNoteLocations(); List<StepMeta> getSelectedSteps(); String[] getSelectedStepNames(); int[] getStepIndexes( List<StepMeta> steps ); Point getMaximum(); Point getMinimum(); String[] getStepNames(); StepMeta[] getStepsArray(); boolean findPrevious( StepMeta startStep, StepMeta stepToFind ); void sortSteps(); void sortHops(); Map<StepMeta, Map<StepMeta, Boolean>> sortStepsNatural(); void sortHopsNatural(); void analyseImpact( List<DatabaseImpact> impact, ProgressMonitorListener monitor ); String getAlternativeStepname( String stepname ); List<SQLStatement> getSQLStatements(); List<SQLStatement> getSQLStatements( ProgressMonitorListener monitor ); String getSQLStatementsString(); @Deprecated void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor ); void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor, VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated List<RowMetaAndData> getResultRows(); @Deprecated void setResultRows( List<RowMetaAndData> resultRows ); String getPathAndName(); @Deprecated String[] getArguments(); @Deprecated void setArguments( String[] arguments ); @Deprecated Hashtable<String, Counter> getCounters(); @Deprecated void setCounters( Hashtable<String, Counter> counters ); List<TransDependency> getDependencies(); void setDependencies( List<TransDependency> dependencies ); DatabaseMeta getMaxDateConnection(); void setMaxDateConnection( DatabaseMeta maxDateConnection ); double getMaxDateDifference(); void setMaxDateDifference( double maxDateDifference ); String getMaxDateField(); void setMaxDateField( String maxDateField ); double getMaxDateOffset(); void setMaxDateOffset( double maxDateOffset ); String getMaxDateTable(); void setMaxDateTable( String maxDateTable ); int getSizeRowset(); void setSizeRowset( int sizeRowset ); DBCache getDbCache(); void setDbCache( DBCache dbCache ); String getTransversion(); void setTransversion( String n ); void setTransstatus( int n ); int getTransstatus(); @Override String toString(); void cancelQueries(); Map<String, String> getUsedArguments( String[] arguments ); int getSleepTimeEmpty(); int getSleepTimeFull(); void setSleepTimeEmpty( int sleepTimeEmpty ); void setSleepTimeFull( int sleepTimeFull ); boolean isDatabaseConnectionUsed( DatabaseMeta databaseMeta ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes, boolean includePasswords ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes ); List<String> getUsedVariables(); @Deprecated Result getPreviousResult(); @Deprecated void setPreviousResult( Result previousResult ); @Deprecated List<ResultFile> getResultFiles(); @Deprecated void setResultFiles( List<ResultFile> resultFiles ); List<PartitionSchema> getPartitionSchemas(); void setPartitionSchemas( List<PartitionSchema> partitionSchemas ); String[] getPartitionSchemasNames(); boolean isFeedbackShown(); void setFeedbackShown( boolean feedbackShown ); int getFeedbackSize(); void setFeedbackSize( int feedbackSize ); boolean isUsingUniqueConnections(); void setUsingUniqueConnections( boolean usingUniqueConnections ); List<ClusterSchema> getClusterSchemas(); void setClusterSchemas( List<ClusterSchema> clusterSchemas ); String[] getClusterSchemaNames(); PartitionSchema findPartitionSchema( String name ); ClusterSchema findClusterSchema( String name ); void addOrReplacePartitionSchema( PartitionSchema partitionSchema ); void addOrReplaceClusterSchema( ClusterSchema clusterSchema ); boolean isUsingThreadPriorityManagment(); void setUsingThreadPriorityManagment( boolean usingThreadPriorityManagment ); void checkRowMixingStatically( StepMeta stepMeta, ProgressMonitorListener monitor ); @Override void setInternalKettleVariables( VariableSpace var ); StepMeta findMappingInputStep( String stepname ); StepMeta findMappingOutputStep( String stepname ); List<ResourceReference> getResourceDependencies(); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); SlaveStepCopyPartitionDistribution getSlaveStepCopyPartitionDistribution(); void setSlaveStepCopyPartitionDistribution( SlaveStepCopyPartitionDistribution slaveStepCopyPartitionDistribution ); ClusterSchema findFirstUsedClusterSchema(); boolean isSlaveTransformation(); void setSlaveTransformation( boolean slaveTransformation ); boolean isCapturingStepPerformanceSnapShots(); void setCapturingStepPerformanceSnapShots( boolean capturingStepPerformanceSnapShots ); long getStepPerformanceCapturingDelay(); void setStepPerformanceCapturingDelay( long stepPerformanceCapturingDelay ); String getStepPerformanceCapturingSizeLimit(); void setStepPerformanceCapturingSizeLimit( String stepPerformanceCapturingSizeLimit ); void clearCaches(); @Override RepositoryObjectType getRepositoryElementType(); LogChannelInterface getLogChannel(); @Override String getLogChannelId(); @Override LoggingObjectType getObjectType(); TransLogTable getTransLogTable(); void setTransLogTable( TransLogTable transLogTable ); PerformanceLogTable getPerformanceLogTable(); void setPerformanceLogTable( PerformanceLogTable performanceLogTable ); StepLogTable getStepLogTable(); void setStepLogTable( StepLogTable stepLogTable ); List<LogTableInterface> getLogTables(); TransformationType getTransformationType(); void setTransformationType( TransformationType transformationType ); void writeXML( String filename ); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); MetricsLogTable getMetricsLogTable(); void setMetricsLogTable( MetricsLogTable metricsLogTable ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging ); void addStepChangeListener( StepMetaChangeListenerInterface listener ); void addStepChangeListener( int p, StepMetaChangeListenerInterface list ); void removeStepChangeListener( StepMetaChangeListenerInterface list ); void notifyAllListeners( StepMeta oldMeta, StepMeta newMeta ); boolean containsStepMeta( StepMeta stepMeta ); List<MissingTrans> getMissingTrans(); void addMissingTrans( MissingTrans trans ); void removeMissingTrans( MissingTrans trans ); @Override boolean hasMissingPlugins(); @Override NamedClusterEmbedManager getNamedClusterEmbedManager( ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { @Override public int compare( TransMeta t1, TransMeta t2 ) { return super.compare( t1, t2 ); } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); @Override int compare( TransMeta t1, TransMeta t2 ); @Override int compareTo( TransMeta o ); @Override boolean equals( Object obj ); @Override Object clone(); Object realClone( boolean doClear ); @Override void clear(); void addStep( StepMeta stepMeta ); void addOrReplaceStep( StepMeta stepMeta ); void addTransHop( TransHopMeta hi ); void addDependency( TransDependency td ); void addStep( int p, StepMeta stepMeta ); void addTransHop( int p, TransHopMeta hi ); void addDependency( int p, TransDependency td ); List<StepMeta> getSteps(); StepMeta getStep( int i ); TransHopMeta getTransHop( int i ); TransDependency getDependency( int i ); void removeStep( int i ); void removeTransHop( int i ); void removeTransHop( TransHopMeta hop ); void removeDependency( int i ); void removeAllDependencies(); int nrSteps(); int nrTransHops(); int nrDependencies(); int nrStepChangeListeners(); void setStep( int i, StepMeta stepMeta ); void setTransHop( int i, TransHopMeta hi ); List<StepMeta> getUsedSteps(); StepMeta findStep( String name ); StepMeta findStep( String name, StepMeta exclude ); TransHopMeta findTransHop( String name ); TransHopMeta findTransHopFrom( StepMeta fromstep ); List<TransHopMeta> findAllTransHopFrom( StepMeta fromstep ); TransHopMeta findTransHop( TransHopMeta hi ); TransHopMeta findTransHop( StepMeta from, StepMeta to ); TransHopMeta findTransHop( StepMeta from, StepMeta to, boolean disabledToo ); TransHopMeta findTransHopTo( StepMeta tostep ); boolean isStepInformative( StepMeta this_step, StepMeta prev_step ); @Deprecated int findNrPrevSteps( String stepname ); @Deprecated int findNrPrevSteps( String stepname, boolean info ); int findNrPrevSteps( StepMeta stepMeta ); @Deprecated StepMeta findPrevStep( String stepname, int nr ); @Deprecated StepMeta findPrevStep( String stepname, int nr, boolean info ); StepMeta findPrevStep( StepMeta stepMeta, int nr ); @Deprecated int findNrPrevSteps( StepMeta stepMeta, boolean info ); @Deprecated StepMeta findPrevStep( StepMeta stepMeta, int nr, boolean info ); List<StepMeta> findPreviousSteps( StepMeta stepMeta ); List<StepMeta> findPreviousSteps( StepMeta stepMeta, boolean info ); StepMeta[] getInfoStep( StepMeta stepMeta ); int findNrInfoSteps( StepMeta stepMeta ); RowMetaInterface getPrevInfoFields( String stepname ); RowMetaInterface getPrevInfoFields( StepMeta stepMeta ); @Deprecated int findNrNextSteps( StepMeta stepMeta ); @Deprecated StepMeta findNextStep( StepMeta stepMeta, int nr ); StepMeta[] getPrevSteps( StepMeta stepMeta ); String[] getPrevStepNames( String stepname ); String[] getPrevStepNames( StepMeta stepMeta ); @Deprecated StepMeta[] getNextSteps( StepMeta stepMeta ); List<StepMeta> findNextSteps( StepMeta stepMeta ); String[] getNextStepNames( StepMeta stepMeta ); StepMeta getStep( int x, int y, int iconsize ); boolean partOfTransHop( StepMeta stepMeta ); RowMetaInterface getStepFields( String stepname ); RowMetaInterface getStepFields( StepMeta stepMeta ); RowMetaInterface getStepFields( StepMeta[] stepMeta ); RowMetaInterface getStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getStepFields( StepMeta stepMeta, StepMeta targetStep, ProgressMonitorListener monitor ); RowMetaInterface getPrevStepFields( String stepname ); RowMetaInterface getPrevStepFields( StepMeta stepMeta ); RowMetaInterface getPrevStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getThisStepFields( String stepname, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row, ProgressMonitorListener monitor ); boolean isUsingPartitionSchema( PartitionSchema partitionSchema ); boolean isUsingAClusterSchema(); boolean isUsingClusterSchema( ClusterSchema clusterSchema ); boolean isUsingSlaveServer( SlaveServer slaveServer ); boolean isRepReference(); boolean isFileReference(); static boolean isRepReference( String exactFilename, String exactTransname ); static boolean isFileReference( String exactFilename, String exactTransname ); int indexOfTransHop( TransHopMeta hi ); int indexOfStep( StepMeta stepMeta ); @Override String getFileType(); @Override String[] getFilterNames(); @Override String[] getFilterExtensions(); @Override String getDefaultExtension(); @Override String getXML(); String getXML( boolean includeSteps, boolean includeDatabase, boolean includeSlaves, boolean includeClusters, boolean includePartitions ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); byte[] getKey(); void setKey( byte[] key ); boolean isPrivateKey(); void setPrivateKey( boolean privateKey ); @Override boolean loadSharedObject( SharedObjectInterface object ); List<StepMeta> getTransHopSteps( boolean all ); boolean isStepUsedInTransHops( StepMeta stepMeta ); boolean isAnySelectedStepUsedInTransHops(); @Override void clearChanged(); boolean haveStepsChanged(); boolean haveHopsChanged(); boolean havePartitionSchemasChanged(); boolean haveClusterSchemasChanged(); @Override boolean hasChanged(); boolean hasLoop( StepMeta stepMeta ); void selectAll(); void unselectAll(); Point[] getSelectedStepLocations(); Point[] getSelectedNoteLocations(); List<StepMeta> getSelectedSteps(); String[] getSelectedStepNames(); int[] getStepIndexes( List<StepMeta> steps ); Point getMaximum(); Point getMinimum(); String[] getStepNames(); StepMeta[] getStepsArray(); boolean findPrevious( StepMeta startStep, StepMeta stepToFind ); void sortSteps(); void sortHops(); Map<StepMeta, Map<StepMeta, Boolean>> sortStepsNatural(); void sortHopsNatural(); void analyseImpact( List<DatabaseImpact> impact, ProgressMonitorListener monitor ); String getAlternativeStepname( String stepname ); List<SQLStatement> getSQLStatements(); List<SQLStatement> getSQLStatements( ProgressMonitorListener monitor ); String getSQLStatementsString(); @Deprecated void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor ); void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor, VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated List<RowMetaAndData> getResultRows(); @Deprecated void setResultRows( List<RowMetaAndData> resultRows ); String getPathAndName(); @Deprecated String[] getArguments(); @Deprecated void setArguments( String[] arguments ); @Deprecated Hashtable<String, Counter> getCounters(); @Deprecated void setCounters( Hashtable<String, Counter> counters ); List<TransDependency> getDependencies(); void setDependencies( List<TransDependency> dependencies ); DatabaseMeta getMaxDateConnection(); void setMaxDateConnection( DatabaseMeta maxDateConnection ); double getMaxDateDifference(); void setMaxDateDifference( double maxDateDifference ); String getMaxDateField(); void setMaxDateField( String maxDateField ); double getMaxDateOffset(); void setMaxDateOffset( double maxDateOffset ); String getMaxDateTable(); void setMaxDateTable( String maxDateTable ); int getSizeRowset(); void setSizeRowset( int sizeRowset ); DBCache getDbCache(); void setDbCache( DBCache dbCache ); String getTransversion(); void setTransversion( String n ); void setTransstatus( int n ); int getTransstatus(); @Override String toString(); void cancelQueries(); Map<String, String> getUsedArguments( String[] arguments ); int getSleepTimeEmpty(); int getSleepTimeFull(); void setSleepTimeEmpty( int sleepTimeEmpty ); void setSleepTimeFull( int sleepTimeFull ); boolean isDatabaseConnectionUsed( DatabaseMeta databaseMeta ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes, boolean includePasswords ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes ); List<String> getUsedVariables(); @Deprecated Result getPreviousResult(); @Deprecated void setPreviousResult( Result previousResult ); @Deprecated List<ResultFile> getResultFiles(); @Deprecated void setResultFiles( List<ResultFile> resultFiles ); List<PartitionSchema> getPartitionSchemas(); void setPartitionSchemas( List<PartitionSchema> partitionSchemas ); String[] getPartitionSchemasNames(); boolean isFeedbackShown(); void setFeedbackShown( boolean feedbackShown ); int getFeedbackSize(); void setFeedbackSize( int feedbackSize ); boolean isUsingUniqueConnections(); void setUsingUniqueConnections( boolean usingUniqueConnections ); List<ClusterSchema> getClusterSchemas(); void setClusterSchemas( List<ClusterSchema> clusterSchemas ); String[] getClusterSchemaNames(); PartitionSchema findPartitionSchema( String name ); ClusterSchema findClusterSchema( String name ); void addOrReplacePartitionSchema( PartitionSchema partitionSchema ); void addOrReplaceClusterSchema( ClusterSchema clusterSchema ); boolean isUsingThreadPriorityManagment(); void setUsingThreadPriorityManagment( boolean usingThreadPriorityManagment ); void checkRowMixingStatically( StepMeta stepMeta, ProgressMonitorListener monitor ); @Override void setInternalKettleVariables( VariableSpace var ); StepMeta findMappingInputStep( String stepname ); StepMeta findMappingOutputStep( String stepname ); List<ResourceReference> getResourceDependencies(); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); SlaveStepCopyPartitionDistribution getSlaveStepCopyPartitionDistribution(); void setSlaveStepCopyPartitionDistribution( SlaveStepCopyPartitionDistribution slaveStepCopyPartitionDistribution ); ClusterSchema findFirstUsedClusterSchema(); boolean isSlaveTransformation(); void setSlaveTransformation( boolean slaveTransformation ); boolean isCapturingStepPerformanceSnapShots(); void setCapturingStepPerformanceSnapShots( boolean capturingStepPerformanceSnapShots ); long getStepPerformanceCapturingDelay(); void setStepPerformanceCapturingDelay( long stepPerformanceCapturingDelay ); String getStepPerformanceCapturingSizeLimit(); void setStepPerformanceCapturingSizeLimit( String stepPerformanceCapturingSizeLimit ); void clearCaches(); @Override RepositoryObjectType getRepositoryElementType(); LogChannelInterface getLogChannel(); @Override String getLogChannelId(); @Override LoggingObjectType getObjectType(); TransLogTable getTransLogTable(); void setTransLogTable( TransLogTable transLogTable ); PerformanceLogTable getPerformanceLogTable(); void setPerformanceLogTable( PerformanceLogTable performanceLogTable ); StepLogTable getStepLogTable(); void setStepLogTable( StepLogTable stepLogTable ); List<LogTableInterface> getLogTables(); TransformationType getTransformationType(); void setTransformationType( TransformationType transformationType ); void writeXML( String filename ); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); MetricsLogTable getMetricsLogTable(); void setMetricsLogTable( MetricsLogTable metricsLogTable ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging ); void addStepChangeListener( StepMetaChangeListenerInterface listener ); void addStepChangeListener( int p, StepMetaChangeListenerInterface list ); void removeStepChangeListener( StepMetaChangeListenerInterface list ); void notifyAllListeners( StepMeta oldMeta, StepMeta newMeta ); boolean containsStepMeta( StepMeta stepMeta ); List<MissingTrans> getMissingTrans(); void addMissingTrans( MissingTrans trans ); void removeMissingTrans( MissingTrans trans ); @Override boolean hasMissingPlugins(); @Override NamedClusterEmbedManager getNamedClusterEmbedManager( ); static final String XML_TAG; static final String STRING_TRANSMETA; static final RepositoryObjectType REPOSITORY_ELEMENT_TYPE; static final int BORDER_INDENT; static final String[] desc_type_undo; static final String XML_TAG_ORDER; static final String XML_TAG_NOTEPADS; static final String XML_TAG_PARAMETERS; static final String XML_TAG_PARTITIONSCHEMAS; static final String XML_TAG_SLAVESERVERS; static final String XML_TAG_CLUSTERSCHEMAS; static final String XML_TAG_STEP_ERROR_HANDLING; }
@Test public void testEquals() throws Exception { TransMeta transMeta = new TransMeta( "1", "2" ); assertFalse( transMeta.equals( "somethingelse" ) ); assertTrue( transMeta.equals( new TransMeta( "1", "2" ) ) ); }
@Override public boolean equals( Object obj ) { if ( !( obj instanceof TransMeta ) ) { return false; } return compare( this, (TransMeta) obj ) == 0; }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { @Override public boolean equals( Object obj ) { if ( !( obj instanceof TransMeta ) ) { return false; } return compare( this, (TransMeta) obj ) == 0; } }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { @Override public boolean equals( Object obj ) { if ( !( obj instanceof TransMeta ) ) { return false; } return compare( this, (TransMeta) obj ) == 0; } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { @Override public boolean equals( Object obj ) { if ( !( obj instanceof TransMeta ) ) { return false; } return compare( this, (TransMeta) obj ) == 0; } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); @Override int compare( TransMeta t1, TransMeta t2 ); @Override int compareTo( TransMeta o ); @Override boolean equals( Object obj ); @Override Object clone(); Object realClone( boolean doClear ); @Override void clear(); void addStep( StepMeta stepMeta ); void addOrReplaceStep( StepMeta stepMeta ); void addTransHop( TransHopMeta hi ); void addDependency( TransDependency td ); void addStep( int p, StepMeta stepMeta ); void addTransHop( int p, TransHopMeta hi ); void addDependency( int p, TransDependency td ); List<StepMeta> getSteps(); StepMeta getStep( int i ); TransHopMeta getTransHop( int i ); TransDependency getDependency( int i ); void removeStep( int i ); void removeTransHop( int i ); void removeTransHop( TransHopMeta hop ); void removeDependency( int i ); void removeAllDependencies(); int nrSteps(); int nrTransHops(); int nrDependencies(); int nrStepChangeListeners(); void setStep( int i, StepMeta stepMeta ); void setTransHop( int i, TransHopMeta hi ); List<StepMeta> getUsedSteps(); StepMeta findStep( String name ); StepMeta findStep( String name, StepMeta exclude ); TransHopMeta findTransHop( String name ); TransHopMeta findTransHopFrom( StepMeta fromstep ); List<TransHopMeta> findAllTransHopFrom( StepMeta fromstep ); TransHopMeta findTransHop( TransHopMeta hi ); TransHopMeta findTransHop( StepMeta from, StepMeta to ); TransHopMeta findTransHop( StepMeta from, StepMeta to, boolean disabledToo ); TransHopMeta findTransHopTo( StepMeta tostep ); boolean isStepInformative( StepMeta this_step, StepMeta prev_step ); @Deprecated int findNrPrevSteps( String stepname ); @Deprecated int findNrPrevSteps( String stepname, boolean info ); int findNrPrevSteps( StepMeta stepMeta ); @Deprecated StepMeta findPrevStep( String stepname, int nr ); @Deprecated StepMeta findPrevStep( String stepname, int nr, boolean info ); StepMeta findPrevStep( StepMeta stepMeta, int nr ); @Deprecated int findNrPrevSteps( StepMeta stepMeta, boolean info ); @Deprecated StepMeta findPrevStep( StepMeta stepMeta, int nr, boolean info ); List<StepMeta> findPreviousSteps( StepMeta stepMeta ); List<StepMeta> findPreviousSteps( StepMeta stepMeta, boolean info ); StepMeta[] getInfoStep( StepMeta stepMeta ); int findNrInfoSteps( StepMeta stepMeta ); RowMetaInterface getPrevInfoFields( String stepname ); RowMetaInterface getPrevInfoFields( StepMeta stepMeta ); @Deprecated int findNrNextSteps( StepMeta stepMeta ); @Deprecated StepMeta findNextStep( StepMeta stepMeta, int nr ); StepMeta[] getPrevSteps( StepMeta stepMeta ); String[] getPrevStepNames( String stepname ); String[] getPrevStepNames( StepMeta stepMeta ); @Deprecated StepMeta[] getNextSteps( StepMeta stepMeta ); List<StepMeta> findNextSteps( StepMeta stepMeta ); String[] getNextStepNames( StepMeta stepMeta ); StepMeta getStep( int x, int y, int iconsize ); boolean partOfTransHop( StepMeta stepMeta ); RowMetaInterface getStepFields( String stepname ); RowMetaInterface getStepFields( StepMeta stepMeta ); RowMetaInterface getStepFields( StepMeta[] stepMeta ); RowMetaInterface getStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getStepFields( StepMeta stepMeta, StepMeta targetStep, ProgressMonitorListener monitor ); RowMetaInterface getPrevStepFields( String stepname ); RowMetaInterface getPrevStepFields( StepMeta stepMeta ); RowMetaInterface getPrevStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getThisStepFields( String stepname, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row, ProgressMonitorListener monitor ); boolean isUsingPartitionSchema( PartitionSchema partitionSchema ); boolean isUsingAClusterSchema(); boolean isUsingClusterSchema( ClusterSchema clusterSchema ); boolean isUsingSlaveServer( SlaveServer slaveServer ); boolean isRepReference(); boolean isFileReference(); static boolean isRepReference( String exactFilename, String exactTransname ); static boolean isFileReference( String exactFilename, String exactTransname ); int indexOfTransHop( TransHopMeta hi ); int indexOfStep( StepMeta stepMeta ); @Override String getFileType(); @Override String[] getFilterNames(); @Override String[] getFilterExtensions(); @Override String getDefaultExtension(); @Override String getXML(); String getXML( boolean includeSteps, boolean includeDatabase, boolean includeSlaves, boolean includeClusters, boolean includePartitions ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); byte[] getKey(); void setKey( byte[] key ); boolean isPrivateKey(); void setPrivateKey( boolean privateKey ); @Override boolean loadSharedObject( SharedObjectInterface object ); List<StepMeta> getTransHopSteps( boolean all ); boolean isStepUsedInTransHops( StepMeta stepMeta ); boolean isAnySelectedStepUsedInTransHops(); @Override void clearChanged(); boolean haveStepsChanged(); boolean haveHopsChanged(); boolean havePartitionSchemasChanged(); boolean haveClusterSchemasChanged(); @Override boolean hasChanged(); boolean hasLoop( StepMeta stepMeta ); void selectAll(); void unselectAll(); Point[] getSelectedStepLocations(); Point[] getSelectedNoteLocations(); List<StepMeta> getSelectedSteps(); String[] getSelectedStepNames(); int[] getStepIndexes( List<StepMeta> steps ); Point getMaximum(); Point getMinimum(); String[] getStepNames(); StepMeta[] getStepsArray(); boolean findPrevious( StepMeta startStep, StepMeta stepToFind ); void sortSteps(); void sortHops(); Map<StepMeta, Map<StepMeta, Boolean>> sortStepsNatural(); void sortHopsNatural(); void analyseImpact( List<DatabaseImpact> impact, ProgressMonitorListener monitor ); String getAlternativeStepname( String stepname ); List<SQLStatement> getSQLStatements(); List<SQLStatement> getSQLStatements( ProgressMonitorListener monitor ); String getSQLStatementsString(); @Deprecated void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor ); void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor, VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated List<RowMetaAndData> getResultRows(); @Deprecated void setResultRows( List<RowMetaAndData> resultRows ); String getPathAndName(); @Deprecated String[] getArguments(); @Deprecated void setArguments( String[] arguments ); @Deprecated Hashtable<String, Counter> getCounters(); @Deprecated void setCounters( Hashtable<String, Counter> counters ); List<TransDependency> getDependencies(); void setDependencies( List<TransDependency> dependencies ); DatabaseMeta getMaxDateConnection(); void setMaxDateConnection( DatabaseMeta maxDateConnection ); double getMaxDateDifference(); void setMaxDateDifference( double maxDateDifference ); String getMaxDateField(); void setMaxDateField( String maxDateField ); double getMaxDateOffset(); void setMaxDateOffset( double maxDateOffset ); String getMaxDateTable(); void setMaxDateTable( String maxDateTable ); int getSizeRowset(); void setSizeRowset( int sizeRowset ); DBCache getDbCache(); void setDbCache( DBCache dbCache ); String getTransversion(); void setTransversion( String n ); void setTransstatus( int n ); int getTransstatus(); @Override String toString(); void cancelQueries(); Map<String, String> getUsedArguments( String[] arguments ); int getSleepTimeEmpty(); int getSleepTimeFull(); void setSleepTimeEmpty( int sleepTimeEmpty ); void setSleepTimeFull( int sleepTimeFull ); boolean isDatabaseConnectionUsed( DatabaseMeta databaseMeta ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes, boolean includePasswords ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes ); List<String> getUsedVariables(); @Deprecated Result getPreviousResult(); @Deprecated void setPreviousResult( Result previousResult ); @Deprecated List<ResultFile> getResultFiles(); @Deprecated void setResultFiles( List<ResultFile> resultFiles ); List<PartitionSchema> getPartitionSchemas(); void setPartitionSchemas( List<PartitionSchema> partitionSchemas ); String[] getPartitionSchemasNames(); boolean isFeedbackShown(); void setFeedbackShown( boolean feedbackShown ); int getFeedbackSize(); void setFeedbackSize( int feedbackSize ); boolean isUsingUniqueConnections(); void setUsingUniqueConnections( boolean usingUniqueConnections ); List<ClusterSchema> getClusterSchemas(); void setClusterSchemas( List<ClusterSchema> clusterSchemas ); String[] getClusterSchemaNames(); PartitionSchema findPartitionSchema( String name ); ClusterSchema findClusterSchema( String name ); void addOrReplacePartitionSchema( PartitionSchema partitionSchema ); void addOrReplaceClusterSchema( ClusterSchema clusterSchema ); boolean isUsingThreadPriorityManagment(); void setUsingThreadPriorityManagment( boolean usingThreadPriorityManagment ); void checkRowMixingStatically( StepMeta stepMeta, ProgressMonitorListener monitor ); @Override void setInternalKettleVariables( VariableSpace var ); StepMeta findMappingInputStep( String stepname ); StepMeta findMappingOutputStep( String stepname ); List<ResourceReference> getResourceDependencies(); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); SlaveStepCopyPartitionDistribution getSlaveStepCopyPartitionDistribution(); void setSlaveStepCopyPartitionDistribution( SlaveStepCopyPartitionDistribution slaveStepCopyPartitionDistribution ); ClusterSchema findFirstUsedClusterSchema(); boolean isSlaveTransformation(); void setSlaveTransformation( boolean slaveTransformation ); boolean isCapturingStepPerformanceSnapShots(); void setCapturingStepPerformanceSnapShots( boolean capturingStepPerformanceSnapShots ); long getStepPerformanceCapturingDelay(); void setStepPerformanceCapturingDelay( long stepPerformanceCapturingDelay ); String getStepPerformanceCapturingSizeLimit(); void setStepPerformanceCapturingSizeLimit( String stepPerformanceCapturingSizeLimit ); void clearCaches(); @Override RepositoryObjectType getRepositoryElementType(); LogChannelInterface getLogChannel(); @Override String getLogChannelId(); @Override LoggingObjectType getObjectType(); TransLogTable getTransLogTable(); void setTransLogTable( TransLogTable transLogTable ); PerformanceLogTable getPerformanceLogTable(); void setPerformanceLogTable( PerformanceLogTable performanceLogTable ); StepLogTable getStepLogTable(); void setStepLogTable( StepLogTable stepLogTable ); List<LogTableInterface> getLogTables(); TransformationType getTransformationType(); void setTransformationType( TransformationType transformationType ); void writeXML( String filename ); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); MetricsLogTable getMetricsLogTable(); void setMetricsLogTable( MetricsLogTable metricsLogTable ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging ); void addStepChangeListener( StepMetaChangeListenerInterface listener ); void addStepChangeListener( int p, StepMetaChangeListenerInterface list ); void removeStepChangeListener( StepMetaChangeListenerInterface list ); void notifyAllListeners( StepMeta oldMeta, StepMeta newMeta ); boolean containsStepMeta( StepMeta stepMeta ); List<MissingTrans> getMissingTrans(); void addMissingTrans( MissingTrans trans ); void removeMissingTrans( MissingTrans trans ); @Override boolean hasMissingPlugins(); @Override NamedClusterEmbedManager getNamedClusterEmbedManager( ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { @Override public boolean equals( Object obj ) { if ( !( obj instanceof TransMeta ) ) { return false; } return compare( this, (TransMeta) obj ) == 0; } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); @Override int compare( TransMeta t1, TransMeta t2 ); @Override int compareTo( TransMeta o ); @Override boolean equals( Object obj ); @Override Object clone(); Object realClone( boolean doClear ); @Override void clear(); void addStep( StepMeta stepMeta ); void addOrReplaceStep( StepMeta stepMeta ); void addTransHop( TransHopMeta hi ); void addDependency( TransDependency td ); void addStep( int p, StepMeta stepMeta ); void addTransHop( int p, TransHopMeta hi ); void addDependency( int p, TransDependency td ); List<StepMeta> getSteps(); StepMeta getStep( int i ); TransHopMeta getTransHop( int i ); TransDependency getDependency( int i ); void removeStep( int i ); void removeTransHop( int i ); void removeTransHop( TransHopMeta hop ); void removeDependency( int i ); void removeAllDependencies(); int nrSteps(); int nrTransHops(); int nrDependencies(); int nrStepChangeListeners(); void setStep( int i, StepMeta stepMeta ); void setTransHop( int i, TransHopMeta hi ); List<StepMeta> getUsedSteps(); StepMeta findStep( String name ); StepMeta findStep( String name, StepMeta exclude ); TransHopMeta findTransHop( String name ); TransHopMeta findTransHopFrom( StepMeta fromstep ); List<TransHopMeta> findAllTransHopFrom( StepMeta fromstep ); TransHopMeta findTransHop( TransHopMeta hi ); TransHopMeta findTransHop( StepMeta from, StepMeta to ); TransHopMeta findTransHop( StepMeta from, StepMeta to, boolean disabledToo ); TransHopMeta findTransHopTo( StepMeta tostep ); boolean isStepInformative( StepMeta this_step, StepMeta prev_step ); @Deprecated int findNrPrevSteps( String stepname ); @Deprecated int findNrPrevSteps( String stepname, boolean info ); int findNrPrevSteps( StepMeta stepMeta ); @Deprecated StepMeta findPrevStep( String stepname, int nr ); @Deprecated StepMeta findPrevStep( String stepname, int nr, boolean info ); StepMeta findPrevStep( StepMeta stepMeta, int nr ); @Deprecated int findNrPrevSteps( StepMeta stepMeta, boolean info ); @Deprecated StepMeta findPrevStep( StepMeta stepMeta, int nr, boolean info ); List<StepMeta> findPreviousSteps( StepMeta stepMeta ); List<StepMeta> findPreviousSteps( StepMeta stepMeta, boolean info ); StepMeta[] getInfoStep( StepMeta stepMeta ); int findNrInfoSteps( StepMeta stepMeta ); RowMetaInterface getPrevInfoFields( String stepname ); RowMetaInterface getPrevInfoFields( StepMeta stepMeta ); @Deprecated int findNrNextSteps( StepMeta stepMeta ); @Deprecated StepMeta findNextStep( StepMeta stepMeta, int nr ); StepMeta[] getPrevSteps( StepMeta stepMeta ); String[] getPrevStepNames( String stepname ); String[] getPrevStepNames( StepMeta stepMeta ); @Deprecated StepMeta[] getNextSteps( StepMeta stepMeta ); List<StepMeta> findNextSteps( StepMeta stepMeta ); String[] getNextStepNames( StepMeta stepMeta ); StepMeta getStep( int x, int y, int iconsize ); boolean partOfTransHop( StepMeta stepMeta ); RowMetaInterface getStepFields( String stepname ); RowMetaInterface getStepFields( StepMeta stepMeta ); RowMetaInterface getStepFields( StepMeta[] stepMeta ); RowMetaInterface getStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getStepFields( StepMeta stepMeta, StepMeta targetStep, ProgressMonitorListener monitor ); RowMetaInterface getPrevStepFields( String stepname ); RowMetaInterface getPrevStepFields( StepMeta stepMeta ); RowMetaInterface getPrevStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getThisStepFields( String stepname, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row, ProgressMonitorListener monitor ); boolean isUsingPartitionSchema( PartitionSchema partitionSchema ); boolean isUsingAClusterSchema(); boolean isUsingClusterSchema( ClusterSchema clusterSchema ); boolean isUsingSlaveServer( SlaveServer slaveServer ); boolean isRepReference(); boolean isFileReference(); static boolean isRepReference( String exactFilename, String exactTransname ); static boolean isFileReference( String exactFilename, String exactTransname ); int indexOfTransHop( TransHopMeta hi ); int indexOfStep( StepMeta stepMeta ); @Override String getFileType(); @Override String[] getFilterNames(); @Override String[] getFilterExtensions(); @Override String getDefaultExtension(); @Override String getXML(); String getXML( boolean includeSteps, boolean includeDatabase, boolean includeSlaves, boolean includeClusters, boolean includePartitions ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); byte[] getKey(); void setKey( byte[] key ); boolean isPrivateKey(); void setPrivateKey( boolean privateKey ); @Override boolean loadSharedObject( SharedObjectInterface object ); List<StepMeta> getTransHopSteps( boolean all ); boolean isStepUsedInTransHops( StepMeta stepMeta ); boolean isAnySelectedStepUsedInTransHops(); @Override void clearChanged(); boolean haveStepsChanged(); boolean haveHopsChanged(); boolean havePartitionSchemasChanged(); boolean haveClusterSchemasChanged(); @Override boolean hasChanged(); boolean hasLoop( StepMeta stepMeta ); void selectAll(); void unselectAll(); Point[] getSelectedStepLocations(); Point[] getSelectedNoteLocations(); List<StepMeta> getSelectedSteps(); String[] getSelectedStepNames(); int[] getStepIndexes( List<StepMeta> steps ); Point getMaximum(); Point getMinimum(); String[] getStepNames(); StepMeta[] getStepsArray(); boolean findPrevious( StepMeta startStep, StepMeta stepToFind ); void sortSteps(); void sortHops(); Map<StepMeta, Map<StepMeta, Boolean>> sortStepsNatural(); void sortHopsNatural(); void analyseImpact( List<DatabaseImpact> impact, ProgressMonitorListener monitor ); String getAlternativeStepname( String stepname ); List<SQLStatement> getSQLStatements(); List<SQLStatement> getSQLStatements( ProgressMonitorListener monitor ); String getSQLStatementsString(); @Deprecated void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor ); void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor, VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated List<RowMetaAndData> getResultRows(); @Deprecated void setResultRows( List<RowMetaAndData> resultRows ); String getPathAndName(); @Deprecated String[] getArguments(); @Deprecated void setArguments( String[] arguments ); @Deprecated Hashtable<String, Counter> getCounters(); @Deprecated void setCounters( Hashtable<String, Counter> counters ); List<TransDependency> getDependencies(); void setDependencies( List<TransDependency> dependencies ); DatabaseMeta getMaxDateConnection(); void setMaxDateConnection( DatabaseMeta maxDateConnection ); double getMaxDateDifference(); void setMaxDateDifference( double maxDateDifference ); String getMaxDateField(); void setMaxDateField( String maxDateField ); double getMaxDateOffset(); void setMaxDateOffset( double maxDateOffset ); String getMaxDateTable(); void setMaxDateTable( String maxDateTable ); int getSizeRowset(); void setSizeRowset( int sizeRowset ); DBCache getDbCache(); void setDbCache( DBCache dbCache ); String getTransversion(); void setTransversion( String n ); void setTransstatus( int n ); int getTransstatus(); @Override String toString(); void cancelQueries(); Map<String, String> getUsedArguments( String[] arguments ); int getSleepTimeEmpty(); int getSleepTimeFull(); void setSleepTimeEmpty( int sleepTimeEmpty ); void setSleepTimeFull( int sleepTimeFull ); boolean isDatabaseConnectionUsed( DatabaseMeta databaseMeta ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes, boolean includePasswords ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes ); List<String> getUsedVariables(); @Deprecated Result getPreviousResult(); @Deprecated void setPreviousResult( Result previousResult ); @Deprecated List<ResultFile> getResultFiles(); @Deprecated void setResultFiles( List<ResultFile> resultFiles ); List<PartitionSchema> getPartitionSchemas(); void setPartitionSchemas( List<PartitionSchema> partitionSchemas ); String[] getPartitionSchemasNames(); boolean isFeedbackShown(); void setFeedbackShown( boolean feedbackShown ); int getFeedbackSize(); void setFeedbackSize( int feedbackSize ); boolean isUsingUniqueConnections(); void setUsingUniqueConnections( boolean usingUniqueConnections ); List<ClusterSchema> getClusterSchemas(); void setClusterSchemas( List<ClusterSchema> clusterSchemas ); String[] getClusterSchemaNames(); PartitionSchema findPartitionSchema( String name ); ClusterSchema findClusterSchema( String name ); void addOrReplacePartitionSchema( PartitionSchema partitionSchema ); void addOrReplaceClusterSchema( ClusterSchema clusterSchema ); boolean isUsingThreadPriorityManagment(); void setUsingThreadPriorityManagment( boolean usingThreadPriorityManagment ); void checkRowMixingStatically( StepMeta stepMeta, ProgressMonitorListener monitor ); @Override void setInternalKettleVariables( VariableSpace var ); StepMeta findMappingInputStep( String stepname ); StepMeta findMappingOutputStep( String stepname ); List<ResourceReference> getResourceDependencies(); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); SlaveStepCopyPartitionDistribution getSlaveStepCopyPartitionDistribution(); void setSlaveStepCopyPartitionDistribution( SlaveStepCopyPartitionDistribution slaveStepCopyPartitionDistribution ); ClusterSchema findFirstUsedClusterSchema(); boolean isSlaveTransformation(); void setSlaveTransformation( boolean slaveTransformation ); boolean isCapturingStepPerformanceSnapShots(); void setCapturingStepPerformanceSnapShots( boolean capturingStepPerformanceSnapShots ); long getStepPerformanceCapturingDelay(); void setStepPerformanceCapturingDelay( long stepPerformanceCapturingDelay ); String getStepPerformanceCapturingSizeLimit(); void setStepPerformanceCapturingSizeLimit( String stepPerformanceCapturingSizeLimit ); void clearCaches(); @Override RepositoryObjectType getRepositoryElementType(); LogChannelInterface getLogChannel(); @Override String getLogChannelId(); @Override LoggingObjectType getObjectType(); TransLogTable getTransLogTable(); void setTransLogTable( TransLogTable transLogTable ); PerformanceLogTable getPerformanceLogTable(); void setPerformanceLogTable( PerformanceLogTable performanceLogTable ); StepLogTable getStepLogTable(); void setStepLogTable( StepLogTable stepLogTable ); List<LogTableInterface> getLogTables(); TransformationType getTransformationType(); void setTransformationType( TransformationType transformationType ); void writeXML( String filename ); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); MetricsLogTable getMetricsLogTable(); void setMetricsLogTable( MetricsLogTable metricsLogTable ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging ); void addStepChangeListener( StepMetaChangeListenerInterface listener ); void addStepChangeListener( int p, StepMetaChangeListenerInterface list ); void removeStepChangeListener( StepMetaChangeListenerInterface list ); void notifyAllListeners( StepMeta oldMeta, StepMeta newMeta ); boolean containsStepMeta( StepMeta stepMeta ); List<MissingTrans> getMissingTrans(); void addMissingTrans( MissingTrans trans ); void removeMissingTrans( MissingTrans trans ); @Override boolean hasMissingPlugins(); @Override NamedClusterEmbedManager getNamedClusterEmbedManager( ); static final String XML_TAG; static final String STRING_TRANSMETA; static final RepositoryObjectType REPOSITORY_ELEMENT_TYPE; static final int BORDER_INDENT; static final String[] desc_type_undo; static final String XML_TAG_ORDER; static final String XML_TAG_NOTEPADS; static final String XML_TAG_PARAMETERS; static final String XML_TAG_PARTITIONSCHEMAS; static final String XML_TAG_SLAVESERVERS; static final String XML_TAG_CLUSTERSCHEMAS; static final String XML_TAG_STEP_ERROR_HANDLING; }
@Test public void testGetPrevInfoFields() throws KettleStepException { DataGridMeta dgm1 = new DataGridMeta(); dgm1.setFieldName( new String[]{ "id", "colA" } ); dgm1.allocate( 2 ); dgm1.setFieldType( new String[]{ ValueMetaFactory.getValueMetaName( ValueMetaInterface.TYPE_INTEGER ), ValueMetaFactory.getValueMetaName( ValueMetaInterface.TYPE_STRING ) } ); List<List<String>> dgm1Data = new ArrayList<>(); dgm1Data.add( Arrays.asList( new String[]{ "1", "A" } ) ); dgm1Data.add( Arrays.asList( new String[]{ "2", "B" } ) ); dgm1.setDataLines( dgm1Data ); DataGridMeta dgm2 = new DataGridMeta(); dgm2.allocate( 1 ); dgm2.setFieldName( new String[]{ "moreData" } ); dgm2.setFieldType( new String[]{ ValueMetaFactory.getValueMetaName( ValueMetaInterface.TYPE_STRING ) } ); List<List<String>> dgm2Data = new ArrayList<>(); dgm2Data.add( Arrays.asList( new String[]{ "Some Informational Data" } ) ); dgm2.setDataLines( dgm2Data ); StepMeta dg1 = new StepMeta( "input1", dgm1 ); StepMeta dg2 = new StepMeta( "input2", dgm2 ); final String UDJC_METHOD = "public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { return false; }"; UserDefinedJavaClassMeta udjcMeta = new UserDefinedJavaClassMeta(); udjcMeta.getInfoStepDefinitions().add( new StepDefinition( dg2.getName(), dg2.getName(), dg2, "info_data" ) ); udjcMeta.replaceDefinitions( Arrays.asList( new UserDefinedJavaClassDef[]{ new UserDefinedJavaClassDef( UserDefinedJavaClassDef.ClassType.TRANSFORM_CLASS, "MainClass", UDJC_METHOD ) } ) ); StepMeta udjc = new StepMeta( "PDI-14910", udjcMeta ); TransHopMeta hop1 = new TransHopMeta( dg1, udjc, true ); TransHopMeta hop2 = new TransHopMeta( dg2, udjc, true ); transMeta.addStep( dg1 ); transMeta.addStep( dg2 ); transMeta.addStep( udjc ); transMeta.addTransHop( hop1 ); transMeta.addTransHop( hop2 ); RowMetaInterface row = null; row = transMeta.getPrevInfoFields( udjc ); assertNotNull( row ); assertEquals( 1, row.size() ); assertEquals( "moreData", row.getValueMeta( 0 ).getName() ); assertEquals( ValueMetaInterface.TYPE_STRING, row.getValueMeta( 0 ).getType() ); }
public RowMetaInterface getPrevInfoFields( String stepname ) throws KettleStepException { return getPrevInfoFields( findStep( stepname ) ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public RowMetaInterface getPrevInfoFields( String stepname ) throws KettleStepException { return getPrevInfoFields( findStep( stepname ) ); } }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public RowMetaInterface getPrevInfoFields( String stepname ) throws KettleStepException { return getPrevInfoFields( findStep( stepname ) ); } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public RowMetaInterface getPrevInfoFields( String stepname ) throws KettleStepException { return getPrevInfoFields( findStep( stepname ) ); } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); @Override int compare( TransMeta t1, TransMeta t2 ); @Override int compareTo( TransMeta o ); @Override boolean equals( Object obj ); @Override Object clone(); Object realClone( boolean doClear ); @Override void clear(); void addStep( StepMeta stepMeta ); void addOrReplaceStep( StepMeta stepMeta ); void addTransHop( TransHopMeta hi ); void addDependency( TransDependency td ); void addStep( int p, StepMeta stepMeta ); void addTransHop( int p, TransHopMeta hi ); void addDependency( int p, TransDependency td ); List<StepMeta> getSteps(); StepMeta getStep( int i ); TransHopMeta getTransHop( int i ); TransDependency getDependency( int i ); void removeStep( int i ); void removeTransHop( int i ); void removeTransHop( TransHopMeta hop ); void removeDependency( int i ); void removeAllDependencies(); int nrSteps(); int nrTransHops(); int nrDependencies(); int nrStepChangeListeners(); void setStep( int i, StepMeta stepMeta ); void setTransHop( int i, TransHopMeta hi ); List<StepMeta> getUsedSteps(); StepMeta findStep( String name ); StepMeta findStep( String name, StepMeta exclude ); TransHopMeta findTransHop( String name ); TransHopMeta findTransHopFrom( StepMeta fromstep ); List<TransHopMeta> findAllTransHopFrom( StepMeta fromstep ); TransHopMeta findTransHop( TransHopMeta hi ); TransHopMeta findTransHop( StepMeta from, StepMeta to ); TransHopMeta findTransHop( StepMeta from, StepMeta to, boolean disabledToo ); TransHopMeta findTransHopTo( StepMeta tostep ); boolean isStepInformative( StepMeta this_step, StepMeta prev_step ); @Deprecated int findNrPrevSteps( String stepname ); @Deprecated int findNrPrevSteps( String stepname, boolean info ); int findNrPrevSteps( StepMeta stepMeta ); @Deprecated StepMeta findPrevStep( String stepname, int nr ); @Deprecated StepMeta findPrevStep( String stepname, int nr, boolean info ); StepMeta findPrevStep( StepMeta stepMeta, int nr ); @Deprecated int findNrPrevSteps( StepMeta stepMeta, boolean info ); @Deprecated StepMeta findPrevStep( StepMeta stepMeta, int nr, boolean info ); List<StepMeta> findPreviousSteps( StepMeta stepMeta ); List<StepMeta> findPreviousSteps( StepMeta stepMeta, boolean info ); StepMeta[] getInfoStep( StepMeta stepMeta ); int findNrInfoSteps( StepMeta stepMeta ); RowMetaInterface getPrevInfoFields( String stepname ); RowMetaInterface getPrevInfoFields( StepMeta stepMeta ); @Deprecated int findNrNextSteps( StepMeta stepMeta ); @Deprecated StepMeta findNextStep( StepMeta stepMeta, int nr ); StepMeta[] getPrevSteps( StepMeta stepMeta ); String[] getPrevStepNames( String stepname ); String[] getPrevStepNames( StepMeta stepMeta ); @Deprecated StepMeta[] getNextSteps( StepMeta stepMeta ); List<StepMeta> findNextSteps( StepMeta stepMeta ); String[] getNextStepNames( StepMeta stepMeta ); StepMeta getStep( int x, int y, int iconsize ); boolean partOfTransHop( StepMeta stepMeta ); RowMetaInterface getStepFields( String stepname ); RowMetaInterface getStepFields( StepMeta stepMeta ); RowMetaInterface getStepFields( StepMeta[] stepMeta ); RowMetaInterface getStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getStepFields( StepMeta stepMeta, StepMeta targetStep, ProgressMonitorListener monitor ); RowMetaInterface getPrevStepFields( String stepname ); RowMetaInterface getPrevStepFields( StepMeta stepMeta ); RowMetaInterface getPrevStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getThisStepFields( String stepname, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row, ProgressMonitorListener monitor ); boolean isUsingPartitionSchema( PartitionSchema partitionSchema ); boolean isUsingAClusterSchema(); boolean isUsingClusterSchema( ClusterSchema clusterSchema ); boolean isUsingSlaveServer( SlaveServer slaveServer ); boolean isRepReference(); boolean isFileReference(); static boolean isRepReference( String exactFilename, String exactTransname ); static boolean isFileReference( String exactFilename, String exactTransname ); int indexOfTransHop( TransHopMeta hi ); int indexOfStep( StepMeta stepMeta ); @Override String getFileType(); @Override String[] getFilterNames(); @Override String[] getFilterExtensions(); @Override String getDefaultExtension(); @Override String getXML(); String getXML( boolean includeSteps, boolean includeDatabase, boolean includeSlaves, boolean includeClusters, boolean includePartitions ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); byte[] getKey(); void setKey( byte[] key ); boolean isPrivateKey(); void setPrivateKey( boolean privateKey ); @Override boolean loadSharedObject( SharedObjectInterface object ); List<StepMeta> getTransHopSteps( boolean all ); boolean isStepUsedInTransHops( StepMeta stepMeta ); boolean isAnySelectedStepUsedInTransHops(); @Override void clearChanged(); boolean haveStepsChanged(); boolean haveHopsChanged(); boolean havePartitionSchemasChanged(); boolean haveClusterSchemasChanged(); @Override boolean hasChanged(); boolean hasLoop( StepMeta stepMeta ); void selectAll(); void unselectAll(); Point[] getSelectedStepLocations(); Point[] getSelectedNoteLocations(); List<StepMeta> getSelectedSteps(); String[] getSelectedStepNames(); int[] getStepIndexes( List<StepMeta> steps ); Point getMaximum(); Point getMinimum(); String[] getStepNames(); StepMeta[] getStepsArray(); boolean findPrevious( StepMeta startStep, StepMeta stepToFind ); void sortSteps(); void sortHops(); Map<StepMeta, Map<StepMeta, Boolean>> sortStepsNatural(); void sortHopsNatural(); void analyseImpact( List<DatabaseImpact> impact, ProgressMonitorListener monitor ); String getAlternativeStepname( String stepname ); List<SQLStatement> getSQLStatements(); List<SQLStatement> getSQLStatements( ProgressMonitorListener monitor ); String getSQLStatementsString(); @Deprecated void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor ); void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor, VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated List<RowMetaAndData> getResultRows(); @Deprecated void setResultRows( List<RowMetaAndData> resultRows ); String getPathAndName(); @Deprecated String[] getArguments(); @Deprecated void setArguments( String[] arguments ); @Deprecated Hashtable<String, Counter> getCounters(); @Deprecated void setCounters( Hashtable<String, Counter> counters ); List<TransDependency> getDependencies(); void setDependencies( List<TransDependency> dependencies ); DatabaseMeta getMaxDateConnection(); void setMaxDateConnection( DatabaseMeta maxDateConnection ); double getMaxDateDifference(); void setMaxDateDifference( double maxDateDifference ); String getMaxDateField(); void setMaxDateField( String maxDateField ); double getMaxDateOffset(); void setMaxDateOffset( double maxDateOffset ); String getMaxDateTable(); void setMaxDateTable( String maxDateTable ); int getSizeRowset(); void setSizeRowset( int sizeRowset ); DBCache getDbCache(); void setDbCache( DBCache dbCache ); String getTransversion(); void setTransversion( String n ); void setTransstatus( int n ); int getTransstatus(); @Override String toString(); void cancelQueries(); Map<String, String> getUsedArguments( String[] arguments ); int getSleepTimeEmpty(); int getSleepTimeFull(); void setSleepTimeEmpty( int sleepTimeEmpty ); void setSleepTimeFull( int sleepTimeFull ); boolean isDatabaseConnectionUsed( DatabaseMeta databaseMeta ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes, boolean includePasswords ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes ); List<String> getUsedVariables(); @Deprecated Result getPreviousResult(); @Deprecated void setPreviousResult( Result previousResult ); @Deprecated List<ResultFile> getResultFiles(); @Deprecated void setResultFiles( List<ResultFile> resultFiles ); List<PartitionSchema> getPartitionSchemas(); void setPartitionSchemas( List<PartitionSchema> partitionSchemas ); String[] getPartitionSchemasNames(); boolean isFeedbackShown(); void setFeedbackShown( boolean feedbackShown ); int getFeedbackSize(); void setFeedbackSize( int feedbackSize ); boolean isUsingUniqueConnections(); void setUsingUniqueConnections( boolean usingUniqueConnections ); List<ClusterSchema> getClusterSchemas(); void setClusterSchemas( List<ClusterSchema> clusterSchemas ); String[] getClusterSchemaNames(); PartitionSchema findPartitionSchema( String name ); ClusterSchema findClusterSchema( String name ); void addOrReplacePartitionSchema( PartitionSchema partitionSchema ); void addOrReplaceClusterSchema( ClusterSchema clusterSchema ); boolean isUsingThreadPriorityManagment(); void setUsingThreadPriorityManagment( boolean usingThreadPriorityManagment ); void checkRowMixingStatically( StepMeta stepMeta, ProgressMonitorListener monitor ); @Override void setInternalKettleVariables( VariableSpace var ); StepMeta findMappingInputStep( String stepname ); StepMeta findMappingOutputStep( String stepname ); List<ResourceReference> getResourceDependencies(); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); SlaveStepCopyPartitionDistribution getSlaveStepCopyPartitionDistribution(); void setSlaveStepCopyPartitionDistribution( SlaveStepCopyPartitionDistribution slaveStepCopyPartitionDistribution ); ClusterSchema findFirstUsedClusterSchema(); boolean isSlaveTransformation(); void setSlaveTransformation( boolean slaveTransformation ); boolean isCapturingStepPerformanceSnapShots(); void setCapturingStepPerformanceSnapShots( boolean capturingStepPerformanceSnapShots ); long getStepPerformanceCapturingDelay(); void setStepPerformanceCapturingDelay( long stepPerformanceCapturingDelay ); String getStepPerformanceCapturingSizeLimit(); void setStepPerformanceCapturingSizeLimit( String stepPerformanceCapturingSizeLimit ); void clearCaches(); @Override RepositoryObjectType getRepositoryElementType(); LogChannelInterface getLogChannel(); @Override String getLogChannelId(); @Override LoggingObjectType getObjectType(); TransLogTable getTransLogTable(); void setTransLogTable( TransLogTable transLogTable ); PerformanceLogTable getPerformanceLogTable(); void setPerformanceLogTable( PerformanceLogTable performanceLogTable ); StepLogTable getStepLogTable(); void setStepLogTable( StepLogTable stepLogTable ); List<LogTableInterface> getLogTables(); TransformationType getTransformationType(); void setTransformationType( TransformationType transformationType ); void writeXML( String filename ); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); MetricsLogTable getMetricsLogTable(); void setMetricsLogTable( MetricsLogTable metricsLogTable ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging ); void addStepChangeListener( StepMetaChangeListenerInterface listener ); void addStepChangeListener( int p, StepMetaChangeListenerInterface list ); void removeStepChangeListener( StepMetaChangeListenerInterface list ); void notifyAllListeners( StepMeta oldMeta, StepMeta newMeta ); boolean containsStepMeta( StepMeta stepMeta ); List<MissingTrans> getMissingTrans(); void addMissingTrans( MissingTrans trans ); void removeMissingTrans( MissingTrans trans ); @Override boolean hasMissingPlugins(); @Override NamedClusterEmbedManager getNamedClusterEmbedManager( ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public RowMetaInterface getPrevInfoFields( String stepname ) throws KettleStepException { return getPrevInfoFields( findStep( stepname ) ); } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); @Override int compare( TransMeta t1, TransMeta t2 ); @Override int compareTo( TransMeta o ); @Override boolean equals( Object obj ); @Override Object clone(); Object realClone( boolean doClear ); @Override void clear(); void addStep( StepMeta stepMeta ); void addOrReplaceStep( StepMeta stepMeta ); void addTransHop( TransHopMeta hi ); void addDependency( TransDependency td ); void addStep( int p, StepMeta stepMeta ); void addTransHop( int p, TransHopMeta hi ); void addDependency( int p, TransDependency td ); List<StepMeta> getSteps(); StepMeta getStep( int i ); TransHopMeta getTransHop( int i ); TransDependency getDependency( int i ); void removeStep( int i ); void removeTransHop( int i ); void removeTransHop( TransHopMeta hop ); void removeDependency( int i ); void removeAllDependencies(); int nrSteps(); int nrTransHops(); int nrDependencies(); int nrStepChangeListeners(); void setStep( int i, StepMeta stepMeta ); void setTransHop( int i, TransHopMeta hi ); List<StepMeta> getUsedSteps(); StepMeta findStep( String name ); StepMeta findStep( String name, StepMeta exclude ); TransHopMeta findTransHop( String name ); TransHopMeta findTransHopFrom( StepMeta fromstep ); List<TransHopMeta> findAllTransHopFrom( StepMeta fromstep ); TransHopMeta findTransHop( TransHopMeta hi ); TransHopMeta findTransHop( StepMeta from, StepMeta to ); TransHopMeta findTransHop( StepMeta from, StepMeta to, boolean disabledToo ); TransHopMeta findTransHopTo( StepMeta tostep ); boolean isStepInformative( StepMeta this_step, StepMeta prev_step ); @Deprecated int findNrPrevSteps( String stepname ); @Deprecated int findNrPrevSteps( String stepname, boolean info ); int findNrPrevSteps( StepMeta stepMeta ); @Deprecated StepMeta findPrevStep( String stepname, int nr ); @Deprecated StepMeta findPrevStep( String stepname, int nr, boolean info ); StepMeta findPrevStep( StepMeta stepMeta, int nr ); @Deprecated int findNrPrevSteps( StepMeta stepMeta, boolean info ); @Deprecated StepMeta findPrevStep( StepMeta stepMeta, int nr, boolean info ); List<StepMeta> findPreviousSteps( StepMeta stepMeta ); List<StepMeta> findPreviousSteps( StepMeta stepMeta, boolean info ); StepMeta[] getInfoStep( StepMeta stepMeta ); int findNrInfoSteps( StepMeta stepMeta ); RowMetaInterface getPrevInfoFields( String stepname ); RowMetaInterface getPrevInfoFields( StepMeta stepMeta ); @Deprecated int findNrNextSteps( StepMeta stepMeta ); @Deprecated StepMeta findNextStep( StepMeta stepMeta, int nr ); StepMeta[] getPrevSteps( StepMeta stepMeta ); String[] getPrevStepNames( String stepname ); String[] getPrevStepNames( StepMeta stepMeta ); @Deprecated StepMeta[] getNextSteps( StepMeta stepMeta ); List<StepMeta> findNextSteps( StepMeta stepMeta ); String[] getNextStepNames( StepMeta stepMeta ); StepMeta getStep( int x, int y, int iconsize ); boolean partOfTransHop( StepMeta stepMeta ); RowMetaInterface getStepFields( String stepname ); RowMetaInterface getStepFields( StepMeta stepMeta ); RowMetaInterface getStepFields( StepMeta[] stepMeta ); RowMetaInterface getStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getStepFields( StepMeta stepMeta, StepMeta targetStep, ProgressMonitorListener monitor ); RowMetaInterface getPrevStepFields( String stepname ); RowMetaInterface getPrevStepFields( StepMeta stepMeta ); RowMetaInterface getPrevStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getThisStepFields( String stepname, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row, ProgressMonitorListener monitor ); boolean isUsingPartitionSchema( PartitionSchema partitionSchema ); boolean isUsingAClusterSchema(); boolean isUsingClusterSchema( ClusterSchema clusterSchema ); boolean isUsingSlaveServer( SlaveServer slaveServer ); boolean isRepReference(); boolean isFileReference(); static boolean isRepReference( String exactFilename, String exactTransname ); static boolean isFileReference( String exactFilename, String exactTransname ); int indexOfTransHop( TransHopMeta hi ); int indexOfStep( StepMeta stepMeta ); @Override String getFileType(); @Override String[] getFilterNames(); @Override String[] getFilterExtensions(); @Override String getDefaultExtension(); @Override String getXML(); String getXML( boolean includeSteps, boolean includeDatabase, boolean includeSlaves, boolean includeClusters, boolean includePartitions ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); byte[] getKey(); void setKey( byte[] key ); boolean isPrivateKey(); void setPrivateKey( boolean privateKey ); @Override boolean loadSharedObject( SharedObjectInterface object ); List<StepMeta> getTransHopSteps( boolean all ); boolean isStepUsedInTransHops( StepMeta stepMeta ); boolean isAnySelectedStepUsedInTransHops(); @Override void clearChanged(); boolean haveStepsChanged(); boolean haveHopsChanged(); boolean havePartitionSchemasChanged(); boolean haveClusterSchemasChanged(); @Override boolean hasChanged(); boolean hasLoop( StepMeta stepMeta ); void selectAll(); void unselectAll(); Point[] getSelectedStepLocations(); Point[] getSelectedNoteLocations(); List<StepMeta> getSelectedSteps(); String[] getSelectedStepNames(); int[] getStepIndexes( List<StepMeta> steps ); Point getMaximum(); Point getMinimum(); String[] getStepNames(); StepMeta[] getStepsArray(); boolean findPrevious( StepMeta startStep, StepMeta stepToFind ); void sortSteps(); void sortHops(); Map<StepMeta, Map<StepMeta, Boolean>> sortStepsNatural(); void sortHopsNatural(); void analyseImpact( List<DatabaseImpact> impact, ProgressMonitorListener monitor ); String getAlternativeStepname( String stepname ); List<SQLStatement> getSQLStatements(); List<SQLStatement> getSQLStatements( ProgressMonitorListener monitor ); String getSQLStatementsString(); @Deprecated void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor ); void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor, VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated List<RowMetaAndData> getResultRows(); @Deprecated void setResultRows( List<RowMetaAndData> resultRows ); String getPathAndName(); @Deprecated String[] getArguments(); @Deprecated void setArguments( String[] arguments ); @Deprecated Hashtable<String, Counter> getCounters(); @Deprecated void setCounters( Hashtable<String, Counter> counters ); List<TransDependency> getDependencies(); void setDependencies( List<TransDependency> dependencies ); DatabaseMeta getMaxDateConnection(); void setMaxDateConnection( DatabaseMeta maxDateConnection ); double getMaxDateDifference(); void setMaxDateDifference( double maxDateDifference ); String getMaxDateField(); void setMaxDateField( String maxDateField ); double getMaxDateOffset(); void setMaxDateOffset( double maxDateOffset ); String getMaxDateTable(); void setMaxDateTable( String maxDateTable ); int getSizeRowset(); void setSizeRowset( int sizeRowset ); DBCache getDbCache(); void setDbCache( DBCache dbCache ); String getTransversion(); void setTransversion( String n ); void setTransstatus( int n ); int getTransstatus(); @Override String toString(); void cancelQueries(); Map<String, String> getUsedArguments( String[] arguments ); int getSleepTimeEmpty(); int getSleepTimeFull(); void setSleepTimeEmpty( int sleepTimeEmpty ); void setSleepTimeFull( int sleepTimeFull ); boolean isDatabaseConnectionUsed( DatabaseMeta databaseMeta ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes, boolean includePasswords ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes ); List<String> getUsedVariables(); @Deprecated Result getPreviousResult(); @Deprecated void setPreviousResult( Result previousResult ); @Deprecated List<ResultFile> getResultFiles(); @Deprecated void setResultFiles( List<ResultFile> resultFiles ); List<PartitionSchema> getPartitionSchemas(); void setPartitionSchemas( List<PartitionSchema> partitionSchemas ); String[] getPartitionSchemasNames(); boolean isFeedbackShown(); void setFeedbackShown( boolean feedbackShown ); int getFeedbackSize(); void setFeedbackSize( int feedbackSize ); boolean isUsingUniqueConnections(); void setUsingUniqueConnections( boolean usingUniqueConnections ); List<ClusterSchema> getClusterSchemas(); void setClusterSchemas( List<ClusterSchema> clusterSchemas ); String[] getClusterSchemaNames(); PartitionSchema findPartitionSchema( String name ); ClusterSchema findClusterSchema( String name ); void addOrReplacePartitionSchema( PartitionSchema partitionSchema ); void addOrReplaceClusterSchema( ClusterSchema clusterSchema ); boolean isUsingThreadPriorityManagment(); void setUsingThreadPriorityManagment( boolean usingThreadPriorityManagment ); void checkRowMixingStatically( StepMeta stepMeta, ProgressMonitorListener monitor ); @Override void setInternalKettleVariables( VariableSpace var ); StepMeta findMappingInputStep( String stepname ); StepMeta findMappingOutputStep( String stepname ); List<ResourceReference> getResourceDependencies(); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); SlaveStepCopyPartitionDistribution getSlaveStepCopyPartitionDistribution(); void setSlaveStepCopyPartitionDistribution( SlaveStepCopyPartitionDistribution slaveStepCopyPartitionDistribution ); ClusterSchema findFirstUsedClusterSchema(); boolean isSlaveTransformation(); void setSlaveTransformation( boolean slaveTransformation ); boolean isCapturingStepPerformanceSnapShots(); void setCapturingStepPerformanceSnapShots( boolean capturingStepPerformanceSnapShots ); long getStepPerformanceCapturingDelay(); void setStepPerformanceCapturingDelay( long stepPerformanceCapturingDelay ); String getStepPerformanceCapturingSizeLimit(); void setStepPerformanceCapturingSizeLimit( String stepPerformanceCapturingSizeLimit ); void clearCaches(); @Override RepositoryObjectType getRepositoryElementType(); LogChannelInterface getLogChannel(); @Override String getLogChannelId(); @Override LoggingObjectType getObjectType(); TransLogTable getTransLogTable(); void setTransLogTable( TransLogTable transLogTable ); PerformanceLogTable getPerformanceLogTable(); void setPerformanceLogTable( PerformanceLogTable performanceLogTable ); StepLogTable getStepLogTable(); void setStepLogTable( StepLogTable stepLogTable ); List<LogTableInterface> getLogTables(); TransformationType getTransformationType(); void setTransformationType( TransformationType transformationType ); void writeXML( String filename ); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); MetricsLogTable getMetricsLogTable(); void setMetricsLogTable( MetricsLogTable metricsLogTable ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging ); void addStepChangeListener( StepMetaChangeListenerInterface listener ); void addStepChangeListener( int p, StepMetaChangeListenerInterface list ); void removeStepChangeListener( StepMetaChangeListenerInterface list ); void notifyAllListeners( StepMeta oldMeta, StepMeta newMeta ); boolean containsStepMeta( StepMeta stepMeta ); List<MissingTrans> getMissingTrans(); void addMissingTrans( MissingTrans trans ); void removeMissingTrans( MissingTrans trans ); @Override boolean hasMissingPlugins(); @Override NamedClusterEmbedManager getNamedClusterEmbedManager( ); static final String XML_TAG; static final String STRING_TRANSMETA; static final RepositoryObjectType REPOSITORY_ELEMENT_TYPE; static final int BORDER_INDENT; static final String[] desc_type_undo; static final String XML_TAG_ORDER; static final String XML_TAG_NOTEPADS; static final String XML_TAG_PARAMETERS; static final String XML_TAG_PARTITIONSCHEMAS; static final String XML_TAG_SLAVESERVERS; static final String XML_TAG_CLUSTERSCHEMAS; static final String XML_TAG_STEP_ERROR_HANDLING; }
@Test public void testAddStepWithChangeListenerInterface() { StepMeta stepMeta = mock( StepMeta.class ); StepMetaChangeListenerInterfaceMock metaInterface = mock( StepMetaChangeListenerInterfaceMock.class ); when( stepMeta.getStepMetaInterface() ).thenReturn( metaInterface ); assertEquals( 0, transMeta.steps.size() ); assertEquals( 0, transMeta.stepChangeListeners.size() ); transMeta.addStep( 0, stepMeta ); assertEquals( 1, transMeta.steps.size() ); assertEquals( 1, transMeta.stepChangeListeners.size() ); transMeta.addStep( 0, stepMeta ); assertEquals( 2, transMeta.steps.size() ); assertEquals( 2, transMeta.stepChangeListeners.size() ); }
public void addStep( StepMeta stepMeta ) { steps.add( stepMeta ); stepMeta.setParentTransMeta( this ); StepMetaInterface iface = stepMeta.getStepMetaInterface(); if ( iface instanceof StepMetaChangeListenerInterface ) { addStepChangeListener( (StepMetaChangeListenerInterface) iface ); } changed_steps = true; }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public void addStep( StepMeta stepMeta ) { steps.add( stepMeta ); stepMeta.setParentTransMeta( this ); StepMetaInterface iface = stepMeta.getStepMetaInterface(); if ( iface instanceof StepMetaChangeListenerInterface ) { addStepChangeListener( (StepMetaChangeListenerInterface) iface ); } changed_steps = true; } }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public void addStep( StepMeta stepMeta ) { steps.add( stepMeta ); stepMeta.setParentTransMeta( this ); StepMetaInterface iface = stepMeta.getStepMetaInterface(); if ( iface instanceof StepMetaChangeListenerInterface ) { addStepChangeListener( (StepMetaChangeListenerInterface) iface ); } changed_steps = true; } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public void addStep( StepMeta stepMeta ) { steps.add( stepMeta ); stepMeta.setParentTransMeta( this ); StepMetaInterface iface = stepMeta.getStepMetaInterface(); if ( iface instanceof StepMetaChangeListenerInterface ) { addStepChangeListener( (StepMetaChangeListenerInterface) iface ); } changed_steps = true; } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); @Override int compare( TransMeta t1, TransMeta t2 ); @Override int compareTo( TransMeta o ); @Override boolean equals( Object obj ); @Override Object clone(); Object realClone( boolean doClear ); @Override void clear(); void addStep( StepMeta stepMeta ); void addOrReplaceStep( StepMeta stepMeta ); void addTransHop( TransHopMeta hi ); void addDependency( TransDependency td ); void addStep( int p, StepMeta stepMeta ); void addTransHop( int p, TransHopMeta hi ); void addDependency( int p, TransDependency td ); List<StepMeta> getSteps(); StepMeta getStep( int i ); TransHopMeta getTransHop( int i ); TransDependency getDependency( int i ); void removeStep( int i ); void removeTransHop( int i ); void removeTransHop( TransHopMeta hop ); void removeDependency( int i ); void removeAllDependencies(); int nrSteps(); int nrTransHops(); int nrDependencies(); int nrStepChangeListeners(); void setStep( int i, StepMeta stepMeta ); void setTransHop( int i, TransHopMeta hi ); List<StepMeta> getUsedSteps(); StepMeta findStep( String name ); StepMeta findStep( String name, StepMeta exclude ); TransHopMeta findTransHop( String name ); TransHopMeta findTransHopFrom( StepMeta fromstep ); List<TransHopMeta> findAllTransHopFrom( StepMeta fromstep ); TransHopMeta findTransHop( TransHopMeta hi ); TransHopMeta findTransHop( StepMeta from, StepMeta to ); TransHopMeta findTransHop( StepMeta from, StepMeta to, boolean disabledToo ); TransHopMeta findTransHopTo( StepMeta tostep ); boolean isStepInformative( StepMeta this_step, StepMeta prev_step ); @Deprecated int findNrPrevSteps( String stepname ); @Deprecated int findNrPrevSteps( String stepname, boolean info ); int findNrPrevSteps( StepMeta stepMeta ); @Deprecated StepMeta findPrevStep( String stepname, int nr ); @Deprecated StepMeta findPrevStep( String stepname, int nr, boolean info ); StepMeta findPrevStep( StepMeta stepMeta, int nr ); @Deprecated int findNrPrevSteps( StepMeta stepMeta, boolean info ); @Deprecated StepMeta findPrevStep( StepMeta stepMeta, int nr, boolean info ); List<StepMeta> findPreviousSteps( StepMeta stepMeta ); List<StepMeta> findPreviousSteps( StepMeta stepMeta, boolean info ); StepMeta[] getInfoStep( StepMeta stepMeta ); int findNrInfoSteps( StepMeta stepMeta ); RowMetaInterface getPrevInfoFields( String stepname ); RowMetaInterface getPrevInfoFields( StepMeta stepMeta ); @Deprecated int findNrNextSteps( StepMeta stepMeta ); @Deprecated StepMeta findNextStep( StepMeta stepMeta, int nr ); StepMeta[] getPrevSteps( StepMeta stepMeta ); String[] getPrevStepNames( String stepname ); String[] getPrevStepNames( StepMeta stepMeta ); @Deprecated StepMeta[] getNextSteps( StepMeta stepMeta ); List<StepMeta> findNextSteps( StepMeta stepMeta ); String[] getNextStepNames( StepMeta stepMeta ); StepMeta getStep( int x, int y, int iconsize ); boolean partOfTransHop( StepMeta stepMeta ); RowMetaInterface getStepFields( String stepname ); RowMetaInterface getStepFields( StepMeta stepMeta ); RowMetaInterface getStepFields( StepMeta[] stepMeta ); RowMetaInterface getStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getStepFields( StepMeta stepMeta, StepMeta targetStep, ProgressMonitorListener monitor ); RowMetaInterface getPrevStepFields( String stepname ); RowMetaInterface getPrevStepFields( StepMeta stepMeta ); RowMetaInterface getPrevStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getThisStepFields( String stepname, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row, ProgressMonitorListener monitor ); boolean isUsingPartitionSchema( PartitionSchema partitionSchema ); boolean isUsingAClusterSchema(); boolean isUsingClusterSchema( ClusterSchema clusterSchema ); boolean isUsingSlaveServer( SlaveServer slaveServer ); boolean isRepReference(); boolean isFileReference(); static boolean isRepReference( String exactFilename, String exactTransname ); static boolean isFileReference( String exactFilename, String exactTransname ); int indexOfTransHop( TransHopMeta hi ); int indexOfStep( StepMeta stepMeta ); @Override String getFileType(); @Override String[] getFilterNames(); @Override String[] getFilterExtensions(); @Override String getDefaultExtension(); @Override String getXML(); String getXML( boolean includeSteps, boolean includeDatabase, boolean includeSlaves, boolean includeClusters, boolean includePartitions ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); byte[] getKey(); void setKey( byte[] key ); boolean isPrivateKey(); void setPrivateKey( boolean privateKey ); @Override boolean loadSharedObject( SharedObjectInterface object ); List<StepMeta> getTransHopSteps( boolean all ); boolean isStepUsedInTransHops( StepMeta stepMeta ); boolean isAnySelectedStepUsedInTransHops(); @Override void clearChanged(); boolean haveStepsChanged(); boolean haveHopsChanged(); boolean havePartitionSchemasChanged(); boolean haveClusterSchemasChanged(); @Override boolean hasChanged(); boolean hasLoop( StepMeta stepMeta ); void selectAll(); void unselectAll(); Point[] getSelectedStepLocations(); Point[] getSelectedNoteLocations(); List<StepMeta> getSelectedSteps(); String[] getSelectedStepNames(); int[] getStepIndexes( List<StepMeta> steps ); Point getMaximum(); Point getMinimum(); String[] getStepNames(); StepMeta[] getStepsArray(); boolean findPrevious( StepMeta startStep, StepMeta stepToFind ); void sortSteps(); void sortHops(); Map<StepMeta, Map<StepMeta, Boolean>> sortStepsNatural(); void sortHopsNatural(); void analyseImpact( List<DatabaseImpact> impact, ProgressMonitorListener monitor ); String getAlternativeStepname( String stepname ); List<SQLStatement> getSQLStatements(); List<SQLStatement> getSQLStatements( ProgressMonitorListener monitor ); String getSQLStatementsString(); @Deprecated void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor ); void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor, VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated List<RowMetaAndData> getResultRows(); @Deprecated void setResultRows( List<RowMetaAndData> resultRows ); String getPathAndName(); @Deprecated String[] getArguments(); @Deprecated void setArguments( String[] arguments ); @Deprecated Hashtable<String, Counter> getCounters(); @Deprecated void setCounters( Hashtable<String, Counter> counters ); List<TransDependency> getDependencies(); void setDependencies( List<TransDependency> dependencies ); DatabaseMeta getMaxDateConnection(); void setMaxDateConnection( DatabaseMeta maxDateConnection ); double getMaxDateDifference(); void setMaxDateDifference( double maxDateDifference ); String getMaxDateField(); void setMaxDateField( String maxDateField ); double getMaxDateOffset(); void setMaxDateOffset( double maxDateOffset ); String getMaxDateTable(); void setMaxDateTable( String maxDateTable ); int getSizeRowset(); void setSizeRowset( int sizeRowset ); DBCache getDbCache(); void setDbCache( DBCache dbCache ); String getTransversion(); void setTransversion( String n ); void setTransstatus( int n ); int getTransstatus(); @Override String toString(); void cancelQueries(); Map<String, String> getUsedArguments( String[] arguments ); int getSleepTimeEmpty(); int getSleepTimeFull(); void setSleepTimeEmpty( int sleepTimeEmpty ); void setSleepTimeFull( int sleepTimeFull ); boolean isDatabaseConnectionUsed( DatabaseMeta databaseMeta ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes, boolean includePasswords ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes ); List<String> getUsedVariables(); @Deprecated Result getPreviousResult(); @Deprecated void setPreviousResult( Result previousResult ); @Deprecated List<ResultFile> getResultFiles(); @Deprecated void setResultFiles( List<ResultFile> resultFiles ); List<PartitionSchema> getPartitionSchemas(); void setPartitionSchemas( List<PartitionSchema> partitionSchemas ); String[] getPartitionSchemasNames(); boolean isFeedbackShown(); void setFeedbackShown( boolean feedbackShown ); int getFeedbackSize(); void setFeedbackSize( int feedbackSize ); boolean isUsingUniqueConnections(); void setUsingUniqueConnections( boolean usingUniqueConnections ); List<ClusterSchema> getClusterSchemas(); void setClusterSchemas( List<ClusterSchema> clusterSchemas ); String[] getClusterSchemaNames(); PartitionSchema findPartitionSchema( String name ); ClusterSchema findClusterSchema( String name ); void addOrReplacePartitionSchema( PartitionSchema partitionSchema ); void addOrReplaceClusterSchema( ClusterSchema clusterSchema ); boolean isUsingThreadPriorityManagment(); void setUsingThreadPriorityManagment( boolean usingThreadPriorityManagment ); void checkRowMixingStatically( StepMeta stepMeta, ProgressMonitorListener monitor ); @Override void setInternalKettleVariables( VariableSpace var ); StepMeta findMappingInputStep( String stepname ); StepMeta findMappingOutputStep( String stepname ); List<ResourceReference> getResourceDependencies(); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); SlaveStepCopyPartitionDistribution getSlaveStepCopyPartitionDistribution(); void setSlaveStepCopyPartitionDistribution( SlaveStepCopyPartitionDistribution slaveStepCopyPartitionDistribution ); ClusterSchema findFirstUsedClusterSchema(); boolean isSlaveTransformation(); void setSlaveTransformation( boolean slaveTransformation ); boolean isCapturingStepPerformanceSnapShots(); void setCapturingStepPerformanceSnapShots( boolean capturingStepPerformanceSnapShots ); long getStepPerformanceCapturingDelay(); void setStepPerformanceCapturingDelay( long stepPerformanceCapturingDelay ); String getStepPerformanceCapturingSizeLimit(); void setStepPerformanceCapturingSizeLimit( String stepPerformanceCapturingSizeLimit ); void clearCaches(); @Override RepositoryObjectType getRepositoryElementType(); LogChannelInterface getLogChannel(); @Override String getLogChannelId(); @Override LoggingObjectType getObjectType(); TransLogTable getTransLogTable(); void setTransLogTable( TransLogTable transLogTable ); PerformanceLogTable getPerformanceLogTable(); void setPerformanceLogTable( PerformanceLogTable performanceLogTable ); StepLogTable getStepLogTable(); void setStepLogTable( StepLogTable stepLogTable ); List<LogTableInterface> getLogTables(); TransformationType getTransformationType(); void setTransformationType( TransformationType transformationType ); void writeXML( String filename ); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); MetricsLogTable getMetricsLogTable(); void setMetricsLogTable( MetricsLogTable metricsLogTable ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging ); void addStepChangeListener( StepMetaChangeListenerInterface listener ); void addStepChangeListener( int p, StepMetaChangeListenerInterface list ); void removeStepChangeListener( StepMetaChangeListenerInterface list ); void notifyAllListeners( StepMeta oldMeta, StepMeta newMeta ); boolean containsStepMeta( StepMeta stepMeta ); List<MissingTrans> getMissingTrans(); void addMissingTrans( MissingTrans trans ); void removeMissingTrans( MissingTrans trans ); @Override boolean hasMissingPlugins(); @Override NamedClusterEmbedManager getNamedClusterEmbedManager( ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public void addStep( StepMeta stepMeta ) { steps.add( stepMeta ); stepMeta.setParentTransMeta( this ); StepMetaInterface iface = stepMeta.getStepMetaInterface(); if ( iface instanceof StepMetaChangeListenerInterface ) { addStepChangeListener( (StepMetaChangeListenerInterface) iface ); } changed_steps = true; } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); @Override int compare( TransMeta t1, TransMeta t2 ); @Override int compareTo( TransMeta o ); @Override boolean equals( Object obj ); @Override Object clone(); Object realClone( boolean doClear ); @Override void clear(); void addStep( StepMeta stepMeta ); void addOrReplaceStep( StepMeta stepMeta ); void addTransHop( TransHopMeta hi ); void addDependency( TransDependency td ); void addStep( int p, StepMeta stepMeta ); void addTransHop( int p, TransHopMeta hi ); void addDependency( int p, TransDependency td ); List<StepMeta> getSteps(); StepMeta getStep( int i ); TransHopMeta getTransHop( int i ); TransDependency getDependency( int i ); void removeStep( int i ); void removeTransHop( int i ); void removeTransHop( TransHopMeta hop ); void removeDependency( int i ); void removeAllDependencies(); int nrSteps(); int nrTransHops(); int nrDependencies(); int nrStepChangeListeners(); void setStep( int i, StepMeta stepMeta ); void setTransHop( int i, TransHopMeta hi ); List<StepMeta> getUsedSteps(); StepMeta findStep( String name ); StepMeta findStep( String name, StepMeta exclude ); TransHopMeta findTransHop( String name ); TransHopMeta findTransHopFrom( StepMeta fromstep ); List<TransHopMeta> findAllTransHopFrom( StepMeta fromstep ); TransHopMeta findTransHop( TransHopMeta hi ); TransHopMeta findTransHop( StepMeta from, StepMeta to ); TransHopMeta findTransHop( StepMeta from, StepMeta to, boolean disabledToo ); TransHopMeta findTransHopTo( StepMeta tostep ); boolean isStepInformative( StepMeta this_step, StepMeta prev_step ); @Deprecated int findNrPrevSteps( String stepname ); @Deprecated int findNrPrevSteps( String stepname, boolean info ); int findNrPrevSteps( StepMeta stepMeta ); @Deprecated StepMeta findPrevStep( String stepname, int nr ); @Deprecated StepMeta findPrevStep( String stepname, int nr, boolean info ); StepMeta findPrevStep( StepMeta stepMeta, int nr ); @Deprecated int findNrPrevSteps( StepMeta stepMeta, boolean info ); @Deprecated StepMeta findPrevStep( StepMeta stepMeta, int nr, boolean info ); List<StepMeta> findPreviousSteps( StepMeta stepMeta ); List<StepMeta> findPreviousSteps( StepMeta stepMeta, boolean info ); StepMeta[] getInfoStep( StepMeta stepMeta ); int findNrInfoSteps( StepMeta stepMeta ); RowMetaInterface getPrevInfoFields( String stepname ); RowMetaInterface getPrevInfoFields( StepMeta stepMeta ); @Deprecated int findNrNextSteps( StepMeta stepMeta ); @Deprecated StepMeta findNextStep( StepMeta stepMeta, int nr ); StepMeta[] getPrevSteps( StepMeta stepMeta ); String[] getPrevStepNames( String stepname ); String[] getPrevStepNames( StepMeta stepMeta ); @Deprecated StepMeta[] getNextSteps( StepMeta stepMeta ); List<StepMeta> findNextSteps( StepMeta stepMeta ); String[] getNextStepNames( StepMeta stepMeta ); StepMeta getStep( int x, int y, int iconsize ); boolean partOfTransHop( StepMeta stepMeta ); RowMetaInterface getStepFields( String stepname ); RowMetaInterface getStepFields( StepMeta stepMeta ); RowMetaInterface getStepFields( StepMeta[] stepMeta ); RowMetaInterface getStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getStepFields( StepMeta stepMeta, StepMeta targetStep, ProgressMonitorListener monitor ); RowMetaInterface getPrevStepFields( String stepname ); RowMetaInterface getPrevStepFields( StepMeta stepMeta ); RowMetaInterface getPrevStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getThisStepFields( String stepname, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row, ProgressMonitorListener monitor ); boolean isUsingPartitionSchema( PartitionSchema partitionSchema ); boolean isUsingAClusterSchema(); boolean isUsingClusterSchema( ClusterSchema clusterSchema ); boolean isUsingSlaveServer( SlaveServer slaveServer ); boolean isRepReference(); boolean isFileReference(); static boolean isRepReference( String exactFilename, String exactTransname ); static boolean isFileReference( String exactFilename, String exactTransname ); int indexOfTransHop( TransHopMeta hi ); int indexOfStep( StepMeta stepMeta ); @Override String getFileType(); @Override String[] getFilterNames(); @Override String[] getFilterExtensions(); @Override String getDefaultExtension(); @Override String getXML(); String getXML( boolean includeSteps, boolean includeDatabase, boolean includeSlaves, boolean includeClusters, boolean includePartitions ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); byte[] getKey(); void setKey( byte[] key ); boolean isPrivateKey(); void setPrivateKey( boolean privateKey ); @Override boolean loadSharedObject( SharedObjectInterface object ); List<StepMeta> getTransHopSteps( boolean all ); boolean isStepUsedInTransHops( StepMeta stepMeta ); boolean isAnySelectedStepUsedInTransHops(); @Override void clearChanged(); boolean haveStepsChanged(); boolean haveHopsChanged(); boolean havePartitionSchemasChanged(); boolean haveClusterSchemasChanged(); @Override boolean hasChanged(); boolean hasLoop( StepMeta stepMeta ); void selectAll(); void unselectAll(); Point[] getSelectedStepLocations(); Point[] getSelectedNoteLocations(); List<StepMeta> getSelectedSteps(); String[] getSelectedStepNames(); int[] getStepIndexes( List<StepMeta> steps ); Point getMaximum(); Point getMinimum(); String[] getStepNames(); StepMeta[] getStepsArray(); boolean findPrevious( StepMeta startStep, StepMeta stepToFind ); void sortSteps(); void sortHops(); Map<StepMeta, Map<StepMeta, Boolean>> sortStepsNatural(); void sortHopsNatural(); void analyseImpact( List<DatabaseImpact> impact, ProgressMonitorListener monitor ); String getAlternativeStepname( String stepname ); List<SQLStatement> getSQLStatements(); List<SQLStatement> getSQLStatements( ProgressMonitorListener monitor ); String getSQLStatementsString(); @Deprecated void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor ); void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor, VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated List<RowMetaAndData> getResultRows(); @Deprecated void setResultRows( List<RowMetaAndData> resultRows ); String getPathAndName(); @Deprecated String[] getArguments(); @Deprecated void setArguments( String[] arguments ); @Deprecated Hashtable<String, Counter> getCounters(); @Deprecated void setCounters( Hashtable<String, Counter> counters ); List<TransDependency> getDependencies(); void setDependencies( List<TransDependency> dependencies ); DatabaseMeta getMaxDateConnection(); void setMaxDateConnection( DatabaseMeta maxDateConnection ); double getMaxDateDifference(); void setMaxDateDifference( double maxDateDifference ); String getMaxDateField(); void setMaxDateField( String maxDateField ); double getMaxDateOffset(); void setMaxDateOffset( double maxDateOffset ); String getMaxDateTable(); void setMaxDateTable( String maxDateTable ); int getSizeRowset(); void setSizeRowset( int sizeRowset ); DBCache getDbCache(); void setDbCache( DBCache dbCache ); String getTransversion(); void setTransversion( String n ); void setTransstatus( int n ); int getTransstatus(); @Override String toString(); void cancelQueries(); Map<String, String> getUsedArguments( String[] arguments ); int getSleepTimeEmpty(); int getSleepTimeFull(); void setSleepTimeEmpty( int sleepTimeEmpty ); void setSleepTimeFull( int sleepTimeFull ); boolean isDatabaseConnectionUsed( DatabaseMeta databaseMeta ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes, boolean includePasswords ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes ); List<String> getUsedVariables(); @Deprecated Result getPreviousResult(); @Deprecated void setPreviousResult( Result previousResult ); @Deprecated List<ResultFile> getResultFiles(); @Deprecated void setResultFiles( List<ResultFile> resultFiles ); List<PartitionSchema> getPartitionSchemas(); void setPartitionSchemas( List<PartitionSchema> partitionSchemas ); String[] getPartitionSchemasNames(); boolean isFeedbackShown(); void setFeedbackShown( boolean feedbackShown ); int getFeedbackSize(); void setFeedbackSize( int feedbackSize ); boolean isUsingUniqueConnections(); void setUsingUniqueConnections( boolean usingUniqueConnections ); List<ClusterSchema> getClusterSchemas(); void setClusterSchemas( List<ClusterSchema> clusterSchemas ); String[] getClusterSchemaNames(); PartitionSchema findPartitionSchema( String name ); ClusterSchema findClusterSchema( String name ); void addOrReplacePartitionSchema( PartitionSchema partitionSchema ); void addOrReplaceClusterSchema( ClusterSchema clusterSchema ); boolean isUsingThreadPriorityManagment(); void setUsingThreadPriorityManagment( boolean usingThreadPriorityManagment ); void checkRowMixingStatically( StepMeta stepMeta, ProgressMonitorListener monitor ); @Override void setInternalKettleVariables( VariableSpace var ); StepMeta findMappingInputStep( String stepname ); StepMeta findMappingOutputStep( String stepname ); List<ResourceReference> getResourceDependencies(); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); SlaveStepCopyPartitionDistribution getSlaveStepCopyPartitionDistribution(); void setSlaveStepCopyPartitionDistribution( SlaveStepCopyPartitionDistribution slaveStepCopyPartitionDistribution ); ClusterSchema findFirstUsedClusterSchema(); boolean isSlaveTransformation(); void setSlaveTransformation( boolean slaveTransformation ); boolean isCapturingStepPerformanceSnapShots(); void setCapturingStepPerformanceSnapShots( boolean capturingStepPerformanceSnapShots ); long getStepPerformanceCapturingDelay(); void setStepPerformanceCapturingDelay( long stepPerformanceCapturingDelay ); String getStepPerformanceCapturingSizeLimit(); void setStepPerformanceCapturingSizeLimit( String stepPerformanceCapturingSizeLimit ); void clearCaches(); @Override RepositoryObjectType getRepositoryElementType(); LogChannelInterface getLogChannel(); @Override String getLogChannelId(); @Override LoggingObjectType getObjectType(); TransLogTable getTransLogTable(); void setTransLogTable( TransLogTable transLogTable ); PerformanceLogTable getPerformanceLogTable(); void setPerformanceLogTable( PerformanceLogTable performanceLogTable ); StepLogTable getStepLogTable(); void setStepLogTable( StepLogTable stepLogTable ); List<LogTableInterface> getLogTables(); TransformationType getTransformationType(); void setTransformationType( TransformationType transformationType ); void writeXML( String filename ); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); MetricsLogTable getMetricsLogTable(); void setMetricsLogTable( MetricsLogTable metricsLogTable ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging ); void addStepChangeListener( StepMetaChangeListenerInterface listener ); void addStepChangeListener( int p, StepMetaChangeListenerInterface list ); void removeStepChangeListener( StepMetaChangeListenerInterface list ); void notifyAllListeners( StepMeta oldMeta, StepMeta newMeta ); boolean containsStepMeta( StepMeta stepMeta ); List<MissingTrans> getMissingTrans(); void addMissingTrans( MissingTrans trans ); void removeMissingTrans( MissingTrans trans ); @Override boolean hasMissingPlugins(); @Override NamedClusterEmbedManager getNamedClusterEmbedManager( ); static final String XML_TAG; static final String STRING_TRANSMETA; static final RepositoryObjectType REPOSITORY_ELEMENT_TYPE; static final int BORDER_INDENT; static final String[] desc_type_undo; static final String XML_TAG_ORDER; static final String XML_TAG_NOTEPADS; static final String XML_TAG_PARAMETERS; static final String XML_TAG_PARTITIONSCHEMAS; static final String XML_TAG_SLAVESERVERS; static final String XML_TAG_CLUSTERSCHEMAS; static final String XML_TAG_STEP_ERROR_HANDLING; }
@Test public void testCloneWithParam() throws Exception { TransMeta transMeta = new TransMeta( "transFile", "myTrans" ); transMeta.addParameterDefinition( "key", "defValue", "description" ); Object clone = transMeta.realClone( true ); assertNotNull( clone ); }
public Object realClone( boolean doClear ) { try { TransMeta transMeta = (TransMeta) super.clone(); if ( doClear ) { transMeta.clear(); } else { transMeta.databases = new ArrayList<>(); transMeta.steps = new ArrayList<>(); transMeta.hops = new ArrayList<>(); transMeta.notes = new ArrayList<>(); transMeta.dependencies = new ArrayList<>(); transMeta.partitionSchemas = new ArrayList<>(); transMeta.slaveServers = new ArrayList<>(); transMeta.clusterSchemas = new ArrayList<>(); transMeta.namedParams = new NamedParamsDefault(); transMeta.stepChangeListeners = new ArrayList<>(); } for ( DatabaseMeta db : databases ) { transMeta.addDatabase( (DatabaseMeta) db.clone() ); } for ( StepMeta step : steps ) { transMeta.addStep( (StepMeta) step.clone() ); } for ( StepMeta step : transMeta.getSteps() ) { final StepMetaInterface stepMetaInterface = step.getStepMetaInterface(); if ( stepMetaInterface != null ) { final StepIOMetaInterface stepIOMeta = stepMetaInterface.getStepIOMeta(); if ( stepIOMeta != null ) { for ( StreamInterface stream : stepIOMeta.getInfoStreams() ) { String streamStepName = stream.getStepname(); if ( streamStepName != null ) { StepMeta streamStepMeta = transMeta.findStep( streamStepName ); stream.setStepMeta( streamStepMeta ); } } } } } for ( TransHopMeta hop : hops ) { transMeta.addTransHop( (TransHopMeta) hop.clone() ); } for ( NotePadMeta note : notes ) { transMeta.addNote( (NotePadMeta) note.clone() ); } for ( TransDependency dep : dependencies ) { transMeta.addDependency( (TransDependency) dep.clone() ); } for ( SlaveServer slave : slaveServers ) { transMeta.getSlaveServers().add( (SlaveServer) slave.clone() ); } for ( ClusterSchema schema : clusterSchemas ) { transMeta.getClusterSchemas().add( schema.clone() ); } for ( PartitionSchema schema : partitionSchemas ) { transMeta.getPartitionSchemas().add( (PartitionSchema) schema.clone() ); } for ( String key : listParameters() ) { transMeta.addParameterDefinition( key, getParameterDefault( key ), getParameterDescription( key ) ); } return transMeta; } catch ( Exception e ) { e.printStackTrace(); return null; } }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public Object realClone( boolean doClear ) { try { TransMeta transMeta = (TransMeta) super.clone(); if ( doClear ) { transMeta.clear(); } else { transMeta.databases = new ArrayList<>(); transMeta.steps = new ArrayList<>(); transMeta.hops = new ArrayList<>(); transMeta.notes = new ArrayList<>(); transMeta.dependencies = new ArrayList<>(); transMeta.partitionSchemas = new ArrayList<>(); transMeta.slaveServers = new ArrayList<>(); transMeta.clusterSchemas = new ArrayList<>(); transMeta.namedParams = new NamedParamsDefault(); transMeta.stepChangeListeners = new ArrayList<>(); } for ( DatabaseMeta db : databases ) { transMeta.addDatabase( (DatabaseMeta) db.clone() ); } for ( StepMeta step : steps ) { transMeta.addStep( (StepMeta) step.clone() ); } for ( StepMeta step : transMeta.getSteps() ) { final StepMetaInterface stepMetaInterface = step.getStepMetaInterface(); if ( stepMetaInterface != null ) { final StepIOMetaInterface stepIOMeta = stepMetaInterface.getStepIOMeta(); if ( stepIOMeta != null ) { for ( StreamInterface stream : stepIOMeta.getInfoStreams() ) { String streamStepName = stream.getStepname(); if ( streamStepName != null ) { StepMeta streamStepMeta = transMeta.findStep( streamStepName ); stream.setStepMeta( streamStepMeta ); } } } } } for ( TransHopMeta hop : hops ) { transMeta.addTransHop( (TransHopMeta) hop.clone() ); } for ( NotePadMeta note : notes ) { transMeta.addNote( (NotePadMeta) note.clone() ); } for ( TransDependency dep : dependencies ) { transMeta.addDependency( (TransDependency) dep.clone() ); } for ( SlaveServer slave : slaveServers ) { transMeta.getSlaveServers().add( (SlaveServer) slave.clone() ); } for ( ClusterSchema schema : clusterSchemas ) { transMeta.getClusterSchemas().add( schema.clone() ); } for ( PartitionSchema schema : partitionSchemas ) { transMeta.getPartitionSchemas().add( (PartitionSchema) schema.clone() ); } for ( String key : listParameters() ) { transMeta.addParameterDefinition( key, getParameterDefault( key ), getParameterDescription( key ) ); } return transMeta; } catch ( Exception e ) { e.printStackTrace(); return null; } } }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public Object realClone( boolean doClear ) { try { TransMeta transMeta = (TransMeta) super.clone(); if ( doClear ) { transMeta.clear(); } else { transMeta.databases = new ArrayList<>(); transMeta.steps = new ArrayList<>(); transMeta.hops = new ArrayList<>(); transMeta.notes = new ArrayList<>(); transMeta.dependencies = new ArrayList<>(); transMeta.partitionSchemas = new ArrayList<>(); transMeta.slaveServers = new ArrayList<>(); transMeta.clusterSchemas = new ArrayList<>(); transMeta.namedParams = new NamedParamsDefault(); transMeta.stepChangeListeners = new ArrayList<>(); } for ( DatabaseMeta db : databases ) { transMeta.addDatabase( (DatabaseMeta) db.clone() ); } for ( StepMeta step : steps ) { transMeta.addStep( (StepMeta) step.clone() ); } for ( StepMeta step : transMeta.getSteps() ) { final StepMetaInterface stepMetaInterface = step.getStepMetaInterface(); if ( stepMetaInterface != null ) { final StepIOMetaInterface stepIOMeta = stepMetaInterface.getStepIOMeta(); if ( stepIOMeta != null ) { for ( StreamInterface stream : stepIOMeta.getInfoStreams() ) { String streamStepName = stream.getStepname(); if ( streamStepName != null ) { StepMeta streamStepMeta = transMeta.findStep( streamStepName ); stream.setStepMeta( streamStepMeta ); } } } } } for ( TransHopMeta hop : hops ) { transMeta.addTransHop( (TransHopMeta) hop.clone() ); } for ( NotePadMeta note : notes ) { transMeta.addNote( (NotePadMeta) note.clone() ); } for ( TransDependency dep : dependencies ) { transMeta.addDependency( (TransDependency) dep.clone() ); } for ( SlaveServer slave : slaveServers ) { transMeta.getSlaveServers().add( (SlaveServer) slave.clone() ); } for ( ClusterSchema schema : clusterSchemas ) { transMeta.getClusterSchemas().add( schema.clone() ); } for ( PartitionSchema schema : partitionSchemas ) { transMeta.getPartitionSchemas().add( (PartitionSchema) schema.clone() ); } for ( String key : listParameters() ) { transMeta.addParameterDefinition( key, getParameterDefault( key ), getParameterDescription( key ) ); } return transMeta; } catch ( Exception e ) { e.printStackTrace(); return null; } } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public Object realClone( boolean doClear ) { try { TransMeta transMeta = (TransMeta) super.clone(); if ( doClear ) { transMeta.clear(); } else { transMeta.databases = new ArrayList<>(); transMeta.steps = new ArrayList<>(); transMeta.hops = new ArrayList<>(); transMeta.notes = new ArrayList<>(); transMeta.dependencies = new ArrayList<>(); transMeta.partitionSchemas = new ArrayList<>(); transMeta.slaveServers = new ArrayList<>(); transMeta.clusterSchemas = new ArrayList<>(); transMeta.namedParams = new NamedParamsDefault(); transMeta.stepChangeListeners = new ArrayList<>(); } for ( DatabaseMeta db : databases ) { transMeta.addDatabase( (DatabaseMeta) db.clone() ); } for ( StepMeta step : steps ) { transMeta.addStep( (StepMeta) step.clone() ); } for ( StepMeta step : transMeta.getSteps() ) { final StepMetaInterface stepMetaInterface = step.getStepMetaInterface(); if ( stepMetaInterface != null ) { final StepIOMetaInterface stepIOMeta = stepMetaInterface.getStepIOMeta(); if ( stepIOMeta != null ) { for ( StreamInterface stream : stepIOMeta.getInfoStreams() ) { String streamStepName = stream.getStepname(); if ( streamStepName != null ) { StepMeta streamStepMeta = transMeta.findStep( streamStepName ); stream.setStepMeta( streamStepMeta ); } } } } } for ( TransHopMeta hop : hops ) { transMeta.addTransHop( (TransHopMeta) hop.clone() ); } for ( NotePadMeta note : notes ) { transMeta.addNote( (NotePadMeta) note.clone() ); } for ( TransDependency dep : dependencies ) { transMeta.addDependency( (TransDependency) dep.clone() ); } for ( SlaveServer slave : slaveServers ) { transMeta.getSlaveServers().add( (SlaveServer) slave.clone() ); } for ( ClusterSchema schema : clusterSchemas ) { transMeta.getClusterSchemas().add( schema.clone() ); } for ( PartitionSchema schema : partitionSchemas ) { transMeta.getPartitionSchemas().add( (PartitionSchema) schema.clone() ); } for ( String key : listParameters() ) { transMeta.addParameterDefinition( key, getParameterDefault( key ), getParameterDescription( key ) ); } return transMeta; } catch ( Exception e ) { e.printStackTrace(); return null; } } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); @Override int compare( TransMeta t1, TransMeta t2 ); @Override int compareTo( TransMeta o ); @Override boolean equals( Object obj ); @Override Object clone(); Object realClone( boolean doClear ); @Override void clear(); void addStep( StepMeta stepMeta ); void addOrReplaceStep( StepMeta stepMeta ); void addTransHop( TransHopMeta hi ); void addDependency( TransDependency td ); void addStep( int p, StepMeta stepMeta ); void addTransHop( int p, TransHopMeta hi ); void addDependency( int p, TransDependency td ); List<StepMeta> getSteps(); StepMeta getStep( int i ); TransHopMeta getTransHop( int i ); TransDependency getDependency( int i ); void removeStep( int i ); void removeTransHop( int i ); void removeTransHop( TransHopMeta hop ); void removeDependency( int i ); void removeAllDependencies(); int nrSteps(); int nrTransHops(); int nrDependencies(); int nrStepChangeListeners(); void setStep( int i, StepMeta stepMeta ); void setTransHop( int i, TransHopMeta hi ); List<StepMeta> getUsedSteps(); StepMeta findStep( String name ); StepMeta findStep( String name, StepMeta exclude ); TransHopMeta findTransHop( String name ); TransHopMeta findTransHopFrom( StepMeta fromstep ); List<TransHopMeta> findAllTransHopFrom( StepMeta fromstep ); TransHopMeta findTransHop( TransHopMeta hi ); TransHopMeta findTransHop( StepMeta from, StepMeta to ); TransHopMeta findTransHop( StepMeta from, StepMeta to, boolean disabledToo ); TransHopMeta findTransHopTo( StepMeta tostep ); boolean isStepInformative( StepMeta this_step, StepMeta prev_step ); @Deprecated int findNrPrevSteps( String stepname ); @Deprecated int findNrPrevSteps( String stepname, boolean info ); int findNrPrevSteps( StepMeta stepMeta ); @Deprecated StepMeta findPrevStep( String stepname, int nr ); @Deprecated StepMeta findPrevStep( String stepname, int nr, boolean info ); StepMeta findPrevStep( StepMeta stepMeta, int nr ); @Deprecated int findNrPrevSteps( StepMeta stepMeta, boolean info ); @Deprecated StepMeta findPrevStep( StepMeta stepMeta, int nr, boolean info ); List<StepMeta> findPreviousSteps( StepMeta stepMeta ); List<StepMeta> findPreviousSteps( StepMeta stepMeta, boolean info ); StepMeta[] getInfoStep( StepMeta stepMeta ); int findNrInfoSteps( StepMeta stepMeta ); RowMetaInterface getPrevInfoFields( String stepname ); RowMetaInterface getPrevInfoFields( StepMeta stepMeta ); @Deprecated int findNrNextSteps( StepMeta stepMeta ); @Deprecated StepMeta findNextStep( StepMeta stepMeta, int nr ); StepMeta[] getPrevSteps( StepMeta stepMeta ); String[] getPrevStepNames( String stepname ); String[] getPrevStepNames( StepMeta stepMeta ); @Deprecated StepMeta[] getNextSteps( StepMeta stepMeta ); List<StepMeta> findNextSteps( StepMeta stepMeta ); String[] getNextStepNames( StepMeta stepMeta ); StepMeta getStep( int x, int y, int iconsize ); boolean partOfTransHop( StepMeta stepMeta ); RowMetaInterface getStepFields( String stepname ); RowMetaInterface getStepFields( StepMeta stepMeta ); RowMetaInterface getStepFields( StepMeta[] stepMeta ); RowMetaInterface getStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getStepFields( StepMeta stepMeta, StepMeta targetStep, ProgressMonitorListener monitor ); RowMetaInterface getPrevStepFields( String stepname ); RowMetaInterface getPrevStepFields( StepMeta stepMeta ); RowMetaInterface getPrevStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getThisStepFields( String stepname, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row, ProgressMonitorListener monitor ); boolean isUsingPartitionSchema( PartitionSchema partitionSchema ); boolean isUsingAClusterSchema(); boolean isUsingClusterSchema( ClusterSchema clusterSchema ); boolean isUsingSlaveServer( SlaveServer slaveServer ); boolean isRepReference(); boolean isFileReference(); static boolean isRepReference( String exactFilename, String exactTransname ); static boolean isFileReference( String exactFilename, String exactTransname ); int indexOfTransHop( TransHopMeta hi ); int indexOfStep( StepMeta stepMeta ); @Override String getFileType(); @Override String[] getFilterNames(); @Override String[] getFilterExtensions(); @Override String getDefaultExtension(); @Override String getXML(); String getXML( boolean includeSteps, boolean includeDatabase, boolean includeSlaves, boolean includeClusters, boolean includePartitions ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); byte[] getKey(); void setKey( byte[] key ); boolean isPrivateKey(); void setPrivateKey( boolean privateKey ); @Override boolean loadSharedObject( SharedObjectInterface object ); List<StepMeta> getTransHopSteps( boolean all ); boolean isStepUsedInTransHops( StepMeta stepMeta ); boolean isAnySelectedStepUsedInTransHops(); @Override void clearChanged(); boolean haveStepsChanged(); boolean haveHopsChanged(); boolean havePartitionSchemasChanged(); boolean haveClusterSchemasChanged(); @Override boolean hasChanged(); boolean hasLoop( StepMeta stepMeta ); void selectAll(); void unselectAll(); Point[] getSelectedStepLocations(); Point[] getSelectedNoteLocations(); List<StepMeta> getSelectedSteps(); String[] getSelectedStepNames(); int[] getStepIndexes( List<StepMeta> steps ); Point getMaximum(); Point getMinimum(); String[] getStepNames(); StepMeta[] getStepsArray(); boolean findPrevious( StepMeta startStep, StepMeta stepToFind ); void sortSteps(); void sortHops(); Map<StepMeta, Map<StepMeta, Boolean>> sortStepsNatural(); void sortHopsNatural(); void analyseImpact( List<DatabaseImpact> impact, ProgressMonitorListener monitor ); String getAlternativeStepname( String stepname ); List<SQLStatement> getSQLStatements(); List<SQLStatement> getSQLStatements( ProgressMonitorListener monitor ); String getSQLStatementsString(); @Deprecated void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor ); void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor, VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated List<RowMetaAndData> getResultRows(); @Deprecated void setResultRows( List<RowMetaAndData> resultRows ); String getPathAndName(); @Deprecated String[] getArguments(); @Deprecated void setArguments( String[] arguments ); @Deprecated Hashtable<String, Counter> getCounters(); @Deprecated void setCounters( Hashtable<String, Counter> counters ); List<TransDependency> getDependencies(); void setDependencies( List<TransDependency> dependencies ); DatabaseMeta getMaxDateConnection(); void setMaxDateConnection( DatabaseMeta maxDateConnection ); double getMaxDateDifference(); void setMaxDateDifference( double maxDateDifference ); String getMaxDateField(); void setMaxDateField( String maxDateField ); double getMaxDateOffset(); void setMaxDateOffset( double maxDateOffset ); String getMaxDateTable(); void setMaxDateTable( String maxDateTable ); int getSizeRowset(); void setSizeRowset( int sizeRowset ); DBCache getDbCache(); void setDbCache( DBCache dbCache ); String getTransversion(); void setTransversion( String n ); void setTransstatus( int n ); int getTransstatus(); @Override String toString(); void cancelQueries(); Map<String, String> getUsedArguments( String[] arguments ); int getSleepTimeEmpty(); int getSleepTimeFull(); void setSleepTimeEmpty( int sleepTimeEmpty ); void setSleepTimeFull( int sleepTimeFull ); boolean isDatabaseConnectionUsed( DatabaseMeta databaseMeta ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes, boolean includePasswords ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes ); List<String> getUsedVariables(); @Deprecated Result getPreviousResult(); @Deprecated void setPreviousResult( Result previousResult ); @Deprecated List<ResultFile> getResultFiles(); @Deprecated void setResultFiles( List<ResultFile> resultFiles ); List<PartitionSchema> getPartitionSchemas(); void setPartitionSchemas( List<PartitionSchema> partitionSchemas ); String[] getPartitionSchemasNames(); boolean isFeedbackShown(); void setFeedbackShown( boolean feedbackShown ); int getFeedbackSize(); void setFeedbackSize( int feedbackSize ); boolean isUsingUniqueConnections(); void setUsingUniqueConnections( boolean usingUniqueConnections ); List<ClusterSchema> getClusterSchemas(); void setClusterSchemas( List<ClusterSchema> clusterSchemas ); String[] getClusterSchemaNames(); PartitionSchema findPartitionSchema( String name ); ClusterSchema findClusterSchema( String name ); void addOrReplacePartitionSchema( PartitionSchema partitionSchema ); void addOrReplaceClusterSchema( ClusterSchema clusterSchema ); boolean isUsingThreadPriorityManagment(); void setUsingThreadPriorityManagment( boolean usingThreadPriorityManagment ); void checkRowMixingStatically( StepMeta stepMeta, ProgressMonitorListener monitor ); @Override void setInternalKettleVariables( VariableSpace var ); StepMeta findMappingInputStep( String stepname ); StepMeta findMappingOutputStep( String stepname ); List<ResourceReference> getResourceDependencies(); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); SlaveStepCopyPartitionDistribution getSlaveStepCopyPartitionDistribution(); void setSlaveStepCopyPartitionDistribution( SlaveStepCopyPartitionDistribution slaveStepCopyPartitionDistribution ); ClusterSchema findFirstUsedClusterSchema(); boolean isSlaveTransformation(); void setSlaveTransformation( boolean slaveTransformation ); boolean isCapturingStepPerformanceSnapShots(); void setCapturingStepPerformanceSnapShots( boolean capturingStepPerformanceSnapShots ); long getStepPerformanceCapturingDelay(); void setStepPerformanceCapturingDelay( long stepPerformanceCapturingDelay ); String getStepPerformanceCapturingSizeLimit(); void setStepPerformanceCapturingSizeLimit( String stepPerformanceCapturingSizeLimit ); void clearCaches(); @Override RepositoryObjectType getRepositoryElementType(); LogChannelInterface getLogChannel(); @Override String getLogChannelId(); @Override LoggingObjectType getObjectType(); TransLogTable getTransLogTable(); void setTransLogTable( TransLogTable transLogTable ); PerformanceLogTable getPerformanceLogTable(); void setPerformanceLogTable( PerformanceLogTable performanceLogTable ); StepLogTable getStepLogTable(); void setStepLogTable( StepLogTable stepLogTable ); List<LogTableInterface> getLogTables(); TransformationType getTransformationType(); void setTransformationType( TransformationType transformationType ); void writeXML( String filename ); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); MetricsLogTable getMetricsLogTable(); void setMetricsLogTable( MetricsLogTable metricsLogTable ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging ); void addStepChangeListener( StepMetaChangeListenerInterface listener ); void addStepChangeListener( int p, StepMetaChangeListenerInterface list ); void removeStepChangeListener( StepMetaChangeListenerInterface list ); void notifyAllListeners( StepMeta oldMeta, StepMeta newMeta ); boolean containsStepMeta( StepMeta stepMeta ); List<MissingTrans> getMissingTrans(); void addMissingTrans( MissingTrans trans ); void removeMissingTrans( MissingTrans trans ); @Override boolean hasMissingPlugins(); @Override NamedClusterEmbedManager getNamedClusterEmbedManager( ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public Object realClone( boolean doClear ) { try { TransMeta transMeta = (TransMeta) super.clone(); if ( doClear ) { transMeta.clear(); } else { transMeta.databases = new ArrayList<>(); transMeta.steps = new ArrayList<>(); transMeta.hops = new ArrayList<>(); transMeta.notes = new ArrayList<>(); transMeta.dependencies = new ArrayList<>(); transMeta.partitionSchemas = new ArrayList<>(); transMeta.slaveServers = new ArrayList<>(); transMeta.clusterSchemas = new ArrayList<>(); transMeta.namedParams = new NamedParamsDefault(); transMeta.stepChangeListeners = new ArrayList<>(); } for ( DatabaseMeta db : databases ) { transMeta.addDatabase( (DatabaseMeta) db.clone() ); } for ( StepMeta step : steps ) { transMeta.addStep( (StepMeta) step.clone() ); } for ( StepMeta step : transMeta.getSteps() ) { final StepMetaInterface stepMetaInterface = step.getStepMetaInterface(); if ( stepMetaInterface != null ) { final StepIOMetaInterface stepIOMeta = stepMetaInterface.getStepIOMeta(); if ( stepIOMeta != null ) { for ( StreamInterface stream : stepIOMeta.getInfoStreams() ) { String streamStepName = stream.getStepname(); if ( streamStepName != null ) { StepMeta streamStepMeta = transMeta.findStep( streamStepName ); stream.setStepMeta( streamStepMeta ); } } } } } for ( TransHopMeta hop : hops ) { transMeta.addTransHop( (TransHopMeta) hop.clone() ); } for ( NotePadMeta note : notes ) { transMeta.addNote( (NotePadMeta) note.clone() ); } for ( TransDependency dep : dependencies ) { transMeta.addDependency( (TransDependency) dep.clone() ); } for ( SlaveServer slave : slaveServers ) { transMeta.getSlaveServers().add( (SlaveServer) slave.clone() ); } for ( ClusterSchema schema : clusterSchemas ) { transMeta.getClusterSchemas().add( schema.clone() ); } for ( PartitionSchema schema : partitionSchemas ) { transMeta.getPartitionSchemas().add( (PartitionSchema) schema.clone() ); } for ( String key : listParameters() ) { transMeta.addParameterDefinition( key, getParameterDefault( key ), getParameterDescription( key ) ); } return transMeta; } catch ( Exception e ) { e.printStackTrace(); return null; } } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); @Override int compare( TransMeta t1, TransMeta t2 ); @Override int compareTo( TransMeta o ); @Override boolean equals( Object obj ); @Override Object clone(); Object realClone( boolean doClear ); @Override void clear(); void addStep( StepMeta stepMeta ); void addOrReplaceStep( StepMeta stepMeta ); void addTransHop( TransHopMeta hi ); void addDependency( TransDependency td ); void addStep( int p, StepMeta stepMeta ); void addTransHop( int p, TransHopMeta hi ); void addDependency( int p, TransDependency td ); List<StepMeta> getSteps(); StepMeta getStep( int i ); TransHopMeta getTransHop( int i ); TransDependency getDependency( int i ); void removeStep( int i ); void removeTransHop( int i ); void removeTransHop( TransHopMeta hop ); void removeDependency( int i ); void removeAllDependencies(); int nrSteps(); int nrTransHops(); int nrDependencies(); int nrStepChangeListeners(); void setStep( int i, StepMeta stepMeta ); void setTransHop( int i, TransHopMeta hi ); List<StepMeta> getUsedSteps(); StepMeta findStep( String name ); StepMeta findStep( String name, StepMeta exclude ); TransHopMeta findTransHop( String name ); TransHopMeta findTransHopFrom( StepMeta fromstep ); List<TransHopMeta> findAllTransHopFrom( StepMeta fromstep ); TransHopMeta findTransHop( TransHopMeta hi ); TransHopMeta findTransHop( StepMeta from, StepMeta to ); TransHopMeta findTransHop( StepMeta from, StepMeta to, boolean disabledToo ); TransHopMeta findTransHopTo( StepMeta tostep ); boolean isStepInformative( StepMeta this_step, StepMeta prev_step ); @Deprecated int findNrPrevSteps( String stepname ); @Deprecated int findNrPrevSteps( String stepname, boolean info ); int findNrPrevSteps( StepMeta stepMeta ); @Deprecated StepMeta findPrevStep( String stepname, int nr ); @Deprecated StepMeta findPrevStep( String stepname, int nr, boolean info ); StepMeta findPrevStep( StepMeta stepMeta, int nr ); @Deprecated int findNrPrevSteps( StepMeta stepMeta, boolean info ); @Deprecated StepMeta findPrevStep( StepMeta stepMeta, int nr, boolean info ); List<StepMeta> findPreviousSteps( StepMeta stepMeta ); List<StepMeta> findPreviousSteps( StepMeta stepMeta, boolean info ); StepMeta[] getInfoStep( StepMeta stepMeta ); int findNrInfoSteps( StepMeta stepMeta ); RowMetaInterface getPrevInfoFields( String stepname ); RowMetaInterface getPrevInfoFields( StepMeta stepMeta ); @Deprecated int findNrNextSteps( StepMeta stepMeta ); @Deprecated StepMeta findNextStep( StepMeta stepMeta, int nr ); StepMeta[] getPrevSteps( StepMeta stepMeta ); String[] getPrevStepNames( String stepname ); String[] getPrevStepNames( StepMeta stepMeta ); @Deprecated StepMeta[] getNextSteps( StepMeta stepMeta ); List<StepMeta> findNextSteps( StepMeta stepMeta ); String[] getNextStepNames( StepMeta stepMeta ); StepMeta getStep( int x, int y, int iconsize ); boolean partOfTransHop( StepMeta stepMeta ); RowMetaInterface getStepFields( String stepname ); RowMetaInterface getStepFields( StepMeta stepMeta ); RowMetaInterface getStepFields( StepMeta[] stepMeta ); RowMetaInterface getStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getStepFields( StepMeta stepMeta, StepMeta targetStep, ProgressMonitorListener monitor ); RowMetaInterface getPrevStepFields( String stepname ); RowMetaInterface getPrevStepFields( StepMeta stepMeta ); RowMetaInterface getPrevStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getThisStepFields( String stepname, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row, ProgressMonitorListener monitor ); boolean isUsingPartitionSchema( PartitionSchema partitionSchema ); boolean isUsingAClusterSchema(); boolean isUsingClusterSchema( ClusterSchema clusterSchema ); boolean isUsingSlaveServer( SlaveServer slaveServer ); boolean isRepReference(); boolean isFileReference(); static boolean isRepReference( String exactFilename, String exactTransname ); static boolean isFileReference( String exactFilename, String exactTransname ); int indexOfTransHop( TransHopMeta hi ); int indexOfStep( StepMeta stepMeta ); @Override String getFileType(); @Override String[] getFilterNames(); @Override String[] getFilterExtensions(); @Override String getDefaultExtension(); @Override String getXML(); String getXML( boolean includeSteps, boolean includeDatabase, boolean includeSlaves, boolean includeClusters, boolean includePartitions ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); byte[] getKey(); void setKey( byte[] key ); boolean isPrivateKey(); void setPrivateKey( boolean privateKey ); @Override boolean loadSharedObject( SharedObjectInterface object ); List<StepMeta> getTransHopSteps( boolean all ); boolean isStepUsedInTransHops( StepMeta stepMeta ); boolean isAnySelectedStepUsedInTransHops(); @Override void clearChanged(); boolean haveStepsChanged(); boolean haveHopsChanged(); boolean havePartitionSchemasChanged(); boolean haveClusterSchemasChanged(); @Override boolean hasChanged(); boolean hasLoop( StepMeta stepMeta ); void selectAll(); void unselectAll(); Point[] getSelectedStepLocations(); Point[] getSelectedNoteLocations(); List<StepMeta> getSelectedSteps(); String[] getSelectedStepNames(); int[] getStepIndexes( List<StepMeta> steps ); Point getMaximum(); Point getMinimum(); String[] getStepNames(); StepMeta[] getStepsArray(); boolean findPrevious( StepMeta startStep, StepMeta stepToFind ); void sortSteps(); void sortHops(); Map<StepMeta, Map<StepMeta, Boolean>> sortStepsNatural(); void sortHopsNatural(); void analyseImpact( List<DatabaseImpact> impact, ProgressMonitorListener monitor ); String getAlternativeStepname( String stepname ); List<SQLStatement> getSQLStatements(); List<SQLStatement> getSQLStatements( ProgressMonitorListener monitor ); String getSQLStatementsString(); @Deprecated void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor ); void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor, VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated List<RowMetaAndData> getResultRows(); @Deprecated void setResultRows( List<RowMetaAndData> resultRows ); String getPathAndName(); @Deprecated String[] getArguments(); @Deprecated void setArguments( String[] arguments ); @Deprecated Hashtable<String, Counter> getCounters(); @Deprecated void setCounters( Hashtable<String, Counter> counters ); List<TransDependency> getDependencies(); void setDependencies( List<TransDependency> dependencies ); DatabaseMeta getMaxDateConnection(); void setMaxDateConnection( DatabaseMeta maxDateConnection ); double getMaxDateDifference(); void setMaxDateDifference( double maxDateDifference ); String getMaxDateField(); void setMaxDateField( String maxDateField ); double getMaxDateOffset(); void setMaxDateOffset( double maxDateOffset ); String getMaxDateTable(); void setMaxDateTable( String maxDateTable ); int getSizeRowset(); void setSizeRowset( int sizeRowset ); DBCache getDbCache(); void setDbCache( DBCache dbCache ); String getTransversion(); void setTransversion( String n ); void setTransstatus( int n ); int getTransstatus(); @Override String toString(); void cancelQueries(); Map<String, String> getUsedArguments( String[] arguments ); int getSleepTimeEmpty(); int getSleepTimeFull(); void setSleepTimeEmpty( int sleepTimeEmpty ); void setSleepTimeFull( int sleepTimeFull ); boolean isDatabaseConnectionUsed( DatabaseMeta databaseMeta ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes, boolean includePasswords ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes ); List<String> getUsedVariables(); @Deprecated Result getPreviousResult(); @Deprecated void setPreviousResult( Result previousResult ); @Deprecated List<ResultFile> getResultFiles(); @Deprecated void setResultFiles( List<ResultFile> resultFiles ); List<PartitionSchema> getPartitionSchemas(); void setPartitionSchemas( List<PartitionSchema> partitionSchemas ); String[] getPartitionSchemasNames(); boolean isFeedbackShown(); void setFeedbackShown( boolean feedbackShown ); int getFeedbackSize(); void setFeedbackSize( int feedbackSize ); boolean isUsingUniqueConnections(); void setUsingUniqueConnections( boolean usingUniqueConnections ); List<ClusterSchema> getClusterSchemas(); void setClusterSchemas( List<ClusterSchema> clusterSchemas ); String[] getClusterSchemaNames(); PartitionSchema findPartitionSchema( String name ); ClusterSchema findClusterSchema( String name ); void addOrReplacePartitionSchema( PartitionSchema partitionSchema ); void addOrReplaceClusterSchema( ClusterSchema clusterSchema ); boolean isUsingThreadPriorityManagment(); void setUsingThreadPriorityManagment( boolean usingThreadPriorityManagment ); void checkRowMixingStatically( StepMeta stepMeta, ProgressMonitorListener monitor ); @Override void setInternalKettleVariables( VariableSpace var ); StepMeta findMappingInputStep( String stepname ); StepMeta findMappingOutputStep( String stepname ); List<ResourceReference> getResourceDependencies(); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); SlaveStepCopyPartitionDistribution getSlaveStepCopyPartitionDistribution(); void setSlaveStepCopyPartitionDistribution( SlaveStepCopyPartitionDistribution slaveStepCopyPartitionDistribution ); ClusterSchema findFirstUsedClusterSchema(); boolean isSlaveTransformation(); void setSlaveTransformation( boolean slaveTransformation ); boolean isCapturingStepPerformanceSnapShots(); void setCapturingStepPerformanceSnapShots( boolean capturingStepPerformanceSnapShots ); long getStepPerformanceCapturingDelay(); void setStepPerformanceCapturingDelay( long stepPerformanceCapturingDelay ); String getStepPerformanceCapturingSizeLimit(); void setStepPerformanceCapturingSizeLimit( String stepPerformanceCapturingSizeLimit ); void clearCaches(); @Override RepositoryObjectType getRepositoryElementType(); LogChannelInterface getLogChannel(); @Override String getLogChannelId(); @Override LoggingObjectType getObjectType(); TransLogTable getTransLogTable(); void setTransLogTable( TransLogTable transLogTable ); PerformanceLogTable getPerformanceLogTable(); void setPerformanceLogTable( PerformanceLogTable performanceLogTable ); StepLogTable getStepLogTable(); void setStepLogTable( StepLogTable stepLogTable ); List<LogTableInterface> getLogTables(); TransformationType getTransformationType(); void setTransformationType( TransformationType transformationType ); void writeXML( String filename ); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); MetricsLogTable getMetricsLogTable(); void setMetricsLogTable( MetricsLogTable metricsLogTable ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging ); void addStepChangeListener( StepMetaChangeListenerInterface listener ); void addStepChangeListener( int p, StepMetaChangeListenerInterface list ); void removeStepChangeListener( StepMetaChangeListenerInterface list ); void notifyAllListeners( StepMeta oldMeta, StepMeta newMeta ); boolean containsStepMeta( StepMeta stepMeta ); List<MissingTrans> getMissingTrans(); void addMissingTrans( MissingTrans trans ); void removeMissingTrans( MissingTrans trans ); @Override boolean hasMissingPlugins(); @Override NamedClusterEmbedManager getNamedClusterEmbedManager( ); static final String XML_TAG; static final String STRING_TRANSMETA; static final RepositoryObjectType REPOSITORY_ELEMENT_TYPE; static final int BORDER_INDENT; static final String[] desc_type_undo; static final String XML_TAG_ORDER; static final String XML_TAG_NOTEPADS; static final String XML_TAG_PARAMETERS; static final String XML_TAG_PARTITIONSCHEMAS; static final String XML_TAG_SLAVESERVERS; static final String XML_TAG_CLUSTERSCHEMAS; static final String XML_TAG_STEP_ERROR_HANDLING; }
@Test public void testLoadXml() throws KettleException { String directory = "/home/admin"; Node jobNode = Mockito.mock( Node.class ); NodeList nodeList = new NodeList() { ArrayList<Node> nodes = new ArrayList<>( ); { Node nodeInfo = Mockito.mock( Node.class ); Mockito.when( nodeInfo.getNodeName() ).thenReturn( TransMeta.XML_TAG_INFO ); Mockito.when( nodeInfo.getChildNodes() ).thenReturn( this ); Node nodeDirectory = Mockito.mock( Node.class ); Mockito.when( nodeDirectory.getNodeName() ).thenReturn( "directory" ); Node child = Mockito.mock( Node.class ); Mockito.when( nodeDirectory.getFirstChild() ).thenReturn( child ); Mockito.when( child.getNodeValue() ).thenReturn( directory ); nodes.add( nodeDirectory ); nodes.add( nodeInfo ); } @Override public Node item( int index ) { return nodes.get( index ); } @Override public int getLength() { return nodes.size(); } }; Mockito.when( jobNode.getChildNodes() ).thenReturn( nodeList ); Repository rep = Mockito.mock( Repository.class ); RepositoryDirectory repDirectory = new RepositoryDirectory( new RepositoryDirectory( new RepositoryDirectory(), "home" ), "admin" ); Mockito.when( rep.findDirectory( Mockito.eq( directory ) ) ).thenReturn( repDirectory ); TransMeta meta = new TransMeta(); VariableSpace variableSpace = Mockito.mock( VariableSpace.class ); Mockito.when( variableSpace.listVariables() ).thenReturn( new String[0] ); meta.loadXML( jobNode, null, Mockito.mock( IMetaStore.class ), rep, false, variableSpace, Mockito.mock( OverwritePrompter.class ) ); meta.setInternalKettleVariables( null ); Assert.assertEquals( repDirectory.getPath(), meta.getVariable( Const.INTERNAL_VARIABLE_TRANSFORMATION_REPOSITORY_DIRECTORY ) ); }
public void loadXML( Node transnode, Repository rep, boolean setInternalVariables ) throws KettleXMLException, KettleMissingPluginsException { loadXML( transnode, rep, setInternalVariables, null ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public void loadXML( Node transnode, Repository rep, boolean setInternalVariables ) throws KettleXMLException, KettleMissingPluginsException { loadXML( transnode, rep, setInternalVariables, null ); } }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public void loadXML( Node transnode, Repository rep, boolean setInternalVariables ) throws KettleXMLException, KettleMissingPluginsException { loadXML( transnode, rep, setInternalVariables, null ); } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public void loadXML( Node transnode, Repository rep, boolean setInternalVariables ) throws KettleXMLException, KettleMissingPluginsException { loadXML( transnode, rep, setInternalVariables, null ); } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); @Override int compare( TransMeta t1, TransMeta t2 ); @Override int compareTo( TransMeta o ); @Override boolean equals( Object obj ); @Override Object clone(); Object realClone( boolean doClear ); @Override void clear(); void addStep( StepMeta stepMeta ); void addOrReplaceStep( StepMeta stepMeta ); void addTransHop( TransHopMeta hi ); void addDependency( TransDependency td ); void addStep( int p, StepMeta stepMeta ); void addTransHop( int p, TransHopMeta hi ); void addDependency( int p, TransDependency td ); List<StepMeta> getSteps(); StepMeta getStep( int i ); TransHopMeta getTransHop( int i ); TransDependency getDependency( int i ); void removeStep( int i ); void removeTransHop( int i ); void removeTransHop( TransHopMeta hop ); void removeDependency( int i ); void removeAllDependencies(); int nrSteps(); int nrTransHops(); int nrDependencies(); int nrStepChangeListeners(); void setStep( int i, StepMeta stepMeta ); void setTransHop( int i, TransHopMeta hi ); List<StepMeta> getUsedSteps(); StepMeta findStep( String name ); StepMeta findStep( String name, StepMeta exclude ); TransHopMeta findTransHop( String name ); TransHopMeta findTransHopFrom( StepMeta fromstep ); List<TransHopMeta> findAllTransHopFrom( StepMeta fromstep ); TransHopMeta findTransHop( TransHopMeta hi ); TransHopMeta findTransHop( StepMeta from, StepMeta to ); TransHopMeta findTransHop( StepMeta from, StepMeta to, boolean disabledToo ); TransHopMeta findTransHopTo( StepMeta tostep ); boolean isStepInformative( StepMeta this_step, StepMeta prev_step ); @Deprecated int findNrPrevSteps( String stepname ); @Deprecated int findNrPrevSteps( String stepname, boolean info ); int findNrPrevSteps( StepMeta stepMeta ); @Deprecated StepMeta findPrevStep( String stepname, int nr ); @Deprecated StepMeta findPrevStep( String stepname, int nr, boolean info ); StepMeta findPrevStep( StepMeta stepMeta, int nr ); @Deprecated int findNrPrevSteps( StepMeta stepMeta, boolean info ); @Deprecated StepMeta findPrevStep( StepMeta stepMeta, int nr, boolean info ); List<StepMeta> findPreviousSteps( StepMeta stepMeta ); List<StepMeta> findPreviousSteps( StepMeta stepMeta, boolean info ); StepMeta[] getInfoStep( StepMeta stepMeta ); int findNrInfoSteps( StepMeta stepMeta ); RowMetaInterface getPrevInfoFields( String stepname ); RowMetaInterface getPrevInfoFields( StepMeta stepMeta ); @Deprecated int findNrNextSteps( StepMeta stepMeta ); @Deprecated StepMeta findNextStep( StepMeta stepMeta, int nr ); StepMeta[] getPrevSteps( StepMeta stepMeta ); String[] getPrevStepNames( String stepname ); String[] getPrevStepNames( StepMeta stepMeta ); @Deprecated StepMeta[] getNextSteps( StepMeta stepMeta ); List<StepMeta> findNextSteps( StepMeta stepMeta ); String[] getNextStepNames( StepMeta stepMeta ); StepMeta getStep( int x, int y, int iconsize ); boolean partOfTransHop( StepMeta stepMeta ); RowMetaInterface getStepFields( String stepname ); RowMetaInterface getStepFields( StepMeta stepMeta ); RowMetaInterface getStepFields( StepMeta[] stepMeta ); RowMetaInterface getStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getStepFields( StepMeta stepMeta, StepMeta targetStep, ProgressMonitorListener monitor ); RowMetaInterface getPrevStepFields( String stepname ); RowMetaInterface getPrevStepFields( StepMeta stepMeta ); RowMetaInterface getPrevStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getThisStepFields( String stepname, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row, ProgressMonitorListener monitor ); boolean isUsingPartitionSchema( PartitionSchema partitionSchema ); boolean isUsingAClusterSchema(); boolean isUsingClusterSchema( ClusterSchema clusterSchema ); boolean isUsingSlaveServer( SlaveServer slaveServer ); boolean isRepReference(); boolean isFileReference(); static boolean isRepReference( String exactFilename, String exactTransname ); static boolean isFileReference( String exactFilename, String exactTransname ); int indexOfTransHop( TransHopMeta hi ); int indexOfStep( StepMeta stepMeta ); @Override String getFileType(); @Override String[] getFilterNames(); @Override String[] getFilterExtensions(); @Override String getDefaultExtension(); @Override String getXML(); String getXML( boolean includeSteps, boolean includeDatabase, boolean includeSlaves, boolean includeClusters, boolean includePartitions ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); byte[] getKey(); void setKey( byte[] key ); boolean isPrivateKey(); void setPrivateKey( boolean privateKey ); @Override boolean loadSharedObject( SharedObjectInterface object ); List<StepMeta> getTransHopSteps( boolean all ); boolean isStepUsedInTransHops( StepMeta stepMeta ); boolean isAnySelectedStepUsedInTransHops(); @Override void clearChanged(); boolean haveStepsChanged(); boolean haveHopsChanged(); boolean havePartitionSchemasChanged(); boolean haveClusterSchemasChanged(); @Override boolean hasChanged(); boolean hasLoop( StepMeta stepMeta ); void selectAll(); void unselectAll(); Point[] getSelectedStepLocations(); Point[] getSelectedNoteLocations(); List<StepMeta> getSelectedSteps(); String[] getSelectedStepNames(); int[] getStepIndexes( List<StepMeta> steps ); Point getMaximum(); Point getMinimum(); String[] getStepNames(); StepMeta[] getStepsArray(); boolean findPrevious( StepMeta startStep, StepMeta stepToFind ); void sortSteps(); void sortHops(); Map<StepMeta, Map<StepMeta, Boolean>> sortStepsNatural(); void sortHopsNatural(); void analyseImpact( List<DatabaseImpact> impact, ProgressMonitorListener monitor ); String getAlternativeStepname( String stepname ); List<SQLStatement> getSQLStatements(); List<SQLStatement> getSQLStatements( ProgressMonitorListener monitor ); String getSQLStatementsString(); @Deprecated void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor ); void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor, VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated List<RowMetaAndData> getResultRows(); @Deprecated void setResultRows( List<RowMetaAndData> resultRows ); String getPathAndName(); @Deprecated String[] getArguments(); @Deprecated void setArguments( String[] arguments ); @Deprecated Hashtable<String, Counter> getCounters(); @Deprecated void setCounters( Hashtable<String, Counter> counters ); List<TransDependency> getDependencies(); void setDependencies( List<TransDependency> dependencies ); DatabaseMeta getMaxDateConnection(); void setMaxDateConnection( DatabaseMeta maxDateConnection ); double getMaxDateDifference(); void setMaxDateDifference( double maxDateDifference ); String getMaxDateField(); void setMaxDateField( String maxDateField ); double getMaxDateOffset(); void setMaxDateOffset( double maxDateOffset ); String getMaxDateTable(); void setMaxDateTable( String maxDateTable ); int getSizeRowset(); void setSizeRowset( int sizeRowset ); DBCache getDbCache(); void setDbCache( DBCache dbCache ); String getTransversion(); void setTransversion( String n ); void setTransstatus( int n ); int getTransstatus(); @Override String toString(); void cancelQueries(); Map<String, String> getUsedArguments( String[] arguments ); int getSleepTimeEmpty(); int getSleepTimeFull(); void setSleepTimeEmpty( int sleepTimeEmpty ); void setSleepTimeFull( int sleepTimeFull ); boolean isDatabaseConnectionUsed( DatabaseMeta databaseMeta ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes, boolean includePasswords ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes ); List<String> getUsedVariables(); @Deprecated Result getPreviousResult(); @Deprecated void setPreviousResult( Result previousResult ); @Deprecated List<ResultFile> getResultFiles(); @Deprecated void setResultFiles( List<ResultFile> resultFiles ); List<PartitionSchema> getPartitionSchemas(); void setPartitionSchemas( List<PartitionSchema> partitionSchemas ); String[] getPartitionSchemasNames(); boolean isFeedbackShown(); void setFeedbackShown( boolean feedbackShown ); int getFeedbackSize(); void setFeedbackSize( int feedbackSize ); boolean isUsingUniqueConnections(); void setUsingUniqueConnections( boolean usingUniqueConnections ); List<ClusterSchema> getClusterSchemas(); void setClusterSchemas( List<ClusterSchema> clusterSchemas ); String[] getClusterSchemaNames(); PartitionSchema findPartitionSchema( String name ); ClusterSchema findClusterSchema( String name ); void addOrReplacePartitionSchema( PartitionSchema partitionSchema ); void addOrReplaceClusterSchema( ClusterSchema clusterSchema ); boolean isUsingThreadPriorityManagment(); void setUsingThreadPriorityManagment( boolean usingThreadPriorityManagment ); void checkRowMixingStatically( StepMeta stepMeta, ProgressMonitorListener monitor ); @Override void setInternalKettleVariables( VariableSpace var ); StepMeta findMappingInputStep( String stepname ); StepMeta findMappingOutputStep( String stepname ); List<ResourceReference> getResourceDependencies(); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); SlaveStepCopyPartitionDistribution getSlaveStepCopyPartitionDistribution(); void setSlaveStepCopyPartitionDistribution( SlaveStepCopyPartitionDistribution slaveStepCopyPartitionDistribution ); ClusterSchema findFirstUsedClusterSchema(); boolean isSlaveTransformation(); void setSlaveTransformation( boolean slaveTransformation ); boolean isCapturingStepPerformanceSnapShots(); void setCapturingStepPerformanceSnapShots( boolean capturingStepPerformanceSnapShots ); long getStepPerformanceCapturingDelay(); void setStepPerformanceCapturingDelay( long stepPerformanceCapturingDelay ); String getStepPerformanceCapturingSizeLimit(); void setStepPerformanceCapturingSizeLimit( String stepPerformanceCapturingSizeLimit ); void clearCaches(); @Override RepositoryObjectType getRepositoryElementType(); LogChannelInterface getLogChannel(); @Override String getLogChannelId(); @Override LoggingObjectType getObjectType(); TransLogTable getTransLogTable(); void setTransLogTable( TransLogTable transLogTable ); PerformanceLogTable getPerformanceLogTable(); void setPerformanceLogTable( PerformanceLogTable performanceLogTable ); StepLogTable getStepLogTable(); void setStepLogTable( StepLogTable stepLogTable ); List<LogTableInterface> getLogTables(); TransformationType getTransformationType(); void setTransformationType( TransformationType transformationType ); void writeXML( String filename ); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); MetricsLogTable getMetricsLogTable(); void setMetricsLogTable( MetricsLogTable metricsLogTable ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging ); void addStepChangeListener( StepMetaChangeListenerInterface listener ); void addStepChangeListener( int p, StepMetaChangeListenerInterface list ); void removeStepChangeListener( StepMetaChangeListenerInterface list ); void notifyAllListeners( StepMeta oldMeta, StepMeta newMeta ); boolean containsStepMeta( StepMeta stepMeta ); List<MissingTrans> getMissingTrans(); void addMissingTrans( MissingTrans trans ); void removeMissingTrans( MissingTrans trans ); @Override boolean hasMissingPlugins(); @Override NamedClusterEmbedManager getNamedClusterEmbedManager( ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public void loadXML( Node transnode, Repository rep, boolean setInternalVariables ) throws KettleXMLException, KettleMissingPluginsException { loadXML( transnode, rep, setInternalVariables, null ); } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); @Override int compare( TransMeta t1, TransMeta t2 ); @Override int compareTo( TransMeta o ); @Override boolean equals( Object obj ); @Override Object clone(); Object realClone( boolean doClear ); @Override void clear(); void addStep( StepMeta stepMeta ); void addOrReplaceStep( StepMeta stepMeta ); void addTransHop( TransHopMeta hi ); void addDependency( TransDependency td ); void addStep( int p, StepMeta stepMeta ); void addTransHop( int p, TransHopMeta hi ); void addDependency( int p, TransDependency td ); List<StepMeta> getSteps(); StepMeta getStep( int i ); TransHopMeta getTransHop( int i ); TransDependency getDependency( int i ); void removeStep( int i ); void removeTransHop( int i ); void removeTransHop( TransHopMeta hop ); void removeDependency( int i ); void removeAllDependencies(); int nrSteps(); int nrTransHops(); int nrDependencies(); int nrStepChangeListeners(); void setStep( int i, StepMeta stepMeta ); void setTransHop( int i, TransHopMeta hi ); List<StepMeta> getUsedSteps(); StepMeta findStep( String name ); StepMeta findStep( String name, StepMeta exclude ); TransHopMeta findTransHop( String name ); TransHopMeta findTransHopFrom( StepMeta fromstep ); List<TransHopMeta> findAllTransHopFrom( StepMeta fromstep ); TransHopMeta findTransHop( TransHopMeta hi ); TransHopMeta findTransHop( StepMeta from, StepMeta to ); TransHopMeta findTransHop( StepMeta from, StepMeta to, boolean disabledToo ); TransHopMeta findTransHopTo( StepMeta tostep ); boolean isStepInformative( StepMeta this_step, StepMeta prev_step ); @Deprecated int findNrPrevSteps( String stepname ); @Deprecated int findNrPrevSteps( String stepname, boolean info ); int findNrPrevSteps( StepMeta stepMeta ); @Deprecated StepMeta findPrevStep( String stepname, int nr ); @Deprecated StepMeta findPrevStep( String stepname, int nr, boolean info ); StepMeta findPrevStep( StepMeta stepMeta, int nr ); @Deprecated int findNrPrevSteps( StepMeta stepMeta, boolean info ); @Deprecated StepMeta findPrevStep( StepMeta stepMeta, int nr, boolean info ); List<StepMeta> findPreviousSteps( StepMeta stepMeta ); List<StepMeta> findPreviousSteps( StepMeta stepMeta, boolean info ); StepMeta[] getInfoStep( StepMeta stepMeta ); int findNrInfoSteps( StepMeta stepMeta ); RowMetaInterface getPrevInfoFields( String stepname ); RowMetaInterface getPrevInfoFields( StepMeta stepMeta ); @Deprecated int findNrNextSteps( StepMeta stepMeta ); @Deprecated StepMeta findNextStep( StepMeta stepMeta, int nr ); StepMeta[] getPrevSteps( StepMeta stepMeta ); String[] getPrevStepNames( String stepname ); String[] getPrevStepNames( StepMeta stepMeta ); @Deprecated StepMeta[] getNextSteps( StepMeta stepMeta ); List<StepMeta> findNextSteps( StepMeta stepMeta ); String[] getNextStepNames( StepMeta stepMeta ); StepMeta getStep( int x, int y, int iconsize ); boolean partOfTransHop( StepMeta stepMeta ); RowMetaInterface getStepFields( String stepname ); RowMetaInterface getStepFields( StepMeta stepMeta ); RowMetaInterface getStepFields( StepMeta[] stepMeta ); RowMetaInterface getStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getStepFields( StepMeta stepMeta, StepMeta targetStep, ProgressMonitorListener monitor ); RowMetaInterface getPrevStepFields( String stepname ); RowMetaInterface getPrevStepFields( StepMeta stepMeta ); RowMetaInterface getPrevStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getThisStepFields( String stepname, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row, ProgressMonitorListener monitor ); boolean isUsingPartitionSchema( PartitionSchema partitionSchema ); boolean isUsingAClusterSchema(); boolean isUsingClusterSchema( ClusterSchema clusterSchema ); boolean isUsingSlaveServer( SlaveServer slaveServer ); boolean isRepReference(); boolean isFileReference(); static boolean isRepReference( String exactFilename, String exactTransname ); static boolean isFileReference( String exactFilename, String exactTransname ); int indexOfTransHop( TransHopMeta hi ); int indexOfStep( StepMeta stepMeta ); @Override String getFileType(); @Override String[] getFilterNames(); @Override String[] getFilterExtensions(); @Override String getDefaultExtension(); @Override String getXML(); String getXML( boolean includeSteps, boolean includeDatabase, boolean includeSlaves, boolean includeClusters, boolean includePartitions ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); byte[] getKey(); void setKey( byte[] key ); boolean isPrivateKey(); void setPrivateKey( boolean privateKey ); @Override boolean loadSharedObject( SharedObjectInterface object ); List<StepMeta> getTransHopSteps( boolean all ); boolean isStepUsedInTransHops( StepMeta stepMeta ); boolean isAnySelectedStepUsedInTransHops(); @Override void clearChanged(); boolean haveStepsChanged(); boolean haveHopsChanged(); boolean havePartitionSchemasChanged(); boolean haveClusterSchemasChanged(); @Override boolean hasChanged(); boolean hasLoop( StepMeta stepMeta ); void selectAll(); void unselectAll(); Point[] getSelectedStepLocations(); Point[] getSelectedNoteLocations(); List<StepMeta> getSelectedSteps(); String[] getSelectedStepNames(); int[] getStepIndexes( List<StepMeta> steps ); Point getMaximum(); Point getMinimum(); String[] getStepNames(); StepMeta[] getStepsArray(); boolean findPrevious( StepMeta startStep, StepMeta stepToFind ); void sortSteps(); void sortHops(); Map<StepMeta, Map<StepMeta, Boolean>> sortStepsNatural(); void sortHopsNatural(); void analyseImpact( List<DatabaseImpact> impact, ProgressMonitorListener monitor ); String getAlternativeStepname( String stepname ); List<SQLStatement> getSQLStatements(); List<SQLStatement> getSQLStatements( ProgressMonitorListener monitor ); String getSQLStatementsString(); @Deprecated void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor ); void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor, VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated List<RowMetaAndData> getResultRows(); @Deprecated void setResultRows( List<RowMetaAndData> resultRows ); String getPathAndName(); @Deprecated String[] getArguments(); @Deprecated void setArguments( String[] arguments ); @Deprecated Hashtable<String, Counter> getCounters(); @Deprecated void setCounters( Hashtable<String, Counter> counters ); List<TransDependency> getDependencies(); void setDependencies( List<TransDependency> dependencies ); DatabaseMeta getMaxDateConnection(); void setMaxDateConnection( DatabaseMeta maxDateConnection ); double getMaxDateDifference(); void setMaxDateDifference( double maxDateDifference ); String getMaxDateField(); void setMaxDateField( String maxDateField ); double getMaxDateOffset(); void setMaxDateOffset( double maxDateOffset ); String getMaxDateTable(); void setMaxDateTable( String maxDateTable ); int getSizeRowset(); void setSizeRowset( int sizeRowset ); DBCache getDbCache(); void setDbCache( DBCache dbCache ); String getTransversion(); void setTransversion( String n ); void setTransstatus( int n ); int getTransstatus(); @Override String toString(); void cancelQueries(); Map<String, String> getUsedArguments( String[] arguments ); int getSleepTimeEmpty(); int getSleepTimeFull(); void setSleepTimeEmpty( int sleepTimeEmpty ); void setSleepTimeFull( int sleepTimeFull ); boolean isDatabaseConnectionUsed( DatabaseMeta databaseMeta ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes, boolean includePasswords ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes ); List<String> getUsedVariables(); @Deprecated Result getPreviousResult(); @Deprecated void setPreviousResult( Result previousResult ); @Deprecated List<ResultFile> getResultFiles(); @Deprecated void setResultFiles( List<ResultFile> resultFiles ); List<PartitionSchema> getPartitionSchemas(); void setPartitionSchemas( List<PartitionSchema> partitionSchemas ); String[] getPartitionSchemasNames(); boolean isFeedbackShown(); void setFeedbackShown( boolean feedbackShown ); int getFeedbackSize(); void setFeedbackSize( int feedbackSize ); boolean isUsingUniqueConnections(); void setUsingUniqueConnections( boolean usingUniqueConnections ); List<ClusterSchema> getClusterSchemas(); void setClusterSchemas( List<ClusterSchema> clusterSchemas ); String[] getClusterSchemaNames(); PartitionSchema findPartitionSchema( String name ); ClusterSchema findClusterSchema( String name ); void addOrReplacePartitionSchema( PartitionSchema partitionSchema ); void addOrReplaceClusterSchema( ClusterSchema clusterSchema ); boolean isUsingThreadPriorityManagment(); void setUsingThreadPriorityManagment( boolean usingThreadPriorityManagment ); void checkRowMixingStatically( StepMeta stepMeta, ProgressMonitorListener monitor ); @Override void setInternalKettleVariables( VariableSpace var ); StepMeta findMappingInputStep( String stepname ); StepMeta findMappingOutputStep( String stepname ); List<ResourceReference> getResourceDependencies(); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); SlaveStepCopyPartitionDistribution getSlaveStepCopyPartitionDistribution(); void setSlaveStepCopyPartitionDistribution( SlaveStepCopyPartitionDistribution slaveStepCopyPartitionDistribution ); ClusterSchema findFirstUsedClusterSchema(); boolean isSlaveTransformation(); void setSlaveTransformation( boolean slaveTransformation ); boolean isCapturingStepPerformanceSnapShots(); void setCapturingStepPerformanceSnapShots( boolean capturingStepPerformanceSnapShots ); long getStepPerformanceCapturingDelay(); void setStepPerformanceCapturingDelay( long stepPerformanceCapturingDelay ); String getStepPerformanceCapturingSizeLimit(); void setStepPerformanceCapturingSizeLimit( String stepPerformanceCapturingSizeLimit ); void clearCaches(); @Override RepositoryObjectType getRepositoryElementType(); LogChannelInterface getLogChannel(); @Override String getLogChannelId(); @Override LoggingObjectType getObjectType(); TransLogTable getTransLogTable(); void setTransLogTable( TransLogTable transLogTable ); PerformanceLogTable getPerformanceLogTable(); void setPerformanceLogTable( PerformanceLogTable performanceLogTable ); StepLogTable getStepLogTable(); void setStepLogTable( StepLogTable stepLogTable ); List<LogTableInterface> getLogTables(); TransformationType getTransformationType(); void setTransformationType( TransformationType transformationType ); void writeXML( String filename ); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); MetricsLogTable getMetricsLogTable(); void setMetricsLogTable( MetricsLogTable metricsLogTable ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging ); void addStepChangeListener( StepMetaChangeListenerInterface listener ); void addStepChangeListener( int p, StepMetaChangeListenerInterface list ); void removeStepChangeListener( StepMetaChangeListenerInterface list ); void notifyAllListeners( StepMeta oldMeta, StepMeta newMeta ); boolean containsStepMeta( StepMeta stepMeta ); List<MissingTrans> getMissingTrans(); void addMissingTrans( MissingTrans trans ); void removeMissingTrans( MissingTrans trans ); @Override boolean hasMissingPlugins(); @Override NamedClusterEmbedManager getNamedClusterEmbedManager( ); static final String XML_TAG; static final String STRING_TRANSMETA; static final RepositoryObjectType REPOSITORY_ELEMENT_TYPE; static final int BORDER_INDENT; static final String[] desc_type_undo; static final String XML_TAG_ORDER; static final String XML_TAG_NOTEPADS; static final String XML_TAG_PARAMETERS; static final String XML_TAG_PARTITIONSCHEMAS; static final String XML_TAG_SLAVESERVERS; static final String XML_TAG_CLUSTERSCHEMAS; static final String XML_TAG_STEP_ERROR_HANDLING; }
@Test public void testTransWithOneStepIsConsideredUsed() throws Exception { TransMeta transMeta = new TransMeta( getClass().getResource( "one-step-trans.ktr" ).getPath() ); assertEquals( 1, transMeta.getUsedSteps().size() ); }
public List<StepMeta> getUsedSteps() { List<StepMeta> list = new ArrayList<>(); for ( StepMeta stepMeta : steps ) { if ( isStepUsedInTransHops( stepMeta ) ) { list.add( stepMeta ); } } if ( list.isEmpty() && getSteps().size() == 1 ) { list = getSteps(); } return list; }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public List<StepMeta> getUsedSteps() { List<StepMeta> list = new ArrayList<>(); for ( StepMeta stepMeta : steps ) { if ( isStepUsedInTransHops( stepMeta ) ) { list.add( stepMeta ); } } if ( list.isEmpty() && getSteps().size() == 1 ) { list = getSteps(); } return list; } }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public List<StepMeta> getUsedSteps() { List<StepMeta> list = new ArrayList<>(); for ( StepMeta stepMeta : steps ) { if ( isStepUsedInTransHops( stepMeta ) ) { list.add( stepMeta ); } } if ( list.isEmpty() && getSteps().size() == 1 ) { list = getSteps(); } return list; } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public List<StepMeta> getUsedSteps() { List<StepMeta> list = new ArrayList<>(); for ( StepMeta stepMeta : steps ) { if ( isStepUsedInTransHops( stepMeta ) ) { list.add( stepMeta ); } } if ( list.isEmpty() && getSteps().size() == 1 ) { list = getSteps(); } return list; } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); @Override int compare( TransMeta t1, TransMeta t2 ); @Override int compareTo( TransMeta o ); @Override boolean equals( Object obj ); @Override Object clone(); Object realClone( boolean doClear ); @Override void clear(); void addStep( StepMeta stepMeta ); void addOrReplaceStep( StepMeta stepMeta ); void addTransHop( TransHopMeta hi ); void addDependency( TransDependency td ); void addStep( int p, StepMeta stepMeta ); void addTransHop( int p, TransHopMeta hi ); void addDependency( int p, TransDependency td ); List<StepMeta> getSteps(); StepMeta getStep( int i ); TransHopMeta getTransHop( int i ); TransDependency getDependency( int i ); void removeStep( int i ); void removeTransHop( int i ); void removeTransHop( TransHopMeta hop ); void removeDependency( int i ); void removeAllDependencies(); int nrSteps(); int nrTransHops(); int nrDependencies(); int nrStepChangeListeners(); void setStep( int i, StepMeta stepMeta ); void setTransHop( int i, TransHopMeta hi ); List<StepMeta> getUsedSteps(); StepMeta findStep( String name ); StepMeta findStep( String name, StepMeta exclude ); TransHopMeta findTransHop( String name ); TransHopMeta findTransHopFrom( StepMeta fromstep ); List<TransHopMeta> findAllTransHopFrom( StepMeta fromstep ); TransHopMeta findTransHop( TransHopMeta hi ); TransHopMeta findTransHop( StepMeta from, StepMeta to ); TransHopMeta findTransHop( StepMeta from, StepMeta to, boolean disabledToo ); TransHopMeta findTransHopTo( StepMeta tostep ); boolean isStepInformative( StepMeta this_step, StepMeta prev_step ); @Deprecated int findNrPrevSteps( String stepname ); @Deprecated int findNrPrevSteps( String stepname, boolean info ); int findNrPrevSteps( StepMeta stepMeta ); @Deprecated StepMeta findPrevStep( String stepname, int nr ); @Deprecated StepMeta findPrevStep( String stepname, int nr, boolean info ); StepMeta findPrevStep( StepMeta stepMeta, int nr ); @Deprecated int findNrPrevSteps( StepMeta stepMeta, boolean info ); @Deprecated StepMeta findPrevStep( StepMeta stepMeta, int nr, boolean info ); List<StepMeta> findPreviousSteps( StepMeta stepMeta ); List<StepMeta> findPreviousSteps( StepMeta stepMeta, boolean info ); StepMeta[] getInfoStep( StepMeta stepMeta ); int findNrInfoSteps( StepMeta stepMeta ); RowMetaInterface getPrevInfoFields( String stepname ); RowMetaInterface getPrevInfoFields( StepMeta stepMeta ); @Deprecated int findNrNextSteps( StepMeta stepMeta ); @Deprecated StepMeta findNextStep( StepMeta stepMeta, int nr ); StepMeta[] getPrevSteps( StepMeta stepMeta ); String[] getPrevStepNames( String stepname ); String[] getPrevStepNames( StepMeta stepMeta ); @Deprecated StepMeta[] getNextSteps( StepMeta stepMeta ); List<StepMeta> findNextSteps( StepMeta stepMeta ); String[] getNextStepNames( StepMeta stepMeta ); StepMeta getStep( int x, int y, int iconsize ); boolean partOfTransHop( StepMeta stepMeta ); RowMetaInterface getStepFields( String stepname ); RowMetaInterface getStepFields( StepMeta stepMeta ); RowMetaInterface getStepFields( StepMeta[] stepMeta ); RowMetaInterface getStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getStepFields( StepMeta stepMeta, StepMeta targetStep, ProgressMonitorListener monitor ); RowMetaInterface getPrevStepFields( String stepname ); RowMetaInterface getPrevStepFields( StepMeta stepMeta ); RowMetaInterface getPrevStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getThisStepFields( String stepname, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row, ProgressMonitorListener monitor ); boolean isUsingPartitionSchema( PartitionSchema partitionSchema ); boolean isUsingAClusterSchema(); boolean isUsingClusterSchema( ClusterSchema clusterSchema ); boolean isUsingSlaveServer( SlaveServer slaveServer ); boolean isRepReference(); boolean isFileReference(); static boolean isRepReference( String exactFilename, String exactTransname ); static boolean isFileReference( String exactFilename, String exactTransname ); int indexOfTransHop( TransHopMeta hi ); int indexOfStep( StepMeta stepMeta ); @Override String getFileType(); @Override String[] getFilterNames(); @Override String[] getFilterExtensions(); @Override String getDefaultExtension(); @Override String getXML(); String getXML( boolean includeSteps, boolean includeDatabase, boolean includeSlaves, boolean includeClusters, boolean includePartitions ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); byte[] getKey(); void setKey( byte[] key ); boolean isPrivateKey(); void setPrivateKey( boolean privateKey ); @Override boolean loadSharedObject( SharedObjectInterface object ); List<StepMeta> getTransHopSteps( boolean all ); boolean isStepUsedInTransHops( StepMeta stepMeta ); boolean isAnySelectedStepUsedInTransHops(); @Override void clearChanged(); boolean haveStepsChanged(); boolean haveHopsChanged(); boolean havePartitionSchemasChanged(); boolean haveClusterSchemasChanged(); @Override boolean hasChanged(); boolean hasLoop( StepMeta stepMeta ); void selectAll(); void unselectAll(); Point[] getSelectedStepLocations(); Point[] getSelectedNoteLocations(); List<StepMeta> getSelectedSteps(); String[] getSelectedStepNames(); int[] getStepIndexes( List<StepMeta> steps ); Point getMaximum(); Point getMinimum(); String[] getStepNames(); StepMeta[] getStepsArray(); boolean findPrevious( StepMeta startStep, StepMeta stepToFind ); void sortSteps(); void sortHops(); Map<StepMeta, Map<StepMeta, Boolean>> sortStepsNatural(); void sortHopsNatural(); void analyseImpact( List<DatabaseImpact> impact, ProgressMonitorListener monitor ); String getAlternativeStepname( String stepname ); List<SQLStatement> getSQLStatements(); List<SQLStatement> getSQLStatements( ProgressMonitorListener monitor ); String getSQLStatementsString(); @Deprecated void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor ); void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor, VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated List<RowMetaAndData> getResultRows(); @Deprecated void setResultRows( List<RowMetaAndData> resultRows ); String getPathAndName(); @Deprecated String[] getArguments(); @Deprecated void setArguments( String[] arguments ); @Deprecated Hashtable<String, Counter> getCounters(); @Deprecated void setCounters( Hashtable<String, Counter> counters ); List<TransDependency> getDependencies(); void setDependencies( List<TransDependency> dependencies ); DatabaseMeta getMaxDateConnection(); void setMaxDateConnection( DatabaseMeta maxDateConnection ); double getMaxDateDifference(); void setMaxDateDifference( double maxDateDifference ); String getMaxDateField(); void setMaxDateField( String maxDateField ); double getMaxDateOffset(); void setMaxDateOffset( double maxDateOffset ); String getMaxDateTable(); void setMaxDateTable( String maxDateTable ); int getSizeRowset(); void setSizeRowset( int sizeRowset ); DBCache getDbCache(); void setDbCache( DBCache dbCache ); String getTransversion(); void setTransversion( String n ); void setTransstatus( int n ); int getTransstatus(); @Override String toString(); void cancelQueries(); Map<String, String> getUsedArguments( String[] arguments ); int getSleepTimeEmpty(); int getSleepTimeFull(); void setSleepTimeEmpty( int sleepTimeEmpty ); void setSleepTimeFull( int sleepTimeFull ); boolean isDatabaseConnectionUsed( DatabaseMeta databaseMeta ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes, boolean includePasswords ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes ); List<String> getUsedVariables(); @Deprecated Result getPreviousResult(); @Deprecated void setPreviousResult( Result previousResult ); @Deprecated List<ResultFile> getResultFiles(); @Deprecated void setResultFiles( List<ResultFile> resultFiles ); List<PartitionSchema> getPartitionSchemas(); void setPartitionSchemas( List<PartitionSchema> partitionSchemas ); String[] getPartitionSchemasNames(); boolean isFeedbackShown(); void setFeedbackShown( boolean feedbackShown ); int getFeedbackSize(); void setFeedbackSize( int feedbackSize ); boolean isUsingUniqueConnections(); void setUsingUniqueConnections( boolean usingUniqueConnections ); List<ClusterSchema> getClusterSchemas(); void setClusterSchemas( List<ClusterSchema> clusterSchemas ); String[] getClusterSchemaNames(); PartitionSchema findPartitionSchema( String name ); ClusterSchema findClusterSchema( String name ); void addOrReplacePartitionSchema( PartitionSchema partitionSchema ); void addOrReplaceClusterSchema( ClusterSchema clusterSchema ); boolean isUsingThreadPriorityManagment(); void setUsingThreadPriorityManagment( boolean usingThreadPriorityManagment ); void checkRowMixingStatically( StepMeta stepMeta, ProgressMonitorListener monitor ); @Override void setInternalKettleVariables( VariableSpace var ); StepMeta findMappingInputStep( String stepname ); StepMeta findMappingOutputStep( String stepname ); List<ResourceReference> getResourceDependencies(); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); SlaveStepCopyPartitionDistribution getSlaveStepCopyPartitionDistribution(); void setSlaveStepCopyPartitionDistribution( SlaveStepCopyPartitionDistribution slaveStepCopyPartitionDistribution ); ClusterSchema findFirstUsedClusterSchema(); boolean isSlaveTransformation(); void setSlaveTransformation( boolean slaveTransformation ); boolean isCapturingStepPerformanceSnapShots(); void setCapturingStepPerformanceSnapShots( boolean capturingStepPerformanceSnapShots ); long getStepPerformanceCapturingDelay(); void setStepPerformanceCapturingDelay( long stepPerformanceCapturingDelay ); String getStepPerformanceCapturingSizeLimit(); void setStepPerformanceCapturingSizeLimit( String stepPerformanceCapturingSizeLimit ); void clearCaches(); @Override RepositoryObjectType getRepositoryElementType(); LogChannelInterface getLogChannel(); @Override String getLogChannelId(); @Override LoggingObjectType getObjectType(); TransLogTable getTransLogTable(); void setTransLogTable( TransLogTable transLogTable ); PerformanceLogTable getPerformanceLogTable(); void setPerformanceLogTable( PerformanceLogTable performanceLogTable ); StepLogTable getStepLogTable(); void setStepLogTable( StepLogTable stepLogTable ); List<LogTableInterface> getLogTables(); TransformationType getTransformationType(); void setTransformationType( TransformationType transformationType ); void writeXML( String filename ); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); MetricsLogTable getMetricsLogTable(); void setMetricsLogTable( MetricsLogTable metricsLogTable ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging ); void addStepChangeListener( StepMetaChangeListenerInterface listener ); void addStepChangeListener( int p, StepMetaChangeListenerInterface list ); void removeStepChangeListener( StepMetaChangeListenerInterface list ); void notifyAllListeners( StepMeta oldMeta, StepMeta newMeta ); boolean containsStepMeta( StepMeta stepMeta ); List<MissingTrans> getMissingTrans(); void addMissingTrans( MissingTrans trans ); void removeMissingTrans( MissingTrans trans ); @Override boolean hasMissingPlugins(); @Override NamedClusterEmbedManager getNamedClusterEmbedManager( ); }
TransMeta extends AbstractMeta implements XMLInterface, Comparator<TransMeta>, Comparable<TransMeta>, Cloneable, ResourceExportInterface, RepositoryElementInterface, LoggingObjectInterface { public List<StepMeta> getUsedSteps() { List<StepMeta> list = new ArrayList<>(); for ( StepMeta stepMeta : steps ) { if ( isStepUsedInTransHops( stepMeta ) ) { list.add( stepMeta ); } } if ( list.isEmpty() && getSteps().size() == 1 ) { list = getSteps(); } return list; } TransMeta(); TransMeta( VariableSpace parent ); TransMeta( String filename, String name ); @Deprecated TransMeta( String filename, String name, String[] arguments ); TransMeta( String fname ); TransMeta( String fname, VariableSpace parentVariableSpace ); TransMeta( String fname, boolean setInternalVariables ); TransMeta( String fname, Repository rep ); TransMeta( String fname, Repository rep, boolean setInternalVariables ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); TransMeta( String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( InputStream xmlStream, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); TransMeta( Node transnode, Repository rep ); @Override int compare( TransMeta t1, TransMeta t2 ); @Override int compareTo( TransMeta o ); @Override boolean equals( Object obj ); @Override Object clone(); Object realClone( boolean doClear ); @Override void clear(); void addStep( StepMeta stepMeta ); void addOrReplaceStep( StepMeta stepMeta ); void addTransHop( TransHopMeta hi ); void addDependency( TransDependency td ); void addStep( int p, StepMeta stepMeta ); void addTransHop( int p, TransHopMeta hi ); void addDependency( int p, TransDependency td ); List<StepMeta> getSteps(); StepMeta getStep( int i ); TransHopMeta getTransHop( int i ); TransDependency getDependency( int i ); void removeStep( int i ); void removeTransHop( int i ); void removeTransHop( TransHopMeta hop ); void removeDependency( int i ); void removeAllDependencies(); int nrSteps(); int nrTransHops(); int nrDependencies(); int nrStepChangeListeners(); void setStep( int i, StepMeta stepMeta ); void setTransHop( int i, TransHopMeta hi ); List<StepMeta> getUsedSteps(); StepMeta findStep( String name ); StepMeta findStep( String name, StepMeta exclude ); TransHopMeta findTransHop( String name ); TransHopMeta findTransHopFrom( StepMeta fromstep ); List<TransHopMeta> findAllTransHopFrom( StepMeta fromstep ); TransHopMeta findTransHop( TransHopMeta hi ); TransHopMeta findTransHop( StepMeta from, StepMeta to ); TransHopMeta findTransHop( StepMeta from, StepMeta to, boolean disabledToo ); TransHopMeta findTransHopTo( StepMeta tostep ); boolean isStepInformative( StepMeta this_step, StepMeta prev_step ); @Deprecated int findNrPrevSteps( String stepname ); @Deprecated int findNrPrevSteps( String stepname, boolean info ); int findNrPrevSteps( StepMeta stepMeta ); @Deprecated StepMeta findPrevStep( String stepname, int nr ); @Deprecated StepMeta findPrevStep( String stepname, int nr, boolean info ); StepMeta findPrevStep( StepMeta stepMeta, int nr ); @Deprecated int findNrPrevSteps( StepMeta stepMeta, boolean info ); @Deprecated StepMeta findPrevStep( StepMeta stepMeta, int nr, boolean info ); List<StepMeta> findPreviousSteps( StepMeta stepMeta ); List<StepMeta> findPreviousSteps( StepMeta stepMeta, boolean info ); StepMeta[] getInfoStep( StepMeta stepMeta ); int findNrInfoSteps( StepMeta stepMeta ); RowMetaInterface getPrevInfoFields( String stepname ); RowMetaInterface getPrevInfoFields( StepMeta stepMeta ); @Deprecated int findNrNextSteps( StepMeta stepMeta ); @Deprecated StepMeta findNextStep( StepMeta stepMeta, int nr ); StepMeta[] getPrevSteps( StepMeta stepMeta ); String[] getPrevStepNames( String stepname ); String[] getPrevStepNames( StepMeta stepMeta ); @Deprecated StepMeta[] getNextSteps( StepMeta stepMeta ); List<StepMeta> findNextSteps( StepMeta stepMeta ); String[] getNextStepNames( StepMeta stepMeta ); StepMeta getStep( int x, int y, int iconsize ); boolean partOfTransHop( StepMeta stepMeta ); RowMetaInterface getStepFields( String stepname ); RowMetaInterface getStepFields( StepMeta stepMeta ); RowMetaInterface getStepFields( StepMeta[] stepMeta ); RowMetaInterface getStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getStepFields( StepMeta stepMeta, StepMeta targetStep, ProgressMonitorListener monitor ); RowMetaInterface getPrevStepFields( String stepname ); RowMetaInterface getPrevStepFields( StepMeta stepMeta ); RowMetaInterface getPrevStepFields( StepMeta stepMeta, ProgressMonitorListener monitor ); RowMetaInterface getThisStepFields( String stepname, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row ); RowMetaInterface getThisStepFields( StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row, ProgressMonitorListener monitor ); boolean isUsingPartitionSchema( PartitionSchema partitionSchema ); boolean isUsingAClusterSchema(); boolean isUsingClusterSchema( ClusterSchema clusterSchema ); boolean isUsingSlaveServer( SlaveServer slaveServer ); boolean isRepReference(); boolean isFileReference(); static boolean isRepReference( String exactFilename, String exactTransname ); static boolean isFileReference( String exactFilename, String exactTransname ); int indexOfTransHop( TransHopMeta hi ); int indexOfStep( StepMeta stepMeta ); @Override String getFileType(); @Override String[] getFilterNames(); @Override String[] getFilterExtensions(); @Override String getDefaultExtension(); @Override String getXML(); String getXML( boolean includeSteps, boolean includeDatabase, boolean includeSlaves, boolean includeClusters, boolean includePartitions ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ); void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); void loadXML( Node transnode, String fname, IMetaStore metaStore, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace, OverwritePrompter prompter ); byte[] getKey(); void setKey( byte[] key ); boolean isPrivateKey(); void setPrivateKey( boolean privateKey ); @Override boolean loadSharedObject( SharedObjectInterface object ); List<StepMeta> getTransHopSteps( boolean all ); boolean isStepUsedInTransHops( StepMeta stepMeta ); boolean isAnySelectedStepUsedInTransHops(); @Override void clearChanged(); boolean haveStepsChanged(); boolean haveHopsChanged(); boolean havePartitionSchemasChanged(); boolean haveClusterSchemasChanged(); @Override boolean hasChanged(); boolean hasLoop( StepMeta stepMeta ); void selectAll(); void unselectAll(); Point[] getSelectedStepLocations(); Point[] getSelectedNoteLocations(); List<StepMeta> getSelectedSteps(); String[] getSelectedStepNames(); int[] getStepIndexes( List<StepMeta> steps ); Point getMaximum(); Point getMinimum(); String[] getStepNames(); StepMeta[] getStepsArray(); boolean findPrevious( StepMeta startStep, StepMeta stepToFind ); void sortSteps(); void sortHops(); Map<StepMeta, Map<StepMeta, Boolean>> sortStepsNatural(); void sortHopsNatural(); void analyseImpact( List<DatabaseImpact> impact, ProgressMonitorListener monitor ); String getAlternativeStepname( String stepname ); List<SQLStatement> getSQLStatements(); List<SQLStatement> getSQLStatements( ProgressMonitorListener monitor ); String getSQLStatementsString(); @Deprecated void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor ); void checkSteps( List<CheckResultInterface> remarks, boolean only_selected, ProgressMonitorListener monitor, VariableSpace space, Repository repository, IMetaStore metaStore ); @Deprecated List<RowMetaAndData> getResultRows(); @Deprecated void setResultRows( List<RowMetaAndData> resultRows ); String getPathAndName(); @Deprecated String[] getArguments(); @Deprecated void setArguments( String[] arguments ); @Deprecated Hashtable<String, Counter> getCounters(); @Deprecated void setCounters( Hashtable<String, Counter> counters ); List<TransDependency> getDependencies(); void setDependencies( List<TransDependency> dependencies ); DatabaseMeta getMaxDateConnection(); void setMaxDateConnection( DatabaseMeta maxDateConnection ); double getMaxDateDifference(); void setMaxDateDifference( double maxDateDifference ); String getMaxDateField(); void setMaxDateField( String maxDateField ); double getMaxDateOffset(); void setMaxDateOffset( double maxDateOffset ); String getMaxDateTable(); void setMaxDateTable( String maxDateTable ); int getSizeRowset(); void setSizeRowset( int sizeRowset ); DBCache getDbCache(); void setDbCache( DBCache dbCache ); String getTransversion(); void setTransversion( String n ); void setTransstatus( int n ); int getTransstatus(); @Override String toString(); void cancelQueries(); Map<String, String> getUsedArguments( String[] arguments ); int getSleepTimeEmpty(); int getSleepTimeFull(); void setSleepTimeEmpty( int sleepTimeEmpty ); void setSleepTimeFull( int sleepTimeFull ); boolean isDatabaseConnectionUsed( DatabaseMeta databaseMeta ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes, boolean includePasswords ); List<StringSearchResult> getStringList( boolean searchSteps, boolean searchDatabases, boolean searchNotes ); List<String> getUsedVariables(); @Deprecated Result getPreviousResult(); @Deprecated void setPreviousResult( Result previousResult ); @Deprecated List<ResultFile> getResultFiles(); @Deprecated void setResultFiles( List<ResultFile> resultFiles ); List<PartitionSchema> getPartitionSchemas(); void setPartitionSchemas( List<PartitionSchema> partitionSchemas ); String[] getPartitionSchemasNames(); boolean isFeedbackShown(); void setFeedbackShown( boolean feedbackShown ); int getFeedbackSize(); void setFeedbackSize( int feedbackSize ); boolean isUsingUniqueConnections(); void setUsingUniqueConnections( boolean usingUniqueConnections ); List<ClusterSchema> getClusterSchemas(); void setClusterSchemas( List<ClusterSchema> clusterSchemas ); String[] getClusterSchemaNames(); PartitionSchema findPartitionSchema( String name ); ClusterSchema findClusterSchema( String name ); void addOrReplacePartitionSchema( PartitionSchema partitionSchema ); void addOrReplaceClusterSchema( ClusterSchema clusterSchema ); boolean isUsingThreadPriorityManagment(); void setUsingThreadPriorityManagment( boolean usingThreadPriorityManagment ); void checkRowMixingStatically( StepMeta stepMeta, ProgressMonitorListener monitor ); @Override void setInternalKettleVariables( VariableSpace var ); StepMeta findMappingInputStep( String stepname ); StepMeta findMappingOutputStep( String stepname ); List<ResourceReference> getResourceDependencies(); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); SlaveStepCopyPartitionDistribution getSlaveStepCopyPartitionDistribution(); void setSlaveStepCopyPartitionDistribution( SlaveStepCopyPartitionDistribution slaveStepCopyPartitionDistribution ); ClusterSchema findFirstUsedClusterSchema(); boolean isSlaveTransformation(); void setSlaveTransformation( boolean slaveTransformation ); boolean isCapturingStepPerformanceSnapShots(); void setCapturingStepPerformanceSnapShots( boolean capturingStepPerformanceSnapShots ); long getStepPerformanceCapturingDelay(); void setStepPerformanceCapturingDelay( long stepPerformanceCapturingDelay ); String getStepPerformanceCapturingSizeLimit(); void setStepPerformanceCapturingSizeLimit( String stepPerformanceCapturingSizeLimit ); void clearCaches(); @Override RepositoryObjectType getRepositoryElementType(); LogChannelInterface getLogChannel(); @Override String getLogChannelId(); @Override LoggingObjectType getObjectType(); TransLogTable getTransLogTable(); void setTransLogTable( TransLogTable transLogTable ); PerformanceLogTable getPerformanceLogTable(); void setPerformanceLogTable( PerformanceLogTable performanceLogTable ); StepLogTable getStepLogTable(); void setStepLogTable( StepLogTable stepLogTable ); List<LogTableInterface> getLogTables(); TransformationType getTransformationType(); void setTransformationType( TransformationType transformationType ); void writeXML( String filename ); boolean hasRepositoryReferences(); void lookupRepositoryReferences( Repository repository ); MetricsLogTable getMetricsLogTable(); void setMetricsLogTable( MetricsLogTable metricsLogTable ); @Override boolean isGatheringMetrics(); @Override void setGatheringMetrics( boolean gatheringMetrics ); @Override boolean isForcingSeparateLogging(); @Override void setForcingSeparateLogging( boolean forcingSeparateLogging ); void addStepChangeListener( StepMetaChangeListenerInterface listener ); void addStepChangeListener( int p, StepMetaChangeListenerInterface list ); void removeStepChangeListener( StepMetaChangeListenerInterface list ); void notifyAllListeners( StepMeta oldMeta, StepMeta newMeta ); boolean containsStepMeta( StepMeta stepMeta ); List<MissingTrans> getMissingTrans(); void addMissingTrans( MissingTrans trans ); void removeMissingTrans( MissingTrans trans ); @Override boolean hasMissingPlugins(); @Override NamedClusterEmbedManager getNamedClusterEmbedManager( ); static final String XML_TAG; static final String STRING_TRANSMETA; static final RepositoryObjectType REPOSITORY_ELEMENT_TYPE; static final int BORDER_INDENT; static final String[] desc_type_undo; static final String XML_TAG_ORDER; static final String XML_TAG_NOTEPADS; static final String XML_TAG_PARAMETERS; static final String XML_TAG_PARTITIONSCHEMAS; static final String XML_TAG_SLAVESERVERS; static final String XML_TAG_CLUSTERSCHEMAS; static final String XML_TAG_STEP_ERROR_HANDLING; }
@Test public void testLoadAndGetXml() throws Exception { ZipFileMeta zipFileMeta = new ZipFileMeta(); Node stepnode = getTestNode(); DatabaseMeta dbMeta = mock( DatabaseMeta.class ); IMetaStore metaStore = mock( IMetaStore.class ); StepMeta mockParentStepMeta = mock( StepMeta.class ); zipFileMeta.setParentStepMeta( mockParentStepMeta ); TransMeta mockTransMeta = mock( TransMeta.class ); NamedClusterEmbedManager embedManager = mock( NamedClusterEmbedManager.class ); when( mockParentStepMeta.getParentTransMeta() ).thenReturn( mockTransMeta ); when( mockTransMeta.getNamedClusterEmbedManager() ).thenReturn( embedManager ); zipFileMeta.loadXML( stepnode, Collections.singletonList( dbMeta ), metaStore ); assertXmlOutputMeta( zipFileMeta ); }
public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException { readData( stepnode ); }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException { readData( stepnode ); } }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException { readData( stepnode ); } ZipFileMeta(); }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException { readData( stepnode ); } ZipFileMeta(); String getDynamicSourceFileNameField(); void setDynamicSourceFileNameField( String sourcefilenamefield ); String getBaseFolderField(); void setBaseFolderField( String baseFolderField ); String getMoveToFolderField(); void setMoveToFolderField( String movetofolderfield ); String getDynamicTargetFileNameField(); void setDynamicTargetFileNameField( String targetfilenamefield ); boolean isaddTargetFileNametoResult(); boolean isOverwriteZipEntry(); boolean isCreateParentFolder(); boolean isKeepSouceFolder(); void setKeepSouceFolder( boolean value ); void setaddTargetFileNametoResult( boolean addresultfilenames ); void setOverwriteZipEntry( boolean overwritezipentry ); void setCreateParentFolder( boolean createparentfolder ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); Object clone(); void setDefault(); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); boolean supportsErrorHandling(); int getOperationType(); static int getOperationTypeByDesc( String tt ); void setOperationType( int operationType ); static String getOperationTypeDesc( int i ); }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException { readData( stepnode ); } ZipFileMeta(); String getDynamicSourceFileNameField(); void setDynamicSourceFileNameField( String sourcefilenamefield ); String getBaseFolderField(); void setBaseFolderField( String baseFolderField ); String getMoveToFolderField(); void setMoveToFolderField( String movetofolderfield ); String getDynamicTargetFileNameField(); void setDynamicTargetFileNameField( String targetfilenamefield ); boolean isaddTargetFileNametoResult(); boolean isOverwriteZipEntry(); boolean isCreateParentFolder(); boolean isKeepSouceFolder(); void setKeepSouceFolder( boolean value ); void setaddTargetFileNametoResult( boolean addresultfilenames ); void setOverwriteZipEntry( boolean overwritezipentry ); void setCreateParentFolder( boolean createparentfolder ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); Object clone(); void setDefault(); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); boolean supportsErrorHandling(); int getOperationType(); static int getOperationTypeByDesc( String tt ); void setOperationType( int operationType ); static String getOperationTypeDesc( int i ); static final String[] operationTypeDesc; static final String[] operationTypeCode; static final int OPERATION_TYPE_NOTHING; static final int OPERATION_TYPE_MOVE; static final int OPERATION_TYPE_DELETE; }
@Test public void testReadRep() throws Exception { ZipFileMeta zipFileMeta = new ZipFileMeta(); Repository rep = mock( Repository.class ); IMetaStore metastore = mock( IMetaStore.class ); DatabaseMeta dbMeta = mock( DatabaseMeta.class ); StringObjectId oid = new StringObjectId( "oid" ); when( rep.getStepAttributeString( oid, "sourcefilenamefield" ) ).thenReturn( SOURCE_FILENAME ); when( rep.getStepAttributeString( oid, "targetfilenamefield" ) ).thenReturn( TARGET_FILENAME ); when( rep.getStepAttributeString( oid, "baseFolderField" ) ).thenReturn( BASE_FOLDER ); when( rep.getStepAttributeString( oid, "operation_type" ) ).thenReturn( OPERATION_TYPE ); when( rep.getStepAttributeBoolean( oid, "addresultfilenames" ) ).thenReturn( ADD_RESULT_FILENAME ); when( rep.getStepAttributeBoolean( oid, "overwritezipentry" ) ).thenReturn( OVERWRITE_ZIP_ENTRY ); when( rep.getStepAttributeBoolean( oid, "createparentfolder" ) ).thenReturn( CREATE_PARENT_FOLDER ); when( rep.getStepAttributeBoolean( oid, "keepsourcefolder" ) ).thenReturn( KEEP_SOURCE_FOLDER ); when( rep.getStepAttributeString( oid, "movetofolderfield" ) ).thenReturn( MOVE_TO_FOLDER_FIELD ); zipFileMeta.readRep( rep, metastore, oid, Collections.singletonList( dbMeta ) ); assertEquals( SOURCE_FILENAME, zipFileMeta.getDynamicSourceFileNameField() ); assertEquals( TARGET_FILENAME, zipFileMeta.getDynamicTargetFileNameField() ); assertEquals( BASE_FOLDER, zipFileMeta.getBaseFolderField() ); assertEquals( ZipFileMeta.getOperationTypeByDesc( OPERATION_TYPE ), zipFileMeta.getOperationType() ); assertEquals( MOVE_TO_FOLDER_FIELD, zipFileMeta.getMoveToFolderField() ); assertTrue( zipFileMeta.isaddTargetFileNametoResult() ); assertTrue( zipFileMeta.isOverwriteZipEntry() ); assertTrue( zipFileMeta.isKeepSouceFolder() ); assertTrue( zipFileMeta.isCreateParentFolder() ); Mockito.reset( rep, metastore ); StringObjectId transid = new StringObjectId( "transid" ); zipFileMeta.saveRep( rep, metastore, transid, oid ); verify( rep ).saveStepAttribute( transid, oid, "sourcefilenamefield", SOURCE_FILENAME ); verify( rep ).saveStepAttribute( transid, oid, "targetfilenamefield", TARGET_FILENAME ); verify( rep ).saveStepAttribute( transid, oid, "baseFolderField", BASE_FOLDER ); verify( rep ).saveStepAttribute( transid, oid, "operation_type", OPERATION_TYPE ); verify( rep ).saveStepAttribute( transid, oid, "addresultfilenames", ADD_RESULT_FILENAME ); verify( rep ).saveStepAttribute( transid, oid, "overwritezipentry", OVERWRITE_ZIP_ENTRY ); verify( rep ).saveStepAttribute( transid, oid, "createparentfolder", CREATE_PARENT_FOLDER ); verify( rep ).saveStepAttribute( transid, oid, "keepsourcefolder", KEEP_SOURCE_FOLDER ); verify( rep ).saveStepAttribute( transid, oid, "movetofolderfield", MOVE_TO_FOLDER_FIELD ); Mockito.verifyNoMoreInteractions( rep, metastore ); }
public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { sourcefilenamefield = rep.getStepAttributeString( id_step, "sourcefilenamefield" ); targetfilenamefield = rep.getStepAttributeString( id_step, "targetfilenamefield" ); baseFolderField = rep.getStepAttributeString( id_step, "baseFolderField" ); operationType = getOperationTypeByCode( Const.NVL( rep.getStepAttributeString( id_step, "operation_type" ), "" ) ); addresultfilenames = rep.getStepAttributeBoolean( id_step, "addresultfilenames" ); overwritezipentry = rep.getStepAttributeBoolean( id_step, "overwritezipentry" ); createparentfolder = rep.getStepAttributeBoolean( id_step, "createparentfolder" ); keepsourcefolder = rep.getStepAttributeBoolean( id_step, "keepsourcefolder" ); movetofolderfield = rep.getStepAttributeString( id_step, "movetofolderfield" ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "ZipFileMeta.Exception.UnexpectedErrorReadingStepInfo" ), e ); } }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { sourcefilenamefield = rep.getStepAttributeString( id_step, "sourcefilenamefield" ); targetfilenamefield = rep.getStepAttributeString( id_step, "targetfilenamefield" ); baseFolderField = rep.getStepAttributeString( id_step, "baseFolderField" ); operationType = getOperationTypeByCode( Const.NVL( rep.getStepAttributeString( id_step, "operation_type" ), "" ) ); addresultfilenames = rep.getStepAttributeBoolean( id_step, "addresultfilenames" ); overwritezipentry = rep.getStepAttributeBoolean( id_step, "overwritezipentry" ); createparentfolder = rep.getStepAttributeBoolean( id_step, "createparentfolder" ); keepsourcefolder = rep.getStepAttributeBoolean( id_step, "keepsourcefolder" ); movetofolderfield = rep.getStepAttributeString( id_step, "movetofolderfield" ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "ZipFileMeta.Exception.UnexpectedErrorReadingStepInfo" ), e ); } } }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { sourcefilenamefield = rep.getStepAttributeString( id_step, "sourcefilenamefield" ); targetfilenamefield = rep.getStepAttributeString( id_step, "targetfilenamefield" ); baseFolderField = rep.getStepAttributeString( id_step, "baseFolderField" ); operationType = getOperationTypeByCode( Const.NVL( rep.getStepAttributeString( id_step, "operation_type" ), "" ) ); addresultfilenames = rep.getStepAttributeBoolean( id_step, "addresultfilenames" ); overwritezipentry = rep.getStepAttributeBoolean( id_step, "overwritezipentry" ); createparentfolder = rep.getStepAttributeBoolean( id_step, "createparentfolder" ); keepsourcefolder = rep.getStepAttributeBoolean( id_step, "keepsourcefolder" ); movetofolderfield = rep.getStepAttributeString( id_step, "movetofolderfield" ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "ZipFileMeta.Exception.UnexpectedErrorReadingStepInfo" ), e ); } } ZipFileMeta(); }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { sourcefilenamefield = rep.getStepAttributeString( id_step, "sourcefilenamefield" ); targetfilenamefield = rep.getStepAttributeString( id_step, "targetfilenamefield" ); baseFolderField = rep.getStepAttributeString( id_step, "baseFolderField" ); operationType = getOperationTypeByCode( Const.NVL( rep.getStepAttributeString( id_step, "operation_type" ), "" ) ); addresultfilenames = rep.getStepAttributeBoolean( id_step, "addresultfilenames" ); overwritezipentry = rep.getStepAttributeBoolean( id_step, "overwritezipentry" ); createparentfolder = rep.getStepAttributeBoolean( id_step, "createparentfolder" ); keepsourcefolder = rep.getStepAttributeBoolean( id_step, "keepsourcefolder" ); movetofolderfield = rep.getStepAttributeString( id_step, "movetofolderfield" ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "ZipFileMeta.Exception.UnexpectedErrorReadingStepInfo" ), e ); } } ZipFileMeta(); String getDynamicSourceFileNameField(); void setDynamicSourceFileNameField( String sourcefilenamefield ); String getBaseFolderField(); void setBaseFolderField( String baseFolderField ); String getMoveToFolderField(); void setMoveToFolderField( String movetofolderfield ); String getDynamicTargetFileNameField(); void setDynamicTargetFileNameField( String targetfilenamefield ); boolean isaddTargetFileNametoResult(); boolean isOverwriteZipEntry(); boolean isCreateParentFolder(); boolean isKeepSouceFolder(); void setKeepSouceFolder( boolean value ); void setaddTargetFileNametoResult( boolean addresultfilenames ); void setOverwriteZipEntry( boolean overwritezipentry ); void setCreateParentFolder( boolean createparentfolder ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); Object clone(); void setDefault(); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); boolean supportsErrorHandling(); int getOperationType(); static int getOperationTypeByDesc( String tt ); void setOperationType( int operationType ); static String getOperationTypeDesc( int i ); }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ) throws KettleException { try { sourcefilenamefield = rep.getStepAttributeString( id_step, "sourcefilenamefield" ); targetfilenamefield = rep.getStepAttributeString( id_step, "targetfilenamefield" ); baseFolderField = rep.getStepAttributeString( id_step, "baseFolderField" ); operationType = getOperationTypeByCode( Const.NVL( rep.getStepAttributeString( id_step, "operation_type" ), "" ) ); addresultfilenames = rep.getStepAttributeBoolean( id_step, "addresultfilenames" ); overwritezipentry = rep.getStepAttributeBoolean( id_step, "overwritezipentry" ); createparentfolder = rep.getStepAttributeBoolean( id_step, "createparentfolder" ); keepsourcefolder = rep.getStepAttributeBoolean( id_step, "keepsourcefolder" ); movetofolderfield = rep.getStepAttributeString( id_step, "movetofolderfield" ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "ZipFileMeta.Exception.UnexpectedErrorReadingStepInfo" ), e ); } } ZipFileMeta(); String getDynamicSourceFileNameField(); void setDynamicSourceFileNameField( String sourcefilenamefield ); String getBaseFolderField(); void setBaseFolderField( String baseFolderField ); String getMoveToFolderField(); void setMoveToFolderField( String movetofolderfield ); String getDynamicTargetFileNameField(); void setDynamicTargetFileNameField( String targetfilenamefield ); boolean isaddTargetFileNametoResult(); boolean isOverwriteZipEntry(); boolean isCreateParentFolder(); boolean isKeepSouceFolder(); void setKeepSouceFolder( boolean value ); void setaddTargetFileNametoResult( boolean addresultfilenames ); void setOverwriteZipEntry( boolean overwritezipentry ); void setCreateParentFolder( boolean createparentfolder ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); Object clone(); void setDefault(); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); boolean supportsErrorHandling(); int getOperationType(); static int getOperationTypeByDesc( String tt ); void setOperationType( int operationType ); static String getOperationTypeDesc( int i ); static final String[] operationTypeDesc; static final String[] operationTypeCode; static final int OPERATION_TYPE_NOTHING; static final int OPERATION_TYPE_MOVE; static final int OPERATION_TYPE_DELETE; }
@Test public void testCheck() { ZipFileMeta zipFileMeta = new ZipFileMeta(); zipFileMeta.setDefault(); TransMeta transMeta = mock( TransMeta.class ); StepMeta stepInfo = mock( StepMeta.class ); RowMetaInterface prev = mock( RowMetaInterface.class ); Repository repos = mock( Repository.class ); IMetaStore metastore = mock( IMetaStore.class ); RowMetaInterface info = mock( RowMetaInterface.class ); ArrayList<CheckResultInterface> remarks = new ArrayList<>(); zipFileMeta.check( remarks, transMeta, stepInfo, prev, new String[]{"input"}, new String[]{"output"}, info, new Variables(), repos, metastore ); assertEquals( 2, remarks.size() ); assertEquals( "Source Filename field is missing!", remarks.get( 0 ).getText() ); assertEquals( "Step is receiving info from other steps.", remarks.get( 1 ).getText() ); remarks = new ArrayList<>(); zipFileMeta = new ZipFileMeta(); zipFileMeta.setDynamicSourceFileNameField( "sourceFileField" ); zipFileMeta.check( remarks, transMeta, stepInfo, prev, new String[0], new String[]{"output"}, info, new Variables(), repos, metastore ); assertEquals( 2, remarks.size() ); assertEquals( "Target Filename field was specified", remarks.get( 0 ).getText() ); assertEquals( "No input received from other steps!", remarks.get( 1 ).getText() ); }
public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { CheckResult cr; String error_message = ""; if ( Utils.isEmpty( sourcefilenamefield ) ) { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.SourceFileFieldMissing" ); cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, error_message, stepMeta ); remarks.add( cr ); } else { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.TargetFileFieldOK" ); cr = new CheckResult( CheckResult.TYPE_RESULT_OK, error_message, stepMeta ); remarks.add( cr ); } if ( input.length > 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.ReceivingInfoFromOtherSteps" ), stepMeta ); remarks.add( cr ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.NoInpuReceived" ), stepMeta ); remarks.add( cr ); } }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { CheckResult cr; String error_message = ""; if ( Utils.isEmpty( sourcefilenamefield ) ) { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.SourceFileFieldMissing" ); cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, error_message, stepMeta ); remarks.add( cr ); } else { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.TargetFileFieldOK" ); cr = new CheckResult( CheckResult.TYPE_RESULT_OK, error_message, stepMeta ); remarks.add( cr ); } if ( input.length > 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.ReceivingInfoFromOtherSteps" ), stepMeta ); remarks.add( cr ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.NoInpuReceived" ), stepMeta ); remarks.add( cr ); } } }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { CheckResult cr; String error_message = ""; if ( Utils.isEmpty( sourcefilenamefield ) ) { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.SourceFileFieldMissing" ); cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, error_message, stepMeta ); remarks.add( cr ); } else { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.TargetFileFieldOK" ); cr = new CheckResult( CheckResult.TYPE_RESULT_OK, error_message, stepMeta ); remarks.add( cr ); } if ( input.length > 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.ReceivingInfoFromOtherSteps" ), stepMeta ); remarks.add( cr ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.NoInpuReceived" ), stepMeta ); remarks.add( cr ); } } ZipFileMeta(); }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { CheckResult cr; String error_message = ""; if ( Utils.isEmpty( sourcefilenamefield ) ) { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.SourceFileFieldMissing" ); cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, error_message, stepMeta ); remarks.add( cr ); } else { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.TargetFileFieldOK" ); cr = new CheckResult( CheckResult.TYPE_RESULT_OK, error_message, stepMeta ); remarks.add( cr ); } if ( input.length > 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.ReceivingInfoFromOtherSteps" ), stepMeta ); remarks.add( cr ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.NoInpuReceived" ), stepMeta ); remarks.add( cr ); } } ZipFileMeta(); String getDynamicSourceFileNameField(); void setDynamicSourceFileNameField( String sourcefilenamefield ); String getBaseFolderField(); void setBaseFolderField( String baseFolderField ); String getMoveToFolderField(); void setMoveToFolderField( String movetofolderfield ); String getDynamicTargetFileNameField(); void setDynamicTargetFileNameField( String targetfilenamefield ); boolean isaddTargetFileNametoResult(); boolean isOverwriteZipEntry(); boolean isCreateParentFolder(); boolean isKeepSouceFolder(); void setKeepSouceFolder( boolean value ); void setaddTargetFileNametoResult( boolean addresultfilenames ); void setOverwriteZipEntry( boolean overwritezipentry ); void setCreateParentFolder( boolean createparentfolder ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); Object clone(); void setDefault(); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); boolean supportsErrorHandling(); int getOperationType(); static int getOperationTypeByDesc( String tt ); void setOperationType( int operationType ); static String getOperationTypeDesc( int i ); }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ) { CheckResult cr; String error_message = ""; if ( Utils.isEmpty( sourcefilenamefield ) ) { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.SourceFileFieldMissing" ); cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, error_message, stepMeta ); remarks.add( cr ); } else { error_message = BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.TargetFileFieldOK" ); cr = new CheckResult( CheckResult.TYPE_RESULT_OK, error_message, stepMeta ); remarks.add( cr ); } if ( input.length > 0 ) { cr = new CheckResult( CheckResult.TYPE_RESULT_OK, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.ReceivingInfoFromOtherSteps" ), stepMeta ); remarks.add( cr ); } else { cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, BaseMessages.getString( PKG, "ZipFileMeta.CheckResult.NoInpuReceived" ), stepMeta ); remarks.add( cr ); } } ZipFileMeta(); String getDynamicSourceFileNameField(); void setDynamicSourceFileNameField( String sourcefilenamefield ); String getBaseFolderField(); void setBaseFolderField( String baseFolderField ); String getMoveToFolderField(); void setMoveToFolderField( String movetofolderfield ); String getDynamicTargetFileNameField(); void setDynamicTargetFileNameField( String targetfilenamefield ); boolean isaddTargetFileNametoResult(); boolean isOverwriteZipEntry(); boolean isCreateParentFolder(); boolean isKeepSouceFolder(); void setKeepSouceFolder( boolean value ); void setaddTargetFileNametoResult( boolean addresultfilenames ); void setOverwriteZipEntry( boolean overwritezipentry ); void setCreateParentFolder( boolean createparentfolder ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); Object clone(); void setDefault(); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); boolean supportsErrorHandling(); int getOperationType(); static int getOperationTypeByDesc( String tt ); void setOperationType( int operationType ); static String getOperationTypeDesc( int i ); static final String[] operationTypeDesc; static final String[] operationTypeCode; static final int OPERATION_TYPE_NOTHING; static final int OPERATION_TYPE_MOVE; static final int OPERATION_TYPE_DELETE; }
@Test public void testOnPoolingCheck() throws Exception { }
public void onPoolingCheck() { if ( poolingCheck != null ) { boolean dis = !poolingCheck.isChecked(); if ( poolSizeBox != null ) { poolSizeBox.setDisabled( dis ); } if ( maxPoolSizeBox != null ) { maxPoolSizeBox.setDisabled( dis ); } if ( poolSizeLabel != null ) { poolSizeLabel.setDisabled( dis ); } if ( maxPoolSizeLabel != null ) { maxPoolSizeLabel.setDisabled( dis ); } if ( poolParameterTree != null ) { poolParameterTree.setDisabled( dis ); } if ( poolingParameterDescriptionLabel != null ) { poolingParameterDescriptionLabel.setDisabled( dis ); } if ( poolingDescriptionLabel != null ) { poolingDescriptionLabel.setDisabled( dis ); } if ( poolingDescription != null ) { poolingDescription.setDisabled( dis ); } } }
DataHandler extends AbstractXulEventHandler { public void onPoolingCheck() { if ( poolingCheck != null ) { boolean dis = !poolingCheck.isChecked(); if ( poolSizeBox != null ) { poolSizeBox.setDisabled( dis ); } if ( maxPoolSizeBox != null ) { maxPoolSizeBox.setDisabled( dis ); } if ( poolSizeLabel != null ) { poolSizeLabel.setDisabled( dis ); } if ( maxPoolSizeLabel != null ) { maxPoolSizeLabel.setDisabled( dis ); } if ( poolParameterTree != null ) { poolParameterTree.setDisabled( dis ); } if ( poolingParameterDescriptionLabel != null ) { poolingParameterDescriptionLabel.setDisabled( dis ); } if ( poolingDescriptionLabel != null ) { poolingDescriptionLabel.setDisabled( dis ); } if ( poolingDescription != null ) { poolingDescription.setDisabled( dis ); } } } }
DataHandler extends AbstractXulEventHandler { public void onPoolingCheck() { if ( poolingCheck != null ) { boolean dis = !poolingCheck.isChecked(); if ( poolSizeBox != null ) { poolSizeBox.setDisabled( dis ); } if ( maxPoolSizeBox != null ) { maxPoolSizeBox.setDisabled( dis ); } if ( poolSizeLabel != null ) { poolSizeLabel.setDisabled( dis ); } if ( maxPoolSizeLabel != null ) { maxPoolSizeLabel.setDisabled( dis ); } if ( poolParameterTree != null ) { poolParameterTree.setDisabled( dis ); } if ( poolingParameterDescriptionLabel != null ) { poolingParameterDescriptionLabel.setDisabled( dis ); } if ( poolingDescriptionLabel != null ) { poolingDescriptionLabel.setDisabled( dis ); } if ( poolingDescription != null ) { poolingDescription.setDisabled( dis ); } } } DataHandler(); }
DataHandler extends AbstractXulEventHandler { public void onPoolingCheck() { if ( poolingCheck != null ) { boolean dis = !poolingCheck.isChecked(); if ( poolSizeBox != null ) { poolSizeBox.setDisabled( dis ); } if ( maxPoolSizeBox != null ) { maxPoolSizeBox.setDisabled( dis ); } if ( poolSizeLabel != null ) { poolSizeLabel.setDisabled( dis ); } if ( maxPoolSizeLabel != null ) { maxPoolSizeLabel.setDisabled( dis ); } if ( poolParameterTree != null ) { poolParameterTree.setDisabled( dis ); } if ( poolingParameterDescriptionLabel != null ) { poolingParameterDescriptionLabel.setDisabled( dis ); } if ( poolingDescriptionLabel != null ) { poolingDescriptionLabel.setDisabled( dis ); } if ( poolingDescription != null ) { poolingDescription.setDisabled( dis ); } } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); }
DataHandler extends AbstractXulEventHandler { public void onPoolingCheck() { if ( poolingCheck != null ) { boolean dis = !poolingCheck.isChecked(); if ( poolSizeBox != null ) { poolSizeBox.setDisabled( dis ); } if ( maxPoolSizeBox != null ) { maxPoolSizeBox.setDisabled( dis ); } if ( poolSizeLabel != null ) { poolSizeLabel.setDisabled( dis ); } if ( maxPoolSizeLabel != null ) { maxPoolSizeLabel.setDisabled( dis ); } if ( poolParameterTree != null ) { poolParameterTree.setDisabled( dis ); } if ( poolingParameterDescriptionLabel != null ) { poolingParameterDescriptionLabel.setDisabled( dis ); } if ( poolingDescriptionLabel != null ) { poolingDescriptionLabel.setDisabled( dis ); } if ( poolingDescription != null ) { poolingDescription.setDisabled( dis ); } } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); static final SortedMap<String, DatabaseInterface> connectionMap; static final Map<String, String> connectionNametoID; }
@Test public void testGetStep() throws Exception { StepMeta stepInfo = mock( StepMeta.class ); when( stepInfo.getName() ).thenReturn( "Zip Step Name" ); StepDataInterface stepData = mock( StepDataInterface.class ); TransMeta transMeta = mock( TransMeta.class ); when( transMeta.findStep( "Zip Step Name" ) ).thenReturn( stepInfo ); Trans trans = mock( Trans.class ); ZipFileMeta zipFileMeta = new ZipFileMeta(); ZipFile zipFile = (ZipFile) zipFileMeta.getStep( stepInfo, stepData, 0, transMeta, trans ); assertEquals( stepInfo, zipFile.getStepMeta() ); assertEquals( stepData, zipFile.getStepDataInterface() ); assertEquals( transMeta, zipFile.getTransMeta() ); assertEquals( trans, zipFile.getTrans() ); assertEquals( 0, zipFile.getCopy() ); }
public StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ) { return new ZipFile( stepMeta, stepDataInterface, cnr, transMeta, trans ); }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ) { return new ZipFile( stepMeta, stepDataInterface, cnr, transMeta, trans ); } }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ) { return new ZipFile( stepMeta, stepDataInterface, cnr, transMeta, trans ); } ZipFileMeta(); }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ) { return new ZipFile( stepMeta, stepDataInterface, cnr, transMeta, trans ); } ZipFileMeta(); String getDynamicSourceFileNameField(); void setDynamicSourceFileNameField( String sourcefilenamefield ); String getBaseFolderField(); void setBaseFolderField( String baseFolderField ); String getMoveToFolderField(); void setMoveToFolderField( String movetofolderfield ); String getDynamicTargetFileNameField(); void setDynamicTargetFileNameField( String targetfilenamefield ); boolean isaddTargetFileNametoResult(); boolean isOverwriteZipEntry(); boolean isCreateParentFolder(); boolean isKeepSouceFolder(); void setKeepSouceFolder( boolean value ); void setaddTargetFileNametoResult( boolean addresultfilenames ); void setOverwriteZipEntry( boolean overwritezipentry ); void setCreateParentFolder( boolean createparentfolder ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); Object clone(); void setDefault(); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); boolean supportsErrorHandling(); int getOperationType(); static int getOperationTypeByDesc( String tt ); void setOperationType( int operationType ); static String getOperationTypeDesc( int i ); }
ZipFileMeta extends BaseStepMeta implements StepMetaInterface { public StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ) { return new ZipFile( stepMeta, stepDataInterface, cnr, transMeta, trans ); } ZipFileMeta(); String getDynamicSourceFileNameField(); void setDynamicSourceFileNameField( String sourcefilenamefield ); String getBaseFolderField(); void setBaseFolderField( String baseFolderField ); String getMoveToFolderField(); void setMoveToFolderField( String movetofolderfield ); String getDynamicTargetFileNameField(); void setDynamicTargetFileNameField( String targetfilenamefield ); boolean isaddTargetFileNametoResult(); boolean isOverwriteZipEntry(); boolean isCreateParentFolder(); boolean isKeepSouceFolder(); void setKeepSouceFolder( boolean value ); void setaddTargetFileNametoResult( boolean addresultfilenames ); void setOverwriteZipEntry( boolean overwritezipentry ); void setCreateParentFolder( boolean createparentfolder ); void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); Object clone(); void setDefault(); String getXML(); void readRep( Repository rep, IMetaStore metaStore, ObjectId id_step, List<DatabaseMeta> databases ); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step ); void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); StepDataInterface getStepData(); boolean supportsErrorHandling(); int getOperationType(); static int getOperationTypeByDesc( String tt ); void setOperationType( int operationType ); static String getOperationTypeDesc( int i ); static final String[] operationTypeDesc; static final String[] operationTypeCode; static final int OPERATION_TYPE_NOTHING; static final int OPERATION_TYPE_MOVE; static final int OPERATION_TYPE_DELETE; }
@Test public void testCloseFileDataOutIsNullCase() { textFileOutput = new TextFileOutput( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta, stepMockHelper.trans ); textFileOutput.data = Mockito.mock( TextFileOutputData.class ); Assert.assertNull( textFileOutput.data.out ); textFileOutput.closeFile(); }
protected boolean closeFile() { boolean retval = false; try { if ( data.writer != null ) { data.writer.flush(); if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Closing output stream" ); } data.writer.close(); if ( log.isDebug() ) { logDebug( "Closed output stream" ); } } } data.writer = null; if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Ending running external command" ); } int procStatus = data.cmdProc.waitFor(); try { data.cmdProc.getErrorStream().close(); data.cmdProc.getOutputStream().flush(); data.cmdProc.getOutputStream().close(); data.cmdProc.getInputStream().close(); } catch ( IOException e ) { if ( log.isDetailed() ) { logDetailed( "Warning: Error closing streams: " + e.getMessage() ); } } data.cmdProc = null; if ( log.isBasic() && procStatus != 0 ) { logBasic( "Command exit status: " + procStatus ); } } else { if ( log.isDebug() ) { logDebug( "Closing normal file ..." ); } if ( data.out != null ) { data.out.close(); } if ( data.fos != null ) { data.fos.close(); data.fos = null; } } retval = true; } catch ( Exception e ) { logError( "Exception trying to close file: " + e.toString() ); setErrors( 1 ); retval = false; } return retval; }
TextFileOutput extends BaseStep implements StepInterface { protected boolean closeFile() { boolean retval = false; try { if ( data.writer != null ) { data.writer.flush(); if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Closing output stream" ); } data.writer.close(); if ( log.isDebug() ) { logDebug( "Closed output stream" ); } } } data.writer = null; if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Ending running external command" ); } int procStatus = data.cmdProc.waitFor(); try { data.cmdProc.getErrorStream().close(); data.cmdProc.getOutputStream().flush(); data.cmdProc.getOutputStream().close(); data.cmdProc.getInputStream().close(); } catch ( IOException e ) { if ( log.isDetailed() ) { logDetailed( "Warning: Error closing streams: " + e.getMessage() ); } } data.cmdProc = null; if ( log.isBasic() && procStatus != 0 ) { logBasic( "Command exit status: " + procStatus ); } } else { if ( log.isDebug() ) { logDebug( "Closing normal file ..." ); } if ( data.out != null ) { data.out.close(); } if ( data.fos != null ) { data.fos.close(); data.fos = null; } } retval = true; } catch ( Exception e ) { logError( "Exception trying to close file: " + e.toString() ); setErrors( 1 ); retval = false; } return retval; } }
TextFileOutput extends BaseStep implements StepInterface { protected boolean closeFile() { boolean retval = false; try { if ( data.writer != null ) { data.writer.flush(); if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Closing output stream" ); } data.writer.close(); if ( log.isDebug() ) { logDebug( "Closed output stream" ); } } } data.writer = null; if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Ending running external command" ); } int procStatus = data.cmdProc.waitFor(); try { data.cmdProc.getErrorStream().close(); data.cmdProc.getOutputStream().flush(); data.cmdProc.getOutputStream().close(); data.cmdProc.getInputStream().close(); } catch ( IOException e ) { if ( log.isDetailed() ) { logDetailed( "Warning: Error closing streams: " + e.getMessage() ); } } data.cmdProc = null; if ( log.isBasic() && procStatus != 0 ) { logBasic( "Command exit status: " + procStatus ); } } else { if ( log.isDebug() ) { logDebug( "Closing normal file ..." ); } if ( data.out != null ) { data.out.close(); } if ( data.fos != null ) { data.fos.close(); data.fos = null; } } retval = true; } catch ( Exception e ) { logError( "Exception trying to close file: " + e.toString() ); setErrors( 1 ); retval = false; } return retval; } TextFileOutput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
TextFileOutput extends BaseStep implements StepInterface { protected boolean closeFile() { boolean retval = false; try { if ( data.writer != null ) { data.writer.flush(); if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Closing output stream" ); } data.writer.close(); if ( log.isDebug() ) { logDebug( "Closed output stream" ); } } } data.writer = null; if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Ending running external command" ); } int procStatus = data.cmdProc.waitFor(); try { data.cmdProc.getErrorStream().close(); data.cmdProc.getOutputStream().flush(); data.cmdProc.getOutputStream().close(); data.cmdProc.getInputStream().close(); } catch ( IOException e ) { if ( log.isDetailed() ) { logDetailed( "Warning: Error closing streams: " + e.getMessage() ); } } data.cmdProc = null; if ( log.isBasic() && procStatus != 0 ) { logBasic( "Command exit status: " + procStatus ); } } else { if ( log.isDebug() ) { logDebug( "Closing normal file ..." ); } if ( data.out != null ) { data.out.close(); } if ( data.fos != null ) { data.fos.close(); data.fos = null; } } retval = true; } catch ( Exception e ) { logError( "Exception trying to close file: " + e.toString() ); setErrors( 1 ); retval = false; } return retval; } TextFileOutput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); synchronized boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void writeRowToFile( RowMetaInterface rowMeta, Object[] r ); String buildFilename( String filename, boolean ziparchive ); void openNewFile( String baseFilename ); boolean checkPreviouslyOpened( String filename ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean containsSeparatorOrEnclosure( byte[] source, byte[] separator, byte[] enclosure ); }
TextFileOutput extends BaseStep implements StepInterface { protected boolean closeFile() { boolean retval = false; try { if ( data.writer != null ) { data.writer.flush(); if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Closing output stream" ); } data.writer.close(); if ( log.isDebug() ) { logDebug( "Closed output stream" ); } } } data.writer = null; if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Ending running external command" ); } int procStatus = data.cmdProc.waitFor(); try { data.cmdProc.getErrorStream().close(); data.cmdProc.getOutputStream().flush(); data.cmdProc.getOutputStream().close(); data.cmdProc.getInputStream().close(); } catch ( IOException e ) { if ( log.isDetailed() ) { logDetailed( "Warning: Error closing streams: " + e.getMessage() ); } } data.cmdProc = null; if ( log.isBasic() && procStatus != 0 ) { logBasic( "Command exit status: " + procStatus ); } } else { if ( log.isDebug() ) { logDebug( "Closing normal file ..." ); } if ( data.out != null ) { data.out.close(); } if ( data.fos != null ) { data.fos.close(); data.fos = null; } } retval = true; } catch ( Exception e ) { logError( "Exception trying to close file: " + e.toString() ); setErrors( 1 ); retval = false; } return retval; } TextFileOutput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); synchronized boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void writeRowToFile( RowMetaInterface rowMeta, Object[] r ); String buildFilename( String filename, boolean ziparchive ); void openNewFile( String baseFilename ); boolean checkPreviouslyOpened( String filename ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean containsSeparatorOrEnclosure( byte[] source, byte[] separator, byte[] enclosure ); public TextFileOutputMeta meta; public TextFileOutputData data; }
@Test public void testCloseFileDataOutIsNotNullCase() throws IOException { textFileOutput = new TextFileOutput( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta, stepMockHelper.trans ); textFileOutput.data = Mockito.mock( TextFileOutputData.class ); textFileOutput.data.out = Mockito.mock( CompressionOutputStream.class ); textFileOutput.closeFile(); Mockito.verify( textFileOutput.data.out, Mockito.times( 1 ) ).close(); }
protected boolean closeFile() { boolean retval = false; try { if ( data.writer != null ) { data.writer.flush(); if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Closing output stream" ); } data.writer.close(); if ( log.isDebug() ) { logDebug( "Closed output stream" ); } } } data.writer = null; if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Ending running external command" ); } int procStatus = data.cmdProc.waitFor(); try { data.cmdProc.getErrorStream().close(); data.cmdProc.getOutputStream().flush(); data.cmdProc.getOutputStream().close(); data.cmdProc.getInputStream().close(); } catch ( IOException e ) { if ( log.isDetailed() ) { logDetailed( "Warning: Error closing streams: " + e.getMessage() ); } } data.cmdProc = null; if ( log.isBasic() && procStatus != 0 ) { logBasic( "Command exit status: " + procStatus ); } } else { if ( log.isDebug() ) { logDebug( "Closing normal file ..." ); } if ( data.out != null ) { data.out.close(); } if ( data.fos != null ) { data.fos.close(); data.fos = null; } } retval = true; } catch ( Exception e ) { logError( "Exception trying to close file: " + e.toString() ); setErrors( 1 ); retval = false; } return retval; }
TextFileOutput extends BaseStep implements StepInterface { protected boolean closeFile() { boolean retval = false; try { if ( data.writer != null ) { data.writer.flush(); if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Closing output stream" ); } data.writer.close(); if ( log.isDebug() ) { logDebug( "Closed output stream" ); } } } data.writer = null; if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Ending running external command" ); } int procStatus = data.cmdProc.waitFor(); try { data.cmdProc.getErrorStream().close(); data.cmdProc.getOutputStream().flush(); data.cmdProc.getOutputStream().close(); data.cmdProc.getInputStream().close(); } catch ( IOException e ) { if ( log.isDetailed() ) { logDetailed( "Warning: Error closing streams: " + e.getMessage() ); } } data.cmdProc = null; if ( log.isBasic() && procStatus != 0 ) { logBasic( "Command exit status: " + procStatus ); } } else { if ( log.isDebug() ) { logDebug( "Closing normal file ..." ); } if ( data.out != null ) { data.out.close(); } if ( data.fos != null ) { data.fos.close(); data.fos = null; } } retval = true; } catch ( Exception e ) { logError( "Exception trying to close file: " + e.toString() ); setErrors( 1 ); retval = false; } return retval; } }
TextFileOutput extends BaseStep implements StepInterface { protected boolean closeFile() { boolean retval = false; try { if ( data.writer != null ) { data.writer.flush(); if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Closing output stream" ); } data.writer.close(); if ( log.isDebug() ) { logDebug( "Closed output stream" ); } } } data.writer = null; if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Ending running external command" ); } int procStatus = data.cmdProc.waitFor(); try { data.cmdProc.getErrorStream().close(); data.cmdProc.getOutputStream().flush(); data.cmdProc.getOutputStream().close(); data.cmdProc.getInputStream().close(); } catch ( IOException e ) { if ( log.isDetailed() ) { logDetailed( "Warning: Error closing streams: " + e.getMessage() ); } } data.cmdProc = null; if ( log.isBasic() && procStatus != 0 ) { logBasic( "Command exit status: " + procStatus ); } } else { if ( log.isDebug() ) { logDebug( "Closing normal file ..." ); } if ( data.out != null ) { data.out.close(); } if ( data.fos != null ) { data.fos.close(); data.fos = null; } } retval = true; } catch ( Exception e ) { logError( "Exception trying to close file: " + e.toString() ); setErrors( 1 ); retval = false; } return retval; } TextFileOutput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
TextFileOutput extends BaseStep implements StepInterface { protected boolean closeFile() { boolean retval = false; try { if ( data.writer != null ) { data.writer.flush(); if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Closing output stream" ); } data.writer.close(); if ( log.isDebug() ) { logDebug( "Closed output stream" ); } } } data.writer = null; if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Ending running external command" ); } int procStatus = data.cmdProc.waitFor(); try { data.cmdProc.getErrorStream().close(); data.cmdProc.getOutputStream().flush(); data.cmdProc.getOutputStream().close(); data.cmdProc.getInputStream().close(); } catch ( IOException e ) { if ( log.isDetailed() ) { logDetailed( "Warning: Error closing streams: " + e.getMessage() ); } } data.cmdProc = null; if ( log.isBasic() && procStatus != 0 ) { logBasic( "Command exit status: " + procStatus ); } } else { if ( log.isDebug() ) { logDebug( "Closing normal file ..." ); } if ( data.out != null ) { data.out.close(); } if ( data.fos != null ) { data.fos.close(); data.fos = null; } } retval = true; } catch ( Exception e ) { logError( "Exception trying to close file: " + e.toString() ); setErrors( 1 ); retval = false; } return retval; } TextFileOutput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); synchronized boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void writeRowToFile( RowMetaInterface rowMeta, Object[] r ); String buildFilename( String filename, boolean ziparchive ); void openNewFile( String baseFilename ); boolean checkPreviouslyOpened( String filename ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean containsSeparatorOrEnclosure( byte[] source, byte[] separator, byte[] enclosure ); }
TextFileOutput extends BaseStep implements StepInterface { protected boolean closeFile() { boolean retval = false; try { if ( data.writer != null ) { data.writer.flush(); if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Closing output stream" ); } data.writer.close(); if ( log.isDebug() ) { logDebug( "Closed output stream" ); } } } data.writer = null; if ( data.cmdProc != null ) { if ( log.isDebug() ) { logDebug( "Ending running external command" ); } int procStatus = data.cmdProc.waitFor(); try { data.cmdProc.getErrorStream().close(); data.cmdProc.getOutputStream().flush(); data.cmdProc.getOutputStream().close(); data.cmdProc.getInputStream().close(); } catch ( IOException e ) { if ( log.isDetailed() ) { logDetailed( "Warning: Error closing streams: " + e.getMessage() ); } } data.cmdProc = null; if ( log.isBasic() && procStatus != 0 ) { logBasic( "Command exit status: " + procStatus ); } } else { if ( log.isDebug() ) { logDebug( "Closing normal file ..." ); } if ( data.out != null ) { data.out.close(); } if ( data.fos != null ) { data.fos.close(); data.fos = null; } } retval = true; } catch ( Exception e ) { logError( "Exception trying to close file: " + e.toString() ); setErrors( 1 ); retval = false; } return retval; } TextFileOutput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); synchronized boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void writeRowToFile( RowMetaInterface rowMeta, Object[] r ); String buildFilename( String filename, boolean ziparchive ); void openNewFile( String baseFilename ); boolean checkPreviouslyOpened( String filename ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean containsSeparatorOrEnclosure( byte[] source, byte[] separator, byte[] enclosure ); public TextFileOutputMeta meta; public TextFileOutputData data; }
@Test public void testFastDumpDisableStreamEncodeTest() throws Exception { textFileOutput = new TextFileOutputTestHandler( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta, stepMockHelper.trans ); textFileOutput.meta = stepMockHelper.processRowsStepMetaInterface; String testString = "ÖÜä"; String inputEncode = "UTF-8"; String outputEncode = "Windows-1252"; Object[] rows = {testString.getBytes( inputEncode )}; ValueMetaBase valueMetaInterface = new ValueMetaBase( "test", ValueMetaInterface.TYPE_STRING ); valueMetaInterface.setStringEncoding( inputEncode ); valueMetaInterface.setStorageType( ValueMetaInterface.STORAGE_TYPE_BINARY_STRING ); valueMetaInterface.setStorageMetadata( new ValueMetaString() ); TextFileOutputData data = new TextFileOutputData(); data.binarySeparator = " ".getBytes(); data.binaryEnclosure = "\"".getBytes(); data.binaryNewline = "\n".getBytes(); textFileOutput.data = data; RowMeta rowMeta = new RowMeta(); rowMeta.addValueMeta( valueMetaInterface ); Mockito.doReturn( outputEncode ).when( stepMockHelper.processRowsStepMetaInterface ).getEncoding(); textFileOutput.data.writer = Mockito.mock( BufferedOutputStream.class ); textFileOutput.writeRowToFile( rowMeta, rows ); Mockito.verify( textFileOutput.data.writer, Mockito.times( 1 ) ).write( testString.getBytes( outputEncode ) ); }
public void writeRowToFile( RowMetaInterface rowMeta, Object[] r ) throws KettleStepException { try { if ( meta.getOutputFields() == null || meta.getOutputFields().length == 0 ) { for ( int i = 0; i < rowMeta.size(); i++ ) { if ( i > 0 && data.binarySeparator.length > 0 ) { data.writer.write( data.binarySeparator ); } ValueMetaInterface v = rowMeta.getValueMeta( i ); Object valueData = r[i]; writeField( v, valueData, null ); } data.writer.write( data.binaryNewline ); } else { for ( int i = 0; i < meta.getOutputFields().length; i++ ) { if ( i > 0 && data.binarySeparator.length > 0 ) { data.writer.write( data.binarySeparator ); } ValueMetaInterface v = rowMeta.getValueMeta( data.fieldnrs[i] ); Object valueData = r[data.fieldnrs[i]]; writeField( v, valueData, data.binaryNullValue[i] ); } data.writer.write( data.binaryNewline ); } incrementLinesOutput(); } catch ( Exception e ) { throw new KettleStepException( "Error writing line", e ); } }
TextFileOutput extends BaseStep implements StepInterface { public void writeRowToFile( RowMetaInterface rowMeta, Object[] r ) throws KettleStepException { try { if ( meta.getOutputFields() == null || meta.getOutputFields().length == 0 ) { for ( int i = 0; i < rowMeta.size(); i++ ) { if ( i > 0 && data.binarySeparator.length > 0 ) { data.writer.write( data.binarySeparator ); } ValueMetaInterface v = rowMeta.getValueMeta( i ); Object valueData = r[i]; writeField( v, valueData, null ); } data.writer.write( data.binaryNewline ); } else { for ( int i = 0; i < meta.getOutputFields().length; i++ ) { if ( i > 0 && data.binarySeparator.length > 0 ) { data.writer.write( data.binarySeparator ); } ValueMetaInterface v = rowMeta.getValueMeta( data.fieldnrs[i] ); Object valueData = r[data.fieldnrs[i]]; writeField( v, valueData, data.binaryNullValue[i] ); } data.writer.write( data.binaryNewline ); } incrementLinesOutput(); } catch ( Exception e ) { throw new KettleStepException( "Error writing line", e ); } } }
TextFileOutput extends BaseStep implements StepInterface { public void writeRowToFile( RowMetaInterface rowMeta, Object[] r ) throws KettleStepException { try { if ( meta.getOutputFields() == null || meta.getOutputFields().length == 0 ) { for ( int i = 0; i < rowMeta.size(); i++ ) { if ( i > 0 && data.binarySeparator.length > 0 ) { data.writer.write( data.binarySeparator ); } ValueMetaInterface v = rowMeta.getValueMeta( i ); Object valueData = r[i]; writeField( v, valueData, null ); } data.writer.write( data.binaryNewline ); } else { for ( int i = 0; i < meta.getOutputFields().length; i++ ) { if ( i > 0 && data.binarySeparator.length > 0 ) { data.writer.write( data.binarySeparator ); } ValueMetaInterface v = rowMeta.getValueMeta( data.fieldnrs[i] ); Object valueData = r[data.fieldnrs[i]]; writeField( v, valueData, data.binaryNullValue[i] ); } data.writer.write( data.binaryNewline ); } incrementLinesOutput(); } catch ( Exception e ) { throw new KettleStepException( "Error writing line", e ); } } TextFileOutput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
TextFileOutput extends BaseStep implements StepInterface { public void writeRowToFile( RowMetaInterface rowMeta, Object[] r ) throws KettleStepException { try { if ( meta.getOutputFields() == null || meta.getOutputFields().length == 0 ) { for ( int i = 0; i < rowMeta.size(); i++ ) { if ( i > 0 && data.binarySeparator.length > 0 ) { data.writer.write( data.binarySeparator ); } ValueMetaInterface v = rowMeta.getValueMeta( i ); Object valueData = r[i]; writeField( v, valueData, null ); } data.writer.write( data.binaryNewline ); } else { for ( int i = 0; i < meta.getOutputFields().length; i++ ) { if ( i > 0 && data.binarySeparator.length > 0 ) { data.writer.write( data.binarySeparator ); } ValueMetaInterface v = rowMeta.getValueMeta( data.fieldnrs[i] ); Object valueData = r[data.fieldnrs[i]]; writeField( v, valueData, data.binaryNullValue[i] ); } data.writer.write( data.binaryNewline ); } incrementLinesOutput(); } catch ( Exception e ) { throw new KettleStepException( "Error writing line", e ); } } TextFileOutput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); synchronized boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void writeRowToFile( RowMetaInterface rowMeta, Object[] r ); String buildFilename( String filename, boolean ziparchive ); void openNewFile( String baseFilename ); boolean checkPreviouslyOpened( String filename ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean containsSeparatorOrEnclosure( byte[] source, byte[] separator, byte[] enclosure ); }
TextFileOutput extends BaseStep implements StepInterface { public void writeRowToFile( RowMetaInterface rowMeta, Object[] r ) throws KettleStepException { try { if ( meta.getOutputFields() == null || meta.getOutputFields().length == 0 ) { for ( int i = 0; i < rowMeta.size(); i++ ) { if ( i > 0 && data.binarySeparator.length > 0 ) { data.writer.write( data.binarySeparator ); } ValueMetaInterface v = rowMeta.getValueMeta( i ); Object valueData = r[i]; writeField( v, valueData, null ); } data.writer.write( data.binaryNewline ); } else { for ( int i = 0; i < meta.getOutputFields().length; i++ ) { if ( i > 0 && data.binarySeparator.length > 0 ) { data.writer.write( data.binarySeparator ); } ValueMetaInterface v = rowMeta.getValueMeta( data.fieldnrs[i] ); Object valueData = r[data.fieldnrs[i]]; writeField( v, valueData, data.binaryNullValue[i] ); } data.writer.write( data.binaryNewline ); } incrementLinesOutput(); } catch ( Exception e ) { throw new KettleStepException( "Error writing line", e ); } } TextFileOutput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); synchronized boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void writeRowToFile( RowMetaInterface rowMeta, Object[] r ); String buildFilename( String filename, boolean ziparchive ); void openNewFile( String baseFilename ); boolean checkPreviouslyOpened( String filename ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean containsSeparatorOrEnclosure( byte[] source, byte[] separator, byte[] enclosure ); public TextFileOutputMeta meta; public TextFileOutputData data; }
@Test public void testCreateMultivalueMap() { StepMeta stepMeta = new StepMeta(); stepMeta.setName( "TestRest" ); TransMeta transMeta = new TransMeta(); transMeta.setName( "TestRest" ); transMeta.addStep( stepMeta ); Rest rest = new Rest( stepMeta, Mockito.mock( StepDataInterface.class ), 1, transMeta, Mockito.mock( Trans.class ) ); MultivaluedMapImpl map = rest.createMultivalueMap( "param1", "{a:{[val1]}}" ); String val1 = map.getFirst( "param1" ); Assert.assertTrue( val1.contains( "%7D" ) ); }
MultivaluedMapImpl createMultivalueMap( String paramName, String paramValue ) { MultivaluedMapImpl queryParams = new MultivaluedMapImpl(); queryParams.add( paramName, UriComponent.encode( paramValue, UriComponent.Type.QUERY_PARAM ) ); return queryParams; }
Rest extends BaseStep implements StepInterface { MultivaluedMapImpl createMultivalueMap( String paramName, String paramValue ) { MultivaluedMapImpl queryParams = new MultivaluedMapImpl(); queryParams.add( paramName, UriComponent.encode( paramValue, UriComponent.Type.QUERY_PARAM ) ); return queryParams; } }
Rest extends BaseStep implements StepInterface { MultivaluedMapImpl createMultivalueMap( String paramName, String paramValue ) { MultivaluedMapImpl queryParams = new MultivaluedMapImpl(); queryParams.add( paramName, UriComponent.encode( paramValue, UriComponent.Type.QUERY_PARAM ) ); return queryParams; } Rest( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
Rest extends BaseStep implements StepInterface { MultivaluedMapImpl createMultivalueMap( String paramName, String paramValue ) { MultivaluedMapImpl queryParams = new MultivaluedMapImpl(); queryParams.add( paramName, UriComponent.encode( paramValue, UriComponent.Type.QUERY_PARAM ) ); return queryParams; } Rest( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
Rest extends BaseStep implements StepInterface { MultivaluedMapImpl createMultivalueMap( String paramName, String paramValue ) { MultivaluedMapImpl queryParams = new MultivaluedMapImpl(); queryParams.add( paramName, UriComponent.encode( paramValue, UriComponent.Type.QUERY_PARAM ) ); return queryParams; } Rest( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void checkThatMethodPerformedWithoutError() throws Exception { getJoinRows().dispose( meta, data ); }
public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; if ( data.file != null ) { for ( int i = 1; i < data.file.length; i++ ) { if ( data.file[i] != null ) { data.file[i].delete(); } } } super.dispose( meta, data ); }
JoinRows extends BaseStep implements StepInterface { public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; if ( data.file != null ) { for ( int i = 1; i < data.file.length; i++ ) { if ( data.file[i] != null ) { data.file[i].delete(); } } } super.dispose( meta, data ); } }
JoinRows extends BaseStep implements StepInterface { public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; if ( data.file != null ) { for ( int i = 1; i < data.file.length; i++ ) { if ( data.file[i] != null ) { data.file[i].delete(); } } } super.dispose( meta, data ); } JoinRows( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
JoinRows extends BaseStep implements StepInterface { public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; if ( data.file != null ) { for ( int i = 1; i < data.file.length; i++ ) { if ( data.file[i] != null ) { data.file[i].delete(); } } } super.dispose( meta, data ); } JoinRows( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); @SuppressWarnings( "unchecked" ) void initialize(); Object[] getRowData( int filenr ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); @Override void batchComplete(); }
JoinRows extends BaseStep implements StepInterface { public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; if ( data.file != null ) { for ( int i = 1; i < data.file.length; i++ ) { if ( data.file[i] != null ) { data.file[i].delete(); } } } super.dispose( meta, data ); } JoinRows( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); @SuppressWarnings( "unchecked" ) void initialize(); Object[] getRowData( int filenr ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); @Override void batchComplete(); }
@Test public void disposeDataFiles() throws Exception { File mockFile1 = mock( File.class ); File mockFile2 = mock( File.class ); data.file = new File[] {null, mockFile1, mockFile2}; getJoinRows().dispose( meta, data ); verify( mockFile1, times( 1 ) ).delete(); verify( mockFile2, times( 1 ) ).delete(); }
public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; if ( data.file != null ) { for ( int i = 1; i < data.file.length; i++ ) { if ( data.file[i] != null ) { data.file[i].delete(); } } } super.dispose( meta, data ); }
JoinRows extends BaseStep implements StepInterface { public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; if ( data.file != null ) { for ( int i = 1; i < data.file.length; i++ ) { if ( data.file[i] != null ) { data.file[i].delete(); } } } super.dispose( meta, data ); } }
JoinRows extends BaseStep implements StepInterface { public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; if ( data.file != null ) { for ( int i = 1; i < data.file.length; i++ ) { if ( data.file[i] != null ) { data.file[i].delete(); } } } super.dispose( meta, data ); } JoinRows( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
JoinRows extends BaseStep implements StepInterface { public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; if ( data.file != null ) { for ( int i = 1; i < data.file.length; i++ ) { if ( data.file[i] != null ) { data.file[i].delete(); } } } super.dispose( meta, data ); } JoinRows( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); @SuppressWarnings( "unchecked" ) void initialize(); Object[] getRowData( int filenr ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); @Override void batchComplete(); }
JoinRows extends BaseStep implements StepInterface { public void dispose( StepMetaInterface smi, StepDataInterface sdi ) { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; if ( data.file != null ) { for ( int i = 1; i < data.file.length; i++ ) { if ( data.file[i] != null ) { data.file[i].delete(); } } } super.dispose( meta, data ); } JoinRows( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); @SuppressWarnings( "unchecked" ) void initialize(); Object[] getRowData( int filenr ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); @Override void batchComplete(); }
@Test public void testJoinRowsStep() throws Exception { JoinRowsMeta joinRowsMeta = new JoinRowsMeta(); joinRowsMeta.setMainStepname( "main step name" ); joinRowsMeta.setPrefix( "out" ); joinRowsMeta.setCacheSize( 3 ); JoinRowsData joinRowsData = new JoinRowsData(); JoinRows joinRows = getJoinRows(); joinRows.getTrans().setRunning( true ); joinRows.init( joinRowsMeta, joinRowsData ); List<RowSet> rowSets = new ArrayList<>(); rowSets.add( getRowSetWithData( 3, "main --", true ) ); rowSets.add( getRowSetWithData( 3, "secondary --", false ) ); joinRows.setInputRowSets( rowSets ); RowStepCollector rowStepCollector = new RowStepCollector(); joinRows.addRowListener( rowStepCollector ); joinRows.getLogChannel().setLogLevel( LogLevel.ROWLEVEL ); KettleLogStore.init(); while ( true ) { if ( !joinRows.processRow( joinRowsMeta, joinRowsData ) ) { break; } } rowStepCollector.getRowsWritten(); assertEquals( 9, rowStepCollector.getRowsWritten().size() ); assertEquals( 6, rowStepCollector.getRowsRead().size() ); Object[][] expectedResult = createExpectedResult(); List<Object[]> rowWritten = rowStepCollector.getRowsWritten().stream().map( RowMetaAndData::getData ).collect( Collectors.toList() ); for ( int i = 0; i < 9; i++ ) { assertTrue( Arrays.equals( expectedResult[i], rowWritten.get( i ) ) ); } }
public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; if ( first ) { first = false; initialize(); } if ( data.caching ) { if ( !cacheInputRow() ) { return false; } } else { if ( !outputRow() ) { return false; } } return true; }
JoinRows extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; if ( first ) { first = false; initialize(); } if ( data.caching ) { if ( !cacheInputRow() ) { return false; } } else { if ( !outputRow() ) { return false; } } return true; } }
JoinRows extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; if ( first ) { first = false; initialize(); } if ( data.caching ) { if ( !cacheInputRow() ) { return false; } } else { if ( !outputRow() ) { return false; } } return true; } JoinRows( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
JoinRows extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; if ( first ) { first = false; initialize(); } if ( data.caching ) { if ( !cacheInputRow() ) { return false; } } else { if ( !outputRow() ) { return false; } } return true; } JoinRows( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); @SuppressWarnings( "unchecked" ) void initialize(); Object[] getRowData( int filenr ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); @Override void batchComplete(); }
JoinRows extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (JoinRowsMeta) smi; data = (JoinRowsData) sdi; if ( first ) { first = false; initialize(); } if ( data.caching ) { if ( !cacheInputRow() ) { return false; } } else { if ( !outputRow() ) { return false; } } return true; } JoinRows( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); @SuppressWarnings( "unchecked" ) void initialize(); Object[] getRowData( int filenr ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); @Override void batchComplete(); }
@Test public void testDimInsert() throws Exception { RowMetaInterface rowMetaInterface = mock( RowMetaInterface.class ); Object[] objects = mock( List.class ).toArray(); Date date = mock( Date.class ); dimensionLookupSpy.dimInsert( rowMetaInterface, objects, new Long( "132323" ), true, null, date, date ); verify( databaseMeta, times( 0 ) ).supportsAutoGeneratedKeys(); dimensionLookupSpy.dimInsert( rowMetaInterface, objects, null, true, null, date, date ); verify( databaseMeta, times( 2 ) ).supportsAutoGeneratedKeys(); }
public Long dimInsert( RowMetaInterface inputRowMeta, Object[] row, Long technicalKey, boolean newEntry, Long versionNr, Date dateFrom, Date dateTo ) throws KettleException { DatabaseMeta databaseMeta = meta.getDatabaseMeta(); if ( data.prepStatementInsert == null && data.prepStatementUpdate == null ) { RowMetaInterface insertRowMeta = new RowMeta(); String sql = "INSERT INTO " + data.schemaTable + "( "; if ( !isAutoIncrement() ) { sql += databaseMeta.quoteField( meta.getKeyField() ) + ", "; insertRowMeta.addValueMeta( data.outputRowMeta.getValueMeta( inputRowMeta.size() ) ); } else { if ( databaseMeta.needsPlaceHolder() ) { sql += "0, "; } } sql += databaseMeta.quoteField( meta.getVersionField() ) + ", " + databaseMeta.quoteField( meta.getDateFrom() ) + ", " + databaseMeta.quoteField( meta.getDateTo() ); insertRowMeta.addValueMeta( new ValueMetaInteger( meta.getVersionField() ) ); insertRowMeta.addValueMeta( new ValueMetaDate( meta.getDateFrom() ) ); insertRowMeta.addValueMeta( new ValueMetaDate( meta.getDateTo() ) ); for ( int i = 0; i < meta.getKeyLookup().length; i++ ) { sql += ", " + databaseMeta.quoteField( meta.getKeyLookup()[i] ); insertRowMeta.addValueMeta( inputRowMeta.getValueMeta( data.keynrs[i] ) ); } for ( int i = 0; i < meta.getFieldLookup().length; i++ ) { if ( !DimensionLookupMeta.isUpdateTypeWithoutArgument( meta.isUpdate(), meta.getFieldUpdate()[i] ) ) { sql += ", " + databaseMeta.quoteField( meta.getFieldLookup()[i] ); insertRowMeta.addValueMeta( inputRowMeta.getValueMeta( data.fieldnrs[i] ) ); } } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { ValueMetaInterface valueMeta = null; switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_INSERTED: valueMeta = new ValueMetaDate( meta.getFieldLookup()[i] ); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: valueMeta = new ValueMetaBoolean( meta.getFieldLookup()[i] ); break; default: break; } if ( valueMeta != null ) { sql += ", " + databaseMeta.quoteField( valueMeta.getName() ); insertRowMeta.addValueMeta( valueMeta ); } } sql += ") VALUES ("; if ( !isAutoIncrement() ) { sql += "?, "; } sql += "?, ?, ?"; for ( int i = 0; i < data.keynrs.length; i++ ) { sql += ", ?"; } for ( int i = 0; i < meta.getFieldLookup().length; i++ ) { if ( !DimensionLookupMeta.isUpdateTypeWithoutArgument( meta.isUpdate(), meta.getFieldUpdate()[i] ) ) { sql += ", ?"; } } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_INSERTED: case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: sql += ", ?"; break; default: break; } } sql += " )"; try { if ( technicalKey == null && databaseMeta.supportsAutoGeneratedKeys() ) { logDetailed( "SQL w/ return keys=[" + sql + "]" ); data.prepStatementInsert = data.db.getConnection().prepareStatement( databaseMeta.stripCR( sql ), Statement.RETURN_GENERATED_KEYS ); } else { logDetailed( "SQL=[" + sql + "]" ); data.prepStatementInsert = data.db.getConnection().prepareStatement( databaseMeta.stripCR( sql ) ); } } catch ( SQLException ex ) { throw new KettleDatabaseException( "Unable to prepare dimension insert :" + Const.CR + sql, ex ); } RowMetaInterface updateRowMeta = new RowMeta(); String sql_upd = "UPDATE " + data.schemaTable + Const.CR; sql_upd += "SET " + databaseMeta.quoteField( meta.getDateTo() ) + " = ?" + Const.CR; updateRowMeta.addValueMeta( new ValueMetaDate( meta.getDateTo() ) ); for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { ValueMetaInterface valueMeta = null; switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_UPDATED: valueMeta = new ValueMetaDate( meta.getFieldLookup()[i] ); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: valueMeta = new ValueMetaBoolean( meta.getFieldLookup()[i] ); break; default: break; } if ( valueMeta != null ) { sql_upd += ", " + databaseMeta.quoteField( valueMeta.getName() ) + " = ?" + Const.CR; updateRowMeta.addValueMeta( valueMeta ); } } sql_upd += "WHERE "; for ( int i = 0; i < meta.getKeyLookup().length; i++ ) { if ( i > 0 ) { sql_upd += "AND "; } sql_upd += databaseMeta.quoteField( meta.getKeyLookup()[i] ) + " = ?" + Const.CR; updateRowMeta.addValueMeta( inputRowMeta.getValueMeta( data.keynrs[i] ) ); } sql_upd += "AND " + databaseMeta.quoteField( meta.getVersionField() ) + " = ? "; updateRowMeta.addValueMeta( new ValueMetaInteger( meta.getVersionField() ) ); try { logDetailed( "Preparing update: " + Const.CR + sql_upd + Const.CR ); data.prepStatementUpdate = data.db.getConnection().prepareStatement( databaseMeta.stripCR( sql_upd ) ); } catch ( SQLException ex ) { throw new KettleDatabaseException( "Unable to prepare dimension update :" + Const.CR + sql_upd, ex ); } data.insertRowMeta = insertRowMeta; data.updateRowMeta = updateRowMeta; } Object[] insertRow = new Object[data.insertRowMeta.size()]; int insertIndex = 0; if ( !isAutoIncrement() ) { insertRow[insertIndex++] = technicalKey; } insertRow[insertIndex++] = versionNr; switch ( data.startDateChoice ) { case DimensionLookupMeta.START_DATE_ALTERNATIVE_NONE: insertRow[insertIndex++] = dateFrom; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_SYSDATE: insertRow[insertIndex++] = dateFrom; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_START_OF_TRANS: insertRow[insertIndex++] = getTrans().getStartDate(); break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_NULL: insertRow[insertIndex++] = null; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_COLUMN_VALUE: insertRow[insertIndex++] = inputRowMeta.getDate( row, data.startDateFieldIndex ); break; default: throw new KettleStepException( BaseMessages.getString( PKG, "DimensionLookup.Exception.IllegalStartDateSelection", Integer.toString( data.startDateChoice ) ) ); } insertRow[insertIndex++] = dateTo; for ( int i = 0; i < data.keynrs.length; i++ ) { insertRow[insertIndex++] = row[data.keynrs[i]]; } for ( int i = 0; i < data.fieldnrs.length; i++ ) { if ( data.fieldnrs[i] >= 0 ) { insertRow[insertIndex++] = row[data.fieldnrs[i]]; } } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_INSERTED: insertRow[insertIndex++] = new Date(); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: insertRow[insertIndex++] = Boolean.TRUE; break; default: break; } } if ( isDebug() ) { logDebug( "rins, size=" + data.insertRowMeta.size() + ", values=" + data.insertRowMeta.getString( insertRow ) ); } data.db.setValues( data.insertRowMeta, insertRow, data.prepStatementInsert ); data.db.insertRow( data.prepStatementInsert ); if ( isDebug() ) { logDebug( "Row inserted!" ); } if ( technicalKey == null && databaseMeta.supportsAutoGeneratedKeys() ) { try { RowMetaAndData keys = data.db.getGeneratedKeys( data.prepStatementInsert ); if ( keys.getRowMeta().size() > 0 ) { technicalKey = keys.getRowMeta().getInteger( keys.getData(), 0 ); } else { throw new KettleDatabaseException( "Unable to retrieve value of auto-generated technical key : no value found!" ); } } catch ( Exception e ) { throw new KettleDatabaseException( "Unable to retrieve value of auto-generated technical key : unexpected error: ", e ); } } if ( !newEntry ) { Object[] updateRow = new Object[data.updateRowMeta.size()]; int updateIndex = 0; switch ( data.startDateChoice ) { case DimensionLookupMeta.START_DATE_ALTERNATIVE_NONE: updateRow[updateIndex++] = dateFrom; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_SYSDATE: updateRow[updateIndex++] = new Date(); break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_START_OF_TRANS: updateRow[updateIndex++] = getTrans().getCurrentDate(); break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_NULL: updateRow[updateIndex++] = null; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_COLUMN_VALUE: updateRow[updateIndex++] = inputRowMeta.getDate( row, data.startDateFieldIndex ); break; default: throw new KettleStepException( BaseMessages.getString( "DimensionLookup.Exception.IllegalStartDateSelection", Integer.toString( data.startDateChoice ) ) ); } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: updateRow[updateIndex++] = new Date(); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: updateRow[updateIndex++] = Boolean.FALSE; break; case DimensionLookupMeta.TYPE_UPDATE_DATE_UPDATED: updateRow[updateIndex++] = new Date(); break; default: break; } } for ( int i = 0; i < data.keynrs.length; i++ ) { updateRow[updateIndex++] = row[data.keynrs[i]]; } updateRow[updateIndex++] = versionNr - 1; if ( isRowLevel() ) { logRowlevel( "UPDATE using rupd=" + data.updateRowMeta.getString( updateRow ) ); } data.db.setValues( data.updateRowMeta, updateRow, data.prepStatementUpdate ); if ( isDebug() ) { logDebug( "Values set for update (" + data.updateRowMeta.size() + ")" ); } data.db.insertRow( data.prepStatementUpdate ); if ( isDebug() ) { logDebug( "Row updated!" ); } } return technicalKey; }
DimensionLookup extends BaseStep implements StepInterface { public Long dimInsert( RowMetaInterface inputRowMeta, Object[] row, Long technicalKey, boolean newEntry, Long versionNr, Date dateFrom, Date dateTo ) throws KettleException { DatabaseMeta databaseMeta = meta.getDatabaseMeta(); if ( data.prepStatementInsert == null && data.prepStatementUpdate == null ) { RowMetaInterface insertRowMeta = new RowMeta(); String sql = "INSERT INTO " + data.schemaTable + "( "; if ( !isAutoIncrement() ) { sql += databaseMeta.quoteField( meta.getKeyField() ) + ", "; insertRowMeta.addValueMeta( data.outputRowMeta.getValueMeta( inputRowMeta.size() ) ); } else { if ( databaseMeta.needsPlaceHolder() ) { sql += "0, "; } } sql += databaseMeta.quoteField( meta.getVersionField() ) + ", " + databaseMeta.quoteField( meta.getDateFrom() ) + ", " + databaseMeta.quoteField( meta.getDateTo() ); insertRowMeta.addValueMeta( new ValueMetaInteger( meta.getVersionField() ) ); insertRowMeta.addValueMeta( new ValueMetaDate( meta.getDateFrom() ) ); insertRowMeta.addValueMeta( new ValueMetaDate( meta.getDateTo() ) ); for ( int i = 0; i < meta.getKeyLookup().length; i++ ) { sql += ", " + databaseMeta.quoteField( meta.getKeyLookup()[i] ); insertRowMeta.addValueMeta( inputRowMeta.getValueMeta( data.keynrs[i] ) ); } for ( int i = 0; i < meta.getFieldLookup().length; i++ ) { if ( !DimensionLookupMeta.isUpdateTypeWithoutArgument( meta.isUpdate(), meta.getFieldUpdate()[i] ) ) { sql += ", " + databaseMeta.quoteField( meta.getFieldLookup()[i] ); insertRowMeta.addValueMeta( inputRowMeta.getValueMeta( data.fieldnrs[i] ) ); } } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { ValueMetaInterface valueMeta = null; switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_INSERTED: valueMeta = new ValueMetaDate( meta.getFieldLookup()[i] ); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: valueMeta = new ValueMetaBoolean( meta.getFieldLookup()[i] ); break; default: break; } if ( valueMeta != null ) { sql += ", " + databaseMeta.quoteField( valueMeta.getName() ); insertRowMeta.addValueMeta( valueMeta ); } } sql += ") VALUES ("; if ( !isAutoIncrement() ) { sql += "?, "; } sql += "?, ?, ?"; for ( int i = 0; i < data.keynrs.length; i++ ) { sql += ", ?"; } for ( int i = 0; i < meta.getFieldLookup().length; i++ ) { if ( !DimensionLookupMeta.isUpdateTypeWithoutArgument( meta.isUpdate(), meta.getFieldUpdate()[i] ) ) { sql += ", ?"; } } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_INSERTED: case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: sql += ", ?"; break; default: break; } } sql += " )"; try { if ( technicalKey == null && databaseMeta.supportsAutoGeneratedKeys() ) { logDetailed( "SQL w/ return keys=[" + sql + "]" ); data.prepStatementInsert = data.db.getConnection().prepareStatement( databaseMeta.stripCR( sql ), Statement.RETURN_GENERATED_KEYS ); } else { logDetailed( "SQL=[" + sql + "]" ); data.prepStatementInsert = data.db.getConnection().prepareStatement( databaseMeta.stripCR( sql ) ); } } catch ( SQLException ex ) { throw new KettleDatabaseException( "Unable to prepare dimension insert :" + Const.CR + sql, ex ); } RowMetaInterface updateRowMeta = new RowMeta(); String sql_upd = "UPDATE " + data.schemaTable + Const.CR; sql_upd += "SET " + databaseMeta.quoteField( meta.getDateTo() ) + " = ?" + Const.CR; updateRowMeta.addValueMeta( new ValueMetaDate( meta.getDateTo() ) ); for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { ValueMetaInterface valueMeta = null; switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_UPDATED: valueMeta = new ValueMetaDate( meta.getFieldLookup()[i] ); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: valueMeta = new ValueMetaBoolean( meta.getFieldLookup()[i] ); break; default: break; } if ( valueMeta != null ) { sql_upd += ", " + databaseMeta.quoteField( valueMeta.getName() ) + " = ?" + Const.CR; updateRowMeta.addValueMeta( valueMeta ); } } sql_upd += "WHERE "; for ( int i = 0; i < meta.getKeyLookup().length; i++ ) { if ( i > 0 ) { sql_upd += "AND "; } sql_upd += databaseMeta.quoteField( meta.getKeyLookup()[i] ) + " = ?" + Const.CR; updateRowMeta.addValueMeta( inputRowMeta.getValueMeta( data.keynrs[i] ) ); } sql_upd += "AND " + databaseMeta.quoteField( meta.getVersionField() ) + " = ? "; updateRowMeta.addValueMeta( new ValueMetaInteger( meta.getVersionField() ) ); try { logDetailed( "Preparing update: " + Const.CR + sql_upd + Const.CR ); data.prepStatementUpdate = data.db.getConnection().prepareStatement( databaseMeta.stripCR( sql_upd ) ); } catch ( SQLException ex ) { throw new KettleDatabaseException( "Unable to prepare dimension update :" + Const.CR + sql_upd, ex ); } data.insertRowMeta = insertRowMeta; data.updateRowMeta = updateRowMeta; } Object[] insertRow = new Object[data.insertRowMeta.size()]; int insertIndex = 0; if ( !isAutoIncrement() ) { insertRow[insertIndex++] = technicalKey; } insertRow[insertIndex++] = versionNr; switch ( data.startDateChoice ) { case DimensionLookupMeta.START_DATE_ALTERNATIVE_NONE: insertRow[insertIndex++] = dateFrom; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_SYSDATE: insertRow[insertIndex++] = dateFrom; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_START_OF_TRANS: insertRow[insertIndex++] = getTrans().getStartDate(); break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_NULL: insertRow[insertIndex++] = null; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_COLUMN_VALUE: insertRow[insertIndex++] = inputRowMeta.getDate( row, data.startDateFieldIndex ); break; default: throw new KettleStepException( BaseMessages.getString( PKG, "DimensionLookup.Exception.IllegalStartDateSelection", Integer.toString( data.startDateChoice ) ) ); } insertRow[insertIndex++] = dateTo; for ( int i = 0; i < data.keynrs.length; i++ ) { insertRow[insertIndex++] = row[data.keynrs[i]]; } for ( int i = 0; i < data.fieldnrs.length; i++ ) { if ( data.fieldnrs[i] >= 0 ) { insertRow[insertIndex++] = row[data.fieldnrs[i]]; } } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_INSERTED: insertRow[insertIndex++] = new Date(); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: insertRow[insertIndex++] = Boolean.TRUE; break; default: break; } } if ( isDebug() ) { logDebug( "rins, size=" + data.insertRowMeta.size() + ", values=" + data.insertRowMeta.getString( insertRow ) ); } data.db.setValues( data.insertRowMeta, insertRow, data.prepStatementInsert ); data.db.insertRow( data.prepStatementInsert ); if ( isDebug() ) { logDebug( "Row inserted!" ); } if ( technicalKey == null && databaseMeta.supportsAutoGeneratedKeys() ) { try { RowMetaAndData keys = data.db.getGeneratedKeys( data.prepStatementInsert ); if ( keys.getRowMeta().size() > 0 ) { technicalKey = keys.getRowMeta().getInteger( keys.getData(), 0 ); } else { throw new KettleDatabaseException( "Unable to retrieve value of auto-generated technical key : no value found!" ); } } catch ( Exception e ) { throw new KettleDatabaseException( "Unable to retrieve value of auto-generated technical key : unexpected error: ", e ); } } if ( !newEntry ) { Object[] updateRow = new Object[data.updateRowMeta.size()]; int updateIndex = 0; switch ( data.startDateChoice ) { case DimensionLookupMeta.START_DATE_ALTERNATIVE_NONE: updateRow[updateIndex++] = dateFrom; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_SYSDATE: updateRow[updateIndex++] = new Date(); break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_START_OF_TRANS: updateRow[updateIndex++] = getTrans().getCurrentDate(); break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_NULL: updateRow[updateIndex++] = null; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_COLUMN_VALUE: updateRow[updateIndex++] = inputRowMeta.getDate( row, data.startDateFieldIndex ); break; default: throw new KettleStepException( BaseMessages.getString( "DimensionLookup.Exception.IllegalStartDateSelection", Integer.toString( data.startDateChoice ) ) ); } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: updateRow[updateIndex++] = new Date(); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: updateRow[updateIndex++] = Boolean.FALSE; break; case DimensionLookupMeta.TYPE_UPDATE_DATE_UPDATED: updateRow[updateIndex++] = new Date(); break; default: break; } } for ( int i = 0; i < data.keynrs.length; i++ ) { updateRow[updateIndex++] = row[data.keynrs[i]]; } updateRow[updateIndex++] = versionNr - 1; if ( isRowLevel() ) { logRowlevel( "UPDATE using rupd=" + data.updateRowMeta.getString( updateRow ) ); } data.db.setValues( data.updateRowMeta, updateRow, data.prepStatementUpdate ); if ( isDebug() ) { logDebug( "Values set for update (" + data.updateRowMeta.size() + ")" ); } data.db.insertRow( data.prepStatementUpdate ); if ( isDebug() ) { logDebug( "Row updated!" ); } } return technicalKey; } }
DimensionLookup extends BaseStep implements StepInterface { public Long dimInsert( RowMetaInterface inputRowMeta, Object[] row, Long technicalKey, boolean newEntry, Long versionNr, Date dateFrom, Date dateTo ) throws KettleException { DatabaseMeta databaseMeta = meta.getDatabaseMeta(); if ( data.prepStatementInsert == null && data.prepStatementUpdate == null ) { RowMetaInterface insertRowMeta = new RowMeta(); String sql = "INSERT INTO " + data.schemaTable + "( "; if ( !isAutoIncrement() ) { sql += databaseMeta.quoteField( meta.getKeyField() ) + ", "; insertRowMeta.addValueMeta( data.outputRowMeta.getValueMeta( inputRowMeta.size() ) ); } else { if ( databaseMeta.needsPlaceHolder() ) { sql += "0, "; } } sql += databaseMeta.quoteField( meta.getVersionField() ) + ", " + databaseMeta.quoteField( meta.getDateFrom() ) + ", " + databaseMeta.quoteField( meta.getDateTo() ); insertRowMeta.addValueMeta( new ValueMetaInteger( meta.getVersionField() ) ); insertRowMeta.addValueMeta( new ValueMetaDate( meta.getDateFrom() ) ); insertRowMeta.addValueMeta( new ValueMetaDate( meta.getDateTo() ) ); for ( int i = 0; i < meta.getKeyLookup().length; i++ ) { sql += ", " + databaseMeta.quoteField( meta.getKeyLookup()[i] ); insertRowMeta.addValueMeta( inputRowMeta.getValueMeta( data.keynrs[i] ) ); } for ( int i = 0; i < meta.getFieldLookup().length; i++ ) { if ( !DimensionLookupMeta.isUpdateTypeWithoutArgument( meta.isUpdate(), meta.getFieldUpdate()[i] ) ) { sql += ", " + databaseMeta.quoteField( meta.getFieldLookup()[i] ); insertRowMeta.addValueMeta( inputRowMeta.getValueMeta( data.fieldnrs[i] ) ); } } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { ValueMetaInterface valueMeta = null; switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_INSERTED: valueMeta = new ValueMetaDate( meta.getFieldLookup()[i] ); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: valueMeta = new ValueMetaBoolean( meta.getFieldLookup()[i] ); break; default: break; } if ( valueMeta != null ) { sql += ", " + databaseMeta.quoteField( valueMeta.getName() ); insertRowMeta.addValueMeta( valueMeta ); } } sql += ") VALUES ("; if ( !isAutoIncrement() ) { sql += "?, "; } sql += "?, ?, ?"; for ( int i = 0; i < data.keynrs.length; i++ ) { sql += ", ?"; } for ( int i = 0; i < meta.getFieldLookup().length; i++ ) { if ( !DimensionLookupMeta.isUpdateTypeWithoutArgument( meta.isUpdate(), meta.getFieldUpdate()[i] ) ) { sql += ", ?"; } } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_INSERTED: case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: sql += ", ?"; break; default: break; } } sql += " )"; try { if ( technicalKey == null && databaseMeta.supportsAutoGeneratedKeys() ) { logDetailed( "SQL w/ return keys=[" + sql + "]" ); data.prepStatementInsert = data.db.getConnection().prepareStatement( databaseMeta.stripCR( sql ), Statement.RETURN_GENERATED_KEYS ); } else { logDetailed( "SQL=[" + sql + "]" ); data.prepStatementInsert = data.db.getConnection().prepareStatement( databaseMeta.stripCR( sql ) ); } } catch ( SQLException ex ) { throw new KettleDatabaseException( "Unable to prepare dimension insert :" + Const.CR + sql, ex ); } RowMetaInterface updateRowMeta = new RowMeta(); String sql_upd = "UPDATE " + data.schemaTable + Const.CR; sql_upd += "SET " + databaseMeta.quoteField( meta.getDateTo() ) + " = ?" + Const.CR; updateRowMeta.addValueMeta( new ValueMetaDate( meta.getDateTo() ) ); for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { ValueMetaInterface valueMeta = null; switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_UPDATED: valueMeta = new ValueMetaDate( meta.getFieldLookup()[i] ); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: valueMeta = new ValueMetaBoolean( meta.getFieldLookup()[i] ); break; default: break; } if ( valueMeta != null ) { sql_upd += ", " + databaseMeta.quoteField( valueMeta.getName() ) + " = ?" + Const.CR; updateRowMeta.addValueMeta( valueMeta ); } } sql_upd += "WHERE "; for ( int i = 0; i < meta.getKeyLookup().length; i++ ) { if ( i > 0 ) { sql_upd += "AND "; } sql_upd += databaseMeta.quoteField( meta.getKeyLookup()[i] ) + " = ?" + Const.CR; updateRowMeta.addValueMeta( inputRowMeta.getValueMeta( data.keynrs[i] ) ); } sql_upd += "AND " + databaseMeta.quoteField( meta.getVersionField() ) + " = ? "; updateRowMeta.addValueMeta( new ValueMetaInteger( meta.getVersionField() ) ); try { logDetailed( "Preparing update: " + Const.CR + sql_upd + Const.CR ); data.prepStatementUpdate = data.db.getConnection().prepareStatement( databaseMeta.stripCR( sql_upd ) ); } catch ( SQLException ex ) { throw new KettleDatabaseException( "Unable to prepare dimension update :" + Const.CR + sql_upd, ex ); } data.insertRowMeta = insertRowMeta; data.updateRowMeta = updateRowMeta; } Object[] insertRow = new Object[data.insertRowMeta.size()]; int insertIndex = 0; if ( !isAutoIncrement() ) { insertRow[insertIndex++] = technicalKey; } insertRow[insertIndex++] = versionNr; switch ( data.startDateChoice ) { case DimensionLookupMeta.START_DATE_ALTERNATIVE_NONE: insertRow[insertIndex++] = dateFrom; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_SYSDATE: insertRow[insertIndex++] = dateFrom; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_START_OF_TRANS: insertRow[insertIndex++] = getTrans().getStartDate(); break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_NULL: insertRow[insertIndex++] = null; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_COLUMN_VALUE: insertRow[insertIndex++] = inputRowMeta.getDate( row, data.startDateFieldIndex ); break; default: throw new KettleStepException( BaseMessages.getString( PKG, "DimensionLookup.Exception.IllegalStartDateSelection", Integer.toString( data.startDateChoice ) ) ); } insertRow[insertIndex++] = dateTo; for ( int i = 0; i < data.keynrs.length; i++ ) { insertRow[insertIndex++] = row[data.keynrs[i]]; } for ( int i = 0; i < data.fieldnrs.length; i++ ) { if ( data.fieldnrs[i] >= 0 ) { insertRow[insertIndex++] = row[data.fieldnrs[i]]; } } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_INSERTED: insertRow[insertIndex++] = new Date(); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: insertRow[insertIndex++] = Boolean.TRUE; break; default: break; } } if ( isDebug() ) { logDebug( "rins, size=" + data.insertRowMeta.size() + ", values=" + data.insertRowMeta.getString( insertRow ) ); } data.db.setValues( data.insertRowMeta, insertRow, data.prepStatementInsert ); data.db.insertRow( data.prepStatementInsert ); if ( isDebug() ) { logDebug( "Row inserted!" ); } if ( technicalKey == null && databaseMeta.supportsAutoGeneratedKeys() ) { try { RowMetaAndData keys = data.db.getGeneratedKeys( data.prepStatementInsert ); if ( keys.getRowMeta().size() > 0 ) { technicalKey = keys.getRowMeta().getInteger( keys.getData(), 0 ); } else { throw new KettleDatabaseException( "Unable to retrieve value of auto-generated technical key : no value found!" ); } } catch ( Exception e ) { throw new KettleDatabaseException( "Unable to retrieve value of auto-generated technical key : unexpected error: ", e ); } } if ( !newEntry ) { Object[] updateRow = new Object[data.updateRowMeta.size()]; int updateIndex = 0; switch ( data.startDateChoice ) { case DimensionLookupMeta.START_DATE_ALTERNATIVE_NONE: updateRow[updateIndex++] = dateFrom; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_SYSDATE: updateRow[updateIndex++] = new Date(); break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_START_OF_TRANS: updateRow[updateIndex++] = getTrans().getCurrentDate(); break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_NULL: updateRow[updateIndex++] = null; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_COLUMN_VALUE: updateRow[updateIndex++] = inputRowMeta.getDate( row, data.startDateFieldIndex ); break; default: throw new KettleStepException( BaseMessages.getString( "DimensionLookup.Exception.IllegalStartDateSelection", Integer.toString( data.startDateChoice ) ) ); } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: updateRow[updateIndex++] = new Date(); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: updateRow[updateIndex++] = Boolean.FALSE; break; case DimensionLookupMeta.TYPE_UPDATE_DATE_UPDATED: updateRow[updateIndex++] = new Date(); break; default: break; } } for ( int i = 0; i < data.keynrs.length; i++ ) { updateRow[updateIndex++] = row[data.keynrs[i]]; } updateRow[updateIndex++] = versionNr - 1; if ( isRowLevel() ) { logRowlevel( "UPDATE using rupd=" + data.updateRowMeta.getString( updateRow ) ); } data.db.setValues( data.updateRowMeta, updateRow, data.prepStatementUpdate ); if ( isDebug() ) { logDebug( "Values set for update (" + data.updateRowMeta.size() + ")" ); } data.db.insertRow( data.prepStatementUpdate ); if ( isDebug() ) { logDebug( "Row updated!" ); } } return technicalKey; } DimensionLookup( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
DimensionLookup extends BaseStep implements StepInterface { public Long dimInsert( RowMetaInterface inputRowMeta, Object[] row, Long technicalKey, boolean newEntry, Long versionNr, Date dateFrom, Date dateTo ) throws KettleException { DatabaseMeta databaseMeta = meta.getDatabaseMeta(); if ( data.prepStatementInsert == null && data.prepStatementUpdate == null ) { RowMetaInterface insertRowMeta = new RowMeta(); String sql = "INSERT INTO " + data.schemaTable + "( "; if ( !isAutoIncrement() ) { sql += databaseMeta.quoteField( meta.getKeyField() ) + ", "; insertRowMeta.addValueMeta( data.outputRowMeta.getValueMeta( inputRowMeta.size() ) ); } else { if ( databaseMeta.needsPlaceHolder() ) { sql += "0, "; } } sql += databaseMeta.quoteField( meta.getVersionField() ) + ", " + databaseMeta.quoteField( meta.getDateFrom() ) + ", " + databaseMeta.quoteField( meta.getDateTo() ); insertRowMeta.addValueMeta( new ValueMetaInteger( meta.getVersionField() ) ); insertRowMeta.addValueMeta( new ValueMetaDate( meta.getDateFrom() ) ); insertRowMeta.addValueMeta( new ValueMetaDate( meta.getDateTo() ) ); for ( int i = 0; i < meta.getKeyLookup().length; i++ ) { sql += ", " + databaseMeta.quoteField( meta.getKeyLookup()[i] ); insertRowMeta.addValueMeta( inputRowMeta.getValueMeta( data.keynrs[i] ) ); } for ( int i = 0; i < meta.getFieldLookup().length; i++ ) { if ( !DimensionLookupMeta.isUpdateTypeWithoutArgument( meta.isUpdate(), meta.getFieldUpdate()[i] ) ) { sql += ", " + databaseMeta.quoteField( meta.getFieldLookup()[i] ); insertRowMeta.addValueMeta( inputRowMeta.getValueMeta( data.fieldnrs[i] ) ); } } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { ValueMetaInterface valueMeta = null; switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_INSERTED: valueMeta = new ValueMetaDate( meta.getFieldLookup()[i] ); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: valueMeta = new ValueMetaBoolean( meta.getFieldLookup()[i] ); break; default: break; } if ( valueMeta != null ) { sql += ", " + databaseMeta.quoteField( valueMeta.getName() ); insertRowMeta.addValueMeta( valueMeta ); } } sql += ") VALUES ("; if ( !isAutoIncrement() ) { sql += "?, "; } sql += "?, ?, ?"; for ( int i = 0; i < data.keynrs.length; i++ ) { sql += ", ?"; } for ( int i = 0; i < meta.getFieldLookup().length; i++ ) { if ( !DimensionLookupMeta.isUpdateTypeWithoutArgument( meta.isUpdate(), meta.getFieldUpdate()[i] ) ) { sql += ", ?"; } } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_INSERTED: case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: sql += ", ?"; break; default: break; } } sql += " )"; try { if ( technicalKey == null && databaseMeta.supportsAutoGeneratedKeys() ) { logDetailed( "SQL w/ return keys=[" + sql + "]" ); data.prepStatementInsert = data.db.getConnection().prepareStatement( databaseMeta.stripCR( sql ), Statement.RETURN_GENERATED_KEYS ); } else { logDetailed( "SQL=[" + sql + "]" ); data.prepStatementInsert = data.db.getConnection().prepareStatement( databaseMeta.stripCR( sql ) ); } } catch ( SQLException ex ) { throw new KettleDatabaseException( "Unable to prepare dimension insert :" + Const.CR + sql, ex ); } RowMetaInterface updateRowMeta = new RowMeta(); String sql_upd = "UPDATE " + data.schemaTable + Const.CR; sql_upd += "SET " + databaseMeta.quoteField( meta.getDateTo() ) + " = ?" + Const.CR; updateRowMeta.addValueMeta( new ValueMetaDate( meta.getDateTo() ) ); for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { ValueMetaInterface valueMeta = null; switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_UPDATED: valueMeta = new ValueMetaDate( meta.getFieldLookup()[i] ); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: valueMeta = new ValueMetaBoolean( meta.getFieldLookup()[i] ); break; default: break; } if ( valueMeta != null ) { sql_upd += ", " + databaseMeta.quoteField( valueMeta.getName() ) + " = ?" + Const.CR; updateRowMeta.addValueMeta( valueMeta ); } } sql_upd += "WHERE "; for ( int i = 0; i < meta.getKeyLookup().length; i++ ) { if ( i > 0 ) { sql_upd += "AND "; } sql_upd += databaseMeta.quoteField( meta.getKeyLookup()[i] ) + " = ?" + Const.CR; updateRowMeta.addValueMeta( inputRowMeta.getValueMeta( data.keynrs[i] ) ); } sql_upd += "AND " + databaseMeta.quoteField( meta.getVersionField() ) + " = ? "; updateRowMeta.addValueMeta( new ValueMetaInteger( meta.getVersionField() ) ); try { logDetailed( "Preparing update: " + Const.CR + sql_upd + Const.CR ); data.prepStatementUpdate = data.db.getConnection().prepareStatement( databaseMeta.stripCR( sql_upd ) ); } catch ( SQLException ex ) { throw new KettleDatabaseException( "Unable to prepare dimension update :" + Const.CR + sql_upd, ex ); } data.insertRowMeta = insertRowMeta; data.updateRowMeta = updateRowMeta; } Object[] insertRow = new Object[data.insertRowMeta.size()]; int insertIndex = 0; if ( !isAutoIncrement() ) { insertRow[insertIndex++] = technicalKey; } insertRow[insertIndex++] = versionNr; switch ( data.startDateChoice ) { case DimensionLookupMeta.START_DATE_ALTERNATIVE_NONE: insertRow[insertIndex++] = dateFrom; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_SYSDATE: insertRow[insertIndex++] = dateFrom; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_START_OF_TRANS: insertRow[insertIndex++] = getTrans().getStartDate(); break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_NULL: insertRow[insertIndex++] = null; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_COLUMN_VALUE: insertRow[insertIndex++] = inputRowMeta.getDate( row, data.startDateFieldIndex ); break; default: throw new KettleStepException( BaseMessages.getString( PKG, "DimensionLookup.Exception.IllegalStartDateSelection", Integer.toString( data.startDateChoice ) ) ); } insertRow[insertIndex++] = dateTo; for ( int i = 0; i < data.keynrs.length; i++ ) { insertRow[insertIndex++] = row[data.keynrs[i]]; } for ( int i = 0; i < data.fieldnrs.length; i++ ) { if ( data.fieldnrs[i] >= 0 ) { insertRow[insertIndex++] = row[data.fieldnrs[i]]; } } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_INSERTED: insertRow[insertIndex++] = new Date(); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: insertRow[insertIndex++] = Boolean.TRUE; break; default: break; } } if ( isDebug() ) { logDebug( "rins, size=" + data.insertRowMeta.size() + ", values=" + data.insertRowMeta.getString( insertRow ) ); } data.db.setValues( data.insertRowMeta, insertRow, data.prepStatementInsert ); data.db.insertRow( data.prepStatementInsert ); if ( isDebug() ) { logDebug( "Row inserted!" ); } if ( technicalKey == null && databaseMeta.supportsAutoGeneratedKeys() ) { try { RowMetaAndData keys = data.db.getGeneratedKeys( data.prepStatementInsert ); if ( keys.getRowMeta().size() > 0 ) { technicalKey = keys.getRowMeta().getInteger( keys.getData(), 0 ); } else { throw new KettleDatabaseException( "Unable to retrieve value of auto-generated technical key : no value found!" ); } } catch ( Exception e ) { throw new KettleDatabaseException( "Unable to retrieve value of auto-generated technical key : unexpected error: ", e ); } } if ( !newEntry ) { Object[] updateRow = new Object[data.updateRowMeta.size()]; int updateIndex = 0; switch ( data.startDateChoice ) { case DimensionLookupMeta.START_DATE_ALTERNATIVE_NONE: updateRow[updateIndex++] = dateFrom; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_SYSDATE: updateRow[updateIndex++] = new Date(); break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_START_OF_TRANS: updateRow[updateIndex++] = getTrans().getCurrentDate(); break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_NULL: updateRow[updateIndex++] = null; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_COLUMN_VALUE: updateRow[updateIndex++] = inputRowMeta.getDate( row, data.startDateFieldIndex ); break; default: throw new KettleStepException( BaseMessages.getString( "DimensionLookup.Exception.IllegalStartDateSelection", Integer.toString( data.startDateChoice ) ) ); } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: updateRow[updateIndex++] = new Date(); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: updateRow[updateIndex++] = Boolean.FALSE; break; case DimensionLookupMeta.TYPE_UPDATE_DATE_UPDATED: updateRow[updateIndex++] = new Date(); break; default: break; } } for ( int i = 0; i < data.keynrs.length; i++ ) { updateRow[updateIndex++] = row[data.keynrs[i]]; } updateRow[updateIndex++] = versionNr - 1; if ( isRowLevel() ) { logRowlevel( "UPDATE using rupd=" + data.updateRowMeta.getString( updateRow ) ); } data.db.setValues( data.updateRowMeta, updateRow, data.prepStatementUpdate ); if ( isDebug() ) { logDebug( "Values set for update (" + data.updateRowMeta.size() + ")" ); } data.db.insertRow( data.prepStatementUpdate ); if ( isDebug() ) { logDebug( "Row updated!" ); } } return technicalKey; } DimensionLookup( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); Long dimInsert( RowMetaInterface inputRowMeta, Object[] row, Long technicalKey, boolean newEntry, Long versionNr, Date dateFrom, Date dateTo ); @Override boolean isRowLevel(); @Override boolean isDebug(); void dimUpdate( RowMetaInterface rowMeta, Object[] row, Long dimkey, Date valueDate ); void dimPunchThrough( RowMetaInterface rowMeta, Object[] row ); void checkDimZero(); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
DimensionLookup extends BaseStep implements StepInterface { public Long dimInsert( RowMetaInterface inputRowMeta, Object[] row, Long technicalKey, boolean newEntry, Long versionNr, Date dateFrom, Date dateTo ) throws KettleException { DatabaseMeta databaseMeta = meta.getDatabaseMeta(); if ( data.prepStatementInsert == null && data.prepStatementUpdate == null ) { RowMetaInterface insertRowMeta = new RowMeta(); String sql = "INSERT INTO " + data.schemaTable + "( "; if ( !isAutoIncrement() ) { sql += databaseMeta.quoteField( meta.getKeyField() ) + ", "; insertRowMeta.addValueMeta( data.outputRowMeta.getValueMeta( inputRowMeta.size() ) ); } else { if ( databaseMeta.needsPlaceHolder() ) { sql += "0, "; } } sql += databaseMeta.quoteField( meta.getVersionField() ) + ", " + databaseMeta.quoteField( meta.getDateFrom() ) + ", " + databaseMeta.quoteField( meta.getDateTo() ); insertRowMeta.addValueMeta( new ValueMetaInteger( meta.getVersionField() ) ); insertRowMeta.addValueMeta( new ValueMetaDate( meta.getDateFrom() ) ); insertRowMeta.addValueMeta( new ValueMetaDate( meta.getDateTo() ) ); for ( int i = 0; i < meta.getKeyLookup().length; i++ ) { sql += ", " + databaseMeta.quoteField( meta.getKeyLookup()[i] ); insertRowMeta.addValueMeta( inputRowMeta.getValueMeta( data.keynrs[i] ) ); } for ( int i = 0; i < meta.getFieldLookup().length; i++ ) { if ( !DimensionLookupMeta.isUpdateTypeWithoutArgument( meta.isUpdate(), meta.getFieldUpdate()[i] ) ) { sql += ", " + databaseMeta.quoteField( meta.getFieldLookup()[i] ); insertRowMeta.addValueMeta( inputRowMeta.getValueMeta( data.fieldnrs[i] ) ); } } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { ValueMetaInterface valueMeta = null; switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_INSERTED: valueMeta = new ValueMetaDate( meta.getFieldLookup()[i] ); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: valueMeta = new ValueMetaBoolean( meta.getFieldLookup()[i] ); break; default: break; } if ( valueMeta != null ) { sql += ", " + databaseMeta.quoteField( valueMeta.getName() ); insertRowMeta.addValueMeta( valueMeta ); } } sql += ") VALUES ("; if ( !isAutoIncrement() ) { sql += "?, "; } sql += "?, ?, ?"; for ( int i = 0; i < data.keynrs.length; i++ ) { sql += ", ?"; } for ( int i = 0; i < meta.getFieldLookup().length; i++ ) { if ( !DimensionLookupMeta.isUpdateTypeWithoutArgument( meta.isUpdate(), meta.getFieldUpdate()[i] ) ) { sql += ", ?"; } } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_INSERTED: case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: sql += ", ?"; break; default: break; } } sql += " )"; try { if ( technicalKey == null && databaseMeta.supportsAutoGeneratedKeys() ) { logDetailed( "SQL w/ return keys=[" + sql + "]" ); data.prepStatementInsert = data.db.getConnection().prepareStatement( databaseMeta.stripCR( sql ), Statement.RETURN_GENERATED_KEYS ); } else { logDetailed( "SQL=[" + sql + "]" ); data.prepStatementInsert = data.db.getConnection().prepareStatement( databaseMeta.stripCR( sql ) ); } } catch ( SQLException ex ) { throw new KettleDatabaseException( "Unable to prepare dimension insert :" + Const.CR + sql, ex ); } RowMetaInterface updateRowMeta = new RowMeta(); String sql_upd = "UPDATE " + data.schemaTable + Const.CR; sql_upd += "SET " + databaseMeta.quoteField( meta.getDateTo() ) + " = ?" + Const.CR; updateRowMeta.addValueMeta( new ValueMetaDate( meta.getDateTo() ) ); for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { ValueMetaInterface valueMeta = null; switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_UPDATED: valueMeta = new ValueMetaDate( meta.getFieldLookup()[i] ); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: valueMeta = new ValueMetaBoolean( meta.getFieldLookup()[i] ); break; default: break; } if ( valueMeta != null ) { sql_upd += ", " + databaseMeta.quoteField( valueMeta.getName() ) + " = ?" + Const.CR; updateRowMeta.addValueMeta( valueMeta ); } } sql_upd += "WHERE "; for ( int i = 0; i < meta.getKeyLookup().length; i++ ) { if ( i > 0 ) { sql_upd += "AND "; } sql_upd += databaseMeta.quoteField( meta.getKeyLookup()[i] ) + " = ?" + Const.CR; updateRowMeta.addValueMeta( inputRowMeta.getValueMeta( data.keynrs[i] ) ); } sql_upd += "AND " + databaseMeta.quoteField( meta.getVersionField() ) + " = ? "; updateRowMeta.addValueMeta( new ValueMetaInteger( meta.getVersionField() ) ); try { logDetailed( "Preparing update: " + Const.CR + sql_upd + Const.CR ); data.prepStatementUpdate = data.db.getConnection().prepareStatement( databaseMeta.stripCR( sql_upd ) ); } catch ( SQLException ex ) { throw new KettleDatabaseException( "Unable to prepare dimension update :" + Const.CR + sql_upd, ex ); } data.insertRowMeta = insertRowMeta; data.updateRowMeta = updateRowMeta; } Object[] insertRow = new Object[data.insertRowMeta.size()]; int insertIndex = 0; if ( !isAutoIncrement() ) { insertRow[insertIndex++] = technicalKey; } insertRow[insertIndex++] = versionNr; switch ( data.startDateChoice ) { case DimensionLookupMeta.START_DATE_ALTERNATIVE_NONE: insertRow[insertIndex++] = dateFrom; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_SYSDATE: insertRow[insertIndex++] = dateFrom; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_START_OF_TRANS: insertRow[insertIndex++] = getTrans().getStartDate(); break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_NULL: insertRow[insertIndex++] = null; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_COLUMN_VALUE: insertRow[insertIndex++] = inputRowMeta.getDate( row, data.startDateFieldIndex ); break; default: throw new KettleStepException( BaseMessages.getString( PKG, "DimensionLookup.Exception.IllegalStartDateSelection", Integer.toString( data.startDateChoice ) ) ); } insertRow[insertIndex++] = dateTo; for ( int i = 0; i < data.keynrs.length; i++ ) { insertRow[insertIndex++] = row[data.keynrs[i]]; } for ( int i = 0; i < data.fieldnrs.length; i++ ) { if ( data.fieldnrs[i] >= 0 ) { insertRow[insertIndex++] = row[data.fieldnrs[i]]; } } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: case DimensionLookupMeta.TYPE_UPDATE_DATE_INSERTED: insertRow[insertIndex++] = new Date(); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: insertRow[insertIndex++] = Boolean.TRUE; break; default: break; } } if ( isDebug() ) { logDebug( "rins, size=" + data.insertRowMeta.size() + ", values=" + data.insertRowMeta.getString( insertRow ) ); } data.db.setValues( data.insertRowMeta, insertRow, data.prepStatementInsert ); data.db.insertRow( data.prepStatementInsert ); if ( isDebug() ) { logDebug( "Row inserted!" ); } if ( technicalKey == null && databaseMeta.supportsAutoGeneratedKeys() ) { try { RowMetaAndData keys = data.db.getGeneratedKeys( data.prepStatementInsert ); if ( keys.getRowMeta().size() > 0 ) { technicalKey = keys.getRowMeta().getInteger( keys.getData(), 0 ); } else { throw new KettleDatabaseException( "Unable to retrieve value of auto-generated technical key : no value found!" ); } } catch ( Exception e ) { throw new KettleDatabaseException( "Unable to retrieve value of auto-generated technical key : unexpected error: ", e ); } } if ( !newEntry ) { Object[] updateRow = new Object[data.updateRowMeta.size()]; int updateIndex = 0; switch ( data.startDateChoice ) { case DimensionLookupMeta.START_DATE_ALTERNATIVE_NONE: updateRow[updateIndex++] = dateFrom; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_SYSDATE: updateRow[updateIndex++] = new Date(); break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_START_OF_TRANS: updateRow[updateIndex++] = getTrans().getCurrentDate(); break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_NULL: updateRow[updateIndex++] = null; break; case DimensionLookupMeta.START_DATE_ALTERNATIVE_COLUMN_VALUE: updateRow[updateIndex++] = inputRowMeta.getDate( row, data.startDateFieldIndex ); break; default: throw new KettleStepException( BaseMessages.getString( "DimensionLookup.Exception.IllegalStartDateSelection", Integer.toString( data.startDateChoice ) ) ); } for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) { switch ( meta.getFieldUpdate()[i] ) { case DimensionLookupMeta.TYPE_UPDATE_DATE_INSUP: updateRow[updateIndex++] = new Date(); break; case DimensionLookupMeta.TYPE_UPDATE_LAST_VERSION: updateRow[updateIndex++] = Boolean.FALSE; break; case DimensionLookupMeta.TYPE_UPDATE_DATE_UPDATED: updateRow[updateIndex++] = new Date(); break; default: break; } } for ( int i = 0; i < data.keynrs.length; i++ ) { updateRow[updateIndex++] = row[data.keynrs[i]]; } updateRow[updateIndex++] = versionNr - 1; if ( isRowLevel() ) { logRowlevel( "UPDATE using rupd=" + data.updateRowMeta.getString( updateRow ) ); } data.db.setValues( data.updateRowMeta, updateRow, data.prepStatementUpdate ); if ( isDebug() ) { logDebug( "Values set for update (" + data.updateRowMeta.size() + ")" ); } data.db.insertRow( data.prepStatementUpdate ); if ( isDebug() ) { logDebug( "Row updated!" ); } } return technicalKey; } DimensionLookup( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); Long dimInsert( RowMetaInterface inputRowMeta, Object[] row, Long technicalKey, boolean newEntry, Long versionNr, Date dateFrom, Date dateTo ); @Override boolean isRowLevel(); @Override boolean isDebug(); void dimUpdate( RowMetaInterface rowMeta, Object[] row, Long dimkey, Date valueDate ); void dimPunchThrough( RowMetaInterface rowMeta, Object[] row ); void checkDimZero(); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void testGetFields() throws Exception { RowMeta extraFields = new RowMeta(); extraFields.addValueMeta( new ValueMetaString( "field1" ) ); DatabaseMeta dbMeta = mock( DatabaseMeta.class ); DimensionLookupMeta meta = spy( new DimensionLookupMeta() ); meta.setUpdate( false ); meta.setKeyField( null ); meta.setFieldLookup( new String[] { "field1" } ); meta.setFieldStream( new String[] { "" } ); meta.setDatabaseMeta( dbMeta ); doReturn( extraFields ).when( meta ).getDatabaseTableFields( (Database) anyObject(), anyString(), anyString() ); doReturn( mock( LogChannelInterface.class ) ).when( meta ).getLog(); RowMeta row = new RowMeta(); try { meta.getFields( row, "DimensionLookupMetaTest", new RowMeta[] { row }, null, null, null, null ); } catch ( Throwable e ) { Assert.assertTrue( e.getMessage().contains( BaseMessages.getString( DimensionLookupMeta.class, "DimensionLookupMeta.Error.NoTechnicalKeySpecified" ) ) ); } }
@Override public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( ValueMetaInterface valueMeta : row.getValueMetaList() ) { valueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); valueMeta.setTrimType( ValueMetaInterface.TRIM_TYPE_NONE ); } if ( Utils.isEmpty( keyField ) ) { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Error.NoTechnicalKeySpecified" ); logError( message ); throw new KettleStepException( message ); } ValueMetaInterface v = new ValueMetaInteger( keyField ); if ( keyRename != null && keyRename.length() > 0 ) { v.setName( keyRename ); } v.setLength( 9 ); v.setPrecision( 0 ); v.setOrigin( name ); row.addValueMeta( v ); if ( !update && fieldLookup.length > 0 ) { Database db = null; try { if ( databaseMeta != null ) { db = createDatabaseObject(); RowMetaInterface extraFields = getDatabaseTableFields( db, schemaName, tableName ); for ( int i = 0; i < fieldLookup.length; i++ ) { v = extraFields.searchValueMeta( fieldLookup[i] ); if ( v == null ) { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToFindReturnField", fieldLookup[i] ); logError( message ); throw new KettleStepException( message ); } if ( fieldStream[i] != null && fieldStream[i].length() > 0 ) { v.setName( fieldStream[i] ); } v.setOrigin( name ); row.addValueMeta( v ); } } else { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField" ); logError( message ); throw new KettleStepException( message ); } } catch ( Exception e ) { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField2" ); logError( message ); throw new KettleStepException( message, e ); } finally { if ( db != null ) { db.disconnect(); } } } }
DimensionLookupMeta extends BaseStepMeta implements StepMetaInterface, ProvidesModelerMeta { @Override public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( ValueMetaInterface valueMeta : row.getValueMetaList() ) { valueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); valueMeta.setTrimType( ValueMetaInterface.TRIM_TYPE_NONE ); } if ( Utils.isEmpty( keyField ) ) { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Error.NoTechnicalKeySpecified" ); logError( message ); throw new KettleStepException( message ); } ValueMetaInterface v = new ValueMetaInteger( keyField ); if ( keyRename != null && keyRename.length() > 0 ) { v.setName( keyRename ); } v.setLength( 9 ); v.setPrecision( 0 ); v.setOrigin( name ); row.addValueMeta( v ); if ( !update && fieldLookup.length > 0 ) { Database db = null; try { if ( databaseMeta != null ) { db = createDatabaseObject(); RowMetaInterface extraFields = getDatabaseTableFields( db, schemaName, tableName ); for ( int i = 0; i < fieldLookup.length; i++ ) { v = extraFields.searchValueMeta( fieldLookup[i] ); if ( v == null ) { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToFindReturnField", fieldLookup[i] ); logError( message ); throw new KettleStepException( message ); } if ( fieldStream[i] != null && fieldStream[i].length() > 0 ) { v.setName( fieldStream[i] ); } v.setOrigin( name ); row.addValueMeta( v ); } } else { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField" ); logError( message ); throw new KettleStepException( message ); } } catch ( Exception e ) { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField2" ); logError( message ); throw new KettleStepException( message, e ); } finally { if ( db != null ) { db.disconnect(); } } } } }
DimensionLookupMeta extends BaseStepMeta implements StepMetaInterface, ProvidesModelerMeta { @Override public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( ValueMetaInterface valueMeta : row.getValueMetaList() ) { valueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); valueMeta.setTrimType( ValueMetaInterface.TRIM_TYPE_NONE ); } if ( Utils.isEmpty( keyField ) ) { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Error.NoTechnicalKeySpecified" ); logError( message ); throw new KettleStepException( message ); } ValueMetaInterface v = new ValueMetaInteger( keyField ); if ( keyRename != null && keyRename.length() > 0 ) { v.setName( keyRename ); } v.setLength( 9 ); v.setPrecision( 0 ); v.setOrigin( name ); row.addValueMeta( v ); if ( !update && fieldLookup.length > 0 ) { Database db = null; try { if ( databaseMeta != null ) { db = createDatabaseObject(); RowMetaInterface extraFields = getDatabaseTableFields( db, schemaName, tableName ); for ( int i = 0; i < fieldLookup.length; i++ ) { v = extraFields.searchValueMeta( fieldLookup[i] ); if ( v == null ) { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToFindReturnField", fieldLookup[i] ); logError( message ); throw new KettleStepException( message ); } if ( fieldStream[i] != null && fieldStream[i].length() > 0 ) { v.setName( fieldStream[i] ); } v.setOrigin( name ); row.addValueMeta( v ); } } else { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField" ); logError( message ); throw new KettleStepException( message ); } } catch ( Exception e ) { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField2" ); logError( message ); throw new KettleStepException( message, e ); } finally { if ( db != null ) { db.disconnect(); } } } } DimensionLookupMeta(); }
DimensionLookupMeta extends BaseStepMeta implements StepMetaInterface, ProvidesModelerMeta { @Override public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( ValueMetaInterface valueMeta : row.getValueMetaList() ) { valueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); valueMeta.setTrimType( ValueMetaInterface.TRIM_TYPE_NONE ); } if ( Utils.isEmpty( keyField ) ) { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Error.NoTechnicalKeySpecified" ); logError( message ); throw new KettleStepException( message ); } ValueMetaInterface v = new ValueMetaInteger( keyField ); if ( keyRename != null && keyRename.length() > 0 ) { v.setName( keyRename ); } v.setLength( 9 ); v.setPrecision( 0 ); v.setOrigin( name ); row.addValueMeta( v ); if ( !update && fieldLookup.length > 0 ) { Database db = null; try { if ( databaseMeta != null ) { db = createDatabaseObject(); RowMetaInterface extraFields = getDatabaseTableFields( db, schemaName, tableName ); for ( int i = 0; i < fieldLookup.length; i++ ) { v = extraFields.searchValueMeta( fieldLookup[i] ); if ( v == null ) { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToFindReturnField", fieldLookup[i] ); logError( message ); throw new KettleStepException( message ); } if ( fieldStream[i] != null && fieldStream[i].length() > 0 ) { v.setName( fieldStream[i] ); } v.setOrigin( name ); row.addValueMeta( v ); } } else { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField" ); logError( message ); throw new KettleStepException( message ); } } catch ( Exception e ) { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField2" ); logError( message ); throw new KettleStepException( message, e ); } finally { if ( db != null ) { db.disconnect(); } } } } DimensionLookupMeta(); @Override String getTableName(); void setTableName( String tablename ); @Override DatabaseMeta getDatabaseMeta(); void setDatabaseMeta( DatabaseMeta database ); @Injection( name = "CONNECTION_NAME" ) void setConnection( String connectionName ); boolean isUpdate(); void setUpdate( boolean update ); boolean isAutoIncrement(); void setAutoIncrement( boolean autoIncrement ); void setTechKeyCreation( String techKeyCreation ); String getTechKeyCreation(); int getCommitSize(); void setCommitSize( int commitSize ); String getDateField(); void setDateField( String dateField ); String getDateFrom(); void setDateFrom( String dateFrom ); String getDateTo(); void setDateTo( String dateTo ); String[] getFieldLookup(); void setFieldLookup( String[] fieldLookup ); String[] getFieldStream(); void setFieldStream( String[] fieldStream ); int[] getFieldUpdate(); void setFieldUpdate( int[] fieldUpdate ); int[] getReturnType(); void setReturnType( int[] returnType ); String getKeyField(); void setKeyField( String keyField ); String[] getKeyLookup(); void setKeyLookup( String[] keyLookup ); String getKeyRename(); void setKeyRename( String keyRename ); String[] getKeyStream(); void setKeyStream( String[] keyStream ); int getMaxYear(); void setMaxYear( int maxYear ); int getMinYear(); void setMinYear( int minYear ); String getSequenceName(); void setSequenceName( String sequenceName ); String getVersionField(); void setVersionField( String versionField ); void actualizeWithInjectedValues(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrkeys, int nrfields ); @Override Object clone(); static final int getUpdateType( boolean upd, String ty ); static final String getUpdateType( boolean upd, int t ); static final String getUpdateTypeCode( boolean upd, int t ); static final int getStartDateAlternative( String string ); static final String getStartDateAlternativeCode( int alternative ); static final String getStartDateAlternativeDesc( int alternative ); static final String[] getStartDateAlternativeCodes(); static final String[] getStartDateAlternativeDescriptions(); static final boolean isUpdateTypeWithoutArgument( boolean update, int type ); @Override void setDefault(); @Override void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 ); Date getMinDate(); Date getMaxDate(); @Override void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); @Override RowMetaInterface getTableFields(); @Override SQLStatement getSQLStatements( TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, Repository repository, IMetaStore metaStore ); @Override void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository, IMetaStore metaStore ); @Override StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta tr, Trans trans ); @Override StepDataInterface getStepData(); @Override DatabaseMeta[] getUsedDatabaseConnections(); @Override String getSchemaName(); @Override String getMissingDatabaseConnectionInformationMessage(); void setSchemaName( String schemaName ); int getCacheSize(); void setCacheSize( int cacheSize ); boolean isUsingStartDateAlternative(); void setUsingStartDateAlternative( boolean usingStartDateAlternative ); int getStartDateAlternative(); void setStartDateAlternative( int startDateAlternative ); String getStartDateFieldName(); void setStartDateFieldName( String startDateFieldName ); boolean isPreloadingCache(); void setPreloadingCache( boolean preloadingCache ); boolean useBatchUpdate(); void setUseBatchUpdate( boolean useBatchUpdate ); @Override RowMeta getRowMeta( final StepDataInterface stepData ); @Override List<String> getDatabaseFields(); @Override List<String> getStreamFields(); void normalizeAllocationFields(); @AfterInjection void afterInjectionSynchronization(); }
DimensionLookupMeta extends BaseStepMeta implements StepMetaInterface, ProvidesModelerMeta { @Override public void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException { for ( ValueMetaInterface valueMeta : row.getValueMetaList() ) { valueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); valueMeta.setTrimType( ValueMetaInterface.TRIM_TYPE_NONE ); } if ( Utils.isEmpty( keyField ) ) { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Error.NoTechnicalKeySpecified" ); logError( message ); throw new KettleStepException( message ); } ValueMetaInterface v = new ValueMetaInteger( keyField ); if ( keyRename != null && keyRename.length() > 0 ) { v.setName( keyRename ); } v.setLength( 9 ); v.setPrecision( 0 ); v.setOrigin( name ); row.addValueMeta( v ); if ( !update && fieldLookup.length > 0 ) { Database db = null; try { if ( databaseMeta != null ) { db = createDatabaseObject(); RowMetaInterface extraFields = getDatabaseTableFields( db, schemaName, tableName ); for ( int i = 0; i < fieldLookup.length; i++ ) { v = extraFields.searchValueMeta( fieldLookup[i] ); if ( v == null ) { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToFindReturnField", fieldLookup[i] ); logError( message ); throw new KettleStepException( message ); } if ( fieldStream[i] != null && fieldStream[i].length() > 0 ) { v.setName( fieldStream[i] ); } v.setOrigin( name ); row.addValueMeta( v ); } } else { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField" ); logError( message ); throw new KettleStepException( message ); } } catch ( Exception e ) { String message = BaseMessages.getString( PKG, "DimensionLookupMeta.Exception.UnableToRetrieveDataTypeOfReturnField2" ); logError( message ); throw new KettleStepException( message, e ); } finally { if ( db != null ) { db.disconnect(); } } } } DimensionLookupMeta(); @Override String getTableName(); void setTableName( String tablename ); @Override DatabaseMeta getDatabaseMeta(); void setDatabaseMeta( DatabaseMeta database ); @Injection( name = "CONNECTION_NAME" ) void setConnection( String connectionName ); boolean isUpdate(); void setUpdate( boolean update ); boolean isAutoIncrement(); void setAutoIncrement( boolean autoIncrement ); void setTechKeyCreation( String techKeyCreation ); String getTechKeyCreation(); int getCommitSize(); void setCommitSize( int commitSize ); String getDateField(); void setDateField( String dateField ); String getDateFrom(); void setDateFrom( String dateFrom ); String getDateTo(); void setDateTo( String dateTo ); String[] getFieldLookup(); void setFieldLookup( String[] fieldLookup ); String[] getFieldStream(); void setFieldStream( String[] fieldStream ); int[] getFieldUpdate(); void setFieldUpdate( int[] fieldUpdate ); int[] getReturnType(); void setReturnType( int[] returnType ); String getKeyField(); void setKeyField( String keyField ); String[] getKeyLookup(); void setKeyLookup( String[] keyLookup ); String getKeyRename(); void setKeyRename( String keyRename ); String[] getKeyStream(); void setKeyStream( String[] keyStream ); int getMaxYear(); void setMaxYear( int maxYear ); int getMinYear(); void setMinYear( int minYear ); String getSequenceName(); void setSequenceName( String sequenceName ); String getVersionField(); void setVersionField( String versionField ); void actualizeWithInjectedValues(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrkeys, int nrfields ); @Override Object clone(); static final int getUpdateType( boolean upd, String ty ); static final String getUpdateType( boolean upd, int t ); static final String getUpdateTypeCode( boolean upd, int t ); static final int getStartDateAlternative( String string ); static final String getStartDateAlternativeCode( int alternative ); static final String getStartDateAlternativeDesc( int alternative ); static final String[] getStartDateAlternativeCodes(); static final String[] getStartDateAlternativeDescriptions(); static final boolean isUpdateTypeWithoutArgument( boolean update, int type ); @Override void setDefault(); @Override void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 ); Date getMinDate(); Date getMaxDate(); @Override void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); @Override RowMetaInterface getTableFields(); @Override SQLStatement getSQLStatements( TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, Repository repository, IMetaStore metaStore ); @Override void analyseImpact( List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, Repository repository, IMetaStore metaStore ); @Override StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta tr, Trans trans ); @Override StepDataInterface getStepData(); @Override DatabaseMeta[] getUsedDatabaseConnections(); @Override String getSchemaName(); @Override String getMissingDatabaseConnectionInformationMessage(); void setSchemaName( String schemaName ); int getCacheSize(); void setCacheSize( int cacheSize ); boolean isUsingStartDateAlternative(); void setUsingStartDateAlternative( boolean usingStartDateAlternative ); int getStartDateAlternative(); void setStartDateAlternative( int startDateAlternative ); String getStartDateFieldName(); void setStartDateFieldName( String startDateFieldName ); boolean isPreloadingCache(); void setPreloadingCache( boolean preloadingCache ); boolean useBatchUpdate(); void setUseBatchUpdate( boolean useBatchUpdate ); @Override RowMeta getRowMeta( final StepDataInterface stepData ); @Override List<String> getDatabaseFields(); @Override List<String> getStreamFields(); void normalizeAllocationFields(); @AfterInjection void afterInjectionSynchronization(); static final int TYPE_UPDATE_DIM_INSERT; static final int TYPE_UPDATE_DIM_UPDATE; static final int TYPE_UPDATE_DIM_PUNCHTHROUGH; static final int TYPE_UPDATE_DATE_INSUP; static final int TYPE_UPDATE_DATE_INSERTED; static final int TYPE_UPDATE_DATE_UPDATED; static final int TYPE_UPDATE_LAST_VERSION; static final String[] typeDesc; static final String[] typeCodes; static final String[] typeDescLookup; static final int START_DATE_ALTERNATIVE_NONE; static final int START_DATE_ALTERNATIVE_SYSDATE; static final int START_DATE_ALTERNATIVE_START_OF_TRANS; static final int START_DATE_ALTERNATIVE_NULL; static final int START_DATE_ALTERNATIVE_COLUMN_VALUE; static String CREATION_METHOD_AUTOINC; static String CREATION_METHOD_SEQUENCE; static String CREATION_METHOD_TABLEMAX; }
@Test public void testOnClusterCheck() throws Exception { }
public void onClusterCheck() { if ( clusteringCheck != null ) { boolean dis = !clusteringCheck.isChecked(); if ( clusterParameterTree != null ) { clusterParameterTree.setDisabled( dis ); } if ( clusterParameterDescriptionLabel != null ) { clusterParameterDescriptionLabel.setDisabled( dis ); } } }
DataHandler extends AbstractXulEventHandler { public void onClusterCheck() { if ( clusteringCheck != null ) { boolean dis = !clusteringCheck.isChecked(); if ( clusterParameterTree != null ) { clusterParameterTree.setDisabled( dis ); } if ( clusterParameterDescriptionLabel != null ) { clusterParameterDescriptionLabel.setDisabled( dis ); } } } }
DataHandler extends AbstractXulEventHandler { public void onClusterCheck() { if ( clusteringCheck != null ) { boolean dis = !clusteringCheck.isChecked(); if ( clusterParameterTree != null ) { clusterParameterTree.setDisabled( dis ); } if ( clusterParameterDescriptionLabel != null ) { clusterParameterDescriptionLabel.setDisabled( dis ); } } } DataHandler(); }
DataHandler extends AbstractXulEventHandler { public void onClusterCheck() { if ( clusteringCheck != null ) { boolean dis = !clusteringCheck.isChecked(); if ( clusterParameterTree != null ) { clusterParameterTree.setDisabled( dis ); } if ( clusterParameterDescriptionLabel != null ) { clusterParameterDescriptionLabel.setDisabled( dis ); } } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); }
DataHandler extends AbstractXulEventHandler { public void onClusterCheck() { if ( clusteringCheck != null ) { boolean dis = !clusteringCheck.isChecked(); if ( clusterParameterTree != null ) { clusterParameterTree.setDisabled( dis ); } if ( clusterParameterDescriptionLabel != null ) { clusterParameterDescriptionLabel.setDisabled( dis ); } } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); static final SortedMap<String, DatabaseInterface> connectionMap; static final Map<String, String> connectionNametoID; }
@Test public void setSelectName() { selectValuesMeta.setSelectName( new String[] { FIRST_FIELD, SECOND_FIELD } ); assertArrayEquals( new String[] { FIRST_FIELD, SECOND_FIELD }, selectValuesMeta.getSelectName() ); }
public void setSelectName( String[] selectName ) { resizeSelectFields( selectName.length ); for ( int i = 0; i < selectFields.length; i++ ) { selectFields[i].setName( selectName[i] ); } }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectName( String[] selectName ) { resizeSelectFields( selectName.length ); for ( int i = 0; i < selectFields.length; i++ ) { selectFields[i].setName( selectName[i] ); } } }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectName( String[] selectName ) { resizeSelectFields( selectName.length ); for ( int i = 0; i < selectFields.length; i++ ) { selectFields[i].setName( selectName[i] ); } } SelectValuesMeta(); }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectName( String[] selectName ) { resizeSelectFields( selectName.length ); for ( int i = 0; i < selectFields.length; i++ ) { selectFields[i].setName( selectName[i] ); } } SelectValuesMeta(); String[] getDeleteName(); void setDeleteName( String[] deleteName ); void setSelectName( String[] selectName ); String[] getSelectName(); void setSelectRename( String[] selectRename ); String[] getSelectRename(); void setSelectLength( int[] selectLength ); int[] getSelectLength(); void setSelectPrecision( int[] selectPrecision ); int[] getSelectPrecision(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrFields, int nrRemove, int nrMeta ); @Override Object clone(); @Override void setDefault(); void getSelectFields( RowMetaInterface inputRowMeta, String name ); void getDeleteFields( RowMetaInterface inputRowMeta ); @Deprecated void getMetadataFields( RowMetaInterface inputRowMeta, String name ); void getMetadataFields( RowMetaInterface inputRowMeta, String name, VariableSpace space ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, 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(); boolean isSelectingAndSortingUnspecifiedFields(); void setSelectingAndSortingUnspecifiedFields( boolean selectingAndSortingUnspecifiedFields ); SelectMetadataChange[] getMeta(); void setMeta( SelectMetadataChange[] meta ); @Override boolean supportsErrorHandling(); SelectField[] getSelectFields(); void setSelectFields( SelectField[] selectFields ); List<FieldnameLineage> getFieldnameLineage(); }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectName( String[] selectName ) { resizeSelectFields( selectName.length ); for ( int i = 0; i < selectFields.length; i++ ) { selectFields[i].setName( selectName[i] ); } } SelectValuesMeta(); String[] getDeleteName(); void setDeleteName( String[] deleteName ); void setSelectName( String[] selectName ); String[] getSelectName(); void setSelectRename( String[] selectRename ); String[] getSelectRename(); void setSelectLength( int[] selectLength ); int[] getSelectLength(); void setSelectPrecision( int[] selectPrecision ); int[] getSelectPrecision(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrFields, int nrRemove, int nrMeta ); @Override Object clone(); @Override void setDefault(); void getSelectFields( RowMetaInterface inputRowMeta, String name ); void getDeleteFields( RowMetaInterface inputRowMeta ); @Deprecated void getMetadataFields( RowMetaInterface inputRowMeta, String name ); void getMetadataFields( RowMetaInterface inputRowMeta, String name, VariableSpace space ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, 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(); boolean isSelectingAndSortingUnspecifiedFields(); void setSelectingAndSortingUnspecifiedFields( boolean selectingAndSortingUnspecifiedFields ); SelectMetadataChange[] getMeta(); void setMeta( SelectMetadataChange[] meta ); @Override boolean supportsErrorHandling(); SelectField[] getSelectFields(); void setSelectFields( SelectField[] selectFields ); List<FieldnameLineage> getFieldnameLineage(); static final int UNDEFINED; }
@Test public void getSelectName() { assertArrayEquals( new String[0], selectValuesMeta.getSelectName() ); }
public String[] getSelectName() { String[] selectName = new String[selectFields.length]; for ( int i = 0; i < selectName.length; i++ ) { selectName[i] = selectFields[i].getName(); } return selectName; }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public String[] getSelectName() { String[] selectName = new String[selectFields.length]; for ( int i = 0; i < selectName.length; i++ ) { selectName[i] = selectFields[i].getName(); } return selectName; } }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public String[] getSelectName() { String[] selectName = new String[selectFields.length]; for ( int i = 0; i < selectName.length; i++ ) { selectName[i] = selectFields[i].getName(); } return selectName; } SelectValuesMeta(); }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public String[] getSelectName() { String[] selectName = new String[selectFields.length]; for ( int i = 0; i < selectName.length; i++ ) { selectName[i] = selectFields[i].getName(); } return selectName; } SelectValuesMeta(); String[] getDeleteName(); void setDeleteName( String[] deleteName ); void setSelectName( String[] selectName ); String[] getSelectName(); void setSelectRename( String[] selectRename ); String[] getSelectRename(); void setSelectLength( int[] selectLength ); int[] getSelectLength(); void setSelectPrecision( int[] selectPrecision ); int[] getSelectPrecision(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrFields, int nrRemove, int nrMeta ); @Override Object clone(); @Override void setDefault(); void getSelectFields( RowMetaInterface inputRowMeta, String name ); void getDeleteFields( RowMetaInterface inputRowMeta ); @Deprecated void getMetadataFields( RowMetaInterface inputRowMeta, String name ); void getMetadataFields( RowMetaInterface inputRowMeta, String name, VariableSpace space ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, 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(); boolean isSelectingAndSortingUnspecifiedFields(); void setSelectingAndSortingUnspecifiedFields( boolean selectingAndSortingUnspecifiedFields ); SelectMetadataChange[] getMeta(); void setMeta( SelectMetadataChange[] meta ); @Override boolean supportsErrorHandling(); SelectField[] getSelectFields(); void setSelectFields( SelectField[] selectFields ); List<FieldnameLineage> getFieldnameLineage(); }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public String[] getSelectName() { String[] selectName = new String[selectFields.length]; for ( int i = 0; i < selectName.length; i++ ) { selectName[i] = selectFields[i].getName(); } return selectName; } SelectValuesMeta(); String[] getDeleteName(); void setDeleteName( String[] deleteName ); void setSelectName( String[] selectName ); String[] getSelectName(); void setSelectRename( String[] selectRename ); String[] getSelectRename(); void setSelectLength( int[] selectLength ); int[] getSelectLength(); void setSelectPrecision( int[] selectPrecision ); int[] getSelectPrecision(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrFields, int nrRemove, int nrMeta ); @Override Object clone(); @Override void setDefault(); void getSelectFields( RowMetaInterface inputRowMeta, String name ); void getDeleteFields( RowMetaInterface inputRowMeta ); @Deprecated void getMetadataFields( RowMetaInterface inputRowMeta, String name ); void getMetadataFields( RowMetaInterface inputRowMeta, String name, VariableSpace space ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, 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(); boolean isSelectingAndSortingUnspecifiedFields(); void setSelectingAndSortingUnspecifiedFields( boolean selectingAndSortingUnspecifiedFields ); SelectMetadataChange[] getMeta(); void setMeta( SelectMetadataChange[] meta ); @Override boolean supportsErrorHandling(); SelectField[] getSelectFields(); void setSelectFields( SelectField[] selectFields ); List<FieldnameLineage> getFieldnameLineage(); static final int UNDEFINED; }
@Test public void setSelectRename() { selectValuesMeta.setSelectRename( new String[] { FIRST_FIELD, SECOND_FIELD } ); assertArrayEquals( new String[] { FIRST_FIELD, SECOND_FIELD }, selectValuesMeta.getSelectRename() ); }
public void setSelectRename( String[] selectRename ) { if ( selectRename.length > selectFields.length ) { resizeSelectFields( selectRename.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectRename.length ) { selectFields[i].setRename( selectRename[i] ); } else { selectFields[i].setRename( null ); } } }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectRename( String[] selectRename ) { if ( selectRename.length > selectFields.length ) { resizeSelectFields( selectRename.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectRename.length ) { selectFields[i].setRename( selectRename[i] ); } else { selectFields[i].setRename( null ); } } } }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectRename( String[] selectRename ) { if ( selectRename.length > selectFields.length ) { resizeSelectFields( selectRename.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectRename.length ) { selectFields[i].setRename( selectRename[i] ); } else { selectFields[i].setRename( null ); } } } SelectValuesMeta(); }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectRename( String[] selectRename ) { if ( selectRename.length > selectFields.length ) { resizeSelectFields( selectRename.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectRename.length ) { selectFields[i].setRename( selectRename[i] ); } else { selectFields[i].setRename( null ); } } } SelectValuesMeta(); String[] getDeleteName(); void setDeleteName( String[] deleteName ); void setSelectName( String[] selectName ); String[] getSelectName(); void setSelectRename( String[] selectRename ); String[] getSelectRename(); void setSelectLength( int[] selectLength ); int[] getSelectLength(); void setSelectPrecision( int[] selectPrecision ); int[] getSelectPrecision(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrFields, int nrRemove, int nrMeta ); @Override Object clone(); @Override void setDefault(); void getSelectFields( RowMetaInterface inputRowMeta, String name ); void getDeleteFields( RowMetaInterface inputRowMeta ); @Deprecated void getMetadataFields( RowMetaInterface inputRowMeta, String name ); void getMetadataFields( RowMetaInterface inputRowMeta, String name, VariableSpace space ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, 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(); boolean isSelectingAndSortingUnspecifiedFields(); void setSelectingAndSortingUnspecifiedFields( boolean selectingAndSortingUnspecifiedFields ); SelectMetadataChange[] getMeta(); void setMeta( SelectMetadataChange[] meta ); @Override boolean supportsErrorHandling(); SelectField[] getSelectFields(); void setSelectFields( SelectField[] selectFields ); List<FieldnameLineage> getFieldnameLineage(); }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectRename( String[] selectRename ) { if ( selectRename.length > selectFields.length ) { resizeSelectFields( selectRename.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectRename.length ) { selectFields[i].setRename( selectRename[i] ); } else { selectFields[i].setRename( null ); } } } SelectValuesMeta(); String[] getDeleteName(); void setDeleteName( String[] deleteName ); void setSelectName( String[] selectName ); String[] getSelectName(); void setSelectRename( String[] selectRename ); String[] getSelectRename(); void setSelectLength( int[] selectLength ); int[] getSelectLength(); void setSelectPrecision( int[] selectPrecision ); int[] getSelectPrecision(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrFields, int nrRemove, int nrMeta ); @Override Object clone(); @Override void setDefault(); void getSelectFields( RowMetaInterface inputRowMeta, String name ); void getDeleteFields( RowMetaInterface inputRowMeta ); @Deprecated void getMetadataFields( RowMetaInterface inputRowMeta, String name ); void getMetadataFields( RowMetaInterface inputRowMeta, String name, VariableSpace space ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, 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(); boolean isSelectingAndSortingUnspecifiedFields(); void setSelectingAndSortingUnspecifiedFields( boolean selectingAndSortingUnspecifiedFields ); SelectMetadataChange[] getMeta(); void setMeta( SelectMetadataChange[] meta ); @Override boolean supportsErrorHandling(); SelectField[] getSelectFields(); void setSelectFields( SelectField[] selectFields ); List<FieldnameLineage> getFieldnameLineage(); static final int UNDEFINED; }
@Test public void getSelectRename() { assertArrayEquals( new String[0], selectValuesMeta.getSelectRename() ); }
public String[] getSelectRename() { String[] selectRename = new String[selectFields.length]; for ( int i = 0; i < selectRename.length; i++ ) { selectRename[i] = selectFields[i].getRename(); } return selectRename; }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public String[] getSelectRename() { String[] selectRename = new String[selectFields.length]; for ( int i = 0; i < selectRename.length; i++ ) { selectRename[i] = selectFields[i].getRename(); } return selectRename; } }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public String[] getSelectRename() { String[] selectRename = new String[selectFields.length]; for ( int i = 0; i < selectRename.length; i++ ) { selectRename[i] = selectFields[i].getRename(); } return selectRename; } SelectValuesMeta(); }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public String[] getSelectRename() { String[] selectRename = new String[selectFields.length]; for ( int i = 0; i < selectRename.length; i++ ) { selectRename[i] = selectFields[i].getRename(); } return selectRename; } SelectValuesMeta(); String[] getDeleteName(); void setDeleteName( String[] deleteName ); void setSelectName( String[] selectName ); String[] getSelectName(); void setSelectRename( String[] selectRename ); String[] getSelectRename(); void setSelectLength( int[] selectLength ); int[] getSelectLength(); void setSelectPrecision( int[] selectPrecision ); int[] getSelectPrecision(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrFields, int nrRemove, int nrMeta ); @Override Object clone(); @Override void setDefault(); void getSelectFields( RowMetaInterface inputRowMeta, String name ); void getDeleteFields( RowMetaInterface inputRowMeta ); @Deprecated void getMetadataFields( RowMetaInterface inputRowMeta, String name ); void getMetadataFields( RowMetaInterface inputRowMeta, String name, VariableSpace space ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, 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(); boolean isSelectingAndSortingUnspecifiedFields(); void setSelectingAndSortingUnspecifiedFields( boolean selectingAndSortingUnspecifiedFields ); SelectMetadataChange[] getMeta(); void setMeta( SelectMetadataChange[] meta ); @Override boolean supportsErrorHandling(); SelectField[] getSelectFields(); void setSelectFields( SelectField[] selectFields ); List<FieldnameLineage> getFieldnameLineage(); }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public String[] getSelectRename() { String[] selectRename = new String[selectFields.length]; for ( int i = 0; i < selectRename.length; i++ ) { selectRename[i] = selectFields[i].getRename(); } return selectRename; } SelectValuesMeta(); String[] getDeleteName(); void setDeleteName( String[] deleteName ); void setSelectName( String[] selectName ); String[] getSelectName(); void setSelectRename( String[] selectRename ); String[] getSelectRename(); void setSelectLength( int[] selectLength ); int[] getSelectLength(); void setSelectPrecision( int[] selectPrecision ); int[] getSelectPrecision(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrFields, int nrRemove, int nrMeta ); @Override Object clone(); @Override void setDefault(); void getSelectFields( RowMetaInterface inputRowMeta, String name ); void getDeleteFields( RowMetaInterface inputRowMeta ); @Deprecated void getMetadataFields( RowMetaInterface inputRowMeta, String name ); void getMetadataFields( RowMetaInterface inputRowMeta, String name, VariableSpace space ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, 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(); boolean isSelectingAndSortingUnspecifiedFields(); void setSelectingAndSortingUnspecifiedFields( boolean selectingAndSortingUnspecifiedFields ); SelectMetadataChange[] getMeta(); void setMeta( SelectMetadataChange[] meta ); @Override boolean supportsErrorHandling(); SelectField[] getSelectFields(); void setSelectFields( SelectField[] selectFields ); List<FieldnameLineage> getFieldnameLineage(); static final int UNDEFINED; }
@Test public void setSelectLength() { selectValuesMeta.setSelectLength( new int[] { 1, 2 } ); assertArrayEquals( new int[] { 1, 2 }, selectValuesMeta.getSelectLength() ); }
public void setSelectLength( int[] selectLength ) { if ( selectLength.length > selectFields.length ) { resizeSelectFields( selectLength.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectLength.length ) { selectFields[i].setLength( selectLength[i] ); } else { selectFields[i].setLength( UNDEFINED ); } } }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectLength( int[] selectLength ) { if ( selectLength.length > selectFields.length ) { resizeSelectFields( selectLength.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectLength.length ) { selectFields[i].setLength( selectLength[i] ); } else { selectFields[i].setLength( UNDEFINED ); } } } }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectLength( int[] selectLength ) { if ( selectLength.length > selectFields.length ) { resizeSelectFields( selectLength.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectLength.length ) { selectFields[i].setLength( selectLength[i] ); } else { selectFields[i].setLength( UNDEFINED ); } } } SelectValuesMeta(); }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectLength( int[] selectLength ) { if ( selectLength.length > selectFields.length ) { resizeSelectFields( selectLength.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectLength.length ) { selectFields[i].setLength( selectLength[i] ); } else { selectFields[i].setLength( UNDEFINED ); } } } SelectValuesMeta(); String[] getDeleteName(); void setDeleteName( String[] deleteName ); void setSelectName( String[] selectName ); String[] getSelectName(); void setSelectRename( String[] selectRename ); String[] getSelectRename(); void setSelectLength( int[] selectLength ); int[] getSelectLength(); void setSelectPrecision( int[] selectPrecision ); int[] getSelectPrecision(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrFields, int nrRemove, int nrMeta ); @Override Object clone(); @Override void setDefault(); void getSelectFields( RowMetaInterface inputRowMeta, String name ); void getDeleteFields( RowMetaInterface inputRowMeta ); @Deprecated void getMetadataFields( RowMetaInterface inputRowMeta, String name ); void getMetadataFields( RowMetaInterface inputRowMeta, String name, VariableSpace space ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, 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(); boolean isSelectingAndSortingUnspecifiedFields(); void setSelectingAndSortingUnspecifiedFields( boolean selectingAndSortingUnspecifiedFields ); SelectMetadataChange[] getMeta(); void setMeta( SelectMetadataChange[] meta ); @Override boolean supportsErrorHandling(); SelectField[] getSelectFields(); void setSelectFields( SelectField[] selectFields ); List<FieldnameLineage> getFieldnameLineage(); }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectLength( int[] selectLength ) { if ( selectLength.length > selectFields.length ) { resizeSelectFields( selectLength.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectLength.length ) { selectFields[i].setLength( selectLength[i] ); } else { selectFields[i].setLength( UNDEFINED ); } } } SelectValuesMeta(); String[] getDeleteName(); void setDeleteName( String[] deleteName ); void setSelectName( String[] selectName ); String[] getSelectName(); void setSelectRename( String[] selectRename ); String[] getSelectRename(); void setSelectLength( int[] selectLength ); int[] getSelectLength(); void setSelectPrecision( int[] selectPrecision ); int[] getSelectPrecision(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrFields, int nrRemove, int nrMeta ); @Override Object clone(); @Override void setDefault(); void getSelectFields( RowMetaInterface inputRowMeta, String name ); void getDeleteFields( RowMetaInterface inputRowMeta ); @Deprecated void getMetadataFields( RowMetaInterface inputRowMeta, String name ); void getMetadataFields( RowMetaInterface inputRowMeta, String name, VariableSpace space ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, 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(); boolean isSelectingAndSortingUnspecifiedFields(); void setSelectingAndSortingUnspecifiedFields( boolean selectingAndSortingUnspecifiedFields ); SelectMetadataChange[] getMeta(); void setMeta( SelectMetadataChange[] meta ); @Override boolean supportsErrorHandling(); SelectField[] getSelectFields(); void setSelectFields( SelectField[] selectFields ); List<FieldnameLineage> getFieldnameLineage(); static final int UNDEFINED; }
@Test public void getSelectLength() { assertArrayEquals( new int[0], selectValuesMeta.getSelectLength() ); }
public int[] getSelectLength() { int[] selectLength = new int[selectFields.length]; for ( int i = 0; i < selectLength.length; i++ ) { selectLength[i] = selectFields[i].getLength(); } return selectLength; }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public int[] getSelectLength() { int[] selectLength = new int[selectFields.length]; for ( int i = 0; i < selectLength.length; i++ ) { selectLength[i] = selectFields[i].getLength(); } return selectLength; } }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public int[] getSelectLength() { int[] selectLength = new int[selectFields.length]; for ( int i = 0; i < selectLength.length; i++ ) { selectLength[i] = selectFields[i].getLength(); } return selectLength; } SelectValuesMeta(); }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public int[] getSelectLength() { int[] selectLength = new int[selectFields.length]; for ( int i = 0; i < selectLength.length; i++ ) { selectLength[i] = selectFields[i].getLength(); } return selectLength; } SelectValuesMeta(); String[] getDeleteName(); void setDeleteName( String[] deleteName ); void setSelectName( String[] selectName ); String[] getSelectName(); void setSelectRename( String[] selectRename ); String[] getSelectRename(); void setSelectLength( int[] selectLength ); int[] getSelectLength(); void setSelectPrecision( int[] selectPrecision ); int[] getSelectPrecision(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrFields, int nrRemove, int nrMeta ); @Override Object clone(); @Override void setDefault(); void getSelectFields( RowMetaInterface inputRowMeta, String name ); void getDeleteFields( RowMetaInterface inputRowMeta ); @Deprecated void getMetadataFields( RowMetaInterface inputRowMeta, String name ); void getMetadataFields( RowMetaInterface inputRowMeta, String name, VariableSpace space ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, 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(); boolean isSelectingAndSortingUnspecifiedFields(); void setSelectingAndSortingUnspecifiedFields( boolean selectingAndSortingUnspecifiedFields ); SelectMetadataChange[] getMeta(); void setMeta( SelectMetadataChange[] meta ); @Override boolean supportsErrorHandling(); SelectField[] getSelectFields(); void setSelectFields( SelectField[] selectFields ); List<FieldnameLineage> getFieldnameLineage(); }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public int[] getSelectLength() { int[] selectLength = new int[selectFields.length]; for ( int i = 0; i < selectLength.length; i++ ) { selectLength[i] = selectFields[i].getLength(); } return selectLength; } SelectValuesMeta(); String[] getDeleteName(); void setDeleteName( String[] deleteName ); void setSelectName( String[] selectName ); String[] getSelectName(); void setSelectRename( String[] selectRename ); String[] getSelectRename(); void setSelectLength( int[] selectLength ); int[] getSelectLength(); void setSelectPrecision( int[] selectPrecision ); int[] getSelectPrecision(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrFields, int nrRemove, int nrMeta ); @Override Object clone(); @Override void setDefault(); void getSelectFields( RowMetaInterface inputRowMeta, String name ); void getDeleteFields( RowMetaInterface inputRowMeta ); @Deprecated void getMetadataFields( RowMetaInterface inputRowMeta, String name ); void getMetadataFields( RowMetaInterface inputRowMeta, String name, VariableSpace space ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, 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(); boolean isSelectingAndSortingUnspecifiedFields(); void setSelectingAndSortingUnspecifiedFields( boolean selectingAndSortingUnspecifiedFields ); SelectMetadataChange[] getMeta(); void setMeta( SelectMetadataChange[] meta ); @Override boolean supportsErrorHandling(); SelectField[] getSelectFields(); void setSelectFields( SelectField[] selectFields ); List<FieldnameLineage> getFieldnameLineage(); static final int UNDEFINED; }
@Test public void setSelectPrecision() { selectValuesMeta.setSelectPrecision( new int[] { 1, 2 } ); assertArrayEquals( new int[] { 1, 2 }, selectValuesMeta.getSelectPrecision() ); }
public void setSelectPrecision( int[] selectPrecision ) { if ( selectPrecision.length > selectFields.length ) { resizeSelectFields( selectPrecision.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectPrecision.length ) { selectFields[i].setPrecision( selectPrecision[i] ); } else { selectFields[i].setPrecision( UNDEFINED ); } } }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectPrecision( int[] selectPrecision ) { if ( selectPrecision.length > selectFields.length ) { resizeSelectFields( selectPrecision.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectPrecision.length ) { selectFields[i].setPrecision( selectPrecision[i] ); } else { selectFields[i].setPrecision( UNDEFINED ); } } } }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectPrecision( int[] selectPrecision ) { if ( selectPrecision.length > selectFields.length ) { resizeSelectFields( selectPrecision.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectPrecision.length ) { selectFields[i].setPrecision( selectPrecision[i] ); } else { selectFields[i].setPrecision( UNDEFINED ); } } } SelectValuesMeta(); }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectPrecision( int[] selectPrecision ) { if ( selectPrecision.length > selectFields.length ) { resizeSelectFields( selectPrecision.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectPrecision.length ) { selectFields[i].setPrecision( selectPrecision[i] ); } else { selectFields[i].setPrecision( UNDEFINED ); } } } SelectValuesMeta(); String[] getDeleteName(); void setDeleteName( String[] deleteName ); void setSelectName( String[] selectName ); String[] getSelectName(); void setSelectRename( String[] selectRename ); String[] getSelectRename(); void setSelectLength( int[] selectLength ); int[] getSelectLength(); void setSelectPrecision( int[] selectPrecision ); int[] getSelectPrecision(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrFields, int nrRemove, int nrMeta ); @Override Object clone(); @Override void setDefault(); void getSelectFields( RowMetaInterface inputRowMeta, String name ); void getDeleteFields( RowMetaInterface inputRowMeta ); @Deprecated void getMetadataFields( RowMetaInterface inputRowMeta, String name ); void getMetadataFields( RowMetaInterface inputRowMeta, String name, VariableSpace space ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, 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(); boolean isSelectingAndSortingUnspecifiedFields(); void setSelectingAndSortingUnspecifiedFields( boolean selectingAndSortingUnspecifiedFields ); SelectMetadataChange[] getMeta(); void setMeta( SelectMetadataChange[] meta ); @Override boolean supportsErrorHandling(); SelectField[] getSelectFields(); void setSelectFields( SelectField[] selectFields ); List<FieldnameLineage> getFieldnameLineage(); }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public void setSelectPrecision( int[] selectPrecision ) { if ( selectPrecision.length > selectFields.length ) { resizeSelectFields( selectPrecision.length ); } for ( int i = 0; i < selectFields.length; i++ ) { if ( i < selectPrecision.length ) { selectFields[i].setPrecision( selectPrecision[i] ); } else { selectFields[i].setPrecision( UNDEFINED ); } } } SelectValuesMeta(); String[] getDeleteName(); void setDeleteName( String[] deleteName ); void setSelectName( String[] selectName ); String[] getSelectName(); void setSelectRename( String[] selectRename ); String[] getSelectRename(); void setSelectLength( int[] selectLength ); int[] getSelectLength(); void setSelectPrecision( int[] selectPrecision ); int[] getSelectPrecision(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrFields, int nrRemove, int nrMeta ); @Override Object clone(); @Override void setDefault(); void getSelectFields( RowMetaInterface inputRowMeta, String name ); void getDeleteFields( RowMetaInterface inputRowMeta ); @Deprecated void getMetadataFields( RowMetaInterface inputRowMeta, String name ); void getMetadataFields( RowMetaInterface inputRowMeta, String name, VariableSpace space ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, 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(); boolean isSelectingAndSortingUnspecifiedFields(); void setSelectingAndSortingUnspecifiedFields( boolean selectingAndSortingUnspecifiedFields ); SelectMetadataChange[] getMeta(); void setMeta( SelectMetadataChange[] meta ); @Override boolean supportsErrorHandling(); SelectField[] getSelectFields(); void setSelectFields( SelectField[] selectFields ); List<FieldnameLineage> getFieldnameLineage(); static final int UNDEFINED; }
@Test public void getSelectPrecision() { assertArrayEquals( new int[0], selectValuesMeta.getSelectPrecision() ); }
public int[] getSelectPrecision() { int[] selectPrecision = new int[selectFields.length]; for ( int i = 0; i < selectPrecision.length; i++ ) { selectPrecision[i] = selectFields[i].getPrecision(); } return selectPrecision; }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public int[] getSelectPrecision() { int[] selectPrecision = new int[selectFields.length]; for ( int i = 0; i < selectPrecision.length; i++ ) { selectPrecision[i] = selectFields[i].getPrecision(); } return selectPrecision; } }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public int[] getSelectPrecision() { int[] selectPrecision = new int[selectFields.length]; for ( int i = 0; i < selectPrecision.length; i++ ) { selectPrecision[i] = selectFields[i].getPrecision(); } return selectPrecision; } SelectValuesMeta(); }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public int[] getSelectPrecision() { int[] selectPrecision = new int[selectFields.length]; for ( int i = 0; i < selectPrecision.length; i++ ) { selectPrecision[i] = selectFields[i].getPrecision(); } return selectPrecision; } SelectValuesMeta(); String[] getDeleteName(); void setDeleteName( String[] deleteName ); void setSelectName( String[] selectName ); String[] getSelectName(); void setSelectRename( String[] selectRename ); String[] getSelectRename(); void setSelectLength( int[] selectLength ); int[] getSelectLength(); void setSelectPrecision( int[] selectPrecision ); int[] getSelectPrecision(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrFields, int nrRemove, int nrMeta ); @Override Object clone(); @Override void setDefault(); void getSelectFields( RowMetaInterface inputRowMeta, String name ); void getDeleteFields( RowMetaInterface inputRowMeta ); @Deprecated void getMetadataFields( RowMetaInterface inputRowMeta, String name ); void getMetadataFields( RowMetaInterface inputRowMeta, String name, VariableSpace space ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, 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(); boolean isSelectingAndSortingUnspecifiedFields(); void setSelectingAndSortingUnspecifiedFields( boolean selectingAndSortingUnspecifiedFields ); SelectMetadataChange[] getMeta(); void setMeta( SelectMetadataChange[] meta ); @Override boolean supportsErrorHandling(); SelectField[] getSelectFields(); void setSelectFields( SelectField[] selectFields ); List<FieldnameLineage> getFieldnameLineage(); }
SelectValuesMeta extends BaseStepMeta implements StepMetaInterface { public int[] getSelectPrecision() { int[] selectPrecision = new int[selectFields.length]; for ( int i = 0; i < selectPrecision.length; i++ ) { selectPrecision[i] = selectFields[i].getPrecision(); } return selectPrecision; } SelectValuesMeta(); String[] getDeleteName(); void setDeleteName( String[] deleteName ); void setSelectName( String[] selectName ); String[] getSelectName(); void setSelectRename( String[] selectRename ); String[] getSelectRename(); void setSelectLength( int[] selectLength ); int[] getSelectLength(); void setSelectPrecision( int[] selectPrecision ); int[] getSelectPrecision(); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int nrFields, int nrRemove, int nrMeta ); @Override Object clone(); @Override void setDefault(); void getSelectFields( RowMetaInterface inputRowMeta, String name ); void getDeleteFields( RowMetaInterface inputRowMeta ); @Deprecated void getMetadataFields( RowMetaInterface inputRowMeta, String name ); void getMetadataFields( RowMetaInterface inputRowMeta, String name, VariableSpace space ); @Override void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, 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(); boolean isSelectingAndSortingUnspecifiedFields(); void setSelectingAndSortingUnspecifiedFields( boolean selectingAndSortingUnspecifiedFields ); SelectMetadataChange[] getMeta(); void setMeta( SelectMetadataChange[] meta ); @Override boolean supportsErrorHandling(); SelectField[] getSelectFields(); void setSelectFields( SelectField[] selectFields ); List<FieldnameLineage> getFieldnameLineage(); static final int UNDEFINED; }
@Test public void testPDI16368() throws Exception { StepMockHelper<SelectValuesMeta, StepDataInterface> helper = StepMockUtil.getStepMockHelper( SelectValuesMeta.class, "SelectValuesTest2" ); SelectValuesHandler step2 = null; Object[] inputRow2 = null; RowMeta inputRowMeta = null; SelectValuesMeta stepMeta = null; SelectValuesData stepData = null; ValueMetaInterface vmi = null; step2 = new SelectValuesHandler( helper.stepMeta, helper.stepDataInterface, 1, helper.transMeta, helper.trans ); step2 = spy( step2 ); inputRow2 = new Object[] { new BigDecimal( "589" ) }; doReturn( inputRow2 ).when( step2 ).getRow(); doNothing().when( step2 ) .putError( any( RowMetaInterface.class ), any( Object[].class ), anyLong(), anyString(), anyString(), anyString() ); inputRowMeta = new RowMeta(); inputRowMeta.addValueMeta( new ValueMetaBigNumber( SELECTED_FIELD ) ); step2.setInputRowMeta( inputRowMeta ); stepMeta = new SelectValuesMeta(); stepMeta.allocate( 1, 0, 1 ); stepMeta.getSelectFields()[0] = new SelectField(); stepMeta.getSelectFields()[0].setName( SELECTED_FIELD ); stepMeta.getMeta()[ 0 ] = new SelectMetadataChange( stepMeta, SELECTED_FIELD, null, ValueMetaInterface.TYPE_INTEGER, -2, -2, ValueMetaInterface.STORAGE_TYPE_NORMAL, null, false, null, null, false, null, null, null ); stepData = new SelectValuesData(); stepData.select = true; stepData.metadata = true; stepData.firstselect = true; stepData.firstmetadata = true; step2.processRow( stepMeta, stepData ); vmi = step2.rowMeta.getValueMeta( 0 ); assertEquals( ValueMetaBase.DEFAULT_BIG_NUMBER_FORMAT_MASK, vmi.getConversionMask() ); step2 = new SelectValuesHandler( helper.stepMeta, helper.stepDataInterface, 1, helper.transMeta, helper.trans ); step2 = spy( step2 ); doReturn( inputRow2 ).when( step2 ).getRow(); doNothing().when( step2 ) .putError( any( RowMetaInterface.class ), any( Object[].class ), anyLong(), anyString(), anyString(), anyString() ); inputRowMeta = new RowMeta(); inputRowMeta.addValueMeta( new ValueMetaBigNumber( SELECTED_FIELD ) ); step2.setInputRowMeta( inputRowMeta ); stepMeta = new SelectValuesMeta(); stepMeta.allocate( 1, 0, 1 ); stepMeta.getSelectFields()[0] = new SelectField(); stepMeta.getSelectFields()[0].setName( SELECTED_FIELD ); stepMeta.getMeta()[ 0 ] = new SelectMetadataChange( stepMeta, SELECTED_FIELD, null, ValueMetaInterface.TYPE_NUMBER, -2, -2, ValueMetaInterface.STORAGE_TYPE_NORMAL, null, false, null, null, false, null, null, null ); stepData = new SelectValuesData(); stepData.select = true; stepData.metadata = true; stepData.firstselect = true; stepData.firstmetadata = true; step2.processRow( stepMeta, stepData ); vmi = step2.rowMeta.getValueMeta( 0 ); assertEquals( ValueMetaBase.DEFAULT_BIG_NUMBER_FORMAT_MASK, vmi.getConversionMask() ); step2 = new SelectValuesHandler( helper.stepMeta, helper.stepDataInterface, 1, helper.transMeta, helper.trans ); step2 = spy( step2 ); inputRow2 = new Object[] { new Long( "589" ) }; doReturn( inputRow2 ).when( step2 ).getRow(); doNothing().when( step2 ) .putError( any( RowMetaInterface.class ), any( Object[].class ), anyLong(), anyString(), anyString(), anyString() ); inputRowMeta = new RowMeta(); inputRowMeta.addValueMeta( new ValueMetaInteger( SELECTED_FIELD ) ); step2.setInputRowMeta( inputRowMeta ); stepMeta = new SelectValuesMeta(); stepMeta.allocate( 1, 0, 1 ); stepMeta.getSelectFields()[0] = new SelectField(); stepMeta.getSelectFields()[0].setName( SELECTED_FIELD ); stepMeta.getMeta()[ 0 ] = new SelectMetadataChange( stepMeta, SELECTED_FIELD, null, ValueMetaInterface.TYPE_BIGNUMBER, -2, -2, ValueMetaInterface.STORAGE_TYPE_NORMAL, null, false, null, null, false, null, null, null ); stepData = new SelectValuesData(); stepData.select = true; stepData.metadata = true; stepData.firstselect = true; stepData.firstmetadata = true; step2.processRow( stepMeta, stepData ); vmi = step2.rowMeta.getValueMeta( 0 ); assertEquals( ValueMetaBase.DEFAULT_INTEGER_FORMAT_MASK, vmi.getConversionMask() ); step2 = new SelectValuesHandler( helper.stepMeta, helper.stepDataInterface, 1, helper.transMeta, helper.trans ); step2.setVariable( Const.KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS, "Y" ); step2 = spy( step2 ); inputRow2 = new Object[] { new BigDecimal( "589" ) }; doReturn( inputRow2 ).when( step2 ).getRow(); doNothing().when( step2 ) .putError( any( RowMetaInterface.class ), any( Object[].class ), anyLong(), anyString(), anyString(), anyString() ); inputRowMeta = new RowMeta(); inputRowMeta.addValueMeta( new ValueMetaBigNumber( SELECTED_FIELD ) ); step2.setInputRowMeta( inputRowMeta ); stepMeta = new SelectValuesMeta(); stepMeta.allocate( 1, 0, 1 ); stepMeta.getSelectFields()[0] = new SelectField(); stepMeta.getSelectFields()[0].setName( SELECTED_FIELD ); stepMeta.getMeta()[ 0 ] = new SelectMetadataChange( stepMeta, SELECTED_FIELD, null, ValueMetaInterface.TYPE_INTEGER, -2, -2, ValueMetaInterface.STORAGE_TYPE_NORMAL, null, false, null, null, false, null, null, null ); stepData = new SelectValuesData(); stepData.select = true; stepData.metadata = true; stepData.firstselect = true; stepData.firstmetadata = true; step2.processRow( stepMeta, stepData ); vmi = step2.rowMeta.getValueMeta( 0 ); assertEquals( ValueMetaBase.DEFAULT_INTEGER_FORMAT_MASK, vmi.getConversionMask() ); step2 = new SelectValuesHandler( helper.stepMeta, helper.stepDataInterface, 1, helper.transMeta, helper.trans ); step2.setVariable( Const.KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS, "Y" ); step2 = spy( step2 ); doReturn( inputRow2 ).when( step2 ).getRow(); doNothing().when( step2 ) .putError( any( RowMetaInterface.class ), any( Object[].class ), anyLong(), anyString(), anyString(), anyString() ); inputRowMeta = new RowMeta(); inputRowMeta.addValueMeta( new ValueMetaBigNumber( SELECTED_FIELD ) ); step2.setInputRowMeta( inputRowMeta ); stepMeta = new SelectValuesMeta(); stepMeta.allocate( 1, 0, 1 ); stepMeta.getSelectFields()[0] = new SelectField(); stepMeta.getSelectFields()[0].setName( SELECTED_FIELD ); stepMeta.getMeta()[ 0 ] = new SelectMetadataChange( stepMeta, SELECTED_FIELD, null, ValueMetaInterface.TYPE_NUMBER, -2, -2, ValueMetaInterface.STORAGE_TYPE_NORMAL, null, false, null, null, false, null, null, null ); stepData = new SelectValuesData(); stepData.select = true; stepData.metadata = true; stepData.firstselect = true; stepData.firstmetadata = true; step2.processRow( stepMeta, stepData ); vmi = step2.rowMeta.getValueMeta( 0 ); assertEquals( ValueMetaBase.DEFAULT_NUMBER_FORMAT_MASK, vmi.getConversionMask() ); step2 = new SelectValuesHandler( helper.stepMeta, helper.stepDataInterface, 1, helper.transMeta, helper.trans ); step2.setVariable( Const.KETTLE_COMPATIBILITY_SELECT_VALUES_TYPE_CHANGE_USES_TYPE_DEFAULTS, "Y" ); step2 = spy( step2 ); inputRow2 = new Object[] { new Long( "589" ) }; doReturn( inputRow2 ).when( step2 ).getRow(); doNothing().when( step2 ) .putError( any( RowMetaInterface.class ), any( Object[].class ), anyLong(), anyString(), anyString(), anyString() ); inputRowMeta = new RowMeta(); inputRowMeta.addValueMeta( new ValueMetaInteger( SELECTED_FIELD ) ); step2.setInputRowMeta( inputRowMeta ); stepMeta = new SelectValuesMeta(); stepMeta.allocate( 1, 0, 1 ); stepMeta.getSelectFields()[0] = new SelectField(); stepMeta.getSelectFields()[0].setName( SELECTED_FIELD ); stepMeta.getMeta()[ 0 ] = new SelectMetadataChange( stepMeta, SELECTED_FIELD, null, ValueMetaInterface.TYPE_BIGNUMBER, -2, -2, ValueMetaInterface.STORAGE_TYPE_NORMAL, null, false, null, null, false, null, null, null ); stepData = new SelectValuesData(); stepData.select = true; stepData.metadata = true; stepData.firstselect = true; stepData.firstmetadata = true; step2.processRow( stepMeta, stepData ); vmi = step2.rowMeta.getValueMeta( 0 ); assertEquals( ValueMetaBase.DEFAULT_BIG_NUMBER_FORMAT_MASK, vmi.getConversionMask() ); }
public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SelectValuesMeta) smi; data = (SelectValuesData) sdi; Object[] rowData = getRow(); if ( rowData == null ) { setOutputDone(); return false; } Object[] rowCopy = null; if ( getStepMeta().isDoingErrorHandling() ) { rowCopy = getInputRowMeta().cloneRow( rowData ); } if ( log.isRowLevel() ) { logRowlevel( BaseMessages.getString( PKG, "SelectValues.Log.GotRowFromPreviousStep" ) + getInputRowMeta().getString( rowData ) ); } if ( first ) { first = false; data.selectRowMeta = getInputRowMeta().clone(); meta.getSelectFields( data.selectRowMeta, getStepname() ); data.deselectRowMeta = data.selectRowMeta.clone(); meta.getDeleteFields( data.deselectRowMeta ); data.metadataRowMeta = data.deselectRowMeta.clone(); meta.getMetadataFields( data.metadataRowMeta, getStepname(), this ); } try { Object[] outputData = rowData; if ( data.select ) { outputData = selectValues( getInputRowMeta(), outputData ); } if ( data.deselect ) { outputData = removeValues( data.selectRowMeta, outputData ); } if ( data.metadata ) { outputData = metadataValues( data.deselectRowMeta, outputData ); } if ( outputData == null ) { setOutputDone(); return false; } putRow( data.metadataRowMeta, outputData ); if ( log.isRowLevel() ) { logRowlevel( BaseMessages.getString( PKG, "SelectValues.Log.WroteRowToNextStep" ) + data.metadataRowMeta.getString( outputData ) ); } } catch ( KettleException e ) { if ( getStepMeta().isDoingErrorHandling() ) { String field; if ( e instanceof KettleConversionException ) { List<ValueMetaInterface> fields = ( (KettleConversionException) e ).getFields(); field = fields.isEmpty() ? null : fields.get( 0 ).getName(); } else { field = null; } putError( getInputRowMeta(), rowCopy, 1, e.getMessage(), field, "SELECT001" ); } else { throw e; } } if ( checkFeedback( getLinesRead() ) ) { logBasic( BaseMessages.getString( PKG, "SelectValues.Log.LineNumber" ) + getLinesRead() ); } return true; }
SelectValues extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SelectValuesMeta) smi; data = (SelectValuesData) sdi; Object[] rowData = getRow(); if ( rowData == null ) { setOutputDone(); return false; } Object[] rowCopy = null; if ( getStepMeta().isDoingErrorHandling() ) { rowCopy = getInputRowMeta().cloneRow( rowData ); } if ( log.isRowLevel() ) { logRowlevel( BaseMessages.getString( PKG, "SelectValues.Log.GotRowFromPreviousStep" ) + getInputRowMeta().getString( rowData ) ); } if ( first ) { first = false; data.selectRowMeta = getInputRowMeta().clone(); meta.getSelectFields( data.selectRowMeta, getStepname() ); data.deselectRowMeta = data.selectRowMeta.clone(); meta.getDeleteFields( data.deselectRowMeta ); data.metadataRowMeta = data.deselectRowMeta.clone(); meta.getMetadataFields( data.metadataRowMeta, getStepname(), this ); } try { Object[] outputData = rowData; if ( data.select ) { outputData = selectValues( getInputRowMeta(), outputData ); } if ( data.deselect ) { outputData = removeValues( data.selectRowMeta, outputData ); } if ( data.metadata ) { outputData = metadataValues( data.deselectRowMeta, outputData ); } if ( outputData == null ) { setOutputDone(); return false; } putRow( data.metadataRowMeta, outputData ); if ( log.isRowLevel() ) { logRowlevel( BaseMessages.getString( PKG, "SelectValues.Log.WroteRowToNextStep" ) + data.metadataRowMeta.getString( outputData ) ); } } catch ( KettleException e ) { if ( getStepMeta().isDoingErrorHandling() ) { String field; if ( e instanceof KettleConversionException ) { List<ValueMetaInterface> fields = ( (KettleConversionException) e ).getFields(); field = fields.isEmpty() ? null : fields.get( 0 ).getName(); } else { field = null; } putError( getInputRowMeta(), rowCopy, 1, e.getMessage(), field, "SELECT001" ); } else { throw e; } } if ( checkFeedback( getLinesRead() ) ) { logBasic( BaseMessages.getString( PKG, "SelectValues.Log.LineNumber" ) + getLinesRead() ); } return true; } }
SelectValues extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SelectValuesMeta) smi; data = (SelectValuesData) sdi; Object[] rowData = getRow(); if ( rowData == null ) { setOutputDone(); return false; } Object[] rowCopy = null; if ( getStepMeta().isDoingErrorHandling() ) { rowCopy = getInputRowMeta().cloneRow( rowData ); } if ( log.isRowLevel() ) { logRowlevel( BaseMessages.getString( PKG, "SelectValues.Log.GotRowFromPreviousStep" ) + getInputRowMeta().getString( rowData ) ); } if ( first ) { first = false; data.selectRowMeta = getInputRowMeta().clone(); meta.getSelectFields( data.selectRowMeta, getStepname() ); data.deselectRowMeta = data.selectRowMeta.clone(); meta.getDeleteFields( data.deselectRowMeta ); data.metadataRowMeta = data.deselectRowMeta.clone(); meta.getMetadataFields( data.metadataRowMeta, getStepname(), this ); } try { Object[] outputData = rowData; if ( data.select ) { outputData = selectValues( getInputRowMeta(), outputData ); } if ( data.deselect ) { outputData = removeValues( data.selectRowMeta, outputData ); } if ( data.metadata ) { outputData = metadataValues( data.deselectRowMeta, outputData ); } if ( outputData == null ) { setOutputDone(); return false; } putRow( data.metadataRowMeta, outputData ); if ( log.isRowLevel() ) { logRowlevel( BaseMessages.getString( PKG, "SelectValues.Log.WroteRowToNextStep" ) + data.metadataRowMeta.getString( outputData ) ); } } catch ( KettleException e ) { if ( getStepMeta().isDoingErrorHandling() ) { String field; if ( e instanceof KettleConversionException ) { List<ValueMetaInterface> fields = ( (KettleConversionException) e ).getFields(); field = fields.isEmpty() ? null : fields.get( 0 ).getName(); } else { field = null; } putError( getInputRowMeta(), rowCopy, 1, e.getMessage(), field, "SELECT001" ); } else { throw e; } } if ( checkFeedback( getLinesRead() ) ) { logBasic( BaseMessages.getString( PKG, "SelectValues.Log.LineNumber" ) + getLinesRead() ); } return true; } SelectValues( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
SelectValues extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SelectValuesMeta) smi; data = (SelectValuesData) sdi; Object[] rowData = getRow(); if ( rowData == null ) { setOutputDone(); return false; } Object[] rowCopy = null; if ( getStepMeta().isDoingErrorHandling() ) { rowCopy = getInputRowMeta().cloneRow( rowData ); } if ( log.isRowLevel() ) { logRowlevel( BaseMessages.getString( PKG, "SelectValues.Log.GotRowFromPreviousStep" ) + getInputRowMeta().getString( rowData ) ); } if ( first ) { first = false; data.selectRowMeta = getInputRowMeta().clone(); meta.getSelectFields( data.selectRowMeta, getStepname() ); data.deselectRowMeta = data.selectRowMeta.clone(); meta.getDeleteFields( data.deselectRowMeta ); data.metadataRowMeta = data.deselectRowMeta.clone(); meta.getMetadataFields( data.metadataRowMeta, getStepname(), this ); } try { Object[] outputData = rowData; if ( data.select ) { outputData = selectValues( getInputRowMeta(), outputData ); } if ( data.deselect ) { outputData = removeValues( data.selectRowMeta, outputData ); } if ( data.metadata ) { outputData = metadataValues( data.deselectRowMeta, outputData ); } if ( outputData == null ) { setOutputDone(); return false; } putRow( data.metadataRowMeta, outputData ); if ( log.isRowLevel() ) { logRowlevel( BaseMessages.getString( PKG, "SelectValues.Log.WroteRowToNextStep" ) + data.metadataRowMeta.getString( outputData ) ); } } catch ( KettleException e ) { if ( getStepMeta().isDoingErrorHandling() ) { String field; if ( e instanceof KettleConversionException ) { List<ValueMetaInterface> fields = ( (KettleConversionException) e ).getFields(); field = fields.isEmpty() ? null : fields.get( 0 ).getName(); } else { field = null; } putError( getInputRowMeta(), rowCopy, 1, e.getMessage(), field, "SELECT001" ); } else { throw e; } } if ( checkFeedback( getLinesRead() ) ) { logBasic( BaseMessages.getString( PKG, "SelectValues.Log.LineNumber" ) + getLinesRead() ); } return true; } SelectValues( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); }
SelectValues extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SelectValuesMeta) smi; data = (SelectValuesData) sdi; Object[] rowData = getRow(); if ( rowData == null ) { setOutputDone(); return false; } Object[] rowCopy = null; if ( getStepMeta().isDoingErrorHandling() ) { rowCopy = getInputRowMeta().cloneRow( rowData ); } if ( log.isRowLevel() ) { logRowlevel( BaseMessages.getString( PKG, "SelectValues.Log.GotRowFromPreviousStep" ) + getInputRowMeta().getString( rowData ) ); } if ( first ) { first = false; data.selectRowMeta = getInputRowMeta().clone(); meta.getSelectFields( data.selectRowMeta, getStepname() ); data.deselectRowMeta = data.selectRowMeta.clone(); meta.getDeleteFields( data.deselectRowMeta ); data.metadataRowMeta = data.deselectRowMeta.clone(); meta.getMetadataFields( data.metadataRowMeta, getStepname(), this ); } try { Object[] outputData = rowData; if ( data.select ) { outputData = selectValues( getInputRowMeta(), outputData ); } if ( data.deselect ) { outputData = removeValues( data.selectRowMeta, outputData ); } if ( data.metadata ) { outputData = metadataValues( data.deselectRowMeta, outputData ); } if ( outputData == null ) { setOutputDone(); return false; } putRow( data.metadataRowMeta, outputData ); if ( log.isRowLevel() ) { logRowlevel( BaseMessages.getString( PKG, "SelectValues.Log.WroteRowToNextStep" ) + data.metadataRowMeta.getString( outputData ) ); } } catch ( KettleException e ) { if ( getStepMeta().isDoingErrorHandling() ) { String field; if ( e instanceof KettleConversionException ) { List<ValueMetaInterface> fields = ( (KettleConversionException) e ).getFields(); field = fields.isEmpty() ? null : fields.get( 0 ).getName(); } else { field = null; } putError( getInputRowMeta(), rowCopy, 1, e.getMessage(), field, "SELECT001" ); } else { throw e; } } if ( checkFeedback( getLinesRead() ) ) { logBasic( BaseMessages.getString( PKG, "SelectValues.Log.LineNumber" ) + getLinesRead() ); } return true; } SelectValues( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void bigNumberAreNotTrimmedToInt() throws Exception { ScriptValuesMod step = StepMockUtil.getStep( ScriptValuesMod.class, ScriptValuesMetaMod.class, "test" ); RowMeta input = new RowMeta(); input.addValueMeta( new ValueMetaBigNumber( "value_int" ) ); input.addValueMeta( new ValueMetaBigNumber( "value_double" ) ); step.setInputRowMeta( input ); step = spy( step ); doReturn( new Object[] { BigDecimal.ONE, BigDecimal.ONE } ).when( step ).getRow(); ScriptValuesMetaMod meta = new ScriptValuesMetaMod(); meta.setCompatible( false ); meta.allocate( 2 ); meta.setFieldname( new String[] { "value_int", "value_double" } ); meta.setType( new int[] { ValueMetaInterface.TYPE_BIGNUMBER, ValueMetaInterface.TYPE_BIGNUMBER } ); meta.setReplace( new boolean[] { true, true } ); meta.setJSScripts( new ScriptValuesScript[] { new ScriptValuesScript( ScriptValuesScript.TRANSFORM_SCRIPT, "script", "value_int = 10.00;\nvalue_double = 10.50" ) } ); ScriptValuesModData data = new ScriptValuesModData(); step.init( meta, data ); Object[] expectedRow = { BigDecimal.TEN, new BigDecimal( "10.5" ) }; Object[] row = TransTestingUtil.execute( step, meta, data, 1, false ).get( 0 ); TransTestingUtil.assertResult( expectedRow, row ); }
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ScriptValuesMetaMod) smi; data = (ScriptValuesModData) sdi; if ( super.init( smi, sdi ) ) { jsScripts = meta.getJSScripts(); for ( int j = 0; j < jsScripts.length; j++ ) { switch ( jsScripts[ j ].getScriptType() ) { case ScriptValuesScript.TRANSFORM_SCRIPT: strTransformScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.START_SCRIPT: strStartScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.END_SCRIPT: strEndScript = jsScripts[ j ].getScript(); break; default: break; } } return true; } return false; }
ScriptValuesMod extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ScriptValuesMetaMod) smi; data = (ScriptValuesModData) sdi; if ( super.init( smi, sdi ) ) { jsScripts = meta.getJSScripts(); for ( int j = 0; j < jsScripts.length; j++ ) { switch ( jsScripts[ j ].getScriptType() ) { case ScriptValuesScript.TRANSFORM_SCRIPT: strTransformScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.START_SCRIPT: strStartScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.END_SCRIPT: strEndScript = jsScripts[ j ].getScript(); break; default: break; } } return true; } return false; } }
ScriptValuesMod extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ScriptValuesMetaMod) smi; data = (ScriptValuesModData) sdi; if ( super.init( smi, sdi ) ) { jsScripts = meta.getJSScripts(); for ( int j = 0; j < jsScripts.length; j++ ) { switch ( jsScripts[ j ].getScriptType() ) { case ScriptValuesScript.TRANSFORM_SCRIPT: strTransformScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.START_SCRIPT: strStartScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.END_SCRIPT: strEndScript = jsScripts[ j ].getScript(); break; default: break; } } return true; } return false; } ScriptValuesMod( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
ScriptValuesMod extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ScriptValuesMetaMod) smi; data = (ScriptValuesModData) sdi; if ( super.init( smi, sdi ) ) { jsScripts = meta.getJSScripts(); for ( int j = 0; j < jsScripts.length; j++ ) { switch ( jsScripts[ j ].getScriptType() ) { case ScriptValuesScript.TRANSFORM_SCRIPT: strTransformScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.START_SCRIPT: strStartScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.END_SCRIPT: strEndScript = jsScripts[ j ].getScript(); break; default: break; } } return true; } return false; } ScriptValuesMod( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); Object getValueFromJScript( Object result, int i ); RowMetaInterface getOutputRowMeta(); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
ScriptValuesMod extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ScriptValuesMetaMod) smi; data = (ScriptValuesModData) sdi; if ( super.init( smi, sdi ) ) { jsScripts = meta.getJSScripts(); for ( int j = 0; j < jsScripts.length; j++ ) { switch ( jsScripts[ j ].getScriptType() ) { case ScriptValuesScript.TRANSFORM_SCRIPT: strTransformScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.START_SCRIPT: strStartScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.END_SCRIPT: strEndScript = jsScripts[ j ].getScript(); break; default: break; } } return true; } return false; } ScriptValuesMod( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); Object getValueFromJScript( Object result, int i ); RowMetaInterface getOutputRowMeta(); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); static final int SKIP_TRANSFORMATION; static final int ABORT_TRANSFORMATION; static final int ERROR_TRANSFORMATION; static final int CONTINUE_TRANSFORMATION; public Script script; }
@Test public void testOnCancel() throws Exception { }
public void onCancel() { close(); }
DataHandler extends AbstractXulEventHandler { public void onCancel() { close(); } }
DataHandler extends AbstractXulEventHandler { public void onCancel() { close(); } DataHandler(); }
DataHandler extends AbstractXulEventHandler { public void onCancel() { close(); } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); }
DataHandler extends AbstractXulEventHandler { public void onCancel() { close(); } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); static final SortedMap<String, DatabaseInterface> connectionMap; static final Map<String, String> connectionNametoID; }
@Test public void variableIsSetInScopeOfStep() throws Exception { ScriptValuesMod step = StepMockUtil.getStep( ScriptValuesMod.class, ScriptValuesMetaMod.class, "test" ); RowMeta input = new RowMeta(); input.addValueMeta( new ValueMetaString( "str" ) ); step.setInputRowMeta( input ); step = spy( step ); doReturn( new Object[] { "" } ).when( step ).getRow(); ScriptValuesMetaMod meta = new ScriptValuesMetaMod(); meta.setCompatible( false ); meta.allocate( 1 ); meta.setFieldname( new String[] { "str" } ); meta.setType( new int[] { ValueMetaInterface.TYPE_STRING } ); meta.setReplace( new boolean[] { true } ); meta.setJSScripts( new ScriptValuesScript[] { new ScriptValuesScript( ScriptValuesScript.TRANSFORM_SCRIPT, "script", "setVariable('temp', 'pass', 'r');\nstr = getVariable('temp', 'fail');" ) } ); ScriptValuesModData data = new ScriptValuesModData(); step.init( meta, data ); Object[] expectedRow = { "pass" }; Object[] row = TransTestingUtil.execute( step, meta, data, 1, false ).get( 0 ); TransTestingUtil.assertResult( expectedRow, row ); }
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ScriptValuesMetaMod) smi; data = (ScriptValuesModData) sdi; if ( super.init( smi, sdi ) ) { jsScripts = meta.getJSScripts(); for ( int j = 0; j < jsScripts.length; j++ ) { switch ( jsScripts[ j ].getScriptType() ) { case ScriptValuesScript.TRANSFORM_SCRIPT: strTransformScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.START_SCRIPT: strStartScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.END_SCRIPT: strEndScript = jsScripts[ j ].getScript(); break; default: break; } } return true; } return false; }
ScriptValuesMod extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ScriptValuesMetaMod) smi; data = (ScriptValuesModData) sdi; if ( super.init( smi, sdi ) ) { jsScripts = meta.getJSScripts(); for ( int j = 0; j < jsScripts.length; j++ ) { switch ( jsScripts[ j ].getScriptType() ) { case ScriptValuesScript.TRANSFORM_SCRIPT: strTransformScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.START_SCRIPT: strStartScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.END_SCRIPT: strEndScript = jsScripts[ j ].getScript(); break; default: break; } } return true; } return false; } }
ScriptValuesMod extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ScriptValuesMetaMod) smi; data = (ScriptValuesModData) sdi; if ( super.init( smi, sdi ) ) { jsScripts = meta.getJSScripts(); for ( int j = 0; j < jsScripts.length; j++ ) { switch ( jsScripts[ j ].getScriptType() ) { case ScriptValuesScript.TRANSFORM_SCRIPT: strTransformScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.START_SCRIPT: strStartScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.END_SCRIPT: strEndScript = jsScripts[ j ].getScript(); break; default: break; } } return true; } return false; } ScriptValuesMod( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
ScriptValuesMod extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ScriptValuesMetaMod) smi; data = (ScriptValuesModData) sdi; if ( super.init( smi, sdi ) ) { jsScripts = meta.getJSScripts(); for ( int j = 0; j < jsScripts.length; j++ ) { switch ( jsScripts[ j ].getScriptType() ) { case ScriptValuesScript.TRANSFORM_SCRIPT: strTransformScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.START_SCRIPT: strStartScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.END_SCRIPT: strEndScript = jsScripts[ j ].getScript(); break; default: break; } } return true; } return false; } ScriptValuesMod( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); Object getValueFromJScript( Object result, int i ); RowMetaInterface getOutputRowMeta(); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
ScriptValuesMod extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ScriptValuesMetaMod) smi; data = (ScriptValuesModData) sdi; if ( super.init( smi, sdi ) ) { jsScripts = meta.getJSScripts(); for ( int j = 0; j < jsScripts.length; j++ ) { switch ( jsScripts[ j ].getScriptType() ) { case ScriptValuesScript.TRANSFORM_SCRIPT: strTransformScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.START_SCRIPT: strStartScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.END_SCRIPT: strEndScript = jsScripts[ j ].getScript(); break; default: break; } } return true; } return false; } ScriptValuesMod( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); Object getValueFromJScript( Object result, int i ); RowMetaInterface getOutputRowMeta(); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); static final int SKIP_TRANSFORMATION; static final int ABORT_TRANSFORMATION; static final int ERROR_TRANSFORMATION; static final int CONTINUE_TRANSFORMATION; public Script script; }
@Test public void checkRemoteFilenameField_FieldNameIsBlank() throws Exception { SFTPPutData data = new SFTPPutData(); step.checkRemoteFilenameField( "", data ); assertEquals( -1, data.indexOfSourceFileFieldName ); }
@VisibleForTesting void checkRemoteFilenameField( String remoteFilenameFieldName, SFTPPutData data ) throws KettleStepException { remoteFilenameFieldName = environmentSubstitute( remoteFilenameFieldName ); if ( !Utils.isEmpty( remoteFilenameFieldName ) ) { data.indexOfRemoteFilename = getInputRowMeta().indexOfValue( remoteFilenameFieldName ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFilenameFieldName ) ); } } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFilenameField( String remoteFilenameFieldName, SFTPPutData data ) throws KettleStepException { remoteFilenameFieldName = environmentSubstitute( remoteFilenameFieldName ); if ( !Utils.isEmpty( remoteFilenameFieldName ) ) { data.indexOfRemoteFilename = getInputRowMeta().indexOfValue( remoteFilenameFieldName ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFilenameFieldName ) ); } } } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFilenameField( String remoteFilenameFieldName, SFTPPutData data ) throws KettleStepException { remoteFilenameFieldName = environmentSubstitute( remoteFilenameFieldName ); if ( !Utils.isEmpty( remoteFilenameFieldName ) ) { data.indexOfRemoteFilename = getInputRowMeta().indexOfValue( remoteFilenameFieldName ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFilenameFieldName ) ); } } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFilenameField( String remoteFilenameFieldName, SFTPPutData data ) throws KettleStepException { remoteFilenameFieldName = environmentSubstitute( remoteFilenameFieldName ); if ( !Utils.isEmpty( remoteFilenameFieldName ) ) { data.indexOfRemoteFilename = getInputRowMeta().indexOfValue( remoteFilenameFieldName ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFilenameFieldName ) ); } } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFilenameField( String remoteFilenameFieldName, SFTPPutData data ) throws KettleStepException { remoteFilenameFieldName = environmentSubstitute( remoteFilenameFieldName ); if ( !Utils.isEmpty( remoteFilenameFieldName ) ) { data.indexOfRemoteFilename = getInputRowMeta().indexOfValue( remoteFilenameFieldName ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFilenameFieldName ) ); } } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test( expected = KettleStepException.class ) public void checkRemoteFilenameField_FieldNameIsSet_NotFound() throws Exception { step.setInputRowMeta( new RowMeta() ); step.checkRemoteFilenameField( "remoteFileName", new SFTPPutData() ); }
@VisibleForTesting void checkRemoteFilenameField( String remoteFilenameFieldName, SFTPPutData data ) throws KettleStepException { remoteFilenameFieldName = environmentSubstitute( remoteFilenameFieldName ); if ( !Utils.isEmpty( remoteFilenameFieldName ) ) { data.indexOfRemoteFilename = getInputRowMeta().indexOfValue( remoteFilenameFieldName ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFilenameFieldName ) ); } } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFilenameField( String remoteFilenameFieldName, SFTPPutData data ) throws KettleStepException { remoteFilenameFieldName = environmentSubstitute( remoteFilenameFieldName ); if ( !Utils.isEmpty( remoteFilenameFieldName ) ) { data.indexOfRemoteFilename = getInputRowMeta().indexOfValue( remoteFilenameFieldName ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFilenameFieldName ) ); } } } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFilenameField( String remoteFilenameFieldName, SFTPPutData data ) throws KettleStepException { remoteFilenameFieldName = environmentSubstitute( remoteFilenameFieldName ); if ( !Utils.isEmpty( remoteFilenameFieldName ) ) { data.indexOfRemoteFilename = getInputRowMeta().indexOfValue( remoteFilenameFieldName ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFilenameFieldName ) ); } } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFilenameField( String remoteFilenameFieldName, SFTPPutData data ) throws KettleStepException { remoteFilenameFieldName = environmentSubstitute( remoteFilenameFieldName ); if ( !Utils.isEmpty( remoteFilenameFieldName ) ) { data.indexOfRemoteFilename = getInputRowMeta().indexOfValue( remoteFilenameFieldName ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFilenameFieldName ) ); } } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFilenameField( String remoteFilenameFieldName, SFTPPutData data ) throws KettleStepException { remoteFilenameFieldName = environmentSubstitute( remoteFilenameFieldName ); if ( !Utils.isEmpty( remoteFilenameFieldName ) ) { data.indexOfRemoteFilename = getInputRowMeta().indexOfValue( remoteFilenameFieldName ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFilenameFieldName ) ); } } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void checkRemoteFilenameField_FieldNameIsSet_Found() throws Exception { RowMeta rowMeta = rowOfStringsMeta( "some field", "remoteFileName" ); step.setInputRowMeta( rowMeta ); SFTPPutData data = new SFTPPutData(); step.checkRemoteFilenameField( "remoteFileName", data ); assertEquals( 1, data.indexOfRemoteFilename ); }
@VisibleForTesting void checkRemoteFilenameField( String remoteFilenameFieldName, SFTPPutData data ) throws KettleStepException { remoteFilenameFieldName = environmentSubstitute( remoteFilenameFieldName ); if ( !Utils.isEmpty( remoteFilenameFieldName ) ) { data.indexOfRemoteFilename = getInputRowMeta().indexOfValue( remoteFilenameFieldName ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFilenameFieldName ) ); } } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFilenameField( String remoteFilenameFieldName, SFTPPutData data ) throws KettleStepException { remoteFilenameFieldName = environmentSubstitute( remoteFilenameFieldName ); if ( !Utils.isEmpty( remoteFilenameFieldName ) ) { data.indexOfRemoteFilename = getInputRowMeta().indexOfValue( remoteFilenameFieldName ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFilenameFieldName ) ); } } } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFilenameField( String remoteFilenameFieldName, SFTPPutData data ) throws KettleStepException { remoteFilenameFieldName = environmentSubstitute( remoteFilenameFieldName ); if ( !Utils.isEmpty( remoteFilenameFieldName ) ) { data.indexOfRemoteFilename = getInputRowMeta().indexOfValue( remoteFilenameFieldName ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFilenameFieldName ) ); } } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFilenameField( String remoteFilenameFieldName, SFTPPutData data ) throws KettleStepException { remoteFilenameFieldName = environmentSubstitute( remoteFilenameFieldName ); if ( !Utils.isEmpty( remoteFilenameFieldName ) ) { data.indexOfRemoteFilename = getInputRowMeta().indexOfValue( remoteFilenameFieldName ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFilenameFieldName ) ); } } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFilenameField( String remoteFilenameFieldName, SFTPPutData data ) throws KettleStepException { remoteFilenameFieldName = environmentSubstitute( remoteFilenameFieldName ); if ( !Utils.isEmpty( remoteFilenameFieldName ) ) { data.indexOfRemoteFilename = getInputRowMeta().indexOfValue( remoteFilenameFieldName ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFilenameFieldName ) ); } } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test( expected = KettleStepException.class ) public void checkSourceFileField_NameIsBlank() throws Exception { SFTPPutData data = new SFTPPutData(); step.checkSourceFileField( "", data ); }
@VisibleForTesting void checkSourceFileField( String sourceFilenameFieldName, SFTPPutData data ) throws KettleStepException { sourceFilenameFieldName = environmentSubstitute( sourceFilenameFieldName ); if ( Utils.isEmpty( sourceFilenameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceFileNameFieldMissing" ) ); } data.indexOfSourceFileFieldName = getInputRowMeta().indexOfValue( sourceFilenameFieldName ); if ( data.indexOfSourceFileFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceFilenameFieldName ) ); } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkSourceFileField( String sourceFilenameFieldName, SFTPPutData data ) throws KettleStepException { sourceFilenameFieldName = environmentSubstitute( sourceFilenameFieldName ); if ( Utils.isEmpty( sourceFilenameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceFileNameFieldMissing" ) ); } data.indexOfSourceFileFieldName = getInputRowMeta().indexOfValue( sourceFilenameFieldName ); if ( data.indexOfSourceFileFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceFilenameFieldName ) ); } } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkSourceFileField( String sourceFilenameFieldName, SFTPPutData data ) throws KettleStepException { sourceFilenameFieldName = environmentSubstitute( sourceFilenameFieldName ); if ( Utils.isEmpty( sourceFilenameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceFileNameFieldMissing" ) ); } data.indexOfSourceFileFieldName = getInputRowMeta().indexOfValue( sourceFilenameFieldName ); if ( data.indexOfSourceFileFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceFilenameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkSourceFileField( String sourceFilenameFieldName, SFTPPutData data ) throws KettleStepException { sourceFilenameFieldName = environmentSubstitute( sourceFilenameFieldName ); if ( Utils.isEmpty( sourceFilenameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceFileNameFieldMissing" ) ); } data.indexOfSourceFileFieldName = getInputRowMeta().indexOfValue( sourceFilenameFieldName ); if ( data.indexOfSourceFileFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceFilenameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkSourceFileField( String sourceFilenameFieldName, SFTPPutData data ) throws KettleStepException { sourceFilenameFieldName = environmentSubstitute( sourceFilenameFieldName ); if ( Utils.isEmpty( sourceFilenameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceFileNameFieldMissing" ) ); } data.indexOfSourceFileFieldName = getInputRowMeta().indexOfValue( sourceFilenameFieldName ); if ( data.indexOfSourceFileFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceFilenameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test( expected = KettleStepException.class ) public void checkSourceFileField_NameIsSet_NotFound() throws Exception { step.setInputRowMeta( new RowMeta() ); step.checkSourceFileField( "sourceFile", new SFTPPutData() ); }
@VisibleForTesting void checkSourceFileField( String sourceFilenameFieldName, SFTPPutData data ) throws KettleStepException { sourceFilenameFieldName = environmentSubstitute( sourceFilenameFieldName ); if ( Utils.isEmpty( sourceFilenameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceFileNameFieldMissing" ) ); } data.indexOfSourceFileFieldName = getInputRowMeta().indexOfValue( sourceFilenameFieldName ); if ( data.indexOfSourceFileFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceFilenameFieldName ) ); } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkSourceFileField( String sourceFilenameFieldName, SFTPPutData data ) throws KettleStepException { sourceFilenameFieldName = environmentSubstitute( sourceFilenameFieldName ); if ( Utils.isEmpty( sourceFilenameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceFileNameFieldMissing" ) ); } data.indexOfSourceFileFieldName = getInputRowMeta().indexOfValue( sourceFilenameFieldName ); if ( data.indexOfSourceFileFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceFilenameFieldName ) ); } } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkSourceFileField( String sourceFilenameFieldName, SFTPPutData data ) throws KettleStepException { sourceFilenameFieldName = environmentSubstitute( sourceFilenameFieldName ); if ( Utils.isEmpty( sourceFilenameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceFileNameFieldMissing" ) ); } data.indexOfSourceFileFieldName = getInputRowMeta().indexOfValue( sourceFilenameFieldName ); if ( data.indexOfSourceFileFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceFilenameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkSourceFileField( String sourceFilenameFieldName, SFTPPutData data ) throws KettleStepException { sourceFilenameFieldName = environmentSubstitute( sourceFilenameFieldName ); if ( Utils.isEmpty( sourceFilenameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceFileNameFieldMissing" ) ); } data.indexOfSourceFileFieldName = getInputRowMeta().indexOfValue( sourceFilenameFieldName ); if ( data.indexOfSourceFileFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceFilenameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkSourceFileField( String sourceFilenameFieldName, SFTPPutData data ) throws KettleStepException { sourceFilenameFieldName = environmentSubstitute( sourceFilenameFieldName ); if ( Utils.isEmpty( sourceFilenameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceFileNameFieldMissing" ) ); } data.indexOfSourceFileFieldName = getInputRowMeta().indexOfValue( sourceFilenameFieldName ); if ( data.indexOfSourceFileFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceFilenameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void checkSourceFileField_NameIsSet_Found() throws Exception { RowMeta rowMeta = rowOfStringsMeta( "some field", "sourceFileFieldName" ); step.setInputRowMeta( rowMeta ); SFTPPutData data = new SFTPPutData(); step.checkSourceFileField( "sourceFileFieldName", data ); assertEquals( 1, data.indexOfSourceFileFieldName ); }
@VisibleForTesting void checkSourceFileField( String sourceFilenameFieldName, SFTPPutData data ) throws KettleStepException { sourceFilenameFieldName = environmentSubstitute( sourceFilenameFieldName ); if ( Utils.isEmpty( sourceFilenameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceFileNameFieldMissing" ) ); } data.indexOfSourceFileFieldName = getInputRowMeta().indexOfValue( sourceFilenameFieldName ); if ( data.indexOfSourceFileFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceFilenameFieldName ) ); } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkSourceFileField( String sourceFilenameFieldName, SFTPPutData data ) throws KettleStepException { sourceFilenameFieldName = environmentSubstitute( sourceFilenameFieldName ); if ( Utils.isEmpty( sourceFilenameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceFileNameFieldMissing" ) ); } data.indexOfSourceFileFieldName = getInputRowMeta().indexOfValue( sourceFilenameFieldName ); if ( data.indexOfSourceFileFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceFilenameFieldName ) ); } } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkSourceFileField( String sourceFilenameFieldName, SFTPPutData data ) throws KettleStepException { sourceFilenameFieldName = environmentSubstitute( sourceFilenameFieldName ); if ( Utils.isEmpty( sourceFilenameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceFileNameFieldMissing" ) ); } data.indexOfSourceFileFieldName = getInputRowMeta().indexOfValue( sourceFilenameFieldName ); if ( data.indexOfSourceFileFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceFilenameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkSourceFileField( String sourceFilenameFieldName, SFTPPutData data ) throws KettleStepException { sourceFilenameFieldName = environmentSubstitute( sourceFilenameFieldName ); if ( Utils.isEmpty( sourceFilenameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceFileNameFieldMissing" ) ); } data.indexOfSourceFileFieldName = getInputRowMeta().indexOfValue( sourceFilenameFieldName ); if ( data.indexOfSourceFileFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceFilenameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkSourceFileField( String sourceFilenameFieldName, SFTPPutData data ) throws KettleStepException { sourceFilenameFieldName = environmentSubstitute( sourceFilenameFieldName ); if ( Utils.isEmpty( sourceFilenameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceFileNameFieldMissing" ) ); } data.indexOfSourceFileFieldName = getInputRowMeta().indexOfValue( sourceFilenameFieldName ); if ( data.indexOfSourceFileFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceFilenameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test( expected = KettleStepException.class ) public void checkRemoteFoldernameField_NameIsBlank() throws Exception { SFTPPutData data = new SFTPPutData(); step.checkRemoteFoldernameField( "", data ); }
@VisibleForTesting void checkRemoteFoldernameField( String remoteFoldernameFieldName, SFTPPutData data ) throws KettleStepException { remoteFoldernameFieldName = environmentSubstitute( remoteFoldernameFieldName ); if ( Utils.isEmpty( remoteFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFolderNameFieldMissing" ) ); } data.indexOfRemoteDirectory = getInputRowMeta().indexOfValue( remoteFoldernameFieldName ); if ( data.indexOfRemoteDirectory == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFoldernameFieldName ) ); } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFoldernameField( String remoteFoldernameFieldName, SFTPPutData data ) throws KettleStepException { remoteFoldernameFieldName = environmentSubstitute( remoteFoldernameFieldName ); if ( Utils.isEmpty( remoteFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFolderNameFieldMissing" ) ); } data.indexOfRemoteDirectory = getInputRowMeta().indexOfValue( remoteFoldernameFieldName ); if ( data.indexOfRemoteDirectory == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFoldernameFieldName ) ); } } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFoldernameField( String remoteFoldernameFieldName, SFTPPutData data ) throws KettleStepException { remoteFoldernameFieldName = environmentSubstitute( remoteFoldernameFieldName ); if ( Utils.isEmpty( remoteFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFolderNameFieldMissing" ) ); } data.indexOfRemoteDirectory = getInputRowMeta().indexOfValue( remoteFoldernameFieldName ); if ( data.indexOfRemoteDirectory == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFoldernameField( String remoteFoldernameFieldName, SFTPPutData data ) throws KettleStepException { remoteFoldernameFieldName = environmentSubstitute( remoteFoldernameFieldName ); if ( Utils.isEmpty( remoteFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFolderNameFieldMissing" ) ); } data.indexOfRemoteDirectory = getInputRowMeta().indexOfValue( remoteFoldernameFieldName ); if ( data.indexOfRemoteDirectory == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFoldernameField( String remoteFoldernameFieldName, SFTPPutData data ) throws KettleStepException { remoteFoldernameFieldName = environmentSubstitute( remoteFoldernameFieldName ); if ( Utils.isEmpty( remoteFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFolderNameFieldMissing" ) ); } data.indexOfRemoteDirectory = getInputRowMeta().indexOfValue( remoteFoldernameFieldName ); if ( data.indexOfRemoteDirectory == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test( expected = KettleStepException.class ) public void checkRemoteFoldernameField_NameIsSet_NotFound() throws Exception { step.setInputRowMeta( new RowMeta() ); step.checkRemoteFoldernameField( "remoteFolder", new SFTPPutData() ); }
@VisibleForTesting void checkRemoteFoldernameField( String remoteFoldernameFieldName, SFTPPutData data ) throws KettleStepException { remoteFoldernameFieldName = environmentSubstitute( remoteFoldernameFieldName ); if ( Utils.isEmpty( remoteFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFolderNameFieldMissing" ) ); } data.indexOfRemoteDirectory = getInputRowMeta().indexOfValue( remoteFoldernameFieldName ); if ( data.indexOfRemoteDirectory == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFoldernameFieldName ) ); } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFoldernameField( String remoteFoldernameFieldName, SFTPPutData data ) throws KettleStepException { remoteFoldernameFieldName = environmentSubstitute( remoteFoldernameFieldName ); if ( Utils.isEmpty( remoteFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFolderNameFieldMissing" ) ); } data.indexOfRemoteDirectory = getInputRowMeta().indexOfValue( remoteFoldernameFieldName ); if ( data.indexOfRemoteDirectory == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFoldernameFieldName ) ); } } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFoldernameField( String remoteFoldernameFieldName, SFTPPutData data ) throws KettleStepException { remoteFoldernameFieldName = environmentSubstitute( remoteFoldernameFieldName ); if ( Utils.isEmpty( remoteFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFolderNameFieldMissing" ) ); } data.indexOfRemoteDirectory = getInputRowMeta().indexOfValue( remoteFoldernameFieldName ); if ( data.indexOfRemoteDirectory == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFoldernameField( String remoteFoldernameFieldName, SFTPPutData data ) throws KettleStepException { remoteFoldernameFieldName = environmentSubstitute( remoteFoldernameFieldName ); if ( Utils.isEmpty( remoteFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFolderNameFieldMissing" ) ); } data.indexOfRemoteDirectory = getInputRowMeta().indexOfValue( remoteFoldernameFieldName ); if ( data.indexOfRemoteDirectory == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFoldernameField( String remoteFoldernameFieldName, SFTPPutData data ) throws KettleStepException { remoteFoldernameFieldName = environmentSubstitute( remoteFoldernameFieldName ); if ( Utils.isEmpty( remoteFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFolderNameFieldMissing" ) ); } data.indexOfRemoteDirectory = getInputRowMeta().indexOfValue( remoteFoldernameFieldName ); if ( data.indexOfRemoteDirectory == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void checkRemoteFoldernameField_NameIsSet_Found() throws Exception { RowMeta rowMeta = rowOfStringsMeta( "some field", "remoteFoldernameFieldName" ); step.setInputRowMeta( rowMeta ); SFTPPutData data = new SFTPPutData(); step.checkRemoteFoldernameField( "remoteFoldernameFieldName", data ); assertEquals( 1, data.indexOfRemoteDirectory ); }
@VisibleForTesting void checkRemoteFoldernameField( String remoteFoldernameFieldName, SFTPPutData data ) throws KettleStepException { remoteFoldernameFieldName = environmentSubstitute( remoteFoldernameFieldName ); if ( Utils.isEmpty( remoteFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFolderNameFieldMissing" ) ); } data.indexOfRemoteDirectory = getInputRowMeta().indexOfValue( remoteFoldernameFieldName ); if ( data.indexOfRemoteDirectory == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFoldernameFieldName ) ); } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFoldernameField( String remoteFoldernameFieldName, SFTPPutData data ) throws KettleStepException { remoteFoldernameFieldName = environmentSubstitute( remoteFoldernameFieldName ); if ( Utils.isEmpty( remoteFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFolderNameFieldMissing" ) ); } data.indexOfRemoteDirectory = getInputRowMeta().indexOfValue( remoteFoldernameFieldName ); if ( data.indexOfRemoteDirectory == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFoldernameFieldName ) ); } } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFoldernameField( String remoteFoldernameFieldName, SFTPPutData data ) throws KettleStepException { remoteFoldernameFieldName = environmentSubstitute( remoteFoldernameFieldName ); if ( Utils.isEmpty( remoteFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFolderNameFieldMissing" ) ); } data.indexOfRemoteDirectory = getInputRowMeta().indexOfValue( remoteFoldernameFieldName ); if ( data.indexOfRemoteDirectory == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFoldernameField( String remoteFoldernameFieldName, SFTPPutData data ) throws KettleStepException { remoteFoldernameFieldName = environmentSubstitute( remoteFoldernameFieldName ); if ( Utils.isEmpty( remoteFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFolderNameFieldMissing" ) ); } data.indexOfRemoteDirectory = getInputRowMeta().indexOfValue( remoteFoldernameFieldName ); if ( data.indexOfRemoteDirectory == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkRemoteFoldernameField( String remoteFoldernameFieldName, SFTPPutData data ) throws KettleStepException { remoteFoldernameFieldName = environmentSubstitute( remoteFoldernameFieldName ); if ( Utils.isEmpty( remoteFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFolderNameFieldMissing" ) ); } data.indexOfRemoteDirectory = getInputRowMeta().indexOfValue( remoteFoldernameFieldName ); if ( data.indexOfRemoteDirectory == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", remoteFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void testOnOK() throws Exception { }
public void onOK() { DatabaseMeta database = new DatabaseMeta(); this.getInfo( database ); boolean passed = checkPoolingParameters(); if ( !passed ) { return; } String[] remarks = database.checkParameters(); String message = ""; if ( remarks.length != 0 ) { for ( int i = 0; i < remarks.length; i++ ) { message = message.concat( "* " ).concat( remarks[i] ).concat( System.getProperty( "line.separator" ) ); } showMessage( message, false ); } else { if ( databaseMeta == null ) { databaseMeta = new DatabaseMeta(); } this.getInfo( databaseMeta ); databaseMeta.setChanged(); close(); } }
DataHandler extends AbstractXulEventHandler { public void onOK() { DatabaseMeta database = new DatabaseMeta(); this.getInfo( database ); boolean passed = checkPoolingParameters(); if ( !passed ) { return; } String[] remarks = database.checkParameters(); String message = ""; if ( remarks.length != 0 ) { for ( int i = 0; i < remarks.length; i++ ) { message = message.concat( "* " ).concat( remarks[i] ).concat( System.getProperty( "line.separator" ) ); } showMessage( message, false ); } else { if ( databaseMeta == null ) { databaseMeta = new DatabaseMeta(); } this.getInfo( databaseMeta ); databaseMeta.setChanged(); close(); } } }
DataHandler extends AbstractXulEventHandler { public void onOK() { DatabaseMeta database = new DatabaseMeta(); this.getInfo( database ); boolean passed = checkPoolingParameters(); if ( !passed ) { return; } String[] remarks = database.checkParameters(); String message = ""; if ( remarks.length != 0 ) { for ( int i = 0; i < remarks.length; i++ ) { message = message.concat( "* " ).concat( remarks[i] ).concat( System.getProperty( "line.separator" ) ); } showMessage( message, false ); } else { if ( databaseMeta == null ) { databaseMeta = new DatabaseMeta(); } this.getInfo( databaseMeta ); databaseMeta.setChanged(); close(); } } DataHandler(); }
DataHandler extends AbstractXulEventHandler { public void onOK() { DatabaseMeta database = new DatabaseMeta(); this.getInfo( database ); boolean passed = checkPoolingParameters(); if ( !passed ) { return; } String[] remarks = database.checkParameters(); String message = ""; if ( remarks.length != 0 ) { for ( int i = 0; i < remarks.length; i++ ) { message = message.concat( "* " ).concat( remarks[i] ).concat( System.getProperty( "line.separator" ) ); } showMessage( message, false ); } else { if ( databaseMeta == null ) { databaseMeta = new DatabaseMeta(); } this.getInfo( databaseMeta ); databaseMeta.setChanged(); close(); } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); }
DataHandler extends AbstractXulEventHandler { public void onOK() { DatabaseMeta database = new DatabaseMeta(); this.getInfo( database ); boolean passed = checkPoolingParameters(); if ( !passed ) { return; } String[] remarks = database.checkParameters(); String message = ""; if ( remarks.length != 0 ) { for ( int i = 0; i < remarks.length; i++ ) { message = message.concat( "* " ).concat( remarks[i] ).concat( System.getProperty( "line.separator" ) ); } showMessage( message, false ); } else { if ( databaseMeta == null ) { databaseMeta = new DatabaseMeta(); } this.getInfo( databaseMeta ); databaseMeta.setChanged(); close(); } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); static final SortedMap<String, DatabaseInterface> connectionMap; static final Map<String, String> connectionNametoID; }
@Test( expected = KettleStepException.class ) public void checkDestinationFolderField_NameIsBlank() throws Exception { SFTPPutData data = new SFTPPutData(); step.checkDestinationFolderField( "", data ); }
@VisibleForTesting void checkDestinationFolderField( String realDestinationFoldernameFieldName, SFTPPutData data ) throws KettleStepException { realDestinationFoldernameFieldName = environmentSubstitute( realDestinationFoldernameFieldName ); if ( Utils.isEmpty( realDestinationFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Log.DestinatFolderNameFieldNameMissing" ) ); } data.indexOfMoveToFolderFieldName = getInputRowMeta().indexOfValue( realDestinationFoldernameFieldName ); if ( data.indexOfMoveToFolderFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", realDestinationFoldernameFieldName ) ); } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkDestinationFolderField( String realDestinationFoldernameFieldName, SFTPPutData data ) throws KettleStepException { realDestinationFoldernameFieldName = environmentSubstitute( realDestinationFoldernameFieldName ); if ( Utils.isEmpty( realDestinationFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Log.DestinatFolderNameFieldNameMissing" ) ); } data.indexOfMoveToFolderFieldName = getInputRowMeta().indexOfValue( realDestinationFoldernameFieldName ); if ( data.indexOfMoveToFolderFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", realDestinationFoldernameFieldName ) ); } } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkDestinationFolderField( String realDestinationFoldernameFieldName, SFTPPutData data ) throws KettleStepException { realDestinationFoldernameFieldName = environmentSubstitute( realDestinationFoldernameFieldName ); if ( Utils.isEmpty( realDestinationFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Log.DestinatFolderNameFieldNameMissing" ) ); } data.indexOfMoveToFolderFieldName = getInputRowMeta().indexOfValue( realDestinationFoldernameFieldName ); if ( data.indexOfMoveToFolderFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", realDestinationFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkDestinationFolderField( String realDestinationFoldernameFieldName, SFTPPutData data ) throws KettleStepException { realDestinationFoldernameFieldName = environmentSubstitute( realDestinationFoldernameFieldName ); if ( Utils.isEmpty( realDestinationFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Log.DestinatFolderNameFieldNameMissing" ) ); } data.indexOfMoveToFolderFieldName = getInputRowMeta().indexOfValue( realDestinationFoldernameFieldName ); if ( data.indexOfMoveToFolderFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", realDestinationFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkDestinationFolderField( String realDestinationFoldernameFieldName, SFTPPutData data ) throws KettleStepException { realDestinationFoldernameFieldName = environmentSubstitute( realDestinationFoldernameFieldName ); if ( Utils.isEmpty( realDestinationFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Log.DestinatFolderNameFieldNameMissing" ) ); } data.indexOfMoveToFolderFieldName = getInputRowMeta().indexOfValue( realDestinationFoldernameFieldName ); if ( data.indexOfMoveToFolderFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", realDestinationFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test( expected = KettleStepException.class ) public void checkDestinationFolderField_NameIsSet_NotFound() throws Exception { step.setInputRowMeta( new RowMeta() ); step.checkDestinationFolderField( "destinationFolder", new SFTPPutData() ); }
@VisibleForTesting void checkDestinationFolderField( String realDestinationFoldernameFieldName, SFTPPutData data ) throws KettleStepException { realDestinationFoldernameFieldName = environmentSubstitute( realDestinationFoldernameFieldName ); if ( Utils.isEmpty( realDestinationFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Log.DestinatFolderNameFieldNameMissing" ) ); } data.indexOfMoveToFolderFieldName = getInputRowMeta().indexOfValue( realDestinationFoldernameFieldName ); if ( data.indexOfMoveToFolderFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", realDestinationFoldernameFieldName ) ); } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkDestinationFolderField( String realDestinationFoldernameFieldName, SFTPPutData data ) throws KettleStepException { realDestinationFoldernameFieldName = environmentSubstitute( realDestinationFoldernameFieldName ); if ( Utils.isEmpty( realDestinationFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Log.DestinatFolderNameFieldNameMissing" ) ); } data.indexOfMoveToFolderFieldName = getInputRowMeta().indexOfValue( realDestinationFoldernameFieldName ); if ( data.indexOfMoveToFolderFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", realDestinationFoldernameFieldName ) ); } } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkDestinationFolderField( String realDestinationFoldernameFieldName, SFTPPutData data ) throws KettleStepException { realDestinationFoldernameFieldName = environmentSubstitute( realDestinationFoldernameFieldName ); if ( Utils.isEmpty( realDestinationFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Log.DestinatFolderNameFieldNameMissing" ) ); } data.indexOfMoveToFolderFieldName = getInputRowMeta().indexOfValue( realDestinationFoldernameFieldName ); if ( data.indexOfMoveToFolderFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", realDestinationFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkDestinationFolderField( String realDestinationFoldernameFieldName, SFTPPutData data ) throws KettleStepException { realDestinationFoldernameFieldName = environmentSubstitute( realDestinationFoldernameFieldName ); if ( Utils.isEmpty( realDestinationFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Log.DestinatFolderNameFieldNameMissing" ) ); } data.indexOfMoveToFolderFieldName = getInputRowMeta().indexOfValue( realDestinationFoldernameFieldName ); if ( data.indexOfMoveToFolderFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", realDestinationFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkDestinationFolderField( String realDestinationFoldernameFieldName, SFTPPutData data ) throws KettleStepException { realDestinationFoldernameFieldName = environmentSubstitute( realDestinationFoldernameFieldName ); if ( Utils.isEmpty( realDestinationFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Log.DestinatFolderNameFieldNameMissing" ) ); } data.indexOfMoveToFolderFieldName = getInputRowMeta().indexOfValue( realDestinationFoldernameFieldName ); if ( data.indexOfMoveToFolderFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", realDestinationFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void checkDestinationFolderField_NameIsSet_Found() throws Exception { RowMeta rowMeta = rowOfStringsMeta( "some field", "destinationFolderFieldName" ); step.setInputRowMeta( rowMeta ); SFTPPutData data = new SFTPPutData(); step.checkDestinationFolderField( "destinationFolderFieldName", data ); assertEquals( 1, data.indexOfMoveToFolderFieldName ); }
@VisibleForTesting void checkDestinationFolderField( String realDestinationFoldernameFieldName, SFTPPutData data ) throws KettleStepException { realDestinationFoldernameFieldName = environmentSubstitute( realDestinationFoldernameFieldName ); if ( Utils.isEmpty( realDestinationFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Log.DestinatFolderNameFieldNameMissing" ) ); } data.indexOfMoveToFolderFieldName = getInputRowMeta().indexOfValue( realDestinationFoldernameFieldName ); if ( data.indexOfMoveToFolderFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", realDestinationFoldernameFieldName ) ); } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkDestinationFolderField( String realDestinationFoldernameFieldName, SFTPPutData data ) throws KettleStepException { realDestinationFoldernameFieldName = environmentSubstitute( realDestinationFoldernameFieldName ); if ( Utils.isEmpty( realDestinationFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Log.DestinatFolderNameFieldNameMissing" ) ); } data.indexOfMoveToFolderFieldName = getInputRowMeta().indexOfValue( realDestinationFoldernameFieldName ); if ( data.indexOfMoveToFolderFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", realDestinationFoldernameFieldName ) ); } } }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkDestinationFolderField( String realDestinationFoldernameFieldName, SFTPPutData data ) throws KettleStepException { realDestinationFoldernameFieldName = environmentSubstitute( realDestinationFoldernameFieldName ); if ( Utils.isEmpty( realDestinationFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Log.DestinatFolderNameFieldNameMissing" ) ); } data.indexOfMoveToFolderFieldName = getInputRowMeta().indexOfValue( realDestinationFoldernameFieldName ); if ( data.indexOfMoveToFolderFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", realDestinationFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkDestinationFolderField( String realDestinationFoldernameFieldName, SFTPPutData data ) throws KettleStepException { realDestinationFoldernameFieldName = environmentSubstitute( realDestinationFoldernameFieldName ); if ( Utils.isEmpty( realDestinationFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Log.DestinatFolderNameFieldNameMissing" ) ); } data.indexOfMoveToFolderFieldName = getInputRowMeta().indexOfValue( realDestinationFoldernameFieldName ); if ( data.indexOfMoveToFolderFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", realDestinationFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
SFTPPut extends BaseStep implements StepInterface { @VisibleForTesting void checkDestinationFolderField( String realDestinationFoldernameFieldName, SFTPPutData data ) throws KettleStepException { realDestinationFoldernameFieldName = environmentSubstitute( realDestinationFoldernameFieldName ); if ( Utils.isEmpty( realDestinationFoldernameFieldName ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Log.DestinatFolderNameFieldNameMissing" ) ); } data.indexOfMoveToFolderFieldName = getInputRowMeta().indexOfValue( realDestinationFoldernameFieldName ); if ( data.indexOfMoveToFolderFieldName == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", realDestinationFoldernameFieldName ) ); } } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void remoteFilenameFieldIsMandatoryWhenStreamingFromInputField() throws Exception { RowMeta rowMeta = rowOfStringsMeta( "sourceFilenameFieldName", "remoteDirectoryFieldName" ); step.setInputRowMeta( rowMeta ); doReturn( new Object[] { "qwerty", "asdfg" } ).when( step ).getRow(); SFTPPutMeta meta = new SFTPPutMeta(); meta.setInputStream( true ); meta.setPassword( "qwerty" ); meta.setSourceFileFieldName( "sourceFilenameFieldName" ); meta.setRemoteDirectoryFieldName( "remoteDirectoryFieldName" ); step.processRow( meta, new SFTPPutData() ); assertEquals( 1, step.getErrors() ); }
public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SFTPPutMeta) smi; data = (SFTPPutData) sdi; boolean sendToErrorRow = false; String errorMessage = null; Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( first ) { first = false; try { String realServerName = environmentSubstitute( meta.getServerName() ); String realServerPort = environmentSubstitute( meta.getServerPort() ); String realUsername = environmentSubstitute( meta.getUserName() ); String realPassword = Encr.decryptPasswordOptionallyEncrypted( environmentSubstitute( meta.getPassword() ) ); String realKeyFilename = null; String realPassPhrase = null; if ( meta.isUseKeyFile() ) { realKeyFilename = environmentSubstitute( meta.getKeyFilename() ); if ( Utils.isEmpty( realKeyFilename ) ) { logError( BaseMessages.getString( PKG, "SFTPPut.Error.KeyFileMissing" ) ); return false; } if ( !KettleVFS.fileExists( realKeyFilename ) ) { logError( BaseMessages.getString( PKG, "SFTPPut.Error.KeyFileNotFound", realKeyFilename ) ); return false; } realPassPhrase = environmentSubstitute( meta.getKeyPassPhrase() ); } data.sftpclient = createSftpClient( realServerName, realServerPort, realUsername, realKeyFilename, realPassPhrase ); if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "SFTPPUT.Log.OpenedConnection", realServerName, realServerPort, realUsername ) ); } data.sftpclient.setCompression( meta.getCompression() ); String realProxyHost = environmentSubstitute( meta.getProxyHost() ); if ( !Utils.isEmpty( realProxyHost ) ) { data.sftpclient.setProxy( realProxyHost, environmentSubstitute( meta.getProxyPort() ), environmentSubstitute( meta .getProxyUsername() ), environmentSubstitute( meta.getProxyPassword() ), meta.getProxyType() ); } data.sftpclient.login( realPassword ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "SFTPPUT.Error.Connection" ), e ); } checkSourceFileField( meta.getSourceFileFieldName(), data ); checkRemoteFoldernameField( meta.getRemoteDirectoryFieldName(), data ); checkRemoteFilenameField( meta.getRemoteFilenameFieldName(), data ); if ( meta.getAfterFTPS() == JobEntrySFTPPUT.AFTER_FTPSPUT_MOVE ) { checkDestinationFolderField( meta.getDestinationFolderFieldName(), data ); } } String sourceData = getInputRowMeta().getString( r, data.indexOfSourceFileFieldName ); InputStream inputStream = null; FileObject destinationFolder = null; String destinationFilename; FileObject file = null; try { if ( Utils.isEmpty( sourceData ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceDataEmpty" ) ); } if ( meta.isInputStream() ) { inputStream = new ByteArrayInputStream( sourceData.getBytes() ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFilenameFieldMissing" ) ); } destinationFilename = getInputRowMeta().getString( r, data.indexOfRemoteFilename ); } else { file = KettleVFS.getFileObject( sourceData ); if ( !file.exists() ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceData ) ); } inputStream = KettleVFS.getInputStream( file ); destinationFilename = file.getName().getBaseName(); } if ( file != null ) { if ( meta.getAfterFTPS() == JobEntrySFTPPUT.AFTER_FTPSPUT_MOVE ) { String realDestationFolder = getInputRowMeta().getString( r, data.indexOfMoveToFolderFieldName ); if ( Utils.isEmpty( realDestationFolder ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.MoveToDestinationFolderIsEmpty" ) ); } destinationFolder = KettleVFS.getFileObject( realDestationFolder ); if ( !destinationFolder.exists() ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindFolder", realDestationFolder ) ); } } } setSFTPDirectory( getInputRowMeta().getString( r, data.indexOfRemoteDirectory ) ); data.sftpclient.put( inputStream, destinationFilename ); if ( file != null ) { finishTheJob( file, sourceData, destinationFolder ); } putRow( getInputRowMeta(), r ); if ( checkFeedback( getLinesRead() ) ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "SFTPPut.Log.LineNumber" ) + getLinesRead() ); } } } catch ( Exception e ) { if ( getStepMeta().isDoingErrorHandling() ) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError( BaseMessages.getString( PKG, "SFTPPut.Log.ErrorInStep" ), e ); setErrors( 1 ); stopAll(); setOutputDone(); return false; } if ( sendToErrorRow ) { putError( getInputRowMeta(), r, 1, errorMessage, null, "SFTPPUT001" ); } } finally { try { if ( destinationFolder != null ) { destinationFolder.close(); } if ( file != null ) { file.close(); } if ( inputStream != null ) { inputStream.close(); } } catch ( Exception e ) { } } return true; }
SFTPPut extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SFTPPutMeta) smi; data = (SFTPPutData) sdi; boolean sendToErrorRow = false; String errorMessage = null; Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( first ) { first = false; try { String realServerName = environmentSubstitute( meta.getServerName() ); String realServerPort = environmentSubstitute( meta.getServerPort() ); String realUsername = environmentSubstitute( meta.getUserName() ); String realPassword = Encr.decryptPasswordOptionallyEncrypted( environmentSubstitute( meta.getPassword() ) ); String realKeyFilename = null; String realPassPhrase = null; if ( meta.isUseKeyFile() ) { realKeyFilename = environmentSubstitute( meta.getKeyFilename() ); if ( Utils.isEmpty( realKeyFilename ) ) { logError( BaseMessages.getString( PKG, "SFTPPut.Error.KeyFileMissing" ) ); return false; } if ( !KettleVFS.fileExists( realKeyFilename ) ) { logError( BaseMessages.getString( PKG, "SFTPPut.Error.KeyFileNotFound", realKeyFilename ) ); return false; } realPassPhrase = environmentSubstitute( meta.getKeyPassPhrase() ); } data.sftpclient = createSftpClient( realServerName, realServerPort, realUsername, realKeyFilename, realPassPhrase ); if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "SFTPPUT.Log.OpenedConnection", realServerName, realServerPort, realUsername ) ); } data.sftpclient.setCompression( meta.getCompression() ); String realProxyHost = environmentSubstitute( meta.getProxyHost() ); if ( !Utils.isEmpty( realProxyHost ) ) { data.sftpclient.setProxy( realProxyHost, environmentSubstitute( meta.getProxyPort() ), environmentSubstitute( meta .getProxyUsername() ), environmentSubstitute( meta.getProxyPassword() ), meta.getProxyType() ); } data.sftpclient.login( realPassword ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "SFTPPUT.Error.Connection" ), e ); } checkSourceFileField( meta.getSourceFileFieldName(), data ); checkRemoteFoldernameField( meta.getRemoteDirectoryFieldName(), data ); checkRemoteFilenameField( meta.getRemoteFilenameFieldName(), data ); if ( meta.getAfterFTPS() == JobEntrySFTPPUT.AFTER_FTPSPUT_MOVE ) { checkDestinationFolderField( meta.getDestinationFolderFieldName(), data ); } } String sourceData = getInputRowMeta().getString( r, data.indexOfSourceFileFieldName ); InputStream inputStream = null; FileObject destinationFolder = null; String destinationFilename; FileObject file = null; try { if ( Utils.isEmpty( sourceData ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceDataEmpty" ) ); } if ( meta.isInputStream() ) { inputStream = new ByteArrayInputStream( sourceData.getBytes() ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFilenameFieldMissing" ) ); } destinationFilename = getInputRowMeta().getString( r, data.indexOfRemoteFilename ); } else { file = KettleVFS.getFileObject( sourceData ); if ( !file.exists() ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceData ) ); } inputStream = KettleVFS.getInputStream( file ); destinationFilename = file.getName().getBaseName(); } if ( file != null ) { if ( meta.getAfterFTPS() == JobEntrySFTPPUT.AFTER_FTPSPUT_MOVE ) { String realDestationFolder = getInputRowMeta().getString( r, data.indexOfMoveToFolderFieldName ); if ( Utils.isEmpty( realDestationFolder ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.MoveToDestinationFolderIsEmpty" ) ); } destinationFolder = KettleVFS.getFileObject( realDestationFolder ); if ( !destinationFolder.exists() ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindFolder", realDestationFolder ) ); } } } setSFTPDirectory( getInputRowMeta().getString( r, data.indexOfRemoteDirectory ) ); data.sftpclient.put( inputStream, destinationFilename ); if ( file != null ) { finishTheJob( file, sourceData, destinationFolder ); } putRow( getInputRowMeta(), r ); if ( checkFeedback( getLinesRead() ) ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "SFTPPut.Log.LineNumber" ) + getLinesRead() ); } } } catch ( Exception e ) { if ( getStepMeta().isDoingErrorHandling() ) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError( BaseMessages.getString( PKG, "SFTPPut.Log.ErrorInStep" ), e ); setErrors( 1 ); stopAll(); setOutputDone(); return false; } if ( sendToErrorRow ) { putError( getInputRowMeta(), r, 1, errorMessage, null, "SFTPPUT001" ); } } finally { try { if ( destinationFolder != null ) { destinationFolder.close(); } if ( file != null ) { file.close(); } if ( inputStream != null ) { inputStream.close(); } } catch ( Exception e ) { } } return true; } }
SFTPPut extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SFTPPutMeta) smi; data = (SFTPPutData) sdi; boolean sendToErrorRow = false; String errorMessage = null; Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( first ) { first = false; try { String realServerName = environmentSubstitute( meta.getServerName() ); String realServerPort = environmentSubstitute( meta.getServerPort() ); String realUsername = environmentSubstitute( meta.getUserName() ); String realPassword = Encr.decryptPasswordOptionallyEncrypted( environmentSubstitute( meta.getPassword() ) ); String realKeyFilename = null; String realPassPhrase = null; if ( meta.isUseKeyFile() ) { realKeyFilename = environmentSubstitute( meta.getKeyFilename() ); if ( Utils.isEmpty( realKeyFilename ) ) { logError( BaseMessages.getString( PKG, "SFTPPut.Error.KeyFileMissing" ) ); return false; } if ( !KettleVFS.fileExists( realKeyFilename ) ) { logError( BaseMessages.getString( PKG, "SFTPPut.Error.KeyFileNotFound", realKeyFilename ) ); return false; } realPassPhrase = environmentSubstitute( meta.getKeyPassPhrase() ); } data.sftpclient = createSftpClient( realServerName, realServerPort, realUsername, realKeyFilename, realPassPhrase ); if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "SFTPPUT.Log.OpenedConnection", realServerName, realServerPort, realUsername ) ); } data.sftpclient.setCompression( meta.getCompression() ); String realProxyHost = environmentSubstitute( meta.getProxyHost() ); if ( !Utils.isEmpty( realProxyHost ) ) { data.sftpclient.setProxy( realProxyHost, environmentSubstitute( meta.getProxyPort() ), environmentSubstitute( meta .getProxyUsername() ), environmentSubstitute( meta.getProxyPassword() ), meta.getProxyType() ); } data.sftpclient.login( realPassword ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "SFTPPUT.Error.Connection" ), e ); } checkSourceFileField( meta.getSourceFileFieldName(), data ); checkRemoteFoldernameField( meta.getRemoteDirectoryFieldName(), data ); checkRemoteFilenameField( meta.getRemoteFilenameFieldName(), data ); if ( meta.getAfterFTPS() == JobEntrySFTPPUT.AFTER_FTPSPUT_MOVE ) { checkDestinationFolderField( meta.getDestinationFolderFieldName(), data ); } } String sourceData = getInputRowMeta().getString( r, data.indexOfSourceFileFieldName ); InputStream inputStream = null; FileObject destinationFolder = null; String destinationFilename; FileObject file = null; try { if ( Utils.isEmpty( sourceData ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceDataEmpty" ) ); } if ( meta.isInputStream() ) { inputStream = new ByteArrayInputStream( sourceData.getBytes() ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFilenameFieldMissing" ) ); } destinationFilename = getInputRowMeta().getString( r, data.indexOfRemoteFilename ); } else { file = KettleVFS.getFileObject( sourceData ); if ( !file.exists() ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceData ) ); } inputStream = KettleVFS.getInputStream( file ); destinationFilename = file.getName().getBaseName(); } if ( file != null ) { if ( meta.getAfterFTPS() == JobEntrySFTPPUT.AFTER_FTPSPUT_MOVE ) { String realDestationFolder = getInputRowMeta().getString( r, data.indexOfMoveToFolderFieldName ); if ( Utils.isEmpty( realDestationFolder ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.MoveToDestinationFolderIsEmpty" ) ); } destinationFolder = KettleVFS.getFileObject( realDestationFolder ); if ( !destinationFolder.exists() ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindFolder", realDestationFolder ) ); } } } setSFTPDirectory( getInputRowMeta().getString( r, data.indexOfRemoteDirectory ) ); data.sftpclient.put( inputStream, destinationFilename ); if ( file != null ) { finishTheJob( file, sourceData, destinationFolder ); } putRow( getInputRowMeta(), r ); if ( checkFeedback( getLinesRead() ) ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "SFTPPut.Log.LineNumber" ) + getLinesRead() ); } } } catch ( Exception e ) { if ( getStepMeta().isDoingErrorHandling() ) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError( BaseMessages.getString( PKG, "SFTPPut.Log.ErrorInStep" ), e ); setErrors( 1 ); stopAll(); setOutputDone(); return false; } if ( sendToErrorRow ) { putError( getInputRowMeta(), r, 1, errorMessage, null, "SFTPPUT001" ); } } finally { try { if ( destinationFolder != null ) { destinationFolder.close(); } if ( file != null ) { file.close(); } if ( inputStream != null ) { inputStream.close(); } } catch ( Exception e ) { } } return true; } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
SFTPPut extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SFTPPutMeta) smi; data = (SFTPPutData) sdi; boolean sendToErrorRow = false; String errorMessage = null; Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( first ) { first = false; try { String realServerName = environmentSubstitute( meta.getServerName() ); String realServerPort = environmentSubstitute( meta.getServerPort() ); String realUsername = environmentSubstitute( meta.getUserName() ); String realPassword = Encr.decryptPasswordOptionallyEncrypted( environmentSubstitute( meta.getPassword() ) ); String realKeyFilename = null; String realPassPhrase = null; if ( meta.isUseKeyFile() ) { realKeyFilename = environmentSubstitute( meta.getKeyFilename() ); if ( Utils.isEmpty( realKeyFilename ) ) { logError( BaseMessages.getString( PKG, "SFTPPut.Error.KeyFileMissing" ) ); return false; } if ( !KettleVFS.fileExists( realKeyFilename ) ) { logError( BaseMessages.getString( PKG, "SFTPPut.Error.KeyFileNotFound", realKeyFilename ) ); return false; } realPassPhrase = environmentSubstitute( meta.getKeyPassPhrase() ); } data.sftpclient = createSftpClient( realServerName, realServerPort, realUsername, realKeyFilename, realPassPhrase ); if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "SFTPPUT.Log.OpenedConnection", realServerName, realServerPort, realUsername ) ); } data.sftpclient.setCompression( meta.getCompression() ); String realProxyHost = environmentSubstitute( meta.getProxyHost() ); if ( !Utils.isEmpty( realProxyHost ) ) { data.sftpclient.setProxy( realProxyHost, environmentSubstitute( meta.getProxyPort() ), environmentSubstitute( meta .getProxyUsername() ), environmentSubstitute( meta.getProxyPassword() ), meta.getProxyType() ); } data.sftpclient.login( realPassword ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "SFTPPUT.Error.Connection" ), e ); } checkSourceFileField( meta.getSourceFileFieldName(), data ); checkRemoteFoldernameField( meta.getRemoteDirectoryFieldName(), data ); checkRemoteFilenameField( meta.getRemoteFilenameFieldName(), data ); if ( meta.getAfterFTPS() == JobEntrySFTPPUT.AFTER_FTPSPUT_MOVE ) { checkDestinationFolderField( meta.getDestinationFolderFieldName(), data ); } } String sourceData = getInputRowMeta().getString( r, data.indexOfSourceFileFieldName ); InputStream inputStream = null; FileObject destinationFolder = null; String destinationFilename; FileObject file = null; try { if ( Utils.isEmpty( sourceData ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceDataEmpty" ) ); } if ( meta.isInputStream() ) { inputStream = new ByteArrayInputStream( sourceData.getBytes() ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFilenameFieldMissing" ) ); } destinationFilename = getInputRowMeta().getString( r, data.indexOfRemoteFilename ); } else { file = KettleVFS.getFileObject( sourceData ); if ( !file.exists() ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceData ) ); } inputStream = KettleVFS.getInputStream( file ); destinationFilename = file.getName().getBaseName(); } if ( file != null ) { if ( meta.getAfterFTPS() == JobEntrySFTPPUT.AFTER_FTPSPUT_MOVE ) { String realDestationFolder = getInputRowMeta().getString( r, data.indexOfMoveToFolderFieldName ); if ( Utils.isEmpty( realDestationFolder ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.MoveToDestinationFolderIsEmpty" ) ); } destinationFolder = KettleVFS.getFileObject( realDestationFolder ); if ( !destinationFolder.exists() ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindFolder", realDestationFolder ) ); } } } setSFTPDirectory( getInputRowMeta().getString( r, data.indexOfRemoteDirectory ) ); data.sftpclient.put( inputStream, destinationFilename ); if ( file != null ) { finishTheJob( file, sourceData, destinationFolder ); } putRow( getInputRowMeta(), r ); if ( checkFeedback( getLinesRead() ) ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "SFTPPut.Log.LineNumber" ) + getLinesRead() ); } } } catch ( Exception e ) { if ( getStepMeta().isDoingErrorHandling() ) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError( BaseMessages.getString( PKG, "SFTPPut.Log.ErrorInStep" ), e ); setErrors( 1 ); stopAll(); setOutputDone(); return false; } if ( sendToErrorRow ) { putError( getInputRowMeta(), r, 1, errorMessage, null, "SFTPPUT001" ); } } finally { try { if ( destinationFolder != null ) { destinationFolder.close(); } if ( file != null ) { file.close(); } if ( inputStream != null ) { inputStream.close(); } } catch ( Exception e ) { } } return true; } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
SFTPPut extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SFTPPutMeta) smi; data = (SFTPPutData) sdi; boolean sendToErrorRow = false; String errorMessage = null; Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( first ) { first = false; try { String realServerName = environmentSubstitute( meta.getServerName() ); String realServerPort = environmentSubstitute( meta.getServerPort() ); String realUsername = environmentSubstitute( meta.getUserName() ); String realPassword = Encr.decryptPasswordOptionallyEncrypted( environmentSubstitute( meta.getPassword() ) ); String realKeyFilename = null; String realPassPhrase = null; if ( meta.isUseKeyFile() ) { realKeyFilename = environmentSubstitute( meta.getKeyFilename() ); if ( Utils.isEmpty( realKeyFilename ) ) { logError( BaseMessages.getString( PKG, "SFTPPut.Error.KeyFileMissing" ) ); return false; } if ( !KettleVFS.fileExists( realKeyFilename ) ) { logError( BaseMessages.getString( PKG, "SFTPPut.Error.KeyFileNotFound", realKeyFilename ) ); return false; } realPassPhrase = environmentSubstitute( meta.getKeyPassPhrase() ); } data.sftpclient = createSftpClient( realServerName, realServerPort, realUsername, realKeyFilename, realPassPhrase ); if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "SFTPPUT.Log.OpenedConnection", realServerName, realServerPort, realUsername ) ); } data.sftpclient.setCompression( meta.getCompression() ); String realProxyHost = environmentSubstitute( meta.getProxyHost() ); if ( !Utils.isEmpty( realProxyHost ) ) { data.sftpclient.setProxy( realProxyHost, environmentSubstitute( meta.getProxyPort() ), environmentSubstitute( meta .getProxyUsername() ), environmentSubstitute( meta.getProxyPassword() ), meta.getProxyType() ); } data.sftpclient.login( realPassword ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "SFTPPUT.Error.Connection" ), e ); } checkSourceFileField( meta.getSourceFileFieldName(), data ); checkRemoteFoldernameField( meta.getRemoteDirectoryFieldName(), data ); checkRemoteFilenameField( meta.getRemoteFilenameFieldName(), data ); if ( meta.getAfterFTPS() == JobEntrySFTPPUT.AFTER_FTPSPUT_MOVE ) { checkDestinationFolderField( meta.getDestinationFolderFieldName(), data ); } } String sourceData = getInputRowMeta().getString( r, data.indexOfSourceFileFieldName ); InputStream inputStream = null; FileObject destinationFolder = null; String destinationFilename; FileObject file = null; try { if ( Utils.isEmpty( sourceData ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.SourceDataEmpty" ) ); } if ( meta.isInputStream() ) { inputStream = new ByteArrayInputStream( sourceData.getBytes() ); if ( data.indexOfRemoteFilename == -1 ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.RemoteFilenameFieldMissing" ) ); } destinationFilename = getInputRowMeta().getString( r, data.indexOfRemoteFilename ); } else { file = KettleVFS.getFileObject( sourceData ); if ( !file.exists() ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindField", sourceData ) ); } inputStream = KettleVFS.getInputStream( file ); destinationFilename = file.getName().getBaseName(); } if ( file != null ) { if ( meta.getAfterFTPS() == JobEntrySFTPPUT.AFTER_FTPSPUT_MOVE ) { String realDestationFolder = getInputRowMeta().getString( r, data.indexOfMoveToFolderFieldName ); if ( Utils.isEmpty( realDestationFolder ) ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.MoveToDestinationFolderIsEmpty" ) ); } destinationFolder = KettleVFS.getFileObject( realDestationFolder ); if ( !destinationFolder.exists() ) { throw new KettleStepException( BaseMessages.getString( PKG, "SFTPPut.Error.CanNotFindFolder", realDestationFolder ) ); } } } setSFTPDirectory( getInputRowMeta().getString( r, data.indexOfRemoteDirectory ) ); data.sftpclient.put( inputStream, destinationFilename ); if ( file != null ) { finishTheJob( file, sourceData, destinationFolder ); } putRow( getInputRowMeta(), r ); if ( checkFeedback( getLinesRead() ) ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "SFTPPut.Log.LineNumber" ) + getLinesRead() ); } } } catch ( Exception e ) { if ( getStepMeta().isDoingErrorHandling() ) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError( BaseMessages.getString( PKG, "SFTPPut.Log.ErrorInStep" ), e ); setErrors( 1 ); stopAll(); setOutputDone(); return false; } if ( sendToErrorRow ) { putError( getInputRowMeta(), r, 1, errorMessage, null, "SFTPPUT001" ); } } finally { try { if ( destinationFolder != null ) { destinationFolder.close(); } if ( file != null ) { file.close(); } if ( inputStream != null ) { inputStream.close(); } } catch ( Exception e ) { } } return true; } SFTPPut( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void testLoadXML() throws Exception { SystemDataMeta systemDataMeta = new SystemDataMeta(); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.parse( new InputSource( new StringReader( expectedXML ) ) ); Node node = document; IMetaStore store = null; systemDataMeta.loadXML( node, null, store ); assertEquals( expectedSystemDataMeta, systemDataMeta ); }
@Override public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException { readData( stepnode ); }
SystemDataMeta extends BaseStepMeta implements StepMetaInterface { @Override public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException { readData( stepnode ); } }
SystemDataMeta extends BaseStepMeta implements StepMetaInterface { @Override public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException { readData( stepnode ); } SystemDataMeta(); }
SystemDataMeta extends BaseStepMeta implements StepMetaInterface { @Override public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException { readData( stepnode ); } SystemDataMeta(); String[] getFieldName(); void setFieldName( String[] fieldName ); SystemDataTypes[] getFieldType(); void setFieldType( SystemDataTypes[] fieldType ); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int count ); @Override Object clone(); static final SystemDataTypes getType( String type ); static final String getTypeDesc( SystemDataTypes t ); @Override void setDefault(); @Override void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); @Override Map<String, String> getUsedArguments(); @Override StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); @Override StepDataInterface getStepData(); @Override boolean equals( Object o ); @Override int hashCode(); }
SystemDataMeta extends BaseStepMeta implements StepMetaInterface { @Override public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException { readData( stepnode ); } SystemDataMeta(); String[] getFieldName(); void setFieldName( String[] fieldName ); SystemDataTypes[] getFieldType(); void setFieldType( SystemDataTypes[] fieldType ); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int count ); @Override Object clone(); static final SystemDataTypes getType( String type ); static final String getTypeDesc( SystemDataTypes t ); @Override void setDefault(); @Override void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); @Override Map<String, String> getUsedArguments(); @Override StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); @Override StepDataInterface getStepData(); @Override boolean equals( Object o ); @Override int hashCode(); }
@Test public void testGetXML() throws Exception { String generatedXML = expectedSystemDataMeta.getXML(); assertEquals( expectedXML.replaceAll( "\n", "" ).replaceAll( "\r", "" ), generatedXML.replaceAll( "\n", "" ) .replaceAll( "\r", "" ) ); }
@Override public String getXML() { StringBuilder retval = new StringBuilder(); retval.append( " <fields>" + Const.CR ); for ( int i = 0; i < fieldName.length; i++ ) { retval.append( " <field>" + Const.CR ); retval.append( " " + XMLHandler.addTagValue( "name", fieldName[i] ) ); retval.append( " " + XMLHandler.addTagValue( "type", fieldType[i] != null ? fieldType[i].getCode() : "" ) ); retval.append( " </field>" + Const.CR ); } retval.append( " </fields>" + Const.CR ); return retval.toString(); }
SystemDataMeta extends BaseStepMeta implements StepMetaInterface { @Override public String getXML() { StringBuilder retval = new StringBuilder(); retval.append( " <fields>" + Const.CR ); for ( int i = 0; i < fieldName.length; i++ ) { retval.append( " <field>" + Const.CR ); retval.append( " " + XMLHandler.addTagValue( "name", fieldName[i] ) ); retval.append( " " + XMLHandler.addTagValue( "type", fieldType[i] != null ? fieldType[i].getCode() : "" ) ); retval.append( " </field>" + Const.CR ); } retval.append( " </fields>" + Const.CR ); return retval.toString(); } }
SystemDataMeta extends BaseStepMeta implements StepMetaInterface { @Override public String getXML() { StringBuilder retval = new StringBuilder(); retval.append( " <fields>" + Const.CR ); for ( int i = 0; i < fieldName.length; i++ ) { retval.append( " <field>" + Const.CR ); retval.append( " " + XMLHandler.addTagValue( "name", fieldName[i] ) ); retval.append( " " + XMLHandler.addTagValue( "type", fieldType[i] != null ? fieldType[i].getCode() : "" ) ); retval.append( " </field>" + Const.CR ); } retval.append( " </fields>" + Const.CR ); return retval.toString(); } SystemDataMeta(); }
SystemDataMeta extends BaseStepMeta implements StepMetaInterface { @Override public String getXML() { StringBuilder retval = new StringBuilder(); retval.append( " <fields>" + Const.CR ); for ( int i = 0; i < fieldName.length; i++ ) { retval.append( " <field>" + Const.CR ); retval.append( " " + XMLHandler.addTagValue( "name", fieldName[i] ) ); retval.append( " " + XMLHandler.addTagValue( "type", fieldType[i] != null ? fieldType[i].getCode() : "" ) ); retval.append( " </field>" + Const.CR ); } retval.append( " </fields>" + Const.CR ); return retval.toString(); } SystemDataMeta(); String[] getFieldName(); void setFieldName( String[] fieldName ); SystemDataTypes[] getFieldType(); void setFieldType( SystemDataTypes[] fieldType ); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int count ); @Override Object clone(); static final SystemDataTypes getType( String type ); static final String getTypeDesc( SystemDataTypes t ); @Override void setDefault(); @Override void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); @Override Map<String, String> getUsedArguments(); @Override StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); @Override StepDataInterface getStepData(); @Override boolean equals( Object o ); @Override int hashCode(); }
SystemDataMeta extends BaseStepMeta implements StepMetaInterface { @Override public String getXML() { StringBuilder retval = new StringBuilder(); retval.append( " <fields>" + Const.CR ); for ( int i = 0; i < fieldName.length; i++ ) { retval.append( " <field>" + Const.CR ); retval.append( " " + XMLHandler.addTagValue( "name", fieldName[i] ) ); retval.append( " " + XMLHandler.addTagValue( "type", fieldType[i] != null ? fieldType[i].getCode() : "" ) ); retval.append( " </field>" + Const.CR ); } retval.append( " </fields>" + Const.CR ); return retval.toString(); } SystemDataMeta(); String[] getFieldName(); void setFieldName( String[] fieldName ); SystemDataTypes[] getFieldType(); void setFieldType( SystemDataTypes[] fieldType ); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); void allocate( int count ); @Override Object clone(); static final SystemDataTypes getType( String type ); static final String getTypeDesc( SystemDataTypes t ); @Override void setDefault(); @Override void getFields( RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); @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 check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); @Override Map<String, String> getUsedArguments(); @Override StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans trans ); @Override StepDataInterface getStepData(); @Override boolean equals( Object o ); @Override int hashCode(); }
@Test public void testProcessRow() throws Exception { SystemDataData systemDataData = new SystemDataData(); SystemDataMeta systemDataMeta = new SystemDataMeta(); systemDataMeta.allocate( 2 ); String[] names = systemDataMeta.getFieldName(); SystemDataTypes[] types = systemDataMeta.getFieldType(); names[0] = "hostname"; names[1] = "hostname_real"; types[0] = SystemDataMeta.getType( SystemDataMeta.getTypeDesc( SystemDataTypes.TYPE_SYSTEM_INFO_HOSTNAME ) ); types[1] = SystemDataMeta.getType( SystemDataMeta.getTypeDesc( SystemDataTypes.TYPE_SYSTEM_INFO_HOSTNAME_REAL ) ); SystemDataHandler systemData = new SystemDataHandler( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta, stepMockHelper.trans ); Object[] expectedRow = new Object[] { Const.getHostname(), Const.getHostnameReal() }; RowMetaInterface inputRowMeta = mock( RowMetaInterface.class ); when( inputRowMeta.clone() ).thenReturn( inputRowMeta ); when( inputRowMeta.size() ).thenReturn( 2 ); systemDataData.outputRowMeta = inputRowMeta; systemData.init( systemDataMeta, systemDataData ); assertFalse( systemData.processRow( systemDataMeta, systemDataData ) ); Object[] out = systemData.getOutputRow(); assertArrayEquals( expectedRow, out ); }
public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { Object[] row; if ( data.readsRows ) { row = getRow(); if ( row == null ) { setOutputDone(); return false; } if ( first ) { first = false; data.outputRowMeta = getInputRowMeta().clone(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } } else { row = new Object[] {}; incrementLinesRead(); if ( first ) { first = false; data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } } RowMetaInterface imeta = getInputRowMeta(); if ( imeta == null ) { imeta = new RowMeta(); this.setInputRowMeta( imeta ); } row = getSystemData( imeta, row ); if ( log.isRowLevel() ) { logRowlevel( "System info returned: " + data.outputRowMeta.getString( row ) ); } putRow( data.outputRowMeta, row ); if ( !data.readsRows ) { setOutputDone(); return false; } return true; }
SystemData extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { Object[] row; if ( data.readsRows ) { row = getRow(); if ( row == null ) { setOutputDone(); return false; } if ( first ) { first = false; data.outputRowMeta = getInputRowMeta().clone(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } } else { row = new Object[] {}; incrementLinesRead(); if ( first ) { first = false; data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } } RowMetaInterface imeta = getInputRowMeta(); if ( imeta == null ) { imeta = new RowMeta(); this.setInputRowMeta( imeta ); } row = getSystemData( imeta, row ); if ( log.isRowLevel() ) { logRowlevel( "System info returned: " + data.outputRowMeta.getString( row ) ); } putRow( data.outputRowMeta, row ); if ( !data.readsRows ) { setOutputDone(); return false; } return true; } }
SystemData extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { Object[] row; if ( data.readsRows ) { row = getRow(); if ( row == null ) { setOutputDone(); return false; } if ( first ) { first = false; data.outputRowMeta = getInputRowMeta().clone(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } } else { row = new Object[] {}; incrementLinesRead(); if ( first ) { first = false; data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } } RowMetaInterface imeta = getInputRowMeta(); if ( imeta == null ) { imeta = new RowMeta(); this.setInputRowMeta( imeta ); } row = getSystemData( imeta, row ); if ( log.isRowLevel() ) { logRowlevel( "System info returned: " + data.outputRowMeta.getString( row ) ); } putRow( data.outputRowMeta, row ); if ( !data.readsRows ) { setOutputDone(); return false; } return true; } SystemData( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
SystemData extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { Object[] row; if ( data.readsRows ) { row = getRow(); if ( row == null ) { setOutputDone(); return false; } if ( first ) { first = false; data.outputRowMeta = getInputRowMeta().clone(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } } else { row = new Object[] {}; incrementLinesRead(); if ( first ) { first = false; data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } } RowMetaInterface imeta = getInputRowMeta(); if ( imeta == null ) { imeta = new RowMeta(); this.setInputRowMeta( imeta ); } row = getSystemData( imeta, row ); if ( log.isRowLevel() ) { logRowlevel( "System info returned: " + data.outputRowMeta.getString( row ) ); } putRow( data.outputRowMeta, row ); if ( !data.readsRows ) { setOutputDone(); return false; } return true; } SystemData( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
SystemData extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { Object[] row; if ( data.readsRows ) { row = getRow(); if ( row == null ) { setOutputDone(); return false; } if ( first ) { first = false; data.outputRowMeta = getInputRowMeta().clone(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } } else { row = new Object[] {}; incrementLinesRead(); if ( first ) { first = false; data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } } RowMetaInterface imeta = getInputRowMeta(); if ( imeta == null ) { imeta = new RowMeta(); this.setInputRowMeta( imeta ); } row = getSystemData( imeta, row ); if ( log.isRowLevel() ) { logRowlevel( "System info returned: " + data.outputRowMeta.getString( row ) ); } putRow( data.outputRowMeta, row ); if ( !data.readsRows ) { setOutputDone(); return false; } return true; } SystemData( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void testInitSetGetFirstForIMAP() { MailInput step = new MailInput( mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans ); MailInputData data = new MailInputData(); MailInputMeta meta = mock( MailInputMeta.class ); when( meta.isDynamicFolder() ).thenReturn( false ); when( meta.getProtocol() ).thenReturn( MailConnectionMeta.PROTOCOL_STRING_IMAP ); when( meta.getFirstIMAPMails() ).thenReturn( "2" ); when( meta.getFirstMails() ).thenReturn( "3" ); step.init( meta, data ); Assert.assertEquals( "Row Limit is set up to 2 rows.", 2, data.rowlimit ); }
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; }
MailInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; } }
MailInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; } MailInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
MailInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; } MailInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); String[] getFolders( String realIMAPFolder ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
MailInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; } MailInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); String[] getFolders( String realIMAPFolder ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void testInitSetGetFirstForPOP3() { MailInput step = new MailInput( mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans ); MailInputData data = new MailInputData(); MailInputMeta meta = mock( MailInputMeta.class ); when( meta.isDynamicFolder() ).thenReturn( false ); when( meta.getProtocol() ).thenReturn( MailConnectionMeta.PROTOCOL_STRING_POP3 ); when( meta.getFirstIMAPMails() ).thenReturn( "2" ); when( meta.getFirstMails() ).thenReturn( "3" ); step.init( meta, data ); Assert.assertEquals( "Row Limit is set up to 3 rows.", 3, data.rowlimit ); }
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; }
MailInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; } }
MailInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; } MailInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
MailInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; } MailInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); String[] getFolders( String realIMAPFolder ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
MailInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; } MailInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); String[] getFolders( String realIMAPFolder ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void testInitSetGetFirstLimitOverride() { MailInput step = new MailInput( mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans ); MailInputData data = new MailInputData(); MailInputMeta meta = mock( MailInputMeta.class ); when( meta.isDynamicFolder() ).thenReturn( false ); when( meta.getProtocol() ).thenReturn( MailConnectionMeta.PROTOCOL_STRING_POP3 ); when( meta.getFirstIMAPMails() ).thenReturn( "2" ); when( meta.getFirstMails() ).thenReturn( "3" ); when( meta.getRowLimit() ).thenReturn( "5" ); step.init( meta, data ); Assert.assertEquals( "Row Limit is set up to 5 rows as the Limit has priority.", 5, data.rowlimit ); }
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; }
MailInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; } }
MailInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; } MailInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
MailInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; } MailInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); String[] getFolders( String realIMAPFolder ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
MailInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; } MailInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); String[] getFolders( String realIMAPFolder ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void testGetInfo() throws Exception { }
protected void getInfo( DatabaseMeta meta ) { getControls(); if ( this.databaseMeta != null && this.databaseMeta != meta ) { meta.initializeVariablesFrom( this.databaseMeta ); } meta.setName( connectionNameBox.getValue() ); meta.setDisplayName( connectionNameBox.getValue() ); Object connection = connectionBox.getSelectedItem(); if ( connection != null ) { meta.setDatabaseType( (String) connection ); } Object access = accessBox.getSelectedItem(); if ( access != null ) { meta.setAccessType( DatabaseMeta.getAccessType( (String) access ) ); } getConnectionSpecificInfo( meta ); if ( portNumberBox != null ) { meta.setDBPort( portNumberBox.getValue() ); } if ( optionsParameterTree != null ) { Object[][] values = optionsParameterTree.getValues(); for ( int i = 0; i < values.length; i++ ) { String parameter = (String) values[i][0]; String value = (String) values[i][1]; if ( value == null ) { value = ""; } String dbType = meta.getPluginId(); if ( ( parameter != null ) && ( parameter.trim().length() > 0 ) ) { if ( value.trim().length() <= 0 ) { value = DatabaseMeta.EMPTY_OPTIONS_STRING; } meta.addExtraOption( dbType, parameter, value ); } } } if ( supportBooleanDataType != null ) { meta.setSupportsBooleanDataType( supportBooleanDataType.isChecked() ); } if ( supportTimestampDataType != null ) { meta.setSupportsTimestampDataType( supportTimestampDataType.isChecked() ); } if ( quoteIdentifiersCheck != null ) { meta.setQuoteAllFields( quoteIdentifiersCheck.isChecked() ); } if ( lowerCaseIdentifiersCheck != null ) { meta.setForcingIdentifiersToLowerCase( lowerCaseIdentifiersCheck.isChecked() ); } if ( upperCaseIdentifiersCheck != null ) { meta.setForcingIdentifiersToUpperCase( upperCaseIdentifiersCheck.isChecked() ); } if ( preserveReservedCaseCheck != null ) { meta.setPreserveReservedCase( preserveReservedCaseCheck.isChecked() ); } if ( strictBigNumberInterpretaion != null && meta.getDatabaseInterface() instanceof OracleDatabaseMeta ) { ( (OracleDatabaseMeta) meta.getDatabaseInterface() ) .setStrictBigNumberInterpretation( strictBigNumberInterpretaion.isChecked() ); } if ( preferredSchemaName != null ) { meta.setPreferredSchemaName( preferredSchemaName.getValue() ); } if ( sqlBox != null ) { meta.setConnectSQL( sqlBox.getValue() ); } if ( clusteringCheck != null ) { meta.setPartitioned( clusteringCheck.isChecked() ); } if ( ( clusterParameterTree != null ) && ( meta.isPartitioned() ) ) { Object[][] values = clusterParameterTree.getValues(); List<PartitionDatabaseMeta> pdms = new ArrayList<PartitionDatabaseMeta>(); for ( int i = 0; i < values.length; i++ ) { String partitionId = (String) values[i][0]; if ( ( partitionId == null ) || ( partitionId.trim().length() <= 0 ) ) { continue; } String hostname = (String) values[i][1]; String port = (String) values[i][2]; String dbName = (String) values[i][3]; String username = (String) values[i][4]; String password = (String) values[i][5]; PartitionDatabaseMeta pdm = new PartitionDatabaseMeta( partitionId, hostname, port, dbName ); pdm.setUsername( username ); pdm.setPassword( password ); pdms.add( pdm ); } PartitionDatabaseMeta[] pdmArray = new PartitionDatabaseMeta[pdms.size()]; meta.setPartitioningInformation( pdms.toArray( pdmArray ) ); } if ( poolingCheck != null ) { meta.setUsingConnectionPool( poolingCheck.isChecked() ); } if ( meta.isUsingConnectionPool() ) { if ( poolSizeBox != null ) { try { int initialPoolSize = Integer.parseInt( poolSizeBox.getValue() ); meta.setInitialPoolSize( initialPoolSize ); } catch ( NumberFormatException e ) { } } if ( maxPoolSizeBox != null ) { try { int maxPoolSize = Integer.parseInt( maxPoolSizeBox.getValue() ); meta.setMaximumPoolSize( maxPoolSize ); } catch ( NumberFormatException e ) { } } if ( poolParameterTree != null ) { Object[][] values = poolParameterTree.getValues(); Properties properties = new Properties(); for ( int i = 0; i < values.length; i++ ) { boolean isChecked = false; if ( values[i][0] instanceof Boolean ) { isChecked = ( (Boolean) values[i][0] ).booleanValue(); } else { isChecked = Boolean.valueOf( (String) values[i][0] ); } if ( !isChecked ) { continue; } String parameter = (String) values[i][1]; String value = (String) values[i][2]; if ( ( parameter != null ) && ( parameter.trim().length() > 0 ) && ( value != null ) && ( value.trim().length() > 0 ) ) { properties.setProperty( parameter, value ); } } meta.setConnectionPoolingProperties( properties ); } } }
DataHandler extends AbstractXulEventHandler { protected void getInfo( DatabaseMeta meta ) { getControls(); if ( this.databaseMeta != null && this.databaseMeta != meta ) { meta.initializeVariablesFrom( this.databaseMeta ); } meta.setName( connectionNameBox.getValue() ); meta.setDisplayName( connectionNameBox.getValue() ); Object connection = connectionBox.getSelectedItem(); if ( connection != null ) { meta.setDatabaseType( (String) connection ); } Object access = accessBox.getSelectedItem(); if ( access != null ) { meta.setAccessType( DatabaseMeta.getAccessType( (String) access ) ); } getConnectionSpecificInfo( meta ); if ( portNumberBox != null ) { meta.setDBPort( portNumberBox.getValue() ); } if ( optionsParameterTree != null ) { Object[][] values = optionsParameterTree.getValues(); for ( int i = 0; i < values.length; i++ ) { String parameter = (String) values[i][0]; String value = (String) values[i][1]; if ( value == null ) { value = ""; } String dbType = meta.getPluginId(); if ( ( parameter != null ) && ( parameter.trim().length() > 0 ) ) { if ( value.trim().length() <= 0 ) { value = DatabaseMeta.EMPTY_OPTIONS_STRING; } meta.addExtraOption( dbType, parameter, value ); } } } if ( supportBooleanDataType != null ) { meta.setSupportsBooleanDataType( supportBooleanDataType.isChecked() ); } if ( supportTimestampDataType != null ) { meta.setSupportsTimestampDataType( supportTimestampDataType.isChecked() ); } if ( quoteIdentifiersCheck != null ) { meta.setQuoteAllFields( quoteIdentifiersCheck.isChecked() ); } if ( lowerCaseIdentifiersCheck != null ) { meta.setForcingIdentifiersToLowerCase( lowerCaseIdentifiersCheck.isChecked() ); } if ( upperCaseIdentifiersCheck != null ) { meta.setForcingIdentifiersToUpperCase( upperCaseIdentifiersCheck.isChecked() ); } if ( preserveReservedCaseCheck != null ) { meta.setPreserveReservedCase( preserveReservedCaseCheck.isChecked() ); } if ( strictBigNumberInterpretaion != null && meta.getDatabaseInterface() instanceof OracleDatabaseMeta ) { ( (OracleDatabaseMeta) meta.getDatabaseInterface() ) .setStrictBigNumberInterpretation( strictBigNumberInterpretaion.isChecked() ); } if ( preferredSchemaName != null ) { meta.setPreferredSchemaName( preferredSchemaName.getValue() ); } if ( sqlBox != null ) { meta.setConnectSQL( sqlBox.getValue() ); } if ( clusteringCheck != null ) { meta.setPartitioned( clusteringCheck.isChecked() ); } if ( ( clusterParameterTree != null ) && ( meta.isPartitioned() ) ) { Object[][] values = clusterParameterTree.getValues(); List<PartitionDatabaseMeta> pdms = new ArrayList<PartitionDatabaseMeta>(); for ( int i = 0; i < values.length; i++ ) { String partitionId = (String) values[i][0]; if ( ( partitionId == null ) || ( partitionId.trim().length() <= 0 ) ) { continue; } String hostname = (String) values[i][1]; String port = (String) values[i][2]; String dbName = (String) values[i][3]; String username = (String) values[i][4]; String password = (String) values[i][5]; PartitionDatabaseMeta pdm = new PartitionDatabaseMeta( partitionId, hostname, port, dbName ); pdm.setUsername( username ); pdm.setPassword( password ); pdms.add( pdm ); } PartitionDatabaseMeta[] pdmArray = new PartitionDatabaseMeta[pdms.size()]; meta.setPartitioningInformation( pdms.toArray( pdmArray ) ); } if ( poolingCheck != null ) { meta.setUsingConnectionPool( poolingCheck.isChecked() ); } if ( meta.isUsingConnectionPool() ) { if ( poolSizeBox != null ) { try { int initialPoolSize = Integer.parseInt( poolSizeBox.getValue() ); meta.setInitialPoolSize( initialPoolSize ); } catch ( NumberFormatException e ) { } } if ( maxPoolSizeBox != null ) { try { int maxPoolSize = Integer.parseInt( maxPoolSizeBox.getValue() ); meta.setMaximumPoolSize( maxPoolSize ); } catch ( NumberFormatException e ) { } } if ( poolParameterTree != null ) { Object[][] values = poolParameterTree.getValues(); Properties properties = new Properties(); for ( int i = 0; i < values.length; i++ ) { boolean isChecked = false; if ( values[i][0] instanceof Boolean ) { isChecked = ( (Boolean) values[i][0] ).booleanValue(); } else { isChecked = Boolean.valueOf( (String) values[i][0] ); } if ( !isChecked ) { continue; } String parameter = (String) values[i][1]; String value = (String) values[i][2]; if ( ( parameter != null ) && ( parameter.trim().length() > 0 ) && ( value != null ) && ( value.trim().length() > 0 ) ) { properties.setProperty( parameter, value ); } } meta.setConnectionPoolingProperties( properties ); } } } }
DataHandler extends AbstractXulEventHandler { protected void getInfo( DatabaseMeta meta ) { getControls(); if ( this.databaseMeta != null && this.databaseMeta != meta ) { meta.initializeVariablesFrom( this.databaseMeta ); } meta.setName( connectionNameBox.getValue() ); meta.setDisplayName( connectionNameBox.getValue() ); Object connection = connectionBox.getSelectedItem(); if ( connection != null ) { meta.setDatabaseType( (String) connection ); } Object access = accessBox.getSelectedItem(); if ( access != null ) { meta.setAccessType( DatabaseMeta.getAccessType( (String) access ) ); } getConnectionSpecificInfo( meta ); if ( portNumberBox != null ) { meta.setDBPort( portNumberBox.getValue() ); } if ( optionsParameterTree != null ) { Object[][] values = optionsParameterTree.getValues(); for ( int i = 0; i < values.length; i++ ) { String parameter = (String) values[i][0]; String value = (String) values[i][1]; if ( value == null ) { value = ""; } String dbType = meta.getPluginId(); if ( ( parameter != null ) && ( parameter.trim().length() > 0 ) ) { if ( value.trim().length() <= 0 ) { value = DatabaseMeta.EMPTY_OPTIONS_STRING; } meta.addExtraOption( dbType, parameter, value ); } } } if ( supportBooleanDataType != null ) { meta.setSupportsBooleanDataType( supportBooleanDataType.isChecked() ); } if ( supportTimestampDataType != null ) { meta.setSupportsTimestampDataType( supportTimestampDataType.isChecked() ); } if ( quoteIdentifiersCheck != null ) { meta.setQuoteAllFields( quoteIdentifiersCheck.isChecked() ); } if ( lowerCaseIdentifiersCheck != null ) { meta.setForcingIdentifiersToLowerCase( lowerCaseIdentifiersCheck.isChecked() ); } if ( upperCaseIdentifiersCheck != null ) { meta.setForcingIdentifiersToUpperCase( upperCaseIdentifiersCheck.isChecked() ); } if ( preserveReservedCaseCheck != null ) { meta.setPreserveReservedCase( preserveReservedCaseCheck.isChecked() ); } if ( strictBigNumberInterpretaion != null && meta.getDatabaseInterface() instanceof OracleDatabaseMeta ) { ( (OracleDatabaseMeta) meta.getDatabaseInterface() ) .setStrictBigNumberInterpretation( strictBigNumberInterpretaion.isChecked() ); } if ( preferredSchemaName != null ) { meta.setPreferredSchemaName( preferredSchemaName.getValue() ); } if ( sqlBox != null ) { meta.setConnectSQL( sqlBox.getValue() ); } if ( clusteringCheck != null ) { meta.setPartitioned( clusteringCheck.isChecked() ); } if ( ( clusterParameterTree != null ) && ( meta.isPartitioned() ) ) { Object[][] values = clusterParameterTree.getValues(); List<PartitionDatabaseMeta> pdms = new ArrayList<PartitionDatabaseMeta>(); for ( int i = 0; i < values.length; i++ ) { String partitionId = (String) values[i][0]; if ( ( partitionId == null ) || ( partitionId.trim().length() <= 0 ) ) { continue; } String hostname = (String) values[i][1]; String port = (String) values[i][2]; String dbName = (String) values[i][3]; String username = (String) values[i][4]; String password = (String) values[i][5]; PartitionDatabaseMeta pdm = new PartitionDatabaseMeta( partitionId, hostname, port, dbName ); pdm.setUsername( username ); pdm.setPassword( password ); pdms.add( pdm ); } PartitionDatabaseMeta[] pdmArray = new PartitionDatabaseMeta[pdms.size()]; meta.setPartitioningInformation( pdms.toArray( pdmArray ) ); } if ( poolingCheck != null ) { meta.setUsingConnectionPool( poolingCheck.isChecked() ); } if ( meta.isUsingConnectionPool() ) { if ( poolSizeBox != null ) { try { int initialPoolSize = Integer.parseInt( poolSizeBox.getValue() ); meta.setInitialPoolSize( initialPoolSize ); } catch ( NumberFormatException e ) { } } if ( maxPoolSizeBox != null ) { try { int maxPoolSize = Integer.parseInt( maxPoolSizeBox.getValue() ); meta.setMaximumPoolSize( maxPoolSize ); } catch ( NumberFormatException e ) { } } if ( poolParameterTree != null ) { Object[][] values = poolParameterTree.getValues(); Properties properties = new Properties(); for ( int i = 0; i < values.length; i++ ) { boolean isChecked = false; if ( values[i][0] instanceof Boolean ) { isChecked = ( (Boolean) values[i][0] ).booleanValue(); } else { isChecked = Boolean.valueOf( (String) values[i][0] ); } if ( !isChecked ) { continue; } String parameter = (String) values[i][1]; String value = (String) values[i][2]; if ( ( parameter != null ) && ( parameter.trim().length() > 0 ) && ( value != null ) && ( value.trim().length() > 0 ) ) { properties.setProperty( parameter, value ); } } meta.setConnectionPoolingProperties( properties ); } } } DataHandler(); }
DataHandler extends AbstractXulEventHandler { protected void getInfo( DatabaseMeta meta ) { getControls(); if ( this.databaseMeta != null && this.databaseMeta != meta ) { meta.initializeVariablesFrom( this.databaseMeta ); } meta.setName( connectionNameBox.getValue() ); meta.setDisplayName( connectionNameBox.getValue() ); Object connection = connectionBox.getSelectedItem(); if ( connection != null ) { meta.setDatabaseType( (String) connection ); } Object access = accessBox.getSelectedItem(); if ( access != null ) { meta.setAccessType( DatabaseMeta.getAccessType( (String) access ) ); } getConnectionSpecificInfo( meta ); if ( portNumberBox != null ) { meta.setDBPort( portNumberBox.getValue() ); } if ( optionsParameterTree != null ) { Object[][] values = optionsParameterTree.getValues(); for ( int i = 0; i < values.length; i++ ) { String parameter = (String) values[i][0]; String value = (String) values[i][1]; if ( value == null ) { value = ""; } String dbType = meta.getPluginId(); if ( ( parameter != null ) && ( parameter.trim().length() > 0 ) ) { if ( value.trim().length() <= 0 ) { value = DatabaseMeta.EMPTY_OPTIONS_STRING; } meta.addExtraOption( dbType, parameter, value ); } } } if ( supportBooleanDataType != null ) { meta.setSupportsBooleanDataType( supportBooleanDataType.isChecked() ); } if ( supportTimestampDataType != null ) { meta.setSupportsTimestampDataType( supportTimestampDataType.isChecked() ); } if ( quoteIdentifiersCheck != null ) { meta.setQuoteAllFields( quoteIdentifiersCheck.isChecked() ); } if ( lowerCaseIdentifiersCheck != null ) { meta.setForcingIdentifiersToLowerCase( lowerCaseIdentifiersCheck.isChecked() ); } if ( upperCaseIdentifiersCheck != null ) { meta.setForcingIdentifiersToUpperCase( upperCaseIdentifiersCheck.isChecked() ); } if ( preserveReservedCaseCheck != null ) { meta.setPreserveReservedCase( preserveReservedCaseCheck.isChecked() ); } if ( strictBigNumberInterpretaion != null && meta.getDatabaseInterface() instanceof OracleDatabaseMeta ) { ( (OracleDatabaseMeta) meta.getDatabaseInterface() ) .setStrictBigNumberInterpretation( strictBigNumberInterpretaion.isChecked() ); } if ( preferredSchemaName != null ) { meta.setPreferredSchemaName( preferredSchemaName.getValue() ); } if ( sqlBox != null ) { meta.setConnectSQL( sqlBox.getValue() ); } if ( clusteringCheck != null ) { meta.setPartitioned( clusteringCheck.isChecked() ); } if ( ( clusterParameterTree != null ) && ( meta.isPartitioned() ) ) { Object[][] values = clusterParameterTree.getValues(); List<PartitionDatabaseMeta> pdms = new ArrayList<PartitionDatabaseMeta>(); for ( int i = 0; i < values.length; i++ ) { String partitionId = (String) values[i][0]; if ( ( partitionId == null ) || ( partitionId.trim().length() <= 0 ) ) { continue; } String hostname = (String) values[i][1]; String port = (String) values[i][2]; String dbName = (String) values[i][3]; String username = (String) values[i][4]; String password = (String) values[i][5]; PartitionDatabaseMeta pdm = new PartitionDatabaseMeta( partitionId, hostname, port, dbName ); pdm.setUsername( username ); pdm.setPassword( password ); pdms.add( pdm ); } PartitionDatabaseMeta[] pdmArray = new PartitionDatabaseMeta[pdms.size()]; meta.setPartitioningInformation( pdms.toArray( pdmArray ) ); } if ( poolingCheck != null ) { meta.setUsingConnectionPool( poolingCheck.isChecked() ); } if ( meta.isUsingConnectionPool() ) { if ( poolSizeBox != null ) { try { int initialPoolSize = Integer.parseInt( poolSizeBox.getValue() ); meta.setInitialPoolSize( initialPoolSize ); } catch ( NumberFormatException e ) { } } if ( maxPoolSizeBox != null ) { try { int maxPoolSize = Integer.parseInt( maxPoolSizeBox.getValue() ); meta.setMaximumPoolSize( maxPoolSize ); } catch ( NumberFormatException e ) { } } if ( poolParameterTree != null ) { Object[][] values = poolParameterTree.getValues(); Properties properties = new Properties(); for ( int i = 0; i < values.length; i++ ) { boolean isChecked = false; if ( values[i][0] instanceof Boolean ) { isChecked = ( (Boolean) values[i][0] ).booleanValue(); } else { isChecked = Boolean.valueOf( (String) values[i][0] ); } if ( !isChecked ) { continue; } String parameter = (String) values[i][1]; String value = (String) values[i][2]; if ( ( parameter != null ) && ( parameter.trim().length() > 0 ) && ( value != null ) && ( value.trim().length() > 0 ) ) { properties.setProperty( parameter, value ); } } meta.setConnectionPoolingProperties( properties ); } } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); }
DataHandler extends AbstractXulEventHandler { protected void getInfo( DatabaseMeta meta ) { getControls(); if ( this.databaseMeta != null && this.databaseMeta != meta ) { meta.initializeVariablesFrom( this.databaseMeta ); } meta.setName( connectionNameBox.getValue() ); meta.setDisplayName( connectionNameBox.getValue() ); Object connection = connectionBox.getSelectedItem(); if ( connection != null ) { meta.setDatabaseType( (String) connection ); } Object access = accessBox.getSelectedItem(); if ( access != null ) { meta.setAccessType( DatabaseMeta.getAccessType( (String) access ) ); } getConnectionSpecificInfo( meta ); if ( portNumberBox != null ) { meta.setDBPort( portNumberBox.getValue() ); } if ( optionsParameterTree != null ) { Object[][] values = optionsParameterTree.getValues(); for ( int i = 0; i < values.length; i++ ) { String parameter = (String) values[i][0]; String value = (String) values[i][1]; if ( value == null ) { value = ""; } String dbType = meta.getPluginId(); if ( ( parameter != null ) && ( parameter.trim().length() > 0 ) ) { if ( value.trim().length() <= 0 ) { value = DatabaseMeta.EMPTY_OPTIONS_STRING; } meta.addExtraOption( dbType, parameter, value ); } } } if ( supportBooleanDataType != null ) { meta.setSupportsBooleanDataType( supportBooleanDataType.isChecked() ); } if ( supportTimestampDataType != null ) { meta.setSupportsTimestampDataType( supportTimestampDataType.isChecked() ); } if ( quoteIdentifiersCheck != null ) { meta.setQuoteAllFields( quoteIdentifiersCheck.isChecked() ); } if ( lowerCaseIdentifiersCheck != null ) { meta.setForcingIdentifiersToLowerCase( lowerCaseIdentifiersCheck.isChecked() ); } if ( upperCaseIdentifiersCheck != null ) { meta.setForcingIdentifiersToUpperCase( upperCaseIdentifiersCheck.isChecked() ); } if ( preserveReservedCaseCheck != null ) { meta.setPreserveReservedCase( preserveReservedCaseCheck.isChecked() ); } if ( strictBigNumberInterpretaion != null && meta.getDatabaseInterface() instanceof OracleDatabaseMeta ) { ( (OracleDatabaseMeta) meta.getDatabaseInterface() ) .setStrictBigNumberInterpretation( strictBigNumberInterpretaion.isChecked() ); } if ( preferredSchemaName != null ) { meta.setPreferredSchemaName( preferredSchemaName.getValue() ); } if ( sqlBox != null ) { meta.setConnectSQL( sqlBox.getValue() ); } if ( clusteringCheck != null ) { meta.setPartitioned( clusteringCheck.isChecked() ); } if ( ( clusterParameterTree != null ) && ( meta.isPartitioned() ) ) { Object[][] values = clusterParameterTree.getValues(); List<PartitionDatabaseMeta> pdms = new ArrayList<PartitionDatabaseMeta>(); for ( int i = 0; i < values.length; i++ ) { String partitionId = (String) values[i][0]; if ( ( partitionId == null ) || ( partitionId.trim().length() <= 0 ) ) { continue; } String hostname = (String) values[i][1]; String port = (String) values[i][2]; String dbName = (String) values[i][3]; String username = (String) values[i][4]; String password = (String) values[i][5]; PartitionDatabaseMeta pdm = new PartitionDatabaseMeta( partitionId, hostname, port, dbName ); pdm.setUsername( username ); pdm.setPassword( password ); pdms.add( pdm ); } PartitionDatabaseMeta[] pdmArray = new PartitionDatabaseMeta[pdms.size()]; meta.setPartitioningInformation( pdms.toArray( pdmArray ) ); } if ( poolingCheck != null ) { meta.setUsingConnectionPool( poolingCheck.isChecked() ); } if ( meta.isUsingConnectionPool() ) { if ( poolSizeBox != null ) { try { int initialPoolSize = Integer.parseInt( poolSizeBox.getValue() ); meta.setInitialPoolSize( initialPoolSize ); } catch ( NumberFormatException e ) { } } if ( maxPoolSizeBox != null ) { try { int maxPoolSize = Integer.parseInt( maxPoolSizeBox.getValue() ); meta.setMaximumPoolSize( maxPoolSize ); } catch ( NumberFormatException e ) { } } if ( poolParameterTree != null ) { Object[][] values = poolParameterTree.getValues(); Properties properties = new Properties(); for ( int i = 0; i < values.length; i++ ) { boolean isChecked = false; if ( values[i][0] instanceof Boolean ) { isChecked = ( (Boolean) values[i][0] ).booleanValue(); } else { isChecked = Boolean.valueOf( (String) values[i][0] ); } if ( !isChecked ) { continue; } String parameter = (String) values[i][1]; String value = (String) values[i][2]; if ( ( parameter != null ) && ( parameter.trim().length() > 0 ) && ( value != null ) && ( value.trim().length() > 0 ) ) { properties.setProperty( parameter, value ); } } meta.setConnectionPoolingProperties( properties ); } } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); static final SortedMap<String, DatabaseInterface> connectionMap; static final Map<String, String> connectionNametoID; }
@Test public void testInitSetGetFirstForMBOXIgnored() { MailInput step = new MailInput( mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans ); MailInputData data = new MailInputData(); MailInputMeta meta = mock( MailInputMeta.class ); when( meta.isDynamicFolder() ).thenReturn( false ); when( meta.getProtocol() ).thenReturn( MailConnectionMeta.PROTOCOL_STRING_MBOX ); when( meta.getFirstIMAPMails() ).thenReturn( "2" ); when( meta.getFirstMails() ).thenReturn( "3" ); step.init( meta, data ); Assert.assertEquals( "Row Limit is set up to 0 rows as the Limit has priority.", 0, data.rowlimit ); }
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; }
MailInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; } }
MailInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; } MailInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
MailInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; } MailInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); String[] getFolders( String realIMAPFolder ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
MailInput extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (MailInputMeta) smi; data = (MailInputData) sdi; if ( !super.init( smi, sdi ) ) { return false; } if ( !meta.isDynamicFolder() ) { try { data.outputRowMeta = new RowMeta(); meta.getFields( data.outputRowMeta, getStepname(), null, null, this, repository, metaStore ); } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.ErrorInit", e.toString() ) ); logError( Const.getStackTracker( e ) ); return false; } } data.usePOP = meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_POP3 ); String realserver = environmentSubstitute( meta.getServerName() ); if ( meta.getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_MBOX ) && StringUtils.startsWith( realserver, "file: realserver = StringUtils.remove( realserver, "file: } String realusername = environmentSubstitute( meta.getUserName() ); String realpassword = Utils.resolvePassword( variables, meta.getPassword() ); int realport = Const.toInt( environmentSubstitute( meta.getPort() ), -1 ); String realProxyUsername = environmentSubstitute( meta.getProxyUsername() ); if ( !meta.isDynamicFolder() ) { String reallimitrow = environmentSubstitute( meta.getRowLimit() ); int limit = Const.toInt( reallimitrow, 0 ); if ( limit == 0 ) { limit = getReadFirst( meta.getProtocol() ); } data.rowlimit = limit; } Date beginDate = null; Date endDate = null; SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN ); try { switch ( meta.getConditionOnReceivedDate() ) { case MailConnectionMeta.CONDITION_DATE_EQUAL: case MailConnectionMeta.CONDITION_DATE_GREATER: case MailConnectionMeta.CONDITION_DATE_SMALLER: String realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDateSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); break; case MailConnectionMeta.CONDITION_DATE_BETWEEN: realBeginDate = environmentSubstitute( meta.getReceivedDate1() ); if ( Utils.isEmpty( realBeginDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } beginDate = df.parse( realBeginDate ); String realEndDate = environmentSubstitute( meta.getReceivedDate2() ); if ( Utils.isEmpty( realEndDate ) ) { throw new KettleException( BaseMessages.getString( PKG, "MailInput.Error.ReceivedDatesSearchTermEmpty" ) ); } endDate = df.parse( realEndDate ); break; default: break; } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.SettingSearchTerms", e.getMessage() ) ); setErrors( 1 ); stopAll(); } try { data.mailConn = new MailConnection( log, MailConnectionMeta.getProtocolFromString( meta.getProtocol(), MailConnectionMeta.PROTOCOL_IMAP ), realserver, realport, realusername, realpassword, meta.isUseSSL(), meta.isUseProxy(), realProxyUsername ); data.mailConn.connect(); applySearch( beginDate, endDate ); if ( !meta.isDynamicFolder() ) { String realIMAPFolder = environmentSubstitute( meta.getIMAPFolder() ); data.folders = getFolders( realIMAPFolder ); } } catch ( Exception e ) { logError( BaseMessages.getString( PKG, "MailInput.Error.OpeningConnection", e.getMessage() ) ); setErrors( 1 ); stopAll(); } data.nrFields = meta.getInputFields() != null ? meta.getInputFields().length : 0; return true; } MailInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); String[] getFolders( String realIMAPFolder ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void testClone() throws KettleException { AccessInputMeta meta = new AccessInputMeta(); meta.allocate( 3, 2 ); meta.setFileName( new String[] { "file1", "file2", "file3" } ); meta.setFileMask( new String[] { "mask1", "mask2", "mask3" } ); meta.setExcludeFileMask( new String[] { "exmask1", "exmask2", "exmask3" } ); meta.setFileRequired( new String[] { "false", "true", "false" } ); meta.setIncludeSubFolders( new String[] { "true", "false", "true" } ); AccessInputField f1 = new AccessInputField( "field1" ); AccessInputField f2 = new AccessInputField( "field2" ); meta.setInputFields( new AccessInputField[] { f1, f2 } ); meta.setFilenameField( "aFileNameField" ); AccessInputMeta aClone = (AccessInputMeta) meta.clone(); assertFalse( aClone == meta ); assertTrue( Arrays.equals( aClone.getFileName(), meta.getFileName() ) ); assertTrue( Arrays.equals( aClone.getFileMask(), meta.getFileMask() ) ); assertTrue( Arrays.equals( aClone.getExcludeFileMask(), meta.getExcludeFileMask() ) ); assertTrue( Arrays.equals( aClone.getFileRequired(), meta.getFileRequired() ) ); assertTrue( Arrays.equals( aClone.getIncludeSubFolders(), meta.getIncludeSubFolders() ) ); AccessInputField[] clFields = aClone.getInputFields(); assertEquals( f1.getName(), clFields[0].getName() ); assertEquals( f2.getName(), clFields[1].getName() ); assertEquals( meta.getFilenameField(), aClone.getFilenameField() ); assertEquals( meta.getXML(), aClone.getXML() ); }
@Override public Object clone() { AccessInputMeta retval = (AccessInputMeta) super.clone(); int nrFiles = fileName.length; int nrFields = inputFields.length; retval.allocate( nrFiles, nrFields ); System.arraycopy( fileName, 0, retval.fileName, 0, nrFiles ); System.arraycopy( fileMask, 0, retval.fileMask, 0, nrFiles ); System.arraycopy( excludeFileMask, 0, retval.excludeFileMask, 0, nrFiles ); System.arraycopy( fileRequired, 0, retval.fileRequired, 0, nrFiles ); System.arraycopy( includeSubFolders, 0, retval.includeSubFolders, 0, nrFiles ); for ( int i = 0; i < nrFields; i++ ) { if ( inputFields[i] != null ) { retval.inputFields[i] = (AccessInputField) inputFields[i].clone(); } } return retval; }
AccessInputMeta extends BaseStepMeta implements StepMetaInterface { @Override public Object clone() { AccessInputMeta retval = (AccessInputMeta) super.clone(); int nrFiles = fileName.length; int nrFields = inputFields.length; retval.allocate( nrFiles, nrFields ); System.arraycopy( fileName, 0, retval.fileName, 0, nrFiles ); System.arraycopy( fileMask, 0, retval.fileMask, 0, nrFiles ); System.arraycopy( excludeFileMask, 0, retval.excludeFileMask, 0, nrFiles ); System.arraycopy( fileRequired, 0, retval.fileRequired, 0, nrFiles ); System.arraycopy( includeSubFolders, 0, retval.includeSubFolders, 0, nrFiles ); for ( int i = 0; i < nrFields; i++ ) { if ( inputFields[i] != null ) { retval.inputFields[i] = (AccessInputField) inputFields[i].clone(); } } return retval; } }
AccessInputMeta extends BaseStepMeta implements StepMetaInterface { @Override public Object clone() { AccessInputMeta retval = (AccessInputMeta) super.clone(); int nrFiles = fileName.length; int nrFields = inputFields.length; retval.allocate( nrFiles, nrFields ); System.arraycopy( fileName, 0, retval.fileName, 0, nrFiles ); System.arraycopy( fileMask, 0, retval.fileMask, 0, nrFiles ); System.arraycopy( excludeFileMask, 0, retval.excludeFileMask, 0, nrFiles ); System.arraycopy( fileRequired, 0, retval.fileRequired, 0, nrFiles ); System.arraycopy( includeSubFolders, 0, retval.includeSubFolders, 0, nrFiles ); for ( int i = 0; i < nrFields; i++ ) { if ( inputFields[i] != null ) { retval.inputFields[i] = (AccessInputField) inputFields[i].clone(); } } return retval; } AccessInputMeta(); }
AccessInputMeta extends BaseStepMeta implements StepMetaInterface { @Override public Object clone() { AccessInputMeta retval = (AccessInputMeta) super.clone(); int nrFiles = fileName.length; int nrFields = inputFields.length; retval.allocate( nrFiles, nrFields ); System.arraycopy( fileName, 0, retval.fileName, 0, nrFiles ); System.arraycopy( fileMask, 0, retval.fileMask, 0, nrFiles ); System.arraycopy( excludeFileMask, 0, retval.excludeFileMask, 0, nrFiles ); System.arraycopy( fileRequired, 0, retval.fileRequired, 0, nrFiles ); System.arraycopy( includeSubFolders, 0, retval.includeSubFolders, 0, nrFiles ); for ( int i = 0; i < nrFields; i++ ) { if ( inputFields[i] != null ) { retval.inputFields[i] = (AccessInputField) inputFields[i].clone(); } } return retval; } AccessInputMeta(); String getExtensionField(); void setExtensionField( String field ); String getSizeField(); void setSizeField( String field ); String getShortFileNameField(); void setShortFileNameField( String field ); String getPathField(); void setPathField( String field ); String isHiddenField(); @Deprecated void setIsHiddenField( String field ); void setHiddenField( String field ); String getLastModificationDateField(); void setLastModificationDateField( String field ); String getUriField(); void setUriField( String field ); String getRootUriField(); void setRootUriField( String field ); AccessInputField[] getInputFields(); void setInputFields( AccessInputField[] inputFields ); String[] getExludeFileMask(); String[] getExcludeFileMask(); void setExcludeFileMask( String[] excludeFileMask ); String[] getFileMask(); String[] getFileRequired(); String getRequiredFilesDesc( String tt ); void setFileMask( String[] fileMask ); void setFileRequired( String[] fileRequiredin ); String getRequiredFilesCode( String tt ); String[] getIncludeSubFolders(); void setIncludeSubFolders( String[] includeSubFoldersin ); String[] getFileName(); void setFileName( String[] fileName ); String getFilenameField(); String getDynamicFilenameField(); void setDynamicFilenameField( String dynamicFilenameField ); void setFilenameField( String filenameField ); @Deprecated boolean includeFilename(); boolean isIncludeFilename(); @Deprecated boolean includeTablename(); boolean isIncludeTablename(); void setIncludeFilename( boolean includeFilename ); void setIncludeTablename( boolean includeTablename ); @Deprecated boolean includeRowNumber(); boolean isIncludeRowNumber(); boolean isFileField(); void setFileField( boolean filefield ); @Deprecated boolean resetRowNumber(); boolean isResetRowNumber(); void setIncludeRowNumber( boolean includeRowNumber ); void setAddResultFile( boolean isaddresult ); boolean isAddResultFile(); void setResetRowNumber( boolean resetRowNumber ); long getRowLimit(); void setRowLimit( long rowLimit ); String getRowNumberField(); @Deprecated String gettablenameField(); String getTablenameField(); String getTableName(); void setRowNumberField( String rowNumberField ); void setTablenameField( String tablenameField ); void setTableName( String TableName ); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); @Override Object clone(); @Override String getXML(); void allocate( int nrfiles, int nrfields ); void allocateFiles( int nrfiles ); void allocateFields( int nrfields ); @Override void setDefault(); @Override void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); static final int getTrimTypeByCode( String tt ); @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 ); FileInputList getFiles( VariableSpace space ); @Override void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); static String getFilename( FileObject fileObject ); @Override StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta tr, Trans trans ); @Override StepDataInterface getStepData(); @Override boolean supportsErrorHandling(); String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); static ValueMetaInterface getValueMeta( Column c ); static ValueMetaAndData getValueMetaAndData( Column c, String name, Object data ); @Override StepMetaInjectionInterface getStepMetaInjectionInterface(); }
AccessInputMeta extends BaseStepMeta implements StepMetaInterface { @Override public Object clone() { AccessInputMeta retval = (AccessInputMeta) super.clone(); int nrFiles = fileName.length; int nrFields = inputFields.length; retval.allocate( nrFiles, nrFields ); System.arraycopy( fileName, 0, retval.fileName, 0, nrFiles ); System.arraycopy( fileMask, 0, retval.fileMask, 0, nrFiles ); System.arraycopy( excludeFileMask, 0, retval.excludeFileMask, 0, nrFiles ); System.arraycopy( fileRequired, 0, retval.fileRequired, 0, nrFiles ); System.arraycopy( includeSubFolders, 0, retval.includeSubFolders, 0, nrFiles ); for ( int i = 0; i < nrFields; i++ ) { if ( inputFields[i] != null ) { retval.inputFields[i] = (AccessInputField) inputFields[i].clone(); } } return retval; } AccessInputMeta(); String getExtensionField(); void setExtensionField( String field ); String getSizeField(); void setSizeField( String field ); String getShortFileNameField(); void setShortFileNameField( String field ); String getPathField(); void setPathField( String field ); String isHiddenField(); @Deprecated void setIsHiddenField( String field ); void setHiddenField( String field ); String getLastModificationDateField(); void setLastModificationDateField( String field ); String getUriField(); void setUriField( String field ); String getRootUriField(); void setRootUriField( String field ); AccessInputField[] getInputFields(); void setInputFields( AccessInputField[] inputFields ); String[] getExludeFileMask(); String[] getExcludeFileMask(); void setExcludeFileMask( String[] excludeFileMask ); String[] getFileMask(); String[] getFileRequired(); String getRequiredFilesDesc( String tt ); void setFileMask( String[] fileMask ); void setFileRequired( String[] fileRequiredin ); String getRequiredFilesCode( String tt ); String[] getIncludeSubFolders(); void setIncludeSubFolders( String[] includeSubFoldersin ); String[] getFileName(); void setFileName( String[] fileName ); String getFilenameField(); String getDynamicFilenameField(); void setDynamicFilenameField( String dynamicFilenameField ); void setFilenameField( String filenameField ); @Deprecated boolean includeFilename(); boolean isIncludeFilename(); @Deprecated boolean includeTablename(); boolean isIncludeTablename(); void setIncludeFilename( boolean includeFilename ); void setIncludeTablename( boolean includeTablename ); @Deprecated boolean includeRowNumber(); boolean isIncludeRowNumber(); boolean isFileField(); void setFileField( boolean filefield ); @Deprecated boolean resetRowNumber(); boolean isResetRowNumber(); void setIncludeRowNumber( boolean includeRowNumber ); void setAddResultFile( boolean isaddresult ); boolean isAddResultFile(); void setResetRowNumber( boolean resetRowNumber ); long getRowLimit(); void setRowLimit( long rowLimit ); String getRowNumberField(); @Deprecated String gettablenameField(); String getTablenameField(); String getTableName(); void setRowNumberField( String rowNumberField ); void setTablenameField( String tablenameField ); void setTableName( String TableName ); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); @Override Object clone(); @Override String getXML(); void allocate( int nrfiles, int nrfields ); void allocateFiles( int nrfiles ); void allocateFields( int nrfields ); @Override void setDefault(); @Override void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); static final int getTrimTypeByCode( String tt ); @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 ); FileInputList getFiles( VariableSpace space ); @Override void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); static String getFilename( FileObject fileObject ); @Override StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta tr, Trans trans ); @Override StepDataInterface getStepData(); @Override boolean supportsErrorHandling(); String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ); static ValueMetaInterface getValueMeta( Column c ); static ValueMetaAndData getValueMetaAndData( Column c, String name, Object data ); @Override StepMetaInjectionInterface getStepMetaInjectionInterface(); static final String[] RequiredFilesDesc; static final String[] RequiredFilesCode; static final String[] type_trim_code; static final String PREFIX_SYSTEM; }
@Test public void testInit() { StepMetaInterface stepMetaInterface = new AbstractStepMeta() { @Override public void setDefault() { } @Override public StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ) { return null; } }; StepMeta stepMeta = new StepMeta(); stepMeta.setName( "TestMetaStep" ); StepDataInterface stepDataInterface = mock( StepDataInterface.class ); Trans trans = new Trans(); LogChannel log = mock( LogChannel.class ); doAnswer( new Answer<Void>() { public Void answer( InvocationOnMock invocation ) { return null; } } ).when( log ).logError( anyString() ); trans.setLog( log ); TransMeta transMeta = new TransMeta(); transMeta.addStep( stepMeta ); MissingTransStep step = createAndInitStep( stepMetaInterface, stepDataInterface ); assertFalse( step.init( stepMetaInterface, stepDataInterface ) ); }
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { if ( super.init( smi, sdi ) ) { logError( BaseMessages.getString( PKG, "MissingTransStep.Log.CannotRunTrans" ) ); } return false; }
MissingTransStep extends DummyTrans { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { if ( super.init( smi, sdi ) ) { logError( BaseMessages.getString( PKG, "MissingTransStep.Log.CannotRunTrans" ) ); } return false; } }
MissingTransStep extends DummyTrans { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { if ( super.init( smi, sdi ) ) { logError( BaseMessages.getString( PKG, "MissingTransStep.Log.CannotRunTrans" ) ); } return false; } MissingTransStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
MissingTransStep extends DummyTrans { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { if ( super.init( smi, sdi ) ) { logError( BaseMessages.getString( PKG, "MissingTransStep.Log.CannotRunTrans" ) ); } return false; } MissingTransStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); }
MissingTransStep extends DummyTrans { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { if ( super.init( smi, sdi ) ) { logError( BaseMessages.getString( PKG, "MissingTransStep.Log.CannotRunTrans" ) ); } return false; } MissingTransStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void testGetLineDOS() throws KettleFileException, UnsupportedEncodingException { String input = "col1\tcol2\tcol3\r\ndata1\tdata2\tdata3\r\n"; String expected = "col1\tcol2\tcol3"; String output = TextFileInput.getLine( null, getInputStreamReader( input ), TextFileInputMeta.FILE_FORMAT_DOS, new StringBuilder( 1000 ) ); assertEquals( expected, output ); }
public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
@Test public void testGetLineUnix() throws KettleFileException, UnsupportedEncodingException { String input = "col1\tcol2\tcol3\ndata1\tdata2\tdata3\n"; String expected = "col1\tcol2\tcol3"; String output = TextFileInput.getLine( null, getInputStreamReader( input ), TextFileInputMeta.FILE_FORMAT_UNIX, new StringBuilder( 1000 ) ); assertEquals( expected, output ); }
public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
@Test public void testGetLineOSX() throws KettleFileException, UnsupportedEncodingException { String input = "col1\tcol2\tcol3\rdata1\tdata2\tdata3\r"; String expected = "col1\tcol2\tcol3"; String output = TextFileInput.getLine( null, getInputStreamReader( input ), TextFileInputMeta.FILE_FORMAT_UNIX, new StringBuilder( 1000 ) ); assertEquals( expected, output ); }
public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
@Test public void testGetLineMixed() throws KettleFileException, UnsupportedEncodingException { String input = "col1\tcol2\tcol3\r\ndata1\tdata2\tdata3\r"; String expected = "col1\tcol2\tcol3"; String output = TextFileInput.getLine( null, getInputStreamReader( input ), TextFileInputMeta.FILE_FORMAT_MIXED, new StringBuilder( 1000 ) ); assertEquals( expected, output ); }
public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
@Test( timeout = 100 ) public void test_PDI695() throws KettleFileException, UnsupportedEncodingException { String inputDOS = "col1\tcol2\tcol3\r\ndata1\tdata2\tdata3\r\n"; String inputUnix = "col1\tcol2\tcol3\ndata1\tdata2\tdata3\n"; String inputOSX = "col1\tcol2\tcol3\rdata1\tdata2\tdata3\r"; String expected = "col1\tcol2\tcol3"; assertEquals( expected, TextFileInput.getLine( null, getInputStreamReader( inputDOS ), TextFileInputMeta.FILE_FORMAT_UNIX, new StringBuilder( 1000 ) ) ); assertEquals( expected, TextFileInput.getLine( null, getInputStreamReader( inputUnix ), TextFileInputMeta.FILE_FORMAT_UNIX, new StringBuilder( 1000 ) ) ); assertEquals( expected, TextFileInput.getLine( null, getInputStreamReader( inputOSX ), TextFileInputMeta.FILE_FORMAT_UNIX, new StringBuilder( 1000 ) ) ); }
public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
TextFileInput extends BaseStep implements StepInterface { public static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ) throws KettleFileException { EncodingType type = EncodingType.guessEncodingType( reader.getEncoding() ); return getLine( log, reader, type, formatNr, line ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
@Test public void readWrappedInputWithoutHeaders() throws Exception { final String content = new StringBuilder() .append( "r1c1" ).append( '\n' ).append( ";r1c2\n" ) .append( "r2c1" ).append( '\n' ).append( ";r2c2" ) .toString(); final String virtualFile = createVirtualFile( "pdi-2607.txt", content ); TextFileInputMeta meta = new TextFileInputMeta(); meta.setLineWrapped( true ); meta.setNrWraps( 1 ); meta.setInputFields( new TextFileInputField[] { field( "col1" ), field( "col2" ) } ); meta.setFileCompression( "None" ); meta.setFileType( "CSV" ); meta.setHeader( false ); meta.setNrHeaderLines( -1 ); meta.setFooter( false ); meta.setNrFooterLines( -1 ); TextFileInputData data = new TextFileInputData(); data.setFiles( new FileInputList() ); data.getFiles().addFile( KettleVFS.getFileObject( virtualFile ) ); data.outputRowMeta = new RowMeta(); data.outputRowMeta.addValueMeta( new ValueMetaString( "col1" ) ); data.outputRowMeta.addValueMeta( new ValueMetaString( "col2" ) ); data.dataErrorLineHandler = Mockito.mock( FileErrorHandler.class ); data.fileFormatType = TextFileInputMeta.FILE_FORMAT_UNIX; data.separator = ";"; data.filterProcessor = new TextFileFilterProcessor( new TextFileFilter[ 0 ] ); data.filePlayList = new FilePlayListAll(); TextFileInput input = StepMockUtil.getStep( TextFileInput.class, TextFileInputMeta.class, "test" ); List<Object[]> output = TransTestingUtil.execute( input, meta, data, 2, false ); TransTestingUtil.assertResult( new Object[] { "r1c1", "r1c2" }, output.get( 0 ) ); TransTestingUtil.assertResult( new Object[] { "r2c1", "r2c2" }, output.get( 1 ) ); deleteVfsFile( virtualFile ); }
private int addValueMeta( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.addValueMeta( valueMeta ); } else { index = rowMeta.indexOfValue( fieldName ); } return index; }
TextFileInput extends BaseStep implements StepInterface { private int addValueMeta( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.addValueMeta( valueMeta ); } else { index = rowMeta.indexOfValue( fieldName ); } return index; } }
TextFileInput extends BaseStep implements StepInterface { private int addValueMeta( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.addValueMeta( valueMeta ); } else { index = rowMeta.indexOfValue( fieldName ); } return index; } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
TextFileInput extends BaseStep implements StepInterface { private int addValueMeta( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.addValueMeta( valueMeta ); } else { index = rowMeta.indexOfValue( fieldName ); } return index; } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
TextFileInput extends BaseStep implements StepInterface { private int addValueMeta( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.addValueMeta( valueMeta ); } else { index = rowMeta.indexOfValue( fieldName ); } return index; } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
@Test public void readInputWithMissedValues() throws Exception { final String virtualFile = createVirtualFile( "pdi-14172.txt", "1,1,1\n", "2,,2\n" ); TextFileInputMeta meta = new TextFileInputMeta(); TextFileInputField field2 = field( "col2" ); field2.setRepeated( true ); meta.setInputFields( new TextFileInputField[] { field( "col1" ), field2, field( "col3" ) } ); meta.setFileCompression( "None" ); meta.setFileType( "CSV" ); meta.setHeader( false ); meta.setNrHeaderLines( -1 ); meta.setFooter( false ); meta.setNrFooterLines( -1 ); TextFileInputData data = new TextFileInputData(); data.setFiles( new FileInputList() ); data.getFiles().addFile( KettleVFS.getFileObject( virtualFile ) ); data.outputRowMeta = new RowMeta(); data.outputRowMeta.addValueMeta( new ValueMetaString( "col1" ) ); data.outputRowMeta.addValueMeta( new ValueMetaString( "col2" ) ); data.outputRowMeta.addValueMeta( new ValueMetaString( "col3" ) ); data.dataErrorLineHandler = Mockito.mock( FileErrorHandler.class ); data.fileFormatType = TextFileInputMeta.FILE_FORMAT_UNIX; data.separator = ","; data.filterProcessor = new TextFileFilterProcessor( new TextFileFilter[ 0 ] ); data.filePlayList = new FilePlayListAll(); TextFileInput input = StepMockUtil.getStep( TextFileInput.class, TextFileInputMeta.class, "test" ); List<Object[]> output = TransTestingUtil.execute( input, meta, data, 2, false ); TransTestingUtil.assertResult( new Object[] { "1", "1", "1" }, output.get( 0 ) ); TransTestingUtil.assertResult( new Object[] { "2", "1", "2" }, output.get( 1 ) ); deleteVfsFile( virtualFile ); }
private int addValueMeta( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.addValueMeta( valueMeta ); } else { index = rowMeta.indexOfValue( fieldName ); } return index; }
TextFileInput extends BaseStep implements StepInterface { private int addValueMeta( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.addValueMeta( valueMeta ); } else { index = rowMeta.indexOfValue( fieldName ); } return index; } }
TextFileInput extends BaseStep implements StepInterface { private int addValueMeta( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.addValueMeta( valueMeta ); } else { index = rowMeta.indexOfValue( fieldName ); } return index; } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
TextFileInput extends BaseStep implements StepInterface { private int addValueMeta( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.addValueMeta( valueMeta ); } else { index = rowMeta.indexOfValue( fieldName ); } return index; } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
TextFileInput extends BaseStep implements StepInterface { private int addValueMeta( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.addValueMeta( valueMeta ); } else { index = rowMeta.indexOfValue( fieldName ); } return index; } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
@Test public void testRestoreDefaults() throws Exception { }
public void restoreDefaults() { if ( poolParameterTree != null ) { for ( int i = 0; i < poolParameterTree.getRootChildren().getItemCount(); i++ ) { XulTreeItem item = poolParameterTree.getRootChildren().getItem( i ); String parameterName = item.getRow().getCell( 1 ).getLabel(); String defaultValue = DatabaseConnectionPoolParameter .findParameter( parameterName, BaseDatabaseMeta.poolingParameters ).getDefaultValue(); if ( ( defaultValue == null ) || ( defaultValue.trim().length() <= 0 ) ) { continue; } item.getRow().addCellText( 2, defaultValue ); } } }
DataHandler extends AbstractXulEventHandler { public void restoreDefaults() { if ( poolParameterTree != null ) { for ( int i = 0; i < poolParameterTree.getRootChildren().getItemCount(); i++ ) { XulTreeItem item = poolParameterTree.getRootChildren().getItem( i ); String parameterName = item.getRow().getCell( 1 ).getLabel(); String defaultValue = DatabaseConnectionPoolParameter .findParameter( parameterName, BaseDatabaseMeta.poolingParameters ).getDefaultValue(); if ( ( defaultValue == null ) || ( defaultValue.trim().length() <= 0 ) ) { continue; } item.getRow().addCellText( 2, defaultValue ); } } } }
DataHandler extends AbstractXulEventHandler { public void restoreDefaults() { if ( poolParameterTree != null ) { for ( int i = 0; i < poolParameterTree.getRootChildren().getItemCount(); i++ ) { XulTreeItem item = poolParameterTree.getRootChildren().getItem( i ); String parameterName = item.getRow().getCell( 1 ).getLabel(); String defaultValue = DatabaseConnectionPoolParameter .findParameter( parameterName, BaseDatabaseMeta.poolingParameters ).getDefaultValue(); if ( ( defaultValue == null ) || ( defaultValue.trim().length() <= 0 ) ) { continue; } item.getRow().addCellText( 2, defaultValue ); } } } DataHandler(); }
DataHandler extends AbstractXulEventHandler { public void restoreDefaults() { if ( poolParameterTree != null ) { for ( int i = 0; i < poolParameterTree.getRootChildren().getItemCount(); i++ ) { XulTreeItem item = poolParameterTree.getRootChildren().getItem( i ); String parameterName = item.getRow().getCell( 1 ).getLabel(); String defaultValue = DatabaseConnectionPoolParameter .findParameter( parameterName, BaseDatabaseMeta.poolingParameters ).getDefaultValue(); if ( ( defaultValue == null ) || ( defaultValue.trim().length() <= 0 ) ) { continue; } item.getRow().addCellText( 2, defaultValue ); } } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); }
DataHandler extends AbstractXulEventHandler { public void restoreDefaults() { if ( poolParameterTree != null ) { for ( int i = 0; i < poolParameterTree.getRootChildren().getItemCount(); i++ ) { XulTreeItem item = poolParameterTree.getRootChildren().getItem( i ); String parameterName = item.getRow().getCell( 1 ).getLabel(); String defaultValue = DatabaseConnectionPoolParameter .findParameter( parameterName, BaseDatabaseMeta.poolingParameters ).getDefaultValue(); if ( ( defaultValue == null ) || ( defaultValue.trim().length() <= 0 ) ) { continue; } item.getRow().addCellText( 2, defaultValue ); } } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); static final SortedMap<String, DatabaseInterface> connectionMap; static final Map<String, String> connectionNametoID; }
@Test public void readInputWithDefaultValues() throws Exception { final String virtualFile = createVirtualFile( "pdi-14832.txt", "1,\n" ); TextFileInputMeta meta = new TextFileInputMeta(); TextFileInputField field2 = field( "col2" ); field2.setIfNullValue( "DEFAULT" ); meta.setInputFields( new TextFileInputField[] { field( "col1" ), field2 } ); meta.setFileCompression( "None" ); meta.setFileType( "CSV" ); meta.setHeader( false ); meta.setNrHeaderLines( -1 ); meta.setFooter( false ); meta.setNrFooterLines( -1 ); TextFileInputData data = new TextFileInputData(); data.setFiles( new FileInputList() ); data.getFiles().addFile( KettleVFS.getFileObject( virtualFile ) ); data.outputRowMeta = new RowMeta(); data.outputRowMeta.addValueMeta( new ValueMetaString( "col1" ) ); data.outputRowMeta.addValueMeta( new ValueMetaString( "col2" ) ); data.dataErrorLineHandler = Mockito.mock( FileErrorHandler.class ); data.fileFormatType = TextFileInputMeta.FILE_FORMAT_UNIX; data.separator = ","; data.filterProcessor = new TextFileFilterProcessor( new TextFileFilter[ 0 ] ); data.filePlayList = new FilePlayListAll(); TextFileInput input = StepMockUtil.getStep( TextFileInput.class, TextFileInputMeta.class, "test" ); List<Object[]> output = TransTestingUtil.execute( input, meta, data, 1, false ); TransTestingUtil.assertResult( new Object[] { "1", "DEFAULT" }, output.get( 0 ) ); deleteVfsFile( virtualFile ); }
private int addValueMeta( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.addValueMeta( valueMeta ); } else { index = rowMeta.indexOfValue( fieldName ); } return index; }
TextFileInput extends BaseStep implements StepInterface { private int addValueMeta( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.addValueMeta( valueMeta ); } else { index = rowMeta.indexOfValue( fieldName ); } return index; } }
TextFileInput extends BaseStep implements StepInterface { private int addValueMeta( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.addValueMeta( valueMeta ); } else { index = rowMeta.indexOfValue( fieldName ); } return index; } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
TextFileInput extends BaseStep implements StepInterface { private int addValueMeta( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.addValueMeta( valueMeta ); } else { index = rowMeta.indexOfValue( fieldName ); } return index; } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
TextFileInput extends BaseStep implements StepInterface { private int addValueMeta( RowMetaInterface rowMeta, String fieldName ) { ValueMetaInterface valueMeta = new ValueMetaString( fieldName ); valueMeta.setOrigin( getStepname() ); int index = -1; if ( !rowMeta.exists( valueMeta ) ) { index = rowMeta.size(); rowMeta.addValueMeta( valueMeta ); } else { index = rowMeta.indexOfValue( fieldName ); } return index; } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
@Test public void convertLineToRowTest() throws Exception { LogChannelInterface log = Mockito.mock( LogChannelInterface.class ); TextFileLine textFileLine = Mockito.mock( TextFileLine.class ); textFileLine.line = "testData1;testData2;testData3"; InputFileMetaInterface info = Mockito.mock( InputFileMetaInterface.class ); TextFileInputField[] textFileInputFields = { new TextFileInputField(), new TextFileInputField(), new TextFileInputField() }; Mockito.doReturn( textFileInputFields ).when( info ).getInputFields(); Mockito.doReturn( "CSV" ).when( info ).getFileType(); Mockito.doReturn( "/" ).when( info ).getEscapeCharacter(); Mockito.doReturn( true ).when( info ).isErrorIgnored(); Mockito.doReturn( true ).when( info ).isErrorLineSkipped(); RowMetaInterface outputRowMeta = Mockito.mock( RowMetaInterface.class ); Mockito.doReturn( 15 ).when( outputRowMeta ).size(); ValueMetaInterface valueMetaWithError = Mockito.mock( ValueMetaInterface.class ); Mockito.doThrow( new KettleValueException( "Error converting" ) ).when( valueMetaWithError ).convertDataFromString( Mockito.anyString(), Mockito.any( ValueMetaInterface.class ), Mockito.anyString(), Mockito.anyString(), Mockito.anyInt() ); Mockito.doReturn( valueMetaWithError ).when( outputRowMeta ).getValueMeta( Mockito.anyInt() ); TextFileInput.convertLineToRow( log, textFileLine, info, new Object[3], 1, outputRowMeta, Mockito.mock( RowMetaInterface.class ), null, 1L, ";", null, "/", Mockito.mock( FileErrorHandler.class ), false, false, false, false, false, false, false, false, null, null, false, new Date(), null, null, null, 1L ); }
@Deprecated public static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ) throws KettleException { return convertLineToRow( log, textFileLine, info, null, 0, outputRowMeta, convertRowMeta, fname, rowNr, delimiter, StringUtil.substituteHex( info.getEnclosure() ), StringUtil.substituteHex( info.getEscapeCharacter() ), errorHandler, addShortFilename, addExtension, addPath, addSize, addIsHidden, addLastModificationDate, addUri, addRootUri, shortFilename, path, hidden, modificationDateTime, uri, rooturi, extension, size ); }
TextFileInput extends BaseStep implements StepInterface { @Deprecated public static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ) throws KettleException { return convertLineToRow( log, textFileLine, info, null, 0, outputRowMeta, convertRowMeta, fname, rowNr, delimiter, StringUtil.substituteHex( info.getEnclosure() ), StringUtil.substituteHex( info.getEscapeCharacter() ), errorHandler, addShortFilename, addExtension, addPath, addSize, addIsHidden, addLastModificationDate, addUri, addRootUri, shortFilename, path, hidden, modificationDateTime, uri, rooturi, extension, size ); } }
TextFileInput extends BaseStep implements StepInterface { @Deprecated public static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ) throws KettleException { return convertLineToRow( log, textFileLine, info, null, 0, outputRowMeta, convertRowMeta, fname, rowNr, delimiter, StringUtil.substituteHex( info.getEnclosure() ), StringUtil.substituteHex( info.getEscapeCharacter() ), errorHandler, addShortFilename, addExtension, addPath, addSize, addIsHidden, addLastModificationDate, addUri, addRootUri, shortFilename, path, hidden, modificationDateTime, uri, rooturi, extension, size ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
TextFileInput extends BaseStep implements StepInterface { @Deprecated public static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ) throws KettleException { return convertLineToRow( log, textFileLine, info, null, 0, outputRowMeta, convertRowMeta, fname, rowNr, delimiter, StringUtil.substituteHex( info.getEnclosure() ), StringUtil.substituteHex( info.getEscapeCharacter() ), errorHandler, addShortFilename, addExtension, addPath, addSize, addIsHidden, addLastModificationDate, addUri, addRootUri, shortFilename, path, hidden, modificationDateTime, uri, rooturi, extension, size ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
TextFileInput extends BaseStep implements StepInterface { @Deprecated public static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ) throws KettleException { return convertLineToRow( log, textFileLine, info, null, 0, outputRowMeta, convertRowMeta, fname, rowNr, delimiter, StringUtil.substituteHex( info.getEnclosure() ), StringUtil.substituteHex( info.getEscapeCharacter() ), errorHandler, addShortFilename, addExtension, addPath, addSize, addIsHidden, addLastModificationDate, addUri, addRootUri, shortFilename, path, hidden, modificationDateTime, uri, rooturi, extension, size ); } TextFileInput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); static final String getLine( LogChannelInterface log, InputStreamReader reader, int formatNr, StringBuilder line ); static final String getLine( LogChannelInterface log, InputStreamReader reader, EncodingType encodingType, int formatNr, StringBuilder line ); @Deprecated static final String[] guessStringsFromLine( LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter ); static final String[] guessStringsFromLine( VariableSpace space, LogChannelInterface log, String line, TextFileInputMeta inf, String delimiter, String enclosure, String escapeCharacter ); static final String[] convertLineToStrings( LogChannelInterface log, String line, InputFileMetaInterface inf, String delimiter, String enclosure, String escapeCharacters ); @Deprecated static final Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); static Object[] convertLineToRow( LogChannelInterface log, TextFileLine textFileLine, InputFileMetaInterface info, Object[] passThruFields, int nrPassThruFields, RowMetaInterface outputRowMeta, RowMetaInterface convertRowMeta, String fname, long rowNr, String delimiter, String enclosure, String escapeCharacter, FileErrorHandler errorHandler, boolean addShortFilename, boolean addExtension, boolean addPath, boolean addSize, boolean addIsHidden, boolean addLastModificationDate, boolean addUri, boolean addRootUri, String shortFilename, String path, boolean hidden, Date modificationDateTime, String uri, String rooturi, String extension, long size ); @Override boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); @Override boolean init( StepMetaInterface smi, StepDataInterface sdi ); @Override void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean isWaitingForData(); }
@Test public void testEquals() { CalculatorMetaFunction meta1 = new CalculatorMetaFunction(); CalculatorMetaFunction meta2 = (CalculatorMetaFunction) meta1.clone(); assertNotSame( meta1, meta2 ); assertFalse( meta1.equals( null ) ); assertFalse( meta1.equals( new Object() ) ); assertTrue( meta1.equals( meta2 ) ); meta2.setCalcType( CalculatorMetaFunction.CALC_ADD_DAYS ); assertFalse( meta1.equals( meta2 ) ); }
@Override public boolean equals( Object obj ) { if ( obj != null && ( obj.getClass().equals( this.getClass() ) ) ) { CalculatorMetaFunction mf = (CalculatorMetaFunction) obj; return ( getXML().equals( mf.getXML() ) ); } return false; }
CalculatorMetaFunction implements Cloneable { @Override public boolean equals( Object obj ) { if ( obj != null && ( obj.getClass().equals( this.getClass() ) ) ) { CalculatorMetaFunction mf = (CalculatorMetaFunction) obj; return ( getXML().equals( mf.getXML() ) ); } return false; } }
CalculatorMetaFunction implements Cloneable { @Override public boolean equals( Object obj ) { if ( obj != null && ( obj.getClass().equals( this.getClass() ) ) ) { CalculatorMetaFunction mf = (CalculatorMetaFunction) obj; return ( getXML().equals( mf.getXML() ) ); } return false; } CalculatorMetaFunction( String fieldName, int calcType, String fieldA, String fieldB, String fieldC, int valueType, int valueLength, int valuePrecision, boolean removedFromResult, String conversionMask, String decimalSymbol, String groupingSymbol, String currencySymbol ); CalculatorMetaFunction(); CalculatorMetaFunction( Node calcnode ); CalculatorMetaFunction( Repository rep, ObjectId id_step, int nr ); }
CalculatorMetaFunction implements Cloneable { @Override public boolean equals( Object obj ) { if ( obj != null && ( obj.getClass().equals( this.getClass() ) ) ) { CalculatorMetaFunction mf = (CalculatorMetaFunction) obj; return ( getXML().equals( mf.getXML() ) ); } return false; } CalculatorMetaFunction( String fieldName, int calcType, String fieldA, String fieldB, String fieldC, int valueType, int valueLength, int valuePrecision, boolean removedFromResult, String conversionMask, String decimalSymbol, String groupingSymbol, String currencySymbol ); CalculatorMetaFunction(); CalculatorMetaFunction( Node calcnode ); CalculatorMetaFunction( Repository rep, ObjectId id_step, int nr ); @Override boolean equals( Object obj ); @Override int hashCode(); @Override Object clone(); String getXML(); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step, int nr ); static int getCalcFunctionType( String desc ); static String getCalcFunctionDesc( int type ); static String getCalcFunctionLongDesc( int type ); static int getCalcFunctionDefaultResultType( int type ); int getCalcType(); void setCalcType( int calcType ); String getCalcTypeDesc(); String getCalcTypeLongDesc(); String getFieldA(); void setFieldA( String fieldA ); String getFieldB(); void setFieldB( String fieldB ); String getFieldC(); void setFieldC( String fieldC ); String getFieldName(); void setFieldName( String fieldName ); int getValueLength(); void setValueLength( int valueLength ); int getValuePrecision(); void setValuePrecision( int valuePrecision ); int getValueType(); void setValueType( int valueType ); boolean isRemovedFromResult(); void setRemovedFromResult( boolean removedFromResult ); String getConversionMask(); void setConversionMask( String conversionMask ); String getDecimalSymbol(); void setDecimalSymbol( String decimalSymbol ); String getGroupingSymbol(); void setGroupingSymbol( String groupingSymbol ); String getCurrencySymbol(); void setCurrencySymbol( String currencySymbol ); }
CalculatorMetaFunction implements Cloneable { @Override public boolean equals( Object obj ) { if ( obj != null && ( obj.getClass().equals( this.getClass() ) ) ) { CalculatorMetaFunction mf = (CalculatorMetaFunction) obj; return ( getXML().equals( mf.getXML() ) ); } return false; } CalculatorMetaFunction( String fieldName, int calcType, String fieldA, String fieldB, String fieldC, int valueType, int valueLength, int valuePrecision, boolean removedFromResult, String conversionMask, String decimalSymbol, String groupingSymbol, String currencySymbol ); CalculatorMetaFunction(); CalculatorMetaFunction( Node calcnode ); CalculatorMetaFunction( Repository rep, ObjectId id_step, int nr ); @Override boolean equals( Object obj ); @Override int hashCode(); @Override Object clone(); String getXML(); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step, int nr ); static int getCalcFunctionType( String desc ); static String getCalcFunctionDesc( int type ); static String getCalcFunctionLongDesc( int type ); static int getCalcFunctionDefaultResultType( int type ); int getCalcType(); void setCalcType( int calcType ); String getCalcTypeDesc(); String getCalcTypeLongDesc(); String getFieldA(); void setFieldA( String fieldA ); String getFieldB(); void setFieldB( String fieldB ); String getFieldC(); void setFieldC( String fieldC ); String getFieldName(); void setFieldName( String fieldName ); int getValueLength(); void setValueLength( int valueLength ); int getValuePrecision(); void setValuePrecision( int valuePrecision ); int getValueType(); void setValueType( int valueType ); boolean isRemovedFromResult(); void setRemovedFromResult( boolean removedFromResult ); String getConversionMask(); void setConversionMask( String conversionMask ); String getDecimalSymbol(); void setDecimalSymbol( String decimalSymbol ); String getGroupingSymbol(); void setGroupingSymbol( String groupingSymbol ); String getCurrencySymbol(); void setCurrencySymbol( String currencySymbol ); static final String XML_TAG; static final int CALC_NONE; static final int CALC_CONSTANT; static final int CALC_COPY_OF_FIELD; static final int CALC_ADD; static final int CALC_SUBTRACT; static final int CALC_MULTIPLY; static final int CALC_DIVIDE; static final int CALC_SQUARE; static final int CALC_SQUARE_ROOT; static final int CALC_PERCENT_1; static final int CALC_PERCENT_2; static final int CALC_PERCENT_3; static final int CALC_COMBINATION_1; static final int CALC_COMBINATION_2; static final int CALC_ROUND_1; static final int CALC_ROUND_2; static final int CALC_ROUND_STD_1; static final int CALC_ROUND_STD_2; static final int CALC_CEIL; static final int CALC_FLOOR; static final int CALC_NVL; static final int CALC_ADD_DAYS; static final int CALC_YEAR_OF_DATE; static final int CALC_MONTH_OF_DATE; static final int CALC_DAY_OF_YEAR; static final int CALC_DAY_OF_MONTH; static final int CALC_DAY_OF_WEEK; static final int CALC_WEEK_OF_YEAR; static final int CALC_WEEK_OF_YEAR_ISO8601; static final int CALC_YEAR_OF_DATE_ISO8601; static final int CALC_BYTE_TO_HEX_ENCODE; static final int CALC_HEX_TO_BYTE_DECODE; static final int CALC_CHAR_TO_HEX_ENCODE; static final int CALC_HEX_TO_CHAR_DECODE; static final int CALC_CRC32; static final int CALC_ADLER32; static final int CALC_MD5; static final int CALC_SHA1; static final int CALC_LEVENSHTEIN_DISTANCE; static final int CALC_METAPHONE; static final int CALC_DOUBLE_METAPHONE; static final int CALC_ABS; static final int CALC_REMOVE_TIME_FROM_DATE; static final int CALC_DATE_DIFF; static final int CALC_ADD3; static final int CALC_INITCAP; static final int CALC_UPPER_CASE; static final int CALC_LOWER_CASE; static final int CALC_MASK_XML; static final int CALC_USE_CDATA; static final int CALC_REMOVE_CR; static final int CALC_REMOVE_LF; static final int CALC_REMOVE_CRLF; static final int CALC_REMOVE_TAB; static final int CALC_GET_ONLY_DIGITS; static final int CALC_REMOVE_DIGITS; static final int CALC_STRING_LEN; static final int CALC_LOAD_FILE_CONTENT_BINARY; static final int CALC_ADD_TIME_TO_DATE; static final int CALC_QUARTER_OF_DATE; static final int CALC_SUBSTITUTE_VARIABLE; static final int CALC_UNESCAPE_XML; static final int CALC_ESCAPE_HTML; static final int CALC_UNESCAPE_HTML; static final int CALC_ESCAPE_SQL; static final int CALC_DATE_WORKING_DIFF; static final int CALC_ADD_MONTHS; static final int CALC_CHECK_XML_FILE_WELL_FORMED; static final int CALC_CHECK_XML_WELL_FORMED; static final int CALC_GET_FILE_ENCODING; static final int CALC_DAMERAU_LEVENSHTEIN; static final int CALC_NEEDLEMAN_WUNSH; static final int CALC_JARO; static final int CALC_JARO_WINKLER; static final int CALC_SOUNDEX; static final int CALC_REFINED_SOUNDEX; static final int CALC_ADD_HOURS; static final int CALC_ADD_MINUTES; static final int CALC_DATE_DIFF_MSEC; static final int CALC_DATE_DIFF_SEC; static final int CALC_DATE_DIFF_MN; static final int CALC_DATE_DIFF_HR; static final int CALC_HOUR_OF_DAY; static final int CALC_MINUTE_OF_HOUR; static final int CALC_SECOND_OF_MINUTE; static final int CALC_ROUND_CUSTOM_1; static final int CALC_ROUND_CUSTOM_2; static final int CALC_ADD_SECONDS; static final int CALC_REMAINDER; static final String[] calc_desc; static final String[] calcLongDesc; static final int[] calcDefaultResultType; }
@Test public void testGetCalcFunctionLongDesc() { assertNull( CalculatorMetaFunction.getCalcFunctionLongDesc( Integer.MIN_VALUE ) ); assertNull( CalculatorMetaFunction.getCalcFunctionLongDesc( Integer.MAX_VALUE ) ); assertNull( CalculatorMetaFunction.getCalcFunctionLongDesc( CalculatorMetaFunction.calcLongDesc.length ) ); }
public static String getCalcFunctionLongDesc( int type ) { if ( type < 0 || type >= calcLongDesc.length ) { return null; } return calcLongDesc[ type ]; }
CalculatorMetaFunction implements Cloneable { public static String getCalcFunctionLongDesc( int type ) { if ( type < 0 || type >= calcLongDesc.length ) { return null; } return calcLongDesc[ type ]; } }
CalculatorMetaFunction implements Cloneable { public static String getCalcFunctionLongDesc( int type ) { if ( type < 0 || type >= calcLongDesc.length ) { return null; } return calcLongDesc[ type ]; } CalculatorMetaFunction( String fieldName, int calcType, String fieldA, String fieldB, String fieldC, int valueType, int valueLength, int valuePrecision, boolean removedFromResult, String conversionMask, String decimalSymbol, String groupingSymbol, String currencySymbol ); CalculatorMetaFunction(); CalculatorMetaFunction( Node calcnode ); CalculatorMetaFunction( Repository rep, ObjectId id_step, int nr ); }
CalculatorMetaFunction implements Cloneable { public static String getCalcFunctionLongDesc( int type ) { if ( type < 0 || type >= calcLongDesc.length ) { return null; } return calcLongDesc[ type ]; } CalculatorMetaFunction( String fieldName, int calcType, String fieldA, String fieldB, String fieldC, int valueType, int valueLength, int valuePrecision, boolean removedFromResult, String conversionMask, String decimalSymbol, String groupingSymbol, String currencySymbol ); CalculatorMetaFunction(); CalculatorMetaFunction( Node calcnode ); CalculatorMetaFunction( Repository rep, ObjectId id_step, int nr ); @Override boolean equals( Object obj ); @Override int hashCode(); @Override Object clone(); String getXML(); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step, int nr ); static int getCalcFunctionType( String desc ); static String getCalcFunctionDesc( int type ); static String getCalcFunctionLongDesc( int type ); static int getCalcFunctionDefaultResultType( int type ); int getCalcType(); void setCalcType( int calcType ); String getCalcTypeDesc(); String getCalcTypeLongDesc(); String getFieldA(); void setFieldA( String fieldA ); String getFieldB(); void setFieldB( String fieldB ); String getFieldC(); void setFieldC( String fieldC ); String getFieldName(); void setFieldName( String fieldName ); int getValueLength(); void setValueLength( int valueLength ); int getValuePrecision(); void setValuePrecision( int valuePrecision ); int getValueType(); void setValueType( int valueType ); boolean isRemovedFromResult(); void setRemovedFromResult( boolean removedFromResult ); String getConversionMask(); void setConversionMask( String conversionMask ); String getDecimalSymbol(); void setDecimalSymbol( String decimalSymbol ); String getGroupingSymbol(); void setGroupingSymbol( String groupingSymbol ); String getCurrencySymbol(); void setCurrencySymbol( String currencySymbol ); }
CalculatorMetaFunction implements Cloneable { public static String getCalcFunctionLongDesc( int type ) { if ( type < 0 || type >= calcLongDesc.length ) { return null; } return calcLongDesc[ type ]; } CalculatorMetaFunction( String fieldName, int calcType, String fieldA, String fieldB, String fieldC, int valueType, int valueLength, int valuePrecision, boolean removedFromResult, String conversionMask, String decimalSymbol, String groupingSymbol, String currencySymbol ); CalculatorMetaFunction(); CalculatorMetaFunction( Node calcnode ); CalculatorMetaFunction( Repository rep, ObjectId id_step, int nr ); @Override boolean equals( Object obj ); @Override int hashCode(); @Override Object clone(); String getXML(); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step, int nr ); static int getCalcFunctionType( String desc ); static String getCalcFunctionDesc( int type ); static String getCalcFunctionLongDesc( int type ); static int getCalcFunctionDefaultResultType( int type ); int getCalcType(); void setCalcType( int calcType ); String getCalcTypeDesc(); String getCalcTypeLongDesc(); String getFieldA(); void setFieldA( String fieldA ); String getFieldB(); void setFieldB( String fieldB ); String getFieldC(); void setFieldC( String fieldC ); String getFieldName(); void setFieldName( String fieldName ); int getValueLength(); void setValueLength( int valueLength ); int getValuePrecision(); void setValuePrecision( int valuePrecision ); int getValueType(); void setValueType( int valueType ); boolean isRemovedFromResult(); void setRemovedFromResult( boolean removedFromResult ); String getConversionMask(); void setConversionMask( String conversionMask ); String getDecimalSymbol(); void setDecimalSymbol( String decimalSymbol ); String getGroupingSymbol(); void setGroupingSymbol( String groupingSymbol ); String getCurrencySymbol(); void setCurrencySymbol( String currencySymbol ); static final String XML_TAG; static final int CALC_NONE; static final int CALC_CONSTANT; static final int CALC_COPY_OF_FIELD; static final int CALC_ADD; static final int CALC_SUBTRACT; static final int CALC_MULTIPLY; static final int CALC_DIVIDE; static final int CALC_SQUARE; static final int CALC_SQUARE_ROOT; static final int CALC_PERCENT_1; static final int CALC_PERCENT_2; static final int CALC_PERCENT_3; static final int CALC_COMBINATION_1; static final int CALC_COMBINATION_2; static final int CALC_ROUND_1; static final int CALC_ROUND_2; static final int CALC_ROUND_STD_1; static final int CALC_ROUND_STD_2; static final int CALC_CEIL; static final int CALC_FLOOR; static final int CALC_NVL; static final int CALC_ADD_DAYS; static final int CALC_YEAR_OF_DATE; static final int CALC_MONTH_OF_DATE; static final int CALC_DAY_OF_YEAR; static final int CALC_DAY_OF_MONTH; static final int CALC_DAY_OF_WEEK; static final int CALC_WEEK_OF_YEAR; static final int CALC_WEEK_OF_YEAR_ISO8601; static final int CALC_YEAR_OF_DATE_ISO8601; static final int CALC_BYTE_TO_HEX_ENCODE; static final int CALC_HEX_TO_BYTE_DECODE; static final int CALC_CHAR_TO_HEX_ENCODE; static final int CALC_HEX_TO_CHAR_DECODE; static final int CALC_CRC32; static final int CALC_ADLER32; static final int CALC_MD5; static final int CALC_SHA1; static final int CALC_LEVENSHTEIN_DISTANCE; static final int CALC_METAPHONE; static final int CALC_DOUBLE_METAPHONE; static final int CALC_ABS; static final int CALC_REMOVE_TIME_FROM_DATE; static final int CALC_DATE_DIFF; static final int CALC_ADD3; static final int CALC_INITCAP; static final int CALC_UPPER_CASE; static final int CALC_LOWER_CASE; static final int CALC_MASK_XML; static final int CALC_USE_CDATA; static final int CALC_REMOVE_CR; static final int CALC_REMOVE_LF; static final int CALC_REMOVE_CRLF; static final int CALC_REMOVE_TAB; static final int CALC_GET_ONLY_DIGITS; static final int CALC_REMOVE_DIGITS; static final int CALC_STRING_LEN; static final int CALC_LOAD_FILE_CONTENT_BINARY; static final int CALC_ADD_TIME_TO_DATE; static final int CALC_QUARTER_OF_DATE; static final int CALC_SUBSTITUTE_VARIABLE; static final int CALC_UNESCAPE_XML; static final int CALC_ESCAPE_HTML; static final int CALC_UNESCAPE_HTML; static final int CALC_ESCAPE_SQL; static final int CALC_DATE_WORKING_DIFF; static final int CALC_ADD_MONTHS; static final int CALC_CHECK_XML_FILE_WELL_FORMED; static final int CALC_CHECK_XML_WELL_FORMED; static final int CALC_GET_FILE_ENCODING; static final int CALC_DAMERAU_LEVENSHTEIN; static final int CALC_NEEDLEMAN_WUNSH; static final int CALC_JARO; static final int CALC_JARO_WINKLER; static final int CALC_SOUNDEX; static final int CALC_REFINED_SOUNDEX; static final int CALC_ADD_HOURS; static final int CALC_ADD_MINUTES; static final int CALC_DATE_DIFF_MSEC; static final int CALC_DATE_DIFF_SEC; static final int CALC_DATE_DIFF_MN; static final int CALC_DATE_DIFF_HR; static final int CALC_HOUR_OF_DAY; static final int CALC_MINUTE_OF_HOUR; static final int CALC_SECOND_OF_MINUTE; static final int CALC_ROUND_CUSTOM_1; static final int CALC_ROUND_CUSTOM_2; static final int CALC_ADD_SECONDS; static final int CALC_REMAINDER; static final String[] calc_desc; static final String[] calcLongDesc; static final int[] calcDefaultResultType; }
@Test public void testGetCalcFunctionDefaultResultType() { assertEquals( ValueMetaInterface.TYPE_NONE, CalculatorMetaFunction.getCalcFunctionDefaultResultType( Integer.MIN_VALUE ) ); assertEquals( ValueMetaInterface.TYPE_NONE, CalculatorMetaFunction.getCalcFunctionDefaultResultType( Integer.MAX_VALUE ) ); assertEquals( ValueMetaInterface.TYPE_NONE, CalculatorMetaFunction.getCalcFunctionDefaultResultType( -1 ) ); assertEquals( ValueMetaInterface.TYPE_STRING, CalculatorMetaFunction.getCalcFunctionDefaultResultType( CalculatorMetaFunction.CALC_CONSTANT ) ); assertEquals( ValueMetaInterface.TYPE_NUMBER, CalculatorMetaFunction.getCalcFunctionDefaultResultType( CalculatorMetaFunction.CALC_ADD ) ); }
public static int getCalcFunctionDefaultResultType( int type ) { if ( type < 0 || type >= calcDefaultResultType.length ) { return ValueMetaInterface.TYPE_NONE; } return calcDefaultResultType[ type ]; }
CalculatorMetaFunction implements Cloneable { public static int getCalcFunctionDefaultResultType( int type ) { if ( type < 0 || type >= calcDefaultResultType.length ) { return ValueMetaInterface.TYPE_NONE; } return calcDefaultResultType[ type ]; } }
CalculatorMetaFunction implements Cloneable { public static int getCalcFunctionDefaultResultType( int type ) { if ( type < 0 || type >= calcDefaultResultType.length ) { return ValueMetaInterface.TYPE_NONE; } return calcDefaultResultType[ type ]; } CalculatorMetaFunction( String fieldName, int calcType, String fieldA, String fieldB, String fieldC, int valueType, int valueLength, int valuePrecision, boolean removedFromResult, String conversionMask, String decimalSymbol, String groupingSymbol, String currencySymbol ); CalculatorMetaFunction(); CalculatorMetaFunction( Node calcnode ); CalculatorMetaFunction( Repository rep, ObjectId id_step, int nr ); }
CalculatorMetaFunction implements Cloneable { public static int getCalcFunctionDefaultResultType( int type ) { if ( type < 0 || type >= calcDefaultResultType.length ) { return ValueMetaInterface.TYPE_NONE; } return calcDefaultResultType[ type ]; } CalculatorMetaFunction( String fieldName, int calcType, String fieldA, String fieldB, String fieldC, int valueType, int valueLength, int valuePrecision, boolean removedFromResult, String conversionMask, String decimalSymbol, String groupingSymbol, String currencySymbol ); CalculatorMetaFunction(); CalculatorMetaFunction( Node calcnode ); CalculatorMetaFunction( Repository rep, ObjectId id_step, int nr ); @Override boolean equals( Object obj ); @Override int hashCode(); @Override Object clone(); String getXML(); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step, int nr ); static int getCalcFunctionType( String desc ); static String getCalcFunctionDesc( int type ); static String getCalcFunctionLongDesc( int type ); static int getCalcFunctionDefaultResultType( int type ); int getCalcType(); void setCalcType( int calcType ); String getCalcTypeDesc(); String getCalcTypeLongDesc(); String getFieldA(); void setFieldA( String fieldA ); String getFieldB(); void setFieldB( String fieldB ); String getFieldC(); void setFieldC( String fieldC ); String getFieldName(); void setFieldName( String fieldName ); int getValueLength(); void setValueLength( int valueLength ); int getValuePrecision(); void setValuePrecision( int valuePrecision ); int getValueType(); void setValueType( int valueType ); boolean isRemovedFromResult(); void setRemovedFromResult( boolean removedFromResult ); String getConversionMask(); void setConversionMask( String conversionMask ); String getDecimalSymbol(); void setDecimalSymbol( String decimalSymbol ); String getGroupingSymbol(); void setGroupingSymbol( String groupingSymbol ); String getCurrencySymbol(); void setCurrencySymbol( String currencySymbol ); }
CalculatorMetaFunction implements Cloneable { public static int getCalcFunctionDefaultResultType( int type ) { if ( type < 0 || type >= calcDefaultResultType.length ) { return ValueMetaInterface.TYPE_NONE; } return calcDefaultResultType[ type ]; } CalculatorMetaFunction( String fieldName, int calcType, String fieldA, String fieldB, String fieldC, int valueType, int valueLength, int valuePrecision, boolean removedFromResult, String conversionMask, String decimalSymbol, String groupingSymbol, String currencySymbol ); CalculatorMetaFunction(); CalculatorMetaFunction( Node calcnode ); CalculatorMetaFunction( Repository rep, ObjectId id_step, int nr ); @Override boolean equals( Object obj ); @Override int hashCode(); @Override Object clone(); String getXML(); void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_transformation, ObjectId id_step, int nr ); static int getCalcFunctionType( String desc ); static String getCalcFunctionDesc( int type ); static String getCalcFunctionLongDesc( int type ); static int getCalcFunctionDefaultResultType( int type ); int getCalcType(); void setCalcType( int calcType ); String getCalcTypeDesc(); String getCalcTypeLongDesc(); String getFieldA(); void setFieldA( String fieldA ); String getFieldB(); void setFieldB( String fieldB ); String getFieldC(); void setFieldC( String fieldC ); String getFieldName(); void setFieldName( String fieldName ); int getValueLength(); void setValueLength( int valueLength ); int getValuePrecision(); void setValuePrecision( int valuePrecision ); int getValueType(); void setValueType( int valueType ); boolean isRemovedFromResult(); void setRemovedFromResult( boolean removedFromResult ); String getConversionMask(); void setConversionMask( String conversionMask ); String getDecimalSymbol(); void setDecimalSymbol( String decimalSymbol ); String getGroupingSymbol(); void setGroupingSymbol( String groupingSymbol ); String getCurrencySymbol(); void setCurrencySymbol( String currencySymbol ); static final String XML_TAG; static final int CALC_NONE; static final int CALC_CONSTANT; static final int CALC_COPY_OF_FIELD; static final int CALC_ADD; static final int CALC_SUBTRACT; static final int CALC_MULTIPLY; static final int CALC_DIVIDE; static final int CALC_SQUARE; static final int CALC_SQUARE_ROOT; static final int CALC_PERCENT_1; static final int CALC_PERCENT_2; static final int CALC_PERCENT_3; static final int CALC_COMBINATION_1; static final int CALC_COMBINATION_2; static final int CALC_ROUND_1; static final int CALC_ROUND_2; static final int CALC_ROUND_STD_1; static final int CALC_ROUND_STD_2; static final int CALC_CEIL; static final int CALC_FLOOR; static final int CALC_NVL; static final int CALC_ADD_DAYS; static final int CALC_YEAR_OF_DATE; static final int CALC_MONTH_OF_DATE; static final int CALC_DAY_OF_YEAR; static final int CALC_DAY_OF_MONTH; static final int CALC_DAY_OF_WEEK; static final int CALC_WEEK_OF_YEAR; static final int CALC_WEEK_OF_YEAR_ISO8601; static final int CALC_YEAR_OF_DATE_ISO8601; static final int CALC_BYTE_TO_HEX_ENCODE; static final int CALC_HEX_TO_BYTE_DECODE; static final int CALC_CHAR_TO_HEX_ENCODE; static final int CALC_HEX_TO_CHAR_DECODE; static final int CALC_CRC32; static final int CALC_ADLER32; static final int CALC_MD5; static final int CALC_SHA1; static final int CALC_LEVENSHTEIN_DISTANCE; static final int CALC_METAPHONE; static final int CALC_DOUBLE_METAPHONE; static final int CALC_ABS; static final int CALC_REMOVE_TIME_FROM_DATE; static final int CALC_DATE_DIFF; static final int CALC_ADD3; static final int CALC_INITCAP; static final int CALC_UPPER_CASE; static final int CALC_LOWER_CASE; static final int CALC_MASK_XML; static final int CALC_USE_CDATA; static final int CALC_REMOVE_CR; static final int CALC_REMOVE_LF; static final int CALC_REMOVE_CRLF; static final int CALC_REMOVE_TAB; static final int CALC_GET_ONLY_DIGITS; static final int CALC_REMOVE_DIGITS; static final int CALC_STRING_LEN; static final int CALC_LOAD_FILE_CONTENT_BINARY; static final int CALC_ADD_TIME_TO_DATE; static final int CALC_QUARTER_OF_DATE; static final int CALC_SUBSTITUTE_VARIABLE; static final int CALC_UNESCAPE_XML; static final int CALC_ESCAPE_HTML; static final int CALC_UNESCAPE_HTML; static final int CALC_ESCAPE_SQL; static final int CALC_DATE_WORKING_DIFF; static final int CALC_ADD_MONTHS; static final int CALC_CHECK_XML_FILE_WELL_FORMED; static final int CALC_CHECK_XML_WELL_FORMED; static final int CALC_GET_FILE_ENCODING; static final int CALC_DAMERAU_LEVENSHTEIN; static final int CALC_NEEDLEMAN_WUNSH; static final int CALC_JARO; static final int CALC_JARO_WINKLER; static final int CALC_SOUNDEX; static final int CALC_REFINED_SOUNDEX; static final int CALC_ADD_HOURS; static final int CALC_ADD_MINUTES; static final int CALC_DATE_DIFF_MSEC; static final int CALC_DATE_DIFF_SEC; static final int CALC_DATE_DIFF_MN; static final int CALC_DATE_DIFF_HR; static final int CALC_HOUR_OF_DAY; static final int CALC_MINUTE_OF_HOUR; static final int CALC_SECOND_OF_MINUTE; static final int CALC_ROUND_CUSTOM_1; static final int CALC_ROUND_CUSTOM_2; static final int CALC_ADD_SECONDS; static final int CALC_REMAINDER; static final String[] calc_desc; static final String[] calcLongDesc; static final int[] calcDefaultResultType; }
@Test public void dataReturnsCachedValues() throws Exception { KettleEnvironment.init( false ); CalculatorData data = new CalculatorData(); ValueMetaInterface valueMeta = data.getValueMetaFor( ValueMetaInterface.TYPE_INTEGER, null ); ValueMetaInterface shouldBeTheSame = data.getValueMetaFor( ValueMetaInterface.TYPE_INTEGER, null ); assertTrue( "CalculatorData should cache loaded value meta instances", valueMeta == shouldBeTheSame ); }
public ValueMetaInterface getValueMetaFor( int resultType, String name ) throws KettlePluginException { ValueMetaInterface meta = resultMetaMapping.get( resultType ); if ( meta == null ) { meta = ValueMetaFactory.createValueMeta( name, resultType ); resultMetaMapping.put( resultType, meta ); } return meta; }
CalculatorData extends BaseStepData implements StepDataInterface { public ValueMetaInterface getValueMetaFor( int resultType, String name ) throws KettlePluginException { ValueMetaInterface meta = resultMetaMapping.get( resultType ); if ( meta == null ) { meta = ValueMetaFactory.createValueMeta( name, resultType ); resultMetaMapping.put( resultType, meta ); } return meta; } }
CalculatorData extends BaseStepData implements StepDataInterface { public ValueMetaInterface getValueMetaFor( int resultType, String name ) throws KettlePluginException { ValueMetaInterface meta = resultMetaMapping.get( resultType ); if ( meta == null ) { meta = ValueMetaFactory.createValueMeta( name, resultType ); resultMetaMapping.put( resultType, meta ); } return meta; } CalculatorData(); }
CalculatorData extends BaseStepData implements StepDataInterface { public ValueMetaInterface getValueMetaFor( int resultType, String name ) throws KettlePluginException { ValueMetaInterface meta = resultMetaMapping.get( resultType ); if ( meta == null ) { meta = ValueMetaFactory.createValueMeta( name, resultType ); resultMetaMapping.put( resultType, meta ); } return meta; } CalculatorData(); RowMetaInterface getOutputRowMeta(); void setOutputRowMeta( RowMetaInterface outputRowMeta ); RowMetaInterface getCalcRowMeta(); void setCalcRowMeta( RowMetaInterface calcRowMeta ); Calculator.FieldIndexes[] getFieldIndexes(); void setFieldIndexes( Calculator.FieldIndexes[] fieldIndexes ); int[] getTempIndexes(); void setTempIndexes( int[] tempIndexes ); ValueMetaInterface getValueMetaFor( int resultType, String name ); void clearValuesMetaMapping(); }
CalculatorData extends BaseStepData implements StepDataInterface { public ValueMetaInterface getValueMetaFor( int resultType, String name ) throws KettlePluginException { ValueMetaInterface meta = resultMetaMapping.get( resultType ); if ( meta == null ) { meta = ValueMetaFactory.createValueMeta( name, resultType ); resultMetaMapping.put( resultType, meta ); } return meta; } CalculatorData(); RowMetaInterface getOutputRowMeta(); void setOutputRowMeta( RowMetaInterface outputRowMeta ); RowMetaInterface getCalcRowMeta(); void setCalcRowMeta( RowMetaInterface calcRowMeta ); Calculator.FieldIndexes[] getFieldIndexes(); void setFieldIndexes( Calculator.FieldIndexes[] fieldIndexes ); int[] getTempIndexes(); void setTempIndexes( int[] tempIndexes ); ValueMetaInterface getValueMetaFor( int resultType, String name ); void clearValuesMetaMapping(); }
@Test public void testGetStepData() { CalculatorMeta meta = new CalculatorMeta(); assertTrue( meta.getStepData() instanceof CalculatorData ); }
@Override public StepDataInterface getStepData() { return new CalculatorData(); }
CalculatorMeta extends BaseStepMeta implements StepMetaInterface { @Override public StepDataInterface getStepData() { return new CalculatorData(); } }
CalculatorMeta extends BaseStepMeta implements StepMetaInterface { @Override public StepDataInterface getStepData() { return new CalculatorData(); } }
CalculatorMeta extends BaseStepMeta implements StepMetaInterface { @Override public StepDataInterface getStepData() { return new CalculatorData(); } CalculatorMetaFunction[] getCalculation(); void setCalculation( CalculatorMetaFunction[] calcTypes ); void allocate( int nrCalcs ); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); @Override String getXML(); @Override boolean equals( Object obj ); @Override int hashCode(); @Override Object clone(); @Override void setDefault(); @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 row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); RowMetaInterface getAllFields( RowMetaInterface inputRowMeta ); @Override void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); @Override StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta tr, Trans trans ); @Override StepDataInterface getStepData(); }
CalculatorMeta extends BaseStepMeta implements StepMetaInterface { @Override public StepDataInterface getStepData() { return new CalculatorData(); } CalculatorMetaFunction[] getCalculation(); void setCalculation( CalculatorMetaFunction[] calcTypes ); void allocate( int nrCalcs ); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); @Override String getXML(); @Override boolean equals( Object obj ); @Override int hashCode(); @Override Object clone(); @Override void setDefault(); @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 row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); RowMetaInterface getAllFields( RowMetaInterface inputRowMeta ); @Override void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); @Override StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta tr, Trans trans ); @Override StepDataInterface getStepData(); }
@Test public void testSetDefault() { CalculatorMeta meta = new CalculatorMeta(); meta.setDefault(); assertNotNull( meta.getCalculation() ); assertEquals( 0, meta.getCalculation().length ); }
@Override public void setDefault() { calculation = new CalculatorMetaFunction[0]; }
CalculatorMeta extends BaseStepMeta implements StepMetaInterface { @Override public void setDefault() { calculation = new CalculatorMetaFunction[0]; } }
CalculatorMeta extends BaseStepMeta implements StepMetaInterface { @Override public void setDefault() { calculation = new CalculatorMetaFunction[0]; } }
CalculatorMeta extends BaseStepMeta implements StepMetaInterface { @Override public void setDefault() { calculation = new CalculatorMetaFunction[0]; } CalculatorMetaFunction[] getCalculation(); void setCalculation( CalculatorMetaFunction[] calcTypes ); void allocate( int nrCalcs ); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); @Override String getXML(); @Override boolean equals( Object obj ); @Override int hashCode(); @Override Object clone(); @Override void setDefault(); @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 row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); RowMetaInterface getAllFields( RowMetaInterface inputRowMeta ); @Override void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); @Override StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta tr, Trans trans ); @Override StepDataInterface getStepData(); }
CalculatorMeta extends BaseStepMeta implements StepMetaInterface { @Override public void setDefault() { calculation = new CalculatorMetaFunction[0]; } CalculatorMetaFunction[] getCalculation(); void setCalculation( CalculatorMetaFunction[] calcTypes ); void allocate( int nrCalcs ); @Override void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ); @Override String getXML(); @Override boolean equals( Object obj ); @Override int hashCode(); @Override Object clone(); @Override void setDefault(); @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 row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore ); RowMetaInterface getAllFields( RowMetaInterface inputRowMeta ); @Override void check( List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info, VariableSpace space, Repository repository, IMetaStore metaStore ); @Override StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta tr, Trans trans ); @Override StepDataInterface getStepData(); }
@Test public void testClone() throws Exception { try { StepDefinition stepDefinition = new StepDefinition( "tag", "stepName", null, "" ); stepDefinition.clone(); } catch ( NullPointerException npe ) { fail( "Null value is not handled" ); } }
public Object clone() throws CloneNotSupportedException { StepDefinition retval; retval = (StepDefinition) super.clone(); if ( stepMeta != null ) { retval.stepMeta = (StepMeta) stepMeta.clone(); } return retval; }
StepDefinition implements Cloneable { public Object clone() throws CloneNotSupportedException { StepDefinition retval; retval = (StepDefinition) super.clone(); if ( stepMeta != null ) { retval.stepMeta = (StepMeta) stepMeta.clone(); } return retval; } }
StepDefinition implements Cloneable { public Object clone() throws CloneNotSupportedException { StepDefinition retval; retval = (StepDefinition) super.clone(); if ( stepMeta != null ) { retval.stepMeta = (StepMeta) stepMeta.clone(); } return retval; } StepDefinition(); StepDefinition( String tag, String stepName, StepMeta stepMeta, String description ); }
StepDefinition implements Cloneable { public Object clone() throws CloneNotSupportedException { StepDefinition retval; retval = (StepDefinition) super.clone(); if ( stepMeta != null ) { retval.stepMeta = (StepMeta) stepMeta.clone(); } return retval; } StepDefinition(); StepDefinition( String tag, String stepName, StepMeta stepMeta, String description ); Object clone(); }
StepDefinition implements Cloneable { public Object clone() throws CloneNotSupportedException { StepDefinition retval; retval = (StepDefinition) super.clone(); if ( stepMeta != null ) { retval.stepMeta = (StepMeta) stepMeta.clone(); } return retval; } StepDefinition(); StepDefinition( String tag, String stepName, StepMeta stepMeta, String description ); Object clone(); public String tag; public String stepName; public StepMeta stepMeta; public String description; }
@Test public void testProcessRow() throws KettleException { PrioritizeStreamsMeta meta = new PrioritizeStreamsMeta(); meta.setStepName( new String[] { "high", "medium", "low" } ); PrioritizeStreamsData data = new PrioritizeStreamsData(); PrioritizeStreamsInner step = new PrioritizeStreamsInner( stepMockHelper ); try { step.processRow( meta, data ); } catch ( NullPointerException e ) { fail( "NullPointerException detecded, seems that RowMetaInterface was not set for RowSet you are attempting" + "to read from." ); } Assert.assertTrue( "First waiting for row set is 'high'", data.currentRowSet.getClass().equals( SingleRowRowSet.class ) ); }
public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (PrioritizeStreamsMeta) smi; data = (PrioritizeStreamsData) sdi; if ( first ) { if ( meta.getStepName() != null || meta.getStepName().length > 0 ) { data.stepnrs = meta.getStepName().length; data.rowSets = new RowSet[data.stepnrs]; for ( int i = 0; i < data.stepnrs; i++ ) { data.rowSets[i] = findInputRowSet( meta.getStepName()[i] ); if ( i > 0 ) { checkInputLayoutValid( data.rowSets[0].getRowMeta(), data.rowSets[i].getRowMeta() ); } } } else { throw new KettleException( BaseMessages.getString( PKG, "PrioritizeStreams.Error.NotInputSteps" ) ); } data.currentRowSet = data.rowSets[0]; } Object[] input = getOneRow(); while ( input == null && data.stepnr < data.stepnrs - 1 && !isStopped() ) { input = getOneRow(); } if ( input == null ) { setOutputDone(); return false; } if ( first ) { data.outputRowMeta = data.currentRowSet.getRowMeta(); first = false; } putRow( data.outputRowMeta, input ); return true; }
PrioritizeStreams extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (PrioritizeStreamsMeta) smi; data = (PrioritizeStreamsData) sdi; if ( first ) { if ( meta.getStepName() != null || meta.getStepName().length > 0 ) { data.stepnrs = meta.getStepName().length; data.rowSets = new RowSet[data.stepnrs]; for ( int i = 0; i < data.stepnrs; i++ ) { data.rowSets[i] = findInputRowSet( meta.getStepName()[i] ); if ( i > 0 ) { checkInputLayoutValid( data.rowSets[0].getRowMeta(), data.rowSets[i].getRowMeta() ); } } } else { throw new KettleException( BaseMessages.getString( PKG, "PrioritizeStreams.Error.NotInputSteps" ) ); } data.currentRowSet = data.rowSets[0]; } Object[] input = getOneRow(); while ( input == null && data.stepnr < data.stepnrs - 1 && !isStopped() ) { input = getOneRow(); } if ( input == null ) { setOutputDone(); return false; } if ( first ) { data.outputRowMeta = data.currentRowSet.getRowMeta(); first = false; } putRow( data.outputRowMeta, input ); return true; } }
PrioritizeStreams extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (PrioritizeStreamsMeta) smi; data = (PrioritizeStreamsData) sdi; if ( first ) { if ( meta.getStepName() != null || meta.getStepName().length > 0 ) { data.stepnrs = meta.getStepName().length; data.rowSets = new RowSet[data.stepnrs]; for ( int i = 0; i < data.stepnrs; i++ ) { data.rowSets[i] = findInputRowSet( meta.getStepName()[i] ); if ( i > 0 ) { checkInputLayoutValid( data.rowSets[0].getRowMeta(), data.rowSets[i].getRowMeta() ); } } } else { throw new KettleException( BaseMessages.getString( PKG, "PrioritizeStreams.Error.NotInputSteps" ) ); } data.currentRowSet = data.rowSets[0]; } Object[] input = getOneRow(); while ( input == null && data.stepnr < data.stepnrs - 1 && !isStopped() ) { input = getOneRow(); } if ( input == null ) { setOutputDone(); return false; } if ( first ) { data.outputRowMeta = data.currentRowSet.getRowMeta(); first = false; } putRow( data.outputRowMeta, input ); return true; } PrioritizeStreams( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
PrioritizeStreams extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (PrioritizeStreamsMeta) smi; data = (PrioritizeStreamsData) sdi; if ( first ) { if ( meta.getStepName() != null || meta.getStepName().length > 0 ) { data.stepnrs = meta.getStepName().length; data.rowSets = new RowSet[data.stepnrs]; for ( int i = 0; i < data.stepnrs; i++ ) { data.rowSets[i] = findInputRowSet( meta.getStepName()[i] ); if ( i > 0 ) { checkInputLayoutValid( data.rowSets[0].getRowMeta(), data.rowSets[i].getRowMeta() ); } } } else { throw new KettleException( BaseMessages.getString( PKG, "PrioritizeStreams.Error.NotInputSteps" ) ); } data.currentRowSet = data.rowSets[0]; } Object[] input = getOneRow(); while ( input == null && data.stepnr < data.stepnrs - 1 && !isStopped() ) { input = getOneRow(); } if ( input == null ) { setOutputDone(); return false; } if ( first ) { data.outputRowMeta = data.currentRowSet.getRowMeta(); first = false; } putRow( data.outputRowMeta, input ); return true; } PrioritizeStreams( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
PrioritizeStreams extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (PrioritizeStreamsMeta) smi; data = (PrioritizeStreamsData) sdi; if ( first ) { if ( meta.getStepName() != null || meta.getStepName().length > 0 ) { data.stepnrs = meta.getStepName().length; data.rowSets = new RowSet[data.stepnrs]; for ( int i = 0; i < data.stepnrs; i++ ) { data.rowSets[i] = findInputRowSet( meta.getStepName()[i] ); if ( i > 0 ) { checkInputLayoutValid( data.rowSets[0].getRowMeta(), data.rowSets[i].getRowMeta() ); } } } else { throw new KettleException( BaseMessages.getString( PKG, "PrioritizeStreams.Error.NotInputSteps" ) ); } data.currentRowSet = data.rowSets[0]; } Object[] input = getOneRow(); while ( input == null && data.stepnr < data.stepnrs - 1 && !isStopped() ) { input = getOneRow(); } if ( input == null ) { setOutputDone(); return false; } if ( first ) { data.outputRowMeta = data.currentRowSet.getRowMeta(); first = false; } putRow( data.outputRowMeta, input ); return true; } PrioritizeStreams( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void testPoolingRowChange() throws Exception { }
public void poolingRowChange( int idx ) { if ( idx != -1 ) { if ( idx >= BaseDatabaseMeta.poolingParameters.length ) { idx = BaseDatabaseMeta.poolingParameters.length - 1; } if ( idx < 0 ) { idx = 0; } poolingDescription.setValue( BaseDatabaseMeta.poolingParameters[idx].getDescription() ); XulTreeRow row = poolParameterTree.getRootChildren().getItem( idx ).getRow(); if ( row.getSelectedColumnIndex() == 2 ) { row.addCellText( 0, "true" ); } } }
DataHandler extends AbstractXulEventHandler { public void poolingRowChange( int idx ) { if ( idx != -1 ) { if ( idx >= BaseDatabaseMeta.poolingParameters.length ) { idx = BaseDatabaseMeta.poolingParameters.length - 1; } if ( idx < 0 ) { idx = 0; } poolingDescription.setValue( BaseDatabaseMeta.poolingParameters[idx].getDescription() ); XulTreeRow row = poolParameterTree.getRootChildren().getItem( idx ).getRow(); if ( row.getSelectedColumnIndex() == 2 ) { row.addCellText( 0, "true" ); } } } }
DataHandler extends AbstractXulEventHandler { public void poolingRowChange( int idx ) { if ( idx != -1 ) { if ( idx >= BaseDatabaseMeta.poolingParameters.length ) { idx = BaseDatabaseMeta.poolingParameters.length - 1; } if ( idx < 0 ) { idx = 0; } poolingDescription.setValue( BaseDatabaseMeta.poolingParameters[idx].getDescription() ); XulTreeRow row = poolParameterTree.getRootChildren().getItem( idx ).getRow(); if ( row.getSelectedColumnIndex() == 2 ) { row.addCellText( 0, "true" ); } } } DataHandler(); }
DataHandler extends AbstractXulEventHandler { public void poolingRowChange( int idx ) { if ( idx != -1 ) { if ( idx >= BaseDatabaseMeta.poolingParameters.length ) { idx = BaseDatabaseMeta.poolingParameters.length - 1; } if ( idx < 0 ) { idx = 0; } poolingDescription.setValue( BaseDatabaseMeta.poolingParameters[idx].getDescription() ); XulTreeRow row = poolParameterTree.getRootChildren().getItem( idx ).getRow(); if ( row.getSelectedColumnIndex() == 2 ) { row.addCellText( 0, "true" ); } } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); }
DataHandler extends AbstractXulEventHandler { public void poolingRowChange( int idx ) { if ( idx != -1 ) { if ( idx >= BaseDatabaseMeta.poolingParameters.length ) { idx = BaseDatabaseMeta.poolingParameters.length - 1; } if ( idx < 0 ) { idx = 0; } poolingDescription.setValue( BaseDatabaseMeta.poolingParameters[idx].getDescription() ); XulTreeRow row = poolParameterTree.getRootChildren().getItem( idx ).getRow(); if ( row.getSelectedColumnIndex() == 2 ) { row.addCellText( 0, "true" ); } } } DataHandler(); void loadConnectionData(); void loadAccessData(); void editOptions( int index ); void clearOptionsData(); void getOptionHelp(); void setDeckChildIndex(); void onPoolingCheck(); void onClusterCheck(); Object getData(); void setData( Object data ); void pushCache(); void popCache(); void onCancel(); void onOK(); void testDatabaseConnection(); void restoreDefaults(); void poolingRowChange( int idx ); void disablePortIfInstancePopulated(); void handleUseSecurityCheckbox(); static final SortedMap<String, DatabaseInterface> connectionMap; static final Map<String, String> connectionNametoID; }
@SuppressWarnings( "unchecked" ) @Test public void testProcessRow() throws Exception { fuzzyMatch = new FuzzyMatchHandler( mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans ); fuzzyMatch.init( mockHelper.initStepMetaInterface, mockHelper.initStepDataInterface ); fuzzyMatch.getInputRowSets().add( mockHelper.getMockInputRowSet( rows ) ); fuzzyMatch.getInputRowSets().add( mockHelper.getMockInputRowSet( lookupRows ) ); when( mockHelper.processRowsStepMetaInterface.getAlgorithmType() ).thenReturn( 8 ); mockHelper.processRowsStepDataInterface.look = mock( HashSet.class ); when( mockHelper.processRowsStepDataInterface.look.iterator() ).thenReturn( lookupRows.iterator() ); fuzzyMatch.processRow( mockHelper.processRowsStepMetaInterface, mockHelper.processRowsStepDataInterface ); Assert.assertEquals( fuzzyMatch.resultRow[0], row3[0] ); }
public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (FuzzyMatchMeta) smi; data = (FuzzyMatchData) sdi; if ( data.readLookupValues ) { data.readLookupValues = false; if ( !readLookupValues() ) { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.UnableToReadDataFromLookupStream" ) ); setErrors( 1 ); stopAll(); return false; } if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadValuesInMemory", data.look.size() ) ); } } Object[] r = getRow(); if ( r == null ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.StoppedProcessingWithEmpty", getLinesRead() ) ); } setOutputDone(); return false; } try { Object[] outputRow = lookupValues( getInputRowMeta(), r ); if ( outputRow == null ) { setOutputDone(); return false; } putRow( data.outputRowMeta, outputRow ); if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "FuzzyMatch.Log.LineNumber" ) + getLinesRead() ); } } } catch ( KettleException e ) { boolean sendToErrorRow = false; String errorMessage = null; if ( getStepMeta().isDoingErrorHandling() ) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.ErrorInStepRunning" ) + e.getMessage() ); setErrors( 1 ); stopAll(); setOutputDone(); return false; } if ( sendToErrorRow ) { putError( getInputRowMeta(), r, 1, errorMessage, meta.getMainStreamField(), "FuzzyMatch001" ); } } return true; }
FuzzyMatch extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (FuzzyMatchMeta) smi; data = (FuzzyMatchData) sdi; if ( data.readLookupValues ) { data.readLookupValues = false; if ( !readLookupValues() ) { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.UnableToReadDataFromLookupStream" ) ); setErrors( 1 ); stopAll(); return false; } if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadValuesInMemory", data.look.size() ) ); } } Object[] r = getRow(); if ( r == null ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.StoppedProcessingWithEmpty", getLinesRead() ) ); } setOutputDone(); return false; } try { Object[] outputRow = lookupValues( getInputRowMeta(), r ); if ( outputRow == null ) { setOutputDone(); return false; } putRow( data.outputRowMeta, outputRow ); if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "FuzzyMatch.Log.LineNumber" ) + getLinesRead() ); } } } catch ( KettleException e ) { boolean sendToErrorRow = false; String errorMessage = null; if ( getStepMeta().isDoingErrorHandling() ) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.ErrorInStepRunning" ) + e.getMessage() ); setErrors( 1 ); stopAll(); setOutputDone(); return false; } if ( sendToErrorRow ) { putError( getInputRowMeta(), r, 1, errorMessage, meta.getMainStreamField(), "FuzzyMatch001" ); } } return true; } }
FuzzyMatch extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (FuzzyMatchMeta) smi; data = (FuzzyMatchData) sdi; if ( data.readLookupValues ) { data.readLookupValues = false; if ( !readLookupValues() ) { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.UnableToReadDataFromLookupStream" ) ); setErrors( 1 ); stopAll(); return false; } if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadValuesInMemory", data.look.size() ) ); } } Object[] r = getRow(); if ( r == null ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.StoppedProcessingWithEmpty", getLinesRead() ) ); } setOutputDone(); return false; } try { Object[] outputRow = lookupValues( getInputRowMeta(), r ); if ( outputRow == null ) { setOutputDone(); return false; } putRow( data.outputRowMeta, outputRow ); if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "FuzzyMatch.Log.LineNumber" ) + getLinesRead() ); } } } catch ( KettleException e ) { boolean sendToErrorRow = false; String errorMessage = null; if ( getStepMeta().isDoingErrorHandling() ) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.ErrorInStepRunning" ) + e.getMessage() ); setErrors( 1 ); stopAll(); setOutputDone(); return false; } if ( sendToErrorRow ) { putError( getInputRowMeta(), r, 1, errorMessage, meta.getMainStreamField(), "FuzzyMatch001" ); } } return true; } FuzzyMatch( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
FuzzyMatch extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (FuzzyMatchMeta) smi; data = (FuzzyMatchData) sdi; if ( data.readLookupValues ) { data.readLookupValues = false; if ( !readLookupValues() ) { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.UnableToReadDataFromLookupStream" ) ); setErrors( 1 ); stopAll(); return false; } if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadValuesInMemory", data.look.size() ) ); } } Object[] r = getRow(); if ( r == null ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.StoppedProcessingWithEmpty", getLinesRead() ) ); } setOutputDone(); return false; } try { Object[] outputRow = lookupValues( getInputRowMeta(), r ); if ( outputRow == null ) { setOutputDone(); return false; } putRow( data.outputRowMeta, outputRow ); if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "FuzzyMatch.Log.LineNumber" ) + getLinesRead() ); } } } catch ( KettleException e ) { boolean sendToErrorRow = false; String errorMessage = null; if ( getStepMeta().isDoingErrorHandling() ) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.ErrorInStepRunning" ) + e.getMessage() ); setErrors( 1 ); stopAll(); setOutputDone(); return false; } if ( sendToErrorRow ) { putError( getInputRowMeta(), r, 1, errorMessage, meta.getMainStreamField(), "FuzzyMatch001" ); } } return true; } FuzzyMatch( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
FuzzyMatch extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (FuzzyMatchMeta) smi; data = (FuzzyMatchData) sdi; if ( data.readLookupValues ) { data.readLookupValues = false; if ( !readLookupValues() ) { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.UnableToReadDataFromLookupStream" ) ); setErrors( 1 ); stopAll(); return false; } if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadValuesInMemory", data.look.size() ) ); } } Object[] r = getRow(); if ( r == null ) { if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.StoppedProcessingWithEmpty", getLinesRead() ) ); } setOutputDone(); return false; } try { Object[] outputRow = lookupValues( getInputRowMeta(), r ); if ( outputRow == null ) { setOutputDone(); return false; } putRow( data.outputRowMeta, outputRow ); if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "FuzzyMatch.Log.LineNumber" ) + getLinesRead() ); } } } catch ( KettleException e ) { boolean sendToErrorRow = false; String errorMessage = null; if ( getStepMeta().isDoingErrorHandling() ) { sendToErrorRow = true; errorMessage = e.toString(); } else { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.ErrorInStepRunning" ) + e.getMessage() ); setErrors( 1 ); stopAll(); setOutputDone(); return false; } if ( sendToErrorRow ) { putError( getInputRowMeta(), r, 1, errorMessage, meta.getMainStreamField(), "FuzzyMatch001" ); } } return true; } FuzzyMatch( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void testReadLookupValues() throws Exception { FuzzyMatchData data = spy( new FuzzyMatchData() ); data.indexOfCachedFields = new int[2]; data.minimalDistance = 0; data.maximalDistance = 5; FuzzyMatchMeta meta = spy( new FuzzyMatchMeta() ); meta.setOutputMatchField( "I don't want NPE here!" ); data.readLookupValues = true; fuzzyMatch = new FuzzyMatchHandler( mockHelper.stepMeta, mockHelper.stepDataInterface, 0, mockHelper.transMeta, mockHelper.trans ); fuzzyMatch.init( meta, data ); RowSet lookupRowSet = mockHelper.getMockInputRowSet( binaryLookupRows ); fuzzyMatch.getInputRowSets().add( mockHelper.getMockInputRowSet( binaryRows ) ); fuzzyMatch.getInputRowSets().add( lookupRowSet ); fuzzyMatch.rowset = lookupRowSet; RowMetaInterface rowMetaInterface = new RowMeta(); ValueMetaInterface valueMeta = new ValueMetaString( "field1" ); valueMeta.setStorageMetadata( new ValueMetaString( "field1" ) ); valueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_BINARY_STRING ); rowMetaInterface.addValueMeta( valueMeta ); when( lookupRowSet.getRowMeta() ).thenReturn( rowMetaInterface ); when( meta.getLookupField() ).thenReturn( "field1" ); when( meta.getMainStreamField() ).thenReturn( "field1" ); fuzzyMatch.setInputRowMeta( rowMetaInterface.clone() ); when( meta.getAlgorithmType() ).thenReturn( 1 ); StepIOMetaInterface stepIOMetaInterface = mock( StepIOMetaInterface.class ); when( meta.getStepIOMeta() ).thenReturn( stepIOMetaInterface ); StreamInterface streamInterface = mock( StreamInterface.class ); List<StreamInterface> streamInterfaceList = new ArrayList<StreamInterface>(); streamInterfaceList.add( streamInterface ); when( streamInterface.getStepMeta() ).thenReturn( mockHelper.stepMeta ); when( stepIOMetaInterface.getInfoStreams() ).thenReturn( streamInterfaceList ); fuzzyMatch.processRow( meta, data ); Assert.assertEquals( rowMetaInterface.getString( row3B, 0 ), data.outputRowMeta.getString( fuzzyMatch.resultRow, 1 ) ); }
private boolean readLookupValues() throws KettleException { data.infoStream = meta.getStepIOMeta().getInfoStreams().get( 0 ); if ( data.infoStream.getStepMeta() == null ) { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.NoLookupStepSpecified" ) ); return false; } if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadingFromStream" ) + data.infoStream.getStepname() + "]" ); } boolean firstRun = true; RowSet rowSet = findInputRowSet( data.infoStream.getStepname() ); Object[] rowData = getRowFrom( rowSet ); while ( rowData != null ) { if ( firstRun ) { data.infoMeta = rowSet.getRowMeta().clone(); int indexOfLookupField = data.infoMeta.indexOfValue( environmentSubstitute( meta.getLookupField() ) ); if ( indexOfLookupField < 0 ) { throw new KettleException( BaseMessages.getString( PKG, "FuzzyMatch.Exception.CouldnotFindLookField", meta.getLookupField() ) ); } data.infoCache = new RowMeta(); ValueMetaInterface keyValueMeta = data.infoMeta.getValueMeta( indexOfLookupField ); keyValueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); data.infoCache.addValueMeta( keyValueMeta ); data.indexOfCachedFields[0] = indexOfLookupField; if ( data.addAdditionalFields ) { ValueMetaInterface additionalFieldValueMeta; for ( int i = 0; i < meta.getValue().length; i++ ) { int fi = i + 1; data.indexOfCachedFields[fi] = data.infoMeta.indexOfValue( meta.getValue()[i] ); if ( data.indexOfCachedFields[fi] < 0 ) { throw new KettleException( BaseMessages.getString( PKG, "FuzzyMatch.Exception.CouldnotFindLookField", meta.getValue()[i] ) ); } additionalFieldValueMeta = data.infoMeta.getValueMeta( data.indexOfCachedFields[fi] ); additionalFieldValueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); data.infoCache.addValueMeta( additionalFieldValueMeta ); } data.nrCachedFields += meta.getValue().length; } } if ( log.isRowLevel() ) { logRowlevel( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadLookupRow" ) + rowSet.getRowMeta().getString( rowData ) ); } Object[] storeData = new Object[data.nrCachedFields]; if ( rowData[data.indexOfCachedFields[0]] == null ) { storeData[0] = ""; } else { ValueMetaInterface fromStreamRowMeta = rowSet.getRowMeta().getValueMeta( data.indexOfCachedFields[0] ); if ( fromStreamRowMeta.isStorageBinaryString() ) { storeData[0] = fromStreamRowMeta.convertToNormalStorageType( rowData[data.indexOfCachedFields[0]] ); } else { storeData[0] = rowData[data.indexOfCachedFields[0]]; } } for ( int i = 1; i < data.nrCachedFields; i++ ) { ValueMetaInterface fromStreamRowMeta = rowSet.getRowMeta().getValueMeta( data.indexOfCachedFields[i] ); if ( fromStreamRowMeta.isStorageBinaryString() ) { storeData[i] = fromStreamRowMeta.convertToNormalStorageType( rowData[data.indexOfCachedFields[i]] ); } else { storeData[i] = rowData[data.indexOfCachedFields[i]]; } } if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "FuzzyMatch.Log.AddingValueToCache", data.infoCache .getString( storeData ) ) ); } addToCache( storeData ); rowData = getRowFrom( rowSet ); if ( firstRun ) { firstRun = false; } } return true; }
FuzzyMatch extends BaseStep implements StepInterface { private boolean readLookupValues() throws KettleException { data.infoStream = meta.getStepIOMeta().getInfoStreams().get( 0 ); if ( data.infoStream.getStepMeta() == null ) { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.NoLookupStepSpecified" ) ); return false; } if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadingFromStream" ) + data.infoStream.getStepname() + "]" ); } boolean firstRun = true; RowSet rowSet = findInputRowSet( data.infoStream.getStepname() ); Object[] rowData = getRowFrom( rowSet ); while ( rowData != null ) { if ( firstRun ) { data.infoMeta = rowSet.getRowMeta().clone(); int indexOfLookupField = data.infoMeta.indexOfValue( environmentSubstitute( meta.getLookupField() ) ); if ( indexOfLookupField < 0 ) { throw new KettleException( BaseMessages.getString( PKG, "FuzzyMatch.Exception.CouldnotFindLookField", meta.getLookupField() ) ); } data.infoCache = new RowMeta(); ValueMetaInterface keyValueMeta = data.infoMeta.getValueMeta( indexOfLookupField ); keyValueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); data.infoCache.addValueMeta( keyValueMeta ); data.indexOfCachedFields[0] = indexOfLookupField; if ( data.addAdditionalFields ) { ValueMetaInterface additionalFieldValueMeta; for ( int i = 0; i < meta.getValue().length; i++ ) { int fi = i + 1; data.indexOfCachedFields[fi] = data.infoMeta.indexOfValue( meta.getValue()[i] ); if ( data.indexOfCachedFields[fi] < 0 ) { throw new KettleException( BaseMessages.getString( PKG, "FuzzyMatch.Exception.CouldnotFindLookField", meta.getValue()[i] ) ); } additionalFieldValueMeta = data.infoMeta.getValueMeta( data.indexOfCachedFields[fi] ); additionalFieldValueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); data.infoCache.addValueMeta( additionalFieldValueMeta ); } data.nrCachedFields += meta.getValue().length; } } if ( log.isRowLevel() ) { logRowlevel( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadLookupRow" ) + rowSet.getRowMeta().getString( rowData ) ); } Object[] storeData = new Object[data.nrCachedFields]; if ( rowData[data.indexOfCachedFields[0]] == null ) { storeData[0] = ""; } else { ValueMetaInterface fromStreamRowMeta = rowSet.getRowMeta().getValueMeta( data.indexOfCachedFields[0] ); if ( fromStreamRowMeta.isStorageBinaryString() ) { storeData[0] = fromStreamRowMeta.convertToNormalStorageType( rowData[data.indexOfCachedFields[0]] ); } else { storeData[0] = rowData[data.indexOfCachedFields[0]]; } } for ( int i = 1; i < data.nrCachedFields; i++ ) { ValueMetaInterface fromStreamRowMeta = rowSet.getRowMeta().getValueMeta( data.indexOfCachedFields[i] ); if ( fromStreamRowMeta.isStorageBinaryString() ) { storeData[i] = fromStreamRowMeta.convertToNormalStorageType( rowData[data.indexOfCachedFields[i]] ); } else { storeData[i] = rowData[data.indexOfCachedFields[i]]; } } if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "FuzzyMatch.Log.AddingValueToCache", data.infoCache .getString( storeData ) ) ); } addToCache( storeData ); rowData = getRowFrom( rowSet ); if ( firstRun ) { firstRun = false; } } return true; } }
FuzzyMatch extends BaseStep implements StepInterface { private boolean readLookupValues() throws KettleException { data.infoStream = meta.getStepIOMeta().getInfoStreams().get( 0 ); if ( data.infoStream.getStepMeta() == null ) { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.NoLookupStepSpecified" ) ); return false; } if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadingFromStream" ) + data.infoStream.getStepname() + "]" ); } boolean firstRun = true; RowSet rowSet = findInputRowSet( data.infoStream.getStepname() ); Object[] rowData = getRowFrom( rowSet ); while ( rowData != null ) { if ( firstRun ) { data.infoMeta = rowSet.getRowMeta().clone(); int indexOfLookupField = data.infoMeta.indexOfValue( environmentSubstitute( meta.getLookupField() ) ); if ( indexOfLookupField < 0 ) { throw new KettleException( BaseMessages.getString( PKG, "FuzzyMatch.Exception.CouldnotFindLookField", meta.getLookupField() ) ); } data.infoCache = new RowMeta(); ValueMetaInterface keyValueMeta = data.infoMeta.getValueMeta( indexOfLookupField ); keyValueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); data.infoCache.addValueMeta( keyValueMeta ); data.indexOfCachedFields[0] = indexOfLookupField; if ( data.addAdditionalFields ) { ValueMetaInterface additionalFieldValueMeta; for ( int i = 0; i < meta.getValue().length; i++ ) { int fi = i + 1; data.indexOfCachedFields[fi] = data.infoMeta.indexOfValue( meta.getValue()[i] ); if ( data.indexOfCachedFields[fi] < 0 ) { throw new KettleException( BaseMessages.getString( PKG, "FuzzyMatch.Exception.CouldnotFindLookField", meta.getValue()[i] ) ); } additionalFieldValueMeta = data.infoMeta.getValueMeta( data.indexOfCachedFields[fi] ); additionalFieldValueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); data.infoCache.addValueMeta( additionalFieldValueMeta ); } data.nrCachedFields += meta.getValue().length; } } if ( log.isRowLevel() ) { logRowlevel( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadLookupRow" ) + rowSet.getRowMeta().getString( rowData ) ); } Object[] storeData = new Object[data.nrCachedFields]; if ( rowData[data.indexOfCachedFields[0]] == null ) { storeData[0] = ""; } else { ValueMetaInterface fromStreamRowMeta = rowSet.getRowMeta().getValueMeta( data.indexOfCachedFields[0] ); if ( fromStreamRowMeta.isStorageBinaryString() ) { storeData[0] = fromStreamRowMeta.convertToNormalStorageType( rowData[data.indexOfCachedFields[0]] ); } else { storeData[0] = rowData[data.indexOfCachedFields[0]]; } } for ( int i = 1; i < data.nrCachedFields; i++ ) { ValueMetaInterface fromStreamRowMeta = rowSet.getRowMeta().getValueMeta( data.indexOfCachedFields[i] ); if ( fromStreamRowMeta.isStorageBinaryString() ) { storeData[i] = fromStreamRowMeta.convertToNormalStorageType( rowData[data.indexOfCachedFields[i]] ); } else { storeData[i] = rowData[data.indexOfCachedFields[i]]; } } if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "FuzzyMatch.Log.AddingValueToCache", data.infoCache .getString( storeData ) ) ); } addToCache( storeData ); rowData = getRowFrom( rowSet ); if ( firstRun ) { firstRun = false; } } return true; } FuzzyMatch( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
FuzzyMatch extends BaseStep implements StepInterface { private boolean readLookupValues() throws KettleException { data.infoStream = meta.getStepIOMeta().getInfoStreams().get( 0 ); if ( data.infoStream.getStepMeta() == null ) { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.NoLookupStepSpecified" ) ); return false; } if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadingFromStream" ) + data.infoStream.getStepname() + "]" ); } boolean firstRun = true; RowSet rowSet = findInputRowSet( data.infoStream.getStepname() ); Object[] rowData = getRowFrom( rowSet ); while ( rowData != null ) { if ( firstRun ) { data.infoMeta = rowSet.getRowMeta().clone(); int indexOfLookupField = data.infoMeta.indexOfValue( environmentSubstitute( meta.getLookupField() ) ); if ( indexOfLookupField < 0 ) { throw new KettleException( BaseMessages.getString( PKG, "FuzzyMatch.Exception.CouldnotFindLookField", meta.getLookupField() ) ); } data.infoCache = new RowMeta(); ValueMetaInterface keyValueMeta = data.infoMeta.getValueMeta( indexOfLookupField ); keyValueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); data.infoCache.addValueMeta( keyValueMeta ); data.indexOfCachedFields[0] = indexOfLookupField; if ( data.addAdditionalFields ) { ValueMetaInterface additionalFieldValueMeta; for ( int i = 0; i < meta.getValue().length; i++ ) { int fi = i + 1; data.indexOfCachedFields[fi] = data.infoMeta.indexOfValue( meta.getValue()[i] ); if ( data.indexOfCachedFields[fi] < 0 ) { throw new KettleException( BaseMessages.getString( PKG, "FuzzyMatch.Exception.CouldnotFindLookField", meta.getValue()[i] ) ); } additionalFieldValueMeta = data.infoMeta.getValueMeta( data.indexOfCachedFields[fi] ); additionalFieldValueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); data.infoCache.addValueMeta( additionalFieldValueMeta ); } data.nrCachedFields += meta.getValue().length; } } if ( log.isRowLevel() ) { logRowlevel( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadLookupRow" ) + rowSet.getRowMeta().getString( rowData ) ); } Object[] storeData = new Object[data.nrCachedFields]; if ( rowData[data.indexOfCachedFields[0]] == null ) { storeData[0] = ""; } else { ValueMetaInterface fromStreamRowMeta = rowSet.getRowMeta().getValueMeta( data.indexOfCachedFields[0] ); if ( fromStreamRowMeta.isStorageBinaryString() ) { storeData[0] = fromStreamRowMeta.convertToNormalStorageType( rowData[data.indexOfCachedFields[0]] ); } else { storeData[0] = rowData[data.indexOfCachedFields[0]]; } } for ( int i = 1; i < data.nrCachedFields; i++ ) { ValueMetaInterface fromStreamRowMeta = rowSet.getRowMeta().getValueMeta( data.indexOfCachedFields[i] ); if ( fromStreamRowMeta.isStorageBinaryString() ) { storeData[i] = fromStreamRowMeta.convertToNormalStorageType( rowData[data.indexOfCachedFields[i]] ); } else { storeData[i] = rowData[data.indexOfCachedFields[i]]; } } if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "FuzzyMatch.Log.AddingValueToCache", data.infoCache .getString( storeData ) ) ); } addToCache( storeData ); rowData = getRowFrom( rowSet ); if ( firstRun ) { firstRun = false; } } return true; } FuzzyMatch( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
FuzzyMatch extends BaseStep implements StepInterface { private boolean readLookupValues() throws KettleException { data.infoStream = meta.getStepIOMeta().getInfoStreams().get( 0 ); if ( data.infoStream.getStepMeta() == null ) { logError( BaseMessages.getString( PKG, "FuzzyMatch.Log.NoLookupStepSpecified" ) ); return false; } if ( isDetailed() ) { logDetailed( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadingFromStream" ) + data.infoStream.getStepname() + "]" ); } boolean firstRun = true; RowSet rowSet = findInputRowSet( data.infoStream.getStepname() ); Object[] rowData = getRowFrom( rowSet ); while ( rowData != null ) { if ( firstRun ) { data.infoMeta = rowSet.getRowMeta().clone(); int indexOfLookupField = data.infoMeta.indexOfValue( environmentSubstitute( meta.getLookupField() ) ); if ( indexOfLookupField < 0 ) { throw new KettleException( BaseMessages.getString( PKG, "FuzzyMatch.Exception.CouldnotFindLookField", meta.getLookupField() ) ); } data.infoCache = new RowMeta(); ValueMetaInterface keyValueMeta = data.infoMeta.getValueMeta( indexOfLookupField ); keyValueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); data.infoCache.addValueMeta( keyValueMeta ); data.indexOfCachedFields[0] = indexOfLookupField; if ( data.addAdditionalFields ) { ValueMetaInterface additionalFieldValueMeta; for ( int i = 0; i < meta.getValue().length; i++ ) { int fi = i + 1; data.indexOfCachedFields[fi] = data.infoMeta.indexOfValue( meta.getValue()[i] ); if ( data.indexOfCachedFields[fi] < 0 ) { throw new KettleException( BaseMessages.getString( PKG, "FuzzyMatch.Exception.CouldnotFindLookField", meta.getValue()[i] ) ); } additionalFieldValueMeta = data.infoMeta.getValueMeta( data.indexOfCachedFields[fi] ); additionalFieldValueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL ); data.infoCache.addValueMeta( additionalFieldValueMeta ); } data.nrCachedFields += meta.getValue().length; } } if ( log.isRowLevel() ) { logRowlevel( BaseMessages.getString( PKG, "FuzzyMatch.Log.ReadLookupRow" ) + rowSet.getRowMeta().getString( rowData ) ); } Object[] storeData = new Object[data.nrCachedFields]; if ( rowData[data.indexOfCachedFields[0]] == null ) { storeData[0] = ""; } else { ValueMetaInterface fromStreamRowMeta = rowSet.getRowMeta().getValueMeta( data.indexOfCachedFields[0] ); if ( fromStreamRowMeta.isStorageBinaryString() ) { storeData[0] = fromStreamRowMeta.convertToNormalStorageType( rowData[data.indexOfCachedFields[0]] ); } else { storeData[0] = rowData[data.indexOfCachedFields[0]]; } } for ( int i = 1; i < data.nrCachedFields; i++ ) { ValueMetaInterface fromStreamRowMeta = rowSet.getRowMeta().getValueMeta( data.indexOfCachedFields[i] ); if ( fromStreamRowMeta.isStorageBinaryString() ) { storeData[i] = fromStreamRowMeta.convertToNormalStorageType( rowData[data.indexOfCachedFields[i]] ); } else { storeData[i] = rowData[data.indexOfCachedFields[i]]; } } if ( isDebug() ) { logDebug( BaseMessages.getString( PKG, "FuzzyMatch.Log.AddingValueToCache", data.infoCache .getString( storeData ) ) ); } addToCache( storeData ); rowData = getRowFrom( rowSet ); if ( firstRun ) { firstRun = false; } } return true; } FuzzyMatch( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void testOutputDoneIfInputEmpty() throws Exception { Script step = new Script( helper.stepMeta, helper.stepDataInterface, 1, helper.transMeta, helper.trans ); step.init( helper.initStepMetaInterface, helper.initStepDataInterface ); RowSet rs = helper.getMockInputRowSet( new Object[ 0 ][ 0 ] ); List<RowSet> in = new ArrayList<RowSet>(); in.add( rs ); step.setInputRowSets( in ); TransTestingUtil.execute( step, helper.processRowsStepMetaInterface, helper.processRowsStepDataInterface, 0, true ); rs.getRow(); }
public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ScriptMeta) smi; data = (ScriptData) sdi; if ( super.init( smi, sdi ) ) { jsScripts = meta.getJSScripts(); for ( int j = 0; j < jsScripts.length; j++ ) { switch ( jsScripts[ j ].getScriptType() ) { case ScriptValuesScript.TRANSFORM_SCRIPT: strTransformScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.START_SCRIPT: strStartScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.END_SCRIPT: strEndScript = jsScripts[ j ].getScript(); break; default: break; } } return true; } return false; }
Script extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ScriptMeta) smi; data = (ScriptData) sdi; if ( super.init( smi, sdi ) ) { jsScripts = meta.getJSScripts(); for ( int j = 0; j < jsScripts.length; j++ ) { switch ( jsScripts[ j ].getScriptType() ) { case ScriptValuesScript.TRANSFORM_SCRIPT: strTransformScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.START_SCRIPT: strStartScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.END_SCRIPT: strEndScript = jsScripts[ j ].getScript(); break; default: break; } } return true; } return false; } }
Script extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ScriptMeta) smi; data = (ScriptData) sdi; if ( super.init( smi, sdi ) ) { jsScripts = meta.getJSScripts(); for ( int j = 0; j < jsScripts.length; j++ ) { switch ( jsScripts[ j ].getScriptType() ) { case ScriptValuesScript.TRANSFORM_SCRIPT: strTransformScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.START_SCRIPT: strStartScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.END_SCRIPT: strEndScript = jsScripts[ j ].getScript(); break; default: break; } } return true; } return false; } Script( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
Script extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ScriptMeta) smi; data = (ScriptData) sdi; if ( super.init( smi, sdi ) ) { jsScripts = meta.getJSScripts(); for ( int j = 0; j < jsScripts.length; j++ ) { switch ( jsScripts[ j ].getScriptType() ) { case ScriptValuesScript.TRANSFORM_SCRIPT: strTransformScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.START_SCRIPT: strStartScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.END_SCRIPT: strEndScript = jsScripts[ j ].getScript(); break; default: break; } } return true; } return false; } Script( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); Object getValueFromJScript( Object result, int i ); RowMetaInterface getOutputRowMeta(); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); }
Script extends BaseStep implements StepInterface { public boolean init( StepMetaInterface smi, StepDataInterface sdi ) { meta = (ScriptMeta) smi; data = (ScriptData) sdi; if ( super.init( smi, sdi ) ) { jsScripts = meta.getJSScripts(); for ( int j = 0; j < jsScripts.length; j++ ) { switch ( jsScripts[ j ].getScriptType() ) { case ScriptValuesScript.TRANSFORM_SCRIPT: strTransformScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.START_SCRIPT: strStartScript = jsScripts[ j ].getScript(); break; case ScriptValuesScript.END_SCRIPT: strEndScript = jsScripts[ j ].getScript(); break; default: break; } } return true; } return false; } Script( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); Object getValueFromJScript( Object result, int i ); RowMetaInterface getOutputRowMeta(); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); static final int SKIP_TRANSFORMATION; static final int ABORT_TRANSFORMATION; static final int ERROR_TRANSFORMATION; static final int CONTINUE_TRANSFORMATION; }
@Test public void testProcessRow() throws KettleException { SwitchCaseCustom krasavez = new SwitchCaseCustom( mockHelper ); krasavez.first = false; RowSet rowSetOne = new QueueRowSet(); RowSet rowSetTwo = new QueueRowSet(); krasavez.data.outputMap.put( 3, rowSetOne ); krasavez.data.outputMap.put( 3, rowSetTwo ); RowSet rowSetNullOne = new QueueRowSet(); RowSet rowSetNullTwo = new QueueRowSet(); krasavez.data.nullRowSetSet.add( rowSetNullOne ); krasavez.data.nullRowSetSet.add( rowSetNullTwo ); RowSet def = new QueueRowSet(); krasavez.data.defaultRowSetSet.add( def ); krasavez.generateData( 1, 5, 2 ); krasavez.processRow(); assertEquals( "First row set collects 2 rows", 2, rowSetOne.size() ); assertEquals( "Second row set collects 2 rows", 2, rowSetTwo.size() ); assertEquals( "First null row set collects 5 rows", 6, rowSetNullOne.size() ); assertEquals( "Second null row set collects 5 rows", 6, rowSetNullTwo.size() ); assertEquals( "Default row set collects the rest of rows", 8, def.size() ); assertEquals( "First row set contains only 3: ", true, isRowSetContainsValue( rowSetOne, new Object[] { 3 }, new Object[] { } ) ); assertEquals( "Second row set contains only 3: ", true, isRowSetContainsValue( rowSetTwo, new Object[] { 3 }, new Object[] { } ) ); assertEquals( "First null row set contains only null: ", true, isRowSetContainsValue( rowSetNullOne, new Object[] { null }, new Object[] { } ) ); assertEquals( "Second null row set contains only null: ", true, isRowSetContainsValue( rowSetNullTwo, new Object[] { null }, new Object[] { } ) ); assertEquals( "Default row set do not contains null or 3, but other", true, isRowSetContainsValue( def, new Object[] { 1, 2, 4, 5 }, new Object[] { 3, null } ) ); }
public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SwitchCaseMeta) smi; data = (SwitchCaseData) sdi; Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( first ) { first = false; createOutputValueMapping(); } Object lookupData = data.valueMeta.convertData( data.inputValueMeta, r[data.fieldIndex] ); Set<RowSet> rowSetSet = ( data.valueMeta.isNull( lookupData ) ) ? data.nullRowSetSet : data.outputMap.get( lookupData ); if ( rowSetSet == null ) { rowSetSet = data.defaultRowSetSet; } for ( RowSet rowSet : rowSetSet ) { putRowTo( data.outputRowMeta, r, rowSet ); } if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "SwitchCase.Log.LineNumber" ) + getLinesRead() ); } } return true; }
SwitchCase extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SwitchCaseMeta) smi; data = (SwitchCaseData) sdi; Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( first ) { first = false; createOutputValueMapping(); } Object lookupData = data.valueMeta.convertData( data.inputValueMeta, r[data.fieldIndex] ); Set<RowSet> rowSetSet = ( data.valueMeta.isNull( lookupData ) ) ? data.nullRowSetSet : data.outputMap.get( lookupData ); if ( rowSetSet == null ) { rowSetSet = data.defaultRowSetSet; } for ( RowSet rowSet : rowSetSet ) { putRowTo( data.outputRowMeta, r, rowSet ); } if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "SwitchCase.Log.LineNumber" ) + getLinesRead() ); } } return true; } }
SwitchCase extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SwitchCaseMeta) smi; data = (SwitchCaseData) sdi; Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( first ) { first = false; createOutputValueMapping(); } Object lookupData = data.valueMeta.convertData( data.inputValueMeta, r[data.fieldIndex] ); Set<RowSet> rowSetSet = ( data.valueMeta.isNull( lookupData ) ) ? data.nullRowSetSet : data.outputMap.get( lookupData ); if ( rowSetSet == null ) { rowSetSet = data.defaultRowSetSet; } for ( RowSet rowSet : rowSetSet ) { putRowTo( data.outputRowMeta, r, rowSet ); } if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "SwitchCase.Log.LineNumber" ) + getLinesRead() ); } } return true; } SwitchCase( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
SwitchCase extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SwitchCaseMeta) smi; data = (SwitchCaseData) sdi; Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( first ) { first = false; createOutputValueMapping(); } Object lookupData = data.valueMeta.convertData( data.inputValueMeta, r[data.fieldIndex] ); Set<RowSet> rowSetSet = ( data.valueMeta.isNull( lookupData ) ) ? data.nullRowSetSet : data.outputMap.get( lookupData ); if ( rowSetSet == null ) { rowSetSet = data.defaultRowSetSet; } for ( RowSet rowSet : rowSetSet ) { putRowTo( data.outputRowMeta, r, rowSet ); } if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "SwitchCase.Log.LineNumber" ) + getLinesRead() ); } } return true; } SwitchCase( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); }
SwitchCase extends BaseStep implements StepInterface { public boolean processRow( StepMetaInterface smi, StepDataInterface sdi ) throws KettleException { meta = (SwitchCaseMeta) smi; data = (SwitchCaseData) sdi; Object[] r = getRow(); if ( r == null ) { setOutputDone(); return false; } if ( first ) { first = false; createOutputValueMapping(); } Object lookupData = data.valueMeta.convertData( data.inputValueMeta, r[data.fieldIndex] ); Set<RowSet> rowSetSet = ( data.valueMeta.isNull( lookupData ) ) ? data.nullRowSetSet : data.outputMap.get( lookupData ); if ( rowSetSet == null ) { rowSetSet = data.defaultRowSetSet; } for ( RowSet rowSet : rowSetSet ) { putRowTo( data.outputRowMeta, r, rowSet ); } if ( checkFeedback( getLinesRead() ) ) { if ( log.isBasic() ) { logBasic( BaseMessages.getString( PKG, "SwitchCase.Log.LineNumber" ) + getLinesRead() ); } } return true; } SwitchCase( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); }
@Test public void testCreateOutputValueMapping() throws KettleException, URISyntaxException, ParserConfigurationException, SAXException, IOException { SwitchCaseCustom krasavez = new SwitchCaseCustom( mockHelper ); List<DatabaseMeta> emptyList = new ArrayList<DatabaseMeta>(); krasavez.meta.loadXML( loadStepXmlMetadata( "SwitchCaseTest.xml" ), emptyList, mock( IMetaStore.class ) ); KeyToRowSetMap expectedNN = new KeyToRowSetMap(); Set<RowSet> nulls = new HashSet<RowSet>(); List<SwitchCaseTarget> list = krasavez.meta.getCaseTargets(); for ( SwitchCaseTarget item : list ) { StepMetaInterface smInt = new DummyTransMeta(); StepMeta stepMeta = new StepMeta( item.caseTargetStepname, smInt ); item.caseTargetStep = stepMeta; RowSet rw = new QueueRowSet(); krasavez.map.put( item.caseTargetStepname, rw ); if ( item.caseValue != null ) { expectedNN.put( item.caseValue, rw ); } else { nulls.add( rw ); } } StepMetaInterface smInt = new DummyTransMeta(); StepMeta stepMeta = new StepMeta( krasavez.meta.getDefaultTargetStepname(), smInt ); krasavez.meta.setDefaultTargetStep( stepMeta ); RowSet rw = new QueueRowSet(); krasavez.map.put( krasavez.meta.getDefaultTargetStepname(), rw ); krasavez.createOutputValueMapping(); Set<RowSet> ones = krasavez.data.outputMap.get( "1" ); assertEquals( "Output map for 1 values contains 2 row sets", 2, ones.size() ); Set<RowSet> twos = krasavez.data.outputMap.get( "2" ); assertEquals( "Output map for 2 values contains 1 row sets", 1, twos.size() ); assertEquals( "Null row set contains 2 items: ", 2, krasavez.data.nullRowSetSet.size() ); assertEquals( "We have at least one default rowset", 1, krasavez.data.defaultRowSetSet.size() ); Set<RowSet> rowsets = expectedNN.get( "1" ); for ( RowSet rowset : rowsets ) { assertTrue( "Output map for 1 values contains expected row set", ones.contains( rowset ) ); } rowsets = expectedNN.get( "2" ); for ( RowSet rowset : rowsets ) { assertTrue( "Output map for 2 values contains expected row set", twos.contains( rowset ) ); } for ( RowSet rowset : krasavez.data.nullRowSetSet ) { assertTrue( "Output map for null values contains expected row set", nulls.contains( rowset ) ); } for ( RowSet rowset : krasavez.data.defaultRowSetSet ) { assertTrue( "Output map for default case contains expected row set", rowset.equals( rw ) ); } }
void createOutputValueMapping() throws KettleException { data.outputRowMeta = getInputRowMeta().clone(); meta.getFields( getInputRowMeta(), getStepname(), null, null, this, repository, metaStore ); data.fieldIndex = getInputRowMeta().indexOfValue( meta.getFieldname() ); if ( data.fieldIndex < 0 ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Exception.UnableToFindFieldName", meta .getFieldname() ) ); } data.inputValueMeta = getInputRowMeta().getValueMeta( data.fieldIndex ); try { StepIOMetaInterface ioMeta = meta.getStepIOMeta(); List<StreamInterface> targetStreams = ioMeta.getTargetStreams(); for ( int i = 0; i < targetStreams.size(); i++ ) { SwitchCaseTarget target = (SwitchCaseTarget) targetStreams.get( i ).getSubject(); if ( target == null ) { break; } if ( target.caseTargetStep == null ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Log.NoTargetStepSpecifiedForValue", target.caseValue ) ); } RowSet rowSet = findOutputRowSet( target.caseTargetStep.getName() ); if ( rowSet == null ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Log.UnableToFindTargetRowSetForStep", target.caseTargetStep ) ); } try { Object value = data.valueMeta.convertDataFromString( target.caseValue, data.stringValueMeta, null, null, ValueMetaInterface.TRIM_TYPE_NONE ); if ( data.valueMeta.isNull( value ) ) { data.nullRowSetSet.add( rowSet ); } else { data.outputMap.put( value, rowSet ); } } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Log.UnableToConvertValue", target.caseValue ), e ); } } if ( meta.getDefaultTargetStep() != null ) { RowSet rowSet = findOutputRowSet( meta.getDefaultTargetStep().getName() ); if ( rowSet != null ) { data.defaultRowSetSet.add( rowSet ); if ( data.nullRowSetSet.isEmpty() ) { data.nullRowSetSet.add( rowSet ); } } } } catch ( Exception e ) { throw new KettleException( e ); } }
SwitchCase extends BaseStep implements StepInterface { void createOutputValueMapping() throws KettleException { data.outputRowMeta = getInputRowMeta().clone(); meta.getFields( getInputRowMeta(), getStepname(), null, null, this, repository, metaStore ); data.fieldIndex = getInputRowMeta().indexOfValue( meta.getFieldname() ); if ( data.fieldIndex < 0 ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Exception.UnableToFindFieldName", meta .getFieldname() ) ); } data.inputValueMeta = getInputRowMeta().getValueMeta( data.fieldIndex ); try { StepIOMetaInterface ioMeta = meta.getStepIOMeta(); List<StreamInterface> targetStreams = ioMeta.getTargetStreams(); for ( int i = 0; i < targetStreams.size(); i++ ) { SwitchCaseTarget target = (SwitchCaseTarget) targetStreams.get( i ).getSubject(); if ( target == null ) { break; } if ( target.caseTargetStep == null ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Log.NoTargetStepSpecifiedForValue", target.caseValue ) ); } RowSet rowSet = findOutputRowSet( target.caseTargetStep.getName() ); if ( rowSet == null ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Log.UnableToFindTargetRowSetForStep", target.caseTargetStep ) ); } try { Object value = data.valueMeta.convertDataFromString( target.caseValue, data.stringValueMeta, null, null, ValueMetaInterface.TRIM_TYPE_NONE ); if ( data.valueMeta.isNull( value ) ) { data.nullRowSetSet.add( rowSet ); } else { data.outputMap.put( value, rowSet ); } } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Log.UnableToConvertValue", target.caseValue ), e ); } } if ( meta.getDefaultTargetStep() != null ) { RowSet rowSet = findOutputRowSet( meta.getDefaultTargetStep().getName() ); if ( rowSet != null ) { data.defaultRowSetSet.add( rowSet ); if ( data.nullRowSetSet.isEmpty() ) { data.nullRowSetSet.add( rowSet ); } } } } catch ( Exception e ) { throw new KettleException( e ); } } }
SwitchCase extends BaseStep implements StepInterface { void createOutputValueMapping() throws KettleException { data.outputRowMeta = getInputRowMeta().clone(); meta.getFields( getInputRowMeta(), getStepname(), null, null, this, repository, metaStore ); data.fieldIndex = getInputRowMeta().indexOfValue( meta.getFieldname() ); if ( data.fieldIndex < 0 ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Exception.UnableToFindFieldName", meta .getFieldname() ) ); } data.inputValueMeta = getInputRowMeta().getValueMeta( data.fieldIndex ); try { StepIOMetaInterface ioMeta = meta.getStepIOMeta(); List<StreamInterface> targetStreams = ioMeta.getTargetStreams(); for ( int i = 0; i < targetStreams.size(); i++ ) { SwitchCaseTarget target = (SwitchCaseTarget) targetStreams.get( i ).getSubject(); if ( target == null ) { break; } if ( target.caseTargetStep == null ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Log.NoTargetStepSpecifiedForValue", target.caseValue ) ); } RowSet rowSet = findOutputRowSet( target.caseTargetStep.getName() ); if ( rowSet == null ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Log.UnableToFindTargetRowSetForStep", target.caseTargetStep ) ); } try { Object value = data.valueMeta.convertDataFromString( target.caseValue, data.stringValueMeta, null, null, ValueMetaInterface.TRIM_TYPE_NONE ); if ( data.valueMeta.isNull( value ) ) { data.nullRowSetSet.add( rowSet ); } else { data.outputMap.put( value, rowSet ); } } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Log.UnableToConvertValue", target.caseValue ), e ); } } if ( meta.getDefaultTargetStep() != null ) { RowSet rowSet = findOutputRowSet( meta.getDefaultTargetStep().getName() ); if ( rowSet != null ) { data.defaultRowSetSet.add( rowSet ); if ( data.nullRowSetSet.isEmpty() ) { data.nullRowSetSet.add( rowSet ); } } } } catch ( Exception e ) { throw new KettleException( e ); } } SwitchCase( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); }
SwitchCase extends BaseStep implements StepInterface { void createOutputValueMapping() throws KettleException { data.outputRowMeta = getInputRowMeta().clone(); meta.getFields( getInputRowMeta(), getStepname(), null, null, this, repository, metaStore ); data.fieldIndex = getInputRowMeta().indexOfValue( meta.getFieldname() ); if ( data.fieldIndex < 0 ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Exception.UnableToFindFieldName", meta .getFieldname() ) ); } data.inputValueMeta = getInputRowMeta().getValueMeta( data.fieldIndex ); try { StepIOMetaInterface ioMeta = meta.getStepIOMeta(); List<StreamInterface> targetStreams = ioMeta.getTargetStreams(); for ( int i = 0; i < targetStreams.size(); i++ ) { SwitchCaseTarget target = (SwitchCaseTarget) targetStreams.get( i ).getSubject(); if ( target == null ) { break; } if ( target.caseTargetStep == null ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Log.NoTargetStepSpecifiedForValue", target.caseValue ) ); } RowSet rowSet = findOutputRowSet( target.caseTargetStep.getName() ); if ( rowSet == null ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Log.UnableToFindTargetRowSetForStep", target.caseTargetStep ) ); } try { Object value = data.valueMeta.convertDataFromString( target.caseValue, data.stringValueMeta, null, null, ValueMetaInterface.TRIM_TYPE_NONE ); if ( data.valueMeta.isNull( value ) ) { data.nullRowSetSet.add( rowSet ); } else { data.outputMap.put( value, rowSet ); } } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Log.UnableToConvertValue", target.caseValue ), e ); } } if ( meta.getDefaultTargetStep() != null ) { RowSet rowSet = findOutputRowSet( meta.getDefaultTargetStep().getName() ); if ( rowSet != null ) { data.defaultRowSetSet.add( rowSet ); if ( data.nullRowSetSet.isEmpty() ) { data.nullRowSetSet.add( rowSet ); } } } } catch ( Exception e ) { throw new KettleException( e ); } } SwitchCase( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); }
SwitchCase extends BaseStep implements StepInterface { void createOutputValueMapping() throws KettleException { data.outputRowMeta = getInputRowMeta().clone(); meta.getFields( getInputRowMeta(), getStepname(), null, null, this, repository, metaStore ); data.fieldIndex = getInputRowMeta().indexOfValue( meta.getFieldname() ); if ( data.fieldIndex < 0 ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Exception.UnableToFindFieldName", meta .getFieldname() ) ); } data.inputValueMeta = getInputRowMeta().getValueMeta( data.fieldIndex ); try { StepIOMetaInterface ioMeta = meta.getStepIOMeta(); List<StreamInterface> targetStreams = ioMeta.getTargetStreams(); for ( int i = 0; i < targetStreams.size(); i++ ) { SwitchCaseTarget target = (SwitchCaseTarget) targetStreams.get( i ).getSubject(); if ( target == null ) { break; } if ( target.caseTargetStep == null ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Log.NoTargetStepSpecifiedForValue", target.caseValue ) ); } RowSet rowSet = findOutputRowSet( target.caseTargetStep.getName() ); if ( rowSet == null ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Log.UnableToFindTargetRowSetForStep", target.caseTargetStep ) ); } try { Object value = data.valueMeta.convertDataFromString( target.caseValue, data.stringValueMeta, null, null, ValueMetaInterface.TRIM_TYPE_NONE ); if ( data.valueMeta.isNull( value ) ) { data.nullRowSetSet.add( rowSet ); } else { data.outputMap.put( value, rowSet ); } } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "SwitchCase.Log.UnableToConvertValue", target.caseValue ), e ); } } if ( meta.getDefaultTargetStep() != null ) { RowSet rowSet = findOutputRowSet( meta.getDefaultTargetStep().getName() ); if ( rowSet != null ) { data.defaultRowSetSet.add( rowSet ); if ( data.nullRowSetSet.isEmpty() ) { data.nullRowSetSet.add( rowSet ); } } } } catch ( Exception e ) { throw new KettleException( e ); } } SwitchCase( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ); boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); }