Revision e76ff5da
Added by Andreas Müller about 3 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/euromed/IpniSourcesImport.java | ||
---|---|---|
50 | 50 |
private static final String SPECIES = "species"; |
51 | 51 |
private static final String INFRA_SPECIES = "infraspecies"; |
52 | 52 |
private static final String RANK = "rank"; |
53 |
private static final String AUTHORS = "EMauthors"; |
|
54 | 53 |
private static final String EM_GEO = "EM-geo"; |
55 | 54 |
|
56 | 55 |
private Map<String,NamedArea> areaMap; |
... | ... | |
112 | 111 |
//single areas |
113 | 112 |
Map<String, String> record = state.getOriginalRecord(); |
114 | 113 |
String allAreaStr = getValue(record, EM_GEO); |
114 |
|
|
115 |
//E+M area |
|
116 |
NamedArea emArea = getAreaMap().get("EM"); |
|
117 |
handleArea(line, taxon, distributions, emArea); |
|
118 |
|
|
115 | 119 |
if(isBlank(allAreaStr)){ |
116 | 120 |
logger.warn(line + "No distribution data exists in IPNI file: " + taxon.getName().getTitleCache()); |
117 | 121 |
}else{ |
118 |
NamedArea emArea = getAreaMap().get("EM"); |
|
119 |
handleArea(line, taxon, distributions, emArea); |
|
120 |
|
|
121 | 122 |
String[] areaSplit = allAreaStr.split(","); |
122 | 123 |
for (String areaStr: areaSplit){ |
123 | 124 |
NamedArea area = getAreaMap().get(areaStr.trim()); |
... | ... | |
126 | 127 |
} |
127 | 128 |
} |
128 | 129 |
|
129 |
/** |
|
130 |
* @param line |
|
131 |
* @param taxon |
|
132 |
* @param distributions |
|
133 |
* @param area |
|
134 |
*/ |
|
135 | 130 |
private void handleArea(String line, Taxon taxon, Set<Distribution> distributions, NamedArea area) { |
136 | 131 |
Distribution distribution = findDistribution(distributions, area); |
137 | 132 |
if (distribution == null){ |
138 |
logger.warn("line + Distribution not found: " + taxon.getName().getTitleCache() + ":" + area.getTitleCache());
|
|
133 |
logger.warn(line + "Distribution not found: " + taxon.getName().getTitleCache() + ": " + area.getTitleCache());
|
|
139 | 134 |
}else{ |
140 | 135 |
if (distribution.getSources().isEmpty()){ |
141 | 136 |
addNomenclaturalSource(taxon, distribution, line); |
... | ... | |
147 | 142 |
|
148 | 143 |
private String getSourceString(Set<DescriptionElementSource> sources) { |
149 | 144 |
String result = ""; |
145 |
boolean isFirst = true; |
|
150 | 146 |
for (DescriptionElementSource source : sources){ |
147 |
if (!isFirst){ |
|
148 |
result += ";"; |
|
149 |
} |
|
151 | 150 |
if (source.getCitation() != null){ |
152 | 151 |
result += source.getCitation().getTitleCache(); |
153 | 152 |
}else{ |
154 |
result += "--source has no citation --";
|
|
153 |
result += "--source has no citation--"; |
|
155 | 154 |
} |
155 |
isFirst = false; |
|
156 | 156 |
} |
157 | 157 |
return result; |
158 | 158 |
} |
Also available in: Unified diff
ref #9145 final changes for IpniSourcesImport