]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecution.java
Save current state even if not completely stable
[gpl/argeo-slc.git] / runtime / org.argeo.slc.specs / src / main / java / org / argeo / slc / process / SlcExecution.java
index 626af3eb6770cd43f85b238e81d45b056aa66a8e..13189b453d37ec0f95e469fa0470bd6adffb4f8d 100644 (file)
@@ -1,3 +1,19 @@
+/*\r
+ * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *         http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
 package org.argeo.slc.process;\r
 \r
 import java.io.Serializable;\r
@@ -7,14 +23,12 @@ import java.util.List;
 import java.util.Map;\r
 import java.util.TreeMap;\r
 \r
-public class SlcExecution implements Serializable {\r
-       private static final long serialVersionUID = 1L;\r
-       public final static String STATUS_NONE = "DEFAULT";\r
-       public final static String STATUS_SCHEDULED = "SCHEDULED";\r
-       public final static String STATUS_RUNNING = "RUNNING";\r
-       public final static String STATUS_FINISHED = "FINISHED";\r
-       public final static String STATUS_ERROR = "ERROR";\r
-       public final static String STATUS_CLEANED = "CLEANED";\r
+import org.argeo.slc.execution.ExecutionProcess;\r
+import org.argeo.slc.execution.ExecutionStep;\r
+\r
+/** @deprecated use other implementations of {@link ExecutionProcess} */\r
+public class SlcExecution implements ExecutionProcess, Serializable {\r
+       private static final long serialVersionUID = -7607457971382118466L;\r
 \r
        public final static String UNKOWN_HOST = "UNKOWN_HOST";\r
 \r
@@ -22,12 +36,14 @@ public class SlcExecution implements Serializable {
        private String host;\r
        private String user;\r
        private String type;\r
-       private String status = STATUS_NONE;\r
+       private String status = NEW;\r
        private Map<String, String> attributes = new TreeMap<String, String>();\r
 \r
        /** TODO: Synchronize */\r
        private List<SlcExecutionStep> steps = new ArrayList<SlcExecutionStep>();\r
        private List<RealizedFlow> realizedFlows = new ArrayList<RealizedFlow>();\r
+\r
+       /** Attachment uuid. */\r
        private String realizedFlowsXml = null;\r
 \r
        public List<RealizedFlow> getRealizedFlows() {\r
@@ -46,6 +62,10 @@ public class SlcExecution implements Serializable {
                this.steps = steps;\r
        }\r
 \r
+       public void addSteps(List<ExecutionStep> steps) {\r
+               // not implemented on deprecated\r
+       }\r
+\r
        public String getUuid() {\r
                return uuid;\r
        }\r
@@ -129,26 +149,32 @@ public class SlcExecution implements Serializable {
                        if (steps.size() == 0)\r
                                return null;\r
                        else\r
-                               return steps.get(0).getBegin();\r
+                               return steps.get(0).getTimestamp();\r
                }\r
        }\r
 \r
        public Date getEndDate() {\r
-               if (!status.equals(STATUS_FINISHED) && !status.equals(STATUS_ERROR))\r
+               if (!status.equals(COMPLETED) && !status.equals(ERROR))\r
                        return null;\r
 \r
                synchronized (steps) {\r
                        if (steps.size() == 0)\r
                                return null;\r
                        else\r
-                               return steps.get(steps.size() - 1).getBegin();\r
+                               return steps.get(steps.size() - 1).getTimestamp();\r
                }\r
        }\r
 \r
+       /**\r
+        * Not (yet) a stable API, should not be relied upon!\r
+        * \r
+        * @return an id or an url allowing to retrieve the XML, not the XML itself!\r
+        */\r
        public String getRealizedFlowsXml() {\r
                return realizedFlowsXml;\r
        }\r
 \r
+       /** Not (yet) a stable API, should not be relied upon! */\r
        public void setRealizedFlowsXml(String realizedFlowsXml) {\r
                this.realizedFlowsXml = realizedFlowsXml;\r
        }\r