JAL-3878 Move status precedence list to JobStatus class
[jalview.git] / src / jalview / ws2 / api / JobStatus.java
index 0334737..3341a69 100644 (file)
@@ -49,4 +49,23 @@ public enum JobStatus
       throw new AssertionError("non-exhaustive switch statement");
     }
   }
+
+  /**
+   * A precedence order of job statuses used to compute the overall task status.
+   */
+  public static final JobStatus[] statusPrecedence = {
+      JobStatus.INVALID, // all must be invalid for task to be invalid
+      JobStatus.COMPLETED, // all but invalid must be completed for task to be
+                           // completed
+      JobStatus.UNKNOWN, // unknown prevents successful completion but not
+                         // running or failure
+      JobStatus.READY,
+      JobStatus.SUBMITTED,
+      JobStatus.QUEUED,
+      JobStatus.RUNNING,
+      JobStatus.CANCELLED, // if any is terminated unsuccessfully, the task is
+                           // failed
+      JobStatus.FAILED,
+      JobStatus.SERVER_ERROR
+  };
 }