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.administration.user; 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.administration.programStrategy.Program2Department; 032import fr.ifremer.adagio.core.dao.referential.Status; 033import java.io.Serializable; 034import java.sql.Timestamp; 035import java.util.Collection; 036import java.util.Date; 037import java.util.HashSet; 038 039/** 040 * Service d'appartenance d'une personne. 041 * Il peut s'agir des départements et service de l'Ifremer, ou bien des entreprises, services 042 * extérieurs (sous-traitants, etc.). 043 * REMARQUE : nous en aurons besoin en v2, pour l'administration des personnes (rechercher une 044 * personne, gérer les sous-traitants, etc.), mais aussi pour identifier le service effectuant 045 * l’analyse d’un résultat de mesure. 046 * Nombre de lignes : 60 047 */ 048// HibernateEntity.vsl annotations merge-point 049public abstract class Department 050 implements Serializable, Comparable<Department> 051{ 052 /** 053 * The serial version UID of this class. Needed for serialization. 054 */ 055 private static final long serialVersionUID = -8644185537302699620L; 056 057 // Generate 9 attributes 058 private Integer id; 059 060 /** 061 * Identifiant interne. généré par le système. 062 * @return this.id Integer 063 */ 064 public Integer getId() 065 { 066 return this.id; 067 } 068 069 /** 070 * Identifiant interne. généré par le système. 071 * @param idIn Integer 072 */ 073 public void setId(Integer idIn) 074 { 075 this.id = idIn; 076 } 077 078 private String code; 079 080 /** 081 * 082 * @return this.code String 083 */ 084 public String getCode() 085 { 086 return this.code; 087 } 088 089 /** 090 * 091 * @param codeIn String 092 */ 093 public void setCode(String codeIn) 094 { 095 this.code = codeIn; 096 } 097 098 private String name; 099 100 /** 101 * 102 * @return this.name String 103 */ 104 public String getName() 105 { 106 return this.name; 107 } 108 109 /** 110 * 111 * @param nameIn String 112 */ 113 public void setName(String nameIn) 114 { 115 this.name = nameIn; 116 } 117 118 private String email; 119 120 /** 121 * 122 * @return this.email String 123 */ 124 public String getEmail() 125 { 126 return this.email; 127 } 128 129 /** 130 * 131 * @param emailIn String 132 */ 133 public void setEmail(String emailIn) 134 { 135 this.email = emailIn; 136 } 137 138 private String address; 139 140 /** 141 * 142 * @return this.address String 143 */ 144 public String getAddress() 145 { 146 return this.address; 147 } 148 149 /** 150 * 151 * @param addressIn String 152 */ 153 public void setAddress(String addressIn) 154 { 155 this.address = addressIn; 156 } 157 158 private String phone; 159 160 /** 161 * 162 * @return this.phone String 163 */ 164 public String getPhone() 165 { 166 return this.phone; 167 } 168 169 /** 170 * 171 * @param phoneIn String 172 */ 173 public void setPhone(String phoneIn) 174 { 175 this.phone = phoneIn; 176 } 177 178 private Boolean isLdap; 179 180 /** 181 * 182 * @return this.isLdap Boolean 183 */ 184 public Boolean isIsLdap() 185 { 186 return this.isLdap; 187 } 188 189 /** 190 * 191 * @param isLdapIn Boolean 192 */ 193 public void setIsLdap(Boolean isLdapIn) 194 { 195 this.isLdap = isLdapIn; 196 } 197 198 private Date creationDate; 199 200 /** 201 * 202 * @return this.creationDate Date 203 */ 204 public Date getCreationDate() 205 { 206 return this.creationDate; 207 } 208 209 /** 210 * 211 * @param creationDateIn Date 212 */ 213 public void setCreationDate(Date creationDateIn) 214 { 215 this.creationDate = creationDateIn; 216 } 217 218 private Timestamp updateDate; 219 220 /** 221 * 222 * @return this.updateDate Timestamp 223 */ 224 public Timestamp getUpdateDate() 225 { 226 return this.updateDate; 227 } 228 229 /** 230 * 231 * @param updateDateIn Timestamp 232 */ 233 public void setUpdateDate(Timestamp updateDateIn) 234 { 235 this.updateDate = updateDateIn; 236 } 237 238 // Generate 34 associations 239 private Department parentDepartment; 240 241 /** 242 * Service d'appartenance d'une personne. 243 * Il peut s'agir des départements et service de l'Ifremer, ou bien des entreprises, services 244 * extérieurs (sous-traitants, etc.). 245 * REMARQUE : nous en aurons besoin en v2, pour l'administration des personnes (rechercher une 246 * personne, gérer les sous-traitants, etc.), mais aussi pour identifier le service effectuant 247 * l’analyse d’un résultat de mesure. 248 * Nombre de lignes : 60 249 * @return this.parentDepartment Department 250 */ 251 public Department getParentDepartment() 252 { 253 return this.parentDepartment; 254 } 255 256 /** 257 * Service d'appartenance d'une personne. 258 * Il peut s'agir des départements et service de l'Ifremer, ou bien des entreprises, services 259 * extérieurs (sous-traitants, etc.). 260 * REMARQUE : nous en aurons besoin en v2, pour l'administration des personnes (rechercher une 261 * personne, gérer les sous-traitants, etc.), mais aussi pour identifier le service effectuant 262 * l’analyse d’un résultat de mesure. 263 * Nombre de lignes : 60 264 * @param parentDepartmentIn Department 265 */ 266 public void setParentDepartment(Department parentDepartmentIn) 267 { 268 this.parentDepartment = parentDepartmentIn; 269 } 270 271 private Collection<Program2Department> program2Departments = new HashSet<Program2Department>(); 272 273 /** 274 * Liste des droits d''un service pour un programme particulier 275 * @return this.program2Departments Collection<Program2Department> 276 */ 277 public Collection<Program2Department> getProgram2Departments() 278 { 279 return this.program2Departments; 280 } 281 282 /** 283 * Liste des droits d''un service pour un programme particulier 284 * @param program2DepartmentsIn Collection<Program2Department> 285 */ 286 public void setProgram2Departments(Collection<Program2Department> program2DepartmentsIn) 287 { 288 this.program2Departments = program2DepartmentsIn; 289 } 290 291 /** 292 * Liste des droits d''un service pour un programme particulier 293 * @param elementToAdd Program2Department 294 * @return <tt>true</tt> if this collection changed as a result of the 295 * call 296 */ 297 public boolean addProgram2Departments(Program2Department elementToAdd) 298 { 299 return this.program2Departments.add(elementToAdd); 300 } 301 302 /** 303 * Liste des droits d''un service pour un programme particulier 304 * @param elementToRemove Program2Department 305 * @return <tt>true</tt> if this collection changed as a result of the 306 * call 307 */ 308 public boolean removeProgram2Departments(Program2Department elementToRemove) 309 { 310 return this.program2Departments.remove(elementToRemove); 311 } 312 313 private Collection<Department> departments = new HashSet<Department>(); 314 315 /** 316 * Service d'appartenance d'une personne. 317 * Il peut s'agir des départements et service de l'Ifremer, ou bien des entreprises, services 318 * extérieurs (sous-traitants, etc.). 319 * REMARQUE : nous en aurons besoin en v2, pour l'administration des personnes (rechercher une 320 * personne, gérer les sous-traitants, etc.), mais aussi pour identifier le service effectuant 321 * l’analyse d’un résultat de mesure. 322 * Nombre de lignes : 60 323 * @return this.departments Collection<Department> 324 */ 325 public Collection<Department> getDepartments() 326 { 327 return this.departments; 328 } 329 330 /** 331 * Service d'appartenance d'une personne. 332 * Il peut s'agir des départements et service de l'Ifremer, ou bien des entreprises, services 333 * extérieurs (sous-traitants, etc.). 334 * REMARQUE : nous en aurons besoin en v2, pour l'administration des personnes (rechercher une 335 * personne, gérer les sous-traitants, etc.), mais aussi pour identifier le service effectuant 336 * l’analyse d’un résultat de mesure. 337 * Nombre de lignes : 60 338 * @param departmentsIn Collection<Department> 339 */ 340 public void setDepartments(Collection<Department> departmentsIn) 341 { 342 this.departments = departmentsIn; 343 } 344 345 /** 346 * Service d'appartenance d'une personne. 347 * Il peut s'agir des départements et service de l'Ifremer, ou bien des entreprises, services 348 * extérieurs (sous-traitants, etc.). 349 * REMARQUE : nous en aurons besoin en v2, pour l'administration des personnes (rechercher une 350 * personne, gérer les sous-traitants, etc.), mais aussi pour identifier le service effectuant 351 * l’analyse d’un résultat de mesure. 352 * Nombre de lignes : 60 353 * @param elementToAdd Department 354 * @return <tt>true</tt> if this collection changed as a result of the 355 * call 356 */ 357 public boolean addDepartments(Department elementToAdd) 358 { 359 return this.departments.add(elementToAdd); 360 } 361 362 /** 363 * Service d'appartenance d'une personne. 364 * Il peut s'agir des départements et service de l'Ifremer, ou bien des entreprises, services 365 * extérieurs (sous-traitants, etc.). 366 * REMARQUE : nous en aurons besoin en v2, pour l'administration des personnes (rechercher une 367 * personne, gérer les sous-traitants, etc.), mais aussi pour identifier le service effectuant 368 * l’analyse d’un résultat de mesure. 369 * Nombre de lignes : 60 370 * @param elementToRemove Department 371 * @return <tt>true</tt> if this collection changed as a result of the 372 * call 373 */ 374 public boolean removeDepartments(Department elementToRemove) 375 { 376 return this.departments.remove(elementToRemove); 377 } 378 379 private Status status; 380 381 /** 382 * Pour les données du référentiel, information permettant de déterminer si une donnée est 383 * valide, 384 * obsolète ou temporaire. 385 * - obsolète (=inactif) : '0' 386 * - valide (=actif) : '1' 387 * - temporaire : '2' 388 * - en cours de suppression : '3' 389 * - : '4' 390 * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas 391 * confondre 392 * avec par exemple l'activité d'un navire sur un mois. 393 * @return this.status Status 394 */ 395 public Status getStatus() 396 { 397 return this.status; 398 } 399 400 /** 401 * Pour les données du référentiel, information permettant de déterminer si une donnée est 402 * valide, 403 * obsolète ou temporaire. 404 * - obsolète (=inactif) : '0' 405 * - valide (=actif) : '1' 406 * - temporaire : '2' 407 * - en cours de suppression : '3' 408 * - : '4' 409 * note : on a préfère ici 'valide' au terme 'actif' (utilisé dans Harmonie), pour ne pas 410 * confondre 411 * avec par exemple l'activité d'un navire sur un mois. 412 * @param statusIn Status 413 */ 414 public void setStatus(Status statusIn) 415 { 416 this.status = statusIn; 417 } 418 419 /** 420 * Returns <code>true</code> if the argument is an Department instance and all identifiers for this entity 421 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise. 422 */ 423 @Override 424 public boolean equals(Object object) 425 { 426 if (this == object) 427 { 428 return true; 429 } 430 if (!(object instanceof Department)) 431 { 432 return false; 433 } 434 final Department that = (Department)object; 435 if (this.id == null || that.getId() == null || !this.id.equals(that.getId())) 436 { 437 return false; 438 } 439 return true; 440 } 441 442 /** 443 * Returns a hash code based on this entity's identifiers. 444 */ 445 @Override 446 public int hashCode() 447 { 448 int hashCode = 0; 449 hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode()); 450 451 return hashCode; 452 } 453 454 /** 455 * Constructs new instances of {@link Department}. 456 */ 457 public static final class Factory 458 { 459 /** 460 * Constructs a new instance of {@link Department}. 461 * @return new DepartmentImpl() 462 */ 463 public static Department newInstance() 464 { 465 return new DepartmentImpl(); 466 } 467 468 /** 469 * Constructs a new instance of {@link Department}, taking all required and/or 470 * read-only properties as arguments, except for identifiers. 471 * @param code String 472 * @param name String 473 * @param isLdap Boolean 474 * @param creationDate Date 475 * @param updateDate Timestamp 476 * @param status Status 477 * @return newInstance 478 */ 479 public static Department newInstance(String code, String name, Boolean isLdap, Date creationDate, Timestamp updateDate, Status status) 480 { 481 final Department entity = new DepartmentImpl(); 482 entity.setCode(code); 483 entity.setName(name); 484 entity.setIsLdap(isLdap); 485 entity.setCreationDate(creationDate); 486 entity.setUpdateDate(updateDate); 487 entity.setStatus(status); 488 return entity; 489 } 490 491 /** 492 * Constructs a new instance of {@link Department}, taking all possible properties 493 * (except the identifier(s))as arguments. 494 * @param code String 495 * @param name String 496 * @param email String 497 * @param address String 498 * @param phone String 499 * @param isLdap Boolean 500 * @param creationDate Date 501 * @param updateDate Timestamp 502 * @param parentDepartment Department 503 * @param program2Departments Collection<Program2Department> 504 * @param departments Collection<Department> 505 * @param status Status 506 * @return newInstance Department 507 */ 508 public static Department newInstance(String code, String name, String email, String address, String phone, Boolean isLdap, Date creationDate, Timestamp updateDate, Department parentDepartment, Collection<Program2Department> program2Departments, Collection<Department> departments, Status status) 509 { 510 final Department entity = new DepartmentImpl(); 511 entity.setCode(code); 512 entity.setName(name); 513 entity.setEmail(email); 514 entity.setAddress(address); 515 entity.setPhone(phone); 516 entity.setIsLdap(isLdap); 517 entity.setCreationDate(creationDate); 518 entity.setUpdateDate(updateDate); 519 entity.setParentDepartment(parentDepartment); 520 entity.setProgram2Departments(program2Departments); 521 entity.setDepartments(departments); 522 entity.setStatus(status); 523 return entity; 524 } 525 } 526 527 /** 528 * @see Comparable#compareTo 529 */ 530 public int compareTo(Department o) 531 { 532 int cmp = 0; 533 if (this.getId() != null) 534 { 535 cmp = this.getId().compareTo(o.getId()); 536 } 537 else 538 { 539 if (this.getCode() != null) 540 { 541 cmp = (cmp != 0 ? cmp : this.getCode().compareTo(o.getCode())); 542 } 543 if (this.getName() != null) 544 { 545 cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName())); 546 } 547 if (this.getEmail() != null) 548 { 549 cmp = (cmp != 0 ? cmp : this.getEmail().compareTo(o.getEmail())); 550 } 551 if (this.getAddress() != null) 552 { 553 cmp = (cmp != 0 ? cmp : this.getAddress().compareTo(o.getAddress())); 554 } 555 if (this.getPhone() != null) 556 { 557 cmp = (cmp != 0 ? cmp : this.getPhone().compareTo(o.getPhone())); 558 } 559 if (this.isIsLdap() != null) 560 { 561 cmp = (cmp != 0 ? cmp : this.isIsLdap().compareTo(o.isIsLdap())); 562 } 563 if (this.getCreationDate() != null) 564 { 565 cmp = (cmp != 0 ? cmp : this.getCreationDate().compareTo(o.getCreationDate())); 566 } 567 if (this.getUpdateDate() != null) 568 { 569 cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate())); 570 } 571 } 572 return cmp; 573 } 574// HibernateEntity.vsl merge-point 575// Department.java merge-point 576}