Skip to content

Commit

Permalink
chore: Remove getEnrollments(Program) from store [DHIS2-17712] (#18200)
Browse files Browse the repository at this point in the history
  • Loading branch information
muilpp authored Jul 25, 2024
1 parent 09d5d3e commit 026b441
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
public interface EnrollmentStore extends IdentifiableObjectStore<Enrollment> {
String ID = EnrollmentStore.class.getName();

/** Get enrollments into a program. */
List<Enrollment> get(Program program);

/** Get enrollments into a program that are in given status. */
List<Enrollment> get(Program program, EnrollmentStatus status);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@ public HibernateEnrollmentStore(
super(entityManager, jdbcTemplate, publisher, Enrollment.class, aclService, true);
}

@Override
public List<Enrollment> get(Program program) {
CriteriaBuilder builder = getCriteriaBuilder();

return getList(
builder,
newJpaParameters().addPredicate(root -> builder.equal(root.get("program"), program)));
}

@Override
public List<Enrollment> get(Program program, EnrollmentStatus status) {
CriteriaBuilder builder = getCriteriaBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,6 @@ void testEventExists() {
assertNull(enrollmentStore.get(99999));
}

@Test
void testGetEnrollmentsByProgram() {
enrollmentStore.save(enrollmentA);
enrollmentStore.save(enrollmentB);
enrollmentStore.save(enrollmentD);
List<Enrollment> 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);
Expand Down

0 comments on commit 026b441

Please sign in to comment.