1 /*
2 * #%L
3 * Quadrige3 Core
4 * %%
5 * Copyright (C) 2017 Ifremer
6 * %%
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * #L%
20 */
21 //
22 /**
23 * @author Generated on 07/22/2024 16:45:05+0200 Do not modify by hand!
24 *
25 * TEMPLATE: ValueObject.vsl in andromda-java-cartridge.
26 * MODEL CLASS: Données::fr.ifremer.quadrige3.core::vo::administration::user::LightQuserVO
27 * STEREOTYPE: ValueObject
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 * TODO: Model Documentation for class LightQuserVO
40 */
41 public class LightQuserVO
42 implements Serializable, Comparable<LightQuserVO>
43 {
44 /** The serial version UID of this class. Needed for serialization. */
45 private static final long serialVersionUID = -1585720450855704024L;
46
47 // Class attributes
48 /** TODO: Model Documentation for attribute id */
49 protected int id;
50 /**
51 * boolean setter for primitive attribute, so we can tell if it's initialized
52 */
53 protected boolean setId = false;
54 /** TODO: Model Documentation for attribute lastname */
55 protected String lastname;
56 /** TODO: Model Documentation for attribute firstname */
57 protected String firstname;
58
59 /** Default Constructor with no properties */
60 public LightQuserVO()
61 {
62 // Documented empty block - avoid compiler warning - no super constructor
63 }
64
65 /**
66 * Constructor with all properties
67 * @param idIn int
68 * @param lastnameIn String
69 * @param firstnameIn String
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 * Copies constructor from other LightQuserVO
81 *
82 * @param otherBean Cannot be <code>null</code>
83 * @throws NullPointerException if the argument is <code>null</code>
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 * Copies all properties from the argument value object into this value object.
95 * @param otherBean Cannot be <code>null</code>
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 * TODO: Model Documentation for attribute id
110 * Get the id Attribute
111 * @return id int
112 */
113 public int getId()
114 {
115 return this.id;
116 }
117
118 /**
119 *
120 * @param value int
121 */
122 public void setId(final int value)
123 {
124 this.id = value;
125 this.setId = true;
126 }
127
128 /**
129 * Return true if the primitive attribute id is set, through the setter or constructor
130 * @return true if the attribute value has been set
131 */
132 public boolean isSetId()
133 {
134 return this.setId;
135 }
136
137 /**
138 * TODO: Model Documentation for attribute lastname
139 * Get the lastname Attribute
140 * @return lastname String
141 */
142 public String getLastname()
143 {
144 return this.lastname;
145 }
146
147 /**
148 *
149 * @param value String
150 */
151 public void setLastname(final String value)
152 {
153 this.lastname = value;
154 }
155
156 /**
157 * TODO: Model Documentation for attribute firstname
158 * Get the firstname Attribute
159 * @return firstname String
160 */
161 public String getFirstname()
162 {
163 return this.firstname;
164 }
165
166 /**
167 *
168 * @param value String
169 */
170 public void setFirstname(final String value)
171 {
172 this.firstname = value;
173 }
174
175 /**
176 * @param object to compare this object against
177 * @return boolean if equal
178 * @see Object#equals(Object)
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 // Check if the same object instance
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 * @param object to compare this object against
202 * @return int if equal
203 * @see Comparable#compareTo(Object)
204 */
205 public int compareTo(final LightQuserVO object)
206 {
207 if (object==null)
208 {
209 return -1;
210 }
211 // Check if the same object instance
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 * @return int hashCode value
225 * @see Object#hashCode()
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 * @return String representation of object
239 * @see Object#toString()
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 * This is a convenient helper method which is able to detect whether or not two values are equal. Two values
253 * are equal when they are both {@code null}, are arrays of the same length with equal elements or are
254 * equal objects (this includes {@link java.util.Collection} and {@link java.util.Map} instances).
255 *
256 * <p/>Note that for array, collection or map instances the comparison runs one level deep.
257 *
258 * @param first the first object to compare, may be {@code null}
259 * @param second the second object to compare, may be {@code null}
260 * @return this method will return {@code true} in case both objects are equal as explained above;
261 * in all other cases this method will return {@code false}
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 // note that the following also covers java.util.Collection and java.util.Map
276 {
277 equal = first.equals(second);
278 }
279
280 return equal;
281 }
282
283 // LightQuserVO value-object java merge-point
284 }