Revision b313991f
Added by Andreas Müller over 4 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/berlinModel/in/BerlinModelTaxonRelationImport.java | ||
---|---|---|
242 | 242 |
} |
243 | 243 |
|
244 | 244 |
@Override |
245 |
public boolean doPartition(ResultSetPartitioner partitioner, BerlinModelImportState state) { |
|
245 |
public boolean doPartition(@SuppressWarnings("rawtypes") ResultSetPartitioner partitioner, BerlinModelImportState state) {
|
|
246 | 246 |
boolean success = true ; |
247 |
Set<TaxonBase> taxaToSave = new HashSet<>(); |
|
248 |
Map<String, TaxonBase> taxonMap = partitioner.getObjectMap(BerlinModelTaxonImport.NAMESPACE); |
|
247 |
@SuppressWarnings("rawtypes") |
|
248 |
Set<TaxonBase> taxaToSave = new HashSet<>(); |
|
249 |
@SuppressWarnings({ "unchecked", "rawtypes" }) |
|
250 |
Map<String, TaxonBase> taxonMap = partitioner.getObjectMap(BerlinModelTaxonImport.NAMESPACE); |
|
249 | 251 |
Map<Integer, Classification> classificationMap = new HashMap<>(); |
250 |
Map<String, Reference> refMap = partitioner.getObjectMap(BerlinModelReferenceImport.REFERENCE_NAMESPACE); |
|
252 |
@SuppressWarnings("unchecked") |
|
253 |
Map<String, Reference> refMap = partitioner.getObjectMap(BerlinModelReferenceImport.REFERENCE_NAMESPACE); |
|
251 | 254 |
|
252 | 255 |
ResultSet rs = partitioner.getResultSet(); |
253 | 256 |
|
... | ... | |
617 | 620 |
|
618 | 621 |
@Override |
619 | 622 |
public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs, BerlinModelImportState state) { |
620 |
String nameSpace; |
|
621 |
Class<?> cdmClass;
|
|
623 |
|
|
624 |
String nameSpace;
|
|
622 | 625 |
Set<String> idSet; |
623 | 626 |
Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<>(); |
624 | 627 |
|
... | ... | |
635 | 638 |
|
636 | 639 |
//taxon map |
637 | 640 |
nameSpace = BerlinModelTaxonImport.NAMESPACE; |
638 |
cdmClass = TaxonBase.class; |
|
639 | 641 |
idSet = taxonIdSet; |
640 |
Map<String, TaxonBase> taxonMap = (Map<String, TaxonBase>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace); |
|
642 |
@SuppressWarnings("rawtypes") |
|
643 |
Map<String, TaxonBase> taxonMap = getCommonService().getSourcedObjectsByIdInSourceC(TaxonBase.class, idSet, nameSpace); |
|
641 | 644 |
result.put(nameSpace, taxonMap); |
642 | 645 |
|
643 | 646 |
// //tree map |
644 | 647 |
// nameSpace = "Classification"; |
645 |
// cdmClass = Classification.class; |
|
646 | 648 |
// idSet = classificationIdSet; |
647 |
// Map<String, Classification> treeMap = (Map<String, Classification>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace);
|
|
649 |
// Map<String, Classification> treeMap = getCommonService().getSourcedObjectsByIdInSourceC(Classification.class, idSet, nameSpace);
|
|
648 | 650 |
// result.put(cdmClass, treeMap); |
649 | 651 |
// Set<UUID> treeUuidSet = state |
650 | 652 |
// getClassificationService().find(uuidSet); |
651 | 653 |
// |
652 | 654 |
//reference map |
653 | 655 |
nameSpace = BerlinModelReferenceImport.REFERENCE_NAMESPACE; |
654 |
cdmClass = Reference.class; |
|
655 | 656 |
idSet = referenceIdSet; |
656 |
Map<String, Reference> referenceMap = (Map<String, Reference>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace);
|
|
657 |
Map<String, Reference> referenceMap = getCommonService().getSourcedObjectsByIdInSourceC(Reference.class, idSet, nameSpace);
|
|
657 | 658 |
result.put(nameSpace, referenceMap); |
658 | 659 |
|
659 | 660 |
} catch (SQLException e) { |
... | ... | |
803 | 804 |
protected boolean isIgnore(BerlinModelImportState state){ |
804 | 805 |
return ! state.getConfig().isDoRelTaxa(); |
805 | 806 |
} |
806 |
|
|
807 |
|
|
808 | 807 |
} |
Also available in: Unified diff
adapt some classes to new CommonService.getSourcedObjectSByIdInSource and cleanup