package eu.simstadt.nf4j; /** * The list of all possible export and import job states. * * @author Marcel Bruse */ public enum JobStatus { UNKOWN(0), LOCAL(1), SENT(2), PENDING(3), RUNNING(4), FAILED(5), FINISHED(6), READY_TO_RUN(7), ERROR(8), WARNING(9), APPROVE(10), REJECT(11), APPROVE_RUNNING(12), REJECT_RUNNING(13), APPROVE_REJECT_ERROR(14), APPROVE_REJECT_OK(15), IMPORTED_WARNING(16); public static final String UNKNOWN_MESSAGE = "The state of the job is unknown."; public static final String LOCAL_MESSAGE = "The job is known locally only. It has not been sent yet."; public static final String SENT_MESSAGE = "The job has been sent, is enqueued at the nF and has a job id."; 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_MESSAGE; break; case 1: message = LOCAL_MESSAGE; break; case 2: message = SENT_MESSAGE; break; case 3: case 7: message = PENDING_MESSAGE; break; case 4: message = RUNNING_MESSAGE; break; case 5: case 8: message = FAILED_MESSAGE; break; case 6: 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; } }