From 2217b953a7fd66307844ce70d1616ad616e03951 Mon Sep 17 00:00:00 2001 From: Enrico Colasante Date: Fri, 19 Jul 2024 15:20:15 +0200 Subject: [PATCH] chore: Remove delete relationship from service [DHIS2-17713] (#18140) --- .../org/hisp/dhis/relationship/RelationshipService.java | 7 ------- .../hisp/dhis/relationship/DefaultRelationshipService.java | 6 ------ .../persister/DefaultTrackerObjectsDeletionService.java | 2 +- .../org/hisp/dhis/maintenance/MaintenanceServiceTest.java | 2 +- 4 files changed, 2 insertions(+), 15 deletions(-) diff --git a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipService.java b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipService.java index dba919cd213b..ed952c2d2459 100644 --- a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipService.java +++ b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/relationship/RelationshipService.java @@ -49,13 +49,6 @@ public interface RelationshipService { */ long addRelationship(Relationship relationship); - /** - * Returns a {@link Relationship}. - * - * @param relationship the relationship. - */ - void deleteRelationship(Relationship relationship); - /** * Returns a {@link Relationship}. * diff --git a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/relationship/DefaultRelationshipService.java b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/relationship/DefaultRelationshipService.java index 60b4e80da06d..c32331a5dd33 100644 --- a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/relationship/DefaultRelationshipService.java +++ b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/relationship/DefaultRelationshipService.java @@ -52,12 +52,6 @@ public class DefaultRelationshipService implements RelationshipService { // Implementation methods // ------------------------------------------------------------------------- - @Override - @Transactional - public void deleteRelationship(Relationship relationship) { - relationshipStore.delete(relationship); - } - @Override @Transactional(readOnly = true) public Relationship getRelationship(long id) { diff --git a/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/imports/bundle/persister/DefaultTrackerObjectsDeletionService.java b/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/imports/bundle/persister/DefaultTrackerObjectsDeletionService.java index 525541f532fc..db0c1ac958c8 100644 --- a/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/imports/bundle/persister/DefaultTrackerObjectsDeletionService.java +++ b/dhis-2/dhis-services/dhis-service-tracker/src/main/java/org/hisp/dhis/tracker/imports/bundle/persister/DefaultTrackerObjectsDeletionService.java @@ -220,7 +220,7 @@ public TrackerTypeReport deleteRelationships(List relationships) { org.hisp.dhis.relationship.Relationship relationship = relationshipService.getRelationship(uid); - relationshipService.deleteRelationship(relationship); + manager.delete(relationship); typeReport.getStats().incDeleted(); typeReport.addEntity(objectReport); diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/maintenance/MaintenanceServiceTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/maintenance/MaintenanceServiceTest.java index d07f57012dfb..ca6669019be7 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/maintenance/MaintenanceServiceTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/maintenance/MaintenanceServiceTest.java @@ -461,7 +461,7 @@ void testDeleteSoftDeletedRelationship() { relationshipService.addRelationship(relationship); assertNotNull(relationshipService.getRelationship(relationship.getUid())); - relationshipService.deleteRelationship(relationship); + manager.delete(relationship); assertNull(relationshipService.getRelationship(relationship.getUid())); assertNotNull(relationshipService.getRelationshipIncludeDeleted(relationship.getUid()));