class FlowJob extends AbstractJob {

	protected Flow flow;

	private final Map<String, Step> stepMap = new ConcurrentHashMap<>();

	private volatile boolean initialized = false;

	/**
	 * Create a {@link FlowJob} with null name and no flow (invalid state).
	 */
	public FlowJob() {
		super();
	}

	/**
	 * Create a {@link FlowJob} with provided name and no flow (invalid state).
	 * @param name the name to be associated with the FlowJob.
	 */
	public FlowJob(String name) {
		super(name);
	}

	/**
	 * Public setter for the flow.
	 * @param flow the flow to set
	 */
	public void setFlow(Flow flow) {
		this.flow = flow;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public Step getStep(String stepName) {
		if (!initialized) {
			init();
		}
		return stepMap.get(stepName);
	}

	/**
	 * Initialize the step names
	 */
	private void init() {
		findSteps(flow, stepMap);
		initialized = true;
	}

	private void findSteps(Flow flow, Map<String, Step> map) {

		for (State state : flow.getStates()) {
			if (state instanceof StepLocator locator) {
				for (String name : locator.getStepNames()) {
					map.put(name, locator.getStep(name));
				}
			}
			else if (state instanceof StepHolder) {
				Step step = ((StepHolder) state).getStep();
				String name = step.getName();
				stepMap.put(name, step);
			}
			else if (state instanceof FlowHolder) {
				for (Flow subflow : ((FlowHolder) state).getFlows()) {
					findSteps(subflow, map);
				}
			}
		}

	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public Collection<String> getStepNames() {
		if (!initialized) {
			init();
		}
		return stepMap.keySet();
	}

	/**
	 * @see AbstractJob#doExecute(JobExecution)
	 */
	@Override
	protected void doExecute(final JobExecution execution) throws JobExecutionException {<FILL_FUNCTION_BODY>}

}

		try {
			JobFlowExecutor executor = new JobFlowExecutor(getJobRepository(),
					new SimpleStepHandler(getJobRepository()), execution);
			executor.updateJobExecutionStatus(flow.start(executor).getStatus());
		}
		catch (FlowExecutionException e) {
			if (e.getCause() instanceof JobExecutionException) {
				throw (JobExecutionException) e.getCause();
			}
			throw new JobExecutionException("Flow execution ended unexpectedly", e);
		}
	
<methods>public void <init>() ,public void <init>(java.lang.String) ,public void afterPropertiesSet() throws java.lang.Exception,public final void execute(org.springframework.batch.core.JobExecution) ,public org.springframework.batch.core.JobParametersIncrementer getJobParametersIncrementer() ,public org.springframework.batch.core.JobParametersValidator getJobParametersValidator() ,public java.lang.String getName() ,public abstract org.springframework.batch.core.Step getStep(java.lang.String) ,public abstract Collection<java.lang.String> getStepNames() ,public boolean isRestartable() ,public void registerJobExecutionListener(org.springframework.batch.core.JobExecutionListener) ,public void setBeanName(java.lang.String) ,public void setJobExecutionListeners(org.springframework.batch.core.JobExecutionListener[]) ,public void setJobParametersIncrementer(org.springframework.batch.core.JobParametersIncrementer) ,public void setJobParametersValidator(org.springframework.batch.core.JobParametersValidator) ,public void setJobRepository(org.springframework.batch.core.repository.JobRepository) ,public void setMeterRegistry(io.micrometer.core.instrument.MeterRegistry) ,public void setName(java.lang.String) ,public void setObservationConvention(org.springframework.batch.core.observability.BatchJobObservationConvention) ,public void setObservationRegistry(io.micrometer.observation.ObservationRegistry) ,public void setRestartable(boolean) ,public java.lang.String toString() <variables>private org.springframework.batch.core.JobParametersIncrementer jobParametersIncrementer,private org.springframework.batch.core.JobParametersValidator jobParametersValidator,private org.springframework.batch.core.repository.JobRepository jobRepository,private final org.springframework.batch.core.listener.CompositeJobExecutionListener listener,protected static final org.apache.commons.logging.Log logger,private io.micrometer.core.instrument.MeterRegistry meterRegistry,private java.lang.String name,private org.springframework.batch.core.observability.BatchJobObservationConvention observationConvention,private io.micrometer.observation.ObservationRegistry observationRegistry,private boolean restartable,private org.springframework.batch.core.job.StepHandler stepHandler