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.system;
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.administration.program.Program;
30 import fr.ifremer.quadrige2.core.dao.referential.pmfm.Parameter;
31 import java.io.Serializable;
32 import java.sql.Timestamp;
33 import java.util.Collection;
34 import java.util.HashSet;
35
36 /**
37 * Contient les différentes fonction de calcul pour les paramètres
38 */
39 // HibernateEntity.vsl annotations merge-point
40 public abstract class ComputeFunction
41 implements Serializable, Comparable<ComputeFunction>
42 {
43 /**
44 * The serial version UID of this class. Needed for serialization.
45 */
46 private static final long serialVersionUID = 5707694753016612813L;
47
48 // Generate 4 attributes
49 private String compFunctionCd;
50
51 /**
52 * Code de la fonction de calcul
53 * @return this.compFunctionCd String
54 */
55 public String getCompFunctionCd()
56 {
57 return this.compFunctionCd;
58 }
59
60 /**
61 * Code de la fonction de calcul
62 * @param compFunctionCdIn String
63 */
64 public void setCompFunctionCd(String compFunctionCdIn)
65 {
66 this.compFunctionCd = compFunctionCdIn;
67 }
68
69 private String compFunctionNm;
70
71 /**
72 * Libellé de la fonction de calcul
73 * @return this.compFunctionNm String
74 */
75 public String getCompFunctionNm()
76 {
77 return this.compFunctionNm;
78 }
79
80 /**
81 * Libellé de la fonction de calcul
82 * @param compFunctionNmIn String
83 */
84 public void setCompFunctionNm(String compFunctionNmIn)
85 {
86 this.compFunctionNm = compFunctionNmIn;
87 }
88
89 private String compFunctionProcNm;
90
91 /**
92 * Nom de la procédure cataloguée oracle correspondant
93 * @return this.compFunctionProcNm String
94 */
95 public String getCompFunctionProcNm()
96 {
97 return this.compFunctionProcNm;
98 }
99
100 /**
101 * Nom de la procédure cataloguée oracle correspondant
102 * @param compFunctionProcNmIn String
103 */
104 public void setCompFunctionProcNm(String compFunctionProcNmIn)
105 {
106 this.compFunctionProcNm = compFunctionProcNmIn;
107 }
108
109 private Timestamp updateDt;
110
111 /**
112 * Date de mise à jour
113 * @return this.updateDt Timestamp
114 */
115 public Timestamp getUpdateDt()
116 {
117 return this.updateDt;
118 }
119
120 /**
121 * Date de mise à jour
122 * @param updateDtIn Timestamp
123 */
124 public void setUpdateDt(Timestamp updateDtIn)
125 {
126 this.updateDt = updateDtIn;
127 }
128
129 // Generate 3 associations
130 private Collection<ComputeMeasurement> compMeasIds = new HashSet<ComputeMeasurement>();
131
132 /**
133 * Contient les informations sur les mesures utilisées dans le calcul d'une mesure
134 * @return this.compMeasIds Collection<ComputeMeasurement>
135 */
136 public Collection<ComputeMeasurement> getCompMeasIds()
137 {
138 return this.compMeasIds;
139 }
140
141 /**
142 * Contient les informations sur les mesures utilisées dans le calcul d'une mesure
143 * @param compMeasIdsIn Collection<ComputeMeasurement>
144 */
145 public void setCompMeasIds(Collection<ComputeMeasurement> compMeasIdsIn)
146 {
147 this.compMeasIds = compMeasIdsIn;
148 }
149
150 /**
151 * Contient les informations sur les mesures utilisées dans le calcul d'une mesure
152 * @param elementToAdd ComputeMeasurement
153 * @return <tt>true</tt> if this collection changed as a result of the
154 * call
155 */
156 public boolean addCompMeasIds(ComputeMeasurement elementToAdd)
157 {
158 return this.compMeasIds.add(elementToAdd);
159 }
160
161 /**
162 * Contient les informations sur les mesures utilisées dans le calcul d'une mesure
163 * @param elementToRemove ComputeMeasurement
164 * @return <tt>true</tt> if this collection changed as a result of the
165 * call
166 */
167 public boolean removeCompMeasIds(ComputeMeasurement elementToRemove)
168 {
169 return this.compMeasIds.remove(elementToRemove);
170 }
171
172 private Collection<Program> progCds = new HashSet<Program>();
173
174 /**
175 * Activités à l'origine de la collecte d'un ensemble cohérent de données.
176 * @return this.progCds Collection<Program>
177 */
178 public Collection<Program> getProgCds()
179 {
180 return this.progCds;
181 }
182
183 /**
184 * Activités à l'origine de la collecte d'un ensemble cohérent de données.
185 * @param progCdsIn Collection<Program>
186 */
187 public void setProgCds(Collection<Program> progCdsIn)
188 {
189 this.progCds = progCdsIn;
190 }
191
192 /**
193 * Activités à l'origine de la collecte d'un ensemble cohérent de données.
194 * @param elementToAdd Program
195 * @return <tt>true</tt> if this collection changed as a result of the
196 * call
197 */
198 public boolean addProgCds(Program elementToAdd)
199 {
200 return this.progCds.add(elementToAdd);
201 }
202
203 /**
204 * Activités à l'origine de la collecte d'un ensemble cohérent de données.
205 * @param elementToRemove Program
206 * @return <tt>true</tt> if this collection changed as a result of the
207 * call
208 */
209 public boolean removeProgCds(Program elementToRemove)
210 {
211 return this.progCds.remove(elementToRemove);
212 }
213
214 private Collection<Parameter> parCds = new HashSet<Parameter>();
215
216 /**
217 * Liste les différents paramètres mesurés. Attention, voir PARAMETRE SISMER.
218 * @return this.parCds Collection<Parameter>
219 */
220 public Collection<Parameter> getParCds()
221 {
222 return this.parCds;
223 }
224
225 /**
226 * Liste les différents paramètres mesurés. Attention, voir PARAMETRE SISMER.
227 * @param parCdsIn Collection<Parameter>
228 */
229 public void setParCds(Collection<Parameter> parCdsIn)
230 {
231 this.parCds = parCdsIn;
232 }
233
234 /**
235 * Liste les différents paramètres mesurés. Attention, voir PARAMETRE SISMER.
236 * @param elementToAdd Parameter
237 * @return <tt>true</tt> if this collection changed as a result of the
238 * call
239 */
240 public boolean addParCds(Parameter elementToAdd)
241 {
242 return this.parCds.add(elementToAdd);
243 }
244
245 /**
246 * Liste les différents paramètres mesurés. Attention, voir PARAMETRE SISMER.
247 * @param elementToRemove Parameter
248 * @return <tt>true</tt> if this collection changed as a result of the
249 * call
250 */
251 public boolean removeParCds(Parameter elementToRemove)
252 {
253 return this.parCds.remove(elementToRemove);
254 }
255
256 /**
257 * Returns <code>true</code> if the argument is an ComputeFunction instance and all identifiers for this entity
258 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
259 */
260 @Override
261 public boolean equals(Object object)
262 {
263 if (this == object)
264 {
265 return true;
266 }
267 if (!(object instanceof ComputeFunction))
268 {
269 return false;
270 }
271 final ComputeFunction that = (ComputeFunction)object;
272 if (this.compFunctionCd == null || that.getCompFunctionCd() == null || !this.compFunctionCd.equals(that.getCompFunctionCd()))
273 {
274 return false;
275 }
276 return true;
277 }
278
279 /**
280 * Returns a hash code based on this entity's identifiers.
281 */
282 @Override
283 public int hashCode()
284 {
285 int hashCode = 0;
286 hashCode = 29 * hashCode + (this.compFunctionCd == null ? 0 : this.compFunctionCd.hashCode());
287
288 return hashCode;
289 }
290
291 /**
292 * Constructs new instances of {@link ComputeFunction}.
293 */
294 public static final class Factory
295 {
296 /**
297 * Constructs a new instance of {@link ComputeFunction}.
298 * @return new ComputeFunctionImpl()
299 */
300 public static ComputeFunction newInstance()
301 {
302 return new ComputeFunctionImpl();
303 }
304
305 /**
306 * Constructs a new instance of {@link ComputeFunction}, taking all required and/or
307 * read-only properties as arguments, except for identifiers.
308 * @param compFunctionNm String
309 * @param compFunctionProcNm String
310 * @param updateDt Timestamp
311 * @return newInstance
312 */
313 public static ComputeFunction newInstance(String compFunctionNm, String compFunctionProcNm, Timestamp updateDt)
314 {
315 final ComputeFunction entity = new ComputeFunctionImpl();
316 entity.setCompFunctionNm(compFunctionNm);
317 entity.setCompFunctionProcNm(compFunctionProcNm);
318 entity.setUpdateDt(updateDt);
319 return entity;
320 }
321
322 /**
323 * Constructs a new instance of {@link ComputeFunction}, taking all possible properties
324 * (except the identifier(s))as arguments.
325 * @param compFunctionNm String
326 * @param compFunctionProcNm String
327 * @param updateDt Timestamp
328 * @param compMeasIds Collection<ComputeMeasurement>
329 * @param progCds Collection<Program>
330 * @param parCds Collection<Parameter>
331 * @return newInstance ComputeFunction
332 */
333 public static ComputeFunction newInstance(String compFunctionNm, String compFunctionProcNm, Timestamp updateDt, Collection<ComputeMeasurement> compMeasIds, Collection<Program> progCds, Collection<Parameter> parCds)
334 {
335 final ComputeFunction entity = new ComputeFunctionImpl();
336 entity.setCompFunctionNm(compFunctionNm);
337 entity.setCompFunctionProcNm(compFunctionProcNm);
338 entity.setUpdateDt(updateDt);
339 entity.setCompMeasIds(compMeasIds);
340 entity.setProgCds(progCds);
341 entity.setParCds(parCds);
342 return entity;
343 }
344 }
345
346 /**
347 * @see Comparable#compareTo
348 */
349 public int compareTo(ComputeFunction o)
350 {
351 int cmp = 0;
352 if (this.getCompFunctionCd() != null)
353 {
354 cmp = this.getCompFunctionCd().compareTo(o.getCompFunctionCd());
355 }
356 else
357 {
358 if (this.getCompFunctionNm() != null)
359 {
360 cmp = (cmp != 0 ? cmp : this.getCompFunctionNm().compareTo(o.getCompFunctionNm()));
361 }
362 if (this.getCompFunctionProcNm() != null)
363 {
364 cmp = (cmp != 0 ? cmp : this.getCompFunctionProcNm().compareTo(o.getCompFunctionProcNm()));
365 }
366 if (this.getUpdateDt() != null)
367 {
368 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
369 }
370 }
371 return cmp;
372 }
373 // HibernateEntity.vsl merge-point
374 // ComputeFunction.java merge-point
375 }