3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.cdm
.model
.name
;
13 import java
.io
.Serializable
;
15 import java
.util
.UUID
;
17 import javax
.xml
.bind
.annotation
.XmlEnum
;
18 import javax
.xml
.bind
.annotation
.XmlEnumValue
;
20 import org
.apache
.log4j
.Logger
;
22 import eu
.etaxonomy
.cdm
.model
.common
.EnumeratedTermVoc
;
23 import eu
.etaxonomy
.cdm
.model
.common
.IEnumTerm
;
24 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
27 * The rank class defines the category of ranks a certain rank belongs to. This information is
28 * usually needed for correct formatting of taxon name text representations by using e.g.
29 * {@link Rank#isSupraGeneric()} . Prior to v3.3 this was computed by comparison of ranks.
30 * The current solution makes such methods less dependend on term loading.<BR>
31 * @see http://dev.e-taxonomy.eu/trac/ticket/3521
37 public enum RankClass
implements IEnumTerm
<RankClass
>, Serializable
{
41 * Unknown rank class is to be used if no information is available about the rank class.
42 * In the current model this type should never be used. However, it is a placeholder in case
43 * we find an appropriate usage in future and in case one needs a short term dummy.
45 @XmlEnumValue("Unknown")
46 @Deprecated Unknown(UUID
.fromString("8c99ba63-2904-4dbb-87cb-3d3d7467e95d"), "Unknown rank class","UN", null),
50 * Class of ranks higher than {@link Rank#GENUS()}
52 @XmlEnumValue("Suprageneric")
53 Suprageneric(UUID
.fromString("439a7897-9e0d-4560-b238-459d827f8a70"), "Suprageneric", "SG", null),
57 * Class of ranks equal to {@link Rank#GENUS()}. It is expected that there is only 1 such rank.
59 @XmlEnumValue("Genus")
60 Genus(UUID
.fromString("86de25dc-3594-462f-a716-6d008caf2662"), "Genus", "GE", null),
64 * Class of ranks below {@link Rank#GENUS()} and above {@link Rank#SPECIES()}.
65 * This class includes {@link #SpeciesGroup species groups}
67 @XmlEnumValue("Infrageneric")
68 Infrageneric(UUID
.fromString("37d5b535-3bf9-4749-af66-1a1c089dc0ae"), "Rank", "IG", null),
72 * Class of ranks directly above {@link Rank#SPECIES()} which are used to group certain species
73 * e.g. for better usability.
74 * This class is part of the {@link #Infrageneric} class but different nomenclatural rules are applied.
76 @XmlEnumValue("SpeciesGroup")
77 SpeciesGroup(UUID
.fromString("702edcb7-ee53-45b7-8635-efcbbfd69bca"), "Species group or aggr.", "AG", Infrageneric
),
81 * Class of ranks equal to {@link Rank#SPECIES()}. It is expected that there is only 1 such rank.
83 @XmlEnumValue("Species")
84 Species(UUID
.fromString("74cc173b-788e-4b01-9d70-a988498458b7"), "Species", "SP", null),
88 * Class of ranks lower than {@link Rank#SPECIES()}
90 @XmlEnumValue("Infraspecific")
91 Infraspecific(UUID
.fromString("25915b4c-7f07-442f-bdaa-9d0223f6be42"), "Infraspecific", "IS", null),
96 @SuppressWarnings("unused")
97 private static final Logger logger
= Logger
.getLogger(RankClass
.class);
101 private RankClass(UUID uuid
, String defaultString
, String key
, RankClass parent
){
102 delegateVocTerm
= EnumeratedTermVoc
.addTerm(getClass(), this, uuid
, defaultString
, key
, parent
);
105 // *************************** DELEGATE **************************************/
107 private static EnumeratedTermVoc
<RankClass
> delegateVoc
;
108 private IEnumTerm
<RankClass
> delegateVocTerm
;
111 delegateVoc
= EnumeratedTermVoc
.getVoc(RankClass
.class);
115 public String
getKey(){return delegateVocTerm
.getKey();}
118 public String
getMessage(){return delegateVocTerm
.getMessage();}
121 public String
getMessage(Language language
){return delegateVocTerm
.getMessage(language
);}
124 public UUID
getUuid() {return delegateVocTerm
.getUuid();}
127 public RankClass
getKindOf() {return delegateVocTerm
.getKindOf();}
130 public Set
<RankClass
> getGeneralizationOf() {return delegateVocTerm
.getGeneralizationOf();}
133 public boolean isKindOf(RankClass ancestor
) {return delegateVocTerm
.isKindOf(ancestor
); }
136 public Set
<RankClass
> getGeneralizationOf(boolean recursive
) {return delegateVocTerm
.getGeneralizationOf(recursive
);}
140 public static RankClass
getByKey(String key
){return delegateVoc
.getByKey(key
);}
141 public static RankClass
getByUuid(UUID uuid
) {return delegateVoc
.getByUuid(uuid
);}