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.specimen.excel.in;
|
11
|
|
12
|
import java.util.UUID;
|
13
|
|
14
|
import org.apache.commons.lang.StringUtils;
|
15
|
import org.apache.log4j.Logger;
|
16
|
|
17
|
import eu.etaxonomy.cdm.io.common.mapping.InputTransformerBase;
|
18
|
import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException;
|
19
|
import eu.etaxonomy.cdm.model.location.ReferenceSystem;
|
20
|
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
|
21
|
|
22
|
/**
|
23
|
* @author a.mueller
|
24
|
* @created 05.05.2011
|
25
|
* @version 1.0
|
26
|
*/
|
27
|
public final class SpecimenCdmExcelTransformer extends InputTransformerBase {
|
28
|
@SuppressWarnings("unused")
|
29
|
private static final Logger logger = Logger.getLogger(SpecimenCdmExcelTransformer.class);
|
30
|
|
31
|
public static final UUID uuidRefSysEstimated = UUID.fromString("3b625520-e5cf-4d9c-9599-0cb048e0e8d2");
|
32
|
public static final UUID uuidRefSysLabel = UUID.fromString("c72335ed-c9aa-4d1c-b6fc-9f307d207862");
|
33
|
public static final UUID uuidRefSysGps = UUID.fromString("b3c36751-b2ac-47f7-8ac1-3dc5c129e0b2");
|
34
|
public static final UUID uuidRefSysUtm = UUID.fromString("bc64f335-a80a-432a-82ff-5c08a308324f");
|
35
|
public static final UUID uuidRefSysDescription = UUID.fromString("a9c42b52-c8cf-4658-86ce-271dca569f2c");
|
36
|
public static final UUID uuidRefSysMapBR = UUID.fromString("64b8dc38-e532-45bf-bea7-86b9467973a1");
|
37
|
public static final UUID uuidRefSysUnsure = UUID.fromString("91781b31-29e9-4807-8172-e7e25433ea06");
|
38
|
|
39
|
|
40
|
|
41
|
|
42
|
//Languages
|
43
|
|
44
|
@Override
|
45
|
public SpecimenTypeDesignationStatus getSpecimenTypeDesignationStatusByKey(String key) throws UndefinedTransformerMethodException {
|
46
|
return super.getSpecimenTypeDesignationStatusByKey(key);
|
47
|
}
|
48
|
|
49
|
@Override
|
50
|
public ReferenceSystem getReferenceSystemByKey(String key) throws UndefinedTransformerMethodException {
|
51
|
if (StringUtils.isBlank(key)){return null;
|
52
|
// }else if (key.matches("(?i)(wgs84)")){return ReferenceSystem.WGS84();
|
53
|
}else{
|
54
|
ReferenceSystem result = null;
|
55
|
try {
|
56
|
result = super.getReferenceSystemByKey(key);
|
57
|
} catch (UndefinedTransformerMethodException e) {
|
58
|
//do nothing
|
59
|
}
|
60
|
return result;
|
61
|
}
|
62
|
}
|
63
|
|
64
|
@Override
|
65
|
public UUID getReferenceSystemUuid(String key) throws UndefinedTransformerMethodException {
|
66
|
if (StringUtils.isBlank(key)){return null;
|
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
|
}else if (key.matches("(?i)(utm)")){return uuidRefSysUtm;
|
71
|
}else if (key.matches("(?i)(description)")){return uuidRefSysDescription;
|
72
|
}else if (key.matches("(?i)(mapBR)")){return uuidRefSysMapBR;
|
73
|
}else if (key.matches("(?i)(Unsure)")){return uuidRefSysUnsure;
|
74
|
}
|
75
|
return null;
|
76
|
}
|
77
|
|
78
|
}
|