1
2
3
4
5
6 package fr.ifremer.quadrige2.core.dao.referential;
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 import java.io.Serializable;
30 import java.sql.Timestamp;
31 import java.util.Collection;
32 import java.util.HashSet;
33
34
35
36
37
38 public abstract class Status
39 implements Serializable, Comparable<Status>
40 {
41
42
43
44 private static final long serialVersionUID = 2413971720867301580L;
45
46
47 private String statusCd;
48
49
50
51
52
53 public String getStatusCd()
54 {
55 return this.statusCd;
56 }
57
58
59
60
61
62 public void setStatusCd(String statusCdIn)
63 {
64 this.statusCd = statusCdIn;
65 }
66
67 private String statusNm;
68
69
70
71
72
73 public String getStatusNm()
74 {
75 return this.statusNm;
76 }
77
78
79
80
81
82 public void setStatusNm(String statusNmIn)
83 {
84 this.statusNm = statusNmIn;
85 }
86
87 private String statusDc;
88
89
90
91
92
93 public String getStatusDc()
94 {
95 return this.statusDc;
96 }
97
98
99
100
101
102 public void setStatusDc(String statusDcIn)
103 {
104 this.statusDc = statusDcIn;
105 }
106
107 private Timestamp updateDt;
108
109
110
111
112
113 public Timestamp getUpdateDt()
114 {
115 return this.updateDt;
116 }
117
118
119
120
121
122 public void setUpdateDt(Timestamp updateDtIn)
123 {
124 this.updateDt = updateDtIn;
125 }
126
127
128 private Collection<PrecisionType> precisionTypes = new HashSet<PrecisionType>();
129
130
131
132
133
134 public Collection<PrecisionType> getPrecisionTypes()
135 {
136 return this.precisionTypes;
137 }
138
139
140
141
142
143 public void setPrecisionTypes(Collection<PrecisionType> precisionTypesIn)
144 {
145 this.precisionTypes = precisionTypesIn;
146 }
147
148
149
150
151
152
153
154 public boolean addPrecisionTypes(PrecisionType elementToAdd)
155 {
156 return this.precisionTypes.add(elementToAdd);
157 }
158
159
160
161
162
163
164
165 public boolean removePrecisionTypes(PrecisionType elementToRemove)
166 {
167 return this.precisionTypes.remove(elementToRemove);
168 }
169
170
171
172
173
174 @Override
175 public boolean equals(Object object)
176 {
177 if (this == object)
178 {
179 return true;
180 }
181 if (!(object instanceof Status))
182 {
183 return false;
184 }
185 final Status that = (Status)object;
186 if (this.statusCd == null || that.getStatusCd() == null || !this.statusCd.equals(that.getStatusCd()))
187 {
188 return false;
189 }
190 return true;
191 }
192
193
194
195
196 @Override
197 public int hashCode()
198 {
199 int hashCode = 0;
200 hashCode = 29 * hashCode + (this.statusCd == null ? 0 : this.statusCd.hashCode());
201
202 return hashCode;
203 }
204
205
206
207
208 public static final class Factory
209 {
210
211
212
213
214 public static Status newInstance()
215 {
216 return new StatusImpl();
217 }
218
219
220
221
222
223
224
225
226 public static Status newInstance(String statusNm, Timestamp updateDt)
227 {
228 final Status entity = new StatusImpl();
229 entity.setStatusNm(statusNm);
230 entity.setUpdateDt(updateDt);
231 return entity;
232 }
233
234
235
236
237
238
239
240
241
242
243 public static Status newInstance(String statusNm, String statusDc, Timestamp updateDt, Collection<PrecisionType> precisionTypes)
244 {
245 final Status entity = new StatusImpl();
246 entity.setStatusNm(statusNm);
247 entity.setStatusDc(statusDc);
248 entity.setUpdateDt(updateDt);
249 entity.setPrecisionTypes(precisionTypes);
250 return entity;
251 }
252 }
253
254
255
256
257 public int compareTo(Status o)
258 {
259 int cmp = 0;
260 if (this.getStatusCd() != null)
261 {
262 cmp = this.getStatusCd().compareTo(o.getStatusCd());
263 }
264 else
265 {
266 if (this.getStatusNm() != null)
267 {
268 cmp = (cmp != 0 ? cmp : this.getStatusNm().compareTo(o.getStatusNm()));
269 }
270 if (this.getStatusDc() != null)
271 {
272 cmp = (cmp != 0 ? cmp : this.getStatusDc().compareTo(o.getStatusDc()));
273 }
274 if (this.getUpdateDt() != null)
275 {
276 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
277 }
278 }
279 return cmp;
280 }
281
282
283 }