1 // license-header java merge-point
2 //
3 // Attention: Generated code! Do not modify by hand!
4 // Generated by: hibernate/HibernateEntity.vsl in andromda-hibernate-cartridge.
5 //
6 package fr.ifremer.quadrige3.core.dao.system;
7
8 /*-
9 * #%L
10 * Quadrige3 Core :: Client API
11 * %%
12 * Copyright (C) 2017 - 2024 Ifremer
13 * %%
14 * This program is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Affero General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU Affero General Public License
25 * along with this program. If not, see <http://www.gnu.org/licenses/>.
26 * #L%
27 */
28 import java.io.Serializable;
29 import java.sql.Timestamp;
30 import java.util.Collection;
31 import java.util.HashSet;
32
33 /**
34 * Localisations pouvant être utilisées pour initialiser la localisation des passages.
35 */
36 // HibernateEntity.vsl annotations merge-point
37 public abstract class Location
38 implements Serializable, Comparable<Location>
39 {
40 /**
41 * The serial version UID of this class. Needed for serialization.
42 */
43 private static final long serialVersionUID = -4044959175915177383L;
44
45 // Generate 5 attributes
46 private Integer locId;
47
48 /**
49 * Identifiant de la localisation
50 * @return this.locId Integer
51 */
52 public Integer getLocId()
53 {
54 return this.locId;
55 }
56
57 /**
58 * Identifiant de la localisation
59 * @param locIdIn Integer
60 */
61 public void setLocId(Integer locIdIn)
62 {
63 this.locId = locIdIn;
64 }
65
66 private String locLb;
67
68 /**
69 * Mnémonique de la localisation
70 * @return this.locLb String
71 */
72 public String getLocLb()
73 {
74 return this.locLb;
75 }
76
77 /**
78 * Mnémonique de la localisation
79 * @param locLbIn String
80 */
81 public void setLocLb(String locLbIn)
82 {
83 this.locLb = locLbIn;
84 }
85
86 private String locNm;
87
88 /**
89 * Libellé de la localisation
90 * @return this.locNm String
91 */
92 public String getLocNm()
93 {
94 return this.locNm;
95 }
96
97 /**
98 * Libellé de la localisation
99 * @param locNmIn String
100 */
101 public void setLocNm(String locNmIn)
102 {
103 this.locNm = locNmIn;
104 }
105
106 private String locDc;
107
108 /**
109 * Description de la localisation
110 * @return this.locDc String
111 */
112 public String getLocDc()
113 {
114 return this.locDc;
115 }
116
117 /**
118 * Description de la localisation
119 * @param locDcIn String
120 */
121 public void setLocDc(String locDcIn)
122 {
123 this.locDc = locDcIn;
124 }
125
126 private Timestamp updateDt;
127
128 /**
129 *
130 * @return this.updateDt Timestamp
131 */
132 public Timestamp getUpdateDt()
133 {
134 return this.updateDt;
135 }
136
137 /**
138 *
139 * @param updateDtIn Timestamp
140 */
141 public void setUpdateDt(Timestamp updateDtIn)
142 {
143 this.updateDt = updateDtIn;
144 }
145
146 // Generate 1 associations
147 private Collection<LocPoint> locPoints = new HashSet<LocPoint>();
148
149 /**
150 * Gestion de la géométrie ponctuelle des localisations
151 * @return this.locPoints Collection<LocPoint>
152 */
153 public Collection<LocPoint> getLocPoints()
154 {
155 return this.locPoints;
156 }
157
158 /**
159 * Gestion de la géométrie ponctuelle des localisations
160 * @param locPointsIn Collection<LocPoint>
161 */
162 public void setLocPoints(Collection<LocPoint> locPointsIn)
163 {
164 this.locPoints = locPointsIn;
165 }
166
167 /**
168 * Gestion de la géométrie ponctuelle des localisations
169 * @param elementToAdd LocPoint
170 * @return <tt>true</tt> if this collection changed as a result of the
171 * call
172 */
173 public boolean addLocPoints(LocPoint elementToAdd)
174 {
175 return this.locPoints.add(elementToAdd);
176 }
177
178 /**
179 * Gestion de la géométrie ponctuelle des localisations
180 * @param elementToRemove LocPoint
181 * @return <tt>true</tt> if this collection changed as a result of the
182 * call
183 */
184 public boolean removeLocPoints(LocPoint elementToRemove)
185 {
186 return this.locPoints.remove(elementToRemove);
187 }
188
189 /**
190 * Returns <code>true</code> if the argument is an Location instance and all identifiers for this entity
191 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
192 */
193 @Override
194 public boolean equals(Object object)
195 {
196 if (this == object)
197 {
198 return true;
199 }
200 if (!(object instanceof Location))
201 {
202 return false;
203 }
204 final Location that = (Location)object;
205 if (this.locId == null || that.getLocId() == null || !this.locId.equals(that.getLocId()))
206 {
207 return false;
208 }
209 return true;
210 }
211
212 /**
213 * Returns a hash code based on this entity's identifiers.
214 */
215 @Override
216 public int hashCode()
217 {
218 int hashCode = 0;
219 hashCode = 29 * hashCode + (this.locId == null ? 0 : this.locId.hashCode());
220
221 return hashCode;
222 }
223
224 /**
225 * Constructs new instances of {@link Location}.
226 */
227 public static final class Factory
228 {
229 /**
230 * Constructs a new instance of {@link Location}.
231 * @return new LocationImpl()
232 */
233 public static Location newInstance()
234 {
235 return new LocationImpl();
236 }
237
238 /**
239 * Constructs a new instance of {@link Location}, taking all required and/or
240 * read-only properties as arguments, except for identifiers.
241 * @param locLb String
242 * @param locNm String
243 * @return newInstance
244 */
245 public static Location newInstance(String locLb, String locNm)
246 {
247 final Location entity = new LocationImpl();
248 entity.setLocLb(locLb);
249 entity.setLocNm(locNm);
250 return entity;
251 }
252
253 /**
254 * Constructs a new instance of {@link Location}, taking all possible properties
255 * (except the identifier(s))as arguments.
256 * @param locLb String
257 * @param locNm String
258 * @param locDc String
259 * @param updateDt Timestamp
260 * @param locPoints Collection<LocPoint>
261 * @return newInstance Location
262 */
263 public static Location newInstance(String locLb, String locNm, String locDc, Timestamp updateDt, Collection<LocPoint> locPoints)
264 {
265 final Location entity = new LocationImpl();
266 entity.setLocLb(locLb);
267 entity.setLocNm(locNm);
268 entity.setLocDc(locDc);
269 entity.setUpdateDt(updateDt);
270 entity.setLocPoints(locPoints);
271 return entity;
272 }
273 }
274
275 /**
276 * @see Comparable#compareTo
277 */
278 public int compareTo(Location o)
279 {
280 int cmp = 0;
281 if (this.getLocId() != null)
282 {
283 cmp = this.getLocId().compareTo(o.getLocId());
284 }
285 else
286 {
287 if (this.getLocLb() != null)
288 {
289 cmp = (cmp != 0 ? cmp : this.getLocLb().compareTo(o.getLocLb()));
290 }
291 if (this.getLocNm() != null)
292 {
293 cmp = (cmp != 0 ? cmp : this.getLocNm().compareTo(o.getLocNm()));
294 }
295 if (this.getLocDc() != null)
296 {
297 cmp = (cmp != 0 ? cmp : this.getLocDc().compareTo(o.getLocDc()));
298 }
299 if (this.getUpdateDt() != null)
300 {
301 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
302 }
303 }
304 return cmp;
305 }
306 // HibernateEntity.vsl merge-point
307 // Location.java merge-point
308 }