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