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