Add utility method to get identifying job parameters
This commit is contained in:
@@ -329,6 +329,21 @@ public class JobParameters implements Serializable {
|
||||
return Collections.unmodifiableMap(parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a map of identifying parameters.
|
||||
* @since 5.1
|
||||
* @return an unmodifiable map containing identifying parameters.
|
||||
*/
|
||||
public Map<String, JobParameter<?>> getIdentifyingParameters() {
|
||||
Map<String, JobParameter<?>> identifyingParameters = new HashMap<>();
|
||||
for (Map.Entry<String, JobParameter<?>> entry : this.parameters.entrySet()) {
|
||||
if (entry.getValue().isIdentifying()) {
|
||||
identifyingParameters.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
return Collections.unmodifiableMap(identifyingParameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@code true} if the parameters object is empty or {@code false} otherwise.
|
||||
*/
|
||||
|
||||
@@ -176,6 +176,9 @@ public class Jackson2ExecutionContextStringSerializer implements ExecutionContex
|
||||
@JsonIgnore
|
||||
abstract boolean isEmpty();
|
||||
|
||||
@JsonIgnore
|
||||
abstract Map<String, JobParameter<?>> getIdentifyingParameters();
|
||||
|
||||
}
|
||||
|
||||
private class JobParameterSerializer extends StdSerializer<JobParameter> {
|
||||
|
||||
Reference in New Issue
Block a user