@Test @PrepareForTest( StepWithMappingMeta.class ) public void activateParamsTest() throws Exception { String childParam = "childParam"; String childValue = "childValue"; String paramOverwrite = "paramOverwrite"; String parentValue = "parentValue"; VariableSpace parent = new Variables(); parent.setVariable( paramOverwrite, parentValue ); TransMeta childVariableSpace = new TransMeta(); childVariableSpace.setParameterValue( childParam, childValue ); String[] parameters = childVariableSpace.listParameters(); StepWithMappingMeta.activateParams( childVariableSpace, childVariableSpace, parent, parameters, new String[] { childParam, paramOverwrite }, new String[] { childValue, childValue } ); Assert.assertEquals( childValue, childVariableSpace.getVariable( childParam ) ); Assert.assertEquals( parentValue, childVariableSpace.getVariable( paramOverwrite ) ); }
public static void activateParams( VariableSpace childVariableSpace, NamedParams childNamedParams, VariableSpace parent, String[] listParameters, String[] mappingVariables, String[] inputFields ) { Map<String, String> parameters = new HashMap<>(); Set<String> subTransParameters = new HashSet<>( Arrays.asList( listParameters ) ); if ( mappingVariables != null ) { for ( int i = 0; i < mappingVariables.length; i++ ) { parameters.put( mappingVariables[ i ], parent.environmentSubstitute( inputFields[ i ] ) ); } } for ( String variableName : parent.listVariables() ) { if ( parameters.containsKey( variableName ) ) { parameters.put( variableName, parent.getVariable( variableName ) ); } else if ( ArrayUtils.contains( listParameters, variableName ) ) { parameters.put( variableName, parent.getVariable( variableName ) ); } } for ( Map.Entry<String, String> entry : parameters.entrySet() ) { String key = entry.getKey(); String value = Const.NVL( entry.getValue(), "" ); if ( subTransParameters.contains( key ) ) { try { childNamedParams.setParameterValue( key, Const.NVL( entry.getValue(), "" ) ); } catch ( UnknownParamException e ) { } } else { childVariableSpace.setVariable( key, value ); } } childNamedParams.activateParameters(); }
StepWithMappingMeta extends BaseSerializingMeta implements HasRepositoryDirectories, StepMetaInterface { public static void activateParams( VariableSpace childVariableSpace, NamedParams childNamedParams, VariableSpace parent, String[] listParameters, String[] mappingVariables, String[] inputFields ) { Map<String, String> parameters = new HashMap<>(); Set<String> subTransParameters = new HashSet<>( Arrays.asList( listParameters ) ); if ( mappingVariables != null ) { for ( int i = 0; i < mappingVariables.length; i++ ) { parameters.put( mappingVariables[ i ], parent.environmentSubstitute( inputFields[ i ] ) ); } } for ( String variableName : parent.listVariables() ) { if ( parameters.containsKey( variableName ) ) { parameters.put( variableName, parent.getVariable( variableName ) ); } else if ( ArrayUtils.contains( listParameters, variableName ) ) { parameters.put( variableName, parent.getVariable( variableName ) ); } } for ( Map.Entry<String, String> entry : parameters.entrySet() ) { String key = entry.getKey(); String value = Const.NVL( entry.getValue(), "" ); if ( subTransParameters.contains( key ) ) { try { childNamedParams.setParameterValue( key, Const.NVL( entry.getValue(), "" ) ); } catch ( UnknownParamException e ) { } } else { childVariableSpace.setVariable( key, value ); } } childNamedParams.activateParameters(); } }
StepWithMappingMeta extends BaseSerializingMeta implements HasRepositoryDirectories, StepMetaInterface { public static void activateParams( VariableSpace childVariableSpace, NamedParams childNamedParams, VariableSpace parent, String[] listParameters, String[] mappingVariables, String[] inputFields ) { Map<String, String> parameters = new HashMap<>(); Set<String> subTransParameters = new HashSet<>( Arrays.asList( listParameters ) ); if ( mappingVariables != null ) { for ( int i = 0; i < mappingVariables.length; i++ ) { parameters.put( mappingVariables[ i ], parent.environmentSubstitute( inputFields[ i ] ) ); } } for ( String variableName : parent.listVariables() ) { if ( parameters.containsKey( variableName ) ) { parameters.put( variableName, parent.getVariable( variableName ) ); } else if ( ArrayUtils.contains( listParameters, variableName ) ) { parameters.put( variableName, parent.getVariable( variableName ) ); } } for ( Map.Entry<String, String> entry : parameters.entrySet() ) { String key = entry.getKey(); String value = Const.NVL( entry.getValue(), "" ); if ( subTransParameters.contains( key ) ) { try { childNamedParams.setParameterValue( key, Const.NVL( entry.getValue(), "" ) ); } catch ( UnknownParamException e ) { } } else { childVariableSpace.setVariable( key, value ); } } childNamedParams.activateParameters(); }  }
StepWithMappingMeta extends BaseSerializingMeta implements HasRepositoryDirectories, StepMetaInterface { public static void activateParams( VariableSpace childVariableSpace, NamedParams childNamedParams, VariableSpace parent, String[] listParameters, String[] mappingVariables, String[] inputFields ) { Map<String, String> parameters = new HashMap<>(); Set<String> subTransParameters = new HashSet<>( Arrays.asList( listParameters ) ); if ( mappingVariables != null ) { for ( int i = 0; i < mappingVariables.length; i++ ) { parameters.put( mappingVariables[ i ], parent.environmentSubstitute( inputFields[ i ] ) ); } } for ( String variableName : parent.listVariables() ) { if ( parameters.containsKey( variableName ) ) { parameters.put( variableName, parent.getVariable( variableName ) ); } else if ( ArrayUtils.contains( listParameters, variableName ) ) { parameters.put( variableName, parent.getVariable( variableName ) ); } } for ( Map.Entry<String, String> entry : parameters.entrySet() ) { String key = entry.getKey(); String value = Const.NVL( entry.getValue(), "" ); if ( subTransParameters.contains( key ) ) { try { childNamedParams.setParameterValue( key, Const.NVL( entry.getValue(), "" ) ); } catch ( UnknownParamException e ) { } } else { childVariableSpace.setVariable( key, value ); } } childNamedParams.activateParameters(); }  static TransMeta loadMappingMeta( StepWithMappingMeta mappingMeta, Repository rep,
                                           IMetaStore metaStore, VariableSpace space ); static synchronized TransMeta loadMappingMeta( StepWithMappingMeta executorMeta, Repository rep,
                                                        IMetaStore metaStore, VariableSpace space, boolean share ); static void activateParams( VariableSpace childVariableSpace, NamedParams childNamedParams, VariableSpace parent, String[] listParameters,
                                     String[] mappingVariables, String[] inputFields ); ObjectLocationSpecificationMethod getSpecificationMethod(); @Override ObjectLocationSpecificationMethod[] getSpecificationMethods(); void setSpecificationMethod( ObjectLocationSpecificationMethod specificationMethod ); String getDirectoryPath(); void setDirectoryPath( String directoryPath ); @Override String[] getDirectories(); @Override void setDirectories( String[] directories ); String getFileName(); void setFileName( String fileName ); void replaceFileName( String fileName ); String getTransName(); void setTransName( String transName ); ObjectId getTransObjectId(); void setTransObjectId( ObjectId transObjectId ); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions,
                                 ResourceNamingInterface resourceNamingInterface, Repository repository,
                                 IMetaStore metaStore ); static void addMissingVariables( VariableSpace fromSpace, VariableSpace toSpace ); static void replaceVariableValues( VariableSpace childTransMeta, VariableSpace replaceBy ); }
StepWithMappingMeta extends BaseSerializingMeta implements HasRepositoryDirectories, StepMetaInterface { public static void activateParams( VariableSpace childVariableSpace, NamedParams childNamedParams, VariableSpace parent, String[] listParameters, String[] mappingVariables, String[] inputFields ) { Map<String, String> parameters = new HashMap<>(); Set<String> subTransParameters = new HashSet<>( Arrays.asList( listParameters ) ); if ( mappingVariables != null ) { for ( int i = 0; i < mappingVariables.length; i++ ) { parameters.put( mappingVariables[ i ], parent.environmentSubstitute( inputFields[ i ] ) ); } } for ( String variableName : parent.listVariables() ) { if ( parameters.containsKey( variableName ) ) { parameters.put( variableName, parent.getVariable( variableName ) ); } else if ( ArrayUtils.contains( listParameters, variableName ) ) { parameters.put( variableName, parent.getVariable( variableName ) ); } } for ( Map.Entry<String, String> entry : parameters.entrySet() ) { String key = entry.getKey(); String value = Const.NVL( entry.getValue(), "" ); if ( subTransParameters.contains( key ) ) { try { childNamedParams.setParameterValue( key, Const.NVL( entry.getValue(), "" ) ); } catch ( UnknownParamException e ) { } } else { childVariableSpace.setVariable( key, value ); } } childNamedParams.activateParameters(); }  static TransMeta loadMappingMeta( StepWithMappingMeta mappingMeta, Repository rep,
                                           IMetaStore metaStore, VariableSpace space ); static synchronized TransMeta loadMappingMeta( StepWithMappingMeta executorMeta, Repository rep,
                                                        IMetaStore metaStore, VariableSpace space, boolean share ); static void activateParams( VariableSpace childVariableSpace, NamedParams childNamedParams, VariableSpace parent, String[] listParameters,
                                     String[] mappingVariables, String[] inputFields ); ObjectLocationSpecificationMethod getSpecificationMethod(); @Override ObjectLocationSpecificationMethod[] getSpecificationMethods(); void setSpecificationMethod( ObjectLocationSpecificationMethod specificationMethod ); String getDirectoryPath(); void setDirectoryPath( String directoryPath ); @Override String[] getDirectories(); @Override void setDirectories( String[] directories ); String getFileName(); void setFileName( String fileName ); void replaceFileName( String fileName ); String getTransName(); void setTransName( String transName ); ObjectId getTransObjectId(); void setTransObjectId( ObjectId transObjectId ); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions,
                                 ResourceNamingInterface resourceNamingInterface, Repository repository,
                                 IMetaStore metaStore ); static void addMissingVariables( VariableSpace fromSpace, VariableSpace toSpace ); static void replaceVariableValues( VariableSpace childTransMeta, VariableSpace replaceBy );  }