(no commit message)
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / name / Rank.java
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 javax.xml.bind.annotation.XmlAccessType;
13 import javax.xml.bind.annotation.XmlAccessorType;
14 import javax.xml.bind.annotation.XmlType;
15 import eu.etaxonomy.cdm.model.common.OrderedTermBase;
16 import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException;
17
18 import org.apache.log4j.Logger;
19
20 import java.util.*;
21
22 import javax.persistence.*;
23
24 /**
25 * The class representing the taxonomical ranks (like "Family", "Genus" or
26 * "Species") used for {@link TaxonNameBase taxon names} across all {@link NomenclaturalCode nomenclatural codes}
27 * for bacteria (ICNB), viruses (ICVCN), plants and fungi (ICBN),
28 * cultivars (ICNCP) and animals (ICZN).
29 * <P>
30 * A standard (ordered) list of taxonomical rank instances will be automatically
31 * created as the project starts. But this class allows to extend this standard
32 * list by creating new instances of additional taxonomical ranks if needed.
33 * <P>
34 * This class corresponds to: <ul>
35 * <li> TaxonRankTerm according to the TDWG ontology
36 * <li> TaxonomicRankEnum according to the TCS
37 * <li> Rank according to the ABCD schema
38 * </ul>
39 *
40 * @author m.doering
41 * @version 1.0
42 * @created 08-Nov-2007 13:06:46
43 */
44 @XmlAccessorType(XmlAccessType.FIELD)
45 @XmlType(name = "Rank")
46 @Entity
47 public class Rank extends OrderedTermBase<Rank> {
48 private static final Logger logger = Logger.getLogger(Rank.class);
49
50 private static final UUID uuidEmpire = UUID.fromString("ac470211-1586-4b24-95ca-1038050b618d");
51 private static final UUID uuidDomain = UUID.fromString("ffca6ec8-8b88-417b-a6a0-f7c992aac19b");
52 private static final UUID uuidSuperkingdom = UUID.fromString("64223610-7625-4cfd-83ad-b797bf7f0edd");
53 private static final UUID uuidKingdom = UUID.fromString("fbe7109d-66b3-498c-a697-c6c49c686162");
54 private static final UUID uuidSubkingdom = UUID.fromString("a71bd9d8-f3ab-4083-afb5-d89315d71655");
55 private static final UUID uuidInfrakingdom = UUID.fromString("1e37930c-86cf-44f6-90fd-7822928df260");
56 private static final UUID uuidSuperphylum = UUID.fromString("0d0cecb1-e254-4607-b210-6801e7ecbb04");
57 private static final UUID uuidPhylum = UUID.fromString("773430d2-76b4-438c-b817-97a543a33287");
58 private static final UUID uuidSubphylum = UUID.fromString("23a9b6ff-9408-49c9-bd9e-7a2ca5ab4725");
59 private static final UUID uuidInfraphylum = UUID.fromString("1701de3a-7693-42a5-a2d3-42697f944190");
60 private static final UUID uuidSuperdivision = UUID.fromString("a735a48f-4fc8-49a7-ae0c-6a984f658131");
61 private static final UUID uuidDivision = UUID.fromString("7e56f5cc-123a-4fd1-8cbb-6fd80358b581");
62 private static final UUID uuidSubdivision = UUID.fromString("931c840f-7a6b-4d76-ad38-bfdd77d7b2e8");
63 private static final UUID uuidInfradivision = UUID.fromString("c0ede273-be52-4dee-b411-66ee08d30c94");
64 private static final UUID uuidSuperclass = UUID.fromString("e65b4e1a-21ec-428d-9b9f-e87721ab967c");
65 private static final UUID uuidClass = UUID.fromString("f23d14c4-1d34-4ee6-8b4e-eee2eb9a3daf");
66 private static final UUID uuidSubclass = UUID.fromString("8cb26733-e2f5-46cb-ab5c-f99254f877aa");
67 private static final UUID uuidInfraclass = UUID.fromString("ad23cfda-879a-4021-8629-c54d27caf717");
68 private static final UUID uuidSuperorder = UUID.fromString("c8c67a22-301a-4219-b882-4a49121232ff");
69 private static final UUID uuidOrder = UUID.fromString("b0785a65-c1c1-4eb4-88c7-dbd3df5aaad1");
70 private static final UUID uuidSuborder = UUID.fromString("768ad378-fa85-42ab-b668-763225832f57");
71 private static final UUID uuidInfraorder = UUID.fromString("84099182-a6f5-47d7-8586-33c9e9955a10");
72 private static final UUID uuidSuperfamily = UUID.fromString("2cfa510a-dcea-4a03-b66a-b1528f9b0796");
73 private static final UUID uuidFamily = UUID.fromString("af5f2481-3192-403f-ae65-7c957a0f02b6");
74 private static final UUID uuidSubfamily = UUID.fromString("862526ee-7592-4760-a23a-4ff3641541c5");
75 private static final UUID uuidInfrafamily = UUID.fromString("c3f2e3bb-6eef-4a26-9fb7-b14f4c8c5e4f");
76 private static final UUID uuidSupertribe = UUID.fromString("11e94828-8c61-499b-87d6-1de35ce2c51c");
77 private static final UUID uuidTribe = UUID.fromString("4aa6890b-0363-4899-8d7c-ee0cb78e6166");
78 private static final UUID uuidSubtribe = UUID.fromString("ae41ecc5-5165-4126-9d24-79939ae5d822");
79 private static final UUID uuidInfratribe = UUID.fromString("1ec02e8f-f2b7-4c65-af9f-b436b34c79a3");
80 private static final UUID uuidSupragenericTaxon = UUID.fromString("1fdc0b93-c354-441a-8406-091e0303ff5c");
81 private static final UUID uuidGenus = UUID.fromString("1b11c34c-48a8-4efa-98d5-84f7f66ef43a");
82 private static final UUID uuidSubgenus = UUID.fromString("78786e16-2a70-48af-a608-494023b91904");
83 private static final UUID uuidInfragenus = UUID.fromString("a9972969-82cd-4d54-b693-a096422f13fa");
84 private static final UUID uuidSection = UUID.fromString("3edff68f-8527-49b5-bf91-7e4398bb975c");
85 private static final UUID uuidSubsection = UUID.fromString("d20f5b61-d463-4448-8f8a-c1ff1f262f59");
86 private static final UUID uuidSeries = UUID.fromString("d7381ecf-48f8-429b-9c54-f461656978cd");
87 private static final UUID uuidSubseries = UUID.fromString("80c9a263-f4db-4a13-b6c2-b7fec1aa1200");
88 private static final UUID uuidSpeciesAggregate = UUID.fromString("1ecae058-4217-4f75-9c27-6d8ba099ac7a");
89 private static final UUID uuidInfragenericTaxon = UUID.fromString("41bcc6ac-37d3-4fd4-bb80-3cc5b04298b9");
90 private static final UUID uuidSpecies = UUID.fromString("b301f787-f319-4ccc-a10f-b4ed3b99a86d");
91 private static final UUID uuidSubspecificAggregate = UUID.fromString("72c248b9-027d-4402-b375-dd4f0850c9ad");
92 private static final UUID uuidSubspecies = UUID.fromString("462a7819-8b00-4190-8313-88b5be81fad5");
93 private static final UUID uuidInfraspecies = UUID.fromString("f28ebc9e-bd50-4194-9af1-42f5cb971a2c");
94 private static final UUID uuidVariety = UUID.fromString("d5feb6a5-af5c-45ef-9878-bb4f36aaf490");
95 private static final UUID uuidBioVariety = UUID.fromString("a3a364cb-1a92-43fc-a717-3c44980a0991");
96 private static final UUID uuidPathoVariety = UUID.fromString("2f4f4303-a099-47e3-9048-d749d735423b");
97 private static final UUID uuidSubvariety = UUID.fromString("9a83862a-7aee-480c-a98d-4bceaf8712ca");
98 private static final UUID uuidSubsubvariety = UUID.fromString("bff22f84-553a-4429-a4e7-c4b3796c3a18");
99 private static final UUID uuidConvar = UUID.fromString("2cc740c9-cebb-43c8-9b06-1bef79e6a56a");
100 private static final UUID uuidForm = UUID.fromString("0461281e-458a-47b9-8d41-19a3d39356d5");
101 private static final UUID uuidSpecialForm = UUID.fromString("bed20aee-2f5a-4635-9c02-eff06246d067");
102 private static final UUID uuidSubform = UUID.fromString("47cfc5b0-0fb7-4ceb-b61d-e1dd8de8b569");
103 private static final UUID uuidSubsubform = UUID.fromString("1c8ac389-4349-4ae0-87be-7239f6635068");
104 private static final UUID uuidInfraspecificTaxon = UUID.fromString("eb75c27d-e154-4570-9d96-227b2df60474");
105 private static final UUID uuidCandidate = UUID.fromString("ead9a1f5-dfd4-4de2-9121-70a47accb10b");
106 private static final UUID uuidDenominationClass = UUID.fromString("49bdf74a-2170-40ed-8be2-887a0db517bf");
107 private static final UUID uuidGrex = UUID.fromString("08dcb4ff-ac58-48a3-93af-efb3d836ac84");
108 private static final UUID uuidGraftChimaera = UUID.fromString("6b4063bc-f934-4796-9bf3-0ef3aea5c1cb");
109 private static final UUID uuidCultivarGroup = UUID.fromString("d763e7d3-e7de-4bb1-9d75-225ca6948659");
110 private static final UUID uuidCultivar = UUID.fromString("5e98415b-dc6e-440b-95d6-ea33dbb39ad0");
111
112 // ************* CONSTRUCTORS *************/
113 /**
114 * Class constructor: creates a new empty rank instance.
115 *
116 * @see #Rank(String, String, String)
117 */
118 public Rank() {
119 super();
120 }
121
122 /**
123 * Class constructor: creates an additional rank instance with a description,
124 * a label and a label abbreviation.
125 *
126 * @param term the string (in the default language) describing the
127 * new rank to be created
128 * @param label the string identifying the new rank to be created
129 * @param labelAbbrev the string identifying (in abbreviated form) the
130 * new rank to be created
131 * @see #Rank()
132 */
133 public Rank(String term, String label, String labelAbbrev) {
134 super(term, label, labelAbbrev);
135 }
136
137 //********* METHODS **************************************/
138
139 /**
140 * Returns the taxonomical rank identified through its immutable universally
141 * unique identifier (UUID).
142 *
143 * @param uuid the universally unique identifier
144 * @return the rank corresponding to the given universally unique
145 * identifier
146 */
147 public static final Rank getByUuid(UUID uuid){
148 return (Rank) findByUuid(uuid);
149 }
150
151 public static final Rank EMPIRE(){
152 return getByUuid(uuidEmpire);
153 }
154 public static final Rank DOMAIN(){
155 return getByUuid(uuidDomain);
156 }
157 public static final Rank SUPERKINGDOM(){
158 return getByUuid(uuidSuperkingdom);
159 }
160 public static final Rank KINGDOM(){
161 return getByUuid(uuidKingdom);
162 }
163 public static final Rank SUBKINGDOM(){
164 return getByUuid(uuidSubkingdom);
165 }
166 public static final Rank INFRAKINGDOM(){
167 return getByUuid(uuidInfrakingdom);
168 }
169 public static final Rank SUPERPHYLUM(){
170 return getByUuid(uuidSuperphylum);
171 }
172 public static final Rank PHYLUM(){
173 return getByUuid(uuidPhylum);
174 }
175 public static final Rank SUBPHYLUM(){
176 return getByUuid(uuidSubphylum);
177 }
178 public static final Rank INFRAPHYLUM(){
179 return getByUuid(uuidInfraphylum);
180 }
181 public static final Rank SUPERDIVISION(){
182 return getByUuid(uuidSuperdivision);
183 }
184 public static final Rank DIVISION(){
185 return getByUuid(uuidDivision);
186 }
187 public static final Rank SUBDIVISION(){
188 return getByUuid(uuidSubdivision);
189 }
190 public static final Rank INFRADIVISION(){
191 return getByUuid(uuidInfradivision);
192 }
193 public static final Rank SUPERCLASS(){
194 return getByUuid(uuidSuperclass);
195 }
196 public static final Rank CLASS(){
197 return getByUuid(uuidClass);
198 }
199 public static final Rank SUBCLASS(){
200 return getByUuid(uuidSubclass);
201 }
202 public static final Rank INFRACLASS(){
203 return getByUuid(uuidInfraclass);
204 }
205 public static final Rank SUPERORDER(){
206 return getByUuid(uuidSuperorder);
207 }
208 public static final Rank ORDER(){
209 return getByUuid(uuidOrder);
210 }
211 public static final Rank SUBORDER(){
212 return getByUuid(uuidSuborder);
213 }
214 public static final Rank INFRAORDER(){
215 return getByUuid(uuidInfraorder);
216 }
217 public static final Rank SUPERFAMILY(){
218 return getByUuid(uuidSuperfamily);
219 }
220 public static final Rank FAMILY(){
221 return getByUuid(uuidFamily);
222 }
223 public static final Rank SUBFAMILY(){
224 return getByUuid(uuidSubfamily);
225 }
226 public static final Rank INFRAFAMILY(){
227 return getByUuid(uuidInfrafamily);
228 }
229 public static final Rank SUPERTRIBE(){
230 return getByUuid(uuidSupertribe);
231 }
232 public static final Rank TRIBE(){
233 return getByUuid(uuidTribe);
234 }
235 public static final Rank SUBTRIBE(){
236 return getByUuid(uuidSubtribe);
237 }
238 public static final Rank INFRATRIBE(){
239 return getByUuid(uuidInfratribe);
240 }
241 public static final Rank SUPRAGENERICTAXON(){
242 return getByUuid(uuidSupragenericTaxon);
243 }
244 public static final Rank GENUS(){
245 return getByUuid(uuidGenus);
246 }
247 public static final Rank SUBGENUS(){
248 return getByUuid(uuidSubgenus);
249 }
250 public static final Rank INFRAGENUS(){
251 return getByUuid(uuidInfragenus);
252 }
253 public static final Rank SECTION(){
254 return getByUuid(uuidSection);
255 }
256 public static final Rank SUBSECTION(){
257 return getByUuid(uuidSubsection);
258 }
259 public static final Rank SERIES(){
260 return getByUuid(uuidSeries);
261 }
262 public static final Rank SUBSERIES(){
263 return getByUuid(uuidSubseries);
264 }
265 public static final Rank SPECIESAGGREGATE(){
266 return getByUuid(uuidSpeciesAggregate);
267 }
268 public static final Rank INFRAGENERICTAXON(){
269 return getByUuid(uuidInfragenericTaxon);
270 }
271 public static final Rank SPECIES(){
272 return getByUuid(uuidSpecies);
273 }
274 public static final Rank SUBSPECIFICAGGREGATE(){
275 return getByUuid(uuidSubspecificAggregate);
276 }
277 public static final Rank SUBSPECIES(){
278 return getByUuid(uuidSubspecies);
279 }
280 public static final Rank INFRASPECIES(){
281 return getByUuid(uuidInfraspecies);
282 }
283 public static final Rank VARIETY(){
284 return getByUuid(uuidVariety);
285 }
286 public static final Rank BIOVARIETY(){
287 return getByUuid(uuidBioVariety);
288 }
289 public static final Rank PATHOVARIETY(){
290 return getByUuid(uuidPathoVariety);
291 }
292 public static final Rank SUBVARIETY(){
293 return getByUuid(uuidSubvariety);
294 }
295 public static final Rank SUBSUBVARIETY(){
296 return getByUuid(uuidSubsubvariety);
297 }
298 public static final Rank CONVAR(){
299 return getByUuid(uuidConvar);
300 }
301 public static final Rank FORM(){
302 return getByUuid(uuidForm);
303 }
304 public static final Rank SPECIALFORM(){
305 return getByUuid(uuidSpecialForm);
306 }
307 public static final Rank SUBFORM(){
308 return getByUuid(uuidSubform);
309 }
310 public static final Rank SUBSUBFORM(){
311 return getByUuid(uuidSubsubform);
312 }
313 public static final Rank INFRASPECIFICTAXON(){
314 return getByUuid(uuidInfraspecificTaxon);
315 }
316 public static final Rank CANDIDATE(){
317 return getByUuid(uuidCandidate);
318 }
319 public static final Rank DENOMINATIONCLASS(){
320 return getByUuid(uuidDenominationClass);
321 }
322 public static final Rank GREX(){
323 return getByUuid(uuidGrex);
324 }
325 public static final Rank GRAFTCHIMAERA(){
326 return getByUuid(uuidGraftChimaera);
327 }
328 public static final Rank CULTIVARGROUP(){
329 return getByUuid(uuidCultivarGroup);
330 }
331 public static final Rank CULTIVAR(){
332 return getByUuid(uuidCultivar);
333 }
334
335
336 /**
337 * Returns the boolean value indicating whether this rank is higher than
338 * the genus rank (true) or not (false). Returns false if this rank is null.
339 *
340 * @see #isGenus()
341 * @see #isInfraGeneric()
342 * @see #isSpecies()
343 * @see #isInfraSpecific()
344 */
345 @Transient
346 public boolean isSupraGeneric(){
347 return (this.isHigher(Rank.GENUS()));
348 }
349
350 /**
351 * Returns the boolean value indicating whether this rank is the genus rank
352 * (true) or not (false). Returns false if this rank is null.
353 *
354 * @see #isSupraGeneric()
355 * @see #isInfraGeneric()
356 * @see #isSpecies()
357 * @see #isInfraSpecific()
358 */
359 @Transient
360 public boolean isGenus(){
361 return (this.equals(Rank.GENUS()));
362 }
363
364 /**
365 * Returns the boolean value indicating whether this rank is higher than the
366 * species rank and lower than the genus rank (true) or not (false).
367 * Returns false if this rank is null.
368 *
369 * @see #isSupraGeneric()
370 * @see #isGenus()
371 * @see #isSpecies()
372 * @see #isInfraSpecific()
373 */
374 @Transient
375 public boolean isInfraGeneric(){
376 return (this.isLower(Rank.GENUS()) && this.isHigher(Rank.SPECIES()));
377 }
378
379 /**
380 * Returns the boolean value indicating whether this rank is the species
381 * rank (true) or not (false). Returns false if this rank is null.
382 *
383 * @see #isSupraGeneric()
384 * @see #isGenus()
385 * @see #isInfraGeneric()
386 * @see #isInfraSpecific()
387 */
388 @Transient
389 public boolean isSpecies(){
390 return (this.equals(Rank.SPECIES()));
391 }
392
393 /**
394 * Returns the boolean value indicating whether this rank is lower than the
395 * species rank (true) or not (false). Returns false if this rank is null.
396 *
397 * @see #isSupraGeneric()
398 * @see #isGenus()
399 * @see #isInfraGeneric()
400 * @see #isSpecies()
401 */
402 @Transient
403 public boolean isInfraSpecific(){
404 return (this.isLower(Rank.SPECIES()));
405 }
406
407 /**
408 * NOT YET COMPLETE !!
409 * @param strRank
410 * @return Rank
411 * @throws UnknownCdmTypeException
412 */
413 @Transient
414 public static Rank getRankByNameOrAbbreviation(String strRank)
415 throws UnknownCdmTypeException{
416 try {
417 return getRankByAbbreviation(strRank);
418 } catch (UnknownCdmTypeException e) {
419 return getRankByName(strRank);
420 }
421 }
422
423
424 /** TODO
425 * preliminary implementation for BotanicalNameParser
426 * * not yet complete
427 */
428 @Transient
429 public static Rank getRankByAbbreviation(String abbrev) throws UnknownCdmTypeException{
430 if (abbrev == null){ throw new NullPointerException("abbrev is 'null' in getRankByAbbreviation");
431 }else if (abbrev.equalsIgnoreCase("reg.")){ return Rank.KINGDOM();
432 }else if (abbrev.equalsIgnoreCase("subreg.")){ return Rank.SUBKINGDOM();
433 }else if (abbrev.equalsIgnoreCase("phyl.")){return Rank.PHYLUM();
434 }else if (abbrev.equalsIgnoreCase("subphyl.")) { return Rank.SUBPHYLUM();
435 }else if (abbrev.equalsIgnoreCase("div.")) { return Rank.DIVISION();
436 }else if (abbrev.equalsIgnoreCase("subdiv.")) { return Rank.SUBDIVISION();
437 }else if (abbrev.equalsIgnoreCase("cl.")) { return Rank.CLASS();
438 }else if (abbrev.equalsIgnoreCase("subcl.")) { return Rank.SUBCLASS();
439 }else if (abbrev.equalsIgnoreCase("superor.")) { return Rank.SUPERORDER();
440 }else if (abbrev.equalsIgnoreCase("ordo")) { return Rank.ORDER();
441 }else if (abbrev.equalsIgnoreCase("subor.")) { return Rank.SUBORDER();
442 }else if (abbrev.equalsIgnoreCase("fam.")) { return Rank.FAMILY();
443 }else if (abbrev.equalsIgnoreCase("subfam.")) { return Rank.SUBFAMILY();
444 }else if (abbrev.equalsIgnoreCase("trib.")) { return Rank.TRIBE();
445 }else if (abbrev.equalsIgnoreCase("subtrib.")) { return Rank.SUBTRIBE();
446 }else if (abbrev.equalsIgnoreCase("gen.")) { return Rank.GENUS();
447 }else if (abbrev.equalsIgnoreCase("subg.")) { return Rank.SUBGENUS();
448 }else if (abbrev.equalsIgnoreCase("sect.")) { return Rank.SECTION();
449 }else if (abbrev.equalsIgnoreCase("subsect.")) { return Rank.SUBSECTION();
450 }else if (abbrev.equalsIgnoreCase("ser.")) { return Rank.SERIES();
451 }else if (abbrev.equalsIgnoreCase("subser.")) { return Rank.SUBSERIES();
452 }else if (abbrev.equalsIgnoreCase("aggr.")) { return Rank.SPECIESAGGREGATE();
453 //TODO
454 //}else if (abbrev.equalsIgnoreCase("group")) { return Rank.SPECIESGROUP();
455 }else if (abbrev.equalsIgnoreCase("sp.")) { return Rank.SPECIES();
456 }else if (abbrev.equalsIgnoreCase("subsp.")) { return Rank.SUBSPECIES();
457 }else if (abbrev.equalsIgnoreCase("convar.")) { return Rank.CONVAR();
458 }else if (abbrev.equalsIgnoreCase("var.")) { return Rank.VARIETY();
459 }else if (abbrev.equalsIgnoreCase("subvar.")) { return Rank.SUBVARIETY();
460 }else if (abbrev.equalsIgnoreCase("f.")) { return Rank.FORM();
461 }else if (abbrev.equalsIgnoreCase("subf.")) { return Rank.SUBFORM();
462 //TODO
463 //}else if (abbrev.equalsIgnoreCase("f.spec.")) { return Rank.FORMA_SPEC();
464 }else if (abbrev.equalsIgnoreCase("t.infgen.")) { return Rank.INFRAGENERICTAXON();
465 }else if (abbrev.equalsIgnoreCase("t.infr.")) { return Rank.INFRASPECIFICTAXON();
466 }else {
467 if (abbrev == null){
468 abbrev = "(null)";
469 }
470 throw new UnknownCdmTypeException("Unknown rank abbreviation: " + abbrev);
471 }
472 }
473
474 /** TODO
475 * preliminary implementation for BotanicalNameParser
476 * not yet complete
477 */
478 @Transient
479 public static Rank getRankByName(String rankName)
480 throws UnknownCdmTypeException{
481 if (rankName.equalsIgnoreCase("Regnum")){ return Rank.KINGDOM();
482 }else if (rankName.equalsIgnoreCase("Subregnum")){ return Rank.SUBKINGDOM();
483 }else if (rankName.equalsIgnoreCase("Phylum")){ return Rank.PHYLUM();
484 }else if (rankName.equalsIgnoreCase("subphylum")){ return Rank.SUBPHYLUM();
485 }else if (rankName.equalsIgnoreCase("Divisio")){ return Rank.DIVISION();
486 }else if (rankName.equalsIgnoreCase("Subdivisio")){ return Rank.SUBDIVISION();
487 }else if (rankName.equalsIgnoreCase("Classis")){ return Rank.CLASS();
488 }else if (rankName.equalsIgnoreCase("Subclassis")){ return Rank.SUBCLASS();
489 }else if (rankName.equalsIgnoreCase("Superordo")){ return Rank.SUPERORDER();
490 }else if (rankName.equalsIgnoreCase("Ordo")){ return Rank.ORDER();
491 }else if (rankName.equalsIgnoreCase("Subordo")){ return Rank.SUBORDER();
492 }else if (rankName.equalsIgnoreCase("Familia")){ return Rank.FAMILY();
493 }else if (rankName.equalsIgnoreCase("Subfamilia")){ return Rank.SUBFAMILY();
494 }else if (rankName.equalsIgnoreCase("Tribus")){ return Rank.TRIBE();
495 }else if (rankName.equalsIgnoreCase("Subtribus")){ return Rank.SUBTRIBE();
496 }else if (rankName.equalsIgnoreCase("Genus")){ return Rank.GENUS();
497 }else if (rankName.equalsIgnoreCase("Subgenus")){ return Rank.SUBGENUS();
498 }else if (rankName.equalsIgnoreCase("Sectio")){ return Rank.SECTION();
499 }else if (rankName.equalsIgnoreCase("Subsectio")){ return Rank.SUBSECTION();
500 }else if (rankName.equalsIgnoreCase("Series")){ return Rank.SERIES();
501 }else if (rankName.equalsIgnoreCase("Subseries")){ return Rank.SUBSERIES();
502 }else if (rankName.equalsIgnoreCase("Aggregate")){ return Rank.SPECIESAGGREGATE();
503 //TODO
504 //}else if (rankName.equalsIgnoreCase("Speciesgroup")){ return Rank.SPECIESGROUP();
505 }else if (rankName.equalsIgnoreCase("Species")){ return Rank.SPECIES();
506 }else if (rankName.equalsIgnoreCase("Subspecies")){ return Rank.SUBSPECIES();
507 }else if (rankName.equalsIgnoreCase("Convarietas")){ return Rank.CONVAR();
508 }else if (rankName.equalsIgnoreCase("Varietas")){ return Rank.VARIETY();
509 }else if (rankName.equalsIgnoreCase("Subvarietas")){ return Rank.SUBVARIETY();
510 }else if (rankName.equalsIgnoreCase("Forma")){ return Rank.FORM();
511 }else if (rankName.equalsIgnoreCase("Subforma")){ return Rank.SUBFORM();
512 }else if (rankName.equalsIgnoreCase("Forma spec.")){ return Rank.SPECIALFORM();
513 }else if (rankName.equalsIgnoreCase("tax.infragen.")){ return Rank.INFRAGENERICTAXON();
514 }else if (rankName.equalsIgnoreCase("tax.infrasp.")){ return Rank.INFRASPECIFICTAXON();
515 // old ranks
516 }else if (rankName.equalsIgnoreCase("proles")){ return Rank.INFRASPECIFICTAXON(); //to create the name put prol. and the infraspeciesepi to the field unnamed namephrase
517 }else if (rankName.equalsIgnoreCase("race")){ return Rank.INFRASPECIFICTAXON(); //to create the name put prol. and the infraspeciesepi to the field unnamed namephrase
518 }else if (rankName.equalsIgnoreCase("taxon")){ return Rank.INFRASPECIFICTAXON(); //to create the name put prol. and the infraspeciesepi to the field unnamed namephrase
519 }else if (rankName.equalsIgnoreCase("sublusus")){ return Rank.INFRASPECIFICTAXON(); //to create the name put prol. and the infraspeciesepi to the field unnamed namephrase
520
521 }else{
522 if (rankName == null){
523 rankName = "(null)";
524 }
525 throw new UnknownCdmTypeException("Unknown rank name: " + rankName);
526 }
527 }
528
529 //TODO
530 //dummy implementation for BerlinModelImport
531 @Transient
532 public String getAbbreviation(){
533 if (this.equals(Rank.ORDER()) ){return "ordo";}
534 if (this.equals(Rank.FAMILY()) ){return "fam.";}
535 else if (this.equals(Rank.SUBFAMILY()) ){return "subfam.";}
536 else if (this.equals(Rank.TRIBE()) ){return "trib.";}
537 else if (this.equals(Rank.SUBTRIBE()) ){return "subtrib.";}
538 else if (this.equals(Rank.GENUS()) ){return "gen.";}
539 else if (this.equals(Rank.SUBGENUS()) ){return "subg.";}
540 else if (this.equals(Rank.SECTION()) ){return "sect.";}
541 else if (this.equals(Rank.SUBSECTION()) ){return "subsect.";}
542 else if (this.equals(Rank.SERIES()) ){return "ser.";}
543 //else if (this.equals(Rank.AGGREGATE()) ){return "aggr.";}
544 else if (this.equals(Rank.SPECIES()) ){return "sp.";}
545 else if (this.equals(Rank.SUBSPECIES()) ){return "subsp.";}
546 else if (this.equals(Rank.VARIETY()) ){return "var.";}
547 else if (this.equals(Rank.CONVAR()) ){return "convar.";}
548 else if (this.equals(Rank.SUBVARIETY()) ){return "subvar.";}
549 else if (this.equals(Rank.FORM()) ){return "var.";}
550 else if (this.equals(Rank.SPECIALFORM()) ){return "f.spec.";}
551 else if (this.equals(Rank.INFRAGENERICTAXON()) ){return "t.infgen.";}
552 else if (this.equals(Rank.INFRASPECIFICTAXON()) ){return "t.infr.";}
553 else {
554 logger.warn("Abbreviation for this Rank " + this.toString() + " not yet implemented");
555 return "xxx.";
556 }
557
558
559
560 }
561
562
563
564
565 }