1
2
3
4
5
6
7
8 package com.buckosoft.PicMan.domain;
9
10 import java.text.SimpleDateFormat;
11 import java.util.Date;
12
13 import com.buckosoft.PicMan.util.DateUtil;
14
15
16
17
18
19
20 public class JobLogEntry {
21 public static final int CONTACT = 0;
22 public static final int PICSIZE = 1;
23 public static final int MLBFIXER = 2;
24 public static final int MD5SUM = 3;
25 public static final int MOSAIC = 4;
26 public static final int MOSAICV = 5;
27 public static final int INFO = 6;
28
29
30 public static final int DONE = 7;
31
32 public static final int OTHER = 8;
33
34
35 protected static final int JLELAST = 9;
36
37 public static final int COLOR_NORMAL = 0;
38 public static final int COLOR_OK = 1;
39 public static final int COLOR_BAD = 2;
40
41 static private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
42
43 protected int type = OTHER;
44
45 private String note = "";
46 private String name = "";
47 private Date startTime = new Date();
48 private Date endTime = null;
49 private int color = COLOR_NORMAL;
50 private static int serialKey = 1;
51 private int serial = serialKey++;
52
53
54
55
56 public void setType(int type) {
57 this.type = type;
58 }
59
60
61
62
63 public int getType() {
64 return type;
65 }
66
67
68
69
70 public int getSerial() {
71 return(serial);
72 }
73
74
75
76
77 public String getTypeAsString() {
78 switch (type) {
79 case CONTACT:
80 return("contact");
81 case PICSIZE:
82 return("PicSize");
83 case MLBFIXER:
84 return("mlbFixer");
85 case MD5SUM:
86 return("md5sum");
87 case MOSAIC:
88 return("mosaic");
89 case MOSAICV:
90 return("mosVec");
91 case INFO:
92 return("Info");
93 case DONE:
94 return("done");
95 case OTHER:
96 return("other");
97 }
98 return("unknown");
99 }
100
101
102
103
104 public Date getEndTime() {
105 return endTime;
106 }
107
108
109
110
111 public void setEndTime(Date endTime) {
112 this.endTime = endTime;
113 }
114
115
116
117 public void setEndTime() {
118 this.endTime = new Date();
119 }
120
121
122
123
124 public String getName() {
125 return name;
126 }
127
128
129
130
131 public void setName(String name) {
132 this.name = name;
133 }
134
135
136
137
138 public String getNote() {
139 return note;
140 }
141
142
143
144
145 public void setNote(String note) {
146 this.note = note;
147 }
148
149
150
151
152 public int getColor() {
153 return color;
154 }
155
156
157
158
159 public void setColor(int color) {
160 this.color = color;
161 }
162
163
164
165
166 public Date getStartTime() {
167 return startTime;
168 }
169
170 public void setError() {
171 setColor(COLOR_BAD);
172 }
173
174 public boolean isError() {
175 return(this.color == COLOR_BAD);
176 }
177
178
179
180 public void setStartTime(Date startTime) {
181 this.startTime = startTime;
182 }
183
184 public String getStartTimeAsString() {
185 return(dateFormat.format(getStartTime()));
186 }
187
188 public String getEndTimeAsString() {
189 if (getEndTime() != null)
190 return(dateFormat.format(getEndTime()));
191 return("0");
192 }
193
194 public String getDurationAsString() {
195 if (getEndTime() != null) {
196 return(DateUtil.timeToString(getEndTime().getTime() - getStartTime().getTime()));
197 }
198 return(DateUtil.timeToString(new Date().getTime() - getStartTime().getTime()));
199 }
200
201 }