diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/api/client/School.java b/api/src/main/java/ca/bc/gov/educ/grad/report/api/client/School.java index ba0aa2c6..9e4de729 100644 --- a/api/src/main/java/ca/bc/gov/educ/grad/report/api/client/School.java +++ b/api/src/main/java/ca/bc/gov/educ/grad/report/api/client/School.java @@ -8,6 +8,7 @@ public class School implements Serializable { + private String schoolId = ""; private String mincode = ""; private String name = ""; private String typeIndicator = ""; @@ -24,6 +25,14 @@ public class School implements Serializable { private List students = new ArrayList<>(); + public String getSchoolId() { + return schoolId; + } + + public void setSchoolId(String value) { + this.schoolId = value; + } + public String getMincode() { return mincode; } diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/api/client/TraxSchool.java b/api/src/main/java/ca/bc/gov/educ/grad/report/api/client/TraxSchool.java index d9b7a074..1cba0732 100644 --- a/api/src/main/java/ca/bc/gov/educ/grad/report/api/client/TraxSchool.java +++ b/api/src/main/java/ca/bc/gov/educ/grad/report/api/client/TraxSchool.java @@ -18,8 +18,8 @@ public class TraxSchool { private String countryCode; private String postal; private String openFlag; + private String schoolCategoryLegacyCode; private String schoolCategoryCode; - private String schoolCategoryCodeInstitute; public String getSchoolName() { return schoolName != null ? schoolName.trim() : null; @@ -47,7 +47,7 @@ public String getPostal() { @Override public String toString() { - return "School [minCode=" + minCode + ", schoolId=" + schoolId + ", schoolCategoryCode=" + schoolCategoryCode + ", schoolCategoryCodeInstitute=" + schoolCategoryCodeInstitute + return "School [minCode=" + minCode + ", schoolId=" + schoolId + ", schoolCategoryLegacyCode=" + schoolCategoryLegacyCode + ", schoolCategoryCode=" + schoolCategoryCode + ", schoolName=" + schoolName + ", districtName=" + districtName + ", transcriptEligibility=" + transcriptEligibility + ", certificateEligibility=" + certificateEligibility + ", address1=" + address1 + ", address2=" + address2 + ", city=" + city + ", provCode=" + provCode + ", countryCode=" + countryCode + ", postal=" + postal + ", openFlag=" + openFlag + "]"; diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/dao/GradDataConvertionBean.java b/api/src/main/java/ca/bc/gov/educ/grad/report/dao/GradDataConvertionBean.java index 27321421..ecfa60d9 100644 --- a/api/src/main/java/ca/bc/gov/educ/grad/report/dao/GradDataConvertionBean.java +++ b/api/src/main/java/ca/bc/gov/educ/grad/report/dao/GradDataConvertionBean.java @@ -110,7 +110,8 @@ public StudentInfo getStudentInfo(ReportData reportData) { school.getAddress() != null ? school.getAddress().getRegion() : "",// String schoolProv, school.getAddress() != null ? school.getAddress().getPostalCode() : "",// String schoolPostalCode, school.getPhoneNumber(),// String schoolPhone, - school.getTypeIndicator()// Character schlIndType + school.getTypeIndicator(),// Character schlIndType, + school.getSchoolId()// String schoolId ); result.setNonGradReasons(this.getNongradReasons(reportData)); result.setHasOtherProgram(student.getHasOtherProgram()); diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/dto/impl/SchoolImpl.java b/api/src/main/java/ca/bc/gov/educ/grad/report/dto/impl/SchoolImpl.java index fa058e8d..a062a89c 100644 --- a/api/src/main/java/ca/bc/gov/educ/grad/report/dto/impl/SchoolImpl.java +++ b/api/src/main/java/ca/bc/gov/educ/grad/report/dto/impl/SchoolImpl.java @@ -34,6 +34,7 @@ public class SchoolImpl extends DistrictImpl implements School { private static final long serialVersionUID = 4L; + private String schoolId = ""; private String mincode = ""; private String schlno = ""; private String schoolCategoryCode = ""; @@ -49,6 +50,15 @@ public void setMincode(final String mincode) { this.mincode = mincode; } + @Override + public String getSchoolId() { + return schoolId; + } + + public void setSchoolId(String schoolId) { + this.schoolId = schoolId; + } + @JsonProperty("minCode") public String getMincode() { return mincode; diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/dto/impl/StudentInfoImpl.java b/api/src/main/java/ca/bc/gov/educ/grad/report/dto/impl/StudentInfoImpl.java index 47519fb0..8d2cad14 100644 --- a/api/src/main/java/ca/bc/gov/educ/grad/report/dto/impl/StudentInfoImpl.java +++ b/api/src/main/java/ca/bc/gov/educ/grad/report/dto/impl/StudentInfoImpl.java @@ -139,6 +139,7 @@ public StudentInfoImpl() { * @param schoolPostalCode * @param schoolPhone * @param schlIndType + * @param schoolId */ public StudentInfoImpl( final String studNo, @@ -178,7 +179,8 @@ public StudentInfoImpl( final String schoolProv, final String schoolPostalCode, final String schoolPhone, - final String schlIndType) { + final String schlIndType, + final String schoolId) { this.pen = trimSafe(studNo); this.firstName = trimSafe(firstName); @@ -214,7 +216,7 @@ public StudentInfoImpl( this.schoolPostalCode = trimSafe(schoolPostalCode); this.schoolPhone = trimSafe(schoolPhone); this.schoolTypeIndicator = trimSafe(schlIndType); - + this.schoolId = schoolId; //setSchoolTypeBanner(); this.academicProgram.add(trimSafe(prgmCode)); diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/model/school/School.java b/api/src/main/java/ca/bc/gov/educ/grad/report/model/school/School.java index c6dfefc5..e2fae497 100644 --- a/api/src/main/java/ca/bc/gov/educ/grad/report/model/school/School.java +++ b/api/src/main/java/ca/bc/gov/educ/grad/report/model/school/School.java @@ -26,6 +26,13 @@ */ public interface School extends District { + /** + * Returns the schoolId the Institute uses to uniquely identify this school. + * + * @return schoolId + */ + String getSchoolId(); + /** * Returns the code the Ministry uses to uniquely identify this school. * diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/service/impl/GradReportServiceImpl.java b/api/src/main/java/ca/bc/gov/educ/grad/report/service/impl/GradReportServiceImpl.java index a2b9dc13..c495a4ec 100644 --- a/api/src/main/java/ca/bc/gov/educ/grad/report/service/impl/GradReportServiceImpl.java +++ b/api/src/main/java/ca/bc/gov/educ/grad/report/service/impl/GradReportServiceImpl.java @@ -340,7 +340,7 @@ School adaptSchool(final StudentInfo studentInfo, String accessToken, boolean ch SchoolImpl school = new SchoolImpl(); if(checkEligibility) { - TraxSchool traxSchool = getSchool(studentInfo.getMincode(), accessToken); + TraxSchool traxSchool = getSchool(studentInfo.getSchoolId(), accessToken); if (traxSchool != null && "N".equalsIgnoreCase(traxSchool.getTranscriptEligibility())) { EntityNotFoundException dse = new EntityNotFoundException( getClass(), @@ -365,6 +365,7 @@ School adaptSchool(final StudentInfo studentInfo, String accessToken, boolean ch } void populateSchoolFromStudentInfo(SchoolImpl school, StudentInfo studentInfo) { + school.setSchoolId(studentInfo.getSchoolId()); school.setMincode(studentInfo.getMincode()); school.setName(studentInfo.getSchoolName()); @@ -382,9 +383,11 @@ void populateSchoolFromStudentInfo(SchoolImpl school, StudentInfo studentInfo) { } void populateSchoolFromTraxSchool(SchoolImpl school, TraxSchool traxSchool) { - school.setSchoolCategoryCode(traxSchool.getSchoolCategoryCode()); + school.setSchoolCategoryCode(traxSchool.getSchoolCategoryLegacyCode()); + school.setSchoolId(traxSchool.getSchoolId()); school.setMincode(traxSchool.getMinCode()); school.setName(traxSchool.getSchoolName()); + school.setSchoolCategoryCode(traxSchool.getSchoolCategoryLegacyCode()); final CanadianPostalAddressImpl address = new CanadianPostalAddressImpl(); address.setStreetLine1(traxSchool.getAddress1()); address.setStreetLine2(traxSchool.getAddress2()); @@ -420,18 +423,18 @@ int parseCredits(final String credits) { } - TraxSchool getSchool(String minCode, String accessToken) { + TraxSchool getSchool(String schoolId, String accessToken) { TraxSchool traxSchool = null; - if(!StringUtils.isBlank(minCode)) { + if(!StringUtils.isBlank(schoolId)) { try { traxSchool = webClient.get() - .uri(String.format(constants.getSchoolDetails(), minCode)) + .uri(String.format(constants.getSchoolDetails(), schoolId)) .headers(h -> h.setBearerAuth(accessToken)) .retrieve() .bodyToMono(TraxSchool.class) .block(); } catch (Exception e) { - LOG.log(Level.WARNING, "Unable to get TRAX school by {0} code. Reason {1}", new String[]{minCode, e.getMessage()}); + LOG.log(Level.WARNING, "Unable to get TRAX school by schoolId={0}. Reason {1}", new String[]{schoolId, e.getMessage()}); } } return traxSchool; diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/service/impl/StudentCertificateServiceImpl.java b/api/src/main/java/ca/bc/gov/educ/grad/report/service/impl/StudentCertificateServiceImpl.java index 349c357b..c9a75e46 100644 --- a/api/src/main/java/ca/bc/gov/educ/grad/report/service/impl/StudentCertificateServiceImpl.java +++ b/api/src/main/java/ca/bc/gov/educ/grad/report/service/impl/StudentCertificateServiceImpl.java @@ -110,8 +110,8 @@ public List buildReport() throws DomainServiceException { final Student student = getStudent(reportData); //validated final School school = getSchool(reportData); //validated - if(school != null && !StringUtils.isBlank(school.getMinistryCode())) { - TraxSchool traxSchool = getSchool(school.getMinistryCode(), accessToken); + if(school != null && !StringUtils.isBlank(school.getSchoolId())) { + TraxSchool traxSchool = getSchool(school.getSchoolId(), accessToken); if(traxSchool != null) { if ("N".equalsIgnoreCase(traxSchool.getCertificateEligibility())) { EntityNotFoundException dse = new EntityNotFoundException( @@ -122,7 +122,7 @@ public List buildReport() throws DomainServiceException { throw dse; } if(StringUtils.isBlank(school.getSchoolCategoryCode())) { - ((SchoolImpl) school).setSchoolCategoryCode(traxSchool.getSchoolCategoryCode()); + ((SchoolImpl) school).setSchoolCategoryCode(traxSchool.getSchoolCategoryLegacyCode()); } } } diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/utils/EducGradReportApiConstants.java b/api/src/main/java/ca/bc/gov/educ/grad/report/utils/EducGradReportApiConstants.java index 917d8213..c1baf85f 100644 --- a/api/src/main/java/ca/bc/gov/educ/grad/report/utils/EducGradReportApiConstants.java +++ b/api/src/main/java/ca/bc/gov/educ/grad/report/utils/EducGradReportApiConstants.java @@ -35,7 +35,7 @@ public class EducGradReportApiConstants { @Value("${endpoint.educ-grad-trax-api.get-district-details.url}") private String districtDetails; - @Value("${endpoint.educ-grad-trax-api.school-by-min-code.url}") + @Value("${endpoint.educ-grad-trax-api.school-by-school-id.url}") private String schoolDetails; @Value("${endpoint.educ-grad-trax-api.country-by-code.url}") diff --git a/api/src/main/resources/application.yaml b/api/src/main/resources/application.yaml index a8010047..728c1d91 100644 --- a/api/src/main/resources/application.yaml +++ b/api/src/main/resources/application.yaml @@ -100,8 +100,8 @@ endpoint: url: ${GRAD_REPORT_API}api/v1/reports/signatures educ-grad-trax-api: get-district-details: - url: ${GRAD_TRAX_API}api/v2/trax/district/%s - school-by-min-code: + url: ${GRAD_TRAX_API}api/v2/trax/district?distNo=%s + school-by-school-id: url: ${GRAD_TRAX_API}api/v2/trax/school-clob/%s country-by-code: url: ${GRAD_TRAX_API}api/v1/trax/code/country/%s diff --git a/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/GradReportBaseTest.java b/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/GradReportBaseTest.java index 47170d60..c8e80af6 100644 --- a/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/GradReportBaseTest.java +++ b/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/GradReportBaseTest.java @@ -108,6 +108,7 @@ protected School getReportDataSchool(ReportData reportData) { protected TraxSchool adaptTraxSchool(School school) { TraxSchool traxSchool = new TraxSchool(); + traxSchool.setSchoolId(school.getSchoolId()); traxSchool.setMinCode(school.getMincode()); traxSchool.setSchoolName(school.getName()); if(school.getAddress() != null) { @@ -123,7 +124,7 @@ protected TraxSchool adaptTraxSchool(School school) { protected void mockTraxSchool(TraxSchool traxSchool) { when(this.webClient.get()).thenReturn(this.requestHeadersUriMock); - when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolDetails(),traxSchool.getMinCode()))).thenReturn(this.requestHeadersMock); + when(this.requestHeadersUriMock.uri(String.format(constants.getSchoolDetails(),traxSchool.getSchoolId()))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.headers(any(Consumer.class))).thenReturn(this.requestHeadersMock); when(this.requestHeadersMock.retrieve()).thenReturn(this.responseMock); when(this.responseMock.bodyToMono(TraxSchool.class)).thenReturn(Mono.just(traxSchool)); diff --git a/api/src/test/resources/application.yaml b/api/src/test/resources/application.yaml index 67a5cacc..658df4b1 100644 --- a/api/src/test/resources/application.yaml +++ b/api/src/test/resources/application.yaml @@ -113,8 +113,8 @@ endpoint: url: https://educ-grad-report-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/reports/signatures educ-grad-trax-api: get-district-details: - url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v2/trax/district/%s - school-by-min-code: + url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v2/trax/district?distNo=%s + school-by-school-id: url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v2/trax/school-clob/%s country-by-code: url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/trax/code/country/%s diff --git a/api/src/test/resources/json/schoolNonGraduationReportRequest.json b/api/src/test/resources/json/schoolNonGraduationReportRequest.json index efd3afd8..40f5278e 100644 --- a/api/src/test/resources/json/schoolNonGraduationReportRequest.json +++ b/api/src/test/resources/json/schoolNonGraduationReportRequest.json @@ -10,6 +10,7 @@ "data" : { "student" : null, "school" : { + "schoolId" : "b69bc244-b93b-2a9f-d2b1-3d8ffae92866", "mincode" : "02828034", "name" : "CORRELIEU SECONDARY", "typeIndicator" : null, diff --git a/api/src/test/resources/json/studentAchievementReportRequest.json b/api/src/test/resources/json/studentAchievementReportRequest.json index 267a9be6..0a31fdae 100644 --- a/api/src/test/resources/json/studentAchievementReportRequest.json +++ b/api/src/test/resources/json/studentAchievementReportRequest.json @@ -66,6 +66,7 @@ } }, "school" : { + "schoolId" : "b69bc244-b93b-2a9f-d2b1-3d8ffae92866", "mincode" : "06398007", "name" : "SOUTH ISLAND DISTANCE EDUCATION SCHOOL", "typeIndicator" : "", diff --git a/api/src/test/resources/json/studentCertificateReportRequest-E.json b/api/src/test/resources/json/studentCertificateReportRequest-E.json index 68c73f17..54dc3d9e 100644 --- a/api/src/test/resources/json/studentCertificateReportRequest-E.json +++ b/api/src/test/resources/json/studentCertificateReportRequest-E.json @@ -46,6 +46,7 @@ "nonGradReasons" : [ ] }, "school" : { + "schoolId" : "b69bc244-b93b-2a9f-d2b1-3d8ffae92866", "mincode" : "00502001", "name" : "ROBERT EDGELL", "typeIndicator" : "", diff --git a/api/src/test/resources/json/studentCertificateReportRequest-F.json b/api/src/test/resources/json/studentCertificateReportRequest-F.json index fd13f0f0..00b37279 100644 --- a/api/src/test/resources/json/studentCertificateReportRequest-F.json +++ b/api/src/test/resources/json/studentCertificateReportRequest-F.json @@ -46,6 +46,7 @@ "nonGradReasons" : [ ] }, "school" : { + "schoolId" : "b69bc244-b93b-2a9f-d2b1-3d8ffae92866", "mincode" : "00502001", "name" : "Ecole Secondaire Mark R. Isfeld Secondary", "typeIndicator" : "", diff --git a/api/src/test/resources/json/studentCertificateReportRequest-FN.json b/api/src/test/resources/json/studentCertificateReportRequest-FN.json index 06090299..bfb75654 100644 --- a/api/src/test/resources/json/studentCertificateReportRequest-FN.json +++ b/api/src/test/resources/json/studentCertificateReportRequest-FN.json @@ -46,6 +46,7 @@ "nonGradReasons" : [ ] }, "school" : { + "schoolId" : "b69bc244-b93b-2a9f-d2b1-3d8ffae92866", "mincode" : "00502001", "name" : "ROBERT EDGELL", "typeIndicator" : "", diff --git a/api/src/test/resources/json/studentCertificateReportRequest-NOTBLANK.json b/api/src/test/resources/json/studentCertificateReportRequest-NOTBLANK.json index b8a3a07d..bf1201e6 100644 --- a/api/src/test/resources/json/studentCertificateReportRequest-NOTBLANK.json +++ b/api/src/test/resources/json/studentCertificateReportRequest-NOTBLANK.json @@ -33,6 +33,7 @@ "frenchCert": "F" }, "school" : { + "schoolId" : "b69bc244-b93b-2a9f-d2b1-3d8ffae92866", "mincode": "03699064", "name": "Ecole Secondaire Mark R. Isfeld Secondary", "typeIndicator": "", diff --git a/api/src/test/resources/json/studentTranscriptReportRequest-NOTELIG_NOPROG.json b/api/src/test/resources/json/studentTranscriptReportRequest-NOTELIG_NOPROG.json index ad93a556..3c908211 100644 --- a/api/src/test/resources/json/studentTranscriptReportRequest-NOTELIG_NOPROG.json +++ b/api/src/test/resources/json/studentTranscriptReportRequest-NOTELIG_NOPROG.json @@ -33,6 +33,7 @@ "frenchCert": "F" }, "school": { + "schoolId" : "b69bc244-b93b-2a9f-d2b1-3d8ffae92866", "mincode": "03939008", "name": "LORD BYNG SECONDARY", "typeIndicator": "",