Project

General

Profile

Revision c5802825

IDc5802825b6e79682e97031fdfc6cae4d5b55f216
Parent 3971a637
Child bc7a1271

Added by Katja Luther about 2 years ago

ref #7887: fix deletion of terms

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/TermServiceImpl.java
279 279
		Set<DefinedTermBase> termsToSave = new HashSet<DefinedTermBase>();
280 280

  
281 281
		DeleteResult result = isDeletable(term.getUuid(), config);
282
		if (result.isAbort()) {
283
            return result;
284
        }
285
		//CdmBase.deproxy(dao.merge(term), DefinedTermBase.class);
286

  
282 287
		try {
283 288
			//generalization of
284 289
			Set<DefinedTermBase> specificTerms = term.getGeneralizationOf();
......
412 417
	        //generalization of
413 418
	        Set<DefinedTermBase> specificTerms = term.getGeneralizationOf();
414 419
	        if (!specificTerms.isEmpty() && termConfig.isDeleteGeneralizationOfRelations()){
415
	            result.getRelatedObjects().removeAll(specificTerms);
420
	            references.removeAll(specificTerms);
416 421
	        }
417 422
	        //kind of
418 423
	        DefinedTermBase generalTerm = term.getKindOf();
419 424
	        if (generalTerm != null && termConfig.isDeleteKindOfRelations()){
420
	            result.getRelatedObjects().remove(generalTerm);
425
	            references.remove(generalTerm);
421 426
	        }
422 427
	        //part of
423 428
	        DefinedTermBase parentTerm = term.getPartOf();
424 429
	        if (parentTerm != null && termConfig.isDeletePartOfRelations()){
425
	            result.getRelatedObjects().remove(parentTerm);
430
	            references.remove(parentTerm);
426 431
	        }
427 432
	        //included in
428 433
	        Set<DefinedTermBase> includedTerms = term.getIncludes();
429 434
	        if (!includedTerms.isEmpty() && termConfig.isDeleteIncludedRelations()){
430
	            result.getRelatedObjects().removeAll(includedTerms);
435
	            references.removeAll(includedTerms);
431 436
	        }
432 437
	    }
433 438

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)