diff --git a/api/src/main/java/ca/bc/gov/educ/api/dataconversion/service/student/StudentService.java b/api/src/main/java/ca/bc/gov/educ/api/dataconversion/service/student/StudentService.java index 20b4a4dd..b3ea1ac2 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/dataconversion/service/student/StudentService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/dataconversion/service/student/StudentService.java @@ -1,7 +1,6 @@ package ca.bc.gov.educ.api.dataconversion.service.student; import ca.bc.gov.educ.api.dataconversion.model.*; -import ca.bc.gov.educ.api.dataconversion.util.EducGradDataConversionApiConstants; import ca.bc.gov.educ.api.dataconversion.util.RestUtils; import io.github.resilience4j.retry.annotation.Retry; import jakarta.transaction.Transactional; @@ -12,7 +11,6 @@ import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.client.WebClient; -import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -36,7 +34,7 @@ public Student getStudentByPen(String pen, String accessToken) { logger.debug("Get Student by PEN [Service]"); Student student; - List gradStudentList = new ArrayList<>(); + List gradStudentList; try { gradStudentList = restUtils.getStudentsByPen(pen, accessToken); @@ -83,7 +81,7 @@ Delete All student related data ({STUDENT_API}/api/v1/student/conv/studentid/{st /* Update TRAX_STUDENT_NO status to NULL */ - restUtils.updateTraxStudentNo(pen, accessToken); + restUtils.updateTraxStudentNo(new TraxStudentNo(pen, null, null), accessToken); } return pen; } diff --git a/api/src/main/java/ca/bc/gov/educ/api/dataconversion/util/RestUtils.java b/api/src/main/java/ca/bc/gov/educ/api/dataconversion/util/RestUtils.java index 7c80a996..4957f1ef 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/dataconversion/util/RestUtils.java +++ b/api/src/main/java/ca/bc/gov/educ/api/dataconversion/util/RestUtils.java @@ -26,7 +26,7 @@ public class RestUtils { private final EducGradDataConversionApiConstants constants; - private ResponseObjCache responseObjCache; + private final ResponseObjCache responseObjCache; private final WebClient webClient; @@ -360,13 +360,14 @@ public TraxStudentNo saveTraxStudentNo(TraxStudentNo traxStudentNo, String acces .retrieve().bodyToMono(TraxStudentNo.class).block(); } - public TraxStudentNo updateTraxStudentNo(String pen, String accessToken) { + public TraxStudentNo updateTraxStudentNo(TraxStudentNo traxStudentNo, String accessToken) { return webClient.put() - .uri(String.format(constants.getSaveTraxStudentNoUrl(), pen)) + .uri(constants.getSaveTraxStudentNoUrl()) .headers(h -> { h.setBearerAuth(accessToken); h.set(EducGradDataConversionApiConstants.CORRELATION_ID, ThreadLocalStateUtil.getCorrelationID()); }) + .body(BodyInserters.fromValue(traxStudentNo)) .retrieve().bodyToMono(TraxStudentNo.class).block(); }