24ff4f55ce438d619745f68dbb5aad350cc9ac99
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / specimen / excel / in / SpecimenCdmExcelTransformer.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.specimen.excel.in;
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.io.common.mapping.InputTransformerBase;
19 import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException;
20 import eu.etaxonomy.cdm.model.location.ReferenceSystem;
21 import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
22
23 /**
24 * @author a.mueller
25 * @created 05.05.2011
26 * @version 1.0
27 */
28 public final class SpecimenCdmExcelTransformer extends InputTransformerBase {
29 @SuppressWarnings("unused")
30 private static final Logger logger = Logger.getLogger(SpecimenCdmExcelTransformer.class);
31
32 public static final UUID uuidRefSysMap = UUID.fromString("6d72d148-458a-42eb-97b0-9824abcffc91");
33 public static final UUID uuidRefSysEstimated = UUID.fromString("3b625520-e5cf-4d9c-9599-0cb048e0e8d2");
34 public static final UUID uuidRefSysLabel = UUID.fromString("c72335ed-c9aa-4d1c-b6fc-9f307d207862");
35 public static final UUID uuidRefSysGps = UUID.fromString("b3c36751-b2ac-47f7-8ac1-3dc5c129e0b2");
36
37
38 //Languages
39
40 /* (non-Javadoc)
41 * @see eu.etaxonomy.cdm.io.common.mapping.InputTransformerBase#getMarkerTypeByKey(java.lang.String)
42 */
43 @Override
44 public SpecimenTypeDesignationStatus getSpecimenTypeDesignationStatusByKey(String key) throws UndefinedTransformerMethodException {
45 return super.getSpecimenTypeDesignationStatusByKey(key);
46 }
47
48 @Override
49 public ReferenceSystem getReferenceSystemByKey(String key) throws UndefinedTransformerMethodException {
50 if (StringUtils.isBlank(key)){return null;
51 // }else if (key.matches("(?i)(wgs84)")){return ReferenceSystem.WGS84();
52 }else{
53 ReferenceSystem result = null;
54 try {
55 result = super.getReferenceSystemByKey(key);
56 } catch (UndefinedTransformerMethodException e) {
57 //do nothing
58 }
59 return result;
60 }
61 }
62
63 @Override
64 public UUID getReferenceSystemUuid(String key) throws UndefinedTransformerMethodException {
65 if (StringUtils.isBlank(key)){return null;
66 }else if (key.matches("(?i)(map)")){return uuidRefSysMap;
67 }else if (key.matches("(?i)(estimated)")){return uuidRefSysEstimated;
68 }else if (key.matches("(?i)(label)")){return uuidRefSysLabel;
69 }else if (key.matches("(?i)(gps)")){return uuidRefSysLabel;
70 }
71 return null;
72 }
73
74
75
76
77 }