Revision b313991f
Added by Andreas Müller over 4 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/berlinModel/in/BerlinModelFactsImport.java | ||
---|---|---|
313 | 313 |
@Override |
314 | 314 |
public boolean doPartition(@SuppressWarnings("rawtypes") ResultSetPartitioner partitioner, BerlinModelImportState state) { |
315 | 315 |
boolean success = true ; |
316 |
Set<TaxonBase> taxaToSave = new HashSet<>(); |
|
317 |
Map<String, TaxonBase> taxonMap = partitioner.getObjectMap(BerlinModelTaxonImport.NAMESPACE); |
|
318 |
Map<String, Reference> refMap = partitioner.getObjectMap(BerlinModelReferenceImport.REFERENCE_NAMESPACE); |
|
316 |
@SuppressWarnings("rawtypes") |
|
317 |
Set<TaxonBase> taxaToSave = new HashSet<>(); |
|
318 |
@SuppressWarnings({ "unchecked", "rawtypes" }) |
|
319 |
Map<String, TaxonBase> taxonMap = partitioner.getObjectMap(BerlinModelTaxonImport.NAMESPACE); |
|
320 |
@SuppressWarnings("unchecked") |
|
321 |
Map<String, Reference> refMap = partitioner.getObjectMap(BerlinModelReferenceImport.REFERENCE_NAMESPACE); |
|
319 | 322 |
|
320 | 323 |
ResultSet rs = partitioner.getResultSet(); |
321 | 324 |
|
... | ... | |
610 | 613 |
} |
611 | 614 |
|
612 | 615 |
|
613 |
private TaxonDescription getMyTaxonDescripion(TaxonBase taxonBase, BerlinModelImportState state, Integer categoryFk, Integer taxonId, int factId, String fact, Reference sourceRef) { |
|
616 |
private TaxonDescription getMyTaxonDescripion(@SuppressWarnings("rawtypes") TaxonBase taxonBase, BerlinModelImportState state, Integer categoryFk, Integer taxonId, int factId, String fact, Reference sourceRef) {
|
|
614 | 617 |
Taxon taxon = null; |
615 | 618 |
if ( taxonBase instanceof Taxon ) { |
616 | 619 |
taxon = (Taxon) taxonBase; |
... | ... | |
694 | 697 |
|
695 | 698 |
@Override |
696 | 699 |
public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs, BerlinModelImportState state) { |
697 |
String nameSpace; |
|
698 |
Class<?> cdmClass;
|
|
700 |
|
|
701 |
String nameSpace;
|
|
699 | 702 |
Set<String> idSet; |
700 |
Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<Object, Map<String, ? extends CdmBase>>();
|
|
703 |
Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<>(); |
|
701 | 704 |
|
702 | 705 |
try{ |
703 |
Set<String> taxonIdSet = new HashSet<String>();
|
|
704 |
Set<String> referenceIdSet = new HashSet<String>();
|
|
705 |
Set<String> refDetailIdSet = new HashSet<String>();
|
|
706 |
Set<String> taxonIdSet = new HashSet<>(); |
|
707 |
Set<String> referenceIdSet = new HashSet<>(); |
|
708 |
Set<String> refDetailIdSet = new HashSet<>(); |
|
706 | 709 |
while (rs.next()){ |
707 | 710 |
handleForeignKey(rs, taxonIdSet, "taxonId"); |
708 | 711 |
handleForeignKey(rs, referenceIdSet, "FactRefFk"); |
... | ... | |
713 | 716 |
|
714 | 717 |
//taxon map |
715 | 718 |
nameSpace = BerlinModelTaxonImport.NAMESPACE; |
716 |
cdmClass = TaxonBase.class; |
|
717 | 719 |
idSet = taxonIdSet; |
718 |
Map<String, TaxonBase> taxonMap = (Map<String, TaxonBase>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace); |
|
720 |
@SuppressWarnings("rawtypes") |
|
721 |
Map<String, TaxonBase> taxonMap = getCommonService().getSourcedObjectsByIdInSourceC(TaxonBase.class, idSet, nameSpace); |
|
719 | 722 |
result.put(nameSpace, taxonMap); |
720 | 723 |
|
721 | 724 |
//reference map |
722 | 725 |
nameSpace = BerlinModelReferenceImport.REFERENCE_NAMESPACE; |
723 |
cdmClass = Reference.class; |
|
724 | 726 |
idSet = referenceIdSet; |
725 |
Map<String, Reference> referenceMap = (Map<String, Reference>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace);
|
|
727 |
Map<String, Reference> referenceMap = getCommonService().getSourcedObjectsByIdInSourceC(Reference.class, idSet, nameSpace);
|
|
726 | 728 |
result.put(nameSpace, referenceMap); |
727 | 729 |
|
728 | 730 |
//refDetail map |
729 | 731 |
nameSpace = BerlinModelRefDetailImport.REFDETAIL_NAMESPACE; |
730 |
cdmClass = Reference.class; |
|
731 | 732 |
idSet = refDetailIdSet; |
732 |
Map<String, Reference> refDetailMap= (Map<String, Reference>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace);
|
|
733 |
Map<String, Reference> refDetailMap= getCommonService().getSourcedObjectsByIdInSourceC(Reference.class, idSet, nameSpace);
|
|
733 | 734 |
result.put(nameSpace, refDetailMap); |
734 | 735 |
|
735 | 736 |
} catch (SQLException e) { |
... | ... | |
1020 | 1021 |
mediaRepresentation.addRepresentationPart(image); |
1021 | 1022 |
} |
1022 | 1023 |
|
1023 |
private TaxonBase<?> getTaxon(Map<String, TaxonBase> taxonMap, Integer taxonIdObj, Number taxonId){ |
|
1024 |
private TaxonBase<?> getTaxon(@SuppressWarnings("rawtypes") Map<String, TaxonBase> taxonMap, Integer taxonIdObj, Number taxonId){
|
|
1024 | 1025 |
if (taxonIdObj != null){ |
1025 | 1026 |
return taxonMap.get(String.valueOf(taxonId)); |
1026 | 1027 |
}else{ |
Also available in: Unified diff
adapt some classes to new CommonService.getSourcedObjectSByIdInSource and cleanup