2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.model
.name
;
12 import java
.util
.HashSet
;
15 import javax
.persistence
.Entity
;
16 import javax
.persistence
.Inheritance
;
17 import javax
.persistence
.InheritanceType
;
18 import javax
.persistence
.ManyToMany
;
19 import javax
.persistence
.ManyToOne
;
20 import javax
.persistence
.OneToMany
;
21 import javax
.xml
.bind
.annotation
.XmlElement
;
22 import javax
.xml
.bind
.annotation
.XmlElementWrapper
;
23 import javax
.xml
.bind
.annotation
.XmlIDREF
;
24 import javax
.xml
.bind
.annotation
.XmlRootElement
;
25 import javax
.xml
.bind
.annotation
.XmlSchemaType
;
26 import javax
.xml
.bind
.annotation
.XmlType
;
28 import org
.apache
.log4j
.Logger
;
29 import org
.hibernate
.annotations
.Cascade
;
30 import org
.hibernate
.annotations
.CascadeType
;
32 import eu
.etaxonomy
.cdm
.model
.common
.ReferencedEntityBase
;
33 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceBase
;
36 * The (abstract) class representing a typification of one or several {@link TaxonNameBase taxon names}.<BR>
37 * All taxon names which have a {@link Rank rank} "species aggregate" or lower
38 * can only be typified by specimens (a {@link SpecimenTypeDesignation specimen type designation}), but taxon
39 * names with a higher rank might be typified by an other taxon name with
40 * rank "species" or "genus" (a {@link NameTypeDesignation name type designation}).
43 * @see NameTypeDesignation
44 * @see SpecimenTypeDesignation
49 @XmlRootElement(name
= "TypeDesignationBase")
50 @XmlType(name
= "TypeDesignationBase", propOrder
= {
56 @Inheritance(strategy
=InheritanceType
.SINGLE_TABLE
)
57 public abstract class TypeDesignationBase
extends ReferencedEntityBase
implements ITypeDesignation
{
58 private static final Logger logger
= Logger
.getLogger(TypeDesignationBase
.class);
61 @XmlElement(name
= "IsNotDesignated")
62 private boolean isNotDesignated
;
64 @XmlElementWrapper(name
= "TypifiedNames")
65 @XmlElement(name
= "TypifiedName")
67 @XmlSchemaType(name
= "IDREF")
68 private Set
<TaxonNameBase
> typifiedNames
= new HashSet
<TaxonNameBase
>();
70 @XmlElement(name
= "HomotypicalGroup")
72 @XmlSchemaType(name
= "IDREF")
73 private HomotypicalGroup homotypicalGroup
;
75 // **************** CONSTRUCTOR *************************************/
78 * Class constructor: creates a new empty type designation.
80 * @see #TypeDesignationBase(ReferenceBase, String, String, Boolean)
82 protected TypeDesignationBase(){
87 * Class constructor: creates a new type designation
88 * (including its {@link ReferenceBase reference source} and eventually
89 * the taxon name string originally used by this reference when establishing
90 * the former designation).
92 * @param citation the reference source for the new designation
93 * @param citationMicroReference the string with the details describing the exact localisation within the reference
94 * @param originalNameString the taxon name string used originally in the reference source for the new designation
95 * @param isNotDesignated the boolean flag indicating whether there is no type at all for
96 * <i>this</i> type designation
97 * @see #TypeDesignationBase()
98 * @see #isNotDesignated()
99 * @see TaxonNameBase#getTypeDesignations()
101 protected TypeDesignationBase(ReferenceBase citation
, String citationMicroReference
, String originalNameString
, boolean isNotDesignated
){
102 super(citation
, citationMicroReference
, originalNameString
);
103 this.isNotDesignated
= isNotDesignated
;
107 // **************** METHODS *************************************/
111 * @see eu.etaxonomy.cdm.model.name.ITypeDesignation#getHomotypicalGroup()
114 * Returns the {@link HomotypicalGroup homotypical group} to which all (in <i>this</i>
115 * type designation) typified {@link TaxonNameBase taxon names} belong.
117 * @see #getTypifiedNames()
120 @Cascade({CascadeType
.SAVE_UPDATE
})
121 public HomotypicalGroup
getHomotypicalGroup() {
122 return homotypicalGroup
;
125 @Deprecated //for hibernate use only
126 private void setHomotypicalGroup(HomotypicalGroup homotypicalGroup
) {
127 this.homotypicalGroup
= homotypicalGroup
;
131 * @see eu.etaxonomy.cdm.model.name.ITypeDesignation#getTypifiedNames()
134 * Returns the set of {@link TaxonNameBase taxon names} typified in <i>this</i>
135 * type designation. This is a subset of the taxon names belonging to the
136 * corresponding {@link #getHomotypicalGroup() homotypical group}.
139 @Cascade({CascadeType
.SAVE_UPDATE
})
140 public Set
<TaxonNameBase
> getTypifiedNames() {
141 return typifiedNames
;
145 * Returns the boolean value "true" if it is known that a type does not
146 * exist and therefore the {@link TaxonNameBase taxon name} to which <i>this</i>
147 * type designation is assigned must still be typified. Two
148 * cases must be differentiated: <BR><ul>
149 * <li> a) it is unknown whether a type exists and
150 * <li> b) it is known that no type exists
152 * If a) is true there should be no TypeDesignation instance at all
153 * assigned to the "typified" taxon name.<BR>
154 * If b) is true there should be a TypeDesignation instance with the
155 * flag isNotDesignated set. The typeName attribute, in case of a
156 * {@link NameTypeDesignation name type designation}, or the typeSpecimen attribute,
157 * in case of a {@link SpecimenTypeDesignation specimen type designation}, should then be "null".
159 public boolean isNotDesignated() {
160 return isNotDesignated
;
164 * @see #isNotDesignated()
166 public void setNotDesignated(boolean isNotDesignated
) {
167 this.isNotDesignated
= isNotDesignated
;
171 @Deprecated //for hibernate use only
172 private void setTypifiedNames(Set
<TaxonNameBase
> typifiedNames
) {
173 this.typifiedNames
= typifiedNames
;
176 @Deprecated //for bidirectional use only
177 protected void addTypifiedName(TaxonNameBase taxonName
){
178 this.typifiedNames
.add(taxonName
);