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.io.Serializable;
|
13
|
import java.util.Set;
|
14
|
import java.util.UUID;
|
15
|
|
16
|
import javax.xml.bind.annotation.XmlEnum;
|
17
|
import javax.xml.bind.annotation.XmlEnumValue;
|
18
|
|
19
|
import org.apache.log4j.Logger;
|
20
|
|
21
|
import eu.etaxonomy.cdm.model.common.EnumeratedTermVoc;
|
22
|
import eu.etaxonomy.cdm.model.common.IEnumTerm;
|
23
|
import eu.etaxonomy.cdm.model.common.Language;
|
24
|
|
25
|
/**
|
26
|
* The rank class defines the category of ranks a certain rank belongs to. This information is
|
27
|
* usually needed for correct formatting of taxon name text representations by using e.g.
|
28
|
* {@link Rank#isSupraGeneric()} . Prior to v3.3 this was computed by comparison of ranks.
|
29
|
* The current solution makes such methods less dependend on term loading.<BR>
|
30
|
* @see http://dev.e-taxonomy.eu/trac/ticket/3521
|
31
|
*
|
32
|
* @author a.mueller
|
33
|
* @since 11.06.2013
|
34
|
*/
|
35
|
@XmlEnum
|
36
|
public enum RankClass implements IEnumTerm<RankClass>, Serializable{
|
37
|
|
38
|
//0
|
39
|
/**
|
40
|
* Unknown rank class is to be used if no information is available about the rank class.
|
41
|
* In the current model this type should never be used. However, it is a placeholder in case
|
42
|
* we find an appropriate usage in future and in case one needs a short term dummy.
|
43
|
*/
|
44
|
@XmlEnumValue("Unknown")
|
45
|
@Deprecated Unknown(UUID.fromString("8c99ba63-2904-4dbb-87cb-3d3d7467e95d"), "Unknown rank class","UN", null),
|
46
|
|
47
|
//1
|
48
|
/**
|
49
|
* Class of ranks higher than {@link Rank#GENUS()}
|
50
|
*/
|
51
|
@XmlEnumValue("Suprageneric")
|
52
|
Suprageneric(UUID.fromString("439a7897-9e0d-4560-b238-459d827f8a70"), "Suprageneric", "SG", null),
|
53
|
|
54
|
//2
|
55
|
/**
|
56
|
* Class of ranks equal to {@link Rank#GENUS()}. It is expected that there is only 1 such rank.
|
57
|
*/
|
58
|
@XmlEnumValue("Genus")
|
59
|
Genus(UUID.fromString("86de25dc-3594-462f-a716-6d008caf2662"), "Genus", "GE", null),
|
60
|
|
61
|
//3
|
62
|
/**
|
63
|
* Class of ranks below {@link Rank#GENUS()} and above {@link Rank#SPECIES()}.
|
64
|
* This class includes {@link #SpeciesGroup species groups}
|
65
|
*/
|
66
|
@XmlEnumValue("Infrageneric")
|
67
|
Infrageneric(UUID.fromString("37d5b535-3bf9-4749-af66-1a1c089dc0ae"), "Rank", "IG", null),
|
68
|
|
69
|
//4
|
70
|
/**
|
71
|
* Class of ranks directly above {@link Rank#SPECIES()} which are used to group certain species
|
72
|
* e.g. for better usability.
|
73
|
* This class is part of the {@link #Infrageneric} class but different nomenclatural rules are applied.
|
74
|
*/
|
75
|
@XmlEnumValue("SpeciesGroup")
|
76
|
SpeciesGroup(UUID.fromString("702edcb7-ee53-45b7-8635-efcbbfd69bca"), "Species group or aggr.", "AG", Infrageneric),
|
77
|
|
78
|
//5
|
79
|
/**
|
80
|
* Class of ranks equal to {@link Rank#SPECIES()}. It is expected that there is only 1 such rank.
|
81
|
*/
|
82
|
@XmlEnumValue("Species")
|
83
|
Species(UUID.fromString("74cc173b-788e-4b01-9d70-a988498458b7"), "Species", "SP", null),
|
84
|
|
85
|
//6
|
86
|
/**
|
87
|
* Class of ranks lower than {@link Rank#SPECIES()}
|
88
|
*/
|
89
|
@XmlEnumValue("Infraspecific")
|
90
|
Infraspecific(UUID.fromString("25915b4c-7f07-442f-bdaa-9d0223f6be42"), "Infraspecific", "IS", null),
|
91
|
|
92
|
;
|
93
|
|
94
|
|
95
|
@SuppressWarnings("unused")
|
96
|
private static final Logger logger = Logger.getLogger(RankClass.class);
|
97
|
|
98
|
|
99
|
|
100
|
private RankClass(UUID uuid, String defaultString, String key, RankClass parent){
|
101
|
delegateVocTerm = EnumeratedTermVoc.addTerm(getClass(), this, uuid, defaultString, key, parent);
|
102
|
}
|
103
|
|
104
|
// *************************** DELEGATE **************************************/
|
105
|
|
106
|
private static EnumeratedTermVoc<RankClass> delegateVoc;
|
107
|
private IEnumTerm<RankClass> delegateVocTerm;
|
108
|
|
109
|
static {
|
110
|
delegateVoc = EnumeratedTermVoc.getVoc(RankClass.class);
|
111
|
}
|
112
|
|
113
|
@Override
|
114
|
public String getKey(){return delegateVocTerm.getKey();}
|
115
|
|
116
|
@Override
|
117
|
public String getMessage(){return delegateVocTerm.getMessage();}
|
118
|
|
119
|
@Override
|
120
|
public String getMessage(Language language){return delegateVocTerm.getMessage(language);}
|
121
|
|
122
|
@Override
|
123
|
public UUID getUuid() {return delegateVocTerm.getUuid();}
|
124
|
|
125
|
@Override
|
126
|
public RankClass getKindOf() {return delegateVocTerm.getKindOf();}
|
127
|
|
128
|
@Override
|
129
|
public Set<RankClass> getGeneralizationOf() {return delegateVocTerm.getGeneralizationOf();}
|
130
|
|
131
|
@Override
|
132
|
public boolean isKindOf(RankClass ancestor) {return delegateVocTerm.isKindOf(ancestor); }
|
133
|
|
134
|
@Override
|
135
|
public Set<RankClass> getGeneralizationOf(boolean recursive) {return delegateVocTerm.getGeneralizationOf(recursive);}
|
136
|
|
137
|
|
138
|
|
139
|
public static RankClass getByKey(String key){return delegateVoc.getByKey(key);}
|
140
|
public static RankClass getByUuid(UUID uuid) {return delegateVoc.getByUuid(uuid);}
|
141
|
|
142
|
|
143
|
}
|