001// license-header java merge-point 002// 003// Attention: Generated code! Do not modify by hand! 004// Generated by: hibernate/HibernateEntity.vsl in andromda-hibernate-cartridge. 005// 006package fr.ifremer.adagio.core.dao.referential.taxon; 007 008/* 009 * #%L 010 * SIH-Adagio :: Core 011 * $Id:$ 012 * $HeadURL:$ 013 * %% 014 * Copyright (C) 2012 - 2014 Ifremer 015 * %% 016 * This program is free software: you can redistribute it and/or modify 017 * it under the terms of the GNU Affero General Public License as published by 018 * the Free Software Foundation, either version 3 of the License, or 019 * (at your option) any later version. 020 * 021 * This program is distributed in the hope that it will be useful, 022 * but WITHOUT ANY WARRANTY; without even the implied warranty of 023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 024 * GNU General Public License for more details. 025 * 026 * You should have received a copy of the GNU Affero General Public License 027 * along with this program. If not, see <http://www.gnu.org/licenses/>. 028 * #L% 029 */ 030 031import fr.ifremer.adagio.core.dao.referential.Status; 032import java.io.Serializable; 033import java.sql.Timestamp; 034import java.util.Collection; 035import java.util.Date; 036import java.util.HashSet; 037 038/** 039 * Les documents de référence sont tous les documents qui peuvent apporter des informations 040 * relatives à la classification systématique des taxons (nomenclature, description, synonymie) ou à 041 * la définition des groupes de taxons. Ces documents peuvent être des publications officielles 042 * (articles de revues ou ouvrage), ou bien des notes de laboratoire, rapports internes, etc. 043 * Dans le cas des publications, la référence du document permet de retrouver les sources. En 044 * revanche, pour les notes de labo, documents internes, et autres, il faudra préciser dans la 045 * référence la localisation de la source (quel service ou quel labo, quelle personne de référence 046 * pour se le procurer). 047 * Les références des publications doivent respecter les règles d'édition des bibliographies 048 * (Auteurs, date. Titre. Editeur...). 049 */ 050// HibernateEntity.vsl annotations merge-point 051public abstract class ReferenceDocument 052 implements Serializable, Comparable<ReferenceDocument> 053{ 054 /** 055 * The serial version UID of this class. Needed for serialization. 056 */ 057 private static final long serialVersionUID = -1529010323374173007L; 058 059 // Generate 6 attributes 060 private Integer id; 061 062 /** 063 * Identifiant unique du document. Généré par le système. 064 * @return this.id Integer 065 */ 066 public Integer getId() 067 { 068 return this.id; 069 } 070 071 /** 072 * Identifiant unique du document. Généré par le système. 073 * @param idIn Integer 074 */ 075 public void setId(Integer idIn) 076 { 077 this.id = idIn; 078 } 079 080 private String reference; 081 082 /** 083 * Libellé stockant la référence du document. Ceci peut être le nom, l'édition etc. 084 * @return this.reference String 085 */ 086 public String getReference() 087 { 088 return this.reference; 089 } 090 091 /** 092 * Libellé stockant la référence du document. Ceci peut être le nom, l'édition etc. 093 * @param referenceIn String 094 */ 095 public void setReference(String referenceIn) 096 { 097 this.reference = referenceIn; 098 } 099 100 private Date publicationDate; 101 102 /** 103 * Date de parution du document. 104 * @return this.publicationDate Date 105 */ 106 public Date getPublicationDate() 107 { 108 return this.publicationDate; 109 } 110 111 /** 112 * Date de parution du document. 113 * @param publicationDateIn Date 114 */ 115 public void setPublicationDate(Date publicationDateIn) 116 { 117 this.publicationDate = publicationDateIn; 118 } 119 120 private String comments; 121 122 /** 123 * Commentaires divers associés au document de référence. 124 * @return this.comments String 125 */ 126 public String getComments() 127 { 128 return this.comments; 129 } 130 131 /** 132 * Commentaires divers associés au document de référence. 133 * @param commentsIn String 134 */ 135 public void setComments(String commentsIn) 136 { 137 this.comments = commentsIn; 138 } 139 140 private Date creationDate; 141 142 /** 143 * Date de création système du document de référence. Renseigné automatiquement par le système. 144 * @return this.creationDate Date 145 */ 146 public Date getCreationDate() 147 { 148 return this.creationDate; 149 } 150 151 /** 152 * Date de création système du document de référence. Renseigné automatiquement par le système. 153 * @param creationDateIn Date 154 */ 155 public void setCreationDate(Date creationDateIn) 156 { 157 this.creationDate = creationDateIn; 158 } 159 160 private Timestamp updateDate; 161 162 /** 163 * Date de mise à jour système de la référence. Renseigné automatiquement par le système. 164 * @return this.updateDate Timestamp 165 */ 166 public Timestamp getUpdateDate() 167 { 168 return this.updateDate; 169 } 170 171 /** 172 * Date de mise à jour système de la référence. Renseigné automatiquement par le système. 173 * @param updateDateIn Timestamp 174 */ 175 public void setUpdateDate(Timestamp updateDateIn) 176 { 177 this.updateDate = updateDateIn; 178 } 179 180 // Generate 5 associations 181 private Collection<Author> authors = new HashSet<Author>(); 182 183 /** 184 * Sont considérés comme auteurs les scientifiques qui sont à l'origine de la description (et 185 * par là 186 * même de la nomenclature et de la position systématique) des taxons, quel que soit leur niveau 187 * (famille, genre, espèce ...). 188 * @return this.authors Collection<Author> 189 */ 190 public Collection<Author> getAuthors() 191 { 192 return this.authors; 193 } 194 195 /** 196 * Sont considérés comme auteurs les scientifiques qui sont à l'origine de la description (et 197 * par là 198 * même de la nomenclature et de la position systématique) des taxons, quel que soit leur niveau 199 * (famille, genre, espèce ...). 200 * @param authorsIn Collection<Author> 201 */ 202 public void setAuthors(Collection<Author> authorsIn) 203 { 204 this.authors = authorsIn; 205 } 206 207 /** 208 * Sont considérés comme auteurs les scientifiques qui sont à l'origine de la description (et 209 * par là 210 * même de la nomenclature et de la position systématique) des taxons, quel que soit leur niveau 211 * (famille, genre, espèce ...). 212 * @param elementToAdd Author 213 * @return <tt>true</tt> if this collection changed as a result of the 214 * call 215 */ 216 public boolean addAuthors(Author elementToAdd) 217 { 218 return this.authors.add(elementToAdd); 219 } 220 221 /** 222 * Sont considérés comme auteurs les scientifiques qui sont à l'origine de la description (et 223 * par là 224 * même de la nomenclature et de la position systématique) des taxons, quel que soit leur niveau 225 * (famille, genre, espèce ...). 226 * @param elementToRemove Author 227 * @return <tt>true</tt> if this collection changed as a result of the 228 * call 229 */ 230 public boolean removeAuthors(Author elementToRemove) 231 { 232 return this.authors.remove(elementToRemove); 233 } 234 235 private Collection<TaxonInformationHistory> taxonInformationHistories = new HashSet<TaxonInformationHistory>(); 236 237 /** 238 * 239 * @return this.taxonInformationHistories Collection<TaxonInformationHistory> 240 */ 241 public Collection<TaxonInformationHistory> getTaxonInformationHistories() 242 { 243 return this.taxonInformationHistories; 244 } 245 246 /** 247 * 248 * @param taxonInformationHistoriesIn Collection<TaxonInformationHistory> 249 */ 250 public void setTaxonInformationHistories(Collection<TaxonInformationHistory> taxonInformationHistoriesIn) 251 { 252 this.taxonInformationHistories = taxonInformationHistoriesIn; 253 } 254 255 /** 256 * 257 * @param elementToAdd TaxonInformationHistory 258 * @return <tt>true</tt> if this collection changed as a result of the 259 * call 260 */ 261 public boolean addTaxonInformationHistories(TaxonInformationHistory elementToAdd) 262 { 263 return this.taxonInformationHistories.add(elementToAdd); 264 } 265 266 /** 267 * 268 * @param elementToRemove TaxonInformationHistory 269 * @return <tt>true</tt> if this collection changed as a result of the 270 * call 271 */ 272 public boolean removeTaxonInformationHistories(TaxonInformationHistory elementToRemove) 273 { 274 return this.taxonInformationHistories.remove(elementToRemove); 275 } 276 277 private Status status; 278 279 /** 280 * Pour les données du référentiel, information permettant de déterminer si une donnée est 281 * valide, 282 * obsolète ou temporaire. 283 * - obsolète (=inactif) : '0' 284 * - valide (=actif) : '1' 285 * - temporaire : '2' 286 * - en cours de suppression : '3' 287 * - : '4' 288 * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas 289 * confondre 290 * avec par exemple l'activité d'un navire sur un mois. 291 * @return this.status Status 292 */ 293 public Status getStatus() 294 { 295 return this.status; 296 } 297 298 /** 299 * Pour les données du référentiel, information permettant de déterminer si une donnée est 300 * valide, 301 * obsolète ou temporaire. 302 * - obsolète (=inactif) : '0' 303 * - valide (=actif) : '1' 304 * - temporaire : '2' 305 * - en cours de suppression : '3' 306 * - : '4' 307 * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas 308 * confondre 309 * avec par exemple l'activité d'un navire sur un mois. 310 * @param statusIn Status 311 */ 312 public void setStatus(Status statusIn) 313 { 314 this.status = statusIn; 315 } 316 317 /** 318 * Returns <code>true</code> if the argument is an ReferenceDocument instance and all identifiers for this entity 319 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise. 320 */ 321 @Override 322 public boolean equals(Object object) 323 { 324 if (this == object) 325 { 326 return true; 327 } 328 if (!(object instanceof ReferenceDocument)) 329 { 330 return false; 331 } 332 final ReferenceDocument that = (ReferenceDocument)object; 333 if (this.id == null || that.getId() == null || !this.id.equals(that.getId())) 334 { 335 return false; 336 } 337 return true; 338 } 339 340 /** 341 * Returns a hash code based on this entity's identifiers. 342 */ 343 @Override 344 public int hashCode() 345 { 346 int hashCode = 0; 347 hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode()); 348 349 return hashCode; 350 } 351 352 /** 353 * Constructs new instances of {@link ReferenceDocument}. 354 */ 355 public static final class Factory 356 { 357 /** 358 * Constructs a new instance of {@link ReferenceDocument}. 359 * @return new ReferenceDocumentImpl() 360 */ 361 public static ReferenceDocument newInstance() 362 { 363 return new ReferenceDocumentImpl(); 364 } 365 366 /** 367 * Constructs a new instance of {@link ReferenceDocument}, taking all required and/or 368 * read-only properties as arguments, except for identifiers. 369 * @param reference String 370 * @param creationDate Date 371 * @param updateDate Timestamp 372 * @param authors Collection<Author> 373 * @param status Status 374 * @return newInstance 375 */ 376 public static ReferenceDocument newInstance(String reference, Date creationDate, Timestamp updateDate, Collection<Author> authors, Status status) 377 { 378 final ReferenceDocument entity = new ReferenceDocumentImpl(); 379 entity.setReference(reference); 380 entity.setCreationDate(creationDate); 381 entity.setUpdateDate(updateDate); 382 entity.setAuthors(authors); 383 entity.setStatus(status); 384 return entity; 385 } 386 387 /** 388 * Constructs a new instance of {@link ReferenceDocument}, taking all possible properties 389 * (except the identifier(s))as arguments. 390 * @param reference String 391 * @param publicationDate Date 392 * @param comments String 393 * @param creationDate Date 394 * @param updateDate Timestamp 395 * @param authors Collection<Author> 396 * @param taxonInformationHistories Collection<TaxonInformationHistory> 397 * @param status Status 398 * @return newInstance ReferenceDocument 399 */ 400 public static ReferenceDocument newInstance(String reference, Date publicationDate, String comments, Date creationDate, Timestamp updateDate, Collection<Author> authors, Collection<TaxonInformationHistory> taxonInformationHistories, Status status) 401 { 402 final ReferenceDocument entity = new ReferenceDocumentImpl(); 403 entity.setReference(reference); 404 entity.setPublicationDate(publicationDate); 405 entity.setComments(comments); 406 entity.setCreationDate(creationDate); 407 entity.setUpdateDate(updateDate); 408 entity.setAuthors(authors); 409 entity.setTaxonInformationHistories(taxonInformationHistories); 410 entity.setStatus(status); 411 return entity; 412 } 413 } 414 415 /** 416 * @see Comparable#compareTo 417 */ 418 public int compareTo(ReferenceDocument o) 419 { 420 int cmp = 0; 421 if (this.getId() != null) 422 { 423 cmp = this.getId().compareTo(o.getId()); 424 } 425 else 426 { 427 if (this.getReference() != null) 428 { 429 cmp = (cmp != 0 ? cmp : this.getReference().compareTo(o.getReference())); 430 } 431 if (this.getPublicationDate() != null) 432 { 433 cmp = (cmp != 0 ? cmp : this.getPublicationDate().compareTo(o.getPublicationDate())); 434 } 435 if (this.getComments() != null) 436 { 437 cmp = (cmp != 0 ? cmp : this.getComments().compareTo(o.getComments())); 438 } 439 if (this.getCreationDate() != null) 440 { 441 cmp = (cmp != 0 ? cmp : this.getCreationDate().compareTo(o.getCreationDate())); 442 } 443 if (this.getUpdateDate() != null) 444 { 445 cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate())); 446 } 447 } 448 return cmp; 449 } 450// HibernateEntity.vsl merge-point 451// ReferenceDocument.java merge-point 452}