Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRAD2-2761: replace minCode with schoolId for SchoolClob. #289

Merged
merged 3 commits into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ public class School {
private String postal;
private String openFlag;
private String schoolCategoryCode;
private String schoolCategoryCodeInstitute;
private String schoolCategoryLegacyCode;

public String getSchoolName() {
return schoolName != null ? schoolName.trim(): null;
@@ -49,7 +49,7 @@ public String getPostal() {

@Override
public String toString() {
return "School [minCode=" + minCode + ", schoolId=" + schoolId + ", schoolCategoryCode=" + schoolCategoryCode + ", schoolCategoryCodeInstitute=" + schoolCategoryCodeInstitute
return "School [minCode=" + minCode + ", schoolId=" + schoolId + ", schoolCategoryCode=" + schoolCategoryCode + ", schoolCategoryLegacyCode=" + schoolCategoryLegacyCode
+ ", schoolName=" + schoolName + ", districtName=" + districtName + ", transcriptEligibility=" + transcriptEligibility + ", certificateEligibility=" + certificateEligibility
+ ", address1=" + address1 + ", address2=" + address2 + ", city=" + city + ", provCode=" + provCode + ", countryCode=" + countryCode + ", postal=" + postal + ", openFlag=" + openFlag
+ "]";
Original file line number Diff line number Diff line change
@@ -374,7 +374,7 @@ public List<SchoolReports> getAllSchoolReportListByMincode(String mincode) {
reportList = schoolReportsTransformer.transformToDTO(schoolReportsRepository.findBySchoolOfRecordOrderBySchoolOfRecord(mincode));
}
}
populateSchoolRepors(reportList);
populateSchoolReports(reportList);
return reportList;
}

@@ -386,12 +386,12 @@ public List<SchoolReports> getAllSchoolReportListByReportType(String reportType,
schoolReportsLightEntityList = schoolReportsLightRepository.findByReportTypeCodeAndSchoolOfRecord(reportType, mincode);
}
List<SchoolReports> reportList = schoolReportsTransformer.transformToLightDTO(schoolReportsLightEntityList);
populateSchoolRepors(reportList);
populateSchoolReports(reportList);
return reportList;
}

@Generated
private void populateSchoolRepors(List<SchoolReports> reportList) {
private void populateSchoolReports(List<SchoolReports> reportList) {
reportList.forEach(rep -> {
String accessToken = fetchAccessToken();
GradReportTypes types = gradReportTypesTransformer.transformToDTO(gradReportTypesRepository.findById(rep.getReportTypeCode()));
@@ -657,10 +657,10 @@ public boolean deleteSchoolReports(String minCode, String reportTypeCode) {
}

@Generated
private School getSchool(String minCode, String accessToken) {
private School getSchool(String schoolId, String accessToken) {
try {
return webClient.get()
.uri(String.format(constants.getSchoolByMincodeUrl(), minCode))
.uri(String.format(constants.getSchoolBySchoolIdUrl(), schoolId))
.headers(h -> {
h.setBearerAuth(accessToken);
h.set(EducGradReportApiConstants.CORRELATION_ID, ThreadLocalStateUtil.getCorrelationID());
@@ -669,7 +669,7 @@ private School getSchool(String minCode, String accessToken) {
.bodyToMono(School.class)
.block();
} catch (Exception e) {
logger.warn("Trax School with mincode {} error {}", minCode, e.getMessage());
logger.warn("School clob with schoolId={} error {}", schoolId, e.getMessage());
return null;
}
}
@@ -678,7 +678,7 @@ private School getSchool(String minCode, String accessToken) {
private District getDistrict(String districtCode, String accessToken) {
try {
return webClient.get()
.uri(String.format(constants.getDistrictByMincodeUrl(), districtCode))
.uri(String.format(constants.getDistrictByDistrictNumberUrl(), districtCode))
.headers(h -> h.setBearerAuth(accessToken))
.retrieve()
.bodyToMono(District.class)
Original file line number Diff line number Diff line change
@@ -106,11 +106,11 @@ private EducGradReportApiConstants(){}
@Value("${endpoint.grad-student-api.student-for-special-grad-run-list}")
private String gradStudentApiStudentForSpcGradListUrl;

@Value("${endpoint.grad-trax-api.school-by-min-code.url}")
private String schoolByMincodeUrl;
@Value("${endpoint.grad-trax-api.school-by-school-id.url}")
private String schoolBySchoolIdUrl;

@Value("${endpoint.grad-trax-api.district-by-min-code.url}")
private String districtByMincodeUrl;
@Value("${endpoint.grad-trax-api.district-by-dist-no.url}")
private String districtByDistrictNumberUrl;

// Splunk LogHelper Enabled
@Value("${splunk.log-helper.enabled}")
6 changes: 3 additions & 3 deletions api/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -96,10 +96,10 @@ endpoint:
get-students-for-school-run: ${GRAD_STUDENT_API}api/v1/student/studentschoolreportdata
student-for-special-grad-run-list: ${GRAD_STUDENT_API}api/v1/student/studentlistsearch
grad-trax-api:
school-by-min-code:
school-by-school-id:
url: ${GRAD_TRAX_API}api/v2/trax/school-clob/%s
district-by-min-code:
url: ${GRAD_TRAX_API}api/v2/trax/district/%s
district-by-dist-no:
url: ${GRAD_TRAX_API}api/v2/trax/district?distNo=%s

#Splunk LogHelper
splunk:
Original file line number Diff line number Diff line change
@@ -1382,7 +1382,7 @@ public void testGetAllSchoolReportList() {
schoolReportsLightEntityList.add(schoolReports4);

when(this.webClient.get()).thenReturn(this.requestHeadersUriMock);
when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolByMincodeUrl(),mincode2))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolBySchoolIdUrl(),mincode2))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock);
when(this.responseMock.bodyToMono(School.class)).thenReturn(Mono.just(schObj));
@@ -1394,7 +1394,7 @@ public void testGetAllSchoolReportList() {
district.setDisplayName("SOOKE");

when(this.webClient.get()).thenReturn(this.requestHeadersUriMock);
when(this.requestHeadersUriMock.uri(String.format(constants.getDistrictByMincodeUrl(),district.getDistrictNumber()))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersUriMock.uri(String.format(constants.getDistrictByDistrictNumberUrl(),district.getDistrictNumber()))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock);
when(this.responseMock.bodyToMono(District.class)).thenReturn(Mono.just(district));
@@ -1471,7 +1471,7 @@ public void testGetAllSchoolReportList_withoutwildcard() {
mockAccessToken();

when(this.webClient.get()).thenReturn(this.requestHeadersUriMock);
when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolByMincodeUrl(),mincode2))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolBySchoolIdUrl(),mincode2))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock);
when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock);
when(this.responseMock.bodyToMono(School.class)).thenReturn(Mono.just(schObj));
6 changes: 3 additions & 3 deletions api/src/test/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -80,10 +80,10 @@ endpoint:
get-students-for-school-run: https://educ-grad-student-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/student/studentschoolreportdata
student-for-special-grad-run-list: https://educ-grad-student-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/student/studentlistsearch
grad-trax-api:
school-by-min-code:
school-by-school-id:
url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v2/trax/school-clob/%s
district-by-min-code:
url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v2/trax/district/%s
district-by-dist-no:
url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v2/trax/district?distNo=%s

#Splunk LogHelper
splunk: