View Javadoc
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.referential;
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 fr.ifremer.quadrige3.core.dao.referential.monitoringLocation.ProjectionSystem;
29  import fr.ifremer.quadrige3.core.dao.referential.pmfm.Pmfm;
30  import java.io.Serializable;
31  import java.sql.Timestamp;
32  import java.util.Collection;
33  import java.util.Date;
34  import java.util.HashSet;
35  
36  /**
37   * Liste l'ensemble des unités de mesure.
38   */
39  // HibernateEntity.vsl annotations merge-point
40  public abstract class Unit
41      implements Serializable, Comparable<Unit>
42  {
43      /**
44       * The serial version UID of this class. Needed for serialization.
45       */
46      private static final long serialVersionUID = -8320669481596096160L;
47  
48      // Generate 6 attributes
49      private Integer unitId;
50  
51      /**
52       * Identifiant interne de l'unité
53       * @return this.unitId Integer
54       */
55      public Integer getUnitId()
56      {
57          return this.unitId;
58      }
59  
60      /**
61       * Identifiant interne de l'unité
62       * @param unitIdIn Integer
63       */
64      public void setUnitId(Integer unitIdIn)
65      {
66          this.unitId = unitIdIn;
67      }
68  
69      private String unitNm;
70  
71      /**
72       * Libellé de l'unité (kilogramme, ...)
73       * @return this.unitNm String
74       */
75      public String getUnitNm()
76      {
77          return this.unitNm;
78      }
79  
80      /**
81       * Libellé de l'unité (kilogramme, ...)
82       * @param unitNmIn String
83       */
84      public void setUnitNm(String unitNmIn)
85      {
86          this.unitNm = unitNmIn;
87      }
88  
89      private String unitSymbol;
90  
91      /**
92       * Symbole de l'unité (kg, cm, ...)
93       * @return this.unitSymbol String
94       */
95      public String getUnitSymbol()
96      {
97          return this.unitSymbol;
98      }
99  
100     /**
101      * Symbole de l'unité (kg, cm, ...)
102      * @param unitSymbolIn String
103      */
104     public void setUnitSymbol(String unitSymbolIn)
105     {
106         this.unitSymbol = unitSymbolIn;
107     }
108 
109     private Date unitCreationDt;
110 
111     /**
112      * Date de création de l'unité
113      * @return this.unitCreationDt Date
114      */
115     public Date getUnitCreationDt()
116     {
117         return this.unitCreationDt;
118     }
119 
120     /**
121      * Date de création de l'unité
122      * @param unitCreationDtIn Date
123      */
124     public void setUnitCreationDt(Date unitCreationDtIn)
125     {
126         this.unitCreationDt = unitCreationDtIn;
127     }
128 
129     private Timestamp updateDt;
130 
131     /**
132      * Date de maj de l'unité
133      * @return this.updateDt Timestamp
134      */
135     public Timestamp getUpdateDt()
136     {
137         return this.updateDt;
138     }
139 
140     /**
141      * Date de maj de l'unité
142      * @param updateDtIn Timestamp
143      */
144     public void setUpdateDt(Timestamp updateDtIn)
145     {
146         this.updateDt = updateDtIn;
147     }
148 
149     private String unitCm;
150 
151     /**
152      * 
153      * @return this.unitCm String
154      */
155     public String getUnitCm()
156     {
157         return this.unitCm;
158     }
159 
160     /**
161      * 
162      * @param unitCmIn String
163      */
164     public void setUnitCm(String unitCmIn)
165     {
166         this.unitCm = unitCmIn;
167     }
168 
169     // Generate 11 associations
170     private Collection<Pmfm> pmfms = new HashSet<Pmfm>();
171 
172     /**
173      * Liste les quadruplets paramètre, méthode, support, fraction.
174      * @return this.pmfms Collection<Pmfm>
175      */
176     public Collection<Pmfm> getPmfms()
177     {
178         return this.pmfms;
179     }
180 
181     /**
182      * Liste les quadruplets paramètre, méthode, support, fraction.
183      * @param pmfmsIn Collection<Pmfm>
184      */
185     public void setPmfms(Collection<Pmfm> pmfmsIn)
186     {
187         this.pmfms = pmfmsIn;
188     }
189 
190     /**
191      * Liste les quadruplets paramètre, méthode, support, fraction.
192      * @param elementToAdd Pmfm
193      * @return <tt>true</tt> if this collection changed as a result of the
194      *         call
195      */
196     public boolean addPmfms(Pmfm elementToAdd)
197     {
198         return this.pmfms.add(elementToAdd);
199     }
200 
201     /**
202      * Liste les quadruplets paramètre, méthode, support, fraction.
203      * @param elementToRemove Pmfm
204      * @return <tt>true</tt> if this collection changed as a result of the
205      *         call
206      */
207     public boolean removePmfms(Pmfm elementToRemove)
208     {
209         return this.pmfms.remove(elementToRemove);
210     }
211 
212     private Status status;
213 
214     /**
215      * Liste des états possibles d'un objet.
216      * @return this.status Status
217      */
218     public Status getStatus()
219     {
220         return this.status;
221     }
222 
223     /**
224      * Liste des états possibles d'un objet.
225      * @param statusIn Status
226      */
227     public void setStatus(Status statusIn)
228     {
229         this.status = statusIn;
230     }
231 
232     private Collection<SamplingEquipment> samplingEquipmentIds = new HashSet<SamplingEquipment>();
233 
234     /**
235      * Liste les engins de prélèvement (au sens marque/modèle et non numéro de série).
236      * @return this.samplingEquipmentIds Collection<SamplingEquipment>
237      */
238     public Collection<SamplingEquipment> getSamplingEquipmentIds()
239     {
240         return this.samplingEquipmentIds;
241     }
242 
243     /**
244      * Liste les engins de prélèvement (au sens marque/modèle et non numéro de série).
245      * @param samplingEquipmentIdsIn Collection<SamplingEquipment>
246      */
247     public void setSamplingEquipmentIds(Collection<SamplingEquipment> samplingEquipmentIdsIn)
248     {
249         this.samplingEquipmentIds = samplingEquipmentIdsIn;
250     }
251 
252     /**
253      * Liste les engins de prélèvement (au sens marque/modèle et non numéro de série).
254      * @param elementToAdd SamplingEquipment
255      * @return <tt>true</tt> if this collection changed as a result of the
256      *         call
257      */
258     public boolean addSamplingEquipmentIds(SamplingEquipment elementToAdd)
259     {
260         return this.samplingEquipmentIds.add(elementToAdd);
261     }
262 
263     /**
264      * Liste les engins de prélèvement (au sens marque/modèle et non numéro de série).
265      * @param elementToRemove SamplingEquipment
266      * @return <tt>true</tt> if this collection changed as a result of the
267      *         call
268      */
269     public boolean removeSamplingEquipmentIds(SamplingEquipment elementToRemove)
270     {
271         return this.samplingEquipmentIds.remove(elementToRemove);
272     }
273 
274     private Collection<ProjectionSystem> projSystemCds = new HashSet<ProjectionSystem>();
275 
276     /**
277      * Système de projection utilisé pour une transformation de coordonnées
278      * @return this.projSystemCds Collection<ProjectionSystem>
279      */
280     public Collection<ProjectionSystem> getProjSystemCds()
281     {
282         return this.projSystemCds;
283     }
284 
285     /**
286      * Système de projection utilisé pour une transformation de coordonnées
287      * @param projSystemCdsIn Collection<ProjectionSystem>
288      */
289     public void setProjSystemCds(Collection<ProjectionSystem> projSystemCdsIn)
290     {
291         this.projSystemCds = projSystemCdsIn;
292     }
293 
294     /**
295      * Système de projection utilisé pour une transformation de coordonnées
296      * @param elementToAdd ProjectionSystem
297      * @return <tt>true</tt> if this collection changed as a result of the
298      *         call
299      */
300     public boolean addProjSystemCds(ProjectionSystem elementToAdd)
301     {
302         return this.projSystemCds.add(elementToAdd);
303     }
304 
305     /**
306      * Système de projection utilisé pour une transformation de coordonnées
307      * @param elementToRemove ProjectionSystem
308      * @return <tt>true</tt> if this collection changed as a result of the
309      *         call
310      */
311     public boolean removeProjSystemCds(ProjectionSystem elementToRemove)
312     {
313         return this.projSystemCds.remove(elementToRemove);
314     }
315 
316     /**
317      * Returns <code>true</code> if the argument is an Unit instance and all identifiers for this entity
318      * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
319      */
320     @Override
321     public boolean equals(Object object)
322     {
323         if (this == object)
324         {
325             return true;
326         }
327         if (!(object instanceof Unit))
328         {
329             return false;
330         }
331         final Unit that = (Unit)object;
332         if (this.unitId == null || that.getUnitId() == null || !this.unitId.equals(that.getUnitId()))
333         {
334             return false;
335         }
336         return true;
337     }
338 
339     /**
340      * Returns a hash code based on this entity's identifiers.
341      */
342     @Override
343     public int hashCode()
344     {
345         int hashCode = 0;
346         hashCode = 29 * hashCode + (this.unitId == null ? 0 : this.unitId.hashCode());
347 
348         return hashCode;
349     }
350 
351     /**
352      * Constructs new instances of {@link Unit}.
353      */
354     public static final class Factory
355     {
356         /**
357          * Constructs a new instance of {@link Unit}.
358          * @return new UnitImpl()
359          */
360         public static Unit newInstance()
361         {
362             return new UnitImpl();
363         }
364 
365         /**
366          * Constructs a new instance of {@link Unit}, taking all required and/or
367          * read-only properties as arguments, except for identifiers.
368          * @param unitNm String
369          * @param status Status
370          * @return newInstance
371          */
372         public static Unit newInstance(String unitNm, Status status)
373         {
374             final Unit entity = new UnitImpl();
375             entity.setUnitNm(unitNm);
376             entity.setStatus(status);
377             return entity;
378         }
379 
380         /**
381          * Constructs a new instance of {@link Unit}, taking all possible properties
382          * (except the identifier(s))as arguments.
383          * @param unitNm String
384          * @param unitSymbol String
385          * @param unitCreationDt Date
386          * @param updateDt Timestamp
387          * @param unitCm String
388          * @param pmfms Collection<Pmfm>
389          * @param status Status
390          * @param samplingEquipmentIds Collection<SamplingEquipment>
391          * @param projSystemCds Collection<ProjectionSystem>
392          * @return newInstance Unit
393          */
394         public static Unit newInstance(String unitNm, String unitSymbol, Date unitCreationDt, Timestamp updateDt, String unitCm, Collection<Pmfm> pmfms, Status status, Collection<SamplingEquipment> samplingEquipmentIds, Collection<ProjectionSystem> projSystemCds)
395         {
396             final Unit entity = new UnitImpl();
397             entity.setUnitNm(unitNm);
398             entity.setUnitSymbol(unitSymbol);
399             entity.setUnitCreationDt(unitCreationDt);
400             entity.setUpdateDt(updateDt);
401             entity.setUnitCm(unitCm);
402             entity.setPmfms(pmfms);
403             entity.setStatus(status);
404             entity.setSamplingEquipmentIds(samplingEquipmentIds);
405             entity.setProjSystemCds(projSystemCds);
406             return entity;
407         }
408     }
409 
410     /**
411      * @see Comparable#compareTo
412      */
413     public int compareTo(Unit o)
414     {
415         int cmp = 0;
416         if (this.getUnitId() != null)
417         {
418             cmp = this.getUnitId().compareTo(o.getUnitId());
419         }
420         else
421         {
422             if (this.getUnitNm() != null)
423             {
424                 cmp = (cmp != 0 ? cmp : this.getUnitNm().compareTo(o.getUnitNm()));
425             }
426             if (this.getUnitSymbol() != null)
427             {
428                 cmp = (cmp != 0 ? cmp : this.getUnitSymbol().compareTo(o.getUnitSymbol()));
429             }
430             if (this.getUnitCreationDt() != null)
431             {
432                 cmp = (cmp != 0 ? cmp : this.getUnitCreationDt().compareTo(o.getUnitCreationDt()));
433             }
434             if (this.getUpdateDt() != null)
435             {
436                 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
437             }
438             if (this.getUnitCm() != null)
439             {
440                 cmp = (cmp != 0 ? cmp : this.getUnitCm().compareTo(o.getUnitCm()));
441             }
442         }
443         return cmp;
444     }
445 // HibernateEntity.vsl merge-point
446 // Unit.java merge-point
447 }