protected void printJobParameters( Job job ) throws UnknownParamException { if ( job != null && job.listParameters() != null ) { for ( String pName : job.listParameters() ) { printParameter( pName, job.getParameterValue( pName ), job.getParameterDefault( pName ), job.getParameterDescription( pName ) ); } } }
private void copyJobParameters( Job job, Map<String, String> params ) throws UnknownParamException { JobMeta jobMeta = job.getJobMeta(); // Also copy the parameters over... job.copyParametersFrom( jobMeta ); job.clearParameters(); String[] parameterNames = job.listParameters(); for ( String parameterName : parameterNames ) { // Grab the parameter value set in the job entry String thisValue = params.get( parameterName ); if ( !StringUtils.isBlank( thisValue ) ) { // Set the value as specified by the user in the job entry jobMeta.setParameterValue( parameterName, thisValue ); } } jobMeta.activateParameters(); }
@Before public void setUp() throws Exception { executor = StepMockUtil.getStep( JobExecutor.class, JobExecutorMeta.class, "TransExecutorUnitTest" ); executor = spy( executor ); executor.setInputRowMeta( mock( RowMetaInterface.class ) ); doNothing().when( executor ).discardLogLines( any( JobExecutorData.class ) ); meta = new JobExecutorMeta(); data = new JobExecutorData(); Job job = mock( Job.class ); doReturn( job ).when( executor ).createJob( any( Repository.class ), any( JobMeta.class ), any( LoggingObjectInterface.class ) ); doReturn( ArrayUtils.EMPTY_STRING_ARRAY ).when( job ).listParameters(); data.groupBuffer = new ArrayList<>(); data.groupSize = -1; data.groupTime = -1; data.groupField = null; }
public void activateParameters() { String[] keys = listParameters(); for ( String key : keys ) { String value; try { value = getParameterValue( key ); } catch ( UnknownParamException e ) { value = ""; } String defValue; try { defValue = getParameterDefault( key ); } catch ( UnknownParamException e ) { defValue = ""; } if ( Utils.isEmpty( value ) ) { setVariable( key, Const.NVL( defValue, "" ) ); } else { setVariable( key, Const.NVL( value, "" ) ); } } }
String[] parameterNames = job.listParameters(); for ( int idx = 0; idx < parameterNames.length; idx++ ) {
private void passParametersToJob() throws KettleException { // Set parameters, when fields are used take the first row in the set. // JobExecutorParameters parameters = meta.getParameters(); String value; for ( int i = 0; i < parameters.getVariable().length; i++ ) { String fieldName = parameters.getField()[i]; if ( !Utils.isEmpty( fieldName ) ) { int idx = getInputRowMeta().indexOfValue( fieldName ); if ( idx < 0 ) { throw new KettleException( BaseMessages.getString( PKG, "JobExecutor.Exception.UnableToFindField", fieldName ) ); } value = data.groupBuffer.get( 0 ).getString( idx, "" ); this.setVariable( parameters.getVariable()[ i ], value ); } } StepWithMappingMeta.activateParams( data.executorJob, data.executorJob, this, data.executorJob.listParameters(), parameters.getVariable(), parameters.getInput() ); }
String[] parameterNames = job.listParameters(); for ( int idx = 0; idx < parameterNames.length; idx++ ) {
String[] parentParameters = parentJob.listParameters(); for ( int idx = 0; idx < parentParameters.length; idx++ ) { String par = parentParameters[idx]; String[] parameterNames = job.listParameters(); for ( int idx = 0; idx < parameterNames.length; idx++ ) {