Project

General

Profile

Download (8.53 KB) Statistics
| Branch: | Tag: | Revision:
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
import java.util.HashMap;
13
import java.util.Map;
14
import java.util.UUID;
15

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

    
22
import org.apache.log4j.Logger;
23
import org.hibernate.envers.Audited;
24

    
25
import eu.etaxonomy.cdm.model.common.TermType;
26
import eu.etaxonomy.cdm.model.common.TermVocabulary;
27

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

    
45
	private static final UUID uuidAutomatic = UUID.fromString("e89d8b21-615a-4602-913f-1625bf39a69f");
46
	private static final UUID uuidMonotypy = UUID.fromString("3fc639b2-9a64-45f8-9a81-657a4043ad74");
47
	private static final UUID uuidNotApplicable = UUID.fromString("91a9d6a9-7754-41cd-9f7e-be136f599f7e");
48
	private static final UUID uuidOriginalDesignation = UUID.fromString("40032a44-973b-4a64-b25e-76f86c3a753c");
49
	private static final UUID uuidPresentDesignation = UUID.fromString("e5f38f5d-995d-4470-a036-1a9792a543fc");
50
	private static final UUID uuidSubsequentMonotypy = UUID.fromString("2b5806d8-31b0-406e-a32a-4adac0c89ae4");
51
	private static final UUID uuidSubsequentDesignation = UUID.fromString("3e449e7d-a03c-4431-a7d3-aa258406f6b2");
52
	private static final UUID uuidTautonymy = UUID.fromString("84521f09-3e10-43f5-aa6f-2173a55a6790");
53
	private static final UUID uuidLectotype = UUID.fromString("4177c938-b741-40e1-95e5-4c53bd1ed87d");
54

    
55
	/**
56
	 * Factory method: creates an additional type designation status instance
57
	 * with a description (in the {@link eu.etaxonomy.cdm.model.common.Language#DEFAULT() default language}), a label
58
	 * and a label abbreviation.
59
	 *
60
	 * @param	term  		 the string (in the default language) describing the
61
	 * 						 new name type designation status to be created
62
	 * @param	label  		 the string identifying the new name type designation
63
	 * 						 status to be created
64
	 * @param	labelAbbrev  the string identifying (in abbreviated form) the
65
	 * 						 new name type designation status to be created
66
	 */
67
	public static NameTypeDesignationStatus NewInstance(String term, String label, String labelAbbrev){
68
		return new NameTypeDesignationStatus(term, label, labelAbbrev);
69
	}
70

    
71
	protected static Map<UUID, NameTypeDesignationStatus> termMap = null;
72

    
73
	protected static NameTypeDesignationStatus findTermByUuid(UUID uuid){
74
        if (termMap == null || termMap.isEmpty()){
75
            return getTermByClassAndUUID(NameTypeDesignationStatus.class, uuid);
76
        } else {
77
            return termMap.get(uuid);
78
        }
79
	}
80

    
81
	//********************************** Constructor *********************************/
82

    
83
  	//for hibernate use only
84
  	@Deprecated
85
  	protected NameTypeDesignationStatus() {
86
		super (TermType.NameTypeDesignationStatus);
87
	}
88

    
89
	protected NameTypeDesignationStatus(String term, String label, String labelAbbrev) {
90
		super(TermType.NameTypeDesignationStatus, term, label, labelAbbrev);
91
	}
92

    
93
//************************** METHODS ********************************
94

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

    
103

    
104
	/**
105
	 * Returns the "automatic" name type designation status.</BR>
106
     * If a new name has to be established for a genus name this new name automatically gets
107
     * the same type species as the old name.
108
     * ICZN 67.8
109
	 */
110
	public static final NameTypeDesignationStatus AUTOMATIC(){
111
		return findTermByUuid(uuidAutomatic);
112
	}
113

    
114
	/**
115
	 * Returns the "monotypy" name type designation status.</BR>
116
	 * Only one species was included in original genus description.
117
	 * ICZN 68.3.
118
	 * No {@linkplain TypeDesignationBase#getCitation() citation} is needed
119
	 * for a monotypy as the type species is decided within the original paper.
120
	 */
121
	public static final NameTypeDesignationStatus MONOTYPY(){
122
		return findTermByUuid(uuidMonotypy);
123
	}
124

    
125
	/**
126
	 * Returns the "not applicable" name type designation status.</BR>
127
	 * Used in the BDWD (BioSystematic Database of World Diptera) for
128
	 * nomina nuda, emendations and misspellings.
129
	 */
130
	public static final NameTypeDesignationStatus NOT_APPLICABLE(){
131
		return findTermByUuid(uuidNotApplicable);
132
	}
133

    
134
	/**
135
	 * Returns the "original designation" name type designation status.</BR>
136
	 * The type species is designated in the original genus description
137
	 * (this includes indication in the species name typicus).
138
	 * ICZN 68.2<Br>
139
	 * No {@linkplain TypeDesignationBase#getCitation() citation} is needed
140
	 * for an original designation as the type species is decided within the original paper.
141
	 */
142
	public static final NameTypeDesignationStatus ORIGINAL_DESIGNATION(){
143
		return findTermByUuid(uuidOriginalDesignation);
144
	}
145

    
146
	/**
147
	 * Returns the "present designation" name type designation status.</BR>
148
	 * The type species is designated now (maybe possible in future,
149
	 * after ICZN has changed and online publications are available).
150
	 */
151
	public static final NameTypeDesignationStatus PRESENT_DESIGNATION(){
152
		return findTermByUuid(uuidPresentDesignation);
153
	}
154

    
155
	/**
156
	 * Returns the "subsequent monotypy" name type designation status.</BR>
157
	 * If only one nominal species was first subsequently included
158
	 * in a nominal genus or subgenus established without included species,
159
	 * that nominal species is automatically fixed as the type species,
160
	 * by subsequent monotypy.
161
	 * ICZN 69.3
162
	 */
163
	public static final NameTypeDesignationStatus SUBSEQUENT_MONOTYPY(){
164
		return findTermByUuid(uuidSubsequentMonotypy);
165
	}
166

    
167
	/**
168
	 * Returns the "subsequent designation" name type designation status.</BR>
169
	 * Several species were included in the original genus description.
170
	 * One of these has been designated as type species in a later publication.
171
	 *
172
	 * ICZN 69.1
173
	 */
174
	public static final NameTypeDesignationStatus SUBSEQUENT_DESIGNATION(){
175
		return findTermByUuid(uuidSubsequentDesignation);
176
	}
177

    
178

    
179
	/**
180
	 * Returns the lectotype name type designation status.</BR>
181
	 * This may be the same as a {@link SUBSEQUENT_DESIGNATION()} but used in botany.
182
	 * Maybe these 2 status will be merged in future.
183
	 */
184
	public static final NameTypeDesignationStatus LECTOTYPE(){
185
		return findTermByUuid(uuidLectotype);
186
	}
187

    
188
	/**
189
	 * Returns the "tautonomy" name type designation status.</BR>
190
	 * The genus name is the same as the species name of one of the included species.
191
	 * ICZN 68.4, 68.5
192
	 */
193
	public static final NameTypeDesignationStatus TAUTONYMY(){
194
		return findTermByUuid(uuidTautonymy);
195
	}
196

    
197

    
198
	@Override
199
	protected void setDefaultTerms(TermVocabulary<NameTypeDesignationStatus> termVocabulary) {
200
		termMap = new HashMap<UUID, NameTypeDesignationStatus>();
201
		for (NameTypeDesignationStatus term : termVocabulary.getTerms()){
202
			termMap.put(term.getUuid(), term);
203
		}
204
	}
205

    
206
	/**
207
	 * Returns the boolean value indicating whether <i>this</i> type designation
208
	 * status is itself "lectotype" or a kind of "lectotype" (true) or not
209
	 * (false). Returns false if <i>this</i> type designation status is null.<BR>
210
	 * A lectotype is a {@link eu.etaxonomy.cdm.model.occurrence.DerivedUnit specimen or illustration} designated as the
211
	 * nomenclatural type, when no holotype was indicated at the time of
212
	 * publication of the "type-bringing" {@link TaxonName taxon name}, when the
213
	 * holotype is found to be assigned to taxon names belonging to more than
214
	 * one {@link HomotypicalGroup homotypical group}, or as long as it is missing.
215
	 *
216
	 * @see  #LECTOTYPE()
217
	 * @see  #HOLOTYPE()
218
	 * @see  eu.etaxonomy.cdm.model.common.DefinedTermBase#getKindOf()
219
	 */
220
	@Transient
221
	public boolean isLectotype(){
222
		if (
223
				this.equals(LECTOTYPE()) ||
224
				this.equals(SUBSEQUENT_DESIGNATION()) ||
225
				this.equals(PRESENT_DESIGNATION() )
226
				){
227
			return true;
228
		}else{
229
			return false;
230
		}
231
	}
232
}
(19-19/36)