Package org.springframework.batch.core.job.flow

# Class FlowJob

java.lang.Object
org.springframework.batch.core.job.AbstractJob
org.springframework.batch.core.job.flow.FlowJob

All Implemented Interfaces:
  `Job`, `StepLocator`, `org.springframework.beans.factory.Aware`, `org.springframework.beans.factory.BeanNameAware`, `org.springframework.beans.factory.InitializingBean`

public class FlowJob extends AbstractJob
Implementation of the `Job` interface that allows for complex flows of steps, rather than requiring sequential execution. In general, this job implementation was designed to be used behind a parser, allowing for a namespace to abstract away details.

Since:
  2.0
Author:
  Dave Syer, Mahmoud Ben Hassine

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Flow`
  `flow`

  ### Fields inherited from class org.springframework.batch.core.job.AbstractJob

  `logger`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FlowJob()`
  Create a `FlowJob` with null name and no flow (invalid state).
  `FlowJob(String name)`
  Create a `FlowJob` with provided name and no flow (invalid state).

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `doExecute(JobExecution execution)`
  Extension point for subclasses allowing them to concentrate on processing logic and ignore listeners and repository calls.
  `Step`
  `getStep(String stepName)`
  Retrieve the step with the given name.
  `Collection<String>`
  `getStepNames()`
  Retrieve the step names.
  `void`
  `setFlow(Flow flow)`
  Public setter for the flow.

  ### Methods inherited from class org.springframework.batch.core.job.AbstractJob

  `afterPropertiesSet, execute, getDefaultExitStatusForFailure, getJobParametersIncrementer, getJobParametersValidator, getJobRepository, getName, handleStep, isRestartable, registerJobExecutionListener, setBeanName, setJobExecutionListeners, setJobParametersIncrementer, setJobParametersValidator, setJobRepository, setName, setRestartable, toString`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### flow

    protected Flow flow

- ## Constructor Details

  - ### FlowJob

    public FlowJob()
    Create a `FlowJob` with null name and no flow (invalid state).

  - ### FlowJob

    public FlowJob(String name)
    Create a `FlowJob` with provided name and no flow (invalid state).
    Parameters:
      `name` - the name to be associated with the FlowJob.

- ## Method Details

  - ### setFlow

    public void setFlow(Flow flow)
    Public setter for the flow.
    Parameters:
      `flow` - the flow to set

  - ### getStep

    public Step getStep(String stepName)
    Retrieve the step with the given name. If there is no Step with the given name, then return null.
    Specified by:
      `getStep` in interface `StepLocator`
    Specified by:
      `getStep` in class `AbstractJob`
    Parameters:
      `stepName` - name of the step
    Returns:
      the Step

  - ### getStepNames

    public Collection<String> getStepNames()
    Retrieve the step names.
    Specified by:
      `getStepNames` in interface `StepLocator`
    Specified by:
      `getStepNames` in class `AbstractJob`
    Returns:
      the step names

  - ### doExecute

    protected void doExecute(JobExecution execution) throws JobExecutionException
    Description copied from class: `AbstractJob`
    Extension point for subclasses allowing them to concentrate on processing logic and ignore listeners and repository calls. Implementations usually are concerned with the ordering of steps, and delegate actual step processing to `AbstractJob.handleStep(Step, JobExecution)`.
    Specified by:
      `doExecute` in class `AbstractJob`
    Parameters:
      `execution` - the current `JobExecution`
    Throws:
      `JobExecutionException` - to signal a fatal batch framework error (not a business or validation exception)
    See Also:
      - `AbstractJob.doExecute(JobExecution)`