Revision 379eb203
Added by Andreas Müller over 3 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/tcsxml/in/TcsXmlImportBase.java | ||
---|---|---|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 |
|
|
10 | 9 |
package eu.etaxonomy.cdm.io.tcsxml.in; |
11 | 10 |
|
12 | 11 |
import static eu.etaxonomy.cdm.io.common.ImportHelper.OBLIGATORY; |
... | ... | |
66 | 65 |
@Override |
67 | 66 |
protected abstract void doInvoke(TcsXmlImportState state); |
68 | 67 |
|
69 |
// /* (non-Javadoc) |
|
70 |
// * @see eu.etaxonomy.cdm.io.common.CdmIoBase#doInvoke(eu.etaxonomy.cdm.io.common.IImportConfigurator, eu.etaxonomy.cdm.api.application.CdmApplicationController, java.util.Map) |
|
71 |
// */ |
|
72 | 68 |
// @Override |
73 | 69 |
// protected boolean doInvoke(IImportConfigurator config, |
74 | 70 |
// Map<String, MapWrapper<? extends CdmBase>> stores){ |
... | ... | |
77 | 73 |
// return doInvoke(state); |
78 | 74 |
// } |
79 | 75 |
|
80 |
|
|
81 | 76 |
protected boolean makeStandardMapper(Element parentElement, CdmBase ref, Set<String> omitAttributes, CdmSingleAttributeXmlMapperBase[] classMappers){ |
82 | 77 |
if (omitAttributes == null){ |
83 |
omitAttributes = new HashSet<String>();
|
|
78 |
omitAttributes = new HashSet<>(); |
|
84 | 79 |
} |
85 | 80 |
boolean result = true; |
86 | 81 |
for (CdmSingleAttributeXmlMapperBase mapper : classMappers){ |
... | ... | |
128 | 123 |
break; |
129 | 124 |
} |
130 | 125 |
} |
131 |
|
|
132 | 126 |
}else if (content instanceof Text){ |
133 | 127 |
//empty Text |
134 | 128 |
if (((Text)content).getTextNormalize().equals("")){ |
... | ... | |
180 | 174 |
// return true; |
181 | 175 |
// } |
182 | 176 |
|
183 |
|
|
184 | 177 |
protected boolean testAdditionalElements(Element parentElement, List<String> excludeList){ |
185 | 178 |
boolean result = true; |
186 | 179 |
List<Element> list = parentElement.getChildren(); |
... | ... | |
193 | 186 |
return result; |
194 | 187 |
} |
195 | 188 |
|
196 |
|
|
197 | 189 |
protected <T extends IdentifiableEntity> T makeReferenceType(Element element, Class<? extends T> clazz, MapWrapper<? extends T> objectMap, ResultWrapper<Boolean> success){ |
198 | 190 |
T result = null; |
199 | 191 |
String linkType = element.getAttributeValue("linkType"); |
... | ... | |
232 | 224 |
return result; |
233 | 225 |
} |
234 | 226 |
|
235 |
|
|
236 | 227 |
protected Reference makeAccordingTo(Element elAccordingTo, MapWrapper<Reference> referenceMap, ResultWrapper<Boolean> success){ |
237 | 228 |
Reference result = null; |
238 | 229 |
if (elAccordingTo != null){ |
... | ... | |
255 | 246 |
return result; |
256 | 247 |
} |
257 | 248 |
|
258 |
|
|
259 | 249 |
private Reference makeAccordingToDetailed(Element elAccordingToDetailed, MapWrapper<Reference> referenceMap, ResultWrapper<Boolean> success){ |
260 | 250 |
Reference result = null; |
261 | 251 |
Namespace tcsNamespace = elAccordingToDetailed.getNamespace(); |
... | ... | |
296 | 286 |
return result; |
297 | 287 |
} |
298 | 288 |
|
299 |
|
|
300 |
|
|
301 |
|
|
302 |
|
|
303 | 289 |
protected void testNoMoreElements(){ |
304 | 290 |
//TODO |
305 | 291 |
//logger.info("testNoMoreElements Not yet implemented"); |
306 | 292 |
} |
307 | 293 |
|
308 |
|
|
309 |
|
|
310 |
|
|
311 |
|
|
312 | 294 |
@SuppressWarnings("unchecked") |
313 | 295 |
protected TeamOrPersonBase<?> makeNameCitation(Element elNameCitation, MapWrapper<Person> authorMap, ResultWrapper<Boolean> success){ |
314 | 296 |
TeamOrPersonBase<?> result = null; |
... | ... | |
360 | 342 |
} |
361 | 343 |
} |
362 | 344 |
|
363 |
|
|
364 |
|
|
365 |
|
|
366 |
|
|
367 |
|
|
368 |
|
|
369 |
|
|
370 |
|
|
371 | 345 |
protected Integer getIntegerYear(String year){ |
372 | 346 |
try { |
373 | 347 |
Integer result = Integer.valueOf(year); |
... | ... | |
384 | 358 |
} else { |
385 | 359 |
return ref; |
386 | 360 |
} |
387 |
|
|
388 | 361 |
} |
389 | 362 |
|
390 |
|
|
391 |
|
|
392 | 363 |
protected void makeTypification(TaxonName name, Element elTypifiacation, ResultWrapper<Boolean> success){ |
393 | 364 |
if (elTypifiacation != null){ |
394 | 365 |
//logger.warn("makeTypification not yet implemented"); |
... | ... | |
396 | 367 |
} |
397 | 368 |
} |
398 | 369 |
|
399 |
|
|
400 | 370 |
protected void makePublicationStatus(TaxonName name, Element elPublicationStatus, ResultWrapper<Boolean> success){ |
401 | 371 |
//Status |
402 | 372 |
|
403 | 373 |
if (elPublicationStatus != null){ |
404 | 374 |
String pubStat = elPublicationStatus.getAttributeValue("Note"); |
405 |
|
|
406 | 375 |
} |
407 | 376 |
} |
408 | 377 |
|
... | ... | |
413 | 382 |
} |
414 | 383 |
} |
415 | 384 |
|
416 |
|
|
417 | 385 |
protected void makeProviderSpecificData(TaxonName name, Element elProviderSpecificData, ResultWrapper<Boolean> success, TcsXmlImportState state){ |
418 | 386 |
if (elProviderSpecificData != null){ |
419 | 387 |
|
... | ... | |
450 | 418 |
String id =elRelatedName.getAttributeValue("ref"); |
451 | 419 |
System.out.println(removeVersionOfRef(id)); |
452 | 420 |
if (name.getTaxa().iterator().hasNext()){ |
453 |
Taxon taxon = (Taxon) name.getTaxa().iterator().next();
|
|
421 |
Taxon taxon = name.getTaxa().iterator().next(); |
|
454 | 422 |
//if taxon already exist |
455 | 423 |
taxon.addHomotypicSynonym((Synonym)state.getStore(TAXON_STORE).get(removeVersionOfRef(id))); |
456 | 424 |
//otherwise add to a map for homotypic synonyms |
457 | 425 |
} |
458 | 426 |
} |
459 |
|
|
460 | 427 |
} |
461 | 428 |
} |
462 | 429 |
|
... | ... | |
465 | 432 |
return ! state.getConfig().isDoTaxonNames(); |
466 | 433 |
} |
467 | 434 |
|
468 |
|
|
469 | 435 |
protected static final Reference unknownSec(){ |
470 | 436 |
Reference result = ReferenceFactory.newGeneric(); |
471 | 437 |
result.setTitleCache("UNKNOWN", true); |
472 | 438 |
return result; |
473 | 439 |
} |
474 |
|
|
475 |
|
|
476 |
|
|
477 | 440 |
} |
Also available in: Unified diff
cleanup