diff --git a/api/src/main/java/ca/bc/gov/educ/api/grad/report/model/dto/StudentSearchRequest.java b/api/src/main/java/ca/bc/gov/educ/api/grad/report/model/dto/StudentSearchRequest.java index 07f08073..dcad7ff7 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/grad/report/model/dto/StudentSearchRequest.java +++ b/api/src/main/java/ca/bc/gov/educ/api/grad/report/model/dto/StudentSearchRequest.java @@ -8,6 +8,7 @@ import java.io.Serializable; import java.util.List; +import java.util.UUID; @Data @Component @@ -20,6 +21,7 @@ public class StudentSearchRequest implements Serializable { List schoolCategoryCodes; List pens; List programs; + private List studentIDs; Boolean validateInput; } diff --git a/api/src/main/java/ca/bc/gov/educ/api/grad/report/service/CommonService.java b/api/src/main/java/ca/bc/gov/educ/api/grad/report/service/CommonService.java index 795781c2..cd9c897b 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/grad/report/service/CommonService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/grad/report/service/CommonService.java @@ -505,12 +505,15 @@ public boolean updateStudentCredentialPosting(UUID studentID, String credentialT public List getStudentCredentialsForUserRequestDisRun(String credentialType, StudentSearchRequest studentSearchRequest, String accessToken) { List scdList = new ArrayList<>(); - List studentList = getStudentsForSpecialGradRun(studentSearchRequest, accessToken); - if (!studentList.isEmpty()) { + List studentIDs = studentSearchRequest.getStudentIDs(); + if(studentIDs == null || studentIDs.isEmpty()) { + studentIDs = getStudentsForSpecialGradRun(studentSearchRequest, accessToken); + } + if (!studentIDs.isEmpty()) { int partitionSize = 1000; List> partitions = new LinkedList<>(); - for (int i = 0; i < studentList.size(); i += partitionSize) { - partitions.add(studentList.subList(i, Math.min(i + partitionSize, studentList.size()))); + for (int i = 0; i < studentIDs.size(); i += partitionSize) { + partitions.add(studentIDs.subList(i, Math.min(i + partitionSize, studentIDs.size()))); } if (credentialType.equalsIgnoreCase("OC") || credentialType.equalsIgnoreCase("RC")) { processCertificate(partitions, scdList);