Skip to content

Commit

Permalink
Merge pull request #289 from bcgov/feature/GRAD2-2761
Browse files Browse the repository at this point in the history
GRAD2-2761: replace minCode with schoolId for SchoolClob.
  • Loading branch information
infstar authored Nov 21, 2024
2 parents 93a057a + 4348d96 commit b2fcf32
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
+ "]";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ public List<SchoolReports> getAllSchoolReportListByMincode(String mincode) {
reportList = schoolReportsTransformer.transformToDTO(schoolReportsRepository.findBySchoolOfRecordOrderBySchoolOfRecord(mincode));
}
}
populateSchoolRepors(reportList);
populateSchoolReports(reportList);
return reportList;
}

Expand All @@ -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()));
Expand Down Expand Up @@ -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());
Expand All @@ -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;
}
}
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
6 changes: 3 additions & 3 deletions api/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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));
Expand Down Expand Up @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions api/src/test/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b2fcf32

Please sign in to comment.