package eu.simstadt.nf; /** * The list of all possible export and import job states. * * @author Marcel Bruse */ public enum JobStatus { UNKOWN(0), PENDING(1), RUNNING(2), FAILED(3), FINISHED(4), READY_TO_RUN(5), ERROR(6), WARNING(7), APPROVE(8), REJECT(9), APPROVE_RUNNING(10), REJECT_RUNNING(11), APPROVE_REJECT_ERROR(12), APPROVE_REJECT_OK(13), IMPORTED_WARNING(14); public static final String UNKNOWN_STATUS_MESSAGE = "The state of the job is unknown."; public static final String PENDING_MESSAGE = "Job is pending."; public static final String RUNNING_MESSAGE = "Job is running."; public static final String FAILED_MESSAGE = "Job failed."; public static final String FINISHED_MESSAGE = "Job is finished."; /** * This constructor sets messages for some states. * * @param internalCode Our numerical SimStadt-internal code for the nF status codes. */ private JobStatus(int internalCode) { switch (internalCode) { case 0: message = UNKNOWN_STATUS_MESSAGE; break; case 1: case 5: message = PENDING_MESSAGE; break; case 2: message = RUNNING_MESSAGE; break; case 3: case 6: message = FAILED_MESSAGE; break; case 4: message = FINISHED_MESSAGE; break; default: message = ""; } } /** * This message describes the status or gives hints about error states. This message may come from a * nF response. */ private String message; /** * Sets a message for this status in order to describe the status. * * @param message A message to describe this status. */ public void setMessage(String message) { this.message = message; } /** * @return Returns a message which describes this status. */ public String getMessage() { return message; } }