diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/model/GraduationStudentRecord.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/model/GraduationStudentRecord.java index 4c9c467a..8ad85191 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/model/GraduationStudentRecord.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/model/GraduationStudentRecord.java @@ -21,6 +21,7 @@ public class GraduationStudentRecord extends BaseModel { private String honoursStanding; private String recalculateGradStatus; private String schoolOfRecord; + private UUID schoolOfRecordId; private String schoolName; private String studentGrade; private String studentStatus; diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/model/School.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/model/School.java index 3df1331d..78d79bbc 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/model/School.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/model/School.java @@ -10,6 +10,7 @@ public class School implements Serializable { private static final long serialVersionUID = 2L; + private String schoolId; private String mincode; private String name; private String typeIndicator; @@ -33,6 +34,14 @@ public School(String mincode) { this.mincode = mincode; } + 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/api/batchgraduation/model/SchoolClob.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/model/SchoolClob.java new file mode 100644 index 00000000..870925f9 --- /dev/null +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/model/SchoolClob.java @@ -0,0 +1,62 @@ +package ca.bc.gov.educ.api.batchgraduation.model; + +import lombok.Data; +import org.springframework.stereotype.Component; + +@Data +@Component +public class SchoolClob { + + private String minCode; + private String schoolId; + private String schoolName; + private String districtName; + private String transcriptEligibility; + private String certificateEligibility; + private String address1; + private String address2; + private String city; + private String provCode; + private String countryCode; + private String postal; + private String openFlag; + private String schoolCategoryCode; + private String schoolCategoryLegacyCode; + + public String getSchoolName() { + return schoolName != null ? schoolName.trim(): null; + } + + public String getDistrictName() { + return districtName != null ? districtName.trim(): null; + } + + public String getAddress1() { + return address1 != null ? address1.trim(): null; + } + + public String getAddress2() { + return address2 != null ? address2.trim(): null; + } + + public String getCity() { + return city != null ? city.trim(): null; + } + + public String getPostal() { + return postal != null ? postal.trim(): null; + } + + public String getOpenFlag() { + return openFlag != null ? openFlag.trim(): null; + } + + @Override + public String toString() { + 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 + + "]"; + } + +} diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/model/TraxSchool.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/model/TraxSchool.java deleted file mode 100644 index 8367c680..00000000 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/model/TraxSchool.java +++ /dev/null @@ -1,114 +0,0 @@ -package ca.bc.gov.educ.api.batchgraduation.model; - -import lombok.Data; -import org.springframework.stereotype.Component; - -@Data -@Component -public class TraxSchool { - - private String minCode; - private String schoolName; - private String districtName; - private String transcriptEligibility; - private String certificateEligibility; - private String independentDesignation; - private String mailerType; - private String address1; - private String address2; - private String city; - private String provCode; - private String provinceName; - private String countryCode; - private String countryName; - private String postal; - private String independentAffiliation; - private String openFlag; - private String signatureDistrict; - private String newMinCode; - private String schoolOrg; - private String appendTrans; - private String ministryContact; - private String principalName; - private String schoolPhone; - private String schoolFax; - private String schoolEmail; - - public String getSchoolName() { - return schoolName != null ? schoolName.trim(): null; - } - - public String getDistrictName() { - return districtName != null ? districtName.trim(): null; - } - - public String getAddress1() { - return address1 != null ? address1.trim(): null; - } - - public String getAddress2() { - return address2 != null ? address2.trim(): null; - } - - public String getCity() { - return city != null ? city.trim(): null; - } - - public String getProvinceName() { - return provinceName != null ? provinceName.trim(): null; - } - - public String getCountryName() { - return countryName != null ? countryName.trim(): null; - } - - public String getPostal() { - return postal != null ? postal.trim(): null; - } - - public String getIndependentDesignation() { - return independentDesignation != null ? independentDesignation.trim(): null; - } - - public String getIndependentAffiliation() { - return independentAffiliation != null ? independentAffiliation.trim(): null; - } - - public String getOpenFlag() { - return openFlag != null ? openFlag.trim(): null; - } - - public String getSignatureDistrict() { - return signatureDistrict != null ? signatureDistrict.trim(): null; - } - - public String getSchoolEmail() { - return schoolEmail != null ? schoolEmail.trim(): null; - } - - public String getPrincipalName() { - return principalName != null ? principalName.trim(): null; - } - - public String getAppendTrans() { - return appendTrans != null ? appendTrans.trim(): null; - } - - public String getMinistryContact() { - return ministryContact != null ? ministryContact.trim(): null; - } - - @Override - public String toString() { - return "School [minCode=" + minCode + ", schoolName=" + schoolName + ", districtName=" + districtName - + ", transcriptEligibility=" + transcriptEligibility + ", certificateEligibility=" - + certificateEligibility + ", independentDesignation=" + independentDesignation + ", mailerType=" - + mailerType + ", address1=" + address1 + ", address2=" + address2 + ", city=" + city + ", provCode=" - + provCode + ", provinceName=" + provinceName + ", countryCode=" + countryCode + ", countryName=" - + countryName + ", postal=" + postal + ", independentAffiliation=" + independentAffiliation - + ", openFlag=" + openFlag + ", signatureDistrict=" + signatureDistrict + ", newMinCode=" + newMinCode - + ", schoolOrg=" + schoolOrg + ", appendTrans=" + appendTrans + ", ministryContact=" + ministryContact - + ", principalName=" + principalName + ", schoolPhone=" + schoolPhone + ", schoolFax=" + schoolFax - + ", schoolEmail=" + schoolEmail + "]"; - } -} diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/rest/RestUtils.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/rest/RestUtils.java index 4d6b438e..4b243c8e 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/rest/RestUtils.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/rest/RestUtils.java @@ -519,13 +519,6 @@ public ResponseObj getTokenResponseObject() { return tokenUtils.getTokenResponseObject(); } - public CommonSchool getCommonSchool(String schoolOfRecord) { - if (StringUtils.isBlank(schoolOfRecord)) { - return null; - } - return restService.get(String.format(constants.getCommonSchoolByMincode(), schoolOfRecord), CommonSchool.class); - } - public List getDistrictBySchoolCategoryCode(String schoolCategoryCode) { try { String url = String.format(constants.getTraxDistrictBySchoolCategory(), schoolCategoryCode); @@ -548,9 +541,9 @@ public List getSchoolBySchoolCategoryCode(String schoolCategoryCode) { } } - public List getSchoolByDistrictCode(String district) { + public List getSchoolByDistrictCode(String district) { try { - String url = String.format(constants.getTraxSchoolByDistrict(), district); + String url = String.format(constants.getSchoolsByDistrictNumber(), district); var response = restService.get(url, List.class); return jsonTransformer.convertValue(response, new TypeReference<>(){}); } catch (Exception e) { @@ -559,8 +552,8 @@ public List getSchoolByDistrictCode(String district) { } } - public TraxSchool getTraxSchool(String mincode) { - return restService.get(String.format(constants.getTraxSchoolByMincode(), mincode), TraxSchool.class, getAccessToken()); + public SchoolClob getSchoolClob(String schoolId) { + return restService.get(String.format(constants.getSchoolClobBySchoolId(), schoolId), SchoolClob.class, getAccessToken()); } public List getDeceasedStudentIDs(List studentIDs) { diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/EducGradBatchGraduationApiConstants.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/EducGradBatchGraduationApiConstants.java index dd44be18..a180c50d 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/EducGradBatchGraduationApiConstants.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/EducGradBatchGraduationApiConstants.java @@ -297,11 +297,8 @@ public class EducGradBatchGraduationApiConstants { @Value("${endpoint.grad-graduation-api.student-certificate-regeneration.url}") private String studentCertificateRegeneration; - @Value("${endpoint.grad-trax-api.commonschool-by-mincode.url}") - private String commonSchoolByMincode; - - @Value("${endpoint.grad-trax-api.school-by-min-code.url}") - private String traxSchoolByMincode; + @Value("${endpoint.grad-trax-api.school-clob-by-school-id.url}") + private String schoolClobBySchoolId; @Value("${endpoint.grad-trax-api.district-by-school-category.url}") private String traxDistrictBySchoolCategory; @@ -310,7 +307,7 @@ public class EducGradBatchGraduationApiConstants { private String traxSchoolBySchoolCategory; @Value("${endpoint.grad-trax-api.school-by-district-code.url}") - private String traxSchoolByDistrict; + private String schoolsByDistrictNumber; @Value("${endpoint.grad-student-api.get-deceased-student-id-list}") private String deceasedStudentIDList; diff --git a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/GradSchoolOfRecordFilter.java b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/GradSchoolOfRecordFilter.java index e97fe4bf..30dfcc67 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/GradSchoolOfRecordFilter.java +++ b/api/src/main/java/ca/bc/gov/educ/api/batchgraduation/util/GradSchoolOfRecordFilter.java @@ -1,6 +1,7 @@ package ca.bc.gov.educ.api.batchgraduation.util; import ca.bc.gov.educ.api.batchgraduation.model.School; +import ca.bc.gov.educ.api.batchgraduation.model.SchoolClob; import ca.bc.gov.educ.api.batchgraduation.model.StudentSearchRequest; import ca.bc.gov.educ.api.batchgraduation.rest.RestUtils; import org.apache.commons.lang3.StringUtils; @@ -44,10 +45,10 @@ public List filterSchoolOfRecords(StudentSearchRequest searchRequest) { } else { for(String district: searchRequest.getDistricts()) { logger.debug("Use district code {} to find list of schools", district); - List schools = restUtils.getSchoolByDistrictCode(district); - for(School school: schools) { - logger.debug("School {} found by district code {}", school.getMincode(), district); - eligibleStudentSchoolDistricts.add(school.getMincode()); + List schools = restUtils.getSchoolByDistrictCode(district); + for(SchoolClob school: schools) { + logger.debug("School {} found by district code {}", school.getMinCode(), district); + eligibleStudentSchoolDistricts.add(school.getMinCode()); } } } diff --git a/api/src/main/resources/application.yaml b/api/src/main/resources/application.yaml index 76f0a924..36cd9091 100644 --- a/api/src/main/resources/application.yaml +++ b/api/src/main/resources/application.yaml @@ -15,7 +15,7 @@ spring: password: ${PASSWORD} driver-class-name: oracle.jdbc.driver.OracleDriver jpa: - show-sql: false + show-sql: ${SHOW_SQL_LOGS} database-platform: org.hibernate.dialect.OracleDialect hibernate: ddl-auto: none @@ -255,10 +255,10 @@ endpoint: grad-trax-api: get-psi-student-list: url: ${GRAD_TRAX_API}api/v1/trax/psi/student?transmissionMode=%s&psiCode=%s&psiYear=%s - school-by-min-code: - url: ${GRAD_TRAX_API}api/v1/trax/school/%s + school-clob-by-school-id: + url: ${GRAD_TRAX_API}api/v2/trax/school-clob/%s school-by-district-code: - url: ${GRAD_TRAX_API}api/v1/trax/school/search?district=%s + url: ${GRAD_TRAX_API}api/v2/trax/schools-by-district/%s district-by-school-category: url: ${GRAD_TRAX_API}api/v1/trax/district/schoolCategories?schoolCategory=%s school-by-school-category: @@ -267,8 +267,6 @@ endpoint: url: ${GRAD_TRAX_API}api/v1/trax/edw/get-schools/snapshot/%s get-edw-snapshot-students-by-min-code: url: ${GRAD_TRAX_API}api/v1/trax/edw/get-students/snapshot/%s/%s - commonschool-by-mincode: - url: ${GRAD_TRAX_API}api/v1/trax/school/common/%s #Splunk LogHelper diff --git a/api/src/test/java/ca/bc/gov/educ/api/batchgraduation/util/RestUtilsTest.java b/api/src/test/java/ca/bc/gov/educ/api/batchgraduation/util/RestUtilsTest.java index 0cacdb1e..7134366b 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/batchgraduation/util/RestUtilsTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/batchgraduation/util/RestUtilsTest.java @@ -1120,12 +1120,12 @@ public void testGetSchoolBySchoolCategoryCode() { @Test public void testGetSchoolByDistrictCode() { - School school = new School(); - school.setMincode("1234567"); + SchoolClob school = new SchoolClob(); + school.setMinCode("1234567"); - when(this.restService.get(String.format(constants.getTraxSchoolByDistrict(), "005"), List.class)).thenReturn(List.of(school)); + when(this.restService.get(String.format(constants.getSchoolsByDistrictNumber(), "005"), List.class)).thenReturn(List.of(school)); - List res = this.restUtils.getSchoolByDistrictCode("005"); + List res = this.restUtils.getSchoolByDistrictCode("005"); assertThat(res).isNotNull(); } diff --git a/api/src/test/resources/application.yaml b/api/src/test/resources/application.yaml index c353d00b..e64d0651 100644 --- a/api/src/test/resources/application.yaml +++ b/api/src/test/resources/application.yaml @@ -220,10 +220,10 @@ endpoint: grad-trax-api: get-psi-student-list: url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/trax/psi/student?transmissionMode=%s&psiCode=%s&psiYear=%s - school-by-min-code: - url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/trax/school/%s + school-clob-by-school-id: + url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v2/trax/school-clob/%s school-by-district-code: - url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/trax/school/search?district=%s + url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v2/trax/schools-by-district/%s district-by-school-category: url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/trax/district/schoolCategories?schoolCategory=%s school-by-school-category: @@ -232,8 +232,6 @@ endpoint: url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/trax/edw/get-schools/snapshot/%s get-edw-snapshot-students-by-min-code: url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/trax/edw/get-students/snapshot/%s/%s - commonschool-by-mincode: - url: https://educ-grad-trax-api-77c02f-dev.apps.silver.devops.gov.bc.ca/api/v1/trax/school/common/%s #Splunk LogHelper splunk: