]>
git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecution.java
1 package org
.argeo
.slc
.process
;
3 import java
.io
.Serializable
;
4 import java
.util
.ArrayList
;
8 import java
.util
.TreeMap
;
10 public class SlcExecution
implements Serializable
{
11 private static final long serialVersionUID
= 1L;
12 public final static String STATUS_NONE
= "DEFAULT";
13 public final static String STATUS_SCHEDULED
= "SCHEDULED";
14 public final static String STATUS_RUNNING
= "RUNNING";
15 public final static String STATUS_FINISHED
= "FINISHED";
16 public final static String STATUS_ERROR
= "ERROR";
17 public final static String STATUS_CLEANED
= "CLEANED";
19 public final static String UNKOWN_HOST
= "UNKOWN_HOST";
25 private String status
= STATUS_NONE
;
26 private Map
<String
, String
> attributes
= new TreeMap
<String
, String
>();
28 /** TODO: Synchronize */
29 private List
<SlcExecutionStep
> steps
= new ArrayList
<SlcExecutionStep
>();
30 private List
<RealizedFlow
> realizedFlows
= new ArrayList
<RealizedFlow
>();
32 /** Attachment uuid. */
33 private String realizedFlowsXml
= null;
35 public List
<RealizedFlow
> getRealizedFlows() {
39 public void setRealizedFlows(List
<RealizedFlow
> realizedFlows
) {
40 this.realizedFlows
= realizedFlows
;
43 public List
<SlcExecutionStep
> getSteps() {
47 public void setSteps(List
<SlcExecutionStep
> steps
) {
51 public String
getUuid() {
55 public void setUuid(String uuid
) {
59 public String
getHost() {
63 public void setHost(String host
) {
67 public String
getUser() {
71 public void setUser(String user
) {
75 public String
getType() {
79 public void setType(String type
) {
83 public String
getStatus() {
87 public void setStatus(String status
) {
91 public SlcExecutionStep
currentStep() {
92 synchronized (steps
) {
94 return steps
.get(steps
.size() - 1);
101 public boolean equals(Object obj
) {
102 if (obj
instanceof SlcExecution
) {
103 return getUuid().equals(((SlcExecution
) obj
).getUuid());
109 public int hashCode() {
110 return getUuid().hashCode();
113 public Map
<String
, String
> getAttributes() {
117 public void setAttributes(Map
<String
, String
> attributes
) {
118 this.attributes
= attributes
;
121 public String
toString() {
122 StringBuffer buf
= new StringBuffer(getClass().getSimpleName());
123 buf
.append('#').append(uuid
);
124 buf
.append(" status=").append(status
);
125 buf
.append(" attributes=").append(attributes
);
126 return buf
.toString();
129 public Date
getStartDate() {
130 synchronized (steps
) {
131 if (steps
.size() == 0)
134 return steps
.get(0).getBegin();
138 public Date
getEndDate() {
139 if (!status
.equals(STATUS_FINISHED
) && !status
.equals(STATUS_ERROR
))
142 synchronized (steps
) {
143 if (steps
.size() == 0)
146 return steps
.get(steps
.size() - 1).getBegin();
151 * Not (yet) a stable API, should not be relied upon!
153 * @return an id or an url allowing to retrieve the XML, not the XML itself!
155 public String
getRealizedFlowsXml() {
156 return realizedFlowsXml
;
159 /** Not (yet) a stable API, should not be relied upon! */
160 public void setRealizedFlowsXml(String realizedFlowsXml
) {
161 this.realizedFlowsXml
= realizedFlowsXml
;