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