Project

General

Profile

« Previous | Next » 

Revision b313991f

Added by Andreas Müller over 4 years ago

adapt some classes to new CommonService.getSourcedObjectSByIdInSource and cleanup

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/berlinModel/in/BerlinModelCommonNamesImport.java
612 612
   private void fillRegionMap(BerlinModelImportState state, String sqlWhere,
613 613
            Map<String, NamedArea> emCodeToAreaMap) throws SQLException {
614 614

  
615
        @SuppressWarnings("unchecked")
615 616
        OrderedTermVocabulary<NamedArea> voc = areaVoc = OrderedTermVocabulary.NewInstance(TermType.NamedArea, "Euro+Med common name areas", "E+M Common Name Areas", null, null);
616 617
        getVocabularyService().save(areaVoc);
617 618

  
......
827 828

  
828 829
	@Override
829 830
	public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs, BerlinModelImportState state) {
830
		String nameSpace;
831
		Class<?> cdmClass;
831

  
832
	    String nameSpace;
832 833
		Set<String> idSet;
833 834
		Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<>();
834 835

  
......
850 851

  
851 852
			//name map
852 853
			nameSpace = BerlinModelTaxonNameImport.NAMESPACE;
853
			cdmClass = TaxonName.class;
854 854
			idSet = nameIdSet;
855
			@SuppressWarnings("unchecked")
856
            Map<String, TaxonName> nameMap = (Map<String, TaxonName>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace);
855
			Map<String, TaxonName> nameMap = getCommonService().getSourcedObjectsByIdInSourceC(TaxonName.class, idSet, nameSpace);
857 856
			result.put(nameSpace, nameMap);
858 857

  
859 858
			//taxon map
860 859
			nameSpace = BerlinModelTaxonImport.NAMESPACE;
861
			cdmClass = TaxonBase.class;
862 860
			idSet = taxonIdSet;
863
			@SuppressWarnings("unchecked")
864
            Map<String, TaxonBase<?>> taxonMap = (Map<String, TaxonBase<?>>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace);
861
			@SuppressWarnings("rawtypes")
862
            Map<String, TaxonBase> taxonMap = getCommonService().getSourcedObjectsByIdInSourceC(TaxonBase.class, idSet, nameSpace);
865 863
			result.put(nameSpace, taxonMap);
866 864

  
867 865
			//reference map
868 866
			nameSpace = BerlinModelReferenceImport.REFERENCE_NAMESPACE;
869
			cdmClass = Reference.class;
870 867
			idSet = referenceIdSet;
871 868
			@SuppressWarnings("unchecked")
872
            Map<String, Reference> referenceMap = (Map<String, Reference>)getCommonService().getSourcedObjectsByIdInSource(cdmClass, idSet, nameSpace);
869
            Map<String, Reference> referenceMap = getCommonService().getSourcedObjectsByIdInSourceC(Reference.class, idSet, nameSpace);
873 870
			result.put(nameSpace, referenceMap);
874 871
			// TODO remove if problem with duplicate DescElement_Annot id is solved
875 872
		} catch (SQLException e) {

Also available in: Unified diff