Revision 855ea64a
Added by Andreas Müller almost 5 years ago
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/erms/ErmsAreaImport.java | ||
---|---|---|
32 | 32 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
33 | 33 |
import eu.etaxonomy.cdm.model.location.NamedAreaLevel; |
34 | 34 |
import eu.etaxonomy.cdm.model.location.NamedAreaType; |
35 |
import eu.etaxonomy.cdm.model.term.TermType; |
|
36 |
import eu.etaxonomy.cdm.model.term.TermVocabulary; |
|
35 | 37 |
|
36 | 38 |
/** |
37 | 39 |
* @author a.mueller |
... | ... | |
90 | 92 |
|
91 | 93 |
@Override |
92 | 94 |
public NamedArea createObject(ResultSet rs, ErmsImportState state) throws SQLException { |
93 |
int id = rs.getInt("id"); |
|
95 |
TermVocabulary<NamedArea> voc = getVocabulary(state, TermType.NamedArea, ErmsTransformer.uuidVocErmsAreas, "User defined vocabulary for named areas", |
|
96 |
"User Defined Named Areas", null, null, true, NamedArea.NewInstance()); |
|
97 |
|
|
98 |
int id = rs.getInt("id"); |
|
94 | 99 |
String strGuName = rs.getString("gu_name"); |
95 | 100 |
UUID uuid = ErmsTransformer.uuidFromGuName(strGuName); |
96 | 101 |
String label = strGuName; |
97 | 102 |
String text = strGuName; |
98 |
//TODO |
|
99 |
String labelAbbrev = String.valueOf(id); |
|
103 |
String labelAbbrev = null; |
|
100 | 104 |
NamedAreaType areaType = null; |
101 | 105 |
NamedAreaLevel level = null; |
102 |
NamedArea area = getNamedArea(state, uuid, label, text, labelAbbrev, areaType, level); |
|
106 |
|
|
107 |
NamedArea area = getNamedArea(state, uuid, label, text, labelAbbrev, areaType, level, voc, null); |
|
108 |
area.setIdInVocabulary(String.valueOf(id)); |
|
103 | 109 |
return area; |
104 | 110 |
} |
105 | 111 |
|
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/erms/ErmsTransformer.java | ||
---|---|---|
61 | 61 |
public static final UUID uuidRankSubterclass = UUID.fromString("39257363-913b-4b3a-a536-b415360dfc8c"); |
62 | 62 |
public static final UUID uuidRankParvorder = UUID.fromString("d26b8cae-96f9-4aee-81f2-98e36f1db7c3"); |
63 | 63 |
|
64 |
//language uuids |
|
64 |
//area uuids |
|
65 |
public static final UUID uuidVocErmsAreas = UUID.fromString("7e6daf5e-f536-4c0c-8967-1400a45f7b4a"); |
|
65 | 66 |
public static final UUID uuidAdriaticSea = UUID.fromString("da376165-f970-4f0c-99db-773686d66591"); |
66 | 67 |
public static final UUID uuidAegeanSea = UUID.fromString("65d6c443-225f-4ac0-9c86-da51502b46df"); |
67 | 68 |
public static final UUID uuidArchipelagoSea = UUID.fromString("d9ea9d63-ec4d-4b01-967d-13f28b09a715"); |
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiTransformer.java | ||
---|---|---|
1132 | 1132 |
else if (namedArea.getUuid().equals(FaunaEuropaeaTransformer.uuidAreaRU_FJL)) { return AREA_FRANZ_JOSEF_LAND; } |
1133 | 1133 |
else if (namedArea.getUuid().equals(FaunaEuropaeaTransformer.uuidAreaRU_NOZ)) { return AREA_NOVAYA_ZEMLYA; } |
1134 | 1134 |
*/ |
1135 |
|
|
1135 |
}else if (area.getVocabulary().getUuid().equals(ErmsTransformer.uuidVocErmsAreas)){ |
|
1136 | 1136 |
//ERMS |
1137 |
else if (namedArea.getUuid().equals(ErmsTransformer.uuidEuropeanMarineWaters)) { return AREA_EUROPEAN_MARINE_WATERS; }
|
|
1137 |
if (namedArea.getUuid().equals(ErmsTransformer.uuidEuropeanMarineWaters)) { return AREA_EUROPEAN_MARINE_WATERS; } |
|
1138 | 1138 |
else if (//(namedArea.getRepresentation(Language.DEFAULT()).getAbbreviatedLabel()).equals("MES") || /carefull: NPE! |
1139 | 1139 |
(namedArea.getUuid().equals(ErmsTransformer.uuidMediterraneanSea))) { return AREA_MEDITERRANEAN_SEA; } // abbreviated label missing |
1140 | 1140 |
else if (namedArea.getUuid().equals(ErmsTransformer.uuidWhiteSea)) { return AREA_WHITE_SEA; } |
... | ... | |
1269 | 1269 |
else if (namedArea.getUuid().equals(ErmsTransformer.uuidVenezuela)) { return 290; } |
1270 | 1270 |
|
1271 | 1271 |
else { |
1272 |
logger.warn("Unknown NamedArea Area: " + area.getTitleCache());
|
|
1272 |
logger.warn("Unknown ERMS Area: " + area.getTitleCache());
|
|
1273 | 1273 |
} |
1274 | 1274 |
|
1275 |
} |
|
1275 |
} else { |
|
1276 |
logger.warn("Unknown NamedArea Area not in a known vocabulary: " + area.getTitleCache()); |
|
1277 |
} |
|
1276 | 1278 |
return null; |
1277 | 1279 |
} |
1278 | 1280 |
|
Also available in: Unified diff
ref #1444, ref #8509 add defined vocabulary to ERMS areas