]>
git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecution.java
7a81facf612b1c6529ef8a2fdd825d4c9057ef17
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 public List
<RealizedFlow
> getRealizedFlows() {
36 public void setRealizedFlows(List
<RealizedFlow
> realizedFlows
) {
37 this.realizedFlows
= realizedFlows
;
40 public List
<SlcExecutionStep
> getSteps() {
44 public void setSteps(List
<SlcExecutionStep
> steps
) {
48 public String
getUuid() {
52 public void setUuid(String uuid
) {
56 public String
getHost() {
60 public void setHost(String host
) {
64 public String
getUser() {
68 public void setUser(String user
) {
72 public String
getType() {
76 public void setType(String type
) {
80 public String
getStatus() {
84 public void setStatus(String status
) {
88 public SlcExecutionStep
currentStep() {
89 synchronized (steps
) {
91 return steps
.get(steps
.size() - 1);
98 public boolean equals(Object obj
) {
99 if (obj
instanceof SlcExecution
) {
100 return getUuid().equals(((SlcExecution
) obj
).getUuid());
106 public int hashCode() {
107 return getUuid().hashCode();
110 public Map
<String
, String
> getAttributes() {
114 public void setAttributes(Map
<String
, String
> attributes
) {
115 this.attributes
= attributes
;
118 public String
toString() {
119 StringBuffer buf
= new StringBuffer(getClass().getSimpleName());
120 buf
.append('#').append(uuid
);
121 buf
.append(" status=").append(status
);
122 buf
.append(" attributes=").append(attributes
);
123 return buf
.toString();
126 public Date
getStartDate() {
127 synchronized (steps
) {
128 if (steps
.size() == 0)
131 return steps
.get(0).getBegin();
135 public Date
getEndDate() {
136 if (!status
.equals(STATUS_FINISHED
) && !status
.equals(STATUS_ERROR
))
139 synchronized (steps
) {
140 if (steps
.size() == 0)
143 return steps
.get(steps
.size() - 1).getBegin();