Project

General

Profile

Revision a797ba42

IDa797ba4231947a67e09ac2c93513181fa7eebc89
Parent 159247e6
Child b00ca8de

Added by Patrick Plitzner about 2 years ago

ref #6668 Evaluate update based on existence of type designation match

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/TaxonNameEditorE4.java
58 58
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
59 59
import eu.etaxonomy.cdm.model.common.CdmBase;
60 60
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
61
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
61 62
import eu.etaxonomy.cdm.model.taxon.Taxon;
62 63
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
63 64
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
......
731 732
    @Optional
732 733
    private void updatefromDelete(@UIEventTopic(WorkbenchEventConstants.DELETE_DERIVATIVE)DeleteResult result,
733 734
            EPartService partService, MApplication application){
734
        //TODO evaluate if update necessary based on specimen type designations
735
        EditorUtil.updateEditor(this.input.getTaxonNode(), partService, application);
735
        if(taxon.getName()==null){
736
            return;
737
        }
738
        Set<DerivedUnit> typeDesignationSpecimens = new HashSet<>();
739
        this.taxon.getName().getSpecimenTypeDesignations().forEach(designation->typeDesignationSpecimens.add(designation.getTypeSpecimen()));
740
        //check if any deleted object was a type specimen
741
        if(result.getUpdatedObjects().stream()
742
                //filter only DerivedUnits
743
                .filter(cdmBase->cdmBase.isInstanceOf(DerivedUnit.class))
744
                //deproxy from CdmBase to DerivedUnit
745
                .map(unit->HibernateProxyHelper.deproxy(unit, DerivedUnit.class))
746
                //check for match in type designations
747
                .anyMatch(unit->typeDesignationSpecimens.contains(unit))){
748
            EditorUtil.updateEditor(this.input.getTaxonNode(), partService, application);
749
        }
736 750
    }
737 751

  
738 752
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)