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::PrivilegeVO
27 * STEREOTYPE: ValueObject
28 */
29 package fr.ifremer.quadrige3.core.vo.administration.user;
30
31 import java.io.Serializable;
32 import java.sql.Timestamp;
33 import java.util.Arrays;
34 import org.apache.commons.lang3.builder.CompareToBuilder;
35 import org.apache.commons.lang3.builder.EqualsBuilder;
36 import org.apache.commons.lang3.builder.HashCodeBuilder;
37 import org.apache.commons.lang3.builder.ToStringBuilder;
38
39 /**
40 * TODO: Model Documentation for class PrivilegeVO
41 */
42 public class PrivilegeVO
43 implements Serializable, Comparable<PrivilegeVO>
44 {
45 /** The serial version UID of this class. Needed for serialization. */
46 private static final long serialVersionUID = -1635634027883761952L;
47
48 // Class attributes
49 /**
50 * Code unique du profil
51 */
52 protected String privilegeCd;
53 /**
54 * Llibellé décrivant le profil
55 */
56 protected String privilegeNm;
57 /**
58 * Description du profil
59 */
60 protected String privilegeDc;
61 /**
62 * Date de modification de l'objet, mise à jour par le système
63 */
64 protected Timestamp updateDt;
65 /**
66 * Code de l'état de l'objet (actif ou inactif)
67 */
68 protected String statusCd;
69
70 /** Default Constructor with no properties */
71 public PrivilegeVO()
72 {
73 // Documented empty block - avoid compiler warning - no super constructor
74 }
75
76 /**
77 * Constructor taking only required properties
78 * @param privilegeCdIn String Code unique du profil
79 * @param privilegeNmIn String Llibellé décrivant le profil
80 * @param statusCdIn String Code de l'état de l'objet (actif ou inactif)
81 */
82 public PrivilegeVO(final String privilegeCdIn, final String privilegeNmIn, final String statusCdIn)
83 {
84 this.privilegeCd = privilegeCdIn;
85 this.privilegeNm = privilegeNmIn;
86 this.statusCd = statusCdIn;
87 }
88
89 /**
90 * Constructor with all properties
91 * @param privilegeCdIn String
92 * @param privilegeNmIn String
93 * @param privilegeDcIn String
94 * @param updateDtIn Timestamp
95 * @param statusCdIn String
96 */
97 public PrivilegeVO(final String privilegeCdIn, final String privilegeNmIn, final String privilegeDcIn, final Timestamp updateDtIn, final String statusCdIn)
98 {
99 this.privilegeCd = privilegeCdIn;
100 this.privilegeNm = privilegeNmIn;
101 this.privilegeDc = privilegeDcIn;
102 this.updateDt = updateDtIn;
103 this.statusCd = statusCdIn;
104 }
105
106 /**
107 * Copies constructor from other PrivilegeVO
108 *
109 * @param otherBean Cannot be <code>null</code>
110 * @throws NullPointerException if the argument is <code>null</code>
111 */
112 public PrivilegeVO(final PrivilegeVO otherBean)
113 {
114 this.privilegeCd = otherBean.getPrivilegeCd();
115 this.privilegeNm = otherBean.getPrivilegeNm();
116 this.privilegeDc = otherBean.getPrivilegeDc();
117 this.updateDt = otherBean.getUpdateDt();
118 this.statusCd = otherBean.getStatusCd();
119 }
120
121 /**
122 * Copies all properties from the argument value object into this value object.
123 * @param otherBean Cannot be <code>null</code>
124 */
125 public void copy(final PrivilegeVO otherBean)
126 {
127 if (null != otherBean)
128 {
129 this.setPrivilegeCd(otherBean.getPrivilegeCd());
130 this.setPrivilegeNm(otherBean.getPrivilegeNm());
131 this.setPrivilegeDc(otherBean.getPrivilegeDc());
132 this.setUpdateDt(otherBean.getUpdateDt());
133 this.setStatusCd(otherBean.getStatusCd());
134 }
135 }
136
137 /**
138 * Code unique du profil
139 * Get the privilegeCd Attribute
140 * @return privilegeCd String
141 */
142 public String getPrivilegeCd()
143 {
144 return this.privilegeCd;
145 }
146
147 /**
148 * Code unique du profil
149 * @param value String
150 */
151 public void setPrivilegeCd(final String value)
152 {
153 this.privilegeCd = value;
154 }
155
156 /**
157 * Llibellé décrivant le profil
158 * Get the privilegeNm Attribute
159 * @return privilegeNm String
160 */
161 public String getPrivilegeNm()
162 {
163 return this.privilegeNm;
164 }
165
166 /**
167 * Llibellé décrivant le profil
168 * @param value String
169 */
170 public void setPrivilegeNm(final String value)
171 {
172 this.privilegeNm = value;
173 }
174
175 /**
176 * Description du profil
177 * Get the privilegeDc Attribute
178 * @return privilegeDc String
179 */
180 public String getPrivilegeDc()
181 {
182 return this.privilegeDc;
183 }
184
185 /**
186 * Description du profil
187 * @param value String
188 */
189 public void setPrivilegeDc(final String value)
190 {
191 this.privilegeDc = value;
192 }
193
194 /**
195 * Date de modification de l'objet, mise à jour par le système
196 * Get the updateDt Attribute
197 * @return updateDt Timestamp
198 */
199 public Timestamp getUpdateDt()
200 {
201 return this.updateDt;
202 }
203
204 /**
205 * Date de modification de l'objet, mise à jour par le système
206 * @param value Timestamp
207 */
208 public void setUpdateDt(final Timestamp value)
209 {
210 this.updateDt = value;
211 }
212
213 /**
214 * Code de l'état de l'objet (actif ou inactif)
215 * Get the statusCd Attribute
216 * @return statusCd String
217 */
218 public String getStatusCd()
219 {
220 return this.statusCd;
221 }
222
223 /**
224 * Code de l'état de l'objet (actif ou inactif)
225 * @param value String
226 */
227 public void setStatusCd(final String value)
228 {
229 this.statusCd = value;
230 }
231
232 /**
233 * @param object to compare this object against
234 * @return boolean if equal
235 * @see Object#equals(Object)
236 */
237 @Override
238 public boolean equals(final Object object)
239 {
240 if (object==null || object.getClass() != this.getClass())
241 {
242 return false;
243 }
244 // Check if the same object instance
245 if (object==this)
246 {
247 return true;
248 }
249 PrivilegeVO rhs = (PrivilegeVO) object;
250 return new EqualsBuilder()
251 .append(this.getPrivilegeCd(), rhs.getPrivilegeCd())
252 .append(this.getPrivilegeNm(), rhs.getPrivilegeNm())
253 .append(this.getPrivilegeDc(), rhs.getPrivilegeDc())
254 .append(this.getUpdateDt(), rhs.getUpdateDt())
255 .append(this.getStatusCd(), rhs.getStatusCd())
256 .isEquals();
257 }
258
259 /**
260 * @param object to compare this object against
261 * @return int if equal
262 * @see Comparable#compareTo(Object)
263 */
264 public int compareTo(final PrivilegeVO object)
265 {
266 if (object==null)
267 {
268 return -1;
269 }
270 // Check if the same object instance
271 if (object==this)
272 {
273 return 0;
274 }
275 return new CompareToBuilder()
276 .append(this.getPrivilegeCd(), object.getPrivilegeCd())
277 .append(this.getPrivilegeNm(), object.getPrivilegeNm())
278 .append(this.getPrivilegeDc(), object.getPrivilegeDc())
279 .append(this.getUpdateDt(), object.getUpdateDt())
280 .append(this.getStatusCd(), object.getStatusCd())
281 .toComparison();
282 }
283
284 /**
285 * @return int hashCode value
286 * @see Object#hashCode()
287 */
288 @Override
289 public int hashCode()
290 {
291 return new HashCodeBuilder(1249046965, -82296885)
292 .append(this.getPrivilegeCd())
293 .append(this.getPrivilegeNm())
294 .append(this.getPrivilegeDc())
295 .append(this.getUpdateDt())
296 .append(this.getStatusCd())
297 .toHashCode();
298 }
299
300 /**
301 * @return String representation of object
302 * @see Object#toString()
303 */
304 @Override
305 public String toString()
306 {
307 return new ToStringBuilder(this)
308 .append("privilegeCd", this.getPrivilegeCd())
309 .append("privilegeNm", this.getPrivilegeNm())
310 .append("privilegeDc", this.getPrivilegeDc())
311 .append("updateDt", this.getUpdateDt())
312 .append("statusCd", this.getStatusCd())
313 .toString();
314 }
315
316 /**
317 * This is a convenient helper method which is able to detect whether or not two values are equal. Two values
318 * are equal when they are both {@code null}, are arrays of the same length with equal elements or are
319 * equal objects (this includes {@link java.util.Collection} and {@link java.util.Map} instances).
320 *
321 * <p/>Note that for array, collection or map instances the comparison runs one level deep.
322 *
323 * @param first the first object to compare, may be {@code null}
324 * @param second the second object to compare, may be {@code null}
325 * @return this method will return {@code true} in case both objects are equal as explained above;
326 * in all other cases this method will return {@code false}
327 */
328 protected static boolean equal(final Object first, final Object second)
329 {
330 final boolean equal;
331
332 if (first == null)
333 {
334 equal = (second == null);
335 }
336 else if (first.getClass().isArray() && (second != null) && second.getClass().isArray())
337 {
338 equal = Arrays.equals((Object[])first, (Object[])second);
339 }
340 else // note that the following also covers java.util.Collection and java.util.Map
341 {
342 equal = first.equals(second);
343 }
344
345 return equal;
346 }
347
348 // PrivilegeVO value-object java merge-point
349 }