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