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.system.context;
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.administration.user.Department;
29  import fr.ifremer.quadrige3.core.dao.administration.user.Quser;
30  import fr.ifremer.quadrige3.core.dao.referential.Status;
31  import fr.ifremer.quadrige3.core.dao.referential.order.OrderItemType;
32  import fr.ifremer.quadrige3.core.dao.system.MapProject;
33  import fr.ifremer.quadrige3.core.dao.system.filter.Filter;
34  import java.io.Serializable;
35  import java.sql.Timestamp;
36  import java.util.Collection;
37  import java.util.Date;
38  import java.util.HashSet;
39  
40  /**
41   * Gestion des contextes utilisateur
42   */
43  // HibernateEntity.vsl annotations merge-point
44  public abstract class Context
45      implements Serializable, Comparable<Context>
46  {
47      /**
48       * The serial version UID of this class. Needed for serialization.
49       */
50      private static final long serialVersionUID = 9107389586125409475L;
51  
52      // Generate 10 attributes
53      private Integer contextId;
54  
55      /**
56       * Identifiant du contexte
57       * @return this.contextId Integer
58       */
59      public Integer getContextId()
60      {
61          return this.contextId;
62      }
63  
64      /**
65       * Identifiant du contexte
66       * @param contextIdIn Integer
67       */
68      public void setContextId(Integer contextIdIn)
69      {
70          this.contextId = contextIdIn;
71      }
72  
73      private String contextNm;
74  
75      /**
76       * Libellé du contexte
77       * @return this.contextNm String
78       */
79      public String getContextNm()
80      {
81          return this.contextNm;
82      }
83  
84      /**
85       * Libellé du contexte
86       * @param contextNmIn String
87       */
88      public void setContextNm(String contextNmIn)
89      {
90          this.contextNm = contextNmIn;
91      }
92  
93      private String contextDc;
94  
95      /**
96       * Description du contexte
97       * @return this.contextDc String
98       */
99      public String getContextDc()
100     {
101         return this.contextDc;
102     }
103 
104     /**
105      * Description du contexte
106      * @param contextDcIn String
107      */
108     public void setContextDc(String contextDcIn)
109     {
110         this.contextDc = contextDcIn;
111     }
112 
113     private String contextIsDefault;
114 
115     /**
116      * Indique s'il s'agit du contexte par défaut
117      * @return this.contextIsDefault String
118      */
119     public String getContextIsDefault()
120     {
121         return this.contextIsDefault;
122     }
123 
124     /**
125      * Indique s'il s'agit du contexte par défaut
126      * @param contextIsDefaultIn String
127      */
128     public void setContextIsDefault(String contextIsDefaultIn)
129     {
130         this.contextIsDefault = contextIsDefaultIn;
131     }
132 
133     private Integer contextSurveyOrder;
134 
135     /**
136      * Ordre de tri des passages
137      * @return this.contextSurveyOrder Integer
138      */
139     public Integer getContextSurveyOrder()
140     {
141         return this.contextSurveyOrder;
142     }
143 
144     /**
145      * Ordre de tri des passages
146      * @param contextSurveyOrderIn Integer
147      */
148     public void setContextSurveyOrder(Integer contextSurveyOrderIn)
149     {
150         this.contextSurveyOrder = contextSurveyOrderIn;
151     }
152 
153     private Integer contextTaxonDisplay;
154 
155     /**
156      * Option d'affichage des taxons (arbre ou liste alphabétique)
157      * @return this.contextTaxonDisplay Integer
158      */
159     public Integer getContextTaxonDisplay()
160     {
161         return this.contextTaxonDisplay;
162     }
163 
164     /**
165      * Option d'affichage des taxons (arbre ou liste alphabétique)
166      * @param contextTaxonDisplayIn Integer
167      */
168     public void setContextTaxonDisplay(Integer contextTaxonDisplayIn)
169     {
170         this.contextTaxonDisplay = contextTaxonDisplayIn;
171     }
172 
173     private Integer contextInitPopOrder;
174 
175     /**
176      * Ordre de tri des populations initiales
177      * @return this.contextInitPopOrder Integer
178      */
179     public Integer getContextInitPopOrder()
180     {
181         return this.contextInitPopOrder;
182     }
183 
184     /**
185      * Ordre de tri des populations initiales
186      * @param contextInitPopOrderIn Integer
187      */
188     public void setContextInitPopOrder(Integer contextInitPopOrderIn)
189     {
190         this.contextInitPopOrder = contextInitPopOrderIn;
191     }
192 
193     private Float contextPlugZone;
194 
195     /**
196      * Taille de la zone tampon pour les règles de cohérence cartographique
197      * @return this.contextPlugZone Float
198      */
199     public Float getContextPlugZone()
200     {
201         return this.contextPlugZone;
202     }
203 
204     /**
205      * Taille de la zone tampon pour les règles de cohérence cartographique
206      * @param contextPlugZoneIn Float
207      */
208     public void setContextPlugZone(Float contextPlugZoneIn)
209     {
210         this.contextPlugZone = contextPlugZoneIn;
211     }
212 
213     private Date contextCreationDt;
214 
215     /**
216      * Date de création du contexte
217      * @return this.contextCreationDt Date
218      */
219     public Date getContextCreationDt()
220     {
221         return this.contextCreationDt;
222     }
223 
224     /**
225      * Date de création du contexte
226      * @param contextCreationDtIn Date
227      */
228     public void setContextCreationDt(Date contextCreationDtIn)
229     {
230         this.contextCreationDt = contextCreationDtIn;
231     }
232 
233     private Timestamp updateDt;
234 
235     /**
236      * Date de mise à jour de l'entité
237      * @return this.updateDt Timestamp
238      */
239     public Timestamp getUpdateDt()
240     {
241         return this.updateDt;
242     }
243 
244     /**
245      * Date de mise à jour de l'entité
246      * @param updateDtIn Timestamp
247      */
248     public void setUpdateDt(Timestamp updateDtIn)
249     {
250         this.updateDt = updateDtIn;
251     }
252 
253     // Generate 8 associations
254     private Status status;
255 
256     /**
257      * Liste des états possibles d'un objet.
258      * @return this.status Status
259      */
260     public Status getStatus()
261     {
262         return this.status;
263     }
264 
265     /**
266      * Liste des états possibles d'un objet.
267      * @param statusIn Status
268      */
269     public void setStatus(Status statusIn)
270     {
271         this.status = statusIn;
272     }
273 
274     private Collection<Filter> filters = new HashSet<Filter>();
275 
276     /**
277      * Table technique : Un filtre permet pour un utilisateur et un service de définie différents
278      * critères
279      * d'accès aux données in situ
280      * @return this.filters Collection<Filter>
281      */
282     public Collection<Filter> getFilters()
283     {
284         return this.filters;
285     }
286 
287     /**
288      * Table technique : Un filtre permet pour un utilisateur et un service de définie différents
289      * critères
290      * d'accès aux données in situ
291      * @param filtersIn Collection<Filter>
292      */
293     public void setFilters(Collection<Filter> filtersIn)
294     {
295         this.filters = filtersIn;
296     }
297 
298     /**
299      * Table technique : Un filtre permet pour un utilisateur et un service de définie différents
300      * critères
301      * d'accès aux données in situ
302      * @param elementToAdd Filter
303      * @return <tt>true</tt> if this collection changed as a result of the
304      *         call
305      */
306     public boolean addFilters(Filter elementToAdd)
307     {
308         return this.filters.add(elementToAdd);
309     }
310 
311     /**
312      * Table technique : Un filtre permet pour un utilisateur et un service de définie différents
313      * critères
314      * d'accès aux données in situ
315      * @param elementToRemove Filter
316      * @return <tt>true</tt> if this collection changed as a result of the
317      *         call
318      */
319     public boolean removeFilters(Filter elementToRemove)
320     {
321         return this.filters.remove(elementToRemove);
322     }
323 
324     private Collection<DefaultValue> defaultValues = new HashSet<DefaultValue>();
325 
326     /**
327      * Valeurs par défaut définies sur un contexte
328      * @return this.defaultValues Collection<DefaultValue>
329      */
330     public Collection<DefaultValue> getDefaultValues()
331     {
332         return this.defaultValues;
333     }
334 
335     /**
336      * Valeurs par défaut définies sur un contexte
337      * @param defaultValuesIn Collection<DefaultValue>
338      */
339     public void setDefaultValues(Collection<DefaultValue> defaultValuesIn)
340     {
341         this.defaultValues = defaultValuesIn;
342     }
343 
344     /**
345      * Valeurs par défaut définies sur un contexte
346      * @param elementToAdd DefaultValue
347      * @return <tt>true</tt> if this collection changed as a result of the
348      *         call
349      */
350     public boolean addDefaultValues(DefaultValue elementToAdd)
351     {
352         return this.defaultValues.add(elementToAdd);
353     }
354 
355     /**
356      * Valeurs par défaut définies sur un contexte
357      * @param elementToRemove DefaultValue
358      * @return <tt>true</tt> if this collection changed as a result of the
359      *         call
360      */
361     public boolean removeDefaultValues(DefaultValue elementToRemove)
362     {
363         return this.defaultValues.remove(elementToRemove);
364     }
365 
366     private MapProject mapProject;
367 
368     /**
369      * Projet cartographique
370      * @return this.mapProject MapProject
371      */
372     public MapProject getMapProject()
373     {
374         return this.mapProject;
375     }
376 
377     /**
378      * Projet cartographique
379      * @param mapProjectIn MapProject
380      */
381     public void setMapProject(MapProject mapProjectIn)
382     {
383         this.mapProject = mapProjectIn;
384     }
385 
386     private Collection<Department> departments = new HashSet<Department>();
387 
388     /**
389      * Liste les départements ou services auxquels sont rattachés les agents
390      * @return this.departments Collection<Department>
391      */
392     public Collection<Department> getDepartments()
393     {
394         return this.departments;
395     }
396 
397     /**
398      * Liste les départements ou services auxquels sont rattachés les agents
399      * @param departmentsIn Collection<Department>
400      */
401     public void setDepartments(Collection<Department> departmentsIn)
402     {
403         this.departments = departmentsIn;
404     }
405 
406     /**
407      * Liste les départements ou services auxquels sont rattachés les agents
408      * @param elementToAdd Department
409      * @return <tt>true</tt> if this collection changed as a result of the
410      *         call
411      */
412     public boolean addDepartments(Department elementToAdd)
413     {
414         return this.departments.add(elementToAdd);
415     }
416 
417     /**
418      * Liste les départements ou services auxquels sont rattachés les agents
419      * @param elementToRemove Department
420      * @return <tt>true</tt> if this collection changed as a result of the
421      *         call
422      */
423     public boolean removeDepartments(Department elementToRemove)
424     {
425         return this.departments.remove(elementToRemove);
426     }
427 
428     private Quser quser;
429 
430     /**
431      * Liste l'ensemble des agents et utilisateurs du système.
432      * @return this.quser Quser
433      */
434     public Quser getQuser()
435     {
436         return this.quser;
437     }
438 
439     /**
440      * Liste l'ensemble des agents et utilisateurs du système.
441      * @param quserIn Quser
442      */
443     public void setQuser(Quser quserIn)
444     {
445         this.quser = quserIn;
446     }
447 
448     private OrderItemType orderItemType;
449 
450     /**
451      * Type d'entités géographiques utilisées pour trier les lieux de surveillance (masse d'eau,
452      * zone
453      * classée, zone conchylicole...)
454      * @return this.orderItemType OrderItemType
455      */
456     public OrderItemType getOrderItemType()
457     {
458         return this.orderItemType;
459     }
460 
461     /**
462      * Type d'entités géographiques utilisées pour trier les lieux de surveillance (masse d'eau,
463      * zone
464      * classée, zone conchylicole...)
465      * @param orderItemTypeIn OrderItemType
466      */
467     public void setOrderItemType(OrderItemType orderItemTypeIn)
468     {
469         this.orderItemType = orderItemTypeIn;
470     }
471 
472     /**
473      * Returns <code>true</code> if the argument is an Context instance and all identifiers for this entity
474      * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
475      */
476     @Override
477     public boolean equals(Object object)
478     {
479         if (this == object)
480         {
481             return true;
482         }
483         if (!(object instanceof Context))
484         {
485             return false;
486         }
487         final Context that = (Context)object;
488         if (this.contextId == null || that.getContextId() == null || !this.contextId.equals(that.getContextId()))
489         {
490             return false;
491         }
492         return true;
493     }
494 
495     /**
496      * Returns a hash code based on this entity's identifiers.
497      */
498     @Override
499     public int hashCode()
500     {
501         int hashCode = 0;
502         hashCode = 29 * hashCode + (this.contextId == null ? 0 : this.contextId.hashCode());
503 
504         return hashCode;
505     }
506 
507     /**
508      * Constructs new instances of {@link Context}.
509      */
510     public static final class Factory
511     {
512         /**
513          * Constructs a new instance of {@link Context}.
514          * @return new ContextImpl()
515          */
516         public static Context newInstance()
517         {
518             return new ContextImpl();
519         }
520 
521         /**
522          * Constructs a new instance of {@link Context}, taking all required and/or
523          * read-only properties as arguments, except for identifiers.
524          * @param contextNm String
525          * @param status Status
526          * @return newInstance
527          */
528         public static Context newInstance(String contextNm, Status status)
529         {
530             final Context entity = new ContextImpl();
531             entity.setContextNm(contextNm);
532             entity.setStatus(status);
533             return entity;
534         }
535 
536         /**
537          * Constructs a new instance of {@link Context}, taking all possible properties
538          * (except the identifier(s))as arguments.
539          * @param contextNm String
540          * @param contextDc String
541          * @param contextIsDefault String
542          * @param contextSurveyOrder Integer
543          * @param contextTaxonDisplay Integer
544          * @param contextInitPopOrder Integer
545          * @param contextPlugZone Float
546          * @param contextCreationDt Date
547          * @param updateDt Timestamp
548          * @param status Status
549          * @param filters Collection<Filter>
550          * @param defaultValues Collection<DefaultValue>
551          * @param mapProject MapProject
552          * @param departments Collection<Department>
553          * @param quser Quser
554          * @param orderItemType OrderItemType
555          * @return newInstance Context
556          */
557         public static Context newInstance(String contextNm, String contextDc, String contextIsDefault, Integer contextSurveyOrder, Integer contextTaxonDisplay, Integer contextInitPopOrder, Float contextPlugZone, Date contextCreationDt, Timestamp updateDt, Status status, Collection<Filter> filters, Collection<DefaultValue> defaultValues, MapProject mapProject, Collection<Department> departments, Quser quser, OrderItemType orderItemType)
558         {
559             final Context entity = new ContextImpl();
560             entity.setContextNm(contextNm);
561             entity.setContextDc(contextDc);
562             entity.setContextIsDefault(contextIsDefault);
563             entity.setContextSurveyOrder(contextSurveyOrder);
564             entity.setContextTaxonDisplay(contextTaxonDisplay);
565             entity.setContextInitPopOrder(contextInitPopOrder);
566             entity.setContextPlugZone(contextPlugZone);
567             entity.setContextCreationDt(contextCreationDt);
568             entity.setUpdateDt(updateDt);
569             entity.setStatus(status);
570             entity.setFilters(filters);
571             entity.setDefaultValues(defaultValues);
572             entity.setMapProject(mapProject);
573             entity.setDepartments(departments);
574             entity.setQuser(quser);
575             entity.setOrderItemType(orderItemType);
576             return entity;
577         }
578     }
579 
580     /**
581      * @see Comparable#compareTo
582      */
583     public int compareTo(Context o)
584     {
585         int cmp = 0;
586         if (this.getContextId() != null)
587         {
588             cmp = this.getContextId().compareTo(o.getContextId());
589         }
590         else
591         {
592             if (this.getContextNm() != null)
593             {
594                 cmp = (cmp != 0 ? cmp : this.getContextNm().compareTo(o.getContextNm()));
595             }
596             if (this.getContextDc() != null)
597             {
598                 cmp = (cmp != 0 ? cmp : this.getContextDc().compareTo(o.getContextDc()));
599             }
600             if (this.getContextIsDefault() != null)
601             {
602                 cmp = (cmp != 0 ? cmp : this.getContextIsDefault().compareTo(o.getContextIsDefault()));
603             }
604             if (this.getContextSurveyOrder() != null)
605             {
606                 cmp = (cmp != 0 ? cmp : this.getContextSurveyOrder().compareTo(o.getContextSurveyOrder()));
607             }
608             if (this.getContextTaxonDisplay() != null)
609             {
610                 cmp = (cmp != 0 ? cmp : this.getContextTaxonDisplay().compareTo(o.getContextTaxonDisplay()));
611             }
612             if (this.getContextInitPopOrder() != null)
613             {
614                 cmp = (cmp != 0 ? cmp : this.getContextInitPopOrder().compareTo(o.getContextInitPopOrder()));
615             }
616             if (this.getContextPlugZone() != null)
617             {
618                 cmp = (cmp != 0 ? cmp : this.getContextPlugZone().compareTo(o.getContextPlugZone()));
619             }
620             if (this.getContextCreationDt() != null)
621             {
622                 cmp = (cmp != 0 ? cmp : this.getContextCreationDt().compareTo(o.getContextCreationDt()));
623             }
624             if (this.getUpdateDt() != null)
625             {
626                 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
627             }
628         }
629         return cmp;
630     }
631 // HibernateEntity.vsl merge-point
632 // Context.java merge-point
633 }