1
2
3
4
5
6 package fr.ifremer.quadrige3.core.dao.system.rule;
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.Unit;
29 import fr.ifremer.quadrige3.core.dao.referential.pmfm.Fraction;
30 import fr.ifremer.quadrige3.core.dao.referential.pmfm.Matrix;
31 import fr.ifremer.quadrige3.core.dao.referential.pmfm.Method;
32 import fr.ifremer.quadrige3.core.dao.referential.pmfm.Parameter;
33 import java.io.Serializable;
34 import java.sql.Timestamp;
35
36
37
38
39
40 public abstract class RulePmfm
41 implements Serializable, Comparable<RulePmfm>
42 {
43
44
45
46 private static final long serialVersionUID = 568638865095291051L;
47
48
49 private Integer rulePmfmId;
50
51
52
53
54
55 public Integer getRulePmfmId()
56 {
57 return this.rulePmfmId;
58 }
59
60
61
62
63
64 public void setRulePmfmId(Integer rulePmfmIdIn)
65 {
66 this.rulePmfmId = rulePmfmIdIn;
67 }
68
69 private Timestamp updateDt;
70
71
72
73
74
75 public Timestamp getUpdateDt()
76 {
77 return this.updateDt;
78 }
79
80
81
82
83
84 public void setUpdateDt(Timestamp updateDtIn)
85 {
86 this.updateDt = updateDtIn;
87 }
88
89
90 private Unit unit;
91
92
93
94
95
96 public Unit getUnit()
97 {
98 return this.unit;
99 }
100
101
102
103
104
105 public void setUnit(Unit unitIn)
106 {
107 this.unit = unitIn;
108 }
109
110 private Matrix matrix;
111
112
113
114
115
116 public Matrix getMatrix()
117 {
118 return this.matrix;
119 }
120
121
122
123
124
125 public void setMatrix(Matrix matrixIn)
126 {
127 this.matrix = matrixIn;
128 }
129
130 private Method method;
131
132
133
134
135
136 public Method getMethod()
137 {
138 return this.method;
139 }
140
141
142
143
144
145 public void setMethod(Method methodIn)
146 {
147 this.method = methodIn;
148 }
149
150 private Parameter parameter;
151
152
153
154
155
156 public Parameter getParameter()
157 {
158 return this.parameter;
159 }
160
161
162
163
164
165 public void setParameter(Parameter parameterIn)
166 {
167 this.parameter = parameterIn;
168 }
169
170 private Fraction fraction;
171
172
173
174
175
176 public Fraction getFraction()
177 {
178 return this.fraction;
179 }
180
181
182
183
184
185 public void setFraction(Fraction fractionIn)
186 {
187 this.fraction = fractionIn;
188 }
189
190 private Rule rule;
191
192
193
194
195
196 public Rule getRule()
197 {
198 return this.rule;
199 }
200
201
202
203
204
205 public void setRule(Rule ruleIn)
206 {
207 this.rule = ruleIn;
208 }
209
210
211
212
213
214 @Override
215 public boolean equals(Object object)
216 {
217 if (this == object)
218 {
219 return true;
220 }
221 if (!(object instanceof RulePmfm))
222 {
223 return false;
224 }
225 final RulePmfm that = (RulePmfm)object;
226 if (this.rulePmfmId == null || that.getRulePmfmId() == null || !this.rulePmfmId.equals(that.getRulePmfmId()))
227 {
228 return false;
229 }
230 return true;
231 }
232
233
234
235
236 @Override
237 public int hashCode()
238 {
239 int hashCode = 0;
240 hashCode = 29 * hashCode + (this.rulePmfmId == null ? 0 : this.rulePmfmId.hashCode());
241
242 return hashCode;
243 }
244
245
246
247
248 public static final class Factory
249 {
250
251
252
253
254 public static RulePmfm newInstance()
255 {
256 return new RulePmfmImpl();
257 }
258
259
260
261
262
263
264
265
266 public static RulePmfm newInstance(Parameter parameter, Rule rule)
267 {
268 final RulePmfm entity = new RulePmfmImpl();
269 entity.setParameter(parameter);
270 entity.setRule(rule);
271 return entity;
272 }
273
274
275
276
277
278
279
280
281
282
283
284
285
286 public static RulePmfm newInstance(Timestamp updateDt, Unit unit, Matrix matrix, Method method, Parameter parameter, Fraction fraction, Rule rule)
287 {
288 final RulePmfm entity = new RulePmfmImpl();
289 entity.setUpdateDt(updateDt);
290 entity.setUnit(unit);
291 entity.setMatrix(matrix);
292 entity.setMethod(method);
293 entity.setParameter(parameter);
294 entity.setFraction(fraction);
295 entity.setRule(rule);
296 return entity;
297 }
298 }
299
300
301
302
303 public int compareTo(RulePmfm o)
304 {
305 int cmp = 0;
306 if (this.getRulePmfmId() != null)
307 {
308 cmp = this.getRulePmfmId().compareTo(o.getRulePmfmId());
309 }
310 else
311 {
312 if (this.getUpdateDt() != null)
313 {
314 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
315 }
316 }
317 return cmp;
318 }
319
320
321 }