KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > za > org > coefficient > modules > task > TaskData


1 package za.org.coefficient.modules.task;
2
3 import java.util.Date JavaDoc;
4
5 import za.org.coefficient.util.common.DateUtil;
6
7 /**
8  * @hibernate.class
9  * table="COEFFICIENT_TASK"
10  */

11 public class TaskData implements java.io.Serializable JavaDoc {
12
13     private Long JavaDoc id; // unique to the file
14
private Long JavaDoc projectId; // projectId to which this belongs
15
private String JavaDoc name;
16     private String JavaDoc description;
17     private String JavaDoc status;
18     private String JavaDoc person;
19     private Long JavaDoc sequence; // sequence number unique to the project
20
private Date JavaDoc startDate; // date task is scheduled to start
21
private Date JavaDoc estimatedEndDate; // estimated finish date
22
private Date JavaDoc actualEndDate; // date task is scheduled to start
23
private Integer JavaDoc estimatedHours; // estimated duration of task (hours)
24
private String JavaDoc projectNameField;
25     private boolean completed;
26
27     public TaskData () {
28         name = new String JavaDoc();
29         description = new String JavaDoc();
30         status = new String JavaDoc();
31     }
32
33     /**
34      * Gets the value of id
35      *
36      * @return the value of id
37      * @hibernate.id
38      * generator-class="native"
39      */

40     public Long JavaDoc getId() {
41         return this.id;
42     }
43
44     /**
45      * Sets the value of id
46      *
47      * @param argId Value to assign to this.id
48      */

49     public void setId(Long JavaDoc argId){
50         this.id = argId;
51         this.setProjectNameField(projectId + "-" + name);
52     }
53
54     /**
55      * Gets the value of id
56      *
57      * @return the value of projectId
58      * @hibernate.property
59      * column="PROJECT_ID"
60      * not-null="true"
61      */

62     public Long JavaDoc getProjectId() {
63         return this.projectId;
64     }
65
66     /**
67      * Sets the value of projectId
68      *
69      * @param argId Value to assign to this.id
70      */

71     public void setProjectId(Long JavaDoc argId){
72         this.projectId = argId;
73     }
74
75
76     /**
77      * Gets the value of estimatedHours
78      *
79      * @return the value of estimatedHours
80      * @hibernate.property
81      * column="ESTIMATED_HOURS"
82      */

83     public Integer JavaDoc getEstimatedHours() {
84         return this.estimatedHours;
85     }
86
87     /**
88      * Sets the value of estimatedHours
89      *
90      * @param argId Value to assign to this.estimatedHours
91      */

92     public void setEstimatedHours(Integer JavaDoc argEstimatedHours){
93         this.estimatedHours = argEstimatedHours;
94     }
95
96     public void setEstimatedHours(String JavaDoc argEstimatedHours) {
97     Integer JavaDoc i;
98     try {
99          i = new Integer JavaDoc(argEstimatedHours);
100     }
101     catch ( Throwable JavaDoc t ) {
102         i = new Integer JavaDoc(0);
103     }
104     setEstimatedHours(i);
105     }
106
107     /**
108      * Gets the value of sequence
109      *
110      * @return the value of sequence
111      * @hibernate.property
112      * column="SEQUENCE"
113      */

114     public Long JavaDoc getSequence() {
115         return this.sequence;
116     }
117
118     /**
119      * Sets the value of sequence
120      *
121      * @param argId Value to assign to this.sequence
122      */

123     public void setSequence(Long JavaDoc argSequence){
124         this.sequence = argSequence;
125     }
126
127     /**
128      * Gets the value of startDate
129      *
130      * @return the value of startDate
131      * @hibernate.property
132      * column="START_DATE"
133      */

134     public Date JavaDoc getStartDate() {
135         return this.startDate;
136     }
137
138     /**
139      * Sets the value of startDate
140      *
141      * @param argId Value to assign to this.startDate
142      */

143     public void setStartDate(Date JavaDoc argStartDate){
144         this.startDate = argStartDate;
145     }
146
147
148     public void setStartDate(String JavaDoc year, String JavaDoc month, String JavaDoc day) {
149         startDate = DateUtil.setDate(year, month, day);
150     }
151
152     public void setEstimatedEndDate(String JavaDoc year, String JavaDoc month, String JavaDoc day) {
153         estimatedEndDate = DateUtil.setDate(year, month, day);
154     }
155
156     public String JavaDoc getStartDateAsString() {
157         return DateUtil.getDate(startDate);
158     }
159
160     public String JavaDoc getStartDateDay() {
161         return DateUtil.getDay(startDate);
162     }
163
164     public String JavaDoc getEstimatedEndDateDay() {
165         return DateUtil.getDay(estimatedEndDate);
166     }
167
168     public String JavaDoc getStartDateMonth() {
169         return DateUtil.getMonth(startDate);
170     }
171     public String JavaDoc getEstimatedEndDateMonth() {
172         return DateUtil.getMonth(estimatedEndDate);
173     }
174     public String JavaDoc getStartDateYear() {
175         return DateUtil.getYear(startDate);
176     }
177     public String JavaDoc getEstimatedEndDateYear() {
178         return DateUtil.getYear(estimatedEndDate);
179     }
180     public String JavaDoc getEstimatedEndDateAsString() {
181         return DateUtil.getDate(estimatedEndDate);
182     }
183
184     /**
185      * Gets the value of estimatedEndDate
186      *
187      * @return the value of estimatedEndDate
188      * @hibernate.property
189      * column="ESTIMATED_END_DATE"
190      */

191     public Date JavaDoc getEstimatedEndDate() {
192         return this.estimatedEndDate;
193     }
194
195     /**
196      * Sets the value of estimatedEndDate
197      *
198      * @param argId Value to assign to this.estimatedEndDate
199      */

200     public void setEstimatedEndDate(Date JavaDoc argEstimatedEndDate){
201         this.estimatedEndDate = argEstimatedEndDate;
202     }
203
204     /**
205      * Gets the value of actualEndDate
206      *
207      * @return the value of actualEndDate
208      * @hibernate.property
209      * column="ACTUAL_END_DATE"
210      */

211     public Date JavaDoc getActualEndDate() {
212         return this.actualEndDate;
213     }
214
215     /**
216      * Sets the value of actualEndDate
217      *
218      * @param argId Value to assign to this.actualEndDate
219      */

220     public void setActualEndDate(Date JavaDoc argActualEndDate){
221         this.actualEndDate = argActualEndDate;
222     }
223
224     /**
225      * Gets the value of name
226      *
227      * @return the value of name
228      * @hibernate.property
229      * column="NAME"
230      * not-null="true"
231      */

232     public String JavaDoc getName() {
233         return this.name;
234     }
235
236     /**
237      * Sets the value of name
238      *
239      * @param argName Value to assign to this.name
240      */

241     public void setName(String JavaDoc name){
242         this.name = name;
243     }
244
245     /**
246      * Gets the value of name
247      *
248      * @return the value of name
249      * @hibernate.property
250      * column="STATUS"
251      */

252     public String JavaDoc getStatus() {
253         return this.status;
254     }
255
256     /**
257      * Sets the value of person
258      *
259      * @param argPerson Value to assign to this.person
260      */

261     public void setPerson(String JavaDoc person){
262         this.person = person;
263     }
264
265     /**
266      * Gets the value of person
267      *
268      * @return the value of person
269      * @hibernate.property
270      * column="PERSON"
271      */

272     public String JavaDoc getPerson() {
273         return this.person;
274     }
275
276     /**
277      * Sets the value of name
278      *
279      * @param argName Value to assign to this.name
280      */

281     public void setStatus(String JavaDoc status){
282         this.status = status;
283         if (Task.FINISHED.equals(status)) {
284             completed = true;
285         } else {
286             completed = false;
287         }
288     }
289
290     /**
291      * Gets the value of description
292      *
293      * @return the value of description
294      * @hibernate.property
295      * column="DESCRIPTION"
296      * length="3999"
297      */

298     public String JavaDoc getDescription() {
299         return this.description;
300     }
301
302     /**
303      * Sets the value of description
304      *
305      * @param argDescription Value to assign to this.description
306      */

307     public void setDescription(String JavaDoc description){
308         this.description = description;
309     }
310
311     /**
312      * Gets the value of projectNameField
313      *
314      * @return the value of projectNameField
315      * @hibernate.property
316      * column="PROJECT_NAME_FIELD"
317      * unique="true"
318      */

319     public String JavaDoc getProjectNameField() {
320         return this.projectNameField;
321     }
322
323     /**
324      * Sets the value of projectNameField
325      *
326      * @param argProjectNameField Value to assign to this.projectNameField
327      */

328     public void setProjectNameField(String JavaDoc projectNameField){
329         this.projectNameField = projectNameField;
330     }
331
332     /**
333      * Gets the value of completed
334      *
335      * @return the value of completed
336      * @hibernate.property
337      * column="COMPLETED"
338      * not-null="true"
339      */

340     public boolean getCompleted() {
341         return this.completed;
342     }
343
344     /**
345      * Sets the value of completed
346      *
347      * @param argCompleted Value to assign to this.completed
348      */

349     public void setCompleted(boolean completed){
350         this.completed = completed;
351     }
352
353     public String JavaDoc dump() {
354         String JavaDoc st = new String JavaDoc("\nID " + id + "\n" +
355                                "PROJECTID " + projectId + "\n" +
356                                "NAME " + name + "\n" +
357                                "PERSON " + person + "\n" +
358                                "DESC " + description + "\n" +
359                                "START " + startDate + "\n" +
360                                "ESTEND " + estimatedEndDate + "\n" +
361                                "ACTEND " + actualEndDate + "\n" +
362                                "HOURS " + estimatedHours + "\n" +
363                                "STATUS " + status + "\n");
364         return st;
365     }
366
367 }
368
Popular Tags