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