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.sdd;
|
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.io.common.mapping.InputTransformerBase;
|
19
|
import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException;
|
20
|
import eu.etaxonomy.cdm.model.common.MarkerType;
|
21
|
import eu.etaxonomy.cdm.model.description.Feature;
|
22
|
|
23
|
/**
|
24
|
* @author a.mueller
|
25
|
* @created 01.03.2010
|
26
|
* @version 1.0
|
27
|
*/
|
28
|
public class SDDTransformer extends InputTransformerBase {
|
29
|
@SuppressWarnings("unused")
|
30
|
private static final Logger logger = Logger.getLogger(SDDTransformer.class);
|
31
|
|
32
|
|
33
|
|
34
|
//feature uuids
|
35
|
public static final UUID uuidNote = UUID.fromString("b9af1489-6b68-497f-8d4b-260a9f886827");
|
36
|
|
37
|
//extension type uuids
|
38
|
public static final UUID uuidTitle = UUID.fromString("5d9ca987-81f1-4d6c-b06a-eaa8311ca249");
|
39
|
|
40
|
//marker type uuid
|
41
|
public static final UUID uuidExcludedTaxon = UUID.fromString("e729a22d-8c94-4859-9f91-3e3ae212c91d");
|
42
|
|
43
|
|
44
|
/* (non-Javadoc)
|
45
|
* @see eu.etaxonomy.cdm.io.common.mapping.InputTransformerBase#getFeatureByKey(java.lang.String)
|
46
|
*/
|
47
|
@Override
|
48
|
public Feature getFeatureByKey(String key) throws UndefinedTransformerMethodException {
|
49
|
if (CdmUtils.isEmpty(key)){return null;
|
50
|
}else if (key.equalsIgnoreCase("distribution")){return Feature.DISTRIBUTION();
|
51
|
}else if (key.equalsIgnoreCase("habitatecology")){return Feature.ECOLOGY();
|
52
|
}else{
|
53
|
return null;
|
54
|
}
|
55
|
}
|
56
|
|
57
|
/* (non-Javadoc)
|
58
|
* @see eu.etaxonomy.cdm.io.common.mapping.InputTransformerBase#getFeatureUuid(java.lang.String)
|
59
|
*/
|
60
|
@Override
|
61
|
public UUID getFeatureUuid(String key) throws UndefinedTransformerMethodException {
|
62
|
if (CdmUtils.isEmpty(key)){return null;
|
63
|
|
64
|
}else if (key.equalsIgnoreCase("lifeform")){return uuidNote;
|
65
|
|
66
|
}else{
|
67
|
return null;
|
68
|
}
|
69
|
|
70
|
}
|
71
|
|
72
|
|
73
|
|
74
|
/* (non-Javadoc)
|
75
|
* @see eu.etaxonomy.cdm.io.common.mapping.InputTransformerBase#getMarkerTypeByKey(java.lang.String)
|
76
|
*/
|
77
|
@Override
|
78
|
public MarkerType getMarkerTypeByKey(String key) throws UndefinedTransformerMethodException {
|
79
|
if (CdmUtils.isEmpty(key)){return null;
|
80
|
// }else if (key.equalsIgnoreCase("distribution")){return MarkerType.;
|
81
|
// }else if (key.equalsIgnoreCase("habitatecology")){return Feature.ECOLOGY();
|
82
|
}else{
|
83
|
return null;
|
84
|
}
|
85
|
}
|
86
|
|
87
|
@Override
|
88
|
public UUID getMarkerTypeUuid(String key) throws UndefinedTransformerMethodException {
|
89
|
if (CdmUtils.isEmpty(key)){return null;
|
90
|
}else if (key.equalsIgnoreCase("excluded")){return uuidExcludedTaxon;
|
91
|
}else if (key.equalsIgnoreCase("EXCLUDED SPECIES, OF UNCERTAIN AFHNITIES PTELEOCARPA")){return uuidExcludedTaxon;
|
92
|
}else if (key.equalsIgnoreCase("EXCLUDED GENUS, OF UNCERTAIN AFHNITIES PTELEOCARPA")){return uuidExcludedTaxon;
|
93
|
}else if (key.equalsIgnoreCase("INCOMPLETELY KNOWN SPECIES")){return uuidNote;
|
94
|
}else{
|
95
|
return null;
|
96
|
}
|
97
|
|
98
|
}
|
99
|
|
100
|
|
101
|
|
102
|
|
103
|
|
104
|
}
|