Partly working security: registration form, authorisaztion, simple authentication
[proteocache.git] / engine / compbio / engine / JobStatus.java
diff --git a/engine/compbio/engine/JobStatus.java b/engine/compbio/engine/JobStatus.java
new file mode 100644 (file)
index 0000000..393f401
--- /dev/null
@@ -0,0 +1,40 @@
+package compbio.engine;
+
+import java.util.Set;
+
+/**
+ * List of all posible final job statuses
+ * 
+ */
+public enum JobStatus {
+       OK, TIMEDOUT, STOPPED, JPREDERROR;
+
+       public static JobStatus getJobStatus(String status) {
+               status = status.trim().toLowerCase();
+               for (JobStatus st : JobStatus.values()) {
+                       if (st.toString().equalsIgnoreCase(status)) {
+                               return st;
+                       }
+               }
+               return null;
+       }
+
+       public static String toString(Set<JobStatus> statuses) {
+               if (statuses == null || statuses.isEmpty()) {
+                       return "No known services...\n";
+               }
+               String value = "";
+               for (JobStatus st : statuses) {
+                       if (null != st) {
+                               value += st + "\n";
+                       } else {
+                               value += "Unknown Job Status\n";
+                       }
+               }
+               return value;
+       }
+
+       public static void main(String[] args) {
+               System.out.println(OK);
+       }
+}