From 026b4414267a9b191ef2ddf4d641dc8b8cde3a67 Mon Sep 17 00:00:00 2001 From: marc Date: Thu, 25 Jul 2024 16:25:27 +0200 Subject: [PATCH] chore: Remove getEnrollments(Program) from store [DHIS2-17712] (#18200) --- .../org/hisp/dhis/program/EnrollmentStore.java | 3 --- .../hibernate/HibernateEnrollmentStore.java | 9 --------- .../org/hisp/dhis/program/EnrollmentStoreTest.java | 14 -------------- 3 files changed, 26 deletions(-) diff --git a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/EnrollmentStore.java b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/EnrollmentStore.java index f2ee09d26283..101c8ed6f9a4 100644 --- a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/EnrollmentStore.java +++ b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/EnrollmentStore.java @@ -37,9 +37,6 @@ public interface EnrollmentStore extends IdentifiableObjectStore { String ID = EnrollmentStore.class.getName(); - /** Get enrollments into a program. */ - List get(Program program); - /** Get enrollments into a program that are in given status. */ List get(Program program, EnrollmentStatus status); diff --git a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateEnrollmentStore.java b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateEnrollmentStore.java index 875e5bcf0f6a..203e5868153a 100644 --- a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateEnrollmentStore.java +++ b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/program/hibernate/HibernateEnrollmentStore.java @@ -61,15 +61,6 @@ public HibernateEnrollmentStore( super(entityManager, jdbcTemplate, publisher, Enrollment.class, aclService, true); } - @Override - public List get(Program program) { - CriteriaBuilder builder = getCriteriaBuilder(); - - return getList( - builder, - newJpaParameters().addPredicate(root -> builder.equal(root.get("program"), program))); - } - @Override public List get(Program program, EnrollmentStatus status) { CriteriaBuilder builder = getCriteriaBuilder(); diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/program/EnrollmentStoreTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/program/EnrollmentStoreTest.java index d82e53c31d68..d0bb81c9ad97 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/program/EnrollmentStoreTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/program/EnrollmentStoreTest.java @@ -159,20 +159,6 @@ void testEventExists() { assertNull(enrollmentStore.get(99999)); } - @Test - void testGetEnrollmentsByProgram() { - enrollmentStore.save(enrollmentA); - enrollmentStore.save(enrollmentB); - enrollmentStore.save(enrollmentD); - List enrollments = enrollmentStore.get(programA); - assertEquals(2, enrollments.size()); - assertTrue(enrollments.contains(enrollmentA)); - assertTrue(enrollments.contains(enrollmentD)); - enrollments = enrollmentStore.get(programB); - assertEquals(1, enrollments.size()); - assertTrue(enrollments.contains(enrollmentB)); - } - @Test void testGetEnrollmentsByTrackedEntityProgramAndEnrollmentStatus() { enrollmentStore.save(enrollmentA);