1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.itracker.model;
20
21 import org.apache.commons.lang.builder.CompareToBuilder;
22 import org.apache.commons.lang.builder.ToStringBuilder;
23
24 import java.io.Serializable;
25 import java.util.*;
26
27
28
29
30
31
32
33
34
35
36 public class Project extends AbstractEntity implements Comparable<Entity> {
37
38 public static final ProjectComparator PROJECT_COMPARATOR = new ProjectComparator();
39
40
41
42 private static final long serialVersionUID = 1L;
43
44 private String name;
45
46 private String description;
47
48
49
50
51
52
53
54
55 private Status status;
56
57 private int options;
58
59
60
61
62
63
64
65
66 private List<Component> components = new ArrayList<Component>();
67
68
69
70
71
72
73
74
75 private List<Version> versions = new ArrayList<Version>();
76
77
78
79
80
81
82
83
84
85
86
87 private Set<Permission> permissions = new TreeSet<Permission>(Permission.PERMISSION_PROPERTIES_COMPARATOR);
88
89
90
91
92
93
94 private List<User> owners = new ArrayList<User>();
95
96
97
98
99
100
101
102
103
104
105
106
107 private List<CustomField> customFields = new ArrayList<CustomField>();
108
109
110
111
112 private List<ProjectScript> scripts = new ArrayList<ProjectScript>();
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129 public Project() {
130 }
131
132 public Project(String name) {
133 setName(name);
134 this.status = Status.ACTIVE;
135 }
136
137 public String getName() {
138 return name;
139 }
140
141 public void setName(String name) {
142 if (name == null) {
143 throw new IllegalArgumentException("null name");
144 }
145 this.name = name;
146 }
147
148 public String getDescription() {
149 return description;
150 }
151
152 public void setDescription(String description) {
153 this.description = description;
154 }
155
156
157
158
159 public Status getStatus() {
160 return status;
161 }
162
163
164
165
166 public void setStatus(Status status) {
167 if (status == null) {
168 throw new IllegalArgumentException("null status");
169 }
170 this.status = status;
171 }
172
173 public int getOptions() {
174 return options;
175 }
176
177 public void setOptions(int options) {
178 this.options = options;
179 }
180
181 public List<Component> getComponents() {
182 return components;
183 }
184
185 public void setComponents(List<Component> getComponents) {
186 this.components = getComponents;
187 }
188
189 public List<Version> getVersions() {
190 return versions;
191 }
192
193 public void setVersions(List<Version> getVersions) {
194 this.versions = getVersions;
195 }
196
197 public List<CustomField> getCustomFields() {
198 return customFields;
199 }
200
201 public void setCustomFields(List<CustomField> getCustomFields) {
202 this.customFields = getCustomFields;
203 }
204
205 public List<User> getOwners() {
206 return owners;
207 }
208
209 public void setOwners(List<User> getOwners) {
210 this.owners = getOwners;
211 }
212
213 public Set<Permission> getPermissions() {
214 return permissions;
215 }
216
217 public void setPermissions(Set<Permission> getPermissions) {
218 this.permissions = getPermissions;
219 }
220
221 public List<ProjectScript> getScripts() {
222 return scripts;
223 }
224
225 public void setScripts(List<ProjectScript> getScripts) {
226 this.scripts = getScripts;
227 }
228
229
230
231
232 @Override
233 public String toString() {
234
235 return new ToStringBuilder(this).append("id", this.getId()).append("name",
236 this.getName()).append("description", getDescription()).append("owners", getOwners()).toString();
237 }
238
239
240
241
242 public static final class ProjectComparator implements Comparator<Project>, Serializable {
243
244
245
246 private static final long serialVersionUID = 1L;
247
248 public int compare(Projectref="../../../org/itracker/model/Project.html#Project">Project o1, Project o2) {
249 return new CompareToBuilder().append(o1.getName(), o2.getName()).append(
250 o1.getId(), o2.getId()).toComparison();
251 }
252 }
253 }