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