Revision 8275a22c
Added by Andreas Müller over 3 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/berlinModel/in/BerlinModelOccurrenceSourceImport.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.berlinModel.in; |
11 | 10 |
|
12 | 11 |
import java.sql.ResultSet; |
... | ... | |
40 | 39 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
41 | 40 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
42 | 41 |
|
43 |
|
|
44 | 42 |
/** |
45 | 43 |
* @author a.mueller |
46 | 44 |
* @since 20.03.2008 |
... | ... | |
48 | 46 |
@Component |
49 | 47 |
public class BerlinModelOccurrenceSourceImport extends BerlinModelImportBase { |
50 | 48 |
|
51 |
private static final String EXACT = "(exact) "; |
|
52 |
|
|
53 | 49 |
private static final long serialVersionUID = 1139543760239436841L; |
54 |
|
|
55 | 50 |
private static final Logger logger = Logger.getLogger(BerlinModelOccurrenceSourceImport.class); |
56 | 51 |
|
57 | 52 |
private static int modCount = 5000; |
58 | 53 |
private static final String pluralString = "occurrence sources"; |
59 | 54 |
private static final String dbTableName = "emOccurrenceSource"; //?? |
60 |
|
|
55 |
private static final String EXACT = "(exact) "; |
|
61 | 56 |
|
62 | 57 |
private Map<String, Integer> sourceNumberRefIdMap; |
63 | 58 |
private Map<String, Set<Integer>> nameCache2NameIdMap; |
... | ... | |
87 | 82 |
return strQuery; |
88 | 83 |
} |
89 | 84 |
|
90 |
|
|
91 |
|
|
92 | 85 |
@Override |
93 | 86 |
protected void doInvoke(BerlinModelImportState state) { |
94 | 87 |
notFoundReferences = new HashSet<>(); |
... | ... | |
358 | 351 |
} |
359 | 352 |
} |
360 | 353 |
|
361 |
/** |
|
362 |
* @param state |
|
363 |
* @param oldNameFk |
|
364 |
* @param occSourceId |
|
365 |
* @param distribution |
|
366 |
* @param taxonName |
|
367 |
*/ |
|
368 | 354 |
protected TaxonName checkSynonymy(BerlinModelImportState state, Integer oldNameFk, Integer occSourceId, |
369 | 355 |
Distribution distribution, TaxonName taxonName, boolean includeMisapplications) { |
370 | 356 |
|
... | ... | |
408 | 394 |
} |
409 | 395 |
} |
410 | 396 |
|
411 |
/** |
|
412 |
* @param state |
|
413 |
* @param names |
|
414 |
* @param taxon |
|
415 |
* @param taxon |
|
416 |
* @return |
|
417 |
*/ |
|
418 | 397 |
private TaxonName getFirstSynonymName(BerlinModelImportState state, Set<TaxonName> names, Distribution distribution, |
419 | 398 |
Taxon taxon, Integer occSourceId, boolean includeMisapplications) { |
420 | 399 |
TaxonName result = null; |
... | ... | |
498 | 477 |
return result; |
499 | 478 |
} |
500 | 479 |
|
501 |
/** |
|
502 |
* @param state |
|
503 |
* @param names |
|
504 |
* @param taxon |
|
505 |
* @return |
|
506 |
*/ |
|
507 | 480 |
private TaxonName getFirstMisapplication(BerlinModelImportState state, Set<TaxonName> names, Distribution distribution, Integer occSourceId) { |
508 | 481 |
TaxonName result = null; |
509 | 482 |
Taxon taxon = getTaxon(distribution); |
... | ... | |
528 | 501 |
return result; |
529 | 502 |
} |
530 | 503 |
|
531 |
/** |
|
532 |
* @param taxon |
|
533 |
* @return |
|
534 |
*/ |
|
535 | 504 |
protected Set<TaxonName> getOrthographicVariants(TaxonBase<?> taxonBase) { |
536 | 505 |
Set<TaxonName> result = taxonBase.getName().getRelatedNames(Direction.relatedTo, NameRelationshipType.ORTHOGRAPHIC_VARIANT()); |
537 | 506 |
result.addAll(taxonBase.getName().getRelatedNames(Direction.relatedTo, NameRelationshipType.MISSPELLING())); |
... | ... | |
539 | 508 |
return result; |
540 | 509 |
} |
541 | 510 |
|
542 |
/** |
|
543 |
* @param distribution |
|
544 |
* @return |
|
545 |
*/ |
|
546 | 511 |
protected String getTaxonStr(Distribution distribution) { |
547 | 512 |
Taxon taxon = CdmBase.deproxy(distribution.getInDescription(), TaxonDescription.class).getTaxon(); |
548 | 513 |
String areaStr = distribution.getArea().getIdInVocabulary(); |
... | ... | |
572 | 537 |
return names; |
573 | 538 |
} |
574 | 539 |
|
575 |
/** |
|
576 |
* @param oldName |
|
577 |
* @return |
|
578 |
*/ |
|
579 | 540 |
private Set<Integer> getNameIds(String oldName) { |
580 | 541 |
Set<Integer> result = nameCache2NameIdMap.get(oldName); |
581 | 542 |
return result == null ? new HashSet<>(): result; |
... | ... | |
583 | 544 |
|
584 | 545 |
/** |
585 | 546 |
* Creates a map which maps source numbers on references |
586 |
* @param state |
|
587 |
* @return |
|
588 |
* @throws SQLException |
|
589 | 547 |
*/ |
590 | 548 |
private Map<String, Integer> makeSourceNumberReferenceIdMap(BerlinModelImportState state) throws SQLException { |
591 | 549 |
Map<String, Integer> result = new HashMap<>(); |
... | ... | |
665 | 623 |
} |
666 | 624 |
} |
667 | 625 |
} |
668 |
|
|
669 |
} |
|
626 |
} |
Also available in: Unified diff
cleanup