Revision 72bde1d7
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.ReferenceType; |
|
24 | 25 |
import eu.etaxonomy.cdm.model.taxon.*; |
25 | 26 |
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl; |
26 | 27 |
import org.apache.commons.lang.ArrayUtils; |
... | ... | |
74 | 75 |
private static List<String> expectedKeys= Arrays.asList(new String[]{ |
75 | 76 |
REGISTRATIONNO_PK, HIGHERTAXON, FULLNAME, AUTHORSSPELLING, LITSTRING, REGISTRATION, TYPE, CAVEATS, FULLBASIONYM, FULLSYNSUBST, NOTESTXT, REGDATE, NAMESTRING, BASIONYMSTRING, SYNSUBSTSTR, AUTHORSTRING}); |
76 | 77 |
|
77 |
private static final Pattern nomRefTokenizeP = Pattern.compile("^(.*):\\s([^\\.:]+)\\.(.*?)\\.?$");
|
|
78 |
private static final Pattern nomRefTokenizeP = Pattern.compile("^(?<title>.*):\\s(?<detail>[^\\.:]+)\\.(?<date>.*?)(?:\\s\\((?<issue>[^\\)]*)\\)\\s*)\\.?$");
|
|
78 | 79 |
private static final Pattern[] datePatterns = new Pattern[]{ |
79 | 80 |
// NOTE: |
80 | 81 |
// The order of the patterns is extremely important!!! |
... | ... | |
164 | 165 |
private Taxon makeTaxon(HashMap<String, String> record, SimpleExcelTaxonImportState<CONFIG> state, |
165 | 166 |
TaxonNode higherTaxonNode, boolean isFossil) { |
166 | 167 |
|
167 |
String line = state.getCurrentLine() + ": "; |
|
168 |
|
|
169 | 168 |
String regNumber = getValue(record, REGISTRATIONNO_PK, false); |
170 | 169 |
String regStr = getValue(record, REGISTRATION, true); |
171 | 170 |
String titleCacheStr = getValue(record, FULLNAME, true); |
... | ... | |
185 | 184 |
String nomRefTitle = null; |
186 | 185 |
String nomRefDetail; |
187 | 186 |
String nomRefPupDate = null; |
187 |
String nomRefIssue = null; |
|
188 | 188 |
Partial pupDate = null; |
189 | 189 |
|
190 | 190 |
// preprocess nomRef: separate citation, reference detail, publishing date |
... | ... | |
192 | 192 |
nomRefStr = nomRefStr.trim(); |
193 | 193 |
Matcher m = nomRefTokenizeP.matcher(nomRefStr); |
194 | 194 |
if(m.matches()){ |
195 |
nomRefTitle = m.group(1); |
|
196 |
nomRefDetail = m.group(2); |
|
197 |
nomRefPupDate = m.group(3).trim(); |
|
195 |
nomRefTitle = m.group("title"); |
|
196 |
nomRefDetail = m.group("detail"); |
|
197 |
nomRefPupDate = m.group("date").trim(); |
|
198 |
nomRefIssue = m.group("issue"); |
|
198 | 199 |
|
199 | 200 |
pupDate = parseDate(regNumber, nomRefPupDate); |
200 | 201 |
if (pupDate != null) { |
... | ... | |
219 | 220 |
if(pupDate != null) { |
220 | 221 |
taxonName.getNomenclaturalReference().setDatePublished(TimePeriod.NewInstance(pupDate)); |
221 | 222 |
} |
223 |
if(nomRefIssue != null) { |
|
224 |
taxonName.getNomenclaturalReference().setType(ReferenceType.Book); |
|
225 |
((Reference)taxonName.getNomenclaturalReference()).setVolume(nomRefIssue); |
|
226 |
} |
|
222 | 227 |
|
223 | 228 |
if(!StringUtils.isEmpty(notesTxt)){ |
224 | 229 |
notesTxt = notesTxt.replace("Notes: ", "").trim(); |
Also available in: Unified diff
ref #6026 handling 'Vorabdrucke' as Book Volume/Issue