Revision dc7815d5
Added by Andreas Müller over 2 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/location/Country.java | ||
---|---|---|
638 | 638 |
String uriStr = CdmUtils.Ne(csvLine.get(1)); |
639 | 639 |
newInstance.setUri(uriStr == null? null: URI.create(uriStr)); |
640 | 640 |
String label = csvLine.get(3).trim(); |
641 |
String text = csvLine.get(3).trim();
|
|
642 |
String abbreviatedLabel = csvLine.get(2);
|
|
641 |
String text = csvLine.get(4).trim();
|
|
642 |
String abbreviatedLabel = csvLine.get(5);
|
|
643 | 643 |
newInstance.addRepresentation(Representation.NewInstance(text, label, abbreviatedLabel, lang) ); |
644 | 644 |
newInstance.setLevel(NamedAreaLevel.COUNTRY()); |
645 | 645 |
|
646 | 646 |
// iso codes extra |
647 |
newInstance.setIso3166_A2(CdmUtils.Ne(csvLine.get(4).trim()));
|
|
647 |
newInstance.setIso3166_A2(CdmUtils.Ne(abbreviatedLabel.trim()));
|
|
648 | 648 |
newInstance.setIdInVocabulary(abbreviatedLabel); |
649 | 649 |
|
650 |
|
|
651 | 650 |
String[] continentList; |
652 |
String tmp = csvLine.get(5).trim();
|
|
651 |
String tmp = csvLine.get(6).trim();
|
|
653 | 652 |
if (tmp.length()>2){ |
654 | 653 |
tmp=tmp.substring(1, tmp.length()-1); |
655 | 654 |
|
... | ... | |
657 | 656 |
for (String continentStr : continentList){ |
658 | 657 |
logger.debug("continent: "+ continentStr); |
659 | 658 |
UUID uuidContinent = UUID.fromString(continentStr); |
659 |
|
|
660 | 660 |
NamedArea continent = NamedArea.getContinentByUuid(uuidContinent); |
661 | 661 |
//old version: but this is null if you use the new termloading mechanism which does not hold |
662 | 662 |
//ALL terms in the terms set: |
... | ... | |
666 | 666 |
} |
667 | 667 |
newInstance.addContinent(continent); |
668 | 668 |
} |
669 |
}else{ |
|
670 |
throw new RuntimeException("Currently we except all countries to belong to a continent"); |
|
669 | 671 |
} |
670 | 672 |
return newInstance; |
671 | 673 |
} catch (Exception e) { |
672 |
// TODO Auto-generated catch block |
|
673 |
e.printStackTrace(); |
|
674 |
throw e; |
|
674 | 675 |
} |
675 |
return null; |
|
676 | 676 |
} |
677 | 677 |
|
678 | 678 |
public void writeCsvLine(CSVWriter writer) { |
Also available in: Unified diff
ref #7640, ref #4209 update country labels and split label from official title (still handled in description)