]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.detached/src/main/java/org/argeo/slc/detached/DetachedAnswer.java
Move org.argeo.slc.detached
[gpl/argeo-slc.git] / runtime / org.argeo.slc.detached / src / main / java / org / argeo / slc / detached / DetachedAnswer.java
1 package org.argeo.slc.detached;
2
3 import java.util.Properties;
4
5 public class DetachedAnswer implements DetachedCommunication {
6 static final long serialVersionUID = 1l;
7
8 public final static int UNKOWN = -1;
9 public final static int PROCESSED = 0;
10 public final static int ERROR = 1;
11 public final static int SKIPPED = 2;
12 public final static int CLOSED_SESSION = 10;
13
14 private Properties properties = new Properties();
15 private int status = UNKOWN;
16 private String log;
17 private String uuid;
18
19 public DetachedAnswer() {
20
21 }
22
23 public DetachedAnswer(DetachedRequest request) {
24 uuid = request.getUuid();
25 }
26
27 public DetachedAnswer(DetachedRequest request, String message) {
28 this(request);
29 log = message;
30 status = PROCESSED;
31 }
32
33 public Properties getProperties() {
34 return properties;
35 }
36
37 public void setProperties(Properties outputParameters) {
38 this.properties = outputParameters;
39 }
40
41 public int getStatus() {
42 return status;
43 }
44
45 public void setStatus(int outputStatus) {
46 this.status = outputStatus;
47 }
48
49 public String getLog() {
50 return log;
51 }
52
53 public void setLog(String log) {
54 this.log = log;
55 }
56
57 public String getUuid() {
58 return uuid;
59 }
60
61 public void setUuid(String uuid) {
62 this.uuid = uuid;
63 }
64
65 public String getStatusAsString() {
66 return convertStatus(getStatus());
67 }
68
69 public static String convertStatus(int status) {
70 switch (status) {
71 case UNKOWN:
72 return "UNKOWN";
73 case PROCESSED:
74 return "PROCESSED";
75 case SKIPPED:
76 return "SKIPPED";
77 case ERROR:
78 return "ERROR";
79 case CLOSED_SESSION:
80 return "CLOSED_SESSION";
81 default:
82 throw new DetachedException("Unkown status " + status);
83 }
84 }
85 }