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.rule;
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.Date;
33  import java.util.HashSet;
34  
35  /**
36   * Cette table permet de conserver les fonctions de contrôle
37   */
38  // HibernateEntity.vsl annotations merge-point
39  public abstract class Function
40      implements Serializable, Comparable<Function>
41  {
42      /**
43       * The serial version UID of this class. Needed for serialization.
44       */
45      private static final long serialVersionUID = -6054206330509848492L;
46  
47      // Generate 5 attributes
48      private Integer functionId;
49  
50      /**
51       * Identifiant unique de la fonction
52       * @return this.functionId Integer
53       */
54      public Integer getFunctionId()
55      {
56          return this.functionId;
57      }
58  
59      /**
60       * Identifiant unique de la fonction
61       * @param functionIdIn Integer
62       */
63      public void setFunctionId(Integer functionIdIn)
64      {
65          this.functionId = functionIdIn;
66      }
67  
68      private String functionNm;
69  
70      /**
71       * Libellé de la fonction
72       * @return this.functionNm String
73       */
74      public String getFunctionNm()
75      {
76          return this.functionNm;
77      }
78  
79      /**
80       * Libellé de la fonction
81       * @param functionNmIn String
82       */
83      public void setFunctionNm(String functionNmIn)
84      {
85          this.functionNm = functionNmIn;
86      }
87  
88      private String functionJavaFunctionClass;
89  
90      /**
91       * Nom de la classe Java fournissant le code de la fonction : identifiant unique
92       * @return this.functionJavaFunctionClass String
93       */
94      public String getFunctionJavaFunctionClass()
95      {
96          return this.functionJavaFunctionClass;
97      }
98  
99      /**
100      * Nom de la classe Java fournissant le code de la fonction : identifiant unique
101      * @param functionJavaFunctionClassIn String
102      */
103     public void setFunctionJavaFunctionClass(String functionJavaFunctionClassIn)
104     {
105         this.functionJavaFunctionClass = functionJavaFunctionClassIn;
106     }
107 
108     private Date functionCreationDt;
109 
110     /**
111      * Date de création de la fonction
112      * @return this.functionCreationDt Date
113      */
114     public Date getFunctionCreationDt()
115     {
116         return this.functionCreationDt;
117     }
118 
119     /**
120      * Date de création de la fonction
121      * @param functionCreationDtIn Date
122      */
123     public void setFunctionCreationDt(Date functionCreationDtIn)
124     {
125         this.functionCreationDt = functionCreationDtIn;
126     }
127 
128     private Timestamp updateDt;
129 
130     /**
131      * Date de modification de l'objet, mise à jour par le système
132      * @return this.updateDt Timestamp
133      */
134     public Timestamp getUpdateDt()
135     {
136         return this.updateDt;
137     }
138 
139     /**
140      * Date de modification de l'objet, mise à jour par le système
141      * @param updateDtIn Timestamp
142      */
143     public void setUpdateDt(Timestamp updateDtIn)
144     {
145         this.updateDt = updateDtIn;
146     }
147 
148     // Generate 2 associations
149     private Collection<FunctionParameter> functionParameters = new HashSet<FunctionParameter>();
150 
151     /**
152      * Cette table permet de conserver les paramètres des fonctions de contrôle
153      * @return this.functionParameters Collection<FunctionParameter>
154      */
155     public Collection<FunctionParameter> getFunctionParameters()
156     {
157         return this.functionParameters;
158     }
159 
160     /**
161      * Cette table permet de conserver les paramètres des fonctions de contrôle
162      * @param functionParametersIn Collection<FunctionParameter>
163      */
164     public void setFunctionParameters(Collection<FunctionParameter> functionParametersIn)
165     {
166         this.functionParameters = functionParametersIn;
167     }
168 
169     /**
170      * Cette table permet de conserver les paramètres des fonctions de contrôle
171      * @param elementToAdd FunctionParameter
172      * @return <tt>true</tt> if this collection changed as a result of the
173      *         call
174      */
175     public boolean addFunctionParameters(FunctionParameter elementToAdd)
176     {
177         return this.functionParameters.add(elementToAdd);
178     }
179 
180     /**
181      * Cette table permet de conserver les paramètres des fonctions de contrôle
182      * @param elementToRemove FunctionParameter
183      * @return <tt>true</tt> if this collection changed as a result of the
184      *         call
185      */
186     public boolean removeFunctionParameters(FunctionParameter elementToRemove)
187     {
188         return this.functionParameters.remove(elementToRemove);
189     }
190 
191     /**
192      * Returns <code>true</code> if the argument is an Function instance and all identifiers for this entity
193      * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
194      */
195     @Override
196     public boolean equals(Object object)
197     {
198         if (this == object)
199         {
200             return true;
201         }
202         if (!(object instanceof Function))
203         {
204             return false;
205         }
206         final Function that = (Function)object;
207         if (this.functionId == null || that.getFunctionId() == null || !this.functionId.equals(that.getFunctionId()))
208         {
209             return false;
210         }
211         return true;
212     }
213 
214     /**
215      * Returns a hash code based on this entity's identifiers.
216      */
217     @Override
218     public int hashCode()
219     {
220         int hashCode = 0;
221         hashCode = 29 * hashCode + (this.functionId == null ? 0 : this.functionId.hashCode());
222 
223         return hashCode;
224     }
225 
226     /**
227      * Constructs new instances of {@link Function}.
228      */
229     public static final class Factory
230     {
231         /**
232          * Constructs a new instance of {@link Function}.
233          * @return new FunctionImpl()
234          */
235         public static Function newInstance()
236         {
237             return new FunctionImpl();
238         }
239 
240         /**
241          * Constructs a new instance of {@link Function}, taking all required and/or
242          * read-only properties as arguments, except for identifiers.
243          * @param functionNm String
244          * @param functionJavaFunctionClass String
245          * @param functionCreationDt Date
246          * @param updateDt Timestamp
247          * @return newInstance
248          */
249         public static Function newInstance(String functionNm, String functionJavaFunctionClass, Date functionCreationDt, Timestamp updateDt)
250         {
251             final Function entity = new FunctionImpl();
252             entity.setFunctionNm(functionNm);
253             entity.setFunctionJavaFunctionClass(functionJavaFunctionClass);
254             entity.setFunctionCreationDt(functionCreationDt);
255             entity.setUpdateDt(updateDt);
256             return entity;
257         }
258 
259         /**
260          * Constructs a new instance of {@link Function}, taking all possible properties
261          * (except the identifier(s))as arguments.
262          * @param functionNm String
263          * @param functionJavaFunctionClass String
264          * @param functionCreationDt Date
265          * @param updateDt Timestamp
266          * @param functionParameters Collection<FunctionParameter>
267          * @return newInstance Function
268          */
269         public static Function newInstance(String functionNm, String functionJavaFunctionClass, Date functionCreationDt, Timestamp updateDt, Collection<FunctionParameter> functionParameters)
270         {
271             final Function entity = new FunctionImpl();
272             entity.setFunctionNm(functionNm);
273             entity.setFunctionJavaFunctionClass(functionJavaFunctionClass);
274             entity.setFunctionCreationDt(functionCreationDt);
275             entity.setUpdateDt(updateDt);
276             entity.setFunctionParameters(functionParameters);
277             return entity;
278         }
279     }
280 
281     /**
282      * @see Comparable#compareTo
283      */
284     public int compareTo(Function o)
285     {
286         int cmp = 0;
287         if (this.getFunctionId() != null)
288         {
289             cmp = this.getFunctionId().compareTo(o.getFunctionId());
290         }
291         else
292         {
293             if (this.getFunctionNm() != null)
294             {
295                 cmp = (cmp != 0 ? cmp : this.getFunctionNm().compareTo(o.getFunctionNm()));
296             }
297             if (this.getFunctionJavaFunctionClass() != null)
298             {
299                 cmp = (cmp != 0 ? cmp : this.getFunctionJavaFunctionClass().compareTo(o.getFunctionJavaFunctionClass()));
300             }
301             if (this.getFunctionCreationDt() != null)
302             {
303                 cmp = (cmp != 0 ? cmp : this.getFunctionCreationDt().compareTo(o.getFunctionCreationDt()));
304             }
305             if (this.getUpdateDt() != null)
306             {
307                 cmp = (cmp != 0 ? cmp : this.getUpdateDt().compareTo(o.getUpdateDt()));
308             }
309         }
310         return cmp;
311     }
312 // HibernateEntity.vsl merge-point
313 // Function.java merge-point
314 }