org.springframework.batch.core

## Enum BatchStatus

- java.lang.Object
- - java.lang.Enum<BatchStatus>
  - - org.springframework.batch.core.BatchStatus

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<BatchStatus>

      public enum BatchStatus
      extends java.lang.Enum<BatchStatus>

  Enumeration representing the status of a an Execution.
  Author:
    Lucas Ward, Dave Syer, Michael Minella

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `ABANDONED`
    `COMPLETED` The order of the status values is significant because it can be used to aggregate a set of status values - the result should be the maximum value.
    `FAILED`
    `STARTED`
    `STARTING`
    `STOPPED`
    `STOPPING`
    `UNKNOWN`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `javax.batch.runtime.BatchStatus` | `getBatchStatus()` Converts the current status to the JSR-352 equivalent
    `boolean` | `isGreaterThan(BatchStatus other)`
    `boolean` | `isLessThan(BatchStatus other)`
    `boolean` | `isLessThanOrEqualTo(BatchStatus other)`
    `boolean` | `isRunning()` Convenience method to decide if a status indicates work is in progress.
    `boolean` | `isUnsuccessful()` Convenience method to decide if a status indicates execution was unsuccessful.
    `static BatchStatus` | `match(java.lang.String value)` Find a BatchStatus that matches the beginning of the given value.
    `static BatchStatus` | `max(BatchStatus status1, BatchStatus status2)`
    `BatchStatus` | `upgradeTo(BatchStatus other)` Method used to move status values through their logical progression, and override less severe failures with more severe ones.
    `static BatchStatus` | `valueOf(java.lang.String name)` Returns the enum constant of this type with the specified name.
    `static BatchStatus[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

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

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

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

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### COMPLETED

          public static final BatchStatus COMPLETED

      The order of the status values is significant because it can be used to aggregate a set of status values - the result should be the maximum value. Since COMPLETED is first in the order, only if all elements of an execution are COMPLETED will the aggregate status be COMPLETED. A running execution is expected to move from STARTING to STARTED to COMPLETED (through the order defined by `upgradeTo(BatchStatus)`). Higher values than STARTED signify more serious failure. ABANDONED is used for steps that have finished processing, but were not successful, and where they should be skipped on a restart (so FAILED is the wrong status).

    - #### STARTING

          public static final BatchStatus STARTING

    - #### STARTED

          public static final BatchStatus STARTED

    - #### STOPPING

          public static final BatchStatus STOPPING

    - #### STOPPED

          public static final BatchStatus STOPPED

    - #### FAILED

          public static final BatchStatus FAILED

    - #### ABANDONED

          public static final BatchStatus ABANDONED

    - #### UNKNOWN

          public static final BatchStatus UNKNOWN

  - ### Method Detail

    - #### values

          public static BatchStatus[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (BatchStatus c : BatchStatus.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static BatchStatus valueOf(java.lang.String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `java.lang.IllegalArgumentException` - if this enum type has no constant with the specified name
        `java.lang.NullPointerException` - if the argument is null

    - #### max

          public static BatchStatus max(BatchStatus status1,
                                        BatchStatus status2)

    - #### isRunning

          public boolean isRunning()

      Convenience method to decide if a status indicates work is in progress.
      Returns:
        true if the status is STARTING, STARTED

    - #### isUnsuccessful

          public boolean isUnsuccessful()

      Convenience method to decide if a status indicates execution was unsuccessful.
      Returns:
        true if the status is FAILED or greater

    - #### upgradeTo

          public BatchStatus upgradeTo(BatchStatus other)

      Method used to move status values through their logical progression, and override less severe failures with more severe ones. This value is compared with the parameter and the one that has higher priority is returned. If both are STARTED or less than the value returned is the largest in the sequence STARTING, STARTED, COMPLETED. Otherwise the value returned is the maximum of the two.
      Parameters:
        `other` - another status to compare to
      Returns:
        either this or the other status depending on their priority

    - #### isGreaterThan

          public boolean isGreaterThan(BatchStatus other)

      Parameters:
        `other` - a status value to compare
      Returns:
        true if this is greater than other

    - #### isLessThan

          public boolean isLessThan(BatchStatus other)

      Parameters:
        `other` - a status value to compare
      Returns:
        true if this is less than other

    - #### isLessThanOrEqualTo

          public boolean isLessThanOrEqualTo(BatchStatus other)

      Parameters:
        `other` - a status value to compare
      Returns:
        true if this is less than other

    - #### getBatchStatus

          public javax.batch.runtime.BatchStatus getBatchStatus()

      Converts the current status to the JSR-352 equivalent
      Returns:
        JSR-352 equivalent to the current status

    - #### match

          public static BatchStatus match(java.lang.String value)

      Find a BatchStatus that matches the beginning of the given value. If no match is found, return COMPLETED as the default because has is low precedence.
      Parameters:
        `value` - a string representing a status
      Returns:
        a BatchStatus