Revision 438dd662
Added by Andreas Kohlbecker over 7 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/iapt/IAPTExcelImport.java | ||
---|---|---|
21 | 21 |
import eu.etaxonomy.cdm.model.occurrence.*; |
22 | 22 |
import eu.etaxonomy.cdm.model.occurrence.Collection; |
23 | 23 |
import eu.etaxonomy.cdm.model.reference.Reference; |
24 |
import eu.etaxonomy.cdm.model.reference.ReferenceFactory; |
|
24 | 25 |
import eu.etaxonomy.cdm.model.reference.ReferenceType; |
25 | 26 |
import eu.etaxonomy.cdm.model.taxon.*; |
26 | 27 |
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl; |
... | ... | |
167 | 168 |
private Rank familyIncertisSedis = null; |
168 | 169 |
private AnnotationType annotationTypeCaveats = null; |
169 | 170 |
|
171 |
private Reference bookVariedadesTradicionales = null; |
|
172 |
|
|
170 | 173 |
private Taxon makeTaxon(HashMap<String, String> record, SimpleExcelTaxonImportState<CONFIG> state, |
171 | 174 |
TaxonNode higherTaxonNode, boolean isFossil) { |
172 | 175 |
|
... | ... | |
192 | 195 |
String nomRefIssue = null; |
193 | 196 |
Partial pupDate = null; |
194 | 197 |
|
198 |
boolean restoreOriginalReference = false; |
|
199 |
|
|
195 | 200 |
// preprocess nomRef: separate citation, reference detail, publishing date |
196 | 201 |
if(!StringUtils.isEmpty(nomRefStr)){ |
197 | 202 |
nomRefStr = nomRefStr.trim(); |
203 |
|
|
204 |
// handle the special case which is hard to parse: |
|
205 |
// |
|
206 |
// Las variedades tradicionales de frutales de la Cuenca del Río Segura. Catálogo Etnobotánico (1): Frutos secos, oleaginosos, frutales de hueso, almendros y frutales de pepita: 154. 1997. |
|
207 |
if(nomRefStr.startsWith("Las variedades tradicionales de frutales ")){ |
|
208 |
|
|
209 |
if(bookVariedadesTradicionales == null){ |
|
210 |
bookVariedadesTradicionales = ReferenceFactory.newBook(); |
|
211 |
bookVariedadesTradicionales.setTitle("Las variedades tradicionales de frutales de la Cuenca del Río Segura. Catálogo Etnobotánico (1): Frutos secos, oleaginosos, frutales de hueso, almendros y frutales de pepita"); |
|
212 |
bookVariedadesTradicionales.setDatePublished(TimePeriod.NewInstance(1997)); |
|
213 |
getReferenceService().save(bookVariedadesTradicionales); |
|
214 |
} |
|
215 |
nomRefStr = nomRefStr.replaceAll("^.*?\\:.*?\\:", "Las variedades tradicionales:"); |
|
216 |
restoreOriginalReference = true; |
|
217 |
} |
|
218 |
|
|
198 | 219 |
Matcher m = nomRefTokenizeP.matcher(nomRefStr); |
199 | 220 |
if(m.matches()){ |
200 | 221 |
nomRefTitle = m.group("title"); |
... | ... | |
222 | 243 |
"\n - '" + REGISTRATION + "': " + regStr |
223 | 244 |
, AnnotationType.TECHNICAL(), Language.DEFAULT())); |
224 | 245 |
|
246 |
if(restoreOriginalReference){ |
|
247 |
taxonName.setNomenclaturalReference(bookVariedadesTradicionales); |
|
248 |
} |
|
225 | 249 |
if(pupDate != null) { |
226 | 250 |
taxonName.getNomenclaturalReference().setDatePublished(TimePeriod.NewInstance(pupDate)); |
227 | 251 |
} |
... | ... | |
229 | 253 |
((Reference)taxonName.getNomenclaturalReference()).setVolume(nomRefIssue); |
230 | 254 |
} |
231 | 255 |
|
256 |
|
|
232 | 257 |
if(!StringUtils.isEmpty(notesTxt)){ |
233 | 258 |
notesTxt = notesTxt.replace("Notes: ", "").trim(); |
234 | 259 |
taxonName.addAnnotation(Annotation.NewInstance(notesTxt, AnnotationType.EDITORIAL(), Language.DEFAULT())); |
... | ... | |
280 | 305 |
// Basionym |
281 | 306 |
if(fullBasionymStr != null){ |
282 | 307 |
fullBasionymStr = fullBasionymStr.replaceAll("^\\w*:\\s", ""); // Strip off the leading 'Basionym: " |
308 |
basionymNameStr = basionymNameStr.replaceAll("^\\w*:\\s", ""); // Strip off the leading 'Basionym: " |
|
283 | 309 |
BotanicalName basionym = makeBotanicalName(state, regNumber, fullBasionymStr, basionymNameStr, null, null); |
284 | 310 |
getNameService().save(basionym); |
285 | 311 |
taxonName.addBasionym(basionym); |
Also available in: Unified diff
ref #6026 speedup of import and fixing a minor bug