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.taxon;
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 * Contient les différentes sources (origines) des codes alternatifs des taxons (autres systèmes,
36 * référentiels...)
37 */
38 // HibernateEntity.vsl annotations merge-point
39 public abstract class AlternativeTaxonOrigin
40 implements Serializable, Comparable<AlternativeTaxonOrigin>
41 {
42 /**
43 * The serial version UID of this class. Needed for serialization.
44 */
45 private static final long serialVersionUID = -1398839530128379897L;
46
47 // Generate 4 attributes
48 private String alternTaxonOriginCd;
49
50 /**
51 * Code de l'origine des codes alternatifs des taxons
52 * @return this.alternTaxonOriginCd String
53 */
54 public String getAlternTaxonOriginCd()
55 {
56 return this.alternTaxonOriginCd;
57 }
58
59 /**
60 * Code de l'origine des codes alternatifs des taxons
61 * @param alternTaxonOriginCdIn String
62 */
63 public void setAlternTaxonOriginCd(String alternTaxonOriginCdIn)
64 {
65 this.alternTaxonOriginCd = alternTaxonOriginCdIn;
66 }
67
68 private String alternTaxonOriginNm;
69
70 /**
71 * Libellé de l'origine des codes alternatifs des taxons
72 * @return this.alternTaxonOriginNm String
73 */
74 public String getAlternTaxonOriginNm()
75 {
76 return this.alternTaxonOriginNm;
77 }
78
79 /**
80 * Libellé de l'origine des codes alternatifs des taxons
81 * @param alternTaxonOriginNmIn String
82 */
83 public void setAlternTaxonOriginNm(String alternTaxonOriginNmIn)
84 {
85 this.alternTaxonOriginNm = alternTaxonOriginNmIn;
86 }
87
88 private String alternTaxonOriginCm;
89
90 /**
91 * Commentaire sur l'origine des codes alternatifs des taxons
92 * @return this.alternTaxonOriginCm String
93 */
94 public String getAlternTaxonOriginCm()
95 {
96 return this.alternTaxonOriginCm;
97 }
98
99 /**
100 * Commentaire sur l'origine des codes alternatifs des taxons
101 * @param alternTaxonOriginCmIn String
102 */
103 public void setAlternTaxonOriginCm(String alternTaxonOriginCmIn)
104 {
105 this.alternTaxonOriginCm = alternTaxonOriginCmIn;
106 }
107
108 private Timestamp updateDt;
109
110 /**
111 * Date de mise à jour de l'objet
112 * @return this.updateDt Timestamp
113 */
114 public Timestamp getUpdateDt()
115 {
116 return this.updateDt;
117 }
118
119 /**
120 * Date de mise à jour de l'objet
121 * @param updateDtIn Timestamp
122 */
123 public void setUpdateDt(Timestamp updateDtIn)
124 {
125 this.updateDt = updateDtIn;
126 }
127
128 // Generate 1 associations
129 private Collection<AlternativeTaxon> alternativeTaxons = new HashSet<AlternativeTaxon>();
130
131 /**
132 * Contient les correspondances entre les taxons du système et les codes alternatifs des taxons
133 * provenant d'autres sources (autres systèmes, référentiels...)
134 * @return this.alternativeTaxons Collection<AlternativeTaxon>
135 */
136 public Collection<AlternativeTaxon> getAlternativeTaxons()
137 {
138 return this.alternativeTaxons;
139 }
140
141 /**
142 * Contient les correspondances entre les taxons du système et les codes alternatifs des taxons
143 * provenant d'autres sources (autres systèmes, référentiels...)
144 * @param alternativeTaxonsIn Collection<AlternativeTaxon>
145 */
146 public void setAlternativeTaxons(Collection<AlternativeTaxon> alternativeTaxonsIn)
147 {
148 this.alternativeTaxons = alternativeTaxonsIn;
149 }
150
151 /**
152 * Contient les correspondances entre les taxons du système et les codes alternatifs des taxons
153 * provenant d'autres sources (autres systèmes, référentiels...)
154 * @param elementToAdd AlternativeTaxon
155 * @return <tt>true</tt> if this collection changed as a result of the
156 * call
157 */
158 public boolean addAlternativeTaxons(AlternativeTaxon elementToAdd)
159 {
160 return this.alternativeTaxons.add(elementToAdd);
161 }
162
163 /**
164 * Contient les correspondances entre les taxons du système et les codes alternatifs des taxons
165 * provenant d'autres sources (autres systèmes, référentiels...)
166 * @param elementToRemove AlternativeTaxon
167 * @return <tt>true</tt> if this collection changed as a result of the
168 * call
169 */
170 public boolean removeAlternativeTaxons(AlternativeTaxon elementToRemove)
171 {
172 return this.alternativeTaxons.remove(elementToRemove);
173 }
174
175 /**
176 * Returns <code>true</code> if the argument is an AlternativeTaxonOrigin instance and all identifiers for this entity
177 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise.
178 */
179 @Override
180 public boolean equals(Object object)
181 {
182 if (this == object)
183 {
184 return true;
185 }
186 if (!(object instanceof AlternativeTaxonOrigin))
187 {
188 return false;
189 }
190 final AlternativeTaxonOrigin that = (AlternativeTaxonOrigin)object;
191 if (this.alternTaxonOriginCd == null || that.getAlternTaxonOriginCd() == null || !this.alternTaxonOriginCd.equals(that.getAlternTaxonOriginCd()))
192 {
193 return false;
194 }
195 return true;
196 }
197
198 /**
199 * Returns a hash code based on this entity's identifiers.
200 */
201 @Override
202 public int hashCode()
203 {
204 int hashCode = 0;
205 hashCode = 29 * hashCode + (this.alternTaxonOriginCd == null ? 0 : this.alternTaxonOriginCd.hashCode());
206
207 return hashCode;
208 }
209
210 /**
211 * Constructs new instances of {@link AlternativeTaxonOrigin}.
212 */
213 public static final class Factory
214 {
215 /**
216 * Constructs a new instance of {@link AlternativeTaxonOrigin}.
217 * @return new AlternativeTaxonOriginImpl()
218 */
219 public static AlternativeTaxonOrigin newInstance()
220 {
221 return new AlternativeTaxonOriginImpl();
222 }
223
224 /**
225 * Constructs a new instance of {@link AlternativeTaxonOrigin}, taking all required and/or
226 * read-only properties as arguments, except for identifiers.
227 * @param alternTaxonOriginNm String
228 * @param updateDt Timestamp
229 * @return newInstance
230 */
231 public static AlternativeTaxonOrigin newInstance(String alternTaxonOriginNm, Timestamp updateDt)
232 {
233 final AlternativeTaxonOrigin entity = new AlternativeTaxonOriginImpl();
234 entity.setAlternTaxonOriginNm(alternTaxonOriginNm);
235 entity.setUpdateDt(updateDt);
236 return entity;
237 }
238
239 /**
240 * Constructs a new instance of {@link AlternativeTaxonOrigin}, taking all possible properties
241 * (except the identifier(s))as arguments.
242 * @param alternTaxonOriginNm String
243 * @param alternTaxonOriginCm String
244 * @param updateDt Timestamp
245 * @param alternativeTaxons Collection<AlternativeTaxon>
246 * @return newInstance AlternativeTaxonOrigin
247 */
248 public static AlternativeTaxonOrigin newInstance(String alternTaxonOriginNm, String alternTaxonOriginCm, Timestamp updateDt, Collection<AlternativeTaxon> alternativeTaxons)
249 {
250 final AlternativeTaxonOrigin entity = new AlternativeTaxonOriginImpl();
251 entity.setAlternTaxonOriginNm(alternTaxonOriginNm);
252 entity.setAlternTaxonOriginCm(alternTaxonOriginCm);
253 entity.setUpdateDt(updateDt);
254 entity.setAlternativeTaxons(alternativeTaxons);
255 return entity;
256 }
257 }
258
259 /**
260 * @see Comparable#compareTo
261 */
262 public int compareTo(AlternativeTaxonOrigin o)
263 {
264 int cmp = 0;
265 if (this.getAlternTaxonOriginCd() != null)
266 {
267 cmp = this.getAlternTaxonOriginCd().compareTo(o.getAlternTaxonOriginCd());
268 }
269 else
270 {
271 if (this.getAlternTaxonOriginNm() != null)
272 {
273 cmp = (cmp != 0 ? cmp : this.getAlternTaxonOriginNm().compareTo(o.getAlternTaxonOriginNm()));
274 }
275 if (this.getAlternTaxonOriginCm() != null)
276 {
277 cmp = (cmp != 0 ? cmp : this.getAlternTaxonOriginCm().compareTo(o.getAlternTaxonOriginCm()));
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 // AlternativeTaxonOrigin.java merge-point
288 }