01: package com.technoetic.xplanner.importer;
02:
03: import java.text.SimpleDateFormat;
04: import java.util.Date;
05:
06: public class SpreadsheetStory {
07: public static final String STATUS_COMPLETED = "C";
08: public final static SimpleDateFormat formatter = new SimpleDateFormat(
09: "ddMMMyy");
10: private String title = "Default title";
11: private double estimate;
12: // TODO status should be an enum
13: private String status = "";
14: private boolean complete = false;
15: private Date endDate;
16: private int priority = 4;
17:
18: SpreadsheetStory(String title, String status, double estimate) {
19: this .title = title;
20: this .estimate = estimate;
21: setStatus(status);
22: }
23:
24: public SpreadsheetStory(Date storyEndDate, String title,
25: String status, double estimate, int priority) {
26: this (title, status, estimate);
27: this .endDate = storyEndDate;
28: this .priority = priority;
29: }
30:
31: public boolean equals(Object o) {
32: if (this == o)
33: return true;
34: if (!(o instanceof SpreadsheetStory))
35: return false;
36:
37: final SpreadsheetStory spreadsheetStory = (SpreadsheetStory) o;
38:
39: if (status != null ? !status.equals(spreadsheetStory.status)
40: : spreadsheetStory.status != null)
41: return false;
42: if (title != null ? !title.equals(spreadsheetStory.title)
43: : spreadsheetStory.title != null)
44: return false;
45: if (estimate != spreadsheetStory.estimate)
46: return false;
47:
48: return true;
49: }
50:
51: public int hashCode() {
52: int result;
53: result = (title != null ? title.hashCode() : 0);
54: result = 29 * result + (status != null ? status.hashCode() : 0);
55: return result;
56: }
57:
58: public String toString() {
59: return "Story{" + " priority=" + priority + ", title='" + title
60: + "'" + ", status='" + status + "'" + ", estimate="
61: + estimate + ", endDate=" + formatter.format(endDate)
62: + "}";
63: }
64:
65: public String getTitle() {
66: return title;
67: }
68:
69: public void setTitle(String title) {
70: this .title = title;
71: }
72:
73: public String getStatus() {
74: return status;
75: }
76:
77: public void setStatus(String status) {
78: this .status = status;
79: if (status.equals(STATUS_COMPLETED)) {
80: complete = true;
81: }
82: }
83:
84: public boolean isCompleted() {
85: return complete;
86: }
87:
88: public Date getEndDate() {
89: return endDate;
90: }
91:
92: public double getEstimate() {
93: return estimate;
94: }
95:
96: public int getPriority() {
97: return priority;
98: }
99: }
|