protected State nextState(String stateName, FlowExecutionStatus status, StepExecution stepExecution) throws FlowExecutionException {
State nextState = findState(stateName, status, stepExecution);
if(stepExecution != null) {
ExecutionContext executionContext = stepExecution.getJobExecution().getExecutionContext();
if(executionContext.containsKey("batch.stoppedStep")) {
String stepName = executionContext.getString("batch.stoppedStep");
if(stateName.endsWith(stepName)) {
if(nextState != null && executionContext.containsKey("batch.restartStep") && StringUtils.hasText(executionContext.getString("batch.restartStep"))) {
nextState = findState(stateName, new FlowExecutionStatus(status.getName() + ".RESTART"), stepExecution);