1 16 17 package info.jtrac.domain; 18 19 import java.io.Serializable ; 20 import java.util.Date ; 21 22 import static info.jtrac.domain.Field.Name.*; 23 import info.jtrac.util.DateUtils; 24 import java.util.LinkedHashSet ; 25 import java.util.Set ; 26 import org.springmodules.lucene.index.core.DocumentCreator; 27 28 32 public abstract class AbstractItem implements Serializable , DocumentCreator { 33 34 private long id; 35 private int version; 36 private Item parent; private String summary; 38 private String detail; 39 private User loggedBy; 40 private User assignedTo; 41 private Date timeStamp; 42 private Double plannedEffort; 43 private Integer status; 45 private Integer severity; 46 private Integer priority; 47 private Integer cusInt01; 48 private Integer cusInt02; 49 private Integer cusInt03; 50 private Integer cusInt04; 51 private Integer cusInt05; 52 private Integer cusInt06; 53 private Integer cusInt07; 54 private Integer cusInt08; 55 private Integer cusInt09; 56 private Integer cusInt10; 57 private Double cusDbl01; 58 private Double cusDbl02; 59 private Double cusDbl03; 60 private String cusStr01; 61 private String cusStr02; 62 private String cusStr03; 63 private String cusStr04; 64 private String cusStr05; 65 private Date cusTim01; 66 private Date cusTim02; 67 private Date cusTim03; 68 69 private Set <ItemUser> itemUsers; 71 private Set <ItemItem> relatedItems; 72 private Set <ItemItem> relatingItems; 73 private Set <ItemTag> itemTags; 74 75 private boolean sendNotifications = true; 77 78 public Object getValue(Field.Name fieldName) { 80 switch(fieldName) { 81 case SEVERITY: return severity; 82 case PRIORITY: return priority; 83 case CUS_INT_01: return cusInt01; 84 case CUS_INT_02: return cusInt02; 85 case CUS_INT_03: return cusInt03; 86 case CUS_INT_04: return cusInt04; 87 case CUS_INT_05: return cusInt05; 88 case CUS_INT_06: return cusInt06; 89 case CUS_INT_07: return cusInt07; 90 case CUS_INT_08: return cusInt08; 91 case CUS_INT_09: return cusInt09; 92 case CUS_INT_10: return cusInt10; 93 case CUS_DBL_01: return cusDbl01; 94 case CUS_DBL_02: return cusDbl02; 95 case CUS_DBL_03: return cusDbl03; 96 case CUS_STR_01: return cusStr01; 97 case CUS_STR_02: return cusStr02; 98 case CUS_STR_03: return cusStr03; 99 case CUS_STR_04: return cusStr04; 100 case CUS_STR_05: return cusStr05; 101 case CUS_TIM_01: return cusTim01; 102 case CUS_TIM_02: return cusTim02; 103 case CUS_TIM_03: return cusTim03; 104 } 105 return null; 107 } 108 109 public void setValue(Field.Name fieldName, Object value) { 111 switch(fieldName) { 112 case SEVERITY: severity = (Integer ) value; break; 113 case PRIORITY: priority = (Integer ) value; break; 114 case CUS_INT_01: cusInt01 = (Integer ) value; break; 115 case CUS_INT_02: cusInt02 = (Integer ) value; break; 116 case CUS_INT_03: cusInt03 = (Integer ) value; break; 117 case CUS_INT_04: cusInt04 = (Integer ) value; break; 118 case CUS_INT_05: cusInt05 = (Integer ) value; break; 119 case CUS_INT_06: cusInt06 = (Integer ) value; break; 120 case CUS_INT_07: cusInt07 = (Integer ) value; break; 121 case CUS_INT_08: cusInt08 = (Integer ) value; break; 122 case CUS_INT_09: cusInt09 = (Integer ) value; break; 123 case CUS_INT_10: cusInt10 = (Integer ) value; break; 124 case CUS_DBL_01: cusDbl01 = (Double ) value; break; 125 case CUS_DBL_02: cusDbl02 = (Double ) value; break; 126 case CUS_DBL_03: cusDbl03 = (Double ) value; break; 127 case CUS_STR_01: cusStr01 = (String ) value; break; 128 case CUS_STR_02: cusStr02 = (String ) value; break; 129 case CUS_STR_03: cusStr03 = (String ) value; break; 130 case CUS_STR_04: cusStr04 = (String ) value; break; 131 case CUS_STR_05: cusStr05 = (String ) value; break; 132 case CUS_TIM_01: cusTim01 = (Date ) value ; break; 133 case CUS_TIM_02: cusTim02 = (Date ) value; break; 134 case CUS_TIM_03: cusTim03 = (Date ) value; 135 } 136 } 137 138 public abstract Space getSpace(); 140 public abstract String getRefId(); 141 142 public String getCustomValue(Field.Name fieldName) { 143 if (fieldName.getType() <= 3) { 145 return getSpace().getMetadata().getCustomValue(fieldName, (Integer ) getValue(fieldName)); 146 } else { 147 Object o = getValue(fieldName); 148 if (o == null) { 149 return ""; 150 } 151 if (o instanceof Date ) { 152 return DateUtils.format((Date ) o); 153 } 154 return o.toString(); 155 } 156 } 157 158 public String getStatusValue() { 159 return getSpace().getMetadata().getStatusValue(status); 161 } 162 163 165 public Integer getStatus() { 166 return status; 167 } 168 169 public Integer getSeverity() { 170 return severity; 171 } 172 173 public Integer getPriority() { 174 return priority; 175 } 176 177 public Integer getCusInt01() { 178 return cusInt01; 179 } 180 181 public Integer getCusInt02() { 182 return cusInt02; 183 } 184 185 public Integer getCusInt03() { 186 return cusInt03; 187 } 188 189 public Integer getCusInt04() { 190 return cusInt04; 191 } 192 193 public Integer getCusInt05() { 194 return cusInt05; 195 } 196 197 public Integer getCusInt06() { 198 return cusInt06; 199 } 200 201 public Integer getCusInt07() { 202 return cusInt07; 203 } 204 205 public Integer getCusInt08() { 206 return cusInt08; 207 } 208 209 public Integer getCusInt09() { 210 return cusInt09; 211 } 212 213 public Integer getCusInt10() { 214 return cusInt10; 215 } 216 217 public Double getCusDbl01() { 218 return cusDbl01; 219 } 220 221 public Double getCusDbl02() { 222 return cusDbl02; 223 } 224 225 public Double getCusDbl03() { 226 return cusDbl03; 227 } 228 229 public String getCusStr01() { 230 return cusStr01; 231 } 232 233 public String getCusStr02() { 234 return cusStr02; 235 } 236 237 public String getCusStr03() { 238 return cusStr03; 239 } 240 241 public String getCusStr04() { 242 return cusStr04; 243 } 244 245 public String getCusStr05() { 246 return cusStr05; 247 } 248 249 public Date getCusTim01() { 250 return cusTim01; 251 } 252 253 public Date getCusTim02() { 254 return cusTim02; 255 } 256 257 public Date getCusTim03() { 258 return cusTim03; 259 } 260 261 263 public void setStatus(Integer status) { 264 this.status = status; 265 } 266 267 public void setSeverity(Integer severity) { 268 this.severity = severity; 269 } 270 271 public void setPriority(Integer priority) { 272 this.priority = priority; 273 } 274 275 public void setCusInt01(Integer cusInt01) { 276 this.cusInt01 = cusInt01; 277 } 278 279 public void setCusInt02(Integer cusInt02) { 280 this.cusInt02 = cusInt02; 281 } 282 283 public void setCusInt03(Integer cusInt03) { 284 this.cusInt03 = cusInt03; 285 } 286 287 public void setCusInt04(Integer cusInt04) { 288 this.cusInt04 = cusInt04; 289 } 290 291 public void setCusInt05(Integer cusInt05) { 292 this.cusInt05 = cusInt05; 293 } 294 295 public void setCusInt06(Integer cusInt06) { 296 this.cusInt06 = cusInt06; 297 } 298 299 public void setCusInt07(Integer cusInt07) { 300 this.cusInt07 = cusInt07; 301 } 302 303 public void setCusInt08(Integer cusInt08) { 304 this.cusInt08 = cusInt08; 305 } 306 307 public void setCusInt09(Integer cusInt09) { 308 this.cusInt09 = cusInt09; 309 } 310 311 public void setCusInt10(Integer cusInt10) { 312 this.cusInt10 = cusInt10; 313 } 314 315 public void setCusDbl01(Double cusDbl01) { 316 this.cusDbl01 = cusDbl01; 317 } 318 319 public void setCusDbl02(Double cusDbl02) { 320 this.cusDbl02 = cusDbl02; 321 } 322 323 public void setCusDbl03(Double cusDbl03) { 324 this.cusDbl03 = cusDbl03; 325 } 326 327 public void setCusStr01(String cusStr01) { 328 this.cusStr01 = cusStr01; 329 } 330 331 public void setCusStr02(String cusStr02) { 332 this.cusStr02 = cusStr02; 333 } 334 335 public void setCusStr03(String cusStr03) { 336 this.cusStr03 = cusStr03; 337 } 338 339 public void setCusStr04(String cusStr04) { 340 this.cusStr04 = cusStr04; 341 } 342 343 public void setCusStr05(String cusStr05) { 344 this.cusStr05 = cusStr05; 345 } 346 347 public void setCusTim01(Date cusTim01) { 348 this.cusTim01 = cusTim01; 349 } 350 351 public void setCusTim02(Date cusTim02) { 352 this.cusTim02 = cusTim02; 353 } 354 355 public void setCusTim03(Date cusTim03) { 356 this.cusTim03 = cusTim03; 357 } 358 359 361 public long getId() { 362 return id; 363 } 364 365 public void setId(long id) { 366 this.id = id; 367 } 368 369 public int getVersion() { 370 return version; 371 } 372 373 public void setVersion(int version) { 374 this.version = version; 375 } 376 377 public Item getParent() { 378 return parent; 379 } 380 381 public void setParent(Item parent) { 382 this.parent = parent; 383 } 384 385 public String getSummary() { 386 return summary; 387 } 388 389 public void setSummary(String summary) { 390 this.summary = summary; 391 } 392 393 public String getDetail() { 394 return detail; 395 } 396 397 public void setDetail(String detail) { 398 this.detail = detail; 399 } 400 401 public User getLoggedBy() { 402 return loggedBy; 403 } 404 405 public void setLoggedBy(User loggedBy) { 406 this.loggedBy = loggedBy; 407 } 408 409 public User getAssignedTo() { 410 return assignedTo; 411 } 412 413 public void setAssignedTo(User assignedTo) { 414 this.assignedTo = assignedTo; 415 } 416 417 public Date getTimeStamp() { 418 return timeStamp; 419 } 420 421 public void setTimeStamp(Date timeStamp) { 422 this.timeStamp = timeStamp; 423 } 424 425 public Double getPlannedEffort() { 426 return plannedEffort; 427 } 428 429 public void setPlannedEffort(Double plannedEffort) { 430 this.plannedEffort = plannedEffort; 431 } 432 433 public boolean isSendNotifications() { 434 return sendNotifications; 435 } 436 437 public void setSendNotifications(boolean sendNotifications) { 438 this.sendNotifications = sendNotifications; 439 } 440 441 public Set <ItemUser> getItemUsers() { 442 return itemUsers; 443 } 444 445 public void setItemUsers(Set <ItemUser> itemUsers) { 446 this.itemUsers = itemUsers; 447 } 448 449 public Set <ItemItem> getRelatedItems() { 450 return relatedItems; 451 } 452 453 public void setRelatedItems(Set <ItemItem> relatedItems) { 454 this.relatedItems = relatedItems; 455 } 456 457 public Set <ItemItem> getRelatingItems() { 458 return relatingItems; 459 } 460 461 public void setRelatingItems(Set <ItemItem> relatingItems) { 462 this.relatingItems = relatingItems; 463 } 464 465 public Set <ItemTag> getItemTags() { 466 return itemTags; 467 } 468 469 public void setItemTags(Set <ItemTag> itemTags) { 470 this.itemTags = itemTags; 471 } 472 473 @Override 474 public String toString() { 475 StringBuffer sb = new StringBuffer (); 476 sb.append("id [").append(id); 477 sb.append("]; parent [").append(parent == null ? "" : parent.getId()); 478 sb.append("]; summary [").append(summary); 479 sb.append("]; detail [").append(detail); 480 sb.append("]; loggedBy [").append(loggedBy); 481 sb.append("]; status [").append(status); 482 sb.append("]; assignedTo [").append(assignedTo); 483 sb.append("]; timeStamp [").append(timeStamp); 484 sb.append("]; severity [").append(severity); 485 sb.append("]; priority [").append(priority); 486 sb.append("]; cusInt01 [").append(cusInt01); 487 sb.append("]; cusInt02 [").append(cusInt02); 488 sb.append("]; cusInt03 [").append(cusInt03); 489 sb.append("]; cusInt04 [").append(cusInt04); 490 sb.append("]; cusInt05 [").append(cusInt05); 491 sb.append("]; cusInt06 [").append(cusInt06); 492 sb.append("]; cusInt07 [").append(cusInt07); 493 sb.append("]; cusInt08 [").append(cusInt08); 494 sb.append("]; cusInt09 [").append(cusInt09); 495 sb.append("]; cusInt10 [").append(cusInt10); 496 sb.append("]; cusDbl01 [").append(cusDbl01); 497 sb.append("]; cusDbl02 [").append(cusDbl02); 498 sb.append("]; cusDbl03 [").append(cusDbl03); 499 sb.append("]; cusStr01 [").append(cusStr01); 500 sb.append("]; cusStr02 [").append(cusStr02); 501 sb.append("]; cusStr03 [").append(cusStr03); 502 sb.append("]; cusStr04 [").append(cusStr04); 503 sb.append("]; cusStr05 [").append(cusStr05); 504 sb.append("]; cusTim01 [").append(cusTim01); 505 sb.append("]; cusTim02 [").append(cusTim02); 506 sb.append("]; cusTim03 [").append(cusTim03); 507 sb.append("]"); 508 return sb.toString(); 509 } 510 511 } 512 | Popular Tags |