Project

General

Profile

Download (4.67 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.Set;
13
import java.util.UUID;
14

    
15
import javax.xml.bind.annotation.XmlEnum;
16
import javax.xml.bind.annotation.XmlEnumValue;
17

    
18
import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
19

    
20
import eu.etaxonomy.cdm.model.common.Language;
21
import eu.etaxonomy.cdm.model.term.EnumeratedTermVoc;
22
import eu.etaxonomy.cdm.model.term.IEnumTerm;
23

    
24
/**
25
 * The rank class defines the category of ranks a certain rank belongs to. This information is
26
 * usually needed for correct formatting of taxon name text representations by using e.g.
27
 * {@link Rank#isSupraGeneric()} . Prior to v3.3 this was computed by comparison of ranks.
28
 * The current solution makes such methods less dependend on term loading.<BR>
29
 * @see https://dev.e-taxonomy.eu/redmine/issues/3521
30
 *
31
 * @author a.mueller
32
 * @since 11.06.2013
33
 */
34
@XmlEnum
35
public enum RankClass implements IEnumTerm<RankClass>{
36

    
37
	//0
38
	/**
39
	 * Unknown rank class is to be used if no information is available about the rank class.
40
	 * In the current model this type should never be used. However, it is a placeholder in case
41
	 * we find an appropriate usage in future and in case one needs a short term dummy.
42
	 */
43
	@XmlEnumValue("Unknown")
44
	@Deprecated Unknown(UUID.fromString("8c99ba63-2904-4dbb-87cb-3d3d7467e95d"), "Unknown rank class","UN", null),
45

    
46
	//1
47
	/**
48
	 * Class of ranks higher than {@link Rank#GENUS()}
49
	 */
50
	@XmlEnumValue("Suprageneric")
51
	Suprageneric(UUID.fromString("439a7897-9e0d-4560-b238-459d827f8a70"), "Suprageneric", "SG", null),
52

    
53
	//2
54
	/**
55
	 * Class of ranks equal to {@link Rank#GENUS()}. It is expected that there is only 1 such rank.
56
	 */
57
	@XmlEnumValue("Genus")
58
	Genus(UUID.fromString("86de25dc-3594-462f-a716-6d008caf2662"), "Genus", "GE", null),
59

    
60
	//3
61
	/**
62
	 * Class of ranks below {@link Rank#GENUS()} and above {@link Rank#SPECIES()}.
63
	 * This class includes {@link #SpeciesGroup species groups}
64
	 */
65
	@XmlEnumValue("Infrageneric")
66
	Infrageneric(UUID.fromString("37d5b535-3bf9-4749-af66-1a1c089dc0ae"), "Rank", "IG", null),
67

    
68
	//4
69
	/**
70
	 * Class of ranks directly above {@link Rank#SPECIES()} which are used to group certain species
71
	 * e.g. for better usability.
72
	 * This class is part of the {@link #Infrageneric} class but different nomenclatural rules are applied.
73
	 */
74
	@XmlEnumValue("SpeciesGroup")
75
	SpeciesGroup(UUID.fromString("702edcb7-ee53-45b7-8635-efcbbfd69bca"), "Species group or aggr.", "AG", Infrageneric),
76

    
77
	//5
78
	/**
79
	 * Class of ranks equal to {@link Rank#SPECIES()}. It is expected that there is only 1 such rank.
80
	 */
81
	@XmlEnumValue("Species")
82
	Species(UUID.fromString("74cc173b-788e-4b01-9d70-a988498458b7"), "Species", "SP", null),
83

    
84
	//6
85
	/**
86
	 * Class of ranks lower than {@link Rank#SPECIES()}
87
	 */
88
	@XmlEnumValue("Infraspecific")
89
	Infraspecific(UUID.fromString("25915b4c-7f07-442f-bdaa-9d0223f6be42"), "Infraspecific", "IS", null),
90

    
91
	;
92

    
93

    
94
	@SuppressWarnings("unused")
95
	private static final Logger logger = LogManager.getLogger(RankClass.class);
96

    
97

    
98

    
99
	private RankClass(UUID uuid, String defaultString, String key, RankClass parent){
100
		delegateVocTerm = EnumeratedTermVoc.addTerm(getClass(), this, uuid, defaultString, key, parent);
101
	}
102

    
103
// *************************** DELEGATE **************************************/
104

    
105
	private static EnumeratedTermVoc<RankClass> delegateVoc;
106
	private IEnumTerm<RankClass> delegateVocTerm;
107

    
108
	static {
109
		delegateVoc = EnumeratedTermVoc.getVoc(RankClass.class);
110
	}
111

    
112
	@Override
113
	public String getKey(){return delegateVocTerm.getKey();}
114

    
115
	@Override
116
    public String getLabel(){return delegateVocTerm.getLabel();}
117

    
118
	@Override
119
    public String getLabel(Language language){return delegateVocTerm.getLabel(language);}
120

    
121
	@Override
122
    public UUID getUuid() {return delegateVocTerm.getUuid();}
123

    
124
	@Override
125
    public RankClass getKindOf() {return delegateVocTerm.getKindOf();}
126

    
127
	@Override
128
    public Set<RankClass> getGeneralizationOf() {return delegateVocTerm.getGeneralizationOf();}
129

    
130
	@Override
131
	public boolean isKindOf(RankClass ancestor) {return delegateVocTerm.isKindOf(ancestor);	}
132

    
133
	@Override
134
    public Set<RankClass> getGeneralizationOf(boolean recursive) {return delegateVocTerm.getGeneralizationOf(recursive);}
135

    
136

    
137

    
138
	public static RankClass getByKey(String key){return delegateVoc.getByKey(key);}
139
    public static RankClass getByUuid(UUID uuid) {return delegateVoc.getByUuid(uuid);}
140

    
141

    
142
}
(27-27/39)