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.referential;
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 java.io.Serializable;
30  import java.sql.Timestamp;
31  import java.util.Collection;
32  import java.util.HashSet;
33  
34  /**
35   * Liste des états possibles d'un objet.
36   */
37  // HibernateEntity.vsl annotations merge-point
38  public abstract class Status
39      implements Serializable, Comparable<Status>
40  {
41      /**
42       * The serial version UID of this class. Needed for serialization.
43       */
44      private static final long serialVersionUID = 2413971720867301580L;
45  
46      // Generate 4 attributes
47      private String statusCd;
48  
49      /**
50       * Code de l'état de l'objet (actif ou inactif)
51       * @return this.statusCd String
52       */
53      public String getStatusCd()
54      {
55          return this.statusCd;
56      }
57  
58      /**
59       * Code de l'état de l'objet (actif ou inactif)
60       * @param statusCdIn String
61       */
62      public void setStatusCd(String statusCdIn)
63      {
64          this.statusCd = statusCdIn;
65      }
66  
67      private String statusNm;
68  
69      /**
70       * Libellé de l'état.
71       * @return this.statusNm String
72       */
73      public String getStatusNm()
74      {
75          return this.statusNm;
76      }
77  
78      /**
79       * Libellé de l'état.
80       * @param statusNmIn String
81       */
82      public void setStatusNm(String statusNmIn)
83      {
84          this.statusNm = statusNmIn;
85      }
86  
87      private String statusDc;
88  
89      /**
90       * Description de l'état
91       * @return this.statusDc String
92       */
93      public String getStatusDc()
94      {
95          return this.statusDc;
96      }
97  
98      /**
99       * Description de l'état
100      * @param statusDcIn String
101      */
102     public void setStatusDc(String statusDcIn)
103     {
104         this.statusDc = statusDcIn;
105     }
106 
107     private Timestamp updateDt;
108 
109     /**
110      * Date de modification de l'objet, mise à jour par le système
111      * @return this.updateDt Timestamp
112      */
113     public Timestamp getUpdateDt()
114     {
115         return this.updateDt;
116     }
117 
118     /**
119      * Date de modification de l'objet, mise à jour par le système
120      * @param updateDtIn Timestamp
121      */
122     public void setUpdateDt(Timestamp updateDtIn)
123     {
124         this.updateDt = updateDtIn;
125     }
126 
127     // Generate 48 associations
128     private Collection<PrecisionType> precisionTypes = new HashSet<PrecisionType>();
129 
130     /**
131      * type d'incertitude des mesures d'un paramètre dans une stratégie.
132      * @return this.precisionTypes Collection<PrecisionType>
133      */
134     public Collection<PrecisionType> getPrecisionTypes()
135     {
136         return this.precisionTypes;
137     }
138 
139     /**
140      * type d'incertitude des mesures d'un paramètre dans une stratégie.
141      * @param precisionTypesIn Collection<PrecisionType>
142      */
143     public void setPrecisionTypes(Collection<PrecisionType> precisionTypesIn)
144     {
145         this.precisionTypes = precisionTypesIn;
146     }
147 
148     /**
149      * type d'incertitude des mesures d'un paramètre dans une stratégie.
150      * @param elementToAdd PrecisionType
151      * @return <tt>true</tt> if this collection changed as a result of the
152      *         call
153      */
154     public boolean addPrecisionTypes(PrecisionType elementToAdd)
155     {
156         return this.precisionTypes.add(elementToAdd);
157     }
158 
159     /**
160      * type d'incertitude des mesures d'un paramètre dans une stratégie.
161      * @param elementToRemove PrecisionType
162      * @return <tt>true</tt> if this collection changed as a result of the
163      *         call
164      */
165     public boolean removePrecisionTypes(PrecisionType elementToRemove)
166     {
167         return this.precisionTypes.remove(elementToRemove);
168     }
169 
170     /**
171      * Returns <code>true</code> if the argument is an Status instance and all identifiers for this entity
172      * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
173      */
174     @Override
175     public boolean equals(Object object)
176     {
177         if (this == object)
178         {
179             return true;
180         }
181         if (!(object instanceof Status))
182         {
183             return false;
184         }
185         final Status that = (Status)object;
186         if (this.statusCd == null || that.getStatusCd() == null || !this.statusCd.equals(that.getStatusCd()))
187         {
188             return false;
189         }
190         return true;
191     }
192 
193     /**
194      * Returns a hash code based on this entity's identifiers.
195      */
196     @Override
197     public int hashCode()
198     {
199         int hashCode = 0;
200         hashCode = 29 * hashCode + (this.statusCd == null ? 0 : this.statusCd.hashCode());
201 
202         return hashCode;
203     }
204 
205     /**
206      * Constructs new instances of {@link Status}.
207      */
208     public static final class Factory
209     {
210         /**
211          * Constructs a new instance of {@link Status}.
212          * @return new StatusImpl()
213          */
214         public static Status newInstance()
215         {
216             return new StatusImpl();
217         }
218 
219         /**
220          * Constructs a new instance of {@link Status}, taking all required and/or
221          * read-only properties as arguments, except for identifiers.
222          * @param statusNm String
223          * @param updateDt Timestamp
224          * @return newInstance
225          */
226         public static Status newInstance(String statusNm, Timestamp updateDt)
227         {
228             final Status entity = new StatusImpl();
229             entity.setStatusNm(statusNm);
230             entity.setUpdateDt(updateDt);
231             return entity;
232         }
233 
234         /**
235          * Constructs a new instance of {@link Status}, taking all possible properties
236          * (except the identifier(s))as arguments.
237          * @param statusNm String
238          * @param statusDc String
239          * @param updateDt Timestamp
240          * @param precisionTypes Collection<PrecisionType>
241          * @return newInstance Status
242          */
243         public static Status newInstance(String statusNm, String statusDc, Timestamp updateDt, Collection<PrecisionType> precisionTypes)
244         {
245             final Status entity = new StatusImpl();
246             entity.setStatusNm(statusNm);
247             entity.setStatusDc(statusDc);
248             entity.setUpdateDt(updateDt);
249             entity.setPrecisionTypes(precisionTypes);
250             return entity;
251         }
252     }
253 
254     /**
255      * @see Comparable#compareTo
256      */
257     public int compareTo(Status o)
258     {
259         int cmp = 0;
260         if (this.getStatusCd() != null)
261         {
262             cmp = this.getStatusCd().compareTo(o.getStatusCd());
263         }
264         else
265         {
266             if (this.getStatusNm() != null)
267             {
268                 cmp = (cmp != 0 ? cmp : this.getStatusNm().compareTo(o.getStatusNm()));
269             }
270             if (this.getStatusDc() != null)
271             {
272                 cmp = (cmp != 0 ? cmp : this.getStatusDc().compareTo(o.getStatusDc()));
273             }
274             if (this.getUpdateDt() != null)
275             {
276                 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
277             }
278         }
279         return cmp;
280     }
281 // HibernateEntity.vsl merge-point
282 // Status.java merge-point
283 }