Project

General

Profile

Download (7.82 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.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
23
import org.hibernate.envers.Audited;
24

    
25
import eu.etaxonomy.cdm.model.term.TermType;
26
import eu.etaxonomy.cdm.model.term.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.term.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 = LogManager.getLogger(NameTypeDesignationStatus.class);
44

    
45
	private static final UUID uuidOriginalDesignation = UUID.fromString("40032a44-973b-4a64-b25e-76f86c3a753c");
46
	private static final UUID uuidMonotypy = UUID.fromString("3fc639b2-9a64-45f8-9a81-657a4043ad74");
47
    private static final UUID uuidAutomatic = UUID.fromString("e89d8b21-615a-4602-913f-1625bf39a69f");
48
	private static final UUID uuidNotApplicable = UUID.fromString("91a9d6a9-7754-41cd-9f7e-be136f599f7e");
49
	private static final UUID uuidTautonymy = UUID.fromString("84521f09-3e10-43f5-aa6f-2173a55a6790");
50

    
51
	private static final UUID uuidLectotype = UUID.fromString("4177c938-b741-40e1-95e5-4c53bd1ed87d");
52
	private static final UUID uuidSubsequentMonotypy = UUID.fromString("2b5806d8-31b0-406e-a32a-4adac0c89ae4");
53
    private static final UUID uuidSubsequentDesignation = UUID.fromString("3e449e7d-a03c-4431-a7d3-aa258406f6b2");
54
    private static final UUID uuidPresentDesignation = UUID.fromString("e5f38f5d-995d-4470-a036-1a9792a543fc");
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 || termMap.isEmpty()){
76
            return getTermByClassAndUUID(NameTypeDesignationStatus.class, uuid);
77
        } else {
78
            return termMap.get(uuid);
79
        }
80
	}
81

    
82
	//********************************** Constructor *********************************/
83

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

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

    
94
//************************** METHODS ********************************
95

    
96
	@Override
97
	public void resetTerms(){
98
		termMap = null;
99
	}
100

    
101

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

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

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

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

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

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

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

    
176

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

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

    
195

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

    
204
	//#8140
205
	@Override
206
    @Transient
207
	public boolean hasDesignationSource(){
208
		if (
209
				this.equals(LECTOTYPE()) ||
210
				this.equals(SUBSEQUENT_DESIGNATION()) ||
211
				this.equals(SUBSEQUENT_MONOTYPY()) ||
212
                this.equals(PRESENT_DESIGNATION() )
213
				){
214
			return true;
215
		}else{
216
			return false;
217
		}
218
	}
219

    
220
}
(19-19/39)