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.quadrige2.core.dao.referential;
7
8 /*-
9 * #%L
10 * Quadrige2 Core :: Server API
11 * %%
12 * Copyright (C) 2017 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
29 import fr.ifremer.quadrige2.core.dao.sandre.SandreAnalysisInstrumentExp;
30 import fr.ifremer.quadrige2.core.dao.sandre.SandreAnalysisInstrumentImp;
31 import java.io.Serializable;
32 import java.sql.Timestamp;
33 import java.util.Collection;
34 import java.util.HashSet;
35
36 /**
37 * Liste les engins d'analyse ou de prélèvement (au sens marque/modèle et non numéro de série).
38 */
39 // HibernateEntity.vsl annotations merge-point
40 public abstract class AnalysisInstrument
41 implements Serializable, Comparable<AnalysisInstrument>
42 {
43 /**
44 * The serial version UID of this class. Needed for serialization.
45 */
46 private static final long serialVersionUID = 715685291693032509L;
47
48 // Generate 4 attributes
49 private Integer analInstId;
50
51 /**
52 * Identifiant de l'engin
53 * @return this.analInstId Integer
54 */
55 public Integer getAnalInstId()
56 {
57 return this.analInstId;
58 }
59
60 /**
61 * Identifiant de l'engin
62 * @param analInstIdIn Integer
63 */
64 public void setAnalInstId(Integer analInstIdIn)
65 {
66 this.analInstId = analInstIdIn;
67 }
68
69 private String analInstNm;
70
71 /**
72 * Libellé de l'engin d'analyse
73 * @return this.analInstNm String
74 */
75 public String getAnalInstNm()
76 {
77 return this.analInstNm;
78 }
79
80 /**
81 * Libellé de l'engin d'analyse
82 * @param analInstNmIn String
83 */
84 public void setAnalInstNm(String analInstNmIn)
85 {
86 this.analInstNm = analInstNmIn;
87 }
88
89 private String analInstDc;
90
91 /**
92 * Description de l'engin
93 * @return this.analInstDc String
94 */
95 public String getAnalInstDc()
96 {
97 return this.analInstDc;
98 }
99
100 /**
101 * Description de l'engin
102 * @param analInstDcIn String
103 */
104 public void setAnalInstDc(String analInstDcIn)
105 {
106 this.analInstDc = analInstDcIn;
107 }
108
109 private Timestamp updateDt;
110
111 /**
112 * Date de modification de l'objet, mise à jour par le système
113 * @return this.updateDt Timestamp
114 */
115 public Timestamp getUpdateDt()
116 {
117 return this.updateDt;
118 }
119
120 /**
121 * Date de modification de l'objet, mise à jour par le système
122 * @param updateDtIn Timestamp
123 */
124 public void setUpdateDt(Timestamp updateDtIn)
125 {
126 this.updateDt = updateDtIn;
127 }
128
129 // Generate 7 associations
130 private Collection<SandreAnalysisInstrumentImp> sandreAnalysisInstrumentImpIds = new HashSet<SandreAnalysisInstrumentImp>();
131
132 /**
133 * Liste des instruments d'analyse sandre pour les imports de données
134 * @return this.sandreAnalysisInstrumentImpIds Collection<SandreAnalysisInstrumentImp>
135 */
136 public Collection<SandreAnalysisInstrumentImp> getSandreAnalysisInstrumentImpIds()
137 {
138 return this.sandreAnalysisInstrumentImpIds;
139 }
140
141 /**
142 * Liste des instruments d'analyse sandre pour les imports de données
143 * @param sandreAnalysisInstrumentImpIdsIn Collection<SandreAnalysisInstrumentImp>
144 */
145 public void setSandreAnalysisInstrumentImpIds(Collection<SandreAnalysisInstrumentImp> sandreAnalysisInstrumentImpIdsIn)
146 {
147 this.sandreAnalysisInstrumentImpIds = sandreAnalysisInstrumentImpIdsIn;
148 }
149
150 /**
151 * Liste des instruments d'analyse sandre pour les imports de données
152 * @param elementToAdd SandreAnalysisInstrumentImp
153 * @return <tt>true</tt> if this collection changed as a result of the
154 * call
155 */
156 public boolean addSandreAnalysisInstrumentImpIds(SandreAnalysisInstrumentImp elementToAdd)
157 {
158 return this.sandreAnalysisInstrumentImpIds.add(elementToAdd);
159 }
160
161 /**
162 * Liste des instruments d'analyse sandre pour les imports de données
163 * @param elementToRemove SandreAnalysisInstrumentImp
164 * @return <tt>true</tt> if this collection changed as a result of the
165 * call
166 */
167 public boolean removeSandreAnalysisInstrumentImpIds(SandreAnalysisInstrumentImp elementToRemove)
168 {
169 return this.sandreAnalysisInstrumentImpIds.remove(elementToRemove);
170 }
171
172 private Status status;
173
174 /**
175 * Liste des états possibles d'un objet.
176 * @return this.status Status
177 */
178 public Status getStatus()
179 {
180 return this.status;
181 }
182
183 /**
184 * Liste des états possibles d'un objet.
185 * @param statusIn Status
186 */
187 public void setStatus(Status statusIn)
188 {
189 this.status = statusIn;
190 }
191
192 private Collection<SandreAnalysisInstrumentExp> sandreAnalysisInstrumentExpIds = new HashSet<SandreAnalysisInstrumentExp>();
193
194 /**
195 * Liste des instruments d'analyse sandre pour les exports de données
196 * @return this.sandreAnalysisInstrumentExpIds Collection<SandreAnalysisInstrumentExp>
197 */
198 public Collection<SandreAnalysisInstrumentExp> getSandreAnalysisInstrumentExpIds()
199 {
200 return this.sandreAnalysisInstrumentExpIds;
201 }
202
203 /**
204 * Liste des instruments d'analyse sandre pour les exports de données
205 * @param sandreAnalysisInstrumentExpIdsIn Collection<SandreAnalysisInstrumentExp>
206 */
207 public void setSandreAnalysisInstrumentExpIds(Collection<SandreAnalysisInstrumentExp> sandreAnalysisInstrumentExpIdsIn)
208 {
209 this.sandreAnalysisInstrumentExpIds = sandreAnalysisInstrumentExpIdsIn;
210 }
211
212 /**
213 * Liste des instruments d'analyse sandre pour les exports de données
214 * @param elementToAdd SandreAnalysisInstrumentExp
215 * @return <tt>true</tt> if this collection changed as a result of the
216 * call
217 */
218 public boolean addSandreAnalysisInstrumentExpIds(SandreAnalysisInstrumentExp elementToAdd)
219 {
220 return this.sandreAnalysisInstrumentExpIds.add(elementToAdd);
221 }
222
223 /**
224 * Liste des instruments d'analyse sandre pour les exports de données
225 * @param elementToRemove SandreAnalysisInstrumentExp
226 * @return <tt>true</tt> if this collection changed as a result of the
227 * call
228 */
229 public boolean removeSandreAnalysisInstrumentExpIds(SandreAnalysisInstrumentExp elementToRemove)
230 {
231 return this.sandreAnalysisInstrumentExpIds.remove(elementToRemove);
232 }
233
234 /**
235 * Returns <code>true</code> if the argument is an AnalysisInstrument instance and all identifiers for this entity
236 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
237 */
238 @Override
239 public boolean equals(Object object)
240 {
241 if (this == object)
242 {
243 return true;
244 }
245 if (!(object instanceof AnalysisInstrument))
246 {
247 return false;
248 }
249 final AnalysisInstrument that = (AnalysisInstrument)object;
250 if (this.analInstId == null || that.getAnalInstId() == null || !this.analInstId.equals(that.getAnalInstId()))
251 {
252 return false;
253 }
254 return true;
255 }
256
257 /**
258 * Returns a hash code based on this entity's identifiers.
259 */
260 @Override
261 public int hashCode()
262 {
263 int hashCode = 0;
264 hashCode = 29 * hashCode + (this.analInstId == null ? 0 : this.analInstId.hashCode());
265
266 return hashCode;
267 }
268
269 /**
270 * Constructs new instances of {@link AnalysisInstrument}.
271 */
272 public static final class Factory
273 {
274 /**
275 * Constructs a new instance of {@link AnalysisInstrument}.
276 * @return new AnalysisInstrumentImpl()
277 */
278 public static AnalysisInstrument newInstance()
279 {
280 return new AnalysisInstrumentImpl();
281 }
282
283 /**
284 * Constructs a new instance of {@link AnalysisInstrument}, taking all required and/or
285 * read-only properties as arguments, except for identifiers.
286 * @param analInstNm String
287 * @param updateDt Timestamp
288 * @param status Status
289 * @return newInstance
290 */
291 public static AnalysisInstrument newInstance(String analInstNm, Timestamp updateDt, Status status)
292 {
293 final AnalysisInstrument entity = new AnalysisInstrumentImpl();
294 entity.setAnalInstNm(analInstNm);
295 entity.setUpdateDt(updateDt);
296 entity.setStatus(status);
297 return entity;
298 }
299
300 /**
301 * Constructs a new instance of {@link AnalysisInstrument}, taking all possible properties
302 * (except the identifier(s))as arguments.
303 * @param analInstNm String
304 * @param analInstDc String
305 * @param updateDt Timestamp
306 * @param sandreAnalysisInstrumentImpIds Collection<SandreAnalysisInstrumentImp>
307 * @param status Status
308 * @param sandreAnalysisInstrumentExpIds Collection<SandreAnalysisInstrumentExp>
309 * @return newInstance AnalysisInstrument
310 */
311 public static AnalysisInstrument newInstance(String analInstNm, String analInstDc, Timestamp updateDt, Collection<SandreAnalysisInstrumentImp> sandreAnalysisInstrumentImpIds, Status status, Collection<SandreAnalysisInstrumentExp> sandreAnalysisInstrumentExpIds)
312 {
313 final AnalysisInstrument entity = new AnalysisInstrumentImpl();
314 entity.setAnalInstNm(analInstNm);
315 entity.setAnalInstDc(analInstDc);
316 entity.setUpdateDt(updateDt);
317 entity.setSandreAnalysisInstrumentImpIds(sandreAnalysisInstrumentImpIds);
318 entity.setStatus(status);
319 entity.setSandreAnalysisInstrumentExpIds(sandreAnalysisInstrumentExpIds);
320 return entity;
321 }
322 }
323
324 /**
325 * @see Comparable#compareTo
326 */
327 public int compareTo(AnalysisInstrument o)
328 {
329 int cmp = 0;
330 if (this.getAnalInstId() != null)
331 {
332 cmp = this.getAnalInstId().compareTo(o.getAnalInstId());
333 }
334 else
335 {
336 if (this.getAnalInstNm() != null)
337 {
338 cmp = (cmp != 0 ? cmp : this.getAnalInstNm().compareTo(o.getAnalInstNm()));
339 }
340 if (this.getAnalInstDc() != null)
341 {
342 cmp = (cmp != 0 ? cmp : this.getAnalInstDc().compareTo(o.getAnalInstDc()));
343 }
344 if (this.getUpdateDt() != null)
345 {
346 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
347 }
348 }
349 return cmp;
350 }
351 // HibernateEntity.vsl merge-point
352 // AnalysisInstrument.java merge-point
353 }