1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.model.name;
|
11
|
|
12
|
|
13
|
import javax.persistence.Entity;
|
14
|
import javax.persistence.FetchType;
|
15
|
import javax.persistence.ManyToOne;
|
16
|
import javax.persistence.Transient;
|
17
|
import javax.xml.bind.annotation.XmlAccessType;
|
18
|
import javax.xml.bind.annotation.XmlAccessorType;
|
19
|
import javax.xml.bind.annotation.XmlElement;
|
20
|
import javax.xml.bind.annotation.XmlIDREF;
|
21
|
import javax.xml.bind.annotation.XmlRootElement;
|
22
|
import javax.xml.bind.annotation.XmlSchemaType;
|
23
|
import javax.xml.bind.annotation.XmlType;
|
24
|
|
25
|
import org.apache.log4j.Logger;
|
26
|
import org.hibernate.annotations.Cascade;
|
27
|
import org.hibernate.annotations.CascadeType;
|
28
|
import org.hibernate.envers.Audited;
|
29
|
|
30
|
import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
|
31
|
import eu.etaxonomy.cdm.model.occurrence.Specimen;
|
32
|
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
|
33
|
|
34
|
/**
|
35
|
* The class representing a typification of one or several {@link TaxonNameBase taxon names} by a
|
36
|
* {@link eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase specimen or a figure}. All {@link TaxonNameBase taxon names}
|
37
|
* which have a {@link Rank rank} "species aggregate" or lower can only be typified
|
38
|
* by specimens. Moreover each typification by a specimen (or by a figure) has a
|
39
|
* {@link SpecimenTypeDesignationStatus status} like "holotype" or "isotype".
|
40
|
* <P>
|
41
|
* This class corresponds to: <ul>
|
42
|
* <li> NomenclaturalType according to the TDWG ontology
|
43
|
* <li> Typification (partially) according to the TCS
|
44
|
* <li> NomenclaturalTypeDesignation according to the ABCD schema
|
45
|
* </ul>
|
46
|
*
|
47
|
* @see TypeDesignationBase
|
48
|
* @see NameTypeDesignation
|
49
|
* @author m.doering
|
50
|
* @version 1.0
|
51
|
* @created 08-Nov-2007 13:06:38
|
52
|
*/
|
53
|
@XmlRootElement(name = "SpecimenTypeDesignation")
|
54
|
@XmlAccessorType(XmlAccessType.FIELD)
|
55
|
@XmlType(name = "SpecimenTypeDesignation", propOrder = {
|
56
|
"typeSpecimen"
|
57
|
})
|
58
|
@Entity
|
59
|
@Audited
|
60
|
public class SpecimenTypeDesignation extends TypeDesignationBase<SpecimenTypeDesignationStatus>
|
61
|
implements ITypeDesignation {
|
62
|
private static final long serialVersionUID = 6481627446997275007L;
|
63
|
@SuppressWarnings("unused")
|
64
|
private static final Logger logger = Logger.getLogger(SpecimenTypeDesignation.class);
|
65
|
|
66
|
@XmlElement(name = "TypeSpecimen")
|
67
|
@XmlIDREF
|
68
|
@XmlSchemaType(name = "IDREF")
|
69
|
@ManyToOne(fetch = FetchType.LAZY)
|
70
|
@Cascade(CascadeType.SAVE_UPDATE)
|
71
|
private DerivedUnitBase typeSpecimen;
|
72
|
|
73
|
// /**
|
74
|
// * Creates a new specimen type designation instance
|
75
|
// * (including its {@link reference.ReferenceBase reference source} and eventually
|
76
|
// * the taxon name string originally used by this reference when establishing
|
77
|
// * the former designation) and adds it to the corresponding
|
78
|
// * {@link HomotypicalGroup#getSpecimenTypeDesignations() specimen type designation set} of the
|
79
|
// * {@link HomotypicalGroup homotypical group}.
|
80
|
// *
|
81
|
// * @param specimen the derived unit (specimen or figure) used as type
|
82
|
// * @param status the type designation status
|
83
|
// * @param citation the reference source for the new designation
|
84
|
// * @param citationMicroReference the string with the details describing the exact localisation within the reference
|
85
|
// * @param originalNameString the taxon name string used originally in the reference source for the new designation
|
86
|
// * @see #SpecimenTypeDesignation(DerivedUnitBase, TypeDesignationStatus, ReferenceBase, String, String)
|
87
|
// * @see HomotypicalGroup#addSpecimenTypeDesignation(SpecimenTypeDesignation, boolean)
|
88
|
// * @see occurrence.DerivedUnitBase
|
89
|
// */
|
90
|
// protected static SpecimenTypeDesignation NewInstance2(DerivedUnitBase specimen, TypeDesignationStatus status,
|
91
|
// ReferenceBase citation, String citationMicroReference, String originalNameString){
|
92
|
// SpecimenTypeDesignation specTypeDesig = new SpecimenTypeDesignation(specimen, status, citation, citationMicroReference, originalNameString);
|
93
|
// return specTypeDesig;
|
94
|
// }
|
95
|
|
96
|
|
97
|
// ************* CONSTRUCTORS *************/
|
98
|
/**
|
99
|
* Class constructor: creates a new empty specimen type designation.
|
100
|
*
|
101
|
* @see #SpecimenTypeDesignation(DerivedUnitBase, SpecimenTypeDesignationStatus,
|
102
|
* ReferenceBase, String, String, boolean)
|
103
|
*/
|
104
|
protected SpecimenTypeDesignation(){
|
105
|
}
|
106
|
|
107
|
public static SpecimenTypeDesignation NewInstance() {
|
108
|
return new SpecimenTypeDesignation();
|
109
|
}
|
110
|
|
111
|
/**
|
112
|
* Class constructor: creates a new specimen type designation instance
|
113
|
* (including its {@link eu.etaxonomy.cdm.model.reference.ReferenceBase reference source} and
|
114
|
* eventually the taxon name string originally used by this reference when
|
115
|
* establishing the former designation).
|
116
|
*
|
117
|
* @param specimen the derived unit (specimen or figure) used
|
118
|
* as type
|
119
|
* @param status the type designation status
|
120
|
* @param citation the reference source for the new designation
|
121
|
* @param citationMicroReference the string with the details describing
|
122
|
* the exact localisation within the reference
|
123
|
* @param originalNameString the taxon name string used originally in the
|
124
|
* reference source for the new designation
|
125
|
* @param isNotDesignated the boolean flag indicating whether there is no specimen type at all for
|
126
|
* <i>this</i> specimen type designation
|
127
|
* @see #SpecimenTypeDesignation()
|
128
|
* @see TaxonNameBase#addSpecimenTypeDesignation(Specimen, SpecimenTypeDesignationStatus, ReferenceBase, String, String, boolean, boolean)
|
129
|
* @see TypeDesignationBase#isNotDesignated()
|
130
|
* @see eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase
|
131
|
*/
|
132
|
protected SpecimenTypeDesignation(DerivedUnitBase specimen, SpecimenTypeDesignationStatus status, ReferenceBase citation, String citationMicroReference,
|
133
|
String originalNameString, boolean isNotDesignated) {
|
134
|
super(citation, citationMicroReference, originalNameString, isNotDesignated);
|
135
|
this.setTypeSpecimen(specimen);
|
136
|
this.setTypeStatus(status);
|
137
|
}
|
138
|
|
139
|
//********* METHODS **************************************/
|
140
|
|
141
|
/**
|
142
|
* Returns the {@link occurrence.DerivedUnitBase derived unit} (specimen or figure) that is used
|
143
|
* in <i>this</i> specimen type designation to typify the {@link TaxonNameBase taxon name}.
|
144
|
*
|
145
|
* @see #getHomotypicalGroup()
|
146
|
*/
|
147
|
public DerivedUnitBase getTypeSpecimen(){
|
148
|
return this.typeSpecimen;
|
149
|
}
|
150
|
/**
|
151
|
* @see #getTypeSpecimen()
|
152
|
*/
|
153
|
public void setTypeSpecimen(DerivedUnitBase typeSpecimen){
|
154
|
this.typeSpecimen = typeSpecimen;
|
155
|
}
|
156
|
|
157
|
/* (non-Javadoc)
|
158
|
* @see eu.etaxonomy.cdm.model.name.ITypeDesignation#isLectoType()
|
159
|
*/
|
160
|
@Transient
|
161
|
public boolean isLectoType() {
|
162
|
if(getTypeStatus() == null){
|
163
|
return false;
|
164
|
}
|
165
|
return getTypeStatus().isLectotype();
|
166
|
}
|
167
|
|
168
|
}
|