1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
|
11
|
package eu.etaxonomy.cdm.io.redlist.gefaesspflanzen;
|
12
|
|
13
|
import org.apache.log4j.Logger;
|
14
|
|
15
|
import eu.etaxonomy.cdm.io.common.mapping.InputTransformerBase;
|
16
|
import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException;
|
17
|
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
|
18
|
import eu.etaxonomy.cdm.model.name.Rank;
|
19
|
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
|
20
|
|
21
|
/**
|
22
|
*
|
23
|
* @author pplitzner
|
24
|
* @date Mar 1, 2016
|
25
|
*
|
26
|
*/
|
27
|
@SuppressWarnings("serial")
|
28
|
public final class RedListGefaesspflanzenTransformer extends InputTransformerBase {
|
29
|
|
30
|
@SuppressWarnings("unused")
|
31
|
private static final Logger logger = Logger.getLogger(RedListGefaesspflanzenTransformer.class);
|
32
|
|
33
|
@Override
|
34
|
public Rank getRankByKey(String key) throws UndefinedTransformerMethodException {
|
35
|
if (key == null){return null;}
|
36
|
if (key.equals("GAT")){return Rank.GENUS();}
|
37
|
else if (key.equals("SPE")){return Rank.SPECIES();}
|
38
|
else if (key.equals("VAR")){return Rank.VARIETY();}
|
39
|
else if (key.equals("SSP")){return Rank.SUBSPECIES();}
|
40
|
else if (key.equals("FOR")){return Rank.FORM();}
|
41
|
else if (key.equals("RAC")){return Rank.RACE();}
|
42
|
else if (key.equals("SEC")){return Rank.SECTION_BOTANY();}
|
43
|
else if (key.equals("SSE")){return Rank.SUBSECTION_BOTANY();}
|
44
|
else if (key.equals("SGE")){return Rank.SUBGENUS();}
|
45
|
else if (key.equals("SVA")){return Rank.SUBVARIETY();}
|
46
|
else if (key.equals("CV")){return Rank.CULTIVAR();}
|
47
|
else if (key.equals("PRO")){return Rank.PROLES();}
|
48
|
else if (key.equals("SER")){return Rank.SERIES();}
|
49
|
else if (key.equals("GRE")){return Rank.GREX();}
|
50
|
else if (key.equals("AGG")){return Rank.SPECIESAGGREGATE();}
|
51
|
else if (key.equals("GRO") || key.equals("GRU")){return Rank.SPECIESGROUP();}
|
52
|
else if (key.equals("ORA")){return null;}
|
53
|
else if (key.equals("?")){return Rank.UNKNOWN_RANK();}
|
54
|
return null;
|
55
|
}
|
56
|
|
57
|
@Override
|
58
|
public NomenclaturalStatusType getNomenclaturalStatusByKey(String key) throws UndefinedTransformerMethodException {
|
59
|
if (key == null){return null;}
|
60
|
if (key.equals("nom. cons.")){return NomenclaturalStatusType.CONSERVED();}
|
61
|
else if (key.equals("nom. illeg.")){return NomenclaturalStatusType.ILLEGITIMATE();}
|
62
|
else if (key.equals("nom. inval.")){return NomenclaturalStatusType.INVALID();}
|
63
|
else if (key.equals("nom. ambig.")){return NomenclaturalStatusType.AMBIGUOUS();}
|
64
|
else if (key.equals("nom. nud.")){return NomenclaturalStatusType.NUDUM();}
|
65
|
else if (key.equals("nom. rejic.")){return NomenclaturalStatusType.REJECTED();}
|
66
|
else if (key.equals("nom. utique rejic.")){return NomenclaturalStatusType.UTIQUE_REJECTED();}
|
67
|
else if (key.equals("nom. utique rejic. pro.")){return NomenclaturalStatusType.UTIQUE_REJECTED_PROP();}
|
68
|
else if (key.equals("comb. nov.")){return NomenclaturalStatusType.COMB_NOV();}
|
69
|
return null;
|
70
|
}
|
71
|
|
72
|
public TaxonRelationshipType getTaxonRelationshipTypeByKey(String key) {
|
73
|
if (key == null){return null;}
|
74
|
else {
|
75
|
String substring = key.substring(key.length()-1, key.length());
|
76
|
// if (key.equals("<")){return TaxonRelationshipType.();}//TODO: what to do here?
|
77
|
if (substring.equals("=")){return TaxonRelationshipType.CONGRUENT_TO();}
|
78
|
else if (substring.equals(">")){return TaxonRelationshipType.INCLUDES();}
|
79
|
else if (substring.equals("!")){return TaxonRelationshipType.OVERLAPS();}
|
80
|
else if (substring.equals("?")){return TaxonRelationshipType.ALL_RELATIONSHIPS();}
|
81
|
// else if (key.equals("x")){return TaxonRelationshipType.();}//TODO: what to do here?
|
82
|
}
|
83
|
return null;
|
84
|
}
|
85
|
|
86
|
}
|