1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 package fr.ifremer.quadrige3.core.vo.administration.strategy;
30
31 import java.io.Serializable;
32 import java.sql.Timestamp;
33 import java.util.Arrays;
34 import java.util.Date;
35 import org.apache.commons.lang3.builder.CompareToBuilder;
36 import org.apache.commons.lang3.builder.EqualsBuilder;
37 import org.apache.commons.lang3.builder.HashCodeBuilder;
38 import org.apache.commons.lang3.builder.ToStringBuilder;
39
40
41
42
43 public class AppliedPeriodVO
44 implements Serializable, Comparable<AppliedPeriodVO>
45 {
46
47 private static final long serialVersionUID = 7525651096912121704L;
48
49
50
51
52
53 protected Date appliedPeriodStartDt;
54
55
56
57 protected Date appliedPeriodEndDt;
58
59
60
61 protected Timestamp updateDt;
62
63 protected Integer appliedStratId;
64
65
66
67
68
69 protected AppliedStrategyVO appliedStrategyVO;
70
71
72 public AppliedPeriodVO()
73 {
74
75 }
76
77
78
79
80
81
82
83
84 public AppliedPeriodVO(final Date appliedPeriodStartDtIn, final Date appliedPeriodEndDtIn, final Integer appliedStratIdIn, final AppliedStrategyVO appliedStrategyVOIn)
85 {
86 this.appliedPeriodStartDt = appliedPeriodStartDtIn;
87 this.appliedPeriodEndDt = appliedPeriodEndDtIn;
88 this.appliedStratId = appliedStratIdIn;
89 this.appliedStrategyVO = appliedStrategyVOIn;
90 }
91
92
93
94
95
96
97
98
99
100 public AppliedPeriodVO(final Date appliedPeriodStartDtIn, final Date appliedPeriodEndDtIn, final Timestamp updateDtIn, final Integer appliedStratIdIn, final AppliedStrategyVO appliedStrategyVOIn)
101 {
102 this.appliedPeriodStartDt = appliedPeriodStartDtIn;
103 this.appliedPeriodEndDt = appliedPeriodEndDtIn;
104 this.updateDt = updateDtIn;
105 this.appliedStratId = appliedStratIdIn;
106 this.appliedStrategyVO = appliedStrategyVOIn;
107 }
108
109
110
111
112
113
114
115 public AppliedPeriodVO(final AppliedPeriodVO otherBean)
116 {
117 this.appliedPeriodStartDt = otherBean.getAppliedPeriodStartDt();
118 this.appliedPeriodEndDt = otherBean.getAppliedPeriodEndDt();
119 this.updateDt = otherBean.getUpdateDt();
120 this.appliedStratId = otherBean.getAppliedStratId();
121 this.appliedStrategyVO = otherBean.getAppliedStrategyVO();
122 }
123
124
125
126
127
128 public void copy(final AppliedPeriodVO otherBean)
129 {
130 if (null != otherBean)
131 {
132 this.setAppliedPeriodStartDt(otherBean.getAppliedPeriodStartDt());
133 this.setAppliedPeriodEndDt(otherBean.getAppliedPeriodEndDt());
134 this.setUpdateDt(otherBean.getUpdateDt());
135 this.setAppliedStratId(otherBean.getAppliedStratId());
136 this.setAppliedStrategyVO(otherBean.getAppliedStrategyVO());
137 }
138 }
139
140
141
142
143
144
145 public Date getAppliedPeriodStartDt()
146 {
147 return this.appliedPeriodStartDt;
148 }
149
150
151
152
153
154 public void setAppliedPeriodStartDt(final Date value)
155 {
156 this.appliedPeriodStartDt = value;
157 }
158
159
160
161
162
163
164 public Date getAppliedPeriodEndDt()
165 {
166 return this.appliedPeriodEndDt;
167 }
168
169
170
171
172
173 public void setAppliedPeriodEndDt(final Date value)
174 {
175 this.appliedPeriodEndDt = value;
176 }
177
178
179
180
181
182
183 public Timestamp getUpdateDt()
184 {
185 return this.updateDt;
186 }
187
188
189
190
191
192 public void setUpdateDt(final Timestamp value)
193 {
194 this.updateDt = value;
195 }
196
197
198
199
200
201
202 public Integer getAppliedStratId()
203 {
204 return this.appliedStratId;
205 }
206
207
208
209
210
211 public void setAppliedStratId(final Integer value)
212 {
213 this.appliedStratId = value;
214 }
215
216
217
218
219
220
221 public AppliedStrategyVO getAppliedStrategyVO()
222 {
223 return this.appliedStrategyVO;
224 }
225
226
227
228
229
230 public void setAppliedStrategyVO(AppliedStrategyVO value)
231 {
232 this.appliedStrategyVO = value;
233 }
234
235
236
237
238
239
240 @Override
241 public boolean equals(final Object object)
242 {
243 if (object==null || object.getClass() != this.getClass())
244 {
245 return false;
246 }
247
248 if (object==this)
249 {
250 return true;
251 }
252 AppliedPeriodVO rhs = (AppliedPeriodVO) object;
253 return new EqualsBuilder()
254 .append(this.getAppliedPeriodStartDt(), rhs.getAppliedPeriodStartDt())
255 .append(this.getAppliedPeriodEndDt(), rhs.getAppliedPeriodEndDt())
256 .append(this.getUpdateDt(), rhs.getUpdateDt())
257 .append(this.getAppliedStratId(), rhs.getAppliedStratId())
258 .append(this.getAppliedStrategyVO(), rhs.getAppliedStrategyVO())
259 .isEquals();
260 }
261
262
263
264
265
266
267 public int compareTo(final AppliedPeriodVO object)
268 {
269 if (object==null)
270 {
271 return -1;
272 }
273
274 if (object==this)
275 {
276 return 0;
277 }
278 return new CompareToBuilder()
279 .append(this.getAppliedPeriodStartDt(), object.getAppliedPeriodStartDt())
280 .append(this.getAppliedPeriodEndDt(), object.getAppliedPeriodEndDt())
281 .append(this.getUpdateDt(), object.getUpdateDt())
282 .append(this.getAppliedStratId(), object.getAppliedStratId())
283 .append(this.getAppliedStrategyVO(), object.getAppliedStrategyVO())
284 .toComparison();
285 }
286
287
288
289
290
291 @Override
292 public int hashCode()
293 {
294 return new HashCodeBuilder(1249046965, -82296885)
295 .append(this.getAppliedPeriodStartDt())
296 .append(this.getAppliedPeriodEndDt())
297 .append(this.getUpdateDt())
298 .append(this.getAppliedStratId())
299 .append(this.getAppliedStrategyVO())
300 .toHashCode();
301 }
302
303
304
305
306
307 @Override
308 public String toString()
309 {
310 return new ToStringBuilder(this)
311 .append("appliedPeriodStartDt", this.getAppliedPeriodStartDt())
312 .append("appliedPeriodEndDt", this.getAppliedPeriodEndDt())
313 .append("updateDt", this.getUpdateDt())
314 .append("appliedStratId", this.getAppliedStratId())
315 .append("appliedStrategyVO", this.getAppliedStrategyVO())
316 .toString();
317 }
318
319
320
321
322
323
324
325
326
327
328
329
330
331 protected static boolean equal(final Object first, final Object second)
332 {
333 final boolean equal;
334
335 if (first == null)
336 {
337 equal = (second == null);
338 }
339 else if (first.getClass().isArray() && (second != null) && second.getClass().isArray())
340 {
341 equal = Arrays.equals((Object[])first, (Object[])second);
342 }
343 else
344 {
345 equal = first.equals(second);
346 }
347
348 return equal;
349 }
350
351
352 }