Add method in ExecutionContext to expose the internal map as read-only

Resolves #4004
This commit is contained in:
sjh836
2021-09-15 03:52:32 +09:00
committed by Mahmoud Ben Hassine
parent d9bf57e572
commit 06e6bdbc98
3 changed files with 16 additions and 20 deletions

View File

@@ -82,11 +82,7 @@ public class JobContext extends SynchronizedAttributeAccessor {
* @return a map containing the items from the job {@link ExecutionContext}
*/
public Map<String, Object> getJobExecutionContext() {
Map<String, Object> result = new HashMap<>();
for (Entry<String, Object> entry : jobExecution.getExecutionContext().entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
return Collections.unmodifiableMap(result);
return jobExecution.getExecutionContext().toMap();
}
/**

View File

@@ -111,22 +111,14 @@ public class StepContext extends SynchronizedAttributeAccessor {
* @return a map containing the items from the step {@link ExecutionContext}
*/
public Map<String, Object> getStepExecutionContext() {
Map<String, Object> result = new HashMap<>();
for (Entry<String, Object> entry : stepExecution.getExecutionContext().entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
return Collections.unmodifiableMap(result);
return stepExecution.getExecutionContext().toMap();
}
/**
* @return a map containing the items from the job {@link ExecutionContext}
*/
public Map<String, Object> getJobExecutionContext() {
Map<String, Object> result = new HashMap<>();
for (Entry<String, Object> entry : stepExecution.getJobExecution().getExecutionContext().entrySet()) {
result.put(entry.getKey(), entry.getValue());
}
return Collections.unmodifiableMap(result);
return stepExecution.getJobExecution().getExecutionContext().toMap();
}
/**