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.administration.programStrategy;
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.gear.GearClassification;
032import fr.ifremer.adagio.core.dao.referential.location.Location;
033import fr.ifremer.adagio.core.dao.referential.location.LocationClassification;
034import fr.ifremer.adagio.core.dao.referential.taxon.TaxonGroupType;
035import java.io.Serializable;
036import java.sql.Timestamp;
037import java.util.Collection;
038import java.util.Date;
039import java.util.HashSet;
040
041/**
042 * Programme d'observation à l'origine d'une collecte de données.
043 * Désigne les activités qui sont à l'origine de la collecte d'un ensemble cohérent de données, que
044 * ce soit pour des collectes continues (marées observées en mer, SIPA) ou pour des études limitées
045 * dans le temps. La quantité de données rattachées à un programme peut être variable, selon qu'il
046 * s'agit d'une activité longue ou intensive, ou d'une opération plus ponctuelle (étude) mais
047 * toujours mise en œuvre selon un schéma décidé à l'avance.
048 * Exemple de programmes d'observations :
049 * - SIH-OBSMER (marées observées en mer)
050 * - SIH-STATPECHE (enquete d'activité et d'effort...)
051 * - SIPA : données déclaratives transmises par la DPMA
052 * - VMS : données satellitaires
053 * - OFIMER : données du SI de l'OFIMER
054 */
055// HibernateEntity.vsl annotations merge-point
056public abstract class Program
057    implements Serializable, Comparable<Program>
058{
059    /**
060     * The serial version UID of this class. Needed for serialization.
061     */
062    private static final long serialVersionUID = -8923218287399812385L;
063
064    // Generate 5 attributes
065    private String code;
066
067    /**
068     * 
069     * @return this.code String
070     */
071    public String getCode()
072    {
073        return this.code;
074    }
075
076    /**
077     * 
078     * @param codeIn String
079     */
080    public void setCode(String codeIn)
081    {
082        this.code = codeIn;
083    }
084
085    private String name;
086
087    /**
088     * 
089     * @return this.name String
090     */
091    public String getName()
092    {
093        return this.name;
094    }
095
096    /**
097     * 
098     * @param nameIn String
099     */
100    public void setName(String nameIn)
101    {
102        this.name = nameIn;
103    }
104
105    private String description;
106
107    /**
108     * 
109     * @return this.description String
110     */
111    public String getDescription()
112    {
113        return this.description;
114    }
115
116    /**
117     * 
118     * @param descriptionIn String
119     */
120    public void setDescription(String descriptionIn)
121    {
122        this.description = descriptionIn;
123    }
124
125    private Date creationDate;
126
127    /**
128     * 
129     * @return this.creationDate Date
130     */
131    public Date getCreationDate()
132    {
133        return this.creationDate;
134    }
135
136    /**
137     * 
138     * @param creationDateIn Date
139     */
140    public void setCreationDate(Date creationDateIn)
141    {
142        this.creationDate = creationDateIn;
143    }
144
145    private Timestamp updateDate;
146
147    /**
148     * 
149     * @return this.updateDate Timestamp
150     */
151    public Timestamp getUpdateDate()
152    {
153        return this.updateDate;
154    }
155
156    /**
157     * 
158     * @param updateDateIn Timestamp
159     */
160    public void setUpdateDate(Timestamp updateDateIn)
161    {
162        this.updateDate = updateDateIn;
163    }
164
165    // Generate 45 associations
166    private TaxonGroupType taxonGroupType;
167
168    /**
169     * Type de classification d'espèce commerciales utilisé par le programme.
170     * Généralement, pour les actions du SIH, on utilise le référentiel des espèces commerciales
171     * ASFIS/FAO.
172     * Malgré tout, dans certains cas (ex : données historiques), d'autres référentiels peuvent
173     * avoir été utilisés.
174     * @return this.taxonGroupType TaxonGroupType
175     */
176    public TaxonGroupType getTaxonGroupType()
177    {
178        return this.taxonGroupType;
179    }
180
181    /**
182     * Type de classification d'espèce commerciales utilisé par le programme.
183     * Généralement, pour les actions du SIH, on utilise le référentiel des espèces commerciales
184     * ASFIS/FAO.
185     * Malgré tout, dans certains cas (ex : données historiques), d'autres référentiels peuvent
186     * avoir été utilisés.
187     * @param taxonGroupTypeIn TaxonGroupType
188     */
189    public void setTaxonGroupType(TaxonGroupType taxonGroupTypeIn)
190    {
191        this.taxonGroupType = taxonGroupTypeIn;
192    }
193
194    private Collection<Program2Person> programUsers = new HashSet<Program2Person>();
195
196    /**
197     * <html>
198     * <head>
199     * <style>
200     * p {padding:0px; margin:0px;}
201     * </style>
202     * </head>
203     * <body>
204     * Définis les privilèges d'un utilsiateur sur un progamme, ou sur un
205     * </body>
206     * </html>
207     * @return this.programUsers Collection<Program2Person>
208     */
209    public Collection<Program2Person> getProgramUsers()
210    {
211        return this.programUsers;
212    }
213
214    /**
215     * <html>
216     * <head>
217     * <style>
218     * p {padding:0px; margin:0px;}
219     * </style>
220     * </head>
221     * <body>
222     * Définis les privilèges d'un utilsiateur sur un progamme, ou sur un
223     * </body>
224     * </html>
225     * @param programUsersIn Collection<Program2Person>
226     */
227    public void setProgramUsers(Collection<Program2Person> programUsersIn)
228    {
229        this.programUsers = programUsersIn;
230    }
231
232    /**
233     * <html>
234     * <head>
235     * <style>
236     * p {padding:0px; margin:0px;}
237     * </style>
238     * </head>
239     * <body>
240     * Définis les privilèges d'un utilsiateur sur un progamme, ou sur un
241     * </body>
242     * </html>
243     * @param elementToAdd Program2Person
244     * @return <tt>true</tt> if this collection changed as a result of the
245     *         call
246     */
247    public boolean addProgramUsers(Program2Person elementToAdd)
248    {
249        return this.programUsers.add(elementToAdd);
250    }
251
252    /**
253     * <html>
254     * <head>
255     * <style>
256     * p {padding:0px; margin:0px;}
257     * </style>
258     * </head>
259     * <body>
260     * Définis les privilèges d'un utilsiateur sur un progamme, ou sur un
261     * </body>
262     * </html>
263     * @param elementToRemove Program2Person
264     * @return <tt>true</tt> if this collection changed as a result of the
265     *         call
266     */
267    public boolean removeProgramUsers(Program2Person elementToRemove)
268    {
269        return this.programUsers.remove(elementToRemove);
270    }
271
272    private Collection<Strategy> strategies = new HashSet<Strategy>();
273
274    /**
275     * La stratégie définit a priori ce que devront être les données présentes dans le système de
276     * l'origine
277     * de la collecte des données. Il s'agit de la liste des paramètres à mesurer, ainsi que des
278     * méthodes
279     * préconisées pour chacun de ces paramètres. La stratégie permet ainsi d'aider à la saisie des
280     * données, en personnalisant les écrans, et facilite la consultation rapide du contenu
281     * théorique de la
282     * base.
283     * Par exemple, on pourra avoir les stratégies suivantes :
284     * - stratégie "échantillonnage pendant les marées observées"
285     * - stratégie "échantillonnage pendant les campagne à la mer"
286     * @return this.strategies Collection<Strategy>
287     */
288    public Collection<Strategy> getStrategies()
289    {
290        return this.strategies;
291    }
292
293    /**
294     * La stratégie définit a priori ce que devront être les données présentes dans le système de
295     * l'origine
296     * de la collecte des données. Il s'agit de la liste des paramètres à mesurer, ainsi que des
297     * méthodes
298     * préconisées pour chacun de ces paramètres. La stratégie permet ainsi d'aider à la saisie des
299     * données, en personnalisant les écrans, et facilite la consultation rapide du contenu
300     * théorique de la
301     * base.
302     * Par exemple, on pourra avoir les stratégies suivantes :
303     * - stratégie "échantillonnage pendant les marées observées"
304     * - stratégie "échantillonnage pendant les campagne à la mer"
305     * @param strategiesIn Collection<Strategy>
306     */
307    public void setStrategies(Collection<Strategy> strategiesIn)
308    {
309        this.strategies = strategiesIn;
310    }
311
312    /**
313     * La stratégie définit a priori ce que devront être les données présentes dans le système de
314     * l'origine
315     * de la collecte des données. Il s'agit de la liste des paramètres à mesurer, ainsi que des
316     * méthodes
317     * préconisées pour chacun de ces paramètres. La stratégie permet ainsi d'aider à la saisie des
318     * données, en personnalisant les écrans, et facilite la consultation rapide du contenu
319     * théorique de la
320     * base.
321     * Par exemple, on pourra avoir les stratégies suivantes :
322     * - stratégie "échantillonnage pendant les marées observées"
323     * - stratégie "échantillonnage pendant les campagne à la mer"
324     * @param elementToAdd Strategy
325     * @return <tt>true</tt> if this collection changed as a result of the
326     *         call
327     */
328    public boolean addStrategies(Strategy elementToAdd)
329    {
330        return this.strategies.add(elementToAdd);
331    }
332
333    /**
334     * La stratégie définit a priori ce que devront être les données présentes dans le système de
335     * l'origine
336     * de la collecte des données. Il s'agit de la liste des paramètres à mesurer, ainsi que des
337     * méthodes
338     * préconisées pour chacun de ces paramètres. La stratégie permet ainsi d'aider à la saisie des
339     * données, en personnalisant les écrans, et facilite la consultation rapide du contenu
340     * théorique de la
341     * base.
342     * Par exemple, on pourra avoir les stratégies suivantes :
343     * - stratégie "échantillonnage pendant les marées observées"
344     * - stratégie "échantillonnage pendant les campagne à la mer"
345     * @param elementToRemove Strategy
346     * @return <tt>true</tt> if this collection changed as a result of the
347     *         call
348     */
349    public boolean removeStrategies(Strategy elementToRemove)
350    {
351        return this.strategies.remove(elementToRemove);
352    }
353
354    private GearClassification gearClassification;
355
356    /**
357     * Une classification d'engin permet le regroupement d'un ensemble cohérent d'engin.
358     * Exemple :
359     * - Engin FAO, appellée aussi CSITEP (Classification Standard Internationale Type des Engins de
360     * Pêche), ou, en anglais : International Standard Statistical Classification of Fishing Gear
361     * (ISSCFG)
362     * : ftp://ftp.fao.org/FI/DOCUMENT/cwp/handbook/annex/AnnexM1fishinggear.pdf
363     * - Engin CNTS (DPMA SIP)
364     * - Engin EU (basé sur les engins FAO, mais adapté au contexte réglementaire européen) :
365     * exemple :    - extension pour signifier 'pas d'engin' : NO
366     * extension pour signifier 'engin inconnu' : NK (Not Known)
367     * 'ligne avec canne (...)' : BTF (code utilisé pour des données historique)
368     * - 'Engin EU Corpus' pour le traitment (cf DRE_CORPUS dans tmpsih)
369     * - Engin Métier Ifremer (basé sur la classification FAO, et etendue aux besoins
370     * Ifremer/francais)
371     * Pour ObsMer, la classification utilisée est : FAO
372     * Pour les observations au débarquement, la classification utilisée est : FAO + CNTS (pour
373     * recroiser
374     * avec les déclarations)
375     * @return this.gearClassification GearClassification
376     */
377    public GearClassification getGearClassification()
378    {
379        return this.gearClassification;
380    }
381
382    /**
383     * Une classification d'engin permet le regroupement d'un ensemble cohérent d'engin.
384     * Exemple :
385     * - Engin FAO, appellée aussi CSITEP (Classification Standard Internationale Type des Engins de
386     * Pêche), ou, en anglais : International Standard Statistical Classification of Fishing Gear
387     * (ISSCFG)
388     * : ftp://ftp.fao.org/FI/DOCUMENT/cwp/handbook/annex/AnnexM1fishinggear.pdf
389     * - Engin CNTS (DPMA SIP)
390     * - Engin EU (basé sur les engins FAO, mais adapté au contexte réglementaire européen) :
391     * exemple :    - extension pour signifier 'pas d'engin' : NO
392     * extension pour signifier 'engin inconnu' : NK (Not Known)
393     * 'ligne avec canne (...)' : BTF (code utilisé pour des données historique)
394     * - 'Engin EU Corpus' pour le traitment (cf DRE_CORPUS dans tmpsih)
395     * - Engin Métier Ifremer (basé sur la classification FAO, et etendue aux besoins
396     * Ifremer/francais)
397     * Pour ObsMer, la classification utilisée est : FAO
398     * Pour les observations au débarquement, la classification utilisée est : FAO + CNTS (pour
399     * recroiser
400     * avec les déclarations)
401     * @param gearClassificationIn GearClassification
402     */
403    public void setGearClassification(GearClassification gearClassificationIn)
404    {
405        this.gearClassification = gearClassificationIn;
406    }
407
408    private Collection<Location> locations = new HashSet<Location>();
409
410    /**
411     * Lieux concernés par le programme.Les lieux sont obligatoirement du type de lieu rattaché au
412     * programme (cf. type de lieu concerné).
413     * @return this.locations Collection<Location>
414     */
415    public Collection<Location> getLocations()
416    {
417        return this.locations;
418    }
419
420    /**
421     * Lieux concernés par le programme.Les lieux sont obligatoirement du type de lieu rattaché au
422     * programme (cf. type de lieu concerné).
423     * @param locationsIn Collection<Location>
424     */
425    public void setLocations(Collection<Location> locationsIn)
426    {
427        this.locations = locationsIn;
428    }
429
430    /**
431     * Lieux concernés par le programme.Les lieux sont obligatoirement du type de lieu rattaché au
432     * programme (cf. type de lieu concerné).
433     * @param elementToAdd Location
434     * @return <tt>true</tt> if this collection changed as a result of the
435     *         call
436     */
437    public boolean addLocations(Location elementToAdd)
438    {
439        return this.locations.add(elementToAdd);
440    }
441
442    /**
443     * Lieux concernés par le programme.Les lieux sont obligatoirement du type de lieu rattaché au
444     * programme (cf. type de lieu concerné).
445     * @param elementToRemove Location
446     * @return <tt>true</tt> if this collection changed as a result of the
447     *         call
448     */
449    public boolean removeLocations(Location elementToRemove)
450    {
451        return this.locations.remove(elementToRemove);
452    }
453
454    private Collection<LocationClassification> locationClassifications = new HashSet<LocationClassification>();
455
456    /**
457     * Classifications de lieu concernés par le programme.
458     * Au moins une est obligatoire.
459     * @return this.locationClassifications Collection<LocationClassification>
460     */
461    public Collection<LocationClassification> getLocationClassifications()
462    {
463        return this.locationClassifications;
464    }
465
466    /**
467     * Classifications de lieu concernés par le programme.
468     * Au moins une est obligatoire.
469     * @param locationClassificationsIn Collection<LocationClassification>
470     */
471    public void setLocationClassifications(Collection<LocationClassification> locationClassificationsIn)
472    {
473        this.locationClassifications = locationClassificationsIn;
474    }
475
476    /**
477     * Classifications de lieu concernés par le programme.
478     * Au moins une est obligatoire.
479     * @param elementToAdd LocationClassification
480     * @return <tt>true</tt> if this collection changed as a result of the
481     *         call
482     */
483    public boolean addLocationClassifications(LocationClassification elementToAdd)
484    {
485        return this.locationClassifications.add(elementToAdd);
486    }
487
488    /**
489     * Classifications de lieu concernés par le programme.
490     * Au moins une est obligatoire.
491     * @param elementToRemove LocationClassification
492     * @return <tt>true</tt> if this collection changed as a result of the
493     *         call
494     */
495    public boolean removeLocationClassifications(LocationClassification elementToRemove)
496    {
497        return this.locationClassifications.remove(elementToRemove);
498    }
499
500    private Collection<Program2Department> program2Departments = new HashSet<Program2Department>();
501
502    /**
503     * Liste des droits d''un service pour un programme particulier
504     * @return this.program2Departments Collection<Program2Department>
505     */
506    public Collection<Program2Department> getProgram2Departments()
507    {
508        return this.program2Departments;
509    }
510
511    /**
512     * Liste des droits d''un service pour un programme particulier
513     * @param program2DepartmentsIn Collection<Program2Department>
514     */
515    public void setProgram2Departments(Collection<Program2Department> program2DepartmentsIn)
516    {
517        this.program2Departments = program2DepartmentsIn;
518    }
519
520    /**
521     * Liste des droits d''un service pour un programme particulier
522     * @param elementToAdd Program2Department
523     * @return <tt>true</tt> if this collection changed as a result of the
524     *         call
525     */
526    public boolean addProgram2Departments(Program2Department elementToAdd)
527    {
528        return this.program2Departments.add(elementToAdd);
529    }
530
531    /**
532     * Liste des droits d''un service pour un programme particulier
533     * @param elementToRemove Program2Department
534     * @return <tt>true</tt> if this collection changed as a result of the
535     *         call
536     */
537    public boolean removeProgram2Departments(Program2Department elementToRemove)
538    {
539        return this.program2Departments.remove(elementToRemove);
540    }
541
542    /**
543     * Returns <code>true</code> if the argument is an Program instance and all identifiers for this entity
544     * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
545     */
546    @Override
547    public boolean equals(Object object)
548    {
549        if (this == object)
550        {
551            return true;
552        }
553        if (!(object instanceof Program))
554        {
555            return false;
556        }
557        final Program that = (Program)object;
558        if (this.code == null || that.getCode() == null || !this.code.equals(that.getCode()))
559        {
560            return false;
561        }
562        return true;
563    }
564
565    /**
566     * Returns a hash code based on this entity's identifiers.
567     */
568    @Override
569    public int hashCode()
570    {
571        int hashCode = 0;
572        hashCode = 29 * hashCode + (this.code == null ? 0 : this.code.hashCode());
573
574        return hashCode;
575    }
576
577    /**
578     * Constructs new instances of {@link Program}.
579     */
580    public static final class Factory
581    {
582        /**
583         * Constructs a new instance of {@link Program}.
584         * @return new ProgramImpl()
585         */
586        public static Program newInstance()
587        {
588            return new ProgramImpl();
589        }
590
591        /**
592         * Constructs a new instance of {@link Program}, taking all required and/or
593         * read-only properties as arguments, except for identifiers.
594         * @param name String
595         * @param description String
596         * @param creationDate Date
597         * @param updateDate Timestamp
598         * @param taxonGroupType TaxonGroupType
599         * @param gearClassification GearClassification
600         * @param locationClassifications Collection<LocationClassification>
601         * @return newInstance
602         */
603        public static Program newInstance(String name, String description, Date creationDate, Timestamp updateDate, TaxonGroupType taxonGroupType, GearClassification gearClassification, Collection<LocationClassification> locationClassifications)
604        {
605            final Program entity = new ProgramImpl();
606            entity.setName(name);
607            entity.setDescription(description);
608            entity.setCreationDate(creationDate);
609            entity.setUpdateDate(updateDate);
610            entity.setTaxonGroupType(taxonGroupType);
611            entity.setGearClassification(gearClassification);
612            entity.setLocationClassifications(locationClassifications);
613            return entity;
614        }
615
616        /**
617         * Constructs a new instance of {@link Program}, taking all possible properties
618         * (except the identifier(s))as arguments.
619         * @param name String
620         * @param description String
621         * @param creationDate Date
622         * @param updateDate Timestamp
623         * @param taxonGroupType TaxonGroupType
624         * @param programUsers Collection<Program2Person>
625         * @param strategies Collection<Strategy>
626         * @param gearClassification GearClassification
627         * @param locations Collection<Location>
628         * @param locationClassifications Collection<LocationClassification>
629         * @param program2Departments Collection<Program2Department>
630         * @return newInstance Program
631         */
632        public static Program newInstance(String name, String description, Date creationDate, Timestamp updateDate, TaxonGroupType taxonGroupType, Collection<Program2Person> programUsers, Collection<Strategy> strategies, GearClassification gearClassification, Collection<Location> locations, Collection<LocationClassification> locationClassifications, Collection<Program2Department> program2Departments)
633        {
634            final Program entity = new ProgramImpl();
635            entity.setName(name);
636            entity.setDescription(description);
637            entity.setCreationDate(creationDate);
638            entity.setUpdateDate(updateDate);
639            entity.setTaxonGroupType(taxonGroupType);
640            entity.setProgramUsers(programUsers);
641            entity.setStrategies(strategies);
642            entity.setGearClassification(gearClassification);
643            entity.setLocations(locations);
644            entity.setLocationClassifications(locationClassifications);
645            entity.setProgram2Departments(program2Departments);
646            return entity;
647        }
648    }
649
650    /**
651     * @see Comparable#compareTo
652     */
653    public int compareTo(Program o)
654    {
655        int cmp = 0;
656        if (this.getCode() != null)
657        {
658            cmp = this.getCode().compareTo(o.getCode());
659        }
660        else
661        {
662            if (this.getName() != null)
663            {
664                cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName()));
665            }
666            if (this.getDescription() != null)
667            {
668                cmp = (cmp != 0 ? cmp : this.getDescription().compareTo(o.getDescription()));
669            }
670            if (this.getCreationDate() != null)
671            {
672                cmp = (cmp != 0 ? cmp : this.getCreationDate().compareTo(o.getCreationDate()));
673            }
674            if (this.getUpdateDate() != null)
675            {
676                cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate()));
677            }
678        }
679        return cmp;
680    }
681// HibernateEntity.vsl merge-point
682// Program.java merge-point
683}