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