fix #9617 rename ICNB to ICNP in cdmlib
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / specimen / SpecimenImportBase.java
index bec35cefbf9ef6163b6dcced607abb1feb8299ab..2eb7ea22fc2e6afb4a524fd29c22a1fcb4a5ec5a 100755 (executable)
@@ -11,6 +11,7 @@ package eu.etaxonomy.cdm.io.specimen;
 
 
 import java.util.ArrayList;
+import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -38,6 +39,7 @@ import eu.etaxonomy.cdm.model.common.IdentifiableSource;
 import eu.etaxonomy.cdm.model.common.LanguageString;
 import eu.etaxonomy.cdm.model.description.DescriptionBase;
 import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
+import eu.etaxonomy.cdm.model.description.DescriptionType;
 import eu.etaxonomy.cdm.model.description.Feature;
 import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
 import eu.etaxonomy.cdm.model.description.TaxonDescription;
@@ -87,6 +89,7 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
        protected Map<String, DefinedTerm> kindOfUnitsMap;
 
 
+
        @Override
     protected abstract void doInvoke(STATE state);
 
@@ -177,7 +180,12 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
             state.getReport().addName(taxonName);
             logger.info("Created new taxon name "+taxonName);
         }
-        save(taxonName, state);
+        if (taxonName != null){
+            state.names.put(taxonName.getNameCache(), taxonName);
+        }
+        if(!taxonName.isPersited()) {
+            save(taxonName, state);
+        }
         return taxonName;
     }
 
@@ -268,25 +276,25 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
                    logger.debug("parseScientificName " + state.getDataHolder().getNomenclatureCode().toString());
                }
 
-               if (state.getDataHolder().getNomenclatureCode().toString().equals("Zoological") || state.getDataHolder().getNomenclatureCode().toString().contains("ICZN")) {
+               if (state.getDataHolder().getNomenclatureCode() != null && (state.getDataHolder().getNomenclatureCode().toString().equals("Zoological") || state.getDataHolder().getNomenclatureCode().toString().contains("ICZN"))) {
                    taxonName = (TaxonName)nvnpi.parseFullName(scientificName, NomenclaturalCode.ICZN, rank);
                    if (taxonName.hasProblem()) {
                        problem = true;
                    }
                }
-               else if (state.getDataHolder().getNomenclatureCode().toString().equals("Botanical") || state.getDataHolder().getNomenclatureCode().toString().contains("ICBN")  || state.getDataHolder().getNomenclatureCode().toString().contains("ICNAFP")) {
+               else if (state.getDataHolder().getNomenclatureCode() != null && (state.getDataHolder().getNomenclatureCode().toString().equals("Botanical") || state.getDataHolder().getNomenclatureCode().toString().contains("ICBN")  || state.getDataHolder().getNomenclatureCode().toString().contains("ICNAFP"))) {
                    taxonName = (TaxonName)nvnpi.parseFullName(scientificName, NomenclaturalCode.ICNAFP, rank);
                    if (taxonName.hasProblem()) {
                        problem = true;
                    }
                }
-               else if (state.getDataHolder().getNomenclatureCode().toString().equals("Bacterial") || state.getDataHolder().getNomenclatureCode().toString().contains("ICBN")) {
-                   taxonName = (TaxonName)nvnpi.parseFullName(scientificName, NomenclaturalCode.ICNB, rank);
+               else if (state.getDataHolder().getNomenclatureCode() != null && (state.getDataHolder().getNomenclatureCode().toString().equals("Bacterial") || state.getDataHolder().getNomenclatureCode().toString().contains("ICBN"))) {
+                   taxonName = (TaxonName)nvnpi.parseFullName(scientificName, NomenclaturalCode.ICNP, rank);
                    if (taxonName.hasProblem()) {
                        problem = true;
                    }
                }
-               else if (state.getDataHolder().getNomenclatureCode().toString().equals("Cultivar") || state.getDataHolder().getNomenclatureCode().toString().contains("ICNCP")) {
+               else if (state.getDataHolder().getNomenclatureCode() != null && (state.getDataHolder().getNomenclatureCode().toString().equals("Cultivar") || state.getDataHolder().getNomenclatureCode().toString().contains("ICNCP"))) {
                    taxonName = (TaxonName)nvnpi.parseFullName(scientificName, NomenclaturalCode.ICNCP, rank);
                    if (taxonName.hasProblem()) {
                        problem = true;
@@ -440,7 +448,7 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
                        return taxonName;
                    }
                }
-               else if (state.getDataHolder().getNomenclatureCode().equals("Bacterial") || state.getDataHolder().getNomenclatureCode().equals(NomenclaturalCode.ICNB.getUuid())) {
+               else if (state.getDataHolder().getNomenclatureCode().equals("Bacterial") || state.getDataHolder().getNomenclatureCode().equals(NomenclaturalCode.ICNP.getUuid())) {
                    TaxonName taxonName = TaxonNameFactory.NewBacterialInstance(null);
                    taxonName.setFullTitleCache(fullName, true);
                    taxonName.setGenusOrUninomial(getFromMap(atomisedMap, "Genus"));
@@ -472,7 +480,7 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
                        taxonName.setBasionymAuthorship(team);
                    }
                    if (taxonName.hasProblem()) {
-                       logger.info("pb ICNB");
+                       logger.info("pb ICNP");
                        problem = true;
                    }
                    else {
@@ -540,7 +548,7 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
 
            /**
             * Very fast and dirty implementation to allow handling of transient objects as described in
-            * https://dev.e-taxonomy.eu/trac/ticket/3726
+            * https://dev.e-taxonomy.eu/redmine/issues/3726
             *
             * Not yet complete.
             *
@@ -597,15 +605,19 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
                commitTransaction(state.getTx());
                state.setTx(startTransaction());
                try{
-               Pager<SpecimenOrObservationBase> existingSpecimens = cdmAppController.getOccurrenceService().findByTitle(config);
-               if(!existingSpecimens.getRecords().isEmpty()){
-                   if(existingSpecimens.getRecords().size()==1){
-                       return existingSpecimens.getRecords().iterator().next();
-                   }
-               }
+                       Pager<SpecimenOrObservationBase> existingSpecimens = cdmAppController.getOccurrenceService().findByTitle(config);
+                       if(!existingSpecimens.getRecords().isEmpty()){
+                           if(existingSpecimens.getRecords().size()==1){
+                               return existingSpecimens.getRecords().iterator().next();
+                           }
+                       }
+
                }catch(NullPointerException e){
                        logger.error("searching for existing specimen creates NPE: " + config.getSignificantIdentifier());
+                       e.printStackTrace();
                }
+
+
                return null;
            }
 
@@ -757,28 +769,6 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
            //    for our new source.
            protected IdentifiableSource getIdentifiableSource(Reference reference, String citationDetail) {
 
-             /*  List<IdentifiableSource> issTmp = getCommonService().list(IdentifiableSource.class, null, null, null, null);
-
-
-               if (reference != null){
-                   try {
-                       for (OriginalSourceBase<?> osb: issTmp){
-                           if (osb.getCitation() != null && osb.getCitation().getTitleCache().equalsIgnoreCase(reference.getTitleCache())){
-                               String osbDetail = osb.getCitationMicroReference();
-                               if ((StringUtils.isBlank(osbDetail) && StringUtils.isBlank(citationDetail))
-                                       || (osbDetail != null && osbDetail.equalsIgnoreCase(citationDetail)) ) {
-//                                 System.out.println("REFERENCE FOUND RETURN EXISTING SOURCE");
-                                   return (IdentifiableSource) osb.clone();
-                               }
-                           }
-                       }
-                   } catch (CloneNotSupportedException e) {
-                       throw new RuntimeException(e);
-                   } catch (Exception e1){
-                       e1.printStackTrace();
-                   }
-               }
-       */
                IdentifiableSource sour = IdentifiableSource.NewInstance(OriginalSourceType.Import,null,null, reference,citationDetail);
                return sour;
            }
@@ -852,6 +842,30 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
                            parent = linkParentChildNode(species, subspecies, classification, state);
                        }
                    }
+               }else{
+                   //handle cf. and aff. taxa
+                   String genusEpithet = null;
+                   if (nvname.getTitleCache().contains("cf.")){
+                       genusEpithet = nvname.getTitleCache().substring(0, nvname.getTitleCache().indexOf("cf."));
+                   } else if (nvname.getTitleCache().contains("aff.")){
+                       genusEpithet = nvname.getTitleCache().substring(0, nvname.getTitleCache().indexOf("aff."));
+                   }
+                   if (genusEpithet != null){
+                   genusEpithet = genusEpithet.trim();
+                   TaxonName taxonName = null;
+                   if (genusEpithet.contains(" ")){
+                       taxonName = getOrCreateTaxonName(genusEpithet, Rank.SPECIES(), preferredFlag, state, -1);
+                   }else{
+                       taxonName = getOrCreateTaxonName(genusEpithet, Rank.GENUS(), preferredFlag, state, -1);
+                   }
+                   genus = getOrCreateTaxonForName(taxonName, state);
+                    if (genus == null){
+                        logger.debug("The genus should not be null " + taxonName);
+                    }
+                    if (preferredFlag) {
+                        parent = linkParentChildNode(null, genus, classification, state);
+                    }
+                   }
                }
                if (preferredFlag && parent!=taxon ) {
                    linkParentChildNode(parent, taxon, classification, state);
@@ -868,9 +882,12 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
             */
            protected Taxon linkParentChildNode(Taxon parent, Taxon child, Classification classification, STATE state) {
                TaxonNode node =null;
+               List<String> propertyPaths = new ArrayList<>();
+            propertyPaths.add("childNodes");
                if (parent != null) {
-                   parent = (Taxon) getTaxonService().find(parent.getUuid());
-                   child = (Taxon) getTaxonService().find(child.getUuid());
+
+                   parent = (Taxon) getTaxonService().load(parent.getUuid(), propertyPaths);
+                   child = (Taxon) getTaxonService().load(child.getUuid(), propertyPaths);
                    //here we do not have to check if the taxon nodes already exists
                    //this is done by classification.addParentChild()
                    //do not add child node if it already exists
@@ -990,7 +1007,9 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
                    String preferred = identification.getPreferred();
                    preferredFlag = false;
                    if (preferred != null || state.getDataHolder().getIdentificationList().size()==1){
-                   if (preferred.equals("1") || preferred.toLowerCase().indexOf("true") != -1 || state.getDataHolder().getIdentificationList().size()==1) {
+                       if (state.getDataHolder().getIdentificationList().size()==1){
+                           preferredFlag = true;
+                       }else if (preferred != null && (preferred.equals("1") || preferred.toLowerCase().indexOf("true") != -1) ) {
                        preferredFlag = true;
                    }
 
@@ -1006,7 +1025,7 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
                    TaxonName taxonName = getOrCreateTaxonName(scientificName, null, preferredFlag, state, i);
                    Taxon taxon = getOrCreateTaxonForName(taxonName, state);
                    addTaxonNode(taxon, state,preferredFlag);
-                   linkDeterminationEvent(state, taxon, preferredFlag, derivedUnitFacade, identification.getIdentifier(), identification.getDate());
+                   linkDeterminationEvent(state, taxon, preferredFlag, derivedUnitFacade, identification.getIdentifier(), identification.getDate(), identification.getModifier());
                }
            }
 
@@ -1076,7 +1095,7 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
             * @param derivedFacade : the derived Unit Facade
             */
            @SuppressWarnings("rawtypes")
-        protected void linkDeterminationEvent(STATE state, Taxon taxon, boolean preferredFlag,  DerivedUnitFacade derivedFacade, String identifierStr, String dateStr) {
+        protected void linkDeterminationEvent(STATE state, Taxon taxon, boolean preferredFlag,  DerivedUnitFacade derivedFacade, String identifierStr, String dateStr, String modifier) {
                SpecimenImportConfiguratorBase config = state.getConfig();
                if (logger.isDebugEnabled()){
                    logger.info("start linkdetermination with taxon:" + taxon.getUuid()+", "+taxon);
@@ -1098,6 +1117,13 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
                if (dateStr != null){
                    determinationEvent.setTimeperiod(TimePeriodParser.parseString(dateStr));
                }
+               if (modifier != null){
+                   if (modifier.equals("cf.")){
+                       determinationEvent.setModifier(DefinedTerm.DETERMINATION_MODIFIER_CONFER());
+                   }else if (modifier.equals("aff.")){
+                       determinationEvent.setModifier(DefinedTerm.DETERMINATION_MODIFIER_AFFINIS());
+                   }
+               }
                state.getDerivedUnitBase().addDetermination(determinationEvent);
 
                if (logger.isDebugEnabled()){
@@ -1179,36 +1205,36 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
 
                TaxonDescription taxonDescription = null;
                Set<TaxonDescription> descriptions= taxon.getDescriptions();
-              if (!descriptions.isEmpty()){ taxonDescription = descriptions.iterator().next();}
-
-//                 for (TaxonDescription description : descriptions){
-//                     Set<IdentifiableSource> sources =  new HashSet<>();
-//                     sources.addAll(description.getTaxon().getSources());
-//                     sources.addAll(description.getSources());
-//                     for (IdentifiableSource source:sources){
-//                         if(state.getRef().equals(source.getCitation())) {
-//                             taxonDescription = description;
-//                         }
-//                     }
-//                 }
-             //  }
-               if (taxonDescription == null){
+               if (state.getIndividualsAssociationDescriptionPerTaxon(taxon.getUuid()) != null){
+                   taxonDescription = state.getIndividualsAssociationDescriptionPerTaxon(taxon.getUuid());
+               }
+              if (taxonDescription == null && !descriptions.isEmpty() && state.getConfig().isReuseExistingDescriptiveGroups()){
+                  for (TaxonDescription desc: descriptions){
+                      if (desc.getTypes().contains(DescriptionType.INDIVIDUALS_ASSOCIATION)){
+                          taxonDescription = desc;
+                          break;
+                      }
+                  }
+              }
+
+              if (taxonDescription == null){
                    taxonDescription = TaxonDescription.NewInstance(taxon, false);
+                   taxonDescription.setTypes(EnumSet.of(DescriptionType.INDIVIDUALS_ASSOCIATION));
                    if(sourceNotLinkedToElement(taxonDescription,state.getRef(),null)) {
                        taxonDescription.addSource(OriginalSourceType.Import, null, null, state.getRef(), null);
                    }
-                   state.setDescriptionGroup(taxonDescription);
+                   state.setIndividualsAssociationDescriptionPerTaxon(taxonDescription);
                    taxon.addDescription(taxonDescription);
                }
 
                //PREPARE REFERENCE QUESTIONS
 
-               Map<String,OriginalSourceBase<?>> sourceMap = new HashMap<String, OriginalSourceBase<?>>();
+               Map<String,OriginalSourceBase> sourceMap = new HashMap<>();
 
                List<IdentifiableSource> issTmp = new ArrayList<>();//getCommonService().list(IdentifiableSource.class, null, null, null, null);
                List<DescriptionElementSource> issTmp2 = new ArrayList<>();//getCommonService().list(DescriptionElementSource.class, null, null, null, null);
 
-               Set<OriginalSourceBase> osbSet = new HashSet<OriginalSourceBase>();
+               Set<OriginalSourceBase> osbSet = new HashSet<>();
                if(issTmp2!=null) {
                    osbSet.addAll(issTmp2);
                }
@@ -1219,119 +1245,34 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
 
                addToSourceMap(sourceMap, osbSet);
 
-//             if (((Abcd206ImportConfigurator) state.getConfig()).isInteractWithUser()){
-//                 List<OriginalSourceBase<?>> res = null;
-//                 if(!state.isDescriptionSourcesSet()){
-//                     res = sui.askForSource(sourceMap, "the description group ("+taxon+")",
-//                             "The current reference is "+state.getRef().getTitleCache(),getReferenceService(), state.getDataHolder().docSources);
-//                     state.setDescriptionRefs(res);
-//                     state.setDescriptionSourcesSet(true);
-//                 }
-//                 else{
-//                     res=state.getDescriptionRefs();
-//                 }
-//                 if(res !=null) {
-//                     for (OriginalSourceBase<?> sour:res){
-//                         if(sour.isInstanceOf(IdentifiableSource.class)){
-//                             try {
-//                                 if(sourceNotLinkedToElement(taxonDescription,sour)) {
-//                                     taxonDescription.addSource((IdentifiableSource)sour.clone());
-//                                 }
-//                             } catch (CloneNotSupportedException e) {
-//                                 logger.warn("no cloning?");
-//                             }
-//                         }else{
-//                             if(sourceNotLinkedToElement(taxonDescription,sour)) {
-//                                 taxonDescription.addSource(OriginalSourceType.Import,null, null, sour.getCitation(),sour.getCitationMicroReference());
-//                             }
-//                         }
-//                     }
-//                 }
-//             }
-//             else {
-                   if(sourceNotLinkedToElement(taxonDescription,state.getRef(),null)) {
-                       taxonDescription.addSource(OriginalSourceType.Import,null, null, state.getRef(), null);
-                   }
-//             }
-               state.setDescriptionGroup(taxonDescription);
+
+            if(sourceNotLinkedToElement(taxonDescription,state.getRef(),null)) {
+                taxonDescription.addSource(OriginalSourceType.Import,null, null, state.getRef(), null);
+            }
+
+               state.setIndividualsAssociationDescriptionPerTaxon(taxonDescription);
 
                IndividualsAssociation indAssociation = IndividualsAssociation.NewInstance();
                Feature feature = makeFeature(state.getDerivedUnitBase());
                indAssociation.setAssociatedSpecimenOrObservation(state.getDerivedUnitBase());
                indAssociation.setFeature(feature);
-//
-//             if (((Abcd206ImportConfigurator) state.getConfig()).isInteractWithUser()){
-//                 sourceMap = new HashMap<String, OriginalSourceBase<?>>();
-//
-//                 issTmp = getCommonService().list(IdentifiableSource.class, null, null, null, null);
-//                 issTmp2 = getCommonService().list(DescriptionElementSource.class, null, null, null, null);
-//
-//                 osbSet = new HashSet<OriginalSourceBase>();
-//                 if(issTmp2!=null) {
-//                     osbSet.addAll(issTmp2);
-//                 }
-//                 if(issTmp!=null) {
-//                     osbSet.addAll(issTmp);
-//                 }
-//
-//
-//                 addToSourceMap(sourceMap, osbSet);
-//
-//                 List<OriginalSourceBase<?>> sources =null;
-//                 if(!state.isAssociationSourcesSet()) {
-//                     sources = sui.askForSource(sourceMap,  "descriptive element (association) ",taxon.toString(),
-//                             getReferenceService(),state.getDataHolder().getDocSources());
-//                     state.setAssociationRefs(sources);
-//                     state.setAssociationSourcesSet(true);
-//                 }
-//                 else{
-//                     sources=state.getAssociationRefs();
-//                 }
-//                 if(sources !=null) {
-//                     for (OriginalSourceBase<?> source: sources) {
-//                         if(source !=null) {
-//                             if(source.isInstanceOf(DescriptionElementSource.class)){
-//                                 try {
-//                                     if(sourceNotLinkedToElement(indAssociation,source)) {
-//                                         indAssociation.addSource((DescriptionElementSource)source.clone());
-//                                     }
-//                                 } catch (CloneNotSupportedException e) {
-//                                     logger.warn("clone forbidden?");
-//                                 }
-//                             }else{
-//                                 if(sourceNotLinkedToElement(indAssociation,source)) {
-//                                     indAssociation.addSource(OriginalSourceType.Import,null, null, source.getCitation(),source.getCitationMicroReference());
-//                                 }
-//                                 try {
-//                                     if(sourceNotLinkedToElement(state.getDerivedUnitBase(), source)) {
-//                                         state.getDerivedUnitBase().addSource((IdentifiableSource) source.clone());
-//                                     }
-//                                 } catch (CloneNotSupportedException e) {
-//                                     // TODO Auto-generated catch block
-//                                     e.printStackTrace();
-//                                 }
-//                             }
-//
-//                         }
-//                     }
-//                 }
-//             }else {
-                   if(sourceNotLinkedToElement(indAssociation,state.getRef(),null)) {
-                       indAssociation.addSource(OriginalSourceType.Import,null, null, state.getRef(), null);
-                   }
-                   if(sourceNotLinkedToElement(state.getDerivedUnitBase(), state.getRef(),null)) {
-                       state.getDerivedUnitBase().addSource(OriginalSourceType.Import,null, null, state.getRef(), null);
-                   }
-                   for (Reference citation : determinationEvent.getReferences()) {
-                       if(sourceNotLinkedToElement(indAssociation,citation,null))
-                       {
-                           indAssociation.addSource(DescriptionElementSource.NewInstance(OriginalSourceType.Import, null, null, citation, null));
-                       }
-                       if(sourceNotLinkedToElement(state.getDerivedUnitBase(), state.getRef(),null)) {
-                           state.getDerivedUnitBase().addSource(OriginalSourceType.Import,null, null, state.getRef(), null);
-                       }
-                   }
-          //     }
+
+            if(sourceNotLinkedToElement(indAssociation,state.getImportReference(state.getActualAccessPoint()),null)) {
+                indAssociation.addSource(OriginalSourceType.Import,null, null, state.getImportReference(state.getActualAccessPoint()), null);
+            }
+            if(sourceNotLinkedToElement(state.getDerivedUnitBase(), state.getImportReference(state.getActualAccessPoint()),null)) {
+                state.getDerivedUnitBase().addSource(OriginalSourceType.Import,null, null, state.getImportReference(state.getActualAccessPoint()), null);
+            }
+            for (Reference citation : determinationEvent.getReferences()) {
+                if(sourceNotLinkedToElement(indAssociation,citation,null))
+                {
+                    indAssociation.addSource(DescriptionElementSource.NewInstance(OriginalSourceType.Import, null, null, citation, null));
+                }
+                if(sourceNotLinkedToElement(state.getDerivedUnitBase(), state.getImportReference(state.getActualAccessPoint()),null)) {
+                    state.getDerivedUnitBase().addSource(OriginalSourceType.Import,null, null, state.getImportReference(state.getActualAccessPoint()), null);
+                }
+            }
+
 
                taxonDescription.addElement(indAssociation);
 
@@ -1389,7 +1330,7 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
                return true;
            }
 
-           private <T extends OriginalSourceBase<?>> boolean  sourceNotLinkedToElement(ISourceable<T> sourcable, Reference reference, String microReference) {
+           private <T extends OriginalSourceBase> boolean  sourceNotLinkedToElement(ISourceable<T> sourcable, Reference reference, String microReference) {
                Set<T> linkedSources = sourcable.getSources();
                for (T is:linkedSources){
                    Reference unitReference = is.getCitation();
@@ -1447,7 +1388,7 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
                    //            return getFeature("Specimen or observation");
                }else{
                    String message = "Unhandled record basis '%s' for defining individuals association feature type. Use default.";
-                   logger.warn(String.format(message, type.getMessage()));
+                   logger.warn(String.format(message, type.getLabel()));
                    return Feature.OBSERVATION();
                    //            return getFeature("Specimen or observation");
 
@@ -1459,8 +1400,8 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
             * @param sourceMap
             * @param osbSet
             */
-           protected void addToSourceMap(Map<String, OriginalSourceBase<?>> sourceMap, Set<OriginalSourceBase> osbSet) {
-               for( OriginalSourceBase<?> osb:osbSet) {
+           protected void addToSourceMap(Map<String, OriginalSourceBase> sourceMap, Set<OriginalSourceBase> osbSet) {
+               for( OriginalSourceBase osb:osbSet) {
                    if(osb.getCitation()!=null && osb.getCitationMicroReference() !=null  && !osb.getCitationMicroReference().isEmpty()) {
                        try{
                            sourceMap.put(osb.getCitation().getTitleCache()+ "---"+osb.getCitationMicroReference(),osb);
@@ -1474,4 +1415,6 @@ public abstract class SpecimenImportBase<CONFIG extends IImportConfigurator, STA
            }
 
 
+
+
 }