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.quadrige2.core.dao.administration.program;
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.strategy.Strategy;
30  import fr.ifremer.quadrige2.core.dao.referential.Status;
31  import fr.ifremer.quadrige2.core.dao.system.ComputeFunction;
32  import java.io.Serializable;
33  import java.sql.Timestamp;
34  import java.util.Collection;
35  import java.util.Date;
36  import java.util.HashSet;
37  
38  /**
39   * Activités à l'origine de la collecte d'un ensemble cohérent de données.
40   */
41  // HibernateEntity.vsl annotations merge-point
42  public abstract class Program
43      implements Serializable, Comparable<Program>
44  {
45      /**
46       * The serial version UID of this class. Needed for serialization.
47       */
48      private static final long serialVersionUID = -1363232296695227311L;
49  
50      // Generate 6 attributes
51      private String progCd;
52  
53      /**
54       * Code unique du programme
55       * @return this.progCd String
56       */
57      public String getProgCd()
58      {
59          return this.progCd;
60      }
61  
62      /**
63       * Code unique du programme
64       * @param progCdIn String
65       */
66      public void setProgCd(String progCdIn)
67      {
68          this.progCd = progCdIn;
69      }
70  
71      private String progNm;
72  
73      /**
74       * Libellé du programme
75       * @return this.progNm String
76       */
77      public String getProgNm()
78      {
79          return this.progNm;
80      }
81  
82      /**
83       * Libellé du programme
84       * @param progNmIn String
85       */
86      public void setProgNm(String progNmIn)
87      {
88          this.progNm = progNmIn;
89      }
90  
91      private String progDc;
92  
93      /**
94       * Description du programme
95       * @return this.progDc String
96       */
97      public String getProgDc()
98      {
99          return this.progDc;
100     }
101 
102     /**
103      * Description du programme
104      * @param progDcIn String
105      */
106     public void setProgDc(String progDcIn)
107     {
108         this.progDc = progDcIn;
109     }
110 
111     private Date progCreationDt;
112 
113     /**
114      * Date de création de l'objet
115      * @return this.progCreationDt Date
116      */
117     public Date getProgCreationDt()
118     {
119         return this.progCreationDt;
120     }
121 
122     /**
123      * Date de création de l'objet
124      * @param progCreationDtIn Date
125      */
126     public void setProgCreationDt(Date progCreationDtIn)
127     {
128         this.progCreationDt = progCreationDtIn;
129     }
130 
131     private Timestamp updateDt;
132 
133     /**
134      * Date de mise à jour de l'objet
135      * @return this.updateDt Timestamp
136      */
137     public Timestamp getUpdateDt()
138     {
139         return this.updateDt;
140     }
141 
142     /**
143      * Date de mise à jour de l'objet
144      * @param updateDtIn Timestamp
145      */
146     public void setUpdateDt(Timestamp updateDtIn)
147     {
148         this.updateDt = updateDtIn;
149     }
150 
151     private String isDepartmentHermetic = "0";
152 
153     /**
154      * 
155      * @return this.isDepartmentHermetic String
156      */
157     public String getIsDepartmentHermetic()
158     {
159         return this.isDepartmentHermetic;
160     }
161 
162     /**
163      * 
164      * @param isDepartmentHermeticIn String
165      */
166     public void setIsDepartmentHermetic(String isDepartmentHermeticIn)
167     {
168         this.isDepartmentHermetic = isDepartmentHermeticIn;
169     }
170 
171     // Generate 20 associations
172     private Status status;
173 
174     /**
175      * Liste des états possibles d'un objet.
176      * @return this.status Status
177      */
178     public Status getStatus()
179     {
180         return this.status;
181     }
182 
183     /**
184      * Liste des états possibles d'un objet.
185      * @param statusIn Status
186      */
187     public void setStatus(Status statusIn)
188     {
189         this.status = statusIn;
190     }
191 
192     private Collection<MonLocProg> monLocProgs = new HashSet<MonLocProg>();
193 
194     /**
195      * Liste des lieux surveillés par un programme.
196      * @return this.monLocProgs Collection<MonLocProg>
197      */
198     public Collection<MonLocProg> getMonLocProgs()
199     {
200         return this.monLocProgs;
201     }
202 
203     /**
204      * Liste des lieux surveillés par un programme.
205      * @param monLocProgsIn Collection<MonLocProg>
206      */
207     public void setMonLocProgs(Collection<MonLocProg> monLocProgsIn)
208     {
209         this.monLocProgs = monLocProgsIn;
210     }
211 
212     /**
213      * Liste des lieux surveillés par un programme.
214      * @param elementToAdd MonLocProg
215      * @return <tt>true</tt> if this collection changed as a result of the
216      *         call
217      */
218     public boolean addMonLocProgs(MonLocProg elementToAdd)
219     {
220         return this.monLocProgs.add(elementToAdd);
221     }
222 
223     /**
224      * Liste des lieux surveillés par un programme.
225      * @param elementToRemove MonLocProg
226      * @return <tt>true</tt> if this collection changed as a result of the
227      *         call
228      */
229     public boolean removeMonLocProgs(MonLocProg elementToRemove)
230     {
231         return this.monLocProgs.remove(elementToRemove);
232     }
233 
234     private Collection<ProgQuserProgPriv> progQuserProgPrivs = new HashSet<ProgQuserProgPriv>();
235 
236     /**
237      * Liste des droits d'un utilisateur pour un programme particulier.
238      * @return this.progQuserProgPrivs Collection<ProgQuserProgPriv>
239      */
240     public Collection<ProgQuserProgPriv> getProgQuserProgPrivs()
241     {
242         return this.progQuserProgPrivs;
243     }
244 
245     /**
246      * Liste des droits d'un utilisateur pour un programme particulier.
247      * @param progQuserProgPrivsIn Collection<ProgQuserProgPriv>
248      */
249     public void setProgQuserProgPrivs(Collection<ProgQuserProgPriv> progQuserProgPrivsIn)
250     {
251         this.progQuserProgPrivs = progQuserProgPrivsIn;
252     }
253 
254     /**
255      * Liste des droits d'un utilisateur pour un programme particulier.
256      * @param elementToAdd ProgQuserProgPriv
257      * @return <tt>true</tt> if this collection changed as a result of the
258      *         call
259      */
260     public boolean addProgQuserProgPrivs(ProgQuserProgPriv elementToAdd)
261     {
262         return this.progQuserProgPrivs.add(elementToAdd);
263     }
264 
265     /**
266      * Liste des droits d'un utilisateur pour un programme particulier.
267      * @param elementToRemove ProgQuserProgPriv
268      * @return <tt>true</tt> if this collection changed as a result of the
269      *         call
270      */
271     public boolean removeProgQuserProgPrivs(ProgQuserProgPriv elementToRemove)
272     {
273         return this.progQuserProgPrivs.remove(elementToRemove);
274     }
275 
276     private Collection<ComputeFunction> compFunctionCds = new HashSet<ComputeFunction>();
277 
278     /**
279      * Contient les différentes fonction de calcul pour les paramètres
280      * @return this.compFunctionCds Collection<ComputeFunction>
281      */
282     public Collection<ComputeFunction> getCompFunctionCds()
283     {
284         return this.compFunctionCds;
285     }
286 
287     /**
288      * Contient les différentes fonction de calcul pour les paramètres
289      * @param compFunctionCdsIn Collection<ComputeFunction>
290      */
291     public void setCompFunctionCds(Collection<ComputeFunction> compFunctionCdsIn)
292     {
293         this.compFunctionCds = compFunctionCdsIn;
294     }
295 
296     /**
297      * Contient les différentes fonction de calcul pour les paramètres
298      * @param elementToAdd ComputeFunction
299      * @return <tt>true</tt> if this collection changed as a result of the
300      *         call
301      */
302     public boolean addCompFunctionCds(ComputeFunction elementToAdd)
303     {
304         return this.compFunctionCds.add(elementToAdd);
305     }
306 
307     /**
308      * Contient les différentes fonction de calcul pour les paramètres
309      * @param elementToRemove ComputeFunction
310      * @return <tt>true</tt> if this collection changed as a result of the
311      *         call
312      */
313     public boolean removeCompFunctionCds(ComputeFunction elementToRemove)
314     {
315         return this.compFunctionCds.remove(elementToRemove);
316     }
317 
318     private Collection<ProgDepProgPriv> progDepProgPrivs = new HashSet<ProgDepProgPriv>();
319 
320     /**
321      * Liste des droits d'un service pour un programme particulier.
322      * @return this.progDepProgPrivs Collection<ProgDepProgPriv>
323      */
324     public Collection<ProgDepProgPriv> getProgDepProgPrivs()
325     {
326         return this.progDepProgPrivs;
327     }
328 
329     /**
330      * Liste des droits d'un service pour un programme particulier.
331      * @param progDepProgPrivsIn Collection<ProgDepProgPriv>
332      */
333     public void setProgDepProgPrivs(Collection<ProgDepProgPriv> progDepProgPrivsIn)
334     {
335         this.progDepProgPrivs = progDepProgPrivsIn;
336     }
337 
338     /**
339      * Liste des droits d'un service pour un programme particulier.
340      * @param elementToAdd ProgDepProgPriv
341      * @return <tt>true</tt> if this collection changed as a result of the
342      *         call
343      */
344     public boolean addProgDepProgPrivs(ProgDepProgPriv elementToAdd)
345     {
346         return this.progDepProgPrivs.add(elementToAdd);
347     }
348 
349     /**
350      * Liste des droits d'un service pour un programme particulier.
351      * @param elementToRemove ProgDepProgPriv
352      * @return <tt>true</tt> if this collection changed as a result of the
353      *         call
354      */
355     public boolean removeProgDepProgPrivs(ProgDepProgPriv elementToRemove)
356     {
357         return this.progDepProgPrivs.remove(elementToRemove);
358     }
359 
360     private Collection<Strategy> strategies = new HashSet<Strategy>();
361 
362     /**
363      * Définie les paramètres à mesurer dans un programme particulier.
364      * @return this.strategies Collection<Strategy>
365      */
366     public Collection<Strategy> getStrategies()
367     {
368         return this.strategies;
369     }
370 
371     /**
372      * Définie les paramètres à mesurer dans un programme particulier.
373      * @param strategiesIn Collection<Strategy>
374      */
375     public void setStrategies(Collection<Strategy> strategiesIn)
376     {
377         this.strategies = strategiesIn;
378     }
379 
380     /**
381      * Définie les paramètres à mesurer dans un programme particulier.
382      * @param elementToAdd Strategy
383      * @return <tt>true</tt> if this collection changed as a result of the
384      *         call
385      */
386     public boolean addStrategies(Strategy elementToAdd)
387     {
388         return this.strategies.add(elementToAdd);
389     }
390 
391     /**
392      * Définie les paramètres à mesurer dans un programme particulier.
393      * @param elementToRemove Strategy
394      * @return <tt>true</tt> if this collection changed as a result of the
395      *         call
396      */
397     public boolean removeStrategies(Strategy elementToRemove)
398     {
399         return this.strategies.remove(elementToRemove);
400     }
401 
402     /**
403      * Returns <code>true</code> if the argument is an Program instance and all identifiers for this entity
404      * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
405      */
406     @Override
407     public boolean equals(Object object)
408     {
409         if (this == object)
410         {
411             return true;
412         }
413         if (!(object instanceof Program))
414         {
415             return false;
416         }
417         final Program that = (Program)object;
418         if (this.progCd == null || that.getProgCd() == null || !this.progCd.equals(that.getProgCd()))
419         {
420             return false;
421         }
422         return true;
423     }
424 
425     /**
426      * Returns a hash code based on this entity's identifiers.
427      */
428     @Override
429     public int hashCode()
430     {
431         int hashCode = 0;
432         hashCode = 29 * hashCode + (this.progCd == null ? 0 : this.progCd.hashCode());
433 
434         return hashCode;
435     }
436 
437     /**
438      * Constructs new instances of {@link Program}.
439      */
440     public static final class Factory
441     {
442         /**
443          * Constructs a new instance of {@link Program}.
444          * @return new ProgramImpl()
445          */
446         public static Program newInstance()
447         {
448             return new ProgramImpl();
449         }
450 
451         /**
452          * Constructs a new instance of {@link Program}, taking all required and/or
453          * read-only properties as arguments, except for identifiers.
454          * @param progNm String
455          * @param updateDt Timestamp
456          * @param status Status
457          * @return newInstance
458          */
459         public static Program newInstance(String progNm, Timestamp updateDt, Status status)
460         {
461             final Program entity = new ProgramImpl();
462             entity.setProgNm(progNm);
463             entity.setUpdateDt(updateDt);
464             entity.setStatus(status);
465             return entity;
466         }
467 
468         /**
469          * Constructs a new instance of {@link Program}, taking all possible properties
470          * (except the identifier(s))as arguments.
471          * @param progNm String
472          * @param progDc String
473          * @param progCreationDt Date
474          * @param updateDt Timestamp
475          * @param isDepartmentHermetic String
476          * @param status Status
477          * @param monLocProgs Collection<MonLocProg>
478          * @param progQuserProgPrivs Collection<ProgQuserProgPriv>
479          * @param compFunctionCds Collection<ComputeFunction>
480          * @param progDepProgPrivs Collection<ProgDepProgPriv>
481          * @param strategies Collection<Strategy>
482          * @return newInstance Program
483          */
484         public static Program newInstance(String progNm, String progDc, Date progCreationDt, Timestamp updateDt, String isDepartmentHermetic, Status status, Collection<MonLocProg> monLocProgs, Collection<ProgQuserProgPriv> progQuserProgPrivs, Collection<ComputeFunction> compFunctionCds, Collection<ProgDepProgPriv> progDepProgPrivs, Collection<Strategy> strategies)
485         {
486             final Program entity = new ProgramImpl();
487             entity.setProgNm(progNm);
488             entity.setProgDc(progDc);
489             entity.setProgCreationDt(progCreationDt);
490             entity.setUpdateDt(updateDt);
491             entity.setIsDepartmentHermetic(isDepartmentHermetic);
492             entity.setStatus(status);
493             entity.setMonLocProgs(monLocProgs);
494             entity.setProgQuserProgPrivs(progQuserProgPrivs);
495             entity.setCompFunctionCds(compFunctionCds);
496             entity.setProgDepProgPrivs(progDepProgPrivs);
497             entity.setStrategies(strategies);
498             return entity;
499         }
500     }
501 
502     /**
503      * @see Comparable#compareTo
504      */
505     public int compareTo(Program o)
506     {
507         int cmp = 0;
508         if (this.getProgCd() != null)
509         {
510             cmp = this.getProgCd().compareTo(o.getProgCd());
511         }
512         else
513         {
514             if (this.getProgNm() != null)
515             {
516                 cmp = (cmp != 0 ? cmp : this.getProgNm().compareTo(o.getProgNm()));
517             }
518             if (this.getProgDc() != null)
519             {
520                 cmp = (cmp != 0 ? cmp : this.getProgDc().compareTo(o.getProgDc()));
521             }
522             if (this.getProgCreationDt() != null)
523             {
524                 cmp = (cmp != 0 ? cmp : this.getProgCreationDt().compareTo(o.getProgCreationDt()));
525             }
526             if (this.getUpdateDt() != null)
527             {
528                 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
529             }
530             if (this.getIsDepartmentHermetic() != null)
531             {
532                 cmp = (cmp != 0 ? cmp : this.getIsDepartmentHermetic().compareTo(o.getIsDepartmentHermetic()));
533             }
534         }
535         return cmp;
536     }
537 // HibernateEntity.vsl merge-point
538 // Program.java merge-point
539 }