*/
@Override
public JobParameters getJobParameters(Job job, StepExecution stepExecution) {
JobParametersBuilder builder = new JobParametersBuilder();
Map<String, JobParameter> jobParameters = stepExecution.getJobParameters().getParameters();
ExecutionContext executionContext = stepExecution.getExecutionContext();
if (useAllParentParameters) {
for (String key : jobParameters.keySet()) {
builder.addParameter(key, jobParameters.get(key));
}
}
for (String key : keys) {
if (key.endsWith("(long)")) {
key = key.replace("(long)", "");
if (executionContext.containsKey(key)) {
builder.addLong(key, executionContext.getLong(key));
}
else if (jobParameters.containsKey(key)) {
builder.addLong(key, (Long) jobParameters.get(key).getValue());
}
}
else if (key.endsWith("(int)")) {
key = key.replace("(int)", "");
if (executionContext.containsKey(key)) {
builder.addLong(key, (long) executionContext.getInt(key));
}
else if (jobParameters.containsKey(key)) {
builder.addLong(key, (Long) jobParameters.get(key).getValue());
}
}
else if (key.endsWith("(double)")) {
key = key.replace("(double)", "");
if (executionContext.containsKey(key)) {
builder.addDouble(key, executionContext.getDouble(key));
}
else if (jobParameters.containsKey(key)) {
builder.addDouble(key, (Double) jobParameters.get(key).getValue());
}
}
else if (key.endsWith("(string)")) {
key = key.replace("(string)", "");
if (executionContext.containsKey(key)) {
builder.addString(key, executionContext.getString(key));
}
else if (jobParameters.containsKey(key)) {
builder.addString(key, (String) jobParameters.get(key).getValue());
}
}
else if (key.endsWith("(date)")) {
key = key.replace("(date)", "");
if (executionContext.containsKey(key)) {
builder.addDate(key, (Date) executionContext.get(key));
}
else if (jobParameters.containsKey(key)) {
builder.addDate(key, (Date) jobParameters.get(key).getValue());
}
}
else {
if (executionContext.containsKey(key)) {
builder.addString(key, executionContext.get(key).toString());
}
else if (jobParameters.containsKey(key)) {
builder.addString(key, jobParameters.get(key).getValue().toString());
}
}