]>
git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.specs/src/main/java/org/argeo/slc/process/SlcExecutionStep.java
1 package org
.argeo
.slc
.process
;
3 import java
.io
.IOException
;
4 import java
.io
.StringReader
;
5 import java
.util
.ArrayList
;
10 import org
.apache
.commons
.io
.IOUtils
;
12 public class SlcExecutionStep
{
13 public final static String TYPE_START
= "START";
14 public final static String TYPE_END
= "END";
15 public final static String TYPE_PHASE_START
= "PHASE_START";
16 public final static String TYPE_PHASE_END
= "PHASE_END";
17 public final static String TYPE_LOG
= "LOG";
19 private String uuid
= UUID
.randomUUID().toString();
21 private Date begin
= new Date();
22 private List
<String
> logLines
= new ArrayList
<String
>();
24 /** Empty constructor */
25 public SlcExecutionStep() {
28 /** Creates a step of type LOG. */
29 public SlcExecutionStep(String log
) {
33 /** Creates a step of the given type. */
34 public SlcExecutionStep(String type
, String log
) {
39 public String
getUuid() {
43 public void setUuid(String uuid
) {
47 public String
getType() {
51 public void setType(String type
) {
55 public Date
getBegin() {
59 public void setBegin(Date begin
) {
63 public List
<String
> getLogLines() {
67 public void setLogLines(List
<String
> logLines
) {
68 this.logLines
= logLines
;
71 @SuppressWarnings(value
= { "unchecked" })
72 public void addLog(String log
) {
77 List
<String
> lines
= IOUtils
.readLines(new StringReader(log
));
78 logLines
.addAll(lines
);
79 } catch (IOException e
) {
80 throw new RuntimeException("Cannot add log", e
);
85 public String
toString() {
86 return getClass().getSimpleName() + "#" + uuid
;