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 java.util.UUID;
|
14
|
|
15
|
import org.apache.log4j.Logger;
|
16
|
|
17
|
import eu.etaxonomy.cdm.io.common.mapping.InputTransformerBase;
|
18
|
import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException;
|
19
|
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
|
20
|
import eu.etaxonomy.cdm.model.name.Rank;
|
21
|
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
|
22
|
|
23
|
/**
|
24
|
*
|
25
|
* @author pplitzner
|
26
|
* @date Mar 1, 2016
|
27
|
*
|
28
|
*/
|
29
|
@SuppressWarnings("serial")
|
30
|
public final class RedListGefaesspflanzenTransformer extends InputTransformerBase {
|
31
|
|
32
|
@SuppressWarnings("unused")
|
33
|
private static final Logger logger = Logger.getLogger(RedListGefaesspflanzenTransformer.class);
|
34
|
|
35
|
@Override
|
36
|
public UUID getRankUuid(String key) throws UndefinedTransformerMethodException {
|
37
|
if (key == null){return null;}
|
38
|
if (key.equals("SAM")){return RedListUtil.uuidRankCollectionSpecies;}
|
39
|
return null;
|
40
|
}
|
41
|
|
42
|
@Override
|
43
|
public Rank getRankByKey(String key) throws UndefinedTransformerMethodException {
|
44
|
if (key == null){return null;}
|
45
|
if (key.equals("GAT")){return Rank.GENUS();}
|
46
|
else if (key.equals("SPE")){return Rank.SPECIES();}
|
47
|
else if (key.equals("VAR")){return Rank.VARIETY();}
|
48
|
else if (key.equals("SSP")){return Rank.SUBSPECIES();}
|
49
|
else if (key.equals("FOR")){return Rank.FORM();}
|
50
|
else if (key.equals("RAC")){return Rank.RACE();}
|
51
|
else if (key.equals("SEC")){return Rank.SECTION_BOTANY();}
|
52
|
else if (key.equals("SSE")){return Rank.SUBSECTION_BOTANY();}
|
53
|
else if (key.equals("SGE")){return Rank.SUBGENUS();}
|
54
|
else if (key.equals("SVA")){return Rank.SUBVARIETY();}
|
55
|
else if (key.equals("CV")){return Rank.CULTIVAR();}
|
56
|
else if (key.equals("PRO")){return Rank.PROLES();}
|
57
|
else if (key.equals("SER")){return Rank.SERIES();}
|
58
|
else if (key.equals("GRE")){return Rank.GREX();}
|
59
|
else if (key.equals("AGG")){return Rank.SPECIESAGGREGATE();}
|
60
|
else if (key.equals("SFO")){return Rank.SUBFORM();}
|
61
|
else if (key.equals("FAM")){return Rank.FAMILY();}
|
62
|
else if (key.equals("SLU")){return Rank.SUBLUSUS();}
|
63
|
else if (key.equals("SPI")){return Rank.SUBSPECIES();}
|
64
|
//FIXME implement ranks
|
65
|
// else if (key.equals("LUS")){return Rank.LUSUS();}
|
66
|
// else if (key.equals("SPR")){return Rank.SUBPROLES();}
|
67
|
// else if (key.equals("SAM")){return Rank.SAMMELART();}
|
68
|
// else if (key.equals("MOD")){return Rank.MODIFICATIO();}
|
69
|
// else if (key.equals("KMB")){return Rank.COMBINATION();}
|
70
|
else if (key.equals("GRO") || key.equals("GRU")){return Rank.SPECIESGROUP();}
|
71
|
else if (key.equals("?")){return Rank.UNKNOWN_RANK();}
|
72
|
return null;
|
73
|
}
|
74
|
|
75
|
@Override
|
76
|
public NomenclaturalStatusType getNomenclaturalStatusByKey(String key) throws UndefinedTransformerMethodException {
|
77
|
if (key == null){return null;}
|
78
|
key = key.trim();
|
79
|
if (key.equals("nom. cons.")){return NomenclaturalStatusType.CONSERVED();}
|
80
|
else if (key.equals("nom. illeg.")){return NomenclaturalStatusType.ILLEGITIMATE();}
|
81
|
else if (key.equals("nom. inval.")){return NomenclaturalStatusType.INVALID();}
|
82
|
else if (key.equals("nom. inval. (sine typus)")){return NomenclaturalStatusType.INVALID();}
|
83
|
else if (key.equals("nom. inval. (sine descr.)")){return NomenclaturalStatusType.INVALID();}
|
84
|
else if (key.equals("nom. inval. (sine descr. lat.)")){return NomenclaturalStatusType.INVALID();}
|
85
|
else if (key.equals("nom. inval. (sine basion.)")){return NomenclaturalStatusType.INVALID();}
|
86
|
else if (key.equals("nom. inval. (nom. non accept.)")){return NomenclaturalStatusType.INVALID();}
|
87
|
else if (key.equals("nom. ambig.")){return NomenclaturalStatusType.AMBIGUOUS();}
|
88
|
else if (key.equals("nom. nud.")){return NomenclaturalStatusType.NUDUM();}
|
89
|
else if (key.equals("nom. dub.")){return NomenclaturalStatusType.DOUBTFUL();}
|
90
|
else if (key.equals("nom. rejic.")){return NomenclaturalStatusType.REJECTED();}
|
91
|
else if (key.equals("nom. rejic. prop.")){return NomenclaturalStatusType.REJECTED_PROP();}
|
92
|
else if (key.equals("nom. utique rejic.")){return NomenclaturalStatusType.UTIQUE_REJECTED();}
|
93
|
else if (key.equals("nom. utique rejic. pro.")){return NomenclaturalStatusType.UTIQUE_REJECTED_PROP();}
|
94
|
else if (key.equals("nom. utique rejic. prop.")){return NomenclaturalStatusType.UTIQUE_REJECTED_PROP();}
|
95
|
else if (key.equals("comb. nov.")){return NomenclaturalStatusType.COMB_NOV();}
|
96
|
else if (key.equals("nom. illeg. (nom. superfl.)")){return NomenclaturalStatusType.SUPERFLUOUS();}
|
97
|
else if (key.equals("nom. inval. (nom. nud.)")){return NomenclaturalStatusType.NUDUM();}
|
98
|
else if (key.equals("nom. nud.")){return NomenclaturalStatusType.NUDUM();}
|
99
|
else if (key.equals("nom. inval. (op. utique oppr.)")){return NomenclaturalStatusType.OPUS_UTIQUE_OPPR();}
|
100
|
else if (key.equals("nom. inval. (nom. prov.)")){return NomenclaturalStatusType.PROVISIONAL();}
|
101
|
return null;
|
102
|
}
|
103
|
|
104
|
public TaxonRelationshipType getTaxonRelationshipTypeByKey(String key) {
|
105
|
if (key == null){return null;}
|
106
|
else {
|
107
|
if (key.equals("=")){return TaxonRelationshipType.CONGRUENT_TO();}
|
108
|
else if (key.equals(">")){return TaxonRelationshipType.INCLUDES();}
|
109
|
else if (key.equals("<")){return TaxonRelationshipType.INCLUDES();}
|
110
|
else if (key.equals("!")){return TaxonRelationshipType.OVERLAPS();}
|
111
|
else if (key.equals("?")){return TaxonRelationshipType.UNCLEAR();}
|
112
|
else if (key.equals("x")){return TaxonRelationshipType.NOT_YET_WORKED_ON();}
|
113
|
}
|
114
|
return null;
|
115
|
}
|
116
|
|
117
|
}
|