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-2951: task is complete. #537

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
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
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
Expand Up @@ -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;
Expand All @@ -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;
}
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 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
+ "]";
}

}

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 schoolId) {
return restService.get(String.format(constants.getSchoolClobBySchoolId(), schoolId), 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;
@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;
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
10 changes: 4 additions & 6 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 @@ -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:
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
8 changes: 3 additions & 5 deletions api/src/test/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
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
Loading