1
2 package com.pnpconsult.zeiterfassung.model;
3
4 import java.util.Date;
5
6 /***
7 * @author <a href="mailto:powerpete@users.sf.net">M. Petersen</a>
8 * @version $Id: AbstractBaseEntry.java,v 1.8 2004/06/09 19:26:40 powerpete Exp $
9 */
10 public abstract class AbstractBaseEntry extends TimestampedObject
11 {
12 private long id = -1;
13 private Project project;
14 private Date targetDate;
15 private User user;
16 private float hours;
17
18 /***
19 * @return Returns the user.
20 *
21 * @hibernate.many-to-one column="userLogin"
22 */
23 public User getUser()
24 {
25 return user;
26 }
27
28 /***
29 * @param user The user to set.
30 */
31 public void setUser(User user)
32 {
33 this.user = user;
34 }
35
36 /***
37 * @return Returns the id.
38 *
39 * @hibernate.id generator-class="increment" unsaved-value="-1"
40 */
41 public long getId()
42 {
43 return id;
44 }
45
46 /***
47 * @param id The id to set.
48 */
49 public void setId(long id)
50 {
51 this.id = id;
52 }
53
54 /***
55 * @return Returns the hours.
56 *
57 * @hibernate.property
58 */
59 public float getHours()
60 {
61 return hours;
62 }
63
64 /***
65 * @param hours The hours to set.
66 */
67 public void setHours(float hours)
68 {
69 this.hours = hours;
70 }
71
72 /***
73 * @return Returns the project.
74 *
75 * @hibernate.many-to-one column="projectId"
76 */
77 public Project getProject()
78 {
79 return project;
80 }
81
82 /***
83 * @param project The project to set.
84 */
85 public void setProject(Project project)
86 {
87 this.project = project;
88 }
89
90 /***
91 * @return Returns the targetDate.
92 *
93 * @hibernate.property type="date"
94 */
95 public Date getTargetDate()
96 {
97 return targetDate;
98 }
99
100 /***
101 * @param targetDate The targetDate to set.
102 */
103 public void setTargetDate(Date targetDate)
104 {
105 this.targetDate = targetDate;
106 }
107
108 public boolean equals(Object obj)
109 {
110 try
111 {
112 return ((AbstractBaseEntry) obj).id == id;
113 }
114 catch (ClassCastException e)
115 {
116 return false;
117 }
118 }
119
120 public int hashCode()
121 {
122 return (int) id;
123 }
124
125 public abstract float getRate();
126
127 /***
128 * Description for the user table.
129 *
130 * @return The description for the user table.
131 */
132 public abstract String getUserDescription();
133
134 /***
135 * Description for the bill table.
136 *
137 * @return The description for the bill table.
138 */
139 public abstract String getBillDescription();
140 }