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