Enum BatchStatus

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

    public enum BatchStatus
    extends java.lang.Enum<BatchStatus>
    Enumeration representing the status of an Execution.
    Author:
    Lucas Ward, Dave Syer, Michael Minella, Mahmoud Ben Hassine
    • 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).
    • 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
      • 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