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