org.springframework.batch.core.job

## Class SimpleJob

- java.lang.Object
- - org.springframework.batch.core.job.AbstractJob
  - - org.springframework.batch.core.job.SimpleJob

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

      public class SimpleJob
      extends AbstractJob

  Simple implementation of `Job` interface providing the ability to run a `JobExecution`. Sequentially executes a job by iterating through its list of steps. Any `Step` that fails will fail the job. The job is considered complete when all steps have been executed.
  Author:
    Lucas Ward, Dave Syer, Michael Minella

- - ### Field Summary

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

      `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleJob()` Default constructor for job with null name
    `SimpleJob(java.lang.String name)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addStep(Step step)` Convenience method for adding a single step to the job.
    `protected void` | `doExecute(JobExecution execution)` Handler of steps sequentially as provided, checking each one for success before moving to the next.
    `Step` | `getStep(java.lang.String stepName)` Retrieve the step with the given name.
    `java.util.Collection<java.lang.String>` | `getStepNames()` Convenience method for clients to inspect the steps for this job.
    `void` | `setSteps(java.util.List<Step> steps)` Public setter for the steps in this job.

    - ### 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`

- - ### Constructor Detail

    - #### SimpleJob

          public SimpleJob()

      Default constructor for job with null name

    - #### SimpleJob

          public SimpleJob(java.lang.String name)

      Parameters:
        `name` -

  - ### Method Detail

    - #### setSteps

          public void setSteps(java.util.List<Step> steps)

      Public setter for the steps in this job. Overrides any calls to `addStep(Step)`.
      Parameters:
        `steps` - the steps to execute

    - #### getStepNames

          public java.util.Collection<java.lang.String> getStepNames()

      Convenience method for clients to inspect the steps for this job.
      Specified by:
        `getStepNames` in interface `StepLocator`
      Specified by:
        `getStepNames` in class `AbstractJob`
      Returns:
        the step names for this job

    - #### addStep

          public void addStep(Step step)

      Convenience method for adding a single step to the job.
      Parameters:
        `step` - a `Step` to add

    - #### getStep

          public Step getStep(java.lang.String stepName)

      Description copied from class: `AbstractJob`
      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`
      Returns:
        the Step

    - #### doExecute

          protected void doExecute(JobExecution execution)
                            throws JobInterruptedException,
                                   JobRestartException,
                                   StartLimitExceededException

      Handler of steps sequentially as provided, checking each one for success before moving to the next. Returns the last `StepExecution` successfully processed if it exists, and null if none were processed.
      Specified by:
        `doExecute` in class `AbstractJob`
      Parameters:
        `execution` - the current `JobExecution`
      Throws:
        `JobInterruptedException`
        `JobRestartException`
        `StartLimitExceededException`
      See Also:
        `AbstractJob.handleStep(Step, JobExecution)`