Project

General

Profile

Download (8.48 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
5
* http://www.e-taxonomy.eu
6
* 
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10

    
11
package eu.etaxonomy.cdm.model.name;
12

    
13
import java.util.HashMap;
14
import java.util.Map;
15
import java.util.UUID;
16

    
17
import javax.persistence.Entity;
18
import javax.persistence.Transient;
19
import javax.xml.bind.annotation.XmlAccessType;
20
import javax.xml.bind.annotation.XmlAccessorType;
21
import javax.xml.bind.annotation.XmlType;
22

    
23
import org.apache.log4j.Logger;
24
import org.hibernate.envers.Audited;
25
import org.hibernate.search.annotations.Indexed;
26

    
27
import eu.etaxonomy.cdm.model.common.TermVocabulary;
28

    
29
/**
30
 * The terms in this class define the status of a {@link NameTypeDesignation name type designation}. 
31
 * 
32
 * @author a.babadshanjan
33
 * @version 1.0
34
 * @created 20.03.2009
35
 */
36
@XmlAccessorType(XmlAccessType.FIELD)
37
@XmlType(name = "NameTypeDesignationStatus")
38
@Entity
39
@Indexed(index = "eu.etaxonomy.cdm.model.common.DefinedTermBase")
40
@Audited
41
public class NameTypeDesignationStatus extends TypeDesignationStatusBase<NameTypeDesignationStatus> {
42
	private static final long serialVersionUID = -8801837496688711907L;
43
	@SuppressWarnings("unused")
44
	private static final Logger logger = Logger.getLogger(NameTypeDesignationStatus.class);
45

    
46
	private static final UUID uuidAutomatic = UUID.fromString("e89d8b21-615a-4602-913f-1625bf39a69f");
47
	private static final UUID uuidMonotypy = UUID.fromString("3fc639b2-9a64-45f8-9a81-657a4043ad74");
48
	private static final UUID uuidNotApplicable = UUID.fromString("91a9d6a9-7754-41cd-9f7e-be136f599f7e");
49
	private static final UUID uuidOriginalDesignation = UUID.fromString("40032a44-973b-4a64-b25e-76f86c3a753c");
50
	private static final UUID uuidPresentDesignation = UUID.fromString("e5f38f5d-995d-4470-a036-1a9792a543fc");
51
	private static final UUID uuidSubsequentMonotypy = UUID.fromString("2b5806d8-31b0-406e-a32a-4adac0c89ae4");
52
	private static final UUID uuidSubsequentDesignation = UUID.fromString("3e449e7d-a03c-4431-a7d3-aa258406f6b2");
53
	private static final UUID uuidTautonymy = UUID.fromString("84521f09-3e10-43f5-aa6f-2173a55a6790");
54
	private static final UUID uuidLectotype = UUID.fromString("4177c938-b741-40e1-95e5-4c53bd1ed87d");
55
	
56
	/** 
57
	 * Factory method: creates an additional type designation status instance
58
	 * with a description (in the {@link eu.etaxonomy.cdm.model.common.Language#DEFAULT() default language}), a label
59
	 * and a label abbreviation.
60
	 * 
61
	 * @param	term  		 the string (in the default language) describing the
62
	 * 						 new name type designation status to be created 
63
	 * @param	label  		 the string identifying the new name type designation
64
	 * 						 status to be created
65
	 * @param	labelAbbrev  the string identifying (in abbreviated form) the
66
	 * 						 new name type designation status to be created
67
	 */
68
	public static NameTypeDesignationStatus NewInstance(String term, String label, String labelAbbrev){
69
		return new NameTypeDesignationStatus(term, label, labelAbbrev);
70
	}
71
	
72
	protected static Map<UUID, NameTypeDesignationStatus> termMap = null;		
73
	
74
	protected static NameTypeDesignationStatus findTermByUuid(UUID uuid){
75
		if (termMap == null){
76
			return null;
77
		}
78
		return (NameTypeDesignationStatus)termMap.get(uuid);
79
	}
80

    
81
	// ************* CONSTRUCTORS *************/	
82

    
83
	/** 
84
	 * Class constructor: creates a new empty name type designation status instance.
85
	 * 
86
	 * @see 	#NameTypeDesignationStatus(String, String, String)
87
	 */
88
	@Deprecated //public use by term initializer only TODO needs to be changed
89
	public NameTypeDesignationStatus() {
90
	}
91
	
92
	protected NameTypeDesignationStatus(String term, String label, String labelAbbrev) {
93
		super(term, label, labelAbbrev);
94
	}
95

    
96
//************************** METHODS ********************************
97
	
98
	/* (non-Javadoc)
99
	 * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#resetTerms()
100
	 */
101
	@Override
102
	public void resetTerms(){
103
		termMap = null;
104
	}
105

    
106

    
107
	/**
108
	 * Returns the "automatic" name type designation status.</BR>
109
     * If a new name has to be established for a genus name this new name automatically gets 
110
     * the same type species as the old name.
111
     * ICZN 67.8
112
	 */
113
	public static final NameTypeDesignationStatus AUTOMATIC(){
114
		return findTermByUuid(uuidAutomatic);
115
	}
116
	
117
	/**
118
	 * Returns the "monotypy" name type designation status.</BR>
119
	 * Only one species was included in original genus description.
120
	 * ICZN 68.3.
121
	 * No {@linkplain TypeDesignationBase#getCitation() citation} is needed 
122
	 * for a monotypy as the type species is decided within the original paper. 
123
	 */
124
	public static final NameTypeDesignationStatus MONOTYPY(){
125
		return findTermByUuid(uuidMonotypy);
126
	}
127
	
128
	/**
129
	 * Returns the "not applicable" name type designation status.</BR>
130
	 * Used in the BDWD (BioSystematic Database of World Diptera) for 
131
	 * nomina nuda, emendations and misspellings.
132
	 */
133
	public static final NameTypeDesignationStatus NOT_APPLICABLE(){
134
		return findTermByUuid(uuidNotApplicable);
135
	}
136
	
137
	/**
138
	 * Returns the "original designation" name type designation status.</BR>
139
	 * The type species is designated in the original genus description 
140
	 * (this includes indication in the species name typicus).
141
	 * ICZN 68.2<Br>
142
	 * No {@linkplain TypeDesignationBase#getCitation() citation} is needed 
143
	 * for an original designation as the type species is decided within the original paper. 
144
	 */
145
	public static final NameTypeDesignationStatus ORIGINAL_DESIGNATION(){
146
		return findTermByUuid(uuidOriginalDesignation);
147
	}
148
	
149
	/**
150
	 * Returns the "present designation" name type designation status.</BR>
151
	 * The type species is designated now (maybe possible in future, 
152
	 * after ICZN has changed and online publications are available).
153
	 */
154
	public static final NameTypeDesignationStatus PRESENT_DESIGNATION(){
155
		return findTermByUuid(uuidPresentDesignation);
156
	}
157
	
158
	/**
159
	 * Returns the "subsequent monotypy" name type designation status.</BR>
160
	 * If only one nominal species was first subsequently included 
161
	 * in a nominal genus or subgenus established without included species, 
162
	 * that nominal species is automatically fixed as the type species, 
163
	 * by subsequent monotypy.
164
	 * ICZN 69.3
165
	 */
166
	public static final NameTypeDesignationStatus SUBSEQUENT_MONOTYPY(){
167
		return findTermByUuid(uuidSubsequentMonotypy);
168
	}
169
	
170
	/**
171
	 * Returns the "subsequent designation" name type designation status.</BR>
172
	 * Several species were included in the original genus description. 
173
	 * One of these has been designated as type species in a later publication.
174
	 * 
175
	 * ICZN 69.1
176
	 */
177
	public static final NameTypeDesignationStatus SUBSEQUENT_DESIGNATION(){
178
		return findTermByUuid(uuidSubsequentDesignation);
179
	}
180

    
181
	
182
	/**
183
	 * Returns the lectotype name type designation status.</BR>
184
	 * This may be the same as a {@link SUBSEQUENT_DESIGNATION()} but used in botany.
185
	 * Maybe these 2 status will be merged in future.
186
	 */
187
	public static final NameTypeDesignationStatus LECTOTYPE(){
188
		return findTermByUuid(uuidLectotype);
189
	}
190
	
191
	/**
192
	 * Returns the "tautonomy" name type designation status.</BR>
193
	 * The genus name is the same as the species name of one of the included species.
194
	 * ICZN 68.4, 68.5
195
	 */
196
	public static final NameTypeDesignationStatus TAUTONYMY(){
197
		return findTermByUuid(uuidTautonymy);
198
	}
199

    
200
	
201
	@Override
202
	protected void setDefaultTerms(TermVocabulary<NameTypeDesignationStatus> termVocabulary) {
203
		termMap = new HashMap<UUID, NameTypeDesignationStatus>();
204
		for (NameTypeDesignationStatus term : termVocabulary.getTerms()){
205
			termMap.put(term.getUuid(), term);
206
		}
207
	}
208
	
209
	/**
210
	 * Returns the boolean value indicating whether <i>this</i> type designation
211
	 * status is itself "lectotype" or a kind of "lectotype" (true) or not
212
	 * (false). Returns false if <i>this</i> type designation status is null.<BR>
213
	 * A lectotype is a {@link eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase specimen or illustration} designated as the
214
	 * nomenclatural type, when no holotype was indicated at the time of
215
	 * publication of the "type-bringing" {@link TaxonNameBase taxon name}, when the
216
	 * holotype is found to be assigned to taxon names belonging to more than
217
	 * one {@link HomotypicalGroup homotypical group}, or as long as it is missing.
218
	 *
219
	 * @see  #LECTOTYPE()
220
	 * @see  #HOLOTYPE()
221
	 * @see  eu.etaxonomy.cdm.model.common.DefinedTermBase#getKindOf()
222
	 */
223
	@Transient
224
	public boolean isLectotype(){
225
		if (
226
				this.equals(LECTOTYPE()) ||
227
				this.equals(SUBSEQUENT_DESIGNATION()) ||
228
				this.equals(PRESENT_DESIGNATION() ) 	
229
				){
230
			return true;
231
		}else{
232
			return false;
233
		}
234
	}
235
}
(11-11/26)