Revision 4b9c9c4b
Added by Andreas Müller about 8 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/cuba/CubaExcelImport.java | ||
---|---|---|
35 | 35 |
import eu.etaxonomy.cdm.model.common.IdentifiableSource; |
36 | 36 |
import eu.etaxonomy.cdm.model.common.Language; |
37 | 37 |
import eu.etaxonomy.cdm.model.common.OriginalSourceType; |
38 |
import eu.etaxonomy.cdm.model.common.Representation; |
|
38 | 39 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
39 | 40 |
import eu.etaxonomy.cdm.model.description.DescriptionElementSource; |
40 | 41 |
import eu.etaxonomy.cdm.model.description.Distribution; |
... | ... | |
103 | 104 |
*/ |
104 | 105 |
private void makeCubanDistribution(HashMap<String, String> record, CubaImportState state) { |
105 | 106 |
try { |
106 |
NamedArea cuba = getNamedArea(state, state.getTransformer().getNamedAreaUuid("C"), null, null, null, null, null); |
|
107 |
NamedArea cuba = getNamedArea(state, state.getTransformer().getNamedAreaUuid("Cu"), null, null, null, null, null);
|
|
107 | 108 |
TaxonDescription desc = getTaxonDescription(state.getCurrentTaxon(), false, true); |
108 | 109 |
List<PresenceAbsenceTerm> statuss = makeCubanStatuss(record, state); |
109 | 110 |
for (PresenceAbsenceTerm status : statuss){ |
... | ... | |
882 | 883 |
* @return |
883 | 884 |
*/ |
884 | 885 |
private Taxon makeTaxon(HashMap<String, String> record, CubaImportState state, TaxonNode familyNode, boolean isSynonym) { |
885 |
String taxonStr = getValue(record, "Taxón"); |
|
886 |
if (taxonStr == null){ |
|
886 |
String taxonStrOrig = getValue(record, "Taxón");
|
|
887 |
if (taxonStrOrig == null){
|
|
887 | 888 |
return isSynonym ? state.getCurrentTaxon() : null; |
888 | 889 |
} |
889 | 890 |
|
890 | 891 |
boolean isAbsent = false; |
891 |
if (taxonStr.startsWith("[") && taxonStr.endsWith("]")){ |
|
892 |
String taxonStr = taxonStrOrig; |
|
893 |
if (taxonStrOrig.startsWith("[") && taxonStrOrig.endsWith("]")){ |
|
892 | 894 |
taxonStr = taxonStr.substring(1, taxonStr.length() - 1); |
893 | 895 |
isAbsent = true; |
894 | 896 |
} |
... | ... | |
908 | 910 |
|
909 | 911 |
TaxonNode higherNode; |
910 | 912 |
if (botanicalName.isProtectedTitleCache()){ |
911 |
logger.warn(state.getCurrentLine() + ": Taxon could not be parsed: " + taxonStr); |
|
913 |
logger.warn(state.getCurrentLine() + ": Taxon could not be parsed: " + taxonStrOrig);
|
|
912 | 914 |
higherNode = familyNode; |
913 | 915 |
}else{ |
914 | 916 |
String genusStr = botanicalName.getGenusOrUninomial(); |
... | ... | |
925 | 927 |
state.putHigherTaxon(genusStr, genus); |
926 | 928 |
} |
927 | 929 |
} |
930 |
if(isAbsent){ |
|
931 |
botanicalName.setTitleCache(taxonStrOrig, true); |
|
932 |
taxon.setExcluded(true); |
|
933 |
} |
|
928 | 934 |
|
929 | 935 |
higherNode.addChildTaxon(taxon, null, null); |
930 | 936 |
taxon.addSource(makeOriginalSource(state)); |
... | ... | |
1328 | 1334 |
state.setCurrentTaxon(taxon); |
1329 | 1335 |
|
1330 | 1336 |
//Fam. ALT |
1331 |
makeAlternativeFamilies(record, state, familyTaxon, taxon); |
|
1337 |
if (!isSynonymOnly){ |
|
1338 |
makeAlternativeFamilies(record, state, familyTaxon, taxon); |
|
1339 |
} |
|
1332 | 1340 |
|
1333 | 1341 |
//(Notas) |
1334 | 1342 |
makeNotes(record, state); |
... | ... | |
1461 | 1469 |
*/ |
1462 | 1470 |
private void makeSingleAlternativeFamily(CubaImportState state, Taxon taxon, String famStr, Reference<?> famRef) { |
1463 | 1471 |
if (isBlank(famStr)){ |
1464 |
return; |
|
1472 |
famStr = "-"; |
|
1473 |
// return; |
|
1465 | 1474 |
} |
1466 | 1475 |
|
1467 | 1476 |
TaxonDescription desc = getTaxonDescription(taxon, false, true); |
... | ... | |
1480 | 1489 |
|
1481 | 1490 |
|
1482 | 1491 |
//TextData |
1483 |
Feature feature1 = getFeature(state, altFamUuid1, "Family in other floras", "Family in other floras", "Other floras", null); |
|
1492 |
Feature feature1 = getFeature(state, altFamUuid1, "Families in other Floras (Text)", "Families in other Floras (Text)", "Other floras", null); |
|
1493 |
feature1.addRepresentation(Representation.NewInstance("Familias en otras Floras", "Familias en otras Floras", null, Language.SPANISH_CASTILIAN())); |
|
1484 | 1494 |
// TextData textData = TextData.NewInstance(feature1, famStr, Language.DEFAULT(), null); |
1485 | 1495 |
TextData textData = TextData.NewInstance(feature1, null, Language.DEFAULT(), null); |
1486 | 1496 |
textData.addSource(OriginalSourceType.PrimaryTaxonomicSource, null,null, famRef, null, famTaxon.getName(),null); |
... | ... | |
1489 | 1499 |
|
1490 | 1500 |
|
1491 | 1501 |
//TaxonInteraction |
1492 |
Feature feature2 = getFeature(state, altFamUuid2, "Family in other floras(2)", "Family in other floras(2)", "Other floras(2)", null);
|
|
1502 |
Feature feature2 = getFeature(state, altFamUuid2, "Families in other Floras", "Families in other Floras", "Other floras(2)", null);
|
|
1493 | 1503 |
feature2.setSupportsTaxonInteraction(true); |
1504 |
feature2.addRepresentation(Representation.NewInstance("Familias en otras Floras", "Familias en otras Floras", null, Language.SPANISH_CASTILIAN())); |
|
1494 | 1505 |
TaxonInteraction taxInteract = TaxonInteraction.NewInstance(feature2); |
1506 |
textData.putText(Language.SPANISH_CASTILIAN(), "Familias en otras Floras"); |
|
1495 | 1507 |
taxInteract.setTaxon2(famTaxon); |
1496 | 1508 |
taxInteract.addSource(OriginalSourceType.PrimaryTaxonomicSource, null,null, famRef, null); |
1497 | 1509 |
desc.addElement(taxInteract); |
Also available in: Unified diff
Latest changes to cuba import #5443