]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.detached/src/main/java/org/argeo/slc/detached/DetachedAnswer.java
Use Equinox and Spring OSGi for SLC Detached
[gpl/argeo-slc.git] / org.argeo.slc.detached / src / main / java / org / argeo / slc / detached / DetachedAnswer.java
index 582703786263bac6eb4cf43f89ab833eed64a807..55789a04696f0b3d1b6a92694547aacc222938e5 100644 (file)
@@ -5,11 +5,11 @@ import java.util.Properties;
 public class DetachedAnswer implements DetachedCommunication {
        static final long serialVersionUID = 1l;
 
-       public static int UNKOWN = -1;
-       public static int PROCESSED = 0;
-       public static int ERROR = 1;
-       public static int SKIPPED = 2;
-       public static int CLOSED_SESSION = 10;
+       public final static int UNKOWN = -1;
+       public final static int PROCESSED = 0;
+       public final static int ERROR = 1;
+       public final static int SKIPPED = 2;
+       public final static int CLOSED_SESSION = 10;
 
        private Properties properties = new Properties();
        private int status = UNKOWN;
@@ -58,4 +58,28 @@ public class DetachedAnswer implements DetachedCommunication {
                return uuid;
        }
 
+       public void setUuid(String uuid) {
+               this.uuid = uuid;
+       }
+
+       public String getStatusAsString() {
+               return convertStatus(getStatus());
+       }
+
+       public static String convertStatus(int status) {
+               switch (status) {
+               case UNKOWN:
+                       return "UNKOWN";
+               case PROCESSED:
+                       return "PROCESSED";
+               case SKIPPED:
+                       return "SKIPPED";
+               case ERROR:
+                       return "ERROR";
+               case CLOSED_SESSION:
+                       return "CLOSED_SESSION";
+               default:
+                       throw new DetachedException("Unkown status " + status);
+               }
+       }
 }