Skip to content

Commit

Permalink
GRAD2-2951: task is complete.
Browse files Browse the repository at this point in the history
GRAD2-2951: task is complete.
  • Loading branch information
infstar committed Nov 6, 2024
1 parent 7afe960 commit 05216f5
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 147 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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 schoolCategoryCodeInstitute;

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 + ", schoolCategoryCodeInstitute=" + schoolCategoryCodeInstitute
+ ", schoolName=" + schoolName + ", districtName=" + districtName + ", transcriptEligibility=" + transcriptEligibility + ", certificateEligibility=" + certificateEligibility
+ ", address1=" + address1 + ", address2=" + address2 + ", city=" + city + ", provCode=" + provCode + ", countryCode=" + countryCode + ", postal=" + postal + ", openFlag=" + openFlag
+ "]";
}

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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<District> getDistrictBySchoolCategoryCode(String schoolCategoryCode) {
try {
String url = String.format(constants.getTraxDistrictBySchoolCategory(), schoolCategoryCode);
Expand All @@ -548,9 +541,9 @@ public List<School> getSchoolBySchoolCategoryCode(String schoolCategoryCode) {
}
}

public List<School> getSchoolByDistrictCode(String district) {
public List<SchoolClob> 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) {
Expand All @@ -559,8 +552,8 @@ public List<School> getSchoolByDistrictCode(String district) {
}
}

public TraxSchool getTraxSchool(String mincode) {
return restService.get(String.format(constants.getTraxSchoolByMincode(), mincode), TraxSchool.class, getAccessToken());
public SchoolClob getSchoolClob(String minCode) {
return restService.get(String.format(constants.getSchoolByMincode(), minCode), SchoolClob.class, getAccessToken());
}

public List<UUID> getDeceasedStudentIDs(List<UUID> studentIDs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
private String schoolByMincode;

@Value("${endpoint.grad-trax-api.district-by-school-category.url}")
private String traxDistrictBySchoolCategory;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -44,10 +45,10 @@ public List<String> filterSchoolOfRecords(StudentSearchRequest searchRequest) {
} else {
for(String district: searchRequest.getDistricts()) {
logger.debug("Use district code {} to find list of schools", district);
List<School> schools = restUtils.getSchoolByDistrictCode(district);
for(School school: schools) {
logger.debug("School {} found by district code {}", school.getMincode(), district);
eligibleStudentSchoolDistricts.add(school.getMincode());
List<SchoolClob> schools = restUtils.getSchoolByDistrictCode(district);
for(SchoolClob school: schools) {
logger.debug("School {} found by district code {}", school.getMinCode(), district);
eligibleStudentSchoolDistricts.add(school.getMinCode());
}
}
}
Expand Down
8 changes: 3 additions & 5 deletions api/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -256,9 +256,9 @@ endpoint:
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
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:
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<School> res = this.restUtils.getSchoolByDistrictCode("005");
List<SchoolClob> res = this.restUtils.getSchoolByDistrictCode("005");
assertThat(res).isNotNull();
}

Expand Down
6 changes: 2 additions & 4 deletions api/src/test/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ endpoint:
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
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:
Expand All @@ -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:
Expand Down

0 comments on commit 05216f5

Please sign in to comment.