dk.netarkivet.harvester.datamodel
Enum JobStatus

java.lang.Object
  extended by java.lang.Enum<JobStatus>
      extended by dk.netarkivet.harvester.datamodel.JobStatus
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<JobStatus>

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

Enumeration of the possible states (alt.: status) a Job can be in.


Enum Constant Summary
DONE
          Job status done is used for a job that a harvester has successfully finished.
FAILED
          Job status failed is used for a job that has failed to execute correctly.
FAILED_REJECTED
          Job status for a job which has failed and which has been rejected for resubmission.
NEW
          Job status new is used for a job that has been created but not yet sent to a JMS queue.
RESUBMITTED
          Job status resubmitted is used for a job that had failed and a new job with this jobs data has been submitted.
STARTED
          Job status started is used for a job that a harvester has started.
SUBMITTED
          Job status submitted is used for a job that has been sent to a JMS queue, but not yet picked up by a harvester.
 
Field Summary
static int ALL_STATUS_CODE
          Constant representing ALL states.
static java.lang.String JOBSTATUS_DONE_KEY
          Localization key for the DONE JobStatus.
static java.lang.String JOBSTATUS_FAILED_KEY
          Localization key for the FAILED JobStatus.
static java.lang.String JOBSTATUS_FAILED_REJECTED_KEY
          Localization key for a JobStatus FAILED_REJECTED
static java.lang.String JOBSTATUS_NEW_KEY
          Localization key for the NEW JobStatus.
static java.lang.String JOBSTATUS_RESUBMITTED_KEY
          Localization key for the RESUBMITTED JobStatus.
static java.lang.String JOBSTATUS_STARTED_KEY
          Localization key for the STARTED JobStatus.
static java.lang.String JOBSTATUS_SUBMITTED_KEY
          Localization key for the SUBMITTED JobStatus.
static java.lang.String JOBSTATUS_UNKNOWN_KEY
          Localization key for a unknown JobStatus.
 
Method Summary
static JobStatus fromOrdinal(int status)
          Helper method that gives a proper object from e.g.
 java.lang.String getLocalizedString(java.util.Locale l)
          Return a localized human-readable string describing this status.
 boolean legalChange(JobStatus newStatus)
          True if it is legal to change from this status to a new status.
static JobStatus parse(java.lang.String status)
          Helper method that gives a proper object from e.g.
static JobStatus valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static JobStatus[] 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

NEW

public static final JobStatus NEW
Job status new is used for a job that has been created but not yet sent to a JMS queue.


SUBMITTED

public static final JobStatus SUBMITTED
Job status submitted is used for a job that has been sent to a JMS queue, but not yet picked up by a harvester.


STARTED

public static final JobStatus STARTED
Job status started is used for a job that a harvester has started.


DONE

public static final JobStatus DONE
Job status done is used for a job that a harvester has successfully finished.


FAILED

public static final JobStatus FAILED
Job status failed is used for a job that has failed to execute correctly.


RESUBMITTED

public static final JobStatus RESUBMITTED
Job status resubmitted is used for a job that had failed and a new job with this jobs data has been submitted.


FAILED_REJECTED

public static final JobStatus FAILED_REJECTED
Job status for a job which has failed and which has been rejected for resubmission. A Job in this status can be returned to status FAILED if it has been rejected in error.

Field Detail

ALL_STATUS_CODE

public static final int ALL_STATUS_CODE
Constant representing ALL states.

See Also:
Constant Field Values

JOBSTATUS_NEW_KEY

public static java.lang.String JOBSTATUS_NEW_KEY
Localization key for the NEW JobStatus.


JOBSTATUS_SUBMITTED_KEY

public static java.lang.String JOBSTATUS_SUBMITTED_KEY
Localization key for the SUBMITTED JobStatus.


JOBSTATUS_STARTED_KEY

public static java.lang.String JOBSTATUS_STARTED_KEY
Localization key for the STARTED JobStatus.


JOBSTATUS_DONE_KEY

public static java.lang.String JOBSTATUS_DONE_KEY
Localization key for the DONE JobStatus.


JOBSTATUS_FAILED_KEY

public static java.lang.String JOBSTATUS_FAILED_KEY
Localization key for the FAILED JobStatus.


JOBSTATUS_RESUBMITTED_KEY

public static java.lang.String JOBSTATUS_RESUBMITTED_KEY
Localization key for the RESUBMITTED JobStatus.


JOBSTATUS_UNKNOWN_KEY

public static java.lang.String JOBSTATUS_UNKNOWN_KEY
Localization key for a unknown JobStatus.


JOBSTATUS_FAILED_REJECTED_KEY

public static java.lang.String JOBSTATUS_FAILED_REJECTED_KEY
Localization key for a JobStatus FAILED_REJECTED

Method Detail

values

public static JobStatus[] 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 (JobStatus c : JobStatus.values())
    System.out.println(c);

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

valueOf

public static JobStatus 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

fromOrdinal

public static JobStatus fromOrdinal(int status)
Helper method that gives a proper object from e.g. a DB-stored value.

Parameters:
status - a certain integer
Returns:
the JobStatus related to a certain integer
Throws:
ArgumentNotValid

parse

public static JobStatus parse(java.lang.String status)
Helper method that gives a proper object from e.g. a DB-stored value.

Parameters:
status - a status string
Returns:
the JobStatus related to a string
Throws:
ArgumentNotValid

getLocalizedString

public java.lang.String getLocalizedString(java.util.Locale l)
Return a localized human-readable string describing this status. Strings are read from the harvester translation bundle found in Translation.properties in this module.

Parameters:
l - The locale
Returns:
A human readable string for that locale.
Throws:
ArgumentNotValid - on null locale.

legalChange

public boolean legalChange(JobStatus newStatus)
True if it is legal to change from this status to a new status.

Parameters:
newStatus - a new JobStatus
Returns:
true if it is legal to go from the current status to this new status