Revision 539b7820
Added by Andreas Müller over 5 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/cuba/CubaExcelImport.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
import java.util.ArrayList; |
13 | 13 |
import java.util.Arrays; |
14 |
import java.util.HashMap; |
|
15 | 14 |
import java.util.HashSet; |
16 | 15 |
import java.util.List; |
16 |
import java.util.Map; |
|
17 | 17 |
import java.util.Set; |
18 | 18 |
import java.util.UUID; |
19 | 19 |
import java.util.regex.Matcher; |
... | ... | |
94 | 94 |
"Taxón","(Notas)","Syn.","End","Ind","Ind? D","Nat","Dud P","Adv","Cult C","CuW","PR PR*","Art","Hab(*)","May","Mat","IJ","CuC","VC","Ci","SS","CA","Cam","LT","CuE","Gr","Ho","SC","Gu","Esp","Ja","PR","Men","Bah","Cay","AmN","AmC","AmS","VM"}); |
95 | 95 |
|
96 | 96 |
@Override |
97 |
protected void analyzeRecord(HashMap<String, String> record, CubaImportState state) {
|
|
97 |
protected void analyzeRecord(Map<String, String> record, CubaImportState state) { |
|
98 | 98 |
//we do everything in firstPass here |
99 | 99 |
return; |
100 | 100 |
} |
... | ... | |
105 | 105 |
* @param state |
106 | 106 |
* @param taxon |
107 | 107 |
*/ |
108 |
private void makeCubanDistribution(HashMap<String, String> record, CubaImportState state) {
|
|
108 |
private void makeCubanDistribution(Map<String, String> record, CubaImportState state) { |
|
109 | 109 |
try { |
110 | 110 |
NamedArea cuba = getNamedArea(state, state.getTransformer().getNamedAreaUuid("Cu"), null, null, null, null, null); |
111 | 111 |
TaxonDescription desc = getTaxonDescription(state.getCurrentTaxon(), false, true); |
... | ... | |
127 | 127 |
* @return |
128 | 128 |
* @throws UndefinedTransformerMethodException |
129 | 129 |
*/ |
130 |
private List<PresenceAbsenceTerm> makeCubanStatuss(HashMap<String, String> record, CubaImportState state) throws UndefinedTransformerMethodException {
|
|
130 |
private List<PresenceAbsenceTerm> makeCubanStatuss(Map<String, String> record, CubaImportState state) throws UndefinedTransformerMethodException { |
|
131 | 131 |
PresenceAbsenceTerm highestStatus = null; |
132 | 132 |
|
133 | 133 |
String line = state.getCurrentLine() + ": "; |
... | ... | |
361 | 361 |
* @param state |
362 | 362 |
* @param taxon |
363 | 363 |
*/ |
364 |
private void makeSynonyms(HashMap<String, String> record, CubaImportState state, boolean isFirstSynonym) {
|
|
364 |
private void makeSynonyms(Map<String, String> record, CubaImportState state, boolean isFirstSynonym) { |
|
365 | 365 |
// boolean forAccepted = true; |
366 | 366 |
String synonymStr = record.get("Syn."); |
367 | 367 |
String line = state.getCurrentLine() + ": "; |
... | ... | |
602 | 602 |
* @param taxon |
603 | 603 |
*/ |
604 | 604 |
private void makeSingleProvinceDistribution(String areaKey, |
605 |
HashMap<String, String> record,
|
|
605 |
Map<String, String> record, |
|
606 | 606 |
CubaImportState state) { |
607 | 607 |
try { |
608 | 608 |
UUID areaUuid = state.getTransformer().getNamedAreaUuid(areaKey); |
... | ... | |
644 | 644 |
* @param record |
645 | 645 |
* @param state |
646 | 646 |
*/ |
647 |
private Reference getAreaSourceByNumber(String areaKey, HashMap<String, String> record, CubaImportState state) {
|
|
647 |
private Reference getAreaSourceByNumber(String areaKey, Map<String, String> record, CubaImportState state) { |
|
648 | 648 |
String statusStr = record.get(areaKey); |
649 | 649 |
if (statusStr == null){ |
650 | 650 |
return null; |
... | ... | |
938 | 938 |
* @param state |
939 | 939 |
* @param taxon |
940 | 940 |
*/ |
941 |
private void makeNotes(HashMap<String, String> record, CubaImportState state) {
|
|
941 |
private void makeNotes(Map<String, String> record, CubaImportState state) { |
|
942 | 942 |
String notesStr = getValue(record, "(Notas)"); |
943 | 943 |
if (notesStr == null){ |
944 | 944 |
return; |
... | ... | |
957 | 957 |
* @param familyTaxon |
958 | 958 |
* @return |
959 | 959 |
*/ |
960 |
private Taxon makeTaxon(HashMap<String, String> record, CubaImportState state, TaxonNode familyNode, boolean isSynonym) {
|
|
960 |
private Taxon makeTaxon(Map<String, String> record, CubaImportState state, TaxonNode familyNode, boolean isSynonym) { |
|
961 | 961 |
String taxonStrOrig = getValue(record, "Taxón"); |
962 | 962 |
if (taxonStrOrig == null){ |
963 | 963 |
return isSynonym ? state.getCurrentTaxon() : null; |
... | ... | |
1160 | 1160 |
* @param state |
1161 | 1161 |
* @return |
1162 | 1162 |
*/ |
1163 |
private TaxonNode getFamilyTaxon(HashMap<String, String> record, CubaImportState state) {
|
|
1163 |
private TaxonNode getFamilyTaxon(Map<String, String> record, CubaImportState state) { |
|
1164 | 1164 |
String familyStr = getValue(record, "Fam. default"); |
1165 | 1165 |
if (familyStr == null){ |
1166 | 1166 |
return null; |
... | ... | |
1354 | 1354 |
* @param originalKey |
1355 | 1355 |
* @return |
1356 | 1356 |
*/ |
1357 |
private String getValue(HashMap<String, String> record, String originalKey) { |
|
1357 |
@Override |
|
1358 |
public String getValue(Map<String, String> record, String originalKey) { |
|
1358 | 1359 |
String value = record.get(originalKey); |
1359 | 1360 |
if (! StringUtils.isBlank(value)) { |
1360 | 1361 |
if (logger.isDebugEnabled()) { logger.debug(originalKey + ": " + value); } |
... | ... | |
1375 | 1376 |
boolean isSynonymOnly = false; |
1376 | 1377 |
|
1377 | 1378 |
String line = state.getCurrentLine() + ": "; |
1378 |
HashMap<String, String> record = state.getOriginalRecord();
|
|
1379 |
Map<String, String> record = state.getOriginalRecord(); |
|
1379 | 1380 |
|
1380 | 1381 |
Set<String> keys = record.keySet(); |
1381 | 1382 |
for (String key: keys) { |
... | ... | |
1505 | 1506 |
* @param familyTaxon |
1506 | 1507 |
* @param taxon |
1507 | 1508 |
*/ |
1508 |
private void makeAlternativeFamilies(HashMap<String, String> record,
|
|
1509 |
private void makeAlternativeFamilies(Map<String, String> record, |
|
1509 | 1510 |
CubaImportState state, |
1510 | 1511 |
TaxonNode familyTaxon, |
1511 | 1512 |
Taxon taxon) { |
... | ... | |
1619 | 1620 |
// "CuW","PR PR*","Art","Hab(*)","May","Mat","IJ", |
1620 | 1621 |
// "CuC","VC","Ci","SS","CA","Cam","LT", |
1621 | 1622 |
// "CuE","Gr","Ho","SC","Gu", |
1622 |
private void makeProvincesDistribution(HashMap<String, String> record, CubaImportState state) {
|
|
1623 |
private void makeProvincesDistribution(Map<String, String> record, CubaImportState state) { |
|
1623 | 1624 |
List<String> areaKeys = Arrays.asList(new String[]{ |
1624 | 1625 |
"CuW","PR PR*","Art","Hab(*)","May","Mat","IJ", |
1625 | 1626 |
"CuC","VC","Ci","SS","CA","Cam","LT", |
... | ... | |
1631 | 1632 |
} |
1632 | 1633 |
} |
1633 | 1634 |
|
1634 |
private void makeOtherAreasDistribution(HashMap<String, String> record, CubaImportState state) {
|
|
1635 |
private void makeOtherAreasDistribution(Map<String, String> record, CubaImportState state) { |
|
1635 | 1636 |
List<String> areaKeys = Arrays.asList(new String[]{ |
1636 | 1637 |
"Esp","Ja","PR","Men","Bah","Cay", |
1637 | 1638 |
"AmN","AmC","AmS","VM"}); |
... | ... | |
1653 | 1654 |
* @throws UndefinedTransformerMethodException |
1654 | 1655 |
*/ |
1655 | 1656 |
private PresenceAbsenceTerm makeProvinceStatus(String areaKey, |
1656 |
HashMap<String, String> record,
|
|
1657 |
Map<String, String> record, |
|
1657 | 1658 |
CubaImportState state) throws UndefinedTransformerMethodException { |
1658 | 1659 |
|
1659 | 1660 |
String statusStr = record.get(areaKey); |
Also available in: Unified diff
cleanup