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.quadrige3.core.dao.referential.taxon; 7 8 /*- 9 * #%L 10 * Quadrige3 Core :: Client API 11 * %% 12 * Copyright (C) 2017 - 2024 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 import java.io.Serializable; 29 30 /** 31 * 32 */ 33 // HibernateEntity.vsl annotations merge-point 34 public abstract class VirtualComponent 35 implements Serializable, Comparable<VirtualComponent> 36 { 37 /** 38 * The serial version UID of this class. Needed for serialization. 39 */ 40 private static final long serialVersionUID = -2345051973744045898L; 41 42 private VirtualComponentPK virtualComponentPk; 43 44 /** 45 * Get the composite primary key identifier class 46 * @return virtualComponentPk 47 */ 48 public VirtualComponentPK getVirtualComponentPk() 49 { 50 return this.virtualComponentPk; 51 } 52 53 /** 54 * Set the composite primary key identifier class 55 * @param virtualComponentPkIn 56 */ 57 public void setVirtualComponentPk(VirtualComponentPK virtualComponentPkIn) { 58 this.virtualComponentPk = virtualComponentPkIn; 59 } 60 61 // Generate 0 attributes 62 // Generate 2 associations 63 private TaxonName taxonName; 64 65 /** 66 * Liste les taxons (interface avec ERMS) 67 * @return this.taxonName TaxonName 68 */ 69 public TaxonName getTaxonName() 70 { 71 return this.taxonName; 72 } 73 74 /** 75 * Liste les taxons (interface avec ERMS) 76 * @param taxonNameIn TaxonName 77 */ 78 public void setTaxonName(TaxonName taxonNameIn) 79 { 80 this.taxonName = taxonNameIn; 81 } 82 83 private ReferenceTaxon referenceTaxon; 84 85 /** 86 * Liste des taxons qui sont la référence. 87 * l'ID référent est indépendant des ID taxon car les taxons peuvent être référents à un moment 88 * et ne 89 * plus l'être par la suite. 90 * Toutes les données du système doivent donc être reliées au référent et non au taxon qui sont 91 * référents à un moment mais ne peuvent plus l'être par la suite. 92 * Le fonctionnement dans la table TAXON_NAME est le suivant : 93 * - REF_TAXON_ID est toujours renseigné 94 * - si TAXON_NAME_IS_REFER est à vrai, il s'agit d'un taxon référent (toujours le cas s'il 95 * s'agit d'un 96 * taxon virtuel) 97 * - sinon c'est un synonyme 98 * Un taxon référent qui devient synonyme voit donc son statut TAXON_NAME_IS_REFER changer et le 99 * nouveau taxon référent qui le remplace récupère l'information REF_TAXON_ID 100 * NB : c'était le comportement initialement prévu. 101 * En réalité, lorsqu'un taxon référent T1-R1 devient synonyme d'un nouveau taxon référent T2, 102 * le taxon 103 * T2 prend un nouveau code référent R2 et donc le taxon T1 est lié à R2 (et tous les synonymes 104 * et les 105 * résultats qu'il pouvait avoir). 106 * Ce mécanisme a été adopté car il fallait distinguer 2 cas : 107 * 1- cas d'un taxon référent T1-R1 qui devient synonyme d'un référent qu'on crée T2 : on aurait 108 * alors 109 * pu utiliser le même REF_TAXON_ID R1 au lieu d'en créer un et ne pas mettre à jour les autres 110 * synonymes, résultats... 111 * 2- cas d'un taxon référent T1-R1 qui devient synonyme d'un référent qui existe déjà T2-R2 (et 112 * qui 113 * aurait déjà d'autres synonymes, résultats...), dans ce cas le remplacement de la référence R1 114 * pour 115 * R2 est nécessaire 116 * La modélisation pourrait être revue car la table REFENCE_TAXON ne se justifie alors plus, on 117 * pourrait directement utiliser une référence à la colonne TAXON_NAME_ID pour désigner les 118 * référents 119 * @return this.referenceTaxon ReferenceTaxon 120 */ 121 public ReferenceTaxon getReferenceTaxon() 122 { 123 return this.referenceTaxon; 124 } 125 126 /** 127 * Liste des taxons qui sont la référence. 128 * l'ID référent est indépendant des ID taxon car les taxons peuvent être référents à un moment 129 * et ne 130 * plus l'être par la suite. 131 * Toutes les données du système doivent donc être reliées au référent et non au taxon qui sont 132 * référents à un moment mais ne peuvent plus l'être par la suite. 133 * Le fonctionnement dans la table TAXON_NAME est le suivant : 134 * - REF_TAXON_ID est toujours renseigné 135 * - si TAXON_NAME_IS_REFER est à vrai, il s'agit d'un taxon référent (toujours le cas s'il 136 * s'agit d'un 137 * taxon virtuel) 138 * - sinon c'est un synonyme 139 * Un taxon référent qui devient synonyme voit donc son statut TAXON_NAME_IS_REFER changer et le 140 * nouveau taxon référent qui le remplace récupère l'information REF_TAXON_ID 141 * NB : c'était le comportement initialement prévu. 142 * En réalité, lorsqu'un taxon référent T1-R1 devient synonyme d'un nouveau taxon référent T2, 143 * le taxon 144 * T2 prend un nouveau code référent R2 et donc le taxon T1 est lié à R2 (et tous les synonymes 145 * et les 146 * résultats qu'il pouvait avoir). 147 * Ce mécanisme a été adopté car il fallait distinguer 2 cas : 148 * 1- cas d'un taxon référent T1-R1 qui devient synonyme d'un référent qu'on crée T2 : on aurait 149 * alors 150 * pu utiliser le même REF_TAXON_ID R1 au lieu d'en créer un et ne pas mettre à jour les autres 151 * synonymes, résultats... 152 * 2- cas d'un taxon référent T1-R1 qui devient synonyme d'un référent qui existe déjà T2-R2 (et 153 * qui 154 * aurait déjà d'autres synonymes, résultats...), dans ce cas le remplacement de la référence R1 155 * pour 156 * R2 est nécessaire 157 * La modélisation pourrait être revue car la table REFENCE_TAXON ne se justifie alors plus, on 158 * pourrait directement utiliser une référence à la colonne TAXON_NAME_ID pour désigner les 159 * référents 160 * @param referenceTaxonIn ReferenceTaxon 161 */ 162 public void setReferenceTaxon(ReferenceTaxon referenceTaxonIn) 163 { 164 this.referenceTaxon = referenceTaxonIn; 165 } 166 167 /** 168 * This entity does not have any identifiers 169 * and is not extending any other entity, 170 * so this method will only return <code>true</code> if the argument reference and <code>this</code> 171 * refer to the same object. 172 */ 173 @Override 174 public boolean equals(Object object) 175 { 176 return super.equals(object); 177 } 178 179 /** 180 * This entity does not have any identifiers 181 * and is not extending any other entity, 182 * so this method will only take the identifiers of this entity into account when calculating the hash code. 183 */ 184 @Override 185 public int hashCode() 186 { 187 return super.hashCode(); 188 } 189 190 /** 191 * Constructs new instances of {@link VirtualComponent}. 192 */ 193 public static final class Factory 194 { 195 /** 196 * Constructs a new instance of {@link VirtualComponent}. 197 * @return new VirtualComponentImpl() 198 */ 199 public static VirtualComponent newInstance() 200 { 201 return new VirtualComponentImpl(); 202 } 203 204 205 /** 206 * Constructs a new instance of {@link VirtualComponent}, taking all possible properties 207 * (except the identifier(s))as arguments. 208 * @param taxonName TaxonName 209 * @param referenceTaxon ReferenceTaxon 210 * @return newInstance VirtualComponent 211 */ 212 public static VirtualComponent newInstance(TaxonName taxonName, ReferenceTaxon referenceTaxon) 213 { 214 final VirtualComponent entity = new VirtualComponentImpl(); 215 entity.setTaxonName(taxonName); 216 entity.setReferenceTaxon(referenceTaxon); 217 return entity; 218 } 219 } 220 221 /** 222 * @see Comparable#compareTo 223 */ 224 public int compareTo(VirtualComponent o) 225 { 226 int cmp = 0; 227 if (this.getVirtualComponentPk() != null) 228 { 229 cmp = this.getVirtualComponentPk().compareTo(o.getVirtualComponentPk()); 230 } 231 return cmp; 232 } 233 // HibernateEntity.vsl merge-point 234 // VirtualComponent.java merge-point 235 }