import java.util.ArrayList;
+import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
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;
}
}
else if (state.getDataHolder().getNomenclatureCode() != null && (state.getDataHolder().getNomenclatureCode().toString().equals("Bacterial") || state.getDataHolder().getNomenclatureCode().toString().contains("ICBN"))) {
- taxonName = (TaxonName)nvnpi.parseFullName(scientificName, NomenclaturalCode.ICNB, rank);
+ taxonName = (TaxonName)nvnpi.parseFullName(scientificName, NomenclaturalCode.ICNP, rank);
if (taxonName.hasProblem()) {
problem = true;
}
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"));
taxonName.setBasionymAuthorship(team);
}
if (taxonName.hasProblem()) {
- logger.info("pb ICNB");
+ logger.info("pb ICNP");
problem = true;
}
else {
TaxonDescription taxonDescription = null;
Set<TaxonDescription> descriptions= taxon.getDescriptions();
- if (state.getDescriptionPerTaxon(taxon.getUuid()) != null){
- taxonDescription = state.getDescriptionPerTaxon(taxon.getUuid());
+ if (state.getIndividualsAssociationDescriptionPerTaxon(taxon.getUuid()) != null){
+ taxonDescription = state.getIndividualsAssociationDescriptionPerTaxon(taxon.getUuid());
}
if (taxonDescription == null && !descriptions.isEmpty() && state.getConfig().isReuseExistingDescriptiveGroups()){
- taxonDescription = descriptions.iterator().next();
+ 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);
}
taxonDescription.addSource(OriginalSourceType.Import,null, null, state.getRef(), null);
}
- state.setDescriptionGroup(taxonDescription);
+ state.setIndividualsAssociationDescriptionPerTaxon(taxonDescription);
IndividualsAssociation indAssociation = IndividualsAssociation.NewInstance();
Feature feature = makeFeature(state.getDerivedUnitBase());
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();
* @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);