Project

General

Profile

« Previous | Next » 

Revision 3c420001

Added by Andreas Müller over 2 years ago

ref #9801, ref #7980, ref #8871 remove aggregated source descriptions from aggregation and fix persistence issues

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/DescriptionServiceImpl.java
684 684
            }
685 685
        }
686 686
        if (deleteResult.isOk() ){
687
            CdmBase.deproxy(description);
687 688
        	if (description instanceof TaxonDescription){
688
        		TaxonDescription taxDescription = HibernateProxyHelper.deproxy(description, TaxonDescription.class);
689
        		TaxonDescription taxDescription = (TaxonDescription)description;
689 690
        		Taxon tax = taxDescription.getTaxon();
690
        		tax.removeDescription(taxDescription, true);
691
                deleteResult.addUpdatedObject(tax);
691
        		if (tax != null){
692
        		    tax.removeDescription(taxDescription, true);
693
        		    deleteResult.addUpdatedObject(tax);
694
        		}
692 695
        	}
693
        	else if (HibernateProxyHelper.isInstanceOf(description, SpecimenDescription.class)){
694
        	    SpecimenDescription specimenDescription = HibernateProxyHelper.deproxy(description, SpecimenDescription.class);
696
        	else if (description instanceof SpecimenDescription){
697
        	    SpecimenDescription specimenDescription = (SpecimenDescription)description;
695 698
        	    SpecimenOrObservationBase<?> specimen = specimenDescription.getDescribedSpecimenOrObservation();
696
        	    specimen.removeDescription(specimenDescription);
697
        	    deleteResult.addUpdatedObject(specimen);
699
        	    if (specimen != null){
700
        	        specimen.removeDescription(specimenDescription);
701
        	        deleteResult.addUpdatedObject(specimen);
702
        	    }
698 703
        	}
699 704

  
700 705
        	for (DescriptiveDataSet dataset : description.getDescriptiveDataSets()) {
......
735 740
                continue;
736 741
            } else if (ref instanceof DescriptionElementBase){
737 742
                continue;
743
            } else if (ref instanceof CdmLinkSource && ((CdmLinkSource)ref).hasNoTarget()) {
744
                continue; //maybe only workaround #9801
738 745
            }else {
739 746
                String message = "The description can't be completely deleted because it is referenced by " + ref.getUserFriendlyTypeName() ;
740 747
                result.setAbort();

Also available in: Unified diff