package eu.simstadt.nf4j; /** * The list of all possible export and import job states. * * @author Marcel Bruse */ public enum JobStatus { UNKNOWN(0), // A local NF4J code, may be set in rare cases, if synchronization with nF fails. LOCAL(10), // Job has not been sent yet and is known by the local system only. SENT(20), // Job has been sent or it is assumed that it has been set before. PENDING(30), // Export job has been enqueued and waits for execution READY_TO_RUN(31), // Same as PENDING, but for import jobs APPROVE(32), // (?) For import jobs only. Read the nF documentation, seams to be never used. RUNNING(40), // Job is running APPROVE_RUNNING(41), // (?) For import jobs only. Read the nF documentation, seams to be never used. FAILED(50), // Export job failed ERROR(51), // Same as FAILED, but for import jobs WARNING(52), // For import jobs only. There has been a minor problem REJECT(53), // (?) For import jobs only. Read the nF documentation, seams to be never used. REJECT_RUNNING(54), // (?) For import jobs only. Read the nF documentation, seams to be never used. APPROVE_REJECT_ERROR(55), // (?) For import jobs only. Read the nF documentation, seams to be never used. APPROVE_REJECT_OK(56), // (?) For import jobs only. Read the nF documentation, seams to be never used. IMPORTED_WARNING(57), // (?) For import jobs only. Read the nF documentation, seams to be never used. FINISHED(60), // Job finished DOWNLOAD(70); // Export jobs only. CityGML has been download to the local file system 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."; public static final String WAITING_MESSAGE = "Job is waiting for a response from the remote nF instance."; /** * 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 10: message = LOCAL_MESSAGE; break; case 20: message = SENT_MESSAGE; break; case 30: case 31: message = PENDING_MESSAGE; break; case 40: message = RUNNING_MESSAGE; break; case 50: case 51: message = FAILED_MESSAGE; break; case 60: 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; } }