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.data.samplingScheme;
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.administration.user.Department;
032import fr.ifremer.adagio.core.dao.administration.user.Person;
033import fr.ifremer.adagio.core.dao.data.measure.SamplingStrataMeasurement;
034import fr.ifremer.adagio.core.dao.referential.location.Location;
035import java.io.Serializable;
036import java.sql.Timestamp;
037import java.util.Collection;
038import java.util.Date;
039import java.util.HashSet;
040
041/**
042 * Représente une ligne du plan d'échantillonnage.
043 * @since v3.2.0
044 */
045// HibernateEntity.vsl annotations merge-point
046public abstract class SamplingStrata
047    implements Serializable, Comparable<SamplingStrata>
048{
049    /**
050     * The serial version UID of this class. Needed for serialization.
051     */
052    private static final long serialVersionUID = -600598895829055537L;
053
054    // Generate 7 attributes
055    private Integer id;
056
057    /**
058     * 
059     * @return this.id Integer
060     */
061    public Integer getId()
062    {
063        return this.id;
064    }
065
066    /**
067     * 
068     * @param idIn Integer
069     */
070    public void setId(Integer idIn)
071    {
072        this.id = idIn;
073    }
074
075    private String label;
076
077    /**
078     * Mnémonique de la ligne du plan.
079     * Ce mnémonique doit être unique en base (clef naturelle) pour tout les plans d'échantillonnage
080     * de la base de données, car il s'agit d'un code fréquemment utilisé pour identifier une ligne
081     * de plan.
082     * @return this.label String
083     */
084    public String getLabel()
085    {
086        return this.label;
087    }
088
089    /**
090     * Mnémonique de la ligne du plan.
091     * Ce mnémonique doit être unique en base (clef naturelle) pour tout les plans d'échantillonnage
092     * de la base de données, car il s'agit d'un code fréquemment utilisé pour identifier une ligne
093     * de plan.
094     * @param labelIn String
095     */
096    public void setLabel(String labelIn)
097    {
098        this.label = labelIn;
099    }
100
101    private Date startDate;
102
103    /**
104     * 
105     * @return this.startDate Date
106     */
107    public Date getStartDate()
108    {
109        return this.startDate;
110    }
111
112    /**
113     * 
114     * @param startDateIn Date
115     */
116    public void setStartDate(Date startDateIn)
117    {
118        this.startDate = startDateIn;
119    }
120
121    private Date endDate;
122
123    /**
124     * 
125     * @return this.endDate Date
126     */
127    public Date getEndDate()
128    {
129        return this.endDate;
130    }
131
132    /**
133     * 
134     * @param endDateIn Date
135     */
136    public void setEndDate(Date endDateIn)
137    {
138        this.endDate = endDateIn;
139    }
140
141    private String description;
142
143    /**
144     * Nom de la strate.
145     * Dans WAO : METIER_LIBELLE
146     * "Chalutage hauturier à démerseaux à grand fond"
147     * TODO : à renommer en "name" ?
148     * @return this.description String
149     */
150    public String getDescription()
151    {
152        return this.description;
153    }
154
155    /**
156     * Nom de la strate.
157     * Dans WAO : METIER_LIBELLE
158     * "Chalutage hauturier à démerseaux à grand fond"
159     * TODO : à renommer en "name" ?
160     * @param descriptionIn String
161     */
162    public void setDescription(String descriptionIn)
163    {
164        this.description = descriptionIn;
165    }
166
167    private String comments;
168
169    /**
170     * Commentaires sur la strate.
171     * Dans WAO : PLAN_COMMENT
172     * @return this.comments String
173     */
174    public String getComments()
175    {
176        return this.comments;
177    }
178
179    /**
180     * Commentaires sur la strate.
181     * Dans WAO : PLAN_COMMENT
182     * @param commentsIn String
183     */
184    public void setComments(String commentsIn)
185    {
186        this.comments = commentsIn;
187    }
188
189    private Timestamp updateDate;
190
191    /**
192     * 
193     * @return this.updateDate Timestamp
194     */
195    public Timestamp getUpdateDate()
196    {
197        return this.updateDate;
198    }
199
200    /**
201     * 
202     * @param updateDateIn Timestamp
203     */
204    public void setUpdateDate(Timestamp updateDateIn)
205    {
206        this.updateDate = updateDateIn;
207    }
208
209    // Generate 12 associations
210    private Collection<SamplingStrata2Fishery> samplingStrata2Fisheries = new HashSet<SamplingStrata2Fishery>();
211
212    /**
213     * <html>
214     * <head>
215     * <style>
216     * p {padding:0px; margin:0px;}
217     * </style>
218     * </head>
219     * <body>
220     * <p>
221     * Permet de lier une strate d'échantillonnage à la pêcherie ou au stock.
222     * </p>
223     * <p>
224     * </p>
225     * <p>
226     * Demande initiale de E.Bodere du 18/07/2012 :
227     * </p>
228     * <p>
229     * Ajout de la table SamplingStrata2Fishery. Pour la reprise des données
230     * Arpège, Joël veut que l’on recréé des plans avec comme strate le stock
231     * arpège (espèce commerciale * grand secteur Arpège). Cette solution
232     * permettrait d’avoir un lien vers des pêcheries ultérieurement
233     * </p>
234     * </body>
235     * </html>
236     * @return this.samplingStrata2Fisheries Collection<SamplingStrata2Fishery>
237     */
238    public Collection<SamplingStrata2Fishery> getSamplingStrata2Fisheries()
239    {
240        return this.samplingStrata2Fisheries;
241    }
242
243    /**
244     * <html>
245     * <head>
246     * <style>
247     * p {padding:0px; margin:0px;}
248     * </style>
249     * </head>
250     * <body>
251     * <p>
252     * Permet de lier une strate d'échantillonnage à la pêcherie ou au stock.
253     * </p>
254     * <p>
255     * </p>
256     * <p>
257     * Demande initiale de E.Bodere du 18/07/2012 :
258     * </p>
259     * <p>
260     * Ajout de la table SamplingStrata2Fishery. Pour la reprise des données
261     * Arpège, Joël veut que l’on recréé des plans avec comme strate le stock
262     * arpège (espèce commerciale * grand secteur Arpège). Cette solution
263     * permettrait d’avoir un lien vers des pêcheries ultérieurement
264     * </p>
265     * </body>
266     * </html>
267     * @param samplingStrata2FisheriesIn Collection<SamplingStrata2Fishery>
268     */
269    public void setSamplingStrata2Fisheries(Collection<SamplingStrata2Fishery> samplingStrata2FisheriesIn)
270    {
271        this.samplingStrata2Fisheries = samplingStrata2FisheriesIn;
272    }
273
274    /**
275     * <html>
276     * <head>
277     * <style>
278     * p {padding:0px; margin:0px;}
279     * </style>
280     * </head>
281     * <body>
282     * <p>
283     * Permet de lier une strate d'échantillonnage à la pêcherie ou au stock.
284     * </p>
285     * <p>
286     * </p>
287     * <p>
288     * Demande initiale de E.Bodere du 18/07/2012 :
289     * </p>
290     * <p>
291     * Ajout de la table SamplingStrata2Fishery. Pour la reprise des données
292     * Arpège, Joël veut que l’on recréé des plans avec comme strate le stock
293     * arpège (espèce commerciale * grand secteur Arpège). Cette solution
294     * permettrait d’avoir un lien vers des pêcheries ultérieurement
295     * </p>
296     * </body>
297     * </html>
298     * @param elementToAdd SamplingStrata2Fishery
299     * @return <tt>true</tt> if this collection changed as a result of the
300     *         call
301     */
302    public boolean addSamplingStrata2Fisheries(SamplingStrata2Fishery elementToAdd)
303    {
304        return this.samplingStrata2Fisheries.add(elementToAdd);
305    }
306
307    /**
308     * <html>
309     * <head>
310     * <style>
311     * p {padding:0px; margin:0px;}
312     * </style>
313     * </head>
314     * <body>
315     * <p>
316     * Permet de lier une strate d'échantillonnage à la pêcherie ou au stock.
317     * </p>
318     * <p>
319     * </p>
320     * <p>
321     * Demande initiale de E.Bodere du 18/07/2012 :
322     * </p>
323     * <p>
324     * Ajout de la table SamplingStrata2Fishery. Pour la reprise des données
325     * Arpège, Joël veut que l’on recréé des plans avec comme strate le stock
326     * arpège (espèce commerciale * grand secteur Arpège). Cette solution
327     * permettrait d’avoir un lien vers des pêcheries ultérieurement
328     * </p>
329     * </body>
330     * </html>
331     * @param elementToRemove SamplingStrata2Fishery
332     * @return <tt>true</tt> if this collection changed as a result of the
333     *         call
334     */
335    public boolean removeSamplingStrata2Fisheries(SamplingStrata2Fishery elementToRemove)
336    {
337        return this.samplingStrata2Fisheries.remove(elementToRemove);
338    }
339
340    private Location observationLocation;
341
342    /**
343     * Lieux ou se déroulera l'observation.
344     * cela peut etre un quartier (cas des enquete d'activité), ou des site de débarquement (cas des
345     * observations aux débarquements).
346     * @return this.observationLocation Location
347     */
348    public Location getObservationLocation()
349    {
350        return this.observationLocation;
351    }
352
353    /**
354     * Lieux ou se déroulera l'observation.
355     * cela peut etre un quartier (cas des enquete d'activité), ou des site de débarquement (cas des
356     * observations aux débarquements).
357     * @param observationLocationIn Location
358     */
359    public void setObservationLocation(Location observationLocationIn)
360    {
361        this.observationLocation = observationLocationIn;
362    }
363
364    private Collection<SamplingStrataMeasurement> samplingStrataMeasurements = new HashSet<SamplingStrataMeasurement>();
365
366    /**
367     * Caratéristiques de la straté d'échantillonnage, en terme de valeurs sur PSFM.
368     * @since v3.2.0
369     * @return this.samplingStrataMeasurements Collection<SamplingStrataMeasurement>
370     */
371    public Collection<SamplingStrataMeasurement> getSamplingStrataMeasurements()
372    {
373        return this.samplingStrataMeasurements;
374    }
375
376    /**
377     * Caratéristiques de la straté d'échantillonnage, en terme de valeurs sur PSFM.
378     * @since v3.2.0
379     * @param samplingStrataMeasurementsIn Collection<SamplingStrataMeasurement>
380     */
381    public void setSamplingStrataMeasurements(Collection<SamplingStrataMeasurement> samplingStrataMeasurementsIn)
382    {
383        this.samplingStrataMeasurements = samplingStrataMeasurementsIn;
384    }
385
386    /**
387     * Caratéristiques de la straté d'échantillonnage, en terme de valeurs sur PSFM.
388     * @since v3.2.0
389     * @param elementToAdd SamplingStrataMeasurement
390     * @return <tt>true</tt> if this collection changed as a result of the
391     *         call
392     */
393    public boolean addSamplingStrataMeasurements(SamplingStrataMeasurement elementToAdd)
394    {
395        return this.samplingStrataMeasurements.add(elementToAdd);
396    }
397
398    /**
399     * Caratéristiques de la straté d'échantillonnage, en terme de valeurs sur PSFM.
400     * @since v3.2.0
401     * @param elementToRemove SamplingStrataMeasurement
402     * @return <tt>true</tt> if this collection changed as a result of the
403     *         call
404     */
405    public boolean removeSamplingStrataMeasurements(SamplingStrataMeasurement elementToRemove)
406    {
407        return this.samplingStrataMeasurements.remove(elementToRemove);
408    }
409
410    private Department department;
411
412    /**
413     * Service ou société chargée de réaliser la ligne du plan.
414     * Permet d'avoir des droits d'accès sur le plan.
415     * @return this.department Department
416     */
417    public Department getDepartment()
418    {
419        return this.department;
420    }
421
422    /**
423     * Service ou société chargée de réaliser la ligne du plan.
424     * Permet d'avoir des droits d'accès sur le plan.
425     * @param departmentIn Department
426     */
427    public void setDepartment(Department departmentIn)
428    {
429        this.department = departmentIn;
430    }
431
432    private Collection<SamplingStrata2Grouping> samplingStrata2Groupings = new HashSet<SamplingStrata2Grouping>();
433
434    /**
435     * Caractéristiques de la strate d'échantillonnage, en terme de regroupement d'entités.
436     * @since v3.2.0
437     * @return this.samplingStrata2Groupings Collection<SamplingStrata2Grouping>
438     */
439    public Collection<SamplingStrata2Grouping> getSamplingStrata2Groupings()
440    {
441        return this.samplingStrata2Groupings;
442    }
443
444    /**
445     * Caractéristiques de la strate d'échantillonnage, en terme de regroupement d'entités.
446     * @since v3.2.0
447     * @param samplingStrata2GroupingsIn Collection<SamplingStrata2Grouping>
448     */
449    public void setSamplingStrata2Groupings(Collection<SamplingStrata2Grouping> samplingStrata2GroupingsIn)
450    {
451        this.samplingStrata2Groupings = samplingStrata2GroupingsIn;
452    }
453
454    /**
455     * Caractéristiques de la strate d'échantillonnage, en terme de regroupement d'entités.
456     * @since v3.2.0
457     * @param elementToAdd SamplingStrata2Grouping
458     * @return <tt>true</tt> if this collection changed as a result of the
459     *         call
460     */
461    public boolean addSamplingStrata2Groupings(SamplingStrata2Grouping elementToAdd)
462    {
463        return this.samplingStrata2Groupings.add(elementToAdd);
464    }
465
466    /**
467     * Caractéristiques de la strate d'échantillonnage, en terme de regroupement d'entités.
468     * @since v3.2.0
469     * @param elementToRemove SamplingStrata2Grouping
470     * @return <tt>true</tt> if this collection changed as a result of the
471     *         call
472     */
473    public boolean removeSamplingStrata2Groupings(SamplingStrata2Grouping elementToRemove)
474    {
475        return this.samplingStrata2Groupings.remove(elementToRemove);
476    }
477
478    private SamplingScheme samplingScheme;
479
480    /**
481     * Plan d'échantillonnage, pour un programme de collecte donné.
482     * @since v3.2.0
483     * @return this.samplingScheme SamplingScheme
484     */
485    public SamplingScheme getSamplingScheme()
486    {
487        return this.samplingScheme;
488    }
489
490    /**
491     * Plan d'échantillonnage, pour un programme de collecte donné.
492     * @since v3.2.0
493     * @param samplingSchemeIn SamplingScheme
494     */
495    public void setSamplingScheme(SamplingScheme samplingSchemeIn)
496    {
497        this.samplingScheme = samplingSchemeIn;
498    }
499
500    private Person person;
501
502    /**
503     * Personne chargée de réaliser la ligne du plan.
504     * Permet d'avoir des droits d'accès sur le plan.
505     * @return this.person Person
506     */
507    public Person getPerson()
508    {
509        return this.person;
510    }
511
512    /**
513     * Personne chargée de réaliser la ligne du plan.
514     * Permet d'avoir des droits d'accès sur le plan.
515     * @param personIn Person
516     */
517    public void setPerson(Person personIn)
518    {
519        this.person = personIn;
520    }
521
522    private Collection<SamplingStrata2Vessel> samplingStrata2Vessels = new HashSet<SamplingStrata2Vessel>();
523
524    /**
525     * Liste des navires elligibles pour la ligne du plan.
526     * @since v3.2.0
527     * @return this.samplingStrata2Vessels Collection<SamplingStrata2Vessel>
528     */
529    public Collection<SamplingStrata2Vessel> getSamplingStrata2Vessels()
530    {
531        return this.samplingStrata2Vessels;
532    }
533
534    /**
535     * Liste des navires elligibles pour la ligne du plan.
536     * @since v3.2.0
537     * @param samplingStrata2VesselsIn Collection<SamplingStrata2Vessel>
538     */
539    public void setSamplingStrata2Vessels(Collection<SamplingStrata2Vessel> samplingStrata2VesselsIn)
540    {
541        this.samplingStrata2Vessels = samplingStrata2VesselsIn;
542    }
543
544    /**
545     * Liste des navires elligibles pour la ligne du plan.
546     * @since v3.2.0
547     * @param elementToAdd SamplingStrata2Vessel
548     * @return <tt>true</tt> if this collection changed as a result of the
549     *         call
550     */
551    public boolean addSamplingStrata2Vessels(SamplingStrata2Vessel elementToAdd)
552    {
553        return this.samplingStrata2Vessels.add(elementToAdd);
554    }
555
556    /**
557     * Liste des navires elligibles pour la ligne du plan.
558     * @since v3.2.0
559     * @param elementToRemove SamplingStrata2Vessel
560     * @return <tt>true</tt> if this collection changed as a result of the
561     *         call
562     */
563    public boolean removeSamplingStrata2Vessels(SamplingStrata2Vessel elementToRemove)
564    {
565        return this.samplingStrata2Vessels.remove(elementToRemove);
566    }
567
568    /**
569     * Returns <code>true</code> if the argument is an SamplingStrata instance and all identifiers for this entity
570     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
571     */
572    @Override
573    public boolean equals(Object object)
574    {
575        if (this == object)
576        {
577            return true;
578        }
579        if (!(object instanceof SamplingStrata))
580        {
581            return false;
582        }
583        final SamplingStrata that = (SamplingStrata)object;
584        if (this.id == null || that.getId() == null || !this.id.equals(that.getId()))
585        {
586            return false;
587        }
588        return true;
589    }
590
591    /**
592     * Returns a hash code based on this entity's identifiers.
593     */
594    @Override
595    public int hashCode()
596    {
597        int hashCode = 0;
598        hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode());
599
600        return hashCode;
601    }
602
603    /**
604     * Constructs new instances of {@link SamplingStrata}.
605     */
606    public static final class Factory
607    {
608        /**
609         * Constructs a new instance of {@link SamplingStrata}.
610         * @return new SamplingStrataImpl()
611         */
612        public static SamplingStrata newInstance()
613        {
614            return new SamplingStrataImpl();
615        }
616
617        /**
618         * Constructs a new instance of {@link SamplingStrata}, taking all required and/or
619         * read-only properties as arguments, except for identifiers.
620         * @param label String
621         * @param updateDate Timestamp
622         * @param samplingScheme SamplingScheme
623         * @return newInstance
624         */
625        public static SamplingStrata newInstance(String label, Timestamp updateDate, SamplingScheme samplingScheme)
626        {
627            final SamplingStrata entity = new SamplingStrataImpl();
628            entity.setLabel(label);
629            entity.setUpdateDate(updateDate);
630            entity.setSamplingScheme(samplingScheme);
631            return entity;
632        }
633
634        /**
635         * Constructs a new instance of {@link SamplingStrata}, taking all possible properties
636         * (except the identifier(s))as arguments.
637         * @param label String
638         * @param startDate Date
639         * @param endDate Date
640         * @param description String
641         * @param comments String
642         * @param updateDate Timestamp
643         * @param samplingStrata2Fisheries Collection<SamplingStrata2Fishery>
644         * @param observationLocation Location
645         * @param samplingStrataMeasurements Collection<SamplingStrataMeasurement>
646         * @param department Department
647         * @param samplingStrata2Groupings Collection<SamplingStrata2Grouping>
648         * @param samplingScheme SamplingScheme
649         * @param person Person
650         * @param samplingStrata2Vessels Collection<SamplingStrata2Vessel>
651         * @return newInstance SamplingStrata
652         */
653        public static SamplingStrata newInstance(String label, Date startDate, Date endDate, String description, String comments, Timestamp updateDate, Collection<SamplingStrata2Fishery> samplingStrata2Fisheries, Location observationLocation, Collection<SamplingStrataMeasurement> samplingStrataMeasurements, Department department, Collection<SamplingStrata2Grouping> samplingStrata2Groupings, SamplingScheme samplingScheme, Person person, Collection<SamplingStrata2Vessel> samplingStrata2Vessels)
654        {
655            final SamplingStrata entity = new SamplingStrataImpl();
656            entity.setLabel(label);
657            entity.setStartDate(startDate);
658            entity.setEndDate(endDate);
659            entity.setDescription(description);
660            entity.setComments(comments);
661            entity.setUpdateDate(updateDate);
662            entity.setSamplingStrata2Fisheries(samplingStrata2Fisheries);
663            entity.setObservationLocation(observationLocation);
664            entity.setSamplingStrataMeasurements(samplingStrataMeasurements);
665            entity.setDepartment(department);
666            entity.setSamplingStrata2Groupings(samplingStrata2Groupings);
667            entity.setSamplingScheme(samplingScheme);
668            entity.setPerson(person);
669            entity.setSamplingStrata2Vessels(samplingStrata2Vessels);
670            return entity;
671        }
672    }
673
674    /**
675     * @see Comparable#compareTo
676     */
677    public int compareTo(SamplingStrata o)
678    {
679        int cmp = 0;
680        if (this.getId() != null)
681        {
682            cmp = this.getId().compareTo(o.getId());
683        }
684        else
685        {
686            if (this.getLabel() != null)
687            {
688                cmp = (cmp != 0 ? cmp : this.getLabel().compareTo(o.getLabel()));
689            }
690            if (this.getStartDate() != null)
691            {
692                cmp = (cmp != 0 ? cmp : this.getStartDate().compareTo(o.getStartDate()));
693            }
694            if (this.getEndDate() != null)
695            {
696                cmp = (cmp != 0 ? cmp : this.getEndDate().compareTo(o.getEndDate()));
697            }
698            if (this.getDescription() != null)
699            {
700                cmp = (cmp != 0 ? cmp : this.getDescription().compareTo(o.getDescription()));
701            }
702            if (this.getComments() != null)
703            {
704                cmp = (cmp != 0 ? cmp : this.getComments().compareTo(o.getComments()));
705            }
706            if (this.getUpdateDate() != null)
707            {
708                cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate()));
709            }
710        }
711        return cmp;
712    }
713// HibernateEntity.vsl merge-point
714// SamplingStrata.java merge-point
715}