1
2
3
4
5
6
7
8 package com.panogenesis.model;
9
10 import java.io.Serializable;
11 import java.util.HashSet;
12 import java.util.Set;
13
14 import org.apache.commons.lang.builder.EqualsBuilder;
15 import org.apache.commons.lang.builder.HashCodeBuilder;
16 import org.apache.commons.lang.builder.ToStringBuilder;
17
18 import com.panogenesis.dao.ProjectStatusDAO;
19
20 /***
21 * @author John Arthur
22 *
23 * TODO To change the template for this generated type comment go to
24 * Window - Preferences - Java - Code Style - Code Templates
25 *
26 * @hibernate.class table="project"
27 */
28 public class Project extends BaseObject implements Serializable {
29
30 /*** The composite primary key value. */
31 private java.lang.Integer id;
32
33 /*** The value of the simple name property. */
34 private java.lang.String name;
35
36 /*** The value of the simple description property. */
37 private java.lang.String description;
38
39 /*** The value of the simple status property. */
40 private java.lang.Integer status;
41
42 /*** The value of the simple options property. */
43 private java.lang.Integer options;
44
45 /*** The value of the simple createDate property. */
46 private java.util.Date createDate;
47
48 /*** The value of the simple lastModified property. */
49 private java.util.Date lastModified;
50
51 private Set issues = new HashSet();
52 private Set components = new HashSet();
53 private Set versions = new HashSet();
54 private Set owners = new HashSet();
55
56 /***
57 * Simple constructor of Project instances.
58 */
59 public Project()
60 {
61 }
62
63 /***
64 * Constructor of Project instances given a simple primary key.
65 * @param id
66 */
67 public Project(java.lang.Integer id)
68 {
69 this.setId(id);
70 }
71
72 /***
73 * Return the simple primary key value that identifies this object.
74 * @return java.lang.Integer
75 *
76 * @hibernate.id column="id"
77 * generator-class="increment" unsaved-value="null"
78 *
79 */
80 public java.lang.Integer getId()
81 {
82 return id;
83 }
84
85 /***
86 * Set the simple primary key value that identifies this object.
87 * @param id
88 */
89 public void setId(java.lang.Integer id)
90 {
91 this.id = id;
92 }
93
94 /***
95 * Return the value of the name column.
96 * @return java.lang.String
97 *
98 * @hibernate.property column="name" not-null="true" length="50"
99 */
100 public java.lang.String getName()
101 {
102 return this.name;
103 }
104
105 /***
106 * Set the value of the name column.
107 * @param name
108 *
109 * @spring.validator type="required"
110 */
111 public void setName(java.lang.String name)
112 {
113 this.name = name;
114 }
115
116 /***
117 * Return the value of the description column.
118 * @return java.lang.String
119 *
120 * @hibernate.property column="description" not-null="true" length="255"
121 */
122 public java.lang.String getDescription()
123 {
124 return this.description;
125 }
126
127 /***
128 * Set the value of the description column.
129 * @param description
130 *
131 * @spring.validator type="required"
132 */
133 public void setDescription(java.lang.String description)
134 {
135 this.description = description;
136 }
137
138 /***
139 * Return the value of the status column.
140 * @return java.lang.Integer
141 *
142 * @hibernate.property column="status"
143 */
144 public java.lang.Integer getStatus()
145 {
146 return this.status;
147 }
148
149 /***
150 * Set the value of the status column.
151 * @param status
152 */
153 public void setStatus(java.lang.Integer status)
154 {
155 this.status = status;
156 }
157
158 /***
159 * Return the value of the options column.
160 * @return java.lang.Integer
161 *
162 * @hibernate.property column="options"
163 */
164 public java.lang.Integer getOptions()
165 {
166 return this.options;
167 }
168
169 /***
170 * Set the value of the options column.
171 * @param options
172 */
173 public void setOptions(java.lang.Integer options)
174 {
175 this.options = options;
176 }
177
178 /***
179 * Return the value of the create_date column.
180 * @return java.util.Date
181 *
182 * @hibernate.property column="create_date"
183 */
184 public java.util.Date getCreateDate()
185 {
186 return this.createDate;
187 }
188
189 /***
190 * Set the value of the create_date column.
191 * @param createDate
192 */
193 public void setCreateDate(java.util.Date createDate)
194 {
195 this.createDate = createDate;
196 }
197
198 /***
199 * Return the value of the last_modified column.
200 * @return java.util.Date
201 *
202 * @hibernate.property column="last_modified"
203 */
204 public java.util.Date getLastModified()
205 {
206 return this.lastModified;
207 }
208
209 /***
210 * Set the value of the last_modified column.
211 * @param lastModified
212 */
213 public void setLastModified(java.util.Date lastModified)
214 {
215 this.lastModified = lastModified;
216 }
217
218 public java.lang.String getStatusText()
219 {
220 ProjectStatusDAO dao=null;
221 return dao.getProjectStatus(this.status).getProjectStatusName();
222 }
223
224 /***
225 * Returns the set of issues.
226 * @return Set
227 *
228 * @hibernate.set cascade="delete" lazy="false" order-by="id asc"
229 * @hibernate.collection-key column="project_id"
230 * @hibernate.collection-one-to-many class="com.panogenesis.model.Issue"
231 *
232 */
233 public Set getIssues() {
234 return issues;
235 }
236 /***
237 * @param issues The issues to set.
238 *
239 */
240
241 public void setIssues(Set issues) {
242 this.issues = issues;
243 }
244 /***
245 * Adds an issue to the project
246 *
247 * @param rolename
248 */
249 public void addIssue(Issue issue) {
250 getIssues().add(issue);
251 }
252
253 /***
254 * Returns the set of components.
255 * @return Set
256 *
257 * @hibernate.set cascade="delete-orphan" lazy="false" order-by="id asc"
258 * @hibernate.collection-key column="project_id"
259 * @hibernate.collection-one-to-many class="com.panogenesis.model.Component"
260 *
261 */
262 public Set getComponents() {
263 return components;
264 }
265
266 /***
267 * @param components The components to set.
268 */
269 public void setComponents(Set components) {
270 this.components = components;
271 }
272
273 /***
274 * Adds a component to the project
275 *
276 * @param component
277 */
278 public void addComponent(Component component) {
279 getComponents().add(component);
280 }
281
282 /***
283 * @return Returns the versions.
284 * @hibernate.set cascade="delete-orphan" lazy="false" order-by="id asc"
285 * @hibernate.collection-key column="project_id"
286 * @hibernate.collection-one-to-many class="com.panogenesis.model.ProjectVersion"
287
288 */
289 public Set getVersions() {
290 return versions;
291 }
292 /***
293 * @param versions The versions to set.
294 */
295 public void setVersions(Set versions) {
296 this.versions = versions;
297 }
298
299 /***
300 * Returns the set of owners.
301 * @return Set
302 *
303 * @hibernate.set table="project_user" cascade="all" lazy="false"
304 * @hibernate.collection-key column="project_id"
305 * @hibernate.collection-many-to-many class="com.panogenesis.model.User"
306 * column="username"
307 *
308 */
309 public Set getOwners() {
310 return owners;
311 }
312
313 /***
314 * @param components The components to set.
315 */
316 public void setOwners(Set owners) {
317 this.owners = owners;
318 }
319
320 /***
321 * Adds a component to the project
322 *
323 * @param component
324 */
325 public void addOwners(Set owners) {
326 getOwners().add(owners);
327 }
328
329 /***
330 * @see java.lang.Object#equals(Object)
331 */
332 public boolean equals(Object object) {
333 if (!(object instanceof Project)) {
334 return false;
335 }
336 Project rhs = (Project) object;
337 return new EqualsBuilder().append(
338 this.description, rhs.description).append(this.lastModified,
339 rhs.lastModified).append(this.createDate, rhs.createDate)
340 .append(this.status, rhs.status).append(this.name, rhs.name)
341 .append(this.id, rhs.id).append(this.options, rhs.options)
342 .isEquals();
343 }
344 /***
345 * @see java.lang.Object#hashCode()
346 */
347 public int hashCode() {
348 return new HashCodeBuilder(1332565015, 2121553825).append(this.description).append(
349 this.lastModified).append(this.createDate).append(this.status)
350 .append(this.name).append(this.id).append(this.options)
351 .toHashCode();
352 }
353 /***
354 * @see java.lang.Object#toString()
355 */
356 public String toString() {
357 return new ToStringBuilder(this).append("name", this.name).append(
358 "description", this.description).append("id", this.id).append(
359 "status", this.status)
360 .append("lastModified", this.lastModified).append("createDate",
361 this.createDate).append("options", this.options)
362 .toString();
363 }
364
365
366 }