1
2
3
4
5
6 package org.andromda.timetracker.domain;
7
8 import java.io.Serializable;
9 import java.util.Date;
10 import java.util.List;
11 import javax.persistence.Entity;
12 import javax.persistence.NamedQuery;
13 import javax.persistence.Table;
14 import javax.persistence.Transient;
15 import org.andromda.timetracker.vo.TimecardSearchCriteriaVO;
16
17
18
19
20
21
22
23
24
25
26
27
28
29 @Entity
30 @Table(name = "TIMECARD")
31
32
33
34
35 @NamedQuery(name = "Timecard.findAll", query = "SELECT t FROM Timecard AS t")
36 public class Timecard
37 extends TimecardEmbeddable
38 implements Comparable<Timecard>
39 {
40
41
42
43 private static final long serialVersionUID = 7573880213879125840L;
44
45
46
47
48
49
50 public Timecard()
51 {
52 super();
53 }
54
55
56
57
58
59
60
61
62
63 public Timecard(TimecardStatus status, Date startDate, String comments)
64 {
65 super(status, startDate, comments);
66 }
67
68
69
70
71
72
73
74
75
76
77 public Timecard(TimecardStatus status, Date startDate, String comments, User submitter, User approver)
78 {
79 super(status, startDate, comments, submitter, approver);
80 }
81
82
83
84
85
86
87
88 @Transient
89 public static List findByCriteria(TimecardSearchCriteriaVO criteria)
90 {
91
92 return null;
93 }
94
95
96
97
98
99 @Override
100 public int compareTo(Timecard o)
101 {
102 int cmp = 0;
103 if (this.getTimecardId() != null)
104 {
105 cmp = this.getTimecardId().compareTo(o.getTimecardId());
106 }
107 else
108 {
109 if (this.getStatus() != null)
110 {
111 cmp = (cmp != 0 ? cmp : this.getStatus().compareTo(o.getStatus()));
112 }
113 if (this.getStartDate() != null)
114 {
115 cmp = (cmp != 0 ? cmp : this.getStartDate().compareTo(o.getStartDate()));
116 }
117 if (this.getComments() != null)
118 {
119 cmp = (cmp != 0 ? cmp : this.getComments().compareTo(o.getComments()));
120 }
121 }
122 return cmp;
123 }
124 }