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