278a3d3ba53cf2a9758b3044f2a6eec7f5c19e48
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.model
.name
;
12 import java
.io
.Serializable
;
14 import java
.util
.UUID
;
16 import javax
.xml
.bind
.annotation
.XmlEnum
;
17 import javax
.xml
.bind
.annotation
.XmlEnumValue
;
19 import org
.apache
.log4j
.Logger
;
21 import eu
.etaxonomy
.cdm
.model
.common
.EnumeratedTermVoc
;
22 import eu
.etaxonomy
.cdm
.model
.common
.IEnumTerm
;
23 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
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
36 public enum RankClass
implements IEnumTerm
<RankClass
>, Serializable
{
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.
44 @XmlEnumValue("Unknown")
45 @Deprecated Unknown(UUID
.fromString("8c99ba63-2904-4dbb-87cb-3d3d7467e95d"), "Unknown rank class","UN", null),
49 * Class of ranks higher than {@link Rank#GENUS()}
51 @XmlEnumValue("Suprageneric")
52 Suprageneric(UUID
.fromString("439a7897-9e0d-4560-b238-459d827f8a70"), "Suprageneric", "SG", null),
56 * Class of ranks equal to {@link Rank#GENUS()}. It is expected that there is only 1 such rank.
58 @XmlEnumValue("Genus")
59 Genus(UUID
.fromString("86de25dc-3594-462f-a716-6d008caf2662"), "Genus", "GE", null),
63 * Class of ranks below {@link Rank#GENUS()} and above {@link Rank#SPECIES()}.
64 * This class includes {@link #SpeciesGroup species groups}
66 @XmlEnumValue("Infrageneric")
67 Infrageneric(UUID
.fromString("37d5b535-3bf9-4749-af66-1a1c089dc0ae"), "Rank", "IG", null),
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.
75 @XmlEnumValue("SpeciesGroup")
76 SpeciesGroup(UUID
.fromString("702edcb7-ee53-45b7-8635-efcbbfd69bca"), "Species group or aggr.", "AG", Infrageneric
),
80 * Class of ranks equal to {@link Rank#SPECIES()}. It is expected that there is only 1 such rank.
82 @XmlEnumValue("Species")
83 Species(UUID
.fromString("74cc173b-788e-4b01-9d70-a988498458b7"), "Species", "SP", null),
87 * Class of ranks lower than {@link Rank#SPECIES()}
89 @XmlEnumValue("Infraspecific")
90 Infraspecific(UUID
.fromString("25915b4c-7f07-442f-bdaa-9d0223f6be42"), "Infraspecific", "IS", null),
95 @SuppressWarnings("unused")
96 private static final Logger logger
= Logger
.getLogger(RankClass
.class);
100 private RankClass(UUID uuid
, String defaultString
, String key
, RankClass parent
){
101 delegateVocTerm
= EnumeratedTermVoc
.addTerm(getClass(), this, uuid
, defaultString
, key
, parent
);
104 // *************************** DELEGATE **************************************/
106 private static EnumeratedTermVoc
<RankClass
> delegateVoc
;
107 private IEnumTerm
<RankClass
> delegateVocTerm
;
110 delegateVoc
= EnumeratedTermVoc
.getVoc(RankClass
.class);
114 public String
getKey(){return delegateVocTerm
.getKey();}
117 public String
getMessage(){return delegateVocTerm
.getMessage();}
120 public String
getMessage(Language language
){return delegateVocTerm
.getMessage(language
);}
123 public UUID
getUuid() {return delegateVocTerm
.getUuid();}
126 public RankClass
getKindOf() {return delegateVocTerm
.getKindOf();}
129 public Set
<RankClass
> getGeneralizationOf() {return delegateVocTerm
.getGeneralizationOf();}
132 public boolean isKindOf(RankClass ancestor
) {return delegateVocTerm
.isKindOf(ancestor
); }
135 public Set
<RankClass
> getGeneralizationOf(boolean recursive
) {return delegateVocTerm
.getGeneralizationOf(recursive
);}
139 public static RankClass
getByKey(String key
){return delegateVoc
.getByKey(key
);}
140 public static RankClass
getByUuid(UUID uuid
) {return delegateVoc
.getByUuid(uuid
);}