001// license-header java merge-point
002//
003// Attention: Generated code! Do not modify by hand!
004// Generated by: hibernate/HibernateEntity.vsl in andromda-hibernate-cartridge.
005//
006package fr.ifremer.adagio.core.dao.referential.pmfm;
007
008/*
009 * #%L
010 * SIH-Adagio :: Core
011 * $Id:$
012 * $HeadURL:$
013 * %%
014 * Copyright (C) 2012 - 2014 Ifremer
015 * %%
016 * This program is free software: you can redistribute it and/or modify
017 * it under the terms of the GNU Affero General Public License as published by
018 * the Free Software Foundation, either version 3 of the License, or
019 * (at your option) any later version.
020 * 
021 * This program is distributed in the hope that it will be useful,
022 * but WITHOUT ANY WARRANTY; without even the implied warranty of
023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
024 * GNU General Public License for more details.
025 * 
026 * You should have received a copy of the GNU Affero General Public License
027 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
028 * #L%
029 */
030
031import fr.ifremer.adagio.core.dao.referential.Status;
032import java.io.Serializable;
033import java.sql.Timestamp;
034import java.util.Collection;
035import java.util.HashSet;
036
037/**
038 * Groupe de paramètres.
039 * Les groupes permettent le regroupement et la hiérarchisation des paramètres, par thématiques. Par
040 * exemple, on aura :
041 * - Halieutique
042 * |- Individu (paramètres : taille, sexe, ..)
043 * |- Engin (paramètres : longueur de bras, ...)
044 * |- Condition d'observation (paramètres : état de la mer...)
045 */
046// HibernateEntity.vsl annotations merge-point
047public abstract class ParameterGroup
048    implements Serializable, Comparable<ParameterGroup>
049{
050    /**
051     * The serial version UID of this class. Needed for serialization.
052     */
053    private static final long serialVersionUID = -3428893340816488105L;
054
055    // Generate 5 attributes
056    private Integer id;
057
058    /**
059     * 
060     * @return this.id Integer
061     */
062    public Integer getId()
063    {
064        return this.id;
065    }
066
067    /**
068     * 
069     * @param idIn Integer
070     */
071    public void setId(Integer idIn)
072    {
073        this.id = idIn;
074    }
075
076    private String name;
077
078    /**
079     * 
080     * @return this.name String
081     */
082    public String getName()
083    {
084        return this.name;
085    }
086
087    /**
088     * 
089     * @param nameIn String
090     */
091    public void setName(String nameIn)
092    {
093        this.name = nameIn;
094    }
095
096    private String description;
097
098    /**
099     * 
100     * @return this.description String
101     */
102    public String getDescription()
103    {
104        return this.description;
105    }
106
107    /**
108     * 
109     * @param descriptionIn String
110     */
111    public void setDescription(String descriptionIn)
112    {
113        this.description = descriptionIn;
114    }
115
116    private String comments;
117
118    /**
119     * 
120     * @return this.comments String
121     */
122    public String getComments()
123    {
124        return this.comments;
125    }
126
127    /**
128     * 
129     * @param commentsIn String
130     */
131    public void setComments(String commentsIn)
132    {
133        this.comments = commentsIn;
134    }
135
136    private Timestamp updateDate;
137
138    /**
139     * 
140     * @return this.updateDate Timestamp
141     */
142    public Timestamp getUpdateDate()
143    {
144        return this.updateDate;
145    }
146
147    /**
148     * 
149     * @param updateDateIn Timestamp
150     */
151    public void setUpdateDate(Timestamp updateDateIn)
152    {
153        this.updateDate = updateDateIn;
154    }
155
156    // Generate 4 associations
157    private ParameterGroup parentParameterGroup;
158
159    /**
160     * Groupe de paramètres.
161     * Les groupes permettent le regroupement et la hiérarchisation des paramètres, par thématiques.
162     * Par
163     * exemple, on aura :
164     * - Halieutique
165     * |- Individu (paramètres : taille, sexe, ..)
166     * |- Engin (paramètres : longueur de bras, ...)
167     * |- Condition d'observation (paramètres : état de la mer...)
168     * @return this.parentParameterGroup ParameterGroup
169     */
170    public ParameterGroup getParentParameterGroup()
171    {
172        return this.parentParameterGroup;
173    }
174
175    /**
176     * Groupe de paramètres.
177     * Les groupes permettent le regroupement et la hiérarchisation des paramètres, par thématiques.
178     * Par
179     * exemple, on aura :
180     * - Halieutique
181     * |- Individu (paramètres : taille, sexe, ..)
182     * |- Engin (paramètres : longueur de bras, ...)
183     * |- Condition d'observation (paramètres : état de la mer...)
184     * @param parentParameterGroupIn ParameterGroup
185     */
186    public void setParentParameterGroup(ParameterGroup parentParameterGroupIn)
187    {
188        this.parentParameterGroup = parentParameterGroupIn;
189    }
190
191    private Collection<ParameterGroup> childParameterGroups = new HashSet<ParameterGroup>();
192
193    /**
194     * Groupe de paramètres.
195     * Les groupes permettent le regroupement et la hiérarchisation des paramètres, par thématiques.
196     * Par
197     * exemple, on aura :
198     * - Halieutique
199     * |- Individu (paramètres : taille, sexe, ..)
200     * |- Engin (paramètres : longueur de bras, ...)
201     * |- Condition d'observation (paramètres : état de la mer...)
202     * @return this.childParameterGroups Collection<ParameterGroup>
203     */
204    public Collection<ParameterGroup> getChildParameterGroups()
205    {
206        return this.childParameterGroups;
207    }
208
209    /**
210     * Groupe de paramètres.
211     * Les groupes permettent le regroupement et la hiérarchisation des paramètres, par thématiques.
212     * Par
213     * exemple, on aura :
214     * - Halieutique
215     * |- Individu (paramètres : taille, sexe, ..)
216     * |- Engin (paramètres : longueur de bras, ...)
217     * |- Condition d'observation (paramètres : état de la mer...)
218     * @param childParameterGroupsIn Collection<ParameterGroup>
219     */
220    public void setChildParameterGroups(Collection<ParameterGroup> childParameterGroupsIn)
221    {
222        this.childParameterGroups = childParameterGroupsIn;
223    }
224
225    /**
226     * Groupe de paramètres.
227     * Les groupes permettent le regroupement et la hiérarchisation des paramètres, par thématiques.
228     * Par
229     * exemple, on aura :
230     * - Halieutique
231     * |- Individu (paramètres : taille, sexe, ..)
232     * |- Engin (paramètres : longueur de bras, ...)
233     * |- Condition d'observation (paramètres : état de la mer...)
234     * @param elementToAdd ParameterGroup
235     * @return <tt>true</tt> if this collection changed as a result of the
236     *         call
237     */
238    public boolean addChildParameterGroups(ParameterGroup elementToAdd)
239    {
240        return this.childParameterGroups.add(elementToAdd);
241    }
242
243    /**
244     * Groupe de paramètres.
245     * Les groupes permettent le regroupement et la hiérarchisation des paramètres, par thématiques.
246     * Par
247     * exemple, on aura :
248     * - Halieutique
249     * |- Individu (paramètres : taille, sexe, ..)
250     * |- Engin (paramètres : longueur de bras, ...)
251     * |- Condition d'observation (paramètres : état de la mer...)
252     * @param elementToRemove ParameterGroup
253     * @return <tt>true</tt> if this collection changed as a result of the
254     *         call
255     */
256    public boolean removeChildParameterGroups(ParameterGroup elementToRemove)
257    {
258        return this.childParameterGroups.remove(elementToRemove);
259    }
260
261    private Status status;
262
263    /**
264     * Pour les données du référentiel, information permettant de déterminer si une donnée est
265     * valide,
266     * obsolète ou temporaire.
267     * - obsolète (=inactif) : '0'
268     * - valide (=actif) : '1'
269     * - temporaire : '2'
270     * - en cours de suppression : '3'
271     * -  : '4'
272     * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas
273     * confondre
274     * avec par exemple l'activité d'un navire sur un mois.
275     * @return this.status Status
276     */
277    public Status getStatus()
278    {
279        return this.status;
280    }
281
282    /**
283     * Pour les données du référentiel, information permettant de déterminer si une donnée est
284     * valide,
285     * obsolète ou temporaire.
286     * - obsolète (=inactif) : '0'
287     * - valide (=actif) : '1'
288     * - temporaire : '2'
289     * - en cours de suppression : '3'
290     * -  : '4'
291     * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas
292     * confondre
293     * avec par exemple l'activité d'un navire sur un mois.
294     * @param statusIn Status
295     */
296    public void setStatus(Status statusIn)
297    {
298        this.status = statusIn;
299    }
300
301    /**
302     * Returns <code>true</code> if the argument is an ParameterGroup instance and all identifiers for this entity
303     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
304     */
305    @Override
306    public boolean equals(Object object)
307    {
308        if (this == object)
309        {
310            return true;
311        }
312        if (!(object instanceof ParameterGroup))
313        {
314            return false;
315        }
316        final ParameterGroup that = (ParameterGroup)object;
317        if (this.id == null || that.getId() == null || !this.id.equals(that.getId()))
318        {
319            return false;
320        }
321        return true;
322    }
323
324    /**
325     * Returns a hash code based on this entity's identifiers.
326     */
327    @Override
328    public int hashCode()
329    {
330        int hashCode = 0;
331        hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode());
332
333        return hashCode;
334    }
335
336    /**
337     * Constructs new instances of {@link ParameterGroup}.
338     */
339    public static final class Factory
340    {
341        /**
342         * Constructs a new instance of {@link ParameterGroup}.
343         * @return new ParameterGroupImpl()
344         */
345        public static ParameterGroup newInstance()
346        {
347            return new ParameterGroupImpl();
348        }
349
350        /**
351         * Constructs a new instance of {@link ParameterGroup}, taking all required and/or
352         * read-only properties as arguments, except for identifiers.
353         * @param name String
354         * @param updateDate Timestamp
355         * @param status Status
356         * @return newInstance
357         */
358        public static ParameterGroup newInstance(String name, Timestamp updateDate, Status status)
359        {
360            final ParameterGroup entity = new ParameterGroupImpl();
361            entity.setName(name);
362            entity.setUpdateDate(updateDate);
363            entity.setStatus(status);
364            return entity;
365        }
366
367        /**
368         * Constructs a new instance of {@link ParameterGroup}, taking all possible properties
369         * (except the identifier(s))as arguments.
370         * @param name String
371         * @param description String
372         * @param comments String
373         * @param updateDate Timestamp
374         * @param parentParameterGroup ParameterGroup
375         * @param childParameterGroups Collection<ParameterGroup>
376         * @param status Status
377         * @return newInstance ParameterGroup
378         */
379        public static ParameterGroup newInstance(String name, String description, String comments, Timestamp updateDate, ParameterGroup parentParameterGroup, Collection<ParameterGroup> childParameterGroups, Status status)
380        {
381            final ParameterGroup entity = new ParameterGroupImpl();
382            entity.setName(name);
383            entity.setDescription(description);
384            entity.setComments(comments);
385            entity.setUpdateDate(updateDate);
386            entity.setParentParameterGroup(parentParameterGroup);
387            entity.setChildParameterGroups(childParameterGroups);
388            entity.setStatus(status);
389            return entity;
390        }
391    }
392
393    /**
394     * @see Comparable#compareTo
395     */
396    public int compareTo(ParameterGroup o)
397    {
398        int cmp = 0;
399        if (this.getId() != null)
400        {
401            cmp = this.getId().compareTo(o.getId());
402        }
403        else
404        {
405            if (this.getName() != null)
406            {
407                cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName()));
408            }
409            if (this.getDescription() != null)
410            {
411                cmp = (cmp != 0 ? cmp : this.getDescription().compareTo(o.getDescription()));
412            }
413            if (this.getComments() != null)
414            {
415                cmp = (cmp != 0 ? cmp : this.getComments().compareTo(o.getComments()));
416            }
417            if (this.getUpdateDate() != null)
418            {
419                cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate()));
420            }
421        }
422        return cmp;
423    }
424// HibernateEntity.vsl merge-point
425// ParameterGroup.java merge-point
426}