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.user;
30
31 import java.io.Serializable;
32 import java.util.Arrays;
33 import org.apache.commons.lang3.builder.CompareToBuilder;
34 import org.apache.commons.lang3.builder.EqualsBuilder;
35 import org.apache.commons.lang3.builder.HashCodeBuilder;
36 import org.apache.commons.lang3.builder.ToStringBuilder;
37
38
39
40
41 public class LightQuserVO
42 implements Serializable, Comparable<LightQuserVO>
43 {
44
45 private static final long serialVersionUID = -1585720450855704024L;
46
47
48
49 protected int id;
50
51
52
53 protected boolean setId = false;
54
55 protected String lastname;
56
57 protected String firstname;
58
59
60 public LightQuserVO()
61 {
62
63 }
64
65
66
67
68
69
70
71 public LightQuserVO(final int idIn, final String lastnameIn, final String firstnameIn)
72 {
73 this.id = idIn;
74 this.setId = true;
75 this.lastname = lastnameIn;
76 this.firstname = firstnameIn;
77 }
78
79
80
81
82
83
84
85 public LightQuserVO(final LightQuserVO otherBean)
86 {
87 this.id = otherBean.getId();
88 this.setId = true;
89 this.lastname = otherBean.getLastname();
90 this.firstname = otherBean.getFirstname();
91 }
92
93
94
95
96
97 public void copy(final LightQuserVO otherBean)
98 {
99 if (null != otherBean)
100 {
101 this.setId(otherBean.getId());
102 this.setId = true;
103 this.setLastname(otherBean.getLastname());
104 this.setFirstname(otherBean.getFirstname());
105 }
106 }
107
108
109
110
111
112
113 public int getId()
114 {
115 return this.id;
116 }
117
118
119
120
121
122 public void setId(final int value)
123 {
124 this.id = value;
125 this.setId = true;
126 }
127
128
129
130
131
132 public boolean isSetId()
133 {
134 return this.setId;
135 }
136
137
138
139
140
141
142 public String getLastname()
143 {
144 return this.lastname;
145 }
146
147
148
149
150
151 public void setLastname(final String value)
152 {
153 this.lastname = value;
154 }
155
156
157
158
159
160
161 public String getFirstname()
162 {
163 return this.firstname;
164 }
165
166
167
168
169
170 public void setFirstname(final String value)
171 {
172 this.firstname = value;
173 }
174
175
176
177
178
179
180 @Override
181 public boolean equals(final Object object)
182 {
183 if (object==null || object.getClass() != this.getClass())
184 {
185 return false;
186 }
187
188 if (object==this)
189 {
190 return true;
191 }
192 LightQuserVO rhs = (LightQuserVO) object;
193 return new EqualsBuilder()
194 .append(this.getId(), rhs.getId())
195 .append(this.getLastname(), rhs.getLastname())
196 .append(this.getFirstname(), rhs.getFirstname())
197 .isEquals();
198 }
199
200
201
202
203
204
205 public int compareTo(final LightQuserVO object)
206 {
207 if (object==null)
208 {
209 return -1;
210 }
211
212 if (object==this)
213 {
214 return 0;
215 }
216 return new CompareToBuilder()
217 .append(this.getId(), object.getId())
218 .append(this.getLastname(), object.getLastname())
219 .append(this.getFirstname(), object.getFirstname())
220 .toComparison();
221 }
222
223
224
225
226
227 @Override
228 public int hashCode()
229 {
230 return new HashCodeBuilder(1249046965, -82296885)
231 .append(this.getId())
232 .append(this.getLastname())
233 .append(this.getFirstname())
234 .toHashCode();
235 }
236
237
238
239
240
241 @Override
242 public String toString()
243 {
244 return new ToStringBuilder(this)
245 .append("id", this.getId())
246 .append("lastname", this.getLastname())
247 .append("firstname", this.getFirstname())
248 .toString();
249 }
250
251
252
253
254
255
256
257
258
259
260
261
262
263 protected static boolean equal(final Object first, final Object second)
264 {
265 final boolean equal;
266
267 if (first == null)
268 {
269 equal = (second == null);
270 }
271 else if (first.getClass().isArray() && (second != null) && second.getClass().isArray())
272 {
273 equal = Arrays.equals((Object[])first, (Object[])second);
274 }
275 else
276 {
277 equal = first.equals(second);
278 }
279
280 return equal;
281 }
282
283
284 }