org.springframework.batch.core.jsr.job.flow.support.state

## Class JsrEndState

- java.lang.Object
- - org.springframework.batch.core.job.flow.support.state.AbstractState
  - - org.springframework.batch.core.job.flow.support.state.EndState
    - - org.springframework.batch.core.jsr.job.flow.support.state.JsrEndState

- All Implemented Interfaces:
    State

      public class JsrEndState
      extends EndState

  `State` implementation for ending a job per JSR-352 rules if it is in progress and continuing if just starting.
  Since:
    3.0
  Author:
    Michael Minella

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JsrEndState(FlowExecutionStatus status, java.lang.String name)`
    `JsrEndState(FlowExecutionStatus status, java.lang.String code, java.lang.String name)`
    `JsrEndState(FlowExecutionStatus status, java.lang.String code, java.lang.String name, boolean abandon)`
    `JsrEndState(FlowExecutionStatus status, java.lang.String code, java.lang.String name, java.lang.String restart, boolean abandon, JobRepository jobRepository)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `FlowExecutionStatus` | `handle(FlowExecutor executor)` Return the `FlowExecutionStatus` stored.
    `protected void` | `setExitStatus(FlowExecutor executor, java.lang.String code)` Performs any logic to update the exit status for the current flow.

    - ### Methods inherited from class org.springframework.batch.core.job.flow.support.state.EndState

      `getCode, getStatus, isAbandon, isEndState, toString`

    - ### Methods inherited from class org.springframework.batch.core.job.flow.support.state.AbstractState

      `getName`

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

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

- - ### Constructor Detail

    - #### JsrEndState

          public JsrEndState(FlowExecutionStatus status,
                             java.lang.String name)

      Parameters:
        `status` - The `FlowExecutionStatus` to end with
        `name` - The name of the state

    - #### JsrEndState

          public JsrEndState(FlowExecutionStatus status,
                             java.lang.String code,
                             java.lang.String name)

      Parameters:
        `status` - The `FlowExecutionStatus` to end with
        `name` - The name of the state
        `code` - the exit status.

    - #### JsrEndState

          public JsrEndState(FlowExecutionStatus status,
                             java.lang.String code,
                             java.lang.String name,
                             boolean abandon)

      Parameters:
        `status` - The `FlowExecutionStatus` to end with
        `name` - The name of the state
        `abandon` - flag to indicate that previous step execution can be marked as abandoned (if there is one)
        `code` - the exit status.

    - #### JsrEndState

          public JsrEndState(FlowExecutionStatus status,
                             java.lang.String code,
                             java.lang.String name,
                             java.lang.String restart,
                             boolean abandon,
                             JobRepository jobRepository)

  - ### Method Detail

    - #### handle

          public FlowExecutionStatus handle(FlowExecutor executor)
                                     throws java.lang.Exception

      Description copied from class: `EndState`
      Return the `FlowExecutionStatus` stored.
      Specified by:
        `handle` in interface `State`
      Overrides:
        `handle` in class `EndState`
      Parameters:
        `executor` - the context passed in by the caller
      Returns:
        a status for the execution
      Throws:
        `java.lang.Exception` - if anything goes wrong
      See Also:
        `State.handle(FlowExecutor)`

    - #### setExitStatus

          protected void setExitStatus(FlowExecutor executor,
                                       java.lang.String code)

      Description copied from class: `EndState`
      Performs any logic to update the exit status for the current flow.
      Overrides:
        `setExitStatus` in class `EndState`
      Parameters:
        `executor` - `FlowExecutor` for the current flow
        `code` - The exit status to save