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.grouping; 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.pmfm.Pmfm; 032import java.io.Serializable; 033import java.sql.Timestamp; 034import java.util.Collection; 035import java.util.HashSet; 036 037/** 038 * <html> 039 * <head> 040 * <style> 041 * p {padding:0px; margin:0px;} 042 * </style> 043 * </head> 044 * <body> 045 * <p> 046 * Niveau de regroupement, d'une classification donnée. 047 * </p> 048 * <p> 049 * </p> 050 * <p> 051 * Exemple : pour les métiers, on peut avoir les niveaux de regroupement 052 * suivants : arts, grandes familles d’engins, … 053 * </p> 054 * <p> 055 * </p> 056 * <p> 057 * Un niveau de regroupement peut avoir un niveau parent. 058 * </p> 059 * <p> 060 * </p> 061 * <p> 062 * Un niveau de regroupement contient un ou plusieurs regroupements (<i>Grouping</i>). 063 * </p> 064 * </body> 065 * </html> 066 */ 067// HibernateEntity.vsl annotations merge-point 068public abstract class GroupingLevel 069 implements Serializable, Comparable<GroupingLevel> 070{ 071 /** 072 * The serial version UID of this class. Needed for serialization. 073 */ 074 private static final long serialVersionUID = 7370660109053024001L; 075 076 // Generate 6 attributes 077 private Integer id; 078 079 /** 080 * Identifiant interne. Généré par le système. 081 * @return this.id Integer 082 */ 083 public Integer getId() 084 { 085 return this.id; 086 } 087 088 /** 089 * Identifiant interne. Généré par le système. 090 * @param idIn Integer 091 */ 092 public void setId(Integer idIn) 093 { 094 this.id = idIn; 095 } 096 097 private String label; 098 099 /** 100 * 101 * @return this.label String 102 */ 103 public String getLabel() 104 { 105 return this.label; 106 } 107 108 /** 109 * 110 * @param labelIn String 111 */ 112 public void setLabel(String labelIn) 113 { 114 this.label = labelIn; 115 } 116 117 private String name; 118 119 /** 120 * 121 * @return this.name String 122 */ 123 public String getName() 124 { 125 return this.name; 126 } 127 128 /** 129 * 130 * @param nameIn String 131 */ 132 public void setName(String nameIn) 133 { 134 this.name = nameIn; 135 } 136 137 private String description; 138 139 /** 140 * 141 * @return this.description String 142 */ 143 public String getDescription() 144 { 145 return this.description; 146 } 147 148 /** 149 * 150 * @param descriptionIn String 151 */ 152 public void setDescription(String descriptionIn) 153 { 154 this.description = descriptionIn; 155 } 156 157 private String comments; 158 159 /** 160 * 161 * @return this.comments String 162 */ 163 public String getComments() 164 { 165 return this.comments; 166 } 167 168 /** 169 * 170 * @param commentsIn String 171 */ 172 public void setComments(String commentsIn) 173 { 174 this.comments = commentsIn; 175 } 176 177 private Timestamp updateDate; 178 179 /** 180 * 181 * @return this.updateDate Timestamp 182 */ 183 public Timestamp getUpdateDate() 184 { 185 return this.updateDate; 186 } 187 188 /** 189 * 190 * @param updateDateIn Timestamp 191 */ 192 public void setUpdateDate(Timestamp updateDateIn) 193 { 194 this.updateDate = updateDateIn; 195 } 196 197 // Generate 5 associations 198 private GroupingLevel parentGroupingLevel; 199 200 /** 201 * Le niveau de regroupement parent (optionnel). 202 * @return this.parentGroupingLevel GroupingLevel 203 */ 204 public GroupingLevel getParentGroupingLevel() 205 { 206 return this.parentGroupingLevel; 207 } 208 209 /** 210 * Le niveau de regroupement parent (optionnel). 211 * @param parentGroupingLevelIn GroupingLevel 212 */ 213 public void setParentGroupingLevel(GroupingLevel parentGroupingLevelIn) 214 { 215 this.parentGroupingLevel = parentGroupingLevelIn; 216 } 217 218 private Collection<Grouping> groupings = new HashSet<Grouping>(); 219 220 /** 221 * <html> 222 * <head> 223 * <style> 224 * p {padding:0px; margin:0px;} 225 * </style> 226 * </head> 227 * <body> 228 * <p> 229 * Un regroupement représente un groupement d'entités (du référentiel ou 230 * bien de navires), correspondant à un niveau de regroupement donné (<i>GroupingLevel</i>). 231 * </p> 232 * <p> 233 * </p> 234 * <p> 235 * Un regroupement peut faire référence à une ou plusieurs entités du 236 * référentiel (<i>GroupingItem</i>). Généralement, surtout les 237 * regroupements de plus bas niveau sont liés à des entités du référentiel 238 * (plus facile à maintenir), puis une table technique remplie toutes les 239 * associations possible avec les ancêtres (cf <i>GroupingItemHierarchy</i>). 240 * </p> 241 * <p> 242 * </p> 243 * <p> 244 * Un regroupement peut avoir un regroupement parent. 245 * </p> 246 * </body> 247 * </html> 248 * @return this.groupings Collection<Grouping> 249 */ 250 public Collection<Grouping> getGroupings() 251 { 252 return this.groupings; 253 } 254 255 /** 256 * <html> 257 * <head> 258 * <style> 259 * p {padding:0px; margin:0px;} 260 * </style> 261 * </head> 262 * <body> 263 * <p> 264 * Un regroupement représente un groupement d'entités (du référentiel ou 265 * bien de navires), correspondant à un niveau de regroupement donné (<i>GroupingLevel</i>). 266 * </p> 267 * <p> 268 * </p> 269 * <p> 270 * Un regroupement peut faire référence à une ou plusieurs entités du 271 * référentiel (<i>GroupingItem</i>). Généralement, surtout les 272 * regroupements de plus bas niveau sont liés à des entités du référentiel 273 * (plus facile à maintenir), puis une table technique remplie toutes les 274 * associations possible avec les ancêtres (cf <i>GroupingItemHierarchy</i>). 275 * </p> 276 * <p> 277 * </p> 278 * <p> 279 * Un regroupement peut avoir un regroupement parent. 280 * </p> 281 * </body> 282 * </html> 283 * @param groupingsIn Collection<Grouping> 284 */ 285 public void setGroupings(Collection<Grouping> groupingsIn) 286 { 287 this.groupings = groupingsIn; 288 } 289 290 /** 291 * <html> 292 * <head> 293 * <style> 294 * p {padding:0px; margin:0px;} 295 * </style> 296 * </head> 297 * <body> 298 * <p> 299 * Un regroupement représente un groupement d'entités (du référentiel ou 300 * bien de navires), correspondant à un niveau de regroupement donné (<i>GroupingLevel</i>). 301 * </p> 302 * <p> 303 * </p> 304 * <p> 305 * Un regroupement peut faire référence à une ou plusieurs entités du 306 * référentiel (<i>GroupingItem</i>). Généralement, surtout les 307 * regroupements de plus bas niveau sont liés à des entités du référentiel 308 * (plus facile à maintenir), puis une table technique remplie toutes les 309 * associations possible avec les ancêtres (cf <i>GroupingItemHierarchy</i>). 310 * </p> 311 * <p> 312 * </p> 313 * <p> 314 * Un regroupement peut avoir un regroupement parent. 315 * </p> 316 * </body> 317 * </html> 318 * @param elementToAdd Grouping 319 * @return <tt>true</tt> if this collection changed as a result of the 320 * call 321 */ 322 public boolean addGroupings(Grouping elementToAdd) 323 { 324 return this.groupings.add(elementToAdd); 325 } 326 327 /** 328 * <html> 329 * <head> 330 * <style> 331 * p {padding:0px; margin:0px;} 332 * </style> 333 * </head> 334 * <body> 335 * <p> 336 * Un regroupement représente un groupement d'entités (du référentiel ou 337 * bien de navires), correspondant à un niveau de regroupement donné (<i>GroupingLevel</i>). 338 * </p> 339 * <p> 340 * </p> 341 * <p> 342 * Un regroupement peut faire référence à une ou plusieurs entités du 343 * référentiel (<i>GroupingItem</i>). Généralement, surtout les 344 * regroupements de plus bas niveau sont liés à des entités du référentiel 345 * (plus facile à maintenir), puis une table technique remplie toutes les 346 * associations possible avec les ancêtres (cf <i>GroupingItemHierarchy</i>). 347 * </p> 348 * <p> 349 * </p> 350 * <p> 351 * Un regroupement peut avoir un regroupement parent. 352 * </p> 353 * </body> 354 * </html> 355 * @param elementToRemove Grouping 356 * @return <tt>true</tt> if this collection changed as a result of the 357 * call 358 */ 359 public boolean removeGroupings(Grouping elementToRemove) 360 { 361 return this.groupings.remove(elementToRemove); 362 } 363 364 private Pmfm pmfm; 365 366 /** 367 * <html> 368 * <head> 369 * <style> 370 * p {padding:0px; margin:0px;} 371 * </style> 372 * </head> 373 * <body> 374 * <p> 375 * Caractéristique définissant le niveau de regroupement (optionnel). 376 * </p> 377 * <p> 378 * Permet un accès au <i>GroupingLevel</i> via requete sur les PSFM, 379 * plutot que par les identifiants ou libellés des <i>GroupingLevel</i>. 380 * </p> 381 * <p> 382 * </p> 383 * <p> 384 * Par exemple : 385 * </p> 386 * <p> 387 * - Longueur d'un navire, 388 * </p> 389 * <p> 390 * - Jauge d'un navire, 391 * </p> 392 * <p> 393 * - etc. 394 * </p> 395 * </body> 396 * </html> 397 * @return this.pmfm Pmfm 398 */ 399 public Pmfm getPmfm() 400 { 401 return this.pmfm; 402 } 403 404 /** 405 * <html> 406 * <head> 407 * <style> 408 * p {padding:0px; margin:0px;} 409 * </style> 410 * </head> 411 * <body> 412 * <p> 413 * Caractéristique définissant le niveau de regroupement (optionnel). 414 * </p> 415 * <p> 416 * Permet un accès au <i>GroupingLevel</i> via requete sur les PSFM, 417 * plutot que par les identifiants ou libellés des <i>GroupingLevel</i>. 418 * </p> 419 * <p> 420 * </p> 421 * <p> 422 * Par exemple : 423 * </p> 424 * <p> 425 * - Longueur d'un navire, 426 * </p> 427 * <p> 428 * - Jauge d'un navire, 429 * </p> 430 * <p> 431 * - etc. 432 * </p> 433 * </body> 434 * </html> 435 * @param pmfmIn Pmfm 436 */ 437 public void setPmfm(Pmfm pmfmIn) 438 { 439 this.pmfm = pmfmIn; 440 } 441 442 private GroupingClassification groupingClassification; 443 444 /** 445 * <html> 446 * <head> 447 * <style> 448 * p {padding:0px; margin:0px;} 449 * </style> 450 * </head> 451 * <body> 452 * <p> 453 * Une classification de regroupement ne traite que d’un seul type de 454 * données du référentiel à la fois (<i>ObjectType</i>). 455 * Il peut s’agir de regroupement sur les métiers, les lieux, les espèces, 456 * etc. 457 * </p> 458 * <p> 459 * En revanche, un même type de données du référentiel (ex : Métier) peut 460 * avoir plusieurs classification de regroupement distinctes (DCR, Ifremer, 461 * Natura 2000, …) 462 * </p> 463 * <p> 464 * </p> 465 * <p> 466 * Une classification de regroupement peut contenir un ou plusieurs niveaux 467 * de regroupement (<i>GroupingLevel</i>). 468 * </p> 469 * </body> 470 * </html> 471 * @return this.groupingClassification GroupingClassification 472 */ 473 public GroupingClassification getGroupingClassification() 474 { 475 return this.groupingClassification; 476 } 477 478 /** 479 * <html> 480 * <head> 481 * <style> 482 * p {padding:0px; margin:0px;} 483 * </style> 484 * </head> 485 * <body> 486 * <p> 487 * Une classification de regroupement ne traite que d’un seul type de 488 * données du référentiel à la fois (<i>ObjectType</i>). 489 * Il peut s’agir de regroupement sur les métiers, les lieux, les espèces, 490 * etc. 491 * </p> 492 * <p> 493 * En revanche, un même type de données du référentiel (ex : Métier) peut 494 * avoir plusieurs classification de regroupement distinctes (DCR, Ifremer, 495 * Natura 2000, …) 496 * </p> 497 * <p> 498 * </p> 499 * <p> 500 * Une classification de regroupement peut contenir un ou plusieurs niveaux 501 * de regroupement (<i>GroupingLevel</i>). 502 * </p> 503 * </body> 504 * </html> 505 * @param groupingClassificationIn GroupingClassification 506 */ 507 public void setGroupingClassification(GroupingClassification groupingClassificationIn) 508 { 509 this.groupingClassification = groupingClassificationIn; 510 } 511 512 private Collection<GroupingLevel> groupingLevels = new HashSet<GroupingLevel>(); 513 514 /** 515 * <html> 516 * <head> 517 * <style> 518 * p {padding:0px; margin:0px;} 519 * </style> 520 * </head> 521 * <body> 522 * <p> 523 * Niveau de regroupement, d'une classification donnée. 524 * </p> 525 * <p> 526 * </p> 527 * <p> 528 * Exemple : pour les métiers, on peut avoir les niveaux de regroupement 529 * suivants : arts, grandes familles d’engins, … 530 * </p> 531 * <p> 532 * </p> 533 * <p> 534 * Un niveau de regroupement peut avoir un niveau parent. 535 * </p> 536 * <p> 537 * </p> 538 * <p> 539 * Un niveau de regroupement contient un ou plusieurs regroupements (<i>Grouping</i>). 540 * </p> 541 * </body> 542 * </html> 543 * @return this.groupingLevels Collection<GroupingLevel> 544 */ 545 public Collection<GroupingLevel> getGroupingLevels() 546 { 547 return this.groupingLevels; 548 } 549 550 /** 551 * <html> 552 * <head> 553 * <style> 554 * p {padding:0px; margin:0px;} 555 * </style> 556 * </head> 557 * <body> 558 * <p> 559 * Niveau de regroupement, d'une classification donnée. 560 * </p> 561 * <p> 562 * </p> 563 * <p> 564 * Exemple : pour les métiers, on peut avoir les niveaux de regroupement 565 * suivants : arts, grandes familles d’engins, … 566 * </p> 567 * <p> 568 * </p> 569 * <p> 570 * Un niveau de regroupement peut avoir un niveau parent. 571 * </p> 572 * <p> 573 * </p> 574 * <p> 575 * Un niveau de regroupement contient un ou plusieurs regroupements (<i>Grouping</i>). 576 * </p> 577 * </body> 578 * </html> 579 * @param groupingLevelsIn Collection<GroupingLevel> 580 */ 581 public void setGroupingLevels(Collection<GroupingLevel> groupingLevelsIn) 582 { 583 this.groupingLevels = groupingLevelsIn; 584 } 585 586 /** 587 * <html> 588 * <head> 589 * <style> 590 * p {padding:0px; margin:0px;} 591 * </style> 592 * </head> 593 * <body> 594 * <p> 595 * Niveau de regroupement, d'une classification donnée. 596 * </p> 597 * <p> 598 * </p> 599 * <p> 600 * Exemple : pour les métiers, on peut avoir les niveaux de regroupement 601 * suivants : arts, grandes familles d’engins, … 602 * </p> 603 * <p> 604 * </p> 605 * <p> 606 * Un niveau de regroupement peut avoir un niveau parent. 607 * </p> 608 * <p> 609 * </p> 610 * <p> 611 * Un niveau de regroupement contient un ou plusieurs regroupements (<i>Grouping</i>). 612 * </p> 613 * </body> 614 * </html> 615 * @param elementToAdd GroupingLevel 616 * @return <tt>true</tt> if this collection changed as a result of the 617 * call 618 */ 619 public boolean addGroupingLevels(GroupingLevel elementToAdd) 620 { 621 return this.groupingLevels.add(elementToAdd); 622 } 623 624 /** 625 * <html> 626 * <head> 627 * <style> 628 * p {padding:0px; margin:0px;} 629 * </style> 630 * </head> 631 * <body> 632 * <p> 633 * Niveau de regroupement, d'une classification donnée. 634 * </p> 635 * <p> 636 * </p> 637 * <p> 638 * Exemple : pour les métiers, on peut avoir les niveaux de regroupement 639 * suivants : arts, grandes familles d’engins, … 640 * </p> 641 * <p> 642 * </p> 643 * <p> 644 * Un niveau de regroupement peut avoir un niveau parent. 645 * </p> 646 * <p> 647 * </p> 648 * <p> 649 * Un niveau de regroupement contient un ou plusieurs regroupements (<i>Grouping</i>). 650 * </p> 651 * </body> 652 * </html> 653 * @param elementToRemove GroupingLevel 654 * @return <tt>true</tt> if this collection changed as a result of the 655 * call 656 */ 657 public boolean removeGroupingLevels(GroupingLevel elementToRemove) 658 { 659 return this.groupingLevels.remove(elementToRemove); 660 } 661 662 /** 663 * Returns <code>true</code> if the argument is an GroupingLevel instance and all identifiers for this entity 664 * equal the identifiers of the argument entity. Returns <code>false</code> otherwise. 665 */ 666 @Override 667 public boolean equals(Object object) 668 { 669 if (this == object) 670 { 671 return true; 672 } 673 if (!(object instanceof GroupingLevel)) 674 { 675 return false; 676 } 677 final GroupingLevel that = (GroupingLevel)object; 678 if (this.id == null || that.getId() == null || !this.id.equals(that.getId())) 679 { 680 return false; 681 } 682 return true; 683 } 684 685 /** 686 * Returns a hash code based on this entity's identifiers. 687 */ 688 @Override 689 public int hashCode() 690 { 691 int hashCode = 0; 692 hashCode = 29 * hashCode + (this.id == null ? 0 : this.id.hashCode()); 693 694 return hashCode; 695 } 696 697 /** 698 * Constructs new instances of {@link GroupingLevel}. 699 */ 700 public static final class Factory 701 { 702 /** 703 * Constructs a new instance of {@link GroupingLevel}. 704 * @return new GroupingLevelImpl() 705 */ 706 public static GroupingLevel newInstance() 707 { 708 return new GroupingLevelImpl(); 709 } 710 711 /** 712 * Constructs a new instance of {@link GroupingLevel}, taking all required and/or 713 * read-only properties as arguments, except for identifiers. 714 * @param label String 715 * @param name String 716 * @param updateDate Timestamp 717 * @param groupingClassification GroupingClassification 718 * @return newInstance 719 */ 720 public static GroupingLevel newInstance(String label, String name, Timestamp updateDate, GroupingClassification groupingClassification) 721 { 722 final GroupingLevel entity = new GroupingLevelImpl(); 723 entity.setLabel(label); 724 entity.setName(name); 725 entity.setUpdateDate(updateDate); 726 entity.setGroupingClassification(groupingClassification); 727 return entity; 728 } 729 730 /** 731 * Constructs a new instance of {@link GroupingLevel}, taking all possible properties 732 * (except the identifier(s))as arguments. 733 * @param label String 734 * @param name String 735 * @param description String 736 * @param comments String 737 * @param updateDate Timestamp 738 * @param parentGroupingLevel GroupingLevel 739 * @param groupings Collection<Grouping> 740 * @param pmfm Pmfm 741 * @param groupingClassification GroupingClassification 742 * @param groupingLevels Collection<GroupingLevel> 743 * @return newInstance GroupingLevel 744 */ 745 public static GroupingLevel newInstance(String label, String name, String description, String comments, Timestamp updateDate, GroupingLevel parentGroupingLevel, Collection<Grouping> groupings, Pmfm pmfm, GroupingClassification groupingClassification, Collection<GroupingLevel> groupingLevels) 746 { 747 final GroupingLevel entity = new GroupingLevelImpl(); 748 entity.setLabel(label); 749 entity.setName(name); 750 entity.setDescription(description); 751 entity.setComments(comments); 752 entity.setUpdateDate(updateDate); 753 entity.setParentGroupingLevel(parentGroupingLevel); 754 entity.setGroupings(groupings); 755 entity.setPmfm(pmfm); 756 entity.setGroupingClassification(groupingClassification); 757 entity.setGroupingLevels(groupingLevels); 758 return entity; 759 } 760 } 761 762 /** 763 * @see Comparable#compareTo 764 */ 765 public int compareTo(GroupingLevel o) 766 { 767 int cmp = 0; 768 if (this.getId() != null) 769 { 770 cmp = this.getId().compareTo(o.getId()); 771 } 772 else 773 { 774 if (this.getLabel() != null) 775 { 776 cmp = (cmp != 0 ? cmp : this.getLabel().compareTo(o.getLabel())); 777 } 778 if (this.getName() != null) 779 { 780 cmp = (cmp != 0 ? cmp : this.getName().compareTo(o.getName())); 781 } 782 if (this.getDescription() != null) 783 { 784 cmp = (cmp != 0 ? cmp : this.getDescription().compareTo(o.getDescription())); 785 } 786 if (this.getComments() != null) 787 { 788 cmp = (cmp != 0 ? cmp : this.getComments().compareTo(o.getComments())); 789 } 790 if (this.getUpdateDate() != null) 791 { 792 cmp = (cmp != 0 ? cmp : this.getUpdateDate().compareTo(o.getUpdateDate())); 793 } 794 } 795 return cmp; 796 } 797// HibernateEntity.vsl merge-point 798// GroupingLevel.java merge-point 799}