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 Matrix
40 implements Serializable, Comparable<Matrix>
41 {
42
43
44
45 private static final long serialVersionUID = 5184077680699660582L;
46
47
48 private Integer matrixId;
49
50
51
52
53
54 public Integer getMatrixId()
55 {
56 return this.matrixId;
57 }
58
59
60
61
62
63 public void setMatrixId(Integer matrixIdIn)
64 {
65 this.matrixId = matrixIdIn;
66 }
67
68 private String matrixNm;
69
70
71
72
73
74 public String getMatrixNm()
75 {
76 return this.matrixNm;
77 }
78
79
80
81
82
83 public void setMatrixNm(String matrixNmIn)
84 {
85 this.matrixNm = matrixNmIn;
86 }
87
88 private String matrixDc;
89
90
91
92
93
94 public String getMatrixDc()
95 {
96 return this.matrixDc;
97 }
98
99
100
101
102
103 public void setMatrixDc(String matrixDcIn)
104 {
105 this.matrixDc = matrixDcIn;
106 }
107
108 private Date matrixCreationDt;
109
110
111
112
113
114 public Date getMatrixCreationDt()
115 {
116 return this.matrixCreationDt;
117 }
118
119
120
121
122
123 public void setMatrixCreationDt(Date matrixCreationDtIn)
124 {
125 this.matrixCreationDt = matrixCreationDtIn;
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 matrixCm;
149
150
151
152
153
154 public String getMatrixCm()
155 {
156 return this.matrixCm;
157 }
158
159
160
161
162
163 public void setMatrixCm(String matrixCmIn)
164 {
165 this.matrixCm = matrixCmIn;
166 }
167
168
169 private Collection<Pmfm> pmfms = new HashSet<Pmfm>();
170
171
172
173
174
175 public Collection<Pmfm> getPmfms()
176 {
177 return this.pmfms;
178 }
179
180
181
182
183
184 public void setPmfms(Collection<Pmfm> pmfmsIn)
185 {
186 this.pmfms = pmfmsIn;
187 }
188
189
190
191
192
193
194
195 public boolean addPmfms(Pmfm elementToAdd)
196 {
197 return this.pmfms.add(elementToAdd);
198 }
199
200
201
202
203
204
205
206 public boolean removePmfms(Pmfm elementToRemove)
207 {
208 return this.pmfms.remove(elementToRemove);
209 }
210
211 private Collection<Fraction> fractions = new HashSet<Fraction>();
212
213
214
215
216
217 public Collection<Fraction> getFractions()
218 {
219 return this.fractions;
220 }
221
222
223
224
225
226 public void setFractions(Collection<Fraction> fractionsIn)
227 {
228 this.fractions = fractionsIn;
229 }
230
231
232
233
234
235
236
237 public boolean addFractions(Fraction elementToAdd)
238 {
239 return this.fractions.add(elementToAdd);
240 }
241
242
243
244
245
246
247
248 public boolean removeFractions(Fraction elementToRemove)
249 {
250 return this.fractions.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 Matrix))
285 {
286 return false;
287 }
288 final Matrix that = (Matrix)object;
289 if (this.matrixId == null || that.getMatrixId() == null || !this.matrixId.equals(that.getMatrixId()))
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.matrixId == null ? 0 : this.matrixId.hashCode());
304
305 return hashCode;
306 }
307
308
309
310
311 public static final class Factory
312 {
313
314
315
316
317 public static Matrix newInstance()
318 {
319 return new MatrixImpl();
320 }
321
322
323
324
325
326
327
328
329 public static Matrix newInstance(String matrixNm, Status status)
330 {
331 final Matrix entity = new MatrixImpl();
332 entity.setMatrixNm(matrixNm);
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 Matrix newInstance(String matrixNm, String matrixDc, Date matrixCreationDt, Timestamp updateDt, String matrixCm, Collection<Pmfm> pmfms, Collection<Fraction> fractions, Status status)
351 {
352 final Matrix entity = new MatrixImpl();
353 entity.setMatrixNm(matrixNm);
354 entity.setMatrixDc(matrixDc);
355 entity.setMatrixCreationDt(matrixCreationDt);
356 entity.setUpdateDt(updateDt);
357 entity.setMatrixCm(matrixCm);
358 entity.setPmfms(pmfms);
359 entity.setFractions(fractions);
360 entity.setStatus(status);
361 return entity;
362 }
363 }
364
365
366
367
368 public int compareTo(Matrix o)
369 {
370 int cmp = 0;
371 if (this.getMatrixId() != null)
372 {
373 cmp = this.getMatrixId().compareTo(o.getMatrixId());
374 }
375 else
376 {
377 if (this.getMatrixNm() != null)
378 {
379 cmp = (cmp != 0 ? cmp : this.getMatrixNm().compareTo(o.getMatrixNm()));
380 }
381 if (this.getMatrixDc() != null)
382 {
383 cmp = (cmp != 0 ? cmp : this.getMatrixDc().compareTo(o.getMatrixDc()));
384 }
385 if (this.getMatrixCreationDt() != null)
386 {
387 cmp = (cmp != 0 ? cmp : this.getMatrixCreationDt().compareTo(o.getMatrixCreationDt()));
388 }
389 if (this.getUpdateDt() != null)
390 {
391 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
392 }
393 if (this.getMatrixCm() != null)
394 {
395 cmp = (cmp != 0 ? cmp : this.getMatrixCm().compareTo(o.getMatrixCm()));
396 }
397 }
398 return cmp;
399 }
400
401
402 }