Revision 2b5f8b56
Added by Andreas Müller over 8 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/cyprus/CyprusTransformer.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.cyprus; |
|
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.common.CdmUtils; |
|
19 |
import eu.etaxonomy.cdm.io.common.mapping.InputTransformerBase; |
|
20 |
import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException; |
|
21 |
import eu.etaxonomy.cdm.model.common.MarkerType; |
|
22 |
|
|
23 |
/** |
|
24 |
* @author a.mueller |
|
25 |
* @created 01.03.2010 |
|
26 |
* @version 1.0 |
|
27 |
*/ |
|
28 |
public final class CyprusTransformer extends InputTransformerBase { |
|
29 |
@SuppressWarnings("unused") |
|
30 |
private static final Logger logger = Logger.getLogger(CyprusTransformer.class); |
|
31 |
|
|
32 |
|
|
33 |
//feature |
|
34 |
public static final UUID redBookUuid = UUID.fromString("df59d44a-ee5a-4c01-8637-127cc804842d"); |
|
35 |
public static final UUID endemismUuid = UUID.fromString("dd343c31-1916-4786-a530-536ea995dce4"); |
|
36 |
|
|
37 |
//presenceTerm |
|
38 |
public static final UUID indigenousUuid = UUID.fromString("b325859b-504b-45e0-9ef0-d5c1602fcc0f"); |
|
39 |
public static final UUID casualUuid = UUID.fromString("5e81353c-38a3-4ca6-b979-0d9abc93b877"); |
|
40 |
public static final UUID nonInvasiveUuid = UUID.fromString("1b025e8b-901a-42e8-9739-119b410c6f03"); |
|
41 |
public static final UUID invasiveUuid = UUID.fromString("faf2d271-868a-4bf7-b0b8-a1c5ab309de2"); |
|
42 |
public static final UUID questionableUuid = UUID.fromString("4b48f675-a6cf-49f3-a5ba-77e2c2979eb3"); |
|
43 |
|
|
44 |
public static final UUID indigenousDoubtfulUuid = UUID.fromString("17bc601f-53eb-4997-a4bc-c03ce5bfd1d3"); |
|
45 |
public static final UUID casualDoubtfulUuid = UUID.fromString("73f75493-1185-4a3e-af1e-9a1f2e8dadb7"); |
|
46 |
public static final UUID nonInvasiveDoubtfulUuid = UUID.fromString("11f56e2f-c16c-4b3d-a870-bb5d3b20e624"); |
|
47 |
public static final UUID invasiveDoubtfulUuid = UUID.fromString("ac429d5f-e8ad-49ae-a41c-e4779b58b96a"); |
|
48 |
public static final UUID questionableDoubtfulUuid = UUID.fromString("914e7393-1314-4632-bc45-5eff3dc1e424"); |
|
49 |
|
|
50 |
public static final UUID cultivatedDoubtfulUuid = UUID.fromString("4f31bfc8-3058-4d83-aea5-3a1fe9773f9f"); |
|
51 |
|
|
52 |
//Named Area - divisions |
|
53 |
public static final UUID uuidCyprusDivisionsVocabulary = UUID.fromString("2119f610-1f93-4d87-af28-40aeefaca100"); |
|
54 |
public static final UUID uuidCyprusDivisionsAreaLevel = UUID.fromString("ff52bbd9-f73d-4476-af39-f3991fa892bd"); |
|
55 |
|
|
56 |
public static final UUID uuidDivision1 = UUID.fromString("ab17eee9-1abb-4ce9-a9a2-563f840cdbfc"); |
|
57 |
public static final UUID uuidDivision2 = UUID.fromString("c3606165-efb7-4224-a168-63e009eb4aa5"); |
|
58 |
public static final UUID uuidDivision3 = UUID.fromString("750d4e07-e34b-491f-a7b7-09723afdc960"); |
|
59 |
public static final UUID uuidDivision4 = UUID.fromString("8a858922-e8e5-4791-ad53-906e50633ec7"); |
|
60 |
public static final UUID uuidDivision5 = UUID.fromString("16057133-d541-4ebd-81d4-cb92265ec54c"); |
|
61 |
public static final UUID uuidDivision6 = UUID.fromString("fbf21230-4a42-4f4c-9af8-5da52123c264"); |
|
62 |
public static final UUID uuidDivision7 = UUID.fromString("d31dd96a-36ea-4428-871c-d8552a9565ca"); |
|
63 |
public static final UUID uuidDivision8 = UUID.fromString("236ea447-c3ab-486d-9e06-cc5907861acc"); |
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
/* (non-Javadoc) |
|
69 |
* @see eu.etaxonomy.cdm.io.common.mapping.InputTransformerBase#getMarkerTypeByKey(java.lang.String) |
|
70 |
*/ |
|
71 |
@Override |
|
72 |
public MarkerType getMarkerTypeByKey(String key) throws UndefinedTransformerMethodException { |
|
73 |
if (StringUtils.isBlank(key)){return null; |
|
74 |
// }else if (key.equalsIgnoreCase("distribution")){return MarkerType.; |
|
75 |
// }else if (key.equalsIgnoreCase("habitatecology")){return Feature.ECOLOGY(); |
|
76 |
}else{ |
|
77 |
return null; |
|
78 |
} |
|
79 |
} |
|
80 |
|
|
81 |
@Override |
|
82 |
public UUID getMarkerTypeUuid(String key) throws UndefinedTransformerMethodException { |
|
83 |
if (StringUtils.isBlank(key)){return null; |
|
84 |
// }else if (key.equalsIgnoreCase("IMPERFECTLY KNOWN SPECIES")){return uuidIncompleteTaxon; |
|
85 |
}else{ |
|
86 |
return null; |
|
87 |
} |
|
88 |
|
|
89 |
} |
|
90 |
|
|
91 |
@Override |
|
92 |
public UUID getPresenceTermUuid(String key) throws UndefinedTransformerMethodException { |
|
93 |
if (StringUtils.isBlank(key)){return null; |
|
94 |
}else if (key.equalsIgnoreCase("IN")){return indigenousUuid; |
|
95 |
}else if (key.equalsIgnoreCase("CA")){return casualUuid; |
|
96 |
}else if (key.equalsIgnoreCase("NN")){return nonInvasiveUuid; |
|
97 |
}else if (key.equalsIgnoreCase("NA")){return invasiveUuid; |
|
98 |
}else if (key.equalsIgnoreCase("Q")){return questionableUuid; |
|
99 |
}else if (key.equalsIgnoreCase("IN?")){return indigenousDoubtfulUuid; |
|
100 |
}else if (key.equalsIgnoreCase("CA?")){return casualDoubtfulUuid; |
|
101 |
}else if (key.equalsIgnoreCase("NN?")){return nonInvasiveDoubtfulUuid; |
|
102 |
}else if (key.equalsIgnoreCase("NA?")){return invasiveDoubtfulUuid; |
|
103 |
}else if (key.equalsIgnoreCase("Q?")){return questionableDoubtfulUuid; |
|
104 |
}else if (key.equalsIgnoreCase("CU?")){return cultivatedDoubtfulUuid; |
|
105 |
}else{ |
|
106 |
return null; |
|
107 |
} |
|
108 |
|
|
109 |
} |
|
110 |
|
|
111 |
@Override |
|
112 |
public UUID getFeatureUuid(String key) throws UndefinedTransformerMethodException { |
|
113 |
if (StringUtils.isBlank(key)){return null; |
|
114 |
}else if (key.equalsIgnoreCase("Red book")){return redBookUuid; |
|
115 |
}else if (key.equalsIgnoreCase("Endemism")){return endemismUuid; |
|
116 |
}else{ |
|
117 |
return null; |
|
118 |
} |
|
119 |
|
|
120 |
} |
|
121 |
|
|
122 |
@Override |
|
123 |
public UUID getNamedAreaUuid(String key) throws UndefinedTransformerMethodException { |
|
124 |
if (StringUtils.isBlank(key)){return null; |
|
125 |
}else if (key.equalsIgnoreCase("1")){return uuidDivision1; |
|
126 |
}else if (key.equalsIgnoreCase("2")){return uuidDivision2; |
|
127 |
}else if (key.equalsIgnoreCase("3")){return uuidDivision3; |
|
128 |
}else if (key.equalsIgnoreCase("4")){return uuidDivision4; |
|
129 |
}else if (key.equalsIgnoreCase("5")){return uuidDivision5; |
|
130 |
}else if (key.equalsIgnoreCase("6")){return uuidDivision6; |
|
131 |
}else if (key.equalsIgnoreCase("7")){return uuidDivision7; |
|
132 |
}else if (key.equalsIgnoreCase("8")){return uuidDivision8; |
|
133 |
}else{ |
|
134 |
return null; |
|
135 |
} |
|
136 |
} |
|
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
|
142 |
|
|
143 |
|
|
144 |
} |
|
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.cyprus; |
|
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.common.MarkerType; |
|
21 |
|
|
22 |
/** |
|
23 |
* @author a.mueller |
|
24 |
* @created 01.03.2010 |
|
25 |
* @version 1.0 |
|
26 |
*/ |
|
27 |
public final class CyprusTransformer extends InputTransformerBase { |
|
28 |
private static final long serialVersionUID = 6499276527625309482L; |
|
29 |
|
|
30 |
|
|
31 |
@SuppressWarnings("unused") |
|
32 |
private static final Logger logger = Logger.getLogger(CyprusTransformer.class); |
|
33 |
|
|
34 |
|
|
35 |
//feature |
|
36 |
public static final UUID redBookUuid = UUID.fromString("df59d44a-ee5a-4c01-8637-127cc804842d"); |
|
37 |
public static final UUID endemismUuid = UUID.fromString("dd343c31-1916-4786-a530-536ea995dce4"); |
|
38 |
|
|
39 |
//presenceTerm |
|
40 |
public static final UUID indigenousUuid = UUID.fromString("b325859b-504b-45e0-9ef0-d5c1602fcc0f"); |
|
41 |
public static final UUID casualUuid = UUID.fromString("5e81353c-38a3-4ca6-b979-0d9abc93b877"); |
|
42 |
public static final UUID nonInvasiveUuid = UUID.fromString("1b025e8b-901a-42e8-9739-119b410c6f03"); |
|
43 |
public static final UUID invasiveUuid = UUID.fromString("faf2d271-868a-4bf7-b0b8-a1c5ab309de2"); |
|
44 |
public static final UUID questionableUuid = UUID.fromString("4b48f675-a6cf-49f3-a5ba-77e2c2979eb3"); |
|
45 |
|
|
46 |
public static final UUID indigenousDoubtfulUuid = UUID.fromString("17bc601f-53eb-4997-a4bc-c03ce5bfd1d3"); |
|
47 |
public static final UUID casualDoubtfulUuid = UUID.fromString("73f75493-1185-4a3e-af1e-9a1f2e8dadb7"); |
|
48 |
public static final UUID nonInvasiveDoubtfulUuid = UUID.fromString("11f56e2f-c16c-4b3d-a870-bb5d3b20e624"); |
|
49 |
public static final UUID invasiveDoubtfulUuid = UUID.fromString("ac429d5f-e8ad-49ae-a41c-e4779b58b96a"); |
|
50 |
public static final UUID questionableDoubtfulUuid = UUID.fromString("914e7393-1314-4632-bc45-5eff3dc1e424"); |
|
51 |
|
|
52 |
public static final UUID cultivatedDoubtfulUuid = UUID.fromString("4f31bfc8-3058-4d83-aea5-3a1fe9773f9f"); |
|
53 |
|
|
54 |
//Named Area - divisions |
|
55 |
public static final UUID uuidCyprusDivisionsVocabulary = UUID.fromString("2119f610-1f93-4d87-af28-40aeefaca100"); |
|
56 |
public static final UUID uuidCyprusDivisionsAreaLevel = UUID.fromString("ff52bbd9-f73d-4476-af39-f3991fa892bd"); |
|
57 |
|
|
58 |
public static final UUID uuidDivision1 = UUID.fromString("ab17eee9-1abb-4ce9-a9a2-563f840cdbfc"); |
|
59 |
public static final UUID uuidDivision2 = UUID.fromString("c3606165-efb7-4224-a168-63e009eb4aa5"); |
|
60 |
public static final UUID uuidDivision3 = UUID.fromString("750d4e07-e34b-491f-a7b7-09723afdc960"); |
|
61 |
public static final UUID uuidDivision4 = UUID.fromString("8a858922-e8e5-4791-ad53-906e50633ec7"); |
|
62 |
public static final UUID uuidDivision5 = UUID.fromString("16057133-d541-4ebd-81d4-cb92265ec54c"); |
|
63 |
public static final UUID uuidDivision6 = UUID.fromString("fbf21230-4a42-4f4c-9af8-5da52123c264"); |
|
64 |
public static final UUID uuidDivision7 = UUID.fromString("d31dd96a-36ea-4428-871c-d8552a9565ca"); |
|
65 |
public static final UUID uuidDivision8 = UUID.fromString("236ea447-c3ab-486d-9e06-cc5907861acc"); |
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
/* (non-Javadoc) |
|
71 |
* @see eu.etaxonomy.cdm.io.common.mapping.InputTransformerBase#getMarkerTypeByKey(java.lang.String) |
|
72 |
*/ |
|
73 |
@Override |
|
74 |
public MarkerType getMarkerTypeByKey(String key) throws UndefinedTransformerMethodException { |
|
75 |
if (StringUtils.isBlank(key)){return null; |
|
76 |
// }else if (key.equalsIgnoreCase("distribution")){return MarkerType.; |
|
77 |
// }else if (key.equalsIgnoreCase("habitatecology")){return Feature.ECOLOGY(); |
|
78 |
}else{ |
|
79 |
return null; |
|
80 |
} |
|
81 |
} |
|
82 |
|
|
83 |
@Override |
|
84 |
public UUID getMarkerTypeUuid(String key) throws UndefinedTransformerMethodException { |
|
85 |
if (StringUtils.isBlank(key)){return null; |
|
86 |
// }else if (key.equalsIgnoreCase("IMPERFECTLY KNOWN SPECIES")){return uuidIncompleteTaxon; |
|
87 |
}else{ |
|
88 |
return null; |
|
89 |
} |
|
90 |
|
|
91 |
} |
|
92 |
|
|
93 |
@Override |
|
94 |
public UUID getPresenceTermUuid(String key) throws UndefinedTransformerMethodException { |
|
95 |
if (StringUtils.isBlank(key)){return null; |
|
96 |
}else if (key.equalsIgnoreCase("IN")){return indigenousUuid; |
|
97 |
}else if (key.equalsIgnoreCase("CA")){return casualUuid; |
|
98 |
}else if (key.equalsIgnoreCase("NN")){return nonInvasiveUuid; |
|
99 |
}else if (key.equalsIgnoreCase("NA")){return invasiveUuid; |
|
100 |
}else if (key.equalsIgnoreCase("Q")){return questionableUuid; |
|
101 |
}else if (key.equalsIgnoreCase("IN?")){return indigenousDoubtfulUuid; |
|
102 |
}else if (key.equalsIgnoreCase("CA?")){return casualDoubtfulUuid; |
|
103 |
}else if (key.equalsIgnoreCase("NN?")){return nonInvasiveDoubtfulUuid; |
|
104 |
}else if (key.equalsIgnoreCase("NA?")){return invasiveDoubtfulUuid; |
|
105 |
}else if (key.equalsIgnoreCase("Q?")){return questionableDoubtfulUuid; |
|
106 |
}else if (key.equalsIgnoreCase("CU?")){return cultivatedDoubtfulUuid; |
|
107 |
}else{ |
|
108 |
return null; |
|
109 |
} |
|
110 |
|
|
111 |
} |
|
112 |
|
|
113 |
@Override |
|
114 |
public UUID getFeatureUuid(String key) throws UndefinedTransformerMethodException { |
|
115 |
if (StringUtils.isBlank(key)){return null; |
|
116 |
}else if (key.equalsIgnoreCase("Red book")){return redBookUuid; |
|
117 |
}else if (key.equalsIgnoreCase("Endemism")){return endemismUuid; |
|
118 |
}else{ |
|
119 |
return null; |
|
120 |
} |
|
121 |
|
|
122 |
} |
|
123 |
|
|
124 |
@Override |
|
125 |
public UUID getNamedAreaUuid(String key) throws UndefinedTransformerMethodException { |
|
126 |
if (StringUtils.isBlank(key)){return null; |
|
127 |
}else if (key.equalsIgnoreCase("1")){return uuidDivision1; |
|
128 |
}else if (key.equalsIgnoreCase("2")){return uuidDivision2; |
|
129 |
}else if (key.equalsIgnoreCase("3")){return uuidDivision3; |
|
130 |
}else if (key.equalsIgnoreCase("4")){return uuidDivision4; |
|
131 |
}else if (key.equalsIgnoreCase("5")){return uuidDivision5; |
|
132 |
}else if (key.equalsIgnoreCase("6")){return uuidDivision6; |
|
133 |
}else if (key.equalsIgnoreCase("7")){return uuidDivision7; |
|
134 |
}else if (key.equalsIgnoreCase("8")){return uuidDivision8; |
|
135 |
}else{ |
|
136 |
return null; |
|
137 |
} |
|
138 |
} |
|
139 |
|
|
140 |
|
|
141 |
|
|
142 |
|
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
} |
Also available in: Unified diff
Add first version of Edaphobase importer and some clean up