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.io.common.mapping;
|
11
|
|
12
|
import java.io.Serializable;
|
13
|
import java.util.UUID;
|
14
|
|
15
|
import org.apache.commons.lang.StringUtils;
|
16
|
import org.apache.log4j.Logger;
|
17
|
|
18
|
import eu.etaxonomy.cdm.common.CdmUtils;
|
19
|
import eu.etaxonomy.cdm.model.common.DefinedTerm;
|
20
|
import eu.etaxonomy.cdm.model.common.ExtensionType;
|
21
|
import eu.etaxonomy.cdm.model.common.Language;
|
22
|
import eu.etaxonomy.cdm.model.common.MarkerType;
|
23
|
import eu.etaxonomy.cdm.model.description.Feature;
|
24
|
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
|
25
|
import eu.etaxonomy.cdm.model.description.State;
|
26
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
27
|
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;
|
28
|
import eu.etaxonomy.cdm.model.location.ReferenceSystem;
|
29
|
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus;
|
30
|
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
|
31
|
import eu.etaxonomy.cdm.model.name.Rank;
|
32
|
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
|
33
|
|
34
|
/**
|
35
|
* @author a.mueller
|
36
|
* @created 15.03.2010
|
37
|
*/
|
38
|
public class InputTransformerBase implements IInputTransformer, Serializable {
|
39
|
private static final long serialVersionUID = 1824180329524647957L;
|
40
|
@SuppressWarnings("unused")
|
41
|
private static final Logger logger = Logger.getLogger(InputTransformerBase.class);
|
42
|
|
43
|
@Override
|
44
|
public Feature getFeatureByKey(String key) throws UndefinedTransformerMethodException {
|
45
|
String warning = "getFeatureByKey is not implemented in implementing transformer class";
|
46
|
throw new UndefinedTransformerMethodException(warning);
|
47
|
}
|
48
|
|
49
|
@Override
|
50
|
public UUID getFeatureUuid(String key) throws UndefinedTransformerMethodException {
|
51
|
String warning = "getFeatureUuid is not implemented in implementing transformer class";
|
52
|
throw new UndefinedTransformerMethodException(warning);
|
53
|
|
54
|
}
|
55
|
|
56
|
|
57
|
@Override
|
58
|
public State getStateByKey(String key) throws UndefinedTransformerMethodException {
|
59
|
String warning = "getStateByKey is not implemented in implementing transformer class";
|
60
|
throw new UndefinedTransformerMethodException(warning);
|
61
|
}
|
62
|
|
63
|
@Override
|
64
|
public UUID getStateUuid(String key) throws UndefinedTransformerMethodException {
|
65
|
String warning = "getStateByKey is not implemented in implementing transformer class";
|
66
|
throw new UndefinedTransformerMethodException(warning);
|
67
|
|
68
|
}
|
69
|
|
70
|
@Override
|
71
|
public Language getLanguageByKey(String key) throws UndefinedTransformerMethodException {
|
72
|
String warning = "getLanguageByKey is not implemented in implementing transformer class";
|
73
|
throw new UndefinedTransformerMethodException(warning);
|
74
|
|
75
|
}
|
76
|
|
77
|
@Override
|
78
|
public UUID getLanguageUuid(String key) throws UndefinedTransformerMethodException {
|
79
|
String warning = "getLanguageByUuid is not implemented in implementing transformer class";
|
80
|
throw new UndefinedTransformerMethodException(warning);
|
81
|
}
|
82
|
|
83
|
@Override
|
84
|
public ExtensionType getExtensionTypeByKey(String key) throws UndefinedTransformerMethodException {
|
85
|
String warning = "getExtensionTypeByKey is not implemented in implementing transformer class";
|
86
|
throw new UndefinedTransformerMethodException(warning);
|
87
|
}
|
88
|
|
89
|
@Override
|
90
|
public UUID getExtensionTypeUuid(String key) throws UndefinedTransformerMethodException {
|
91
|
String warning = "getExtensionTypeUuid is not implemented in implementing transformer class";
|
92
|
throw new UndefinedTransformerMethodException(warning);
|
93
|
}
|
94
|
|
95
|
@Override
|
96
|
public MarkerType getMarkerTypeByKey(String key) throws UndefinedTransformerMethodException {
|
97
|
String warning = "getMarkerTypeByKey is not implemented in implementing transformer class";
|
98
|
throw new UndefinedTransformerMethodException(warning);
|
99
|
}
|
100
|
|
101
|
@Override
|
102
|
public UUID getMarkerTypeUuid(String key) throws UndefinedTransformerMethodException {
|
103
|
String warning = "getMarkerTypeUuid is not implemented in implementing transformer class";
|
104
|
throw new UndefinedTransformerMethodException(warning);
|
105
|
}
|
106
|
|
107
|
@Override
|
108
|
public NameTypeDesignationStatus getNameTypeDesignationStatusByKey(String key) throws UndefinedTransformerMethodException {
|
109
|
String warning = "getNameTypeDesignationStatusByKey is not implemented in implementing transformer class";
|
110
|
throw new UndefinedTransformerMethodException(warning);
|
111
|
}
|
112
|
|
113
|
@Override
|
114
|
public UUID getNameTypeDesignationStatusUuid(String key) throws UndefinedTransformerMethodException {
|
115
|
String warning = "getNameTypeDesignationStatusUuid is not implemented in implementing transformer class";
|
116
|
throw new UndefinedTransformerMethodException(warning);
|
117
|
}
|
118
|
|
119
|
@Override
|
120
|
public SpecimenTypeDesignationStatus getSpecimenTypeDesignationStatusByKey(String key) throws UndefinedTransformerMethodException {
|
121
|
if (StringUtils.isBlank(key)){return null;
|
122
|
}else if (key.matches("(?i)(T|Type)")){return SpecimenTypeDesignationStatus.TYPE();
|
123
|
}else if (key.matches("(?i)(HT|Holotype)")){return SpecimenTypeDesignationStatus.HOLOTYPE();
|
124
|
}else if (key.matches("(?i)(LT|Lectotype)")){return SpecimenTypeDesignationStatus.LECTOTYPE();
|
125
|
}else if (key.matches("(?i)(NT|Neotype)")){return SpecimenTypeDesignationStatus.NEOTYPE();
|
126
|
}else if (key.matches("(?i)(ST|Syntype)")){return SpecimenTypeDesignationStatus.SYNTYPE();
|
127
|
}else if (key.matches("(?i)(ET|Epitype)")){return SpecimenTypeDesignationStatus.EPITYPE();
|
128
|
}else if (key.matches("(?i)(IT|Isotype)")){return SpecimenTypeDesignationStatus.ISOTYPE();
|
129
|
}else if (key.matches("(?i)(ILT|Isolectotype)")){return SpecimenTypeDesignationStatus.ISOLECTOTYPE();
|
130
|
}else if (key.matches("(?i)(INT|Isoneotype)")){return SpecimenTypeDesignationStatus.ISONEOTYPE();
|
131
|
}else if (key.matches("(?i)(IET|Isoepitype)")){return SpecimenTypeDesignationStatus.ISOEPITYPE();
|
132
|
}else if (key.matches("(?i)(PT|Paratype)")){return SpecimenTypeDesignationStatus.PARATYPE();
|
133
|
}else if (key.matches("(?i)(PLT|Paralectotype)")){return SpecimenTypeDesignationStatus.PARALECTOTYPE();
|
134
|
}else if (key.matches("(?i)(PNT|Paraneotype)")){return SpecimenTypeDesignationStatus.PARANEOTYPE();
|
135
|
}else if (key.matches("(?i)(unsp.|Unspecified)")){return SpecimenTypeDesignationStatus.UNSPECIFIC();
|
136
|
}else if (key.matches("(?i)(2LT|Second Step Lectotype)")){return SpecimenTypeDesignationStatus.SECOND_STEP_LECTOTYPE();
|
137
|
}else if (key.matches("(?i)(2NT|Second Step Neotype)")){return SpecimenTypeDesignationStatus.SECOND_STEP_NEOTYPE();
|
138
|
}else if (key.matches("(?i)(OM|Original Material)")){return SpecimenTypeDesignationStatus.ORIGINAL_MATERIAL();
|
139
|
}else if (key.matches("(?i)(IcT|Iconotype)")){return SpecimenTypeDesignationStatus.ICONOTYPE();
|
140
|
}else if (key.matches("(?i)(PT|Phototype)")){return SpecimenTypeDesignationStatus.PHOTOTYPE();
|
141
|
}else if (key.matches("(?i)(IST|Isosyntype)")){return SpecimenTypeDesignationStatus.ISOSYNTYPE();
|
142
|
}else{
|
143
|
return null;
|
144
|
}
|
145
|
}
|
146
|
|
147
|
@Override
|
148
|
public UUID getSpecimenTypeDesignationStatusUuid(String key) throws UndefinedTransformerMethodException {
|
149
|
String warning = "getSpecimenTypeDesignationStatusUuid is not implemented in implementing transformer class";
|
150
|
throw new UndefinedTransformerMethodException(warning);
|
151
|
}
|
152
|
|
153
|
|
154
|
@Override
|
155
|
public PresenceAbsenceTerm getPresenceTermByKey(String key) throws UndefinedTransformerMethodException {
|
156
|
String warning = "getPresenceTermByKey is not implemented in implementing transformer class";
|
157
|
throw new UndefinedTransformerMethodException(warning);
|
158
|
}
|
159
|
|
160
|
@Override
|
161
|
public UUID getPresenceTermUuid(String key) throws UndefinedTransformerMethodException {
|
162
|
String warning = "getPresenceTermUuid is not implemented in implementing transformer class";
|
163
|
throw new UndefinedTransformerMethodException(warning);
|
164
|
}
|
165
|
|
166
|
@Override
|
167
|
public NamedArea getNamedAreaByKey(String key) throws UndefinedTransformerMethodException {
|
168
|
String warning = "getNamedAreaByKey is not implemented in implementing transformer class";
|
169
|
throw new UndefinedTransformerMethodException(warning);
|
170
|
|
171
|
}
|
172
|
|
173
|
@Override
|
174
|
public UUID getNamedAreaUuid(String key) throws UndefinedTransformerMethodException {
|
175
|
String warning = "getNamedAreaUuid is not implemented in implementing transformer class";
|
176
|
throw new UndefinedTransformerMethodException(warning);
|
177
|
}
|
178
|
|
179
|
@Override
|
180
|
public NamedAreaLevel getNamedAreaLevelByKey(String key) throws UndefinedTransformerMethodException {
|
181
|
String warning = "getNamedAreaLevelByKey is not implemented in implementing transformer class";
|
182
|
throw new UndefinedTransformerMethodException(warning);
|
183
|
}
|
184
|
|
185
|
@Override
|
186
|
public UUID getNamedAreaLevelUuid(String key) throws UndefinedTransformerMethodException {
|
187
|
String warning = "getNamedAreaLevelUuid is not implemented in implementing transformer class";
|
188
|
throw new UndefinedTransformerMethodException(warning);
|
189
|
}
|
190
|
|
191
|
@Override
|
192
|
public ReferenceSystem getReferenceSystemByKey(String key) throws UndefinedTransformerMethodException {
|
193
|
if (CdmUtils.isBlank(key)){return null;
|
194
|
}else if (key.matches("(?i)(wgs84)")){return ReferenceSystem.WGS84();
|
195
|
}else if (key.matches("(?i)(googleearth)")){return ReferenceSystem.GOOGLE_EARTH();
|
196
|
}else if (key.matches("(?i)(gazetteer)")){return ReferenceSystem.GAZETTEER();
|
197
|
}else if (key.matches("(?i)(map)")){return ReferenceSystem.MAP();
|
198
|
}else{
|
199
|
String warning = "getReferenceSystemByKey is not implemented in implementing transformer class";
|
200
|
throw new UndefinedTransformerMethodException(warning);
|
201
|
}
|
202
|
}
|
203
|
|
204
|
@Override
|
205
|
public UUID getReferenceSystemUuid(String key) throws UndefinedTransformerMethodException {
|
206
|
|
207
|
String warning = "getReferenceSystemUuid is not implemented in implementing transformer class";
|
208
|
throw new UndefinedTransformerMethodException(warning);
|
209
|
}
|
210
|
|
211
|
@Override
|
212
|
public Rank getRankByKey(String key) throws UndefinedTransformerMethodException {
|
213
|
String warning = "getRankByKey is not yet implemented in implementing transformer class";
|
214
|
throw new UndefinedTransformerMethodException(warning);
|
215
|
}
|
216
|
|
217
|
@Override
|
218
|
public NomenclaturalStatusType getNomenclaturalStatusByKey(String key) throws UndefinedTransformerMethodException {
|
219
|
String warning = "getNomenclaturalStatusByKey is not yet implemented in implementing transformer class";
|
220
|
throw new UndefinedTransformerMethodException(warning);
|
221
|
}
|
222
|
|
223
|
@Override
|
224
|
public UUID getRankUuid(String key) throws UndefinedTransformerMethodException {
|
225
|
String warning = "getRankUuid is not implemented in implementing transformer class";
|
226
|
throw new UndefinedTransformerMethodException(warning);
|
227
|
}
|
228
|
|
229
|
@Override
|
230
|
public DefinedTerm getIdentifierTypeByKey(String key) throws UndefinedTransformerMethodException {
|
231
|
String warning = "getIdentifierTypeByKey is not implemented in implementing transformer class";
|
232
|
throw new UndefinedTransformerMethodException(warning);
|
233
|
}
|
234
|
|
235
|
@Override
|
236
|
public UUID getIdentifierTypeUuid(String key) throws UndefinedTransformerMethodException {
|
237
|
String warning = "getIdentifierTypeUuid is not implemented in implementing transformer class";
|
238
|
throw new UndefinedTransformerMethodException(warning);
|
239
|
}
|
240
|
|
241
|
|
242
|
}
|