1
2
3
4
5
6 package fr.ifremer.quadrige3.core.dao.referential.pmfm;
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 import fr.ifremer.quadrige3.core.dao.referential.Status;
29 import java.io.Serializable;
30 import java.sql.Timestamp;
31 import java.util.Collection;
32 import java.util.Date;
33 import java.util.HashSet;
34
35
36
37
38
39 public abstract class Fraction
40 implements Serializable, Comparable<Fraction>
41 {
42
43
44
45 private static final long serialVersionUID = -2623646185397189514L;
46
47
48 private Integer fractionId;
49
50
51
52
53
54 public Integer getFractionId()
55 {
56 return this.fractionId;
57 }
58
59
60
61
62
63 public void setFractionId(Integer fractionIdIn)
64 {
65 this.fractionId = fractionIdIn;
66 }
67
68 private String fractionNm;
69
70
71
72
73
74 public String getFractionNm()
75 {
76 return this.fractionNm;
77 }
78
79
80
81
82
83 public void setFractionNm(String fractionNmIn)
84 {
85 this.fractionNm = fractionNmIn;
86 }
87
88 private String fractionDc;
89
90
91
92
93
94 public String getFractionDc()
95 {
96 return this.fractionDc;
97 }
98
99
100
101
102
103 public void setFractionDc(String fractionDcIn)
104 {
105 this.fractionDc = fractionDcIn;
106 }
107
108 private Date fractionCreationDt;
109
110
111
112
113
114 public Date getFractionCreationDt()
115 {
116 return this.fractionCreationDt;
117 }
118
119
120
121
122
123 public void setFractionCreationDt(Date fractionCreationDtIn)
124 {
125 this.fractionCreationDt = fractionCreationDtIn;
126 }
127
128 private Timestamp updateDt;
129
130
131
132
133
134 public Timestamp getUpdateDt()
135 {
136 return this.updateDt;
137 }
138
139
140
141
142
143 public void setUpdateDt(Timestamp updateDtIn)
144 {
145 this.updateDt = updateDtIn;
146 }
147
148 private String fractionCm;
149
150
151
152
153
154 public String getFractionCm()
155 {
156 return this.fractionCm;
157 }
158
159
160
161
162
163 public void setFractionCm(String fractionCmIn)
164 {
165 this.fractionCm = fractionCmIn;
166 }
167
168
169 private Collection<Matrix> matrixes = new HashSet<Matrix>();
170
171
172
173
174
175 public Collection<Matrix> getMatrixes()
176 {
177 return this.matrixes;
178 }
179
180
181
182
183
184 public void setMatrixes(Collection<Matrix> matrixesIn)
185 {
186 this.matrixes = matrixesIn;
187 }
188
189
190
191
192
193
194
195 public boolean addMatrixes(Matrix elementToAdd)
196 {
197 return this.matrixes.add(elementToAdd);
198 }
199
200
201
202
203
204
205
206 public boolean removeMatrixes(Matrix elementToRemove)
207 {
208 return this.matrixes.remove(elementToRemove);
209 }
210
211 private Collection<Pmfm> pmfms = new HashSet<Pmfm>();
212
213
214
215
216
217 public Collection<Pmfm> getPmfms()
218 {
219 return this.pmfms;
220 }
221
222
223
224
225
226 public void setPmfms(Collection<Pmfm> pmfmsIn)
227 {
228 this.pmfms = pmfmsIn;
229 }
230
231
232
233
234
235
236
237 public boolean addPmfms(Pmfm elementToAdd)
238 {
239 return this.pmfms.add(elementToAdd);
240 }
241
242
243
244
245
246
247
248 public boolean removePmfms(Pmfm elementToRemove)
249 {
250 return this.pmfms.remove(elementToRemove);
251 }
252
253 private Status status;
254
255
256
257
258
259 public Status getStatus()
260 {
261 return this.status;
262 }
263
264
265
266
267
268 public void setStatus(Status statusIn)
269 {
270 this.status = statusIn;
271 }
272
273
274
275
276
277 @Override
278 public boolean equals(Object object)
279 {
280 if (this == object)
281 {
282 return true;
283 }
284 if (!(object instanceof Fraction))
285 {
286 return false;
287 }
288 final Fraction that = (Fraction)object;
289 if (this.fractionId == null || that.getFractionId() == null || !this.fractionId.equals(that.getFractionId()))
290 {
291 return false;
292 }
293 return true;
294 }
295
296
297
298
299 @Override
300 public int hashCode()
301 {
302 int hashCode = 0;
303 hashCode = 29 * hashCode + (this.fractionId == null ? 0 : this.fractionId.hashCode());
304
305 return hashCode;
306 }
307
308
309
310
311 public static final class Factory
312 {
313
314
315
316
317 public static Fraction newInstance()
318 {
319 return new FractionImpl();
320 }
321
322
323
324
325
326
327
328
329 public static Fraction newInstance(String fractionNm, Status status)
330 {
331 final Fraction entity = new FractionImpl();
332 entity.setFractionNm(fractionNm);
333 entity.setStatus(status);
334 return entity;
335 }
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350 public static Fraction newInstance(String fractionNm, String fractionDc, Date fractionCreationDt, Timestamp updateDt, String fractionCm, Collection<Matrix> matrixes, Collection<Pmfm> pmfms, Status status)
351 {
352 final Fraction entity = new FractionImpl();
353 entity.setFractionNm(fractionNm);
354 entity.setFractionDc(fractionDc);
355 entity.setFractionCreationDt(fractionCreationDt);
356 entity.setUpdateDt(updateDt);
357 entity.setFractionCm(fractionCm);
358 entity.setMatrixes(matrixes);
359 entity.setPmfms(pmfms);
360 entity.setStatus(status);
361 return entity;
362 }
363 }
364
365
366
367
368 public int compareTo(Fraction o)
369 {
370 int cmp = 0;
371 if (this.getFractionId() != null)
372 {
373 cmp = this.getFractionId().compareTo(o.getFractionId());
374 }
375 else
376 {
377 if (this.getFractionNm() != null)
378 {
379 cmp = (cmp != 0 ? cmp : this.getFractionNm().compareTo(o.getFractionNm()));
380 }
381 if (this.getFractionDc() != null)
382 {
383 cmp = (cmp != 0 ? cmp : this.getFractionDc().compareTo(o.getFractionDc()));
384 }
385 if (this.getFractionCreationDt() != null)
386 {
387 cmp = (cmp != 0 ? cmp : this.getFractionCreationDt().compareTo(o.getFractionCreationDt()));
388 }
389 if (this.getUpdateDt() != null)
390 {
391 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
392 }
393 if (this.getFractionCm() != null)
394 {
395 cmp = (cmp != 0 ? cmp : this.getFractionCm().compareTo(o.getFractionCm()));
396 }
397 }
398 return cmp;
399 }
400
401
402 }