Latest updates to Specimen Excel import
[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 public static final UUID uuidRefSysUtm = UUID.fromString("bc64f335-a80a-432a-82ff-5c08a308324f");
37 public static final UUID uuidRefSysDescription = UUID.fromString("a9c42b52-c8cf-4658-86ce-271dca569f2c");
38 public static final UUID uuidRefSysMapBR = UUID.fromString("64b8dc38-e532-45bf-bea7-86b9467973a1");
39 public static final UUID uuidRefSysUnsure = UUID.fromString("91781b31-29e9-4807-8172-e7e25433ea06");
40
41
42
43
44 //Languages
45
46 @Override
47 public SpecimenTypeDesignationStatus getSpecimenTypeDesignationStatusByKey(String key) throws UndefinedTransformerMethodException {
48 return super.getSpecimenTypeDesignationStatusByKey(key);
49 }
50
51 @Override
52 public ReferenceSystem getReferenceSystemByKey(String key) throws UndefinedTransformerMethodException {
53 if (StringUtils.isBlank(key)){return null;
54 // }else if (key.matches("(?i)(wgs84)")){return ReferenceSystem.WGS84();
55 }else{
56 ReferenceSystem result = null;
57 try {
58 result = super.getReferenceSystemByKey(key);
59 } catch (UndefinedTransformerMethodException e) {
60 //do nothing
61 }
62 return result;
63 }
64 }
65
66 @Override
67 public UUID getReferenceSystemUuid(String key) throws UndefinedTransformerMethodException {
68 if (StringUtils.isBlank(key)){return null;
69 }else if (key.matches("(?i)(map)")){return uuidRefSysMap;
70 }else if (key.matches("(?i)(estimated)")){return uuidRefSysEstimated;
71 }else if (key.matches("(?i)(label)")){return uuidRefSysLabel;
72 }else if (key.matches("(?i)(gps)")){return uuidRefSysLabel;
73 }else if (key.matches("(?i)(utm)")){return uuidRefSysUtm;
74 }else if (key.matches("(?i)(description)")){return uuidRefSysDescription;
75 }else if (key.matches("(?i)(mapBR)")){return uuidRefSysMapBR;
76 }else if (key.matches("(?i)(Unsure)")){return uuidRefSysUnsure;
77 }
78 return null;
79 }
80
81
82
83
84 }