Skip to content

Commit

Permalink
Grad release 1.11.0
Browse files Browse the repository at this point in the history
Grad release 1.11.0
  • Loading branch information
kamal-mohammed authored Dec 7, 2023
2 parents b377a44 + e93da0f commit 4e301f6
Show file tree
Hide file tree
Showing 35 changed files with 407 additions and 144 deletions.
6 changes: 5 additions & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>ca.bc.gov.educ</groupId>
<artifactId>educ-grad-data-conversion-api</artifactId>
<version>1.8.48</version>
<version>1.8.50</version>
<name>educ-grad-data-conversion-api</name>
<description>Ministry of Education GRAD DATA CONVERSION API</description>

Expand Down Expand Up @@ -66,6 +66,10 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void handleEvent(@NonNull final Event event) {
break;
}
} catch (final Exception exception) {
log.error("Exception while processing event :: {}", event, exception);
log.error("Exception while processing event :: {} - {}", event, exception.getMessage());
}
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package ca.bc.gov.educ.api.dataconversion.constant;

public enum FieldName {
SCHOOL_OF_RECORD,
GRAD_PROGRAM,
ADULT_START_DATE,
SLP_DATE,
STUDENT_GRADE,
CITIZENSHIP,
STUDENT_STATUS,

RECALC_GRAD_ALG,
RECALC_TVR

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package ca.bc.gov.educ.api.dataconversion.constant;

public enum FieldType {
STRING,
DATE
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package ca.bc.gov.educ.api.dataconversion.exception;

import lombok.Data;

@Data
public class ServiceException extends RuntimeException {

private int statusCode;

public ServiceException() {
super();
}

public ServiceException(String message) {
super(message);
}

public ServiceException(String message, Throwable cause) {
super(message, cause);
}

public ServiceException(Throwable cause) {
super(cause);
}

protected ServiceException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}

public ServiceException(String message, int value) {
super(message);
this.statusCode = value;
}

public ServiceException(String s, int value, Exception e) {
super(s, e);
this.statusCode = value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package ca.bc.gov.educ.api.dataconversion.model;

import ca.bc.gov.educ.api.dataconversion.constant.FieldName;
import ca.bc.gov.educ.api.dataconversion.constant.FieldType;
import lombok.Builder;
import lombok.Data;

import java.util.Objects;

@Builder
@Data
public class OngoingUpdateFieldDTO {
private FieldType type;
private FieldName name;
private Object value;

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
OngoingUpdateFieldDTO that = (OngoingUpdateFieldDTO) o;
return getName() == that.getName();
}

@Override
public int hashCode() {
return Objects.hash(getName());
}

@Override
public String toString() {
return "OngoingUpdateField{" +
"type=" + type +
", name=" + name +
", value=" + value +
'}';
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package ca.bc.gov.educ.api.dataconversion.model;

import ca.bc.gov.educ.api.dataconversion.constant.EventType;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@NoArgsConstructor
@Data
public class OngoingUpdateRequestDTO {
private String studentID;
private String pen;
private EventType eventType;
private List<OngoingUpdateFieldDTO> updateFields = new ArrayList<>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class CourseProcess {
private static final String QFRAL_STR = "QFRAL";
private static final String ZFRAL_STR = "ZFRAL";
private static final String IBFAS_STR = "IBFAS";
private static final String QFRAP_STR = "QFRAP";

private static final String ERR_MSG_FORMAT = "For {} : {}";

Expand Down Expand Up @@ -567,8 +568,8 @@ public void createCourseRequirements(ConversionCourseSummaryDTO summary) {
createCourseRequirement(populate(QFRAL_STR, "12", "915"), summary);

// QFRAP 12
createCourseRequirement(populate("QFRAP", "12", "910"), summary);
createCourseRequirement(populate("QFRAP", "12", "915"), summary);
createCourseRequirement(populate(QFRAP_STR, "12", "910"), summary);
createCourseRequirement(populate(QFRAP_STR, "12", "915"), summary);

// ZFRAL 12
createCourseRequirement(populate(ZFRAL_STR, "12", "819"), summary);
Expand Down Expand Up @@ -1135,6 +1136,22 @@ public void createCourseRequirements(ConversionCourseSummaryDTO summary) {
createCourseRequirement(populate("DAKE", "11", "119"), summary);
createCourseRequirement(populate("DAKE", "12", "119"), summary);
createCourseRequirement(populate("IDAKE", "11", "119"), summary);

// GRAD2-2402: Rule 200
createCourseRequirement(populate(QFRAP_STR, "12", "200"), summary);
createCourseRequirement(populate("FCTF", "12", "200"), summary);
createCourseRequirement(populate(FRALP_STR, "12", "200"), summary);
// GRAD2-2402: Rule 201
createCourseRequirement(populate("ELNMF", "11", "201"), summary);
createCourseRequirement(populate("ELSLF", "11", "201"), summary);
createCourseRequirement(populate("EFLSF", "11", "201"), summary);
createCourseRequirement(populate(FRALP_STR, "11", "201"), summary);
// GRAD2-2402: Rule 202
createCourseRequirement(populate(QFRAP_STR, "10", "202"), summary);
createCourseRequirement(populate("LANMF", "10", "202"), summary);
createCourseRequirement(populate("LAEOF", "10", "202"), summary);
createCourseRequirement(populate("LACWF", "10", "202"), summary);
createCourseRequirement(populate(FRALP_STR, "10", "202"), summary);
}

private CourseRequirement populate(String courseCode, String courseLevel, String courseRequirementCode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import ca.bc.gov.educ.api.dataconversion.model.tsw.report.*;
import ca.bc.gov.educ.api.dataconversion.util.EducGradDataConversionApiConstants;
import ca.bc.gov.educ.api.dataconversion.util.EducGradDataConversionApiUtils;
import ca.bc.gov.educ.api.dataconversion.util.Generated;
import ca.bc.gov.educ.api.dataconversion.util.RestUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.binary.Base64;
Expand Down Expand Up @@ -230,7 +231,7 @@ private void sortOnCourseCode(List<StudentCourse> cList) {
}

private String getCredits(String program, String courseCode, Integer totalCredits, boolean isRestricted) {
if (((program.contains("2004") || program.contains("2018")) && (courseCode.startsWith("X") || courseCode.startsWith("CP"))) || isRestricted) {
if (((program.contains("2004") || program.contains("2018") || program.contains("2023")) && (courseCode.startsWith("X") || courseCode.startsWith("CP"))) || isRestricted) {
return String.format("(%s)", totalCredits);
}
return String.valueOf(totalCredits);
Expand Down Expand Up @@ -309,6 +310,7 @@ private ca.bc.gov.educ.api.dataconversion.model.tsw.report.GraduationData getGra
return data;
}

@Generated
private void setGraduationDataSpecialPrograms(ca.bc.gov.educ.api.dataconversion.model.tsw.report.GraduationData data, List<StudentCareerProgram> studentCareerPrograms) {
if (studentCareerPrograms != null) {
for (StudentCareerProgram cp : studentCareerPrograms) {
Expand Down Expand Up @@ -373,17 +375,19 @@ private ca.bc.gov.educ.api.dataconversion.model.tsw.report.School getSchoolData(
public void saveStudentTranscriptReportJasper(ReportData sample, Date distributionDate, String accessToken, UUID studentID, boolean isGraduated, boolean reload) {

String encodedPdfReportTranscript = generateStudentTranscriptReportJasper(sample, accessToken);
GradStudentTranscripts requestObj = new GradStudentTranscripts();
requestObj.setTranscript(encodedPdfReportTranscript);
requestObj.setStudentID(studentID);
requestObj.setTranscriptTypeCode(sample.getTranscript().getTranscriptTypeCode().getCode());
requestObj.setDocumentStatusCode("IP");
requestObj.setDistributionDate(distributionDate);
requestObj.setOverwrite(reload);
if (isGraduated)
requestObj.setDocumentStatusCode(DOCUMENT_STATUS_COMPLETED);

this.restUtils.saveGradStudentTranscript(requestObj, isGraduated, accessToken);
if(encodedPdfReportTranscript != null) {
GradStudentTranscripts requestObj = new GradStudentTranscripts();
requestObj.setTranscript(encodedPdfReportTranscript);
requestObj.setStudentID(studentID);
requestObj.setTranscriptTypeCode(sample.getTranscript().getTranscriptTypeCode().getCode());
requestObj.setDocumentStatusCode("IP");
requestObj.setDistributionDate(distributionDate);
requestObj.setOverwrite(reload);
if (isGraduated)
requestObj.setDocumentStatusCode(DOCUMENT_STATUS_COMPLETED);

this.restUtils.saveGradStudentTranscript(requestObj, isGraduated, accessToken);
}
}

private String generateStudentTranscriptReportJasper(ReportData sample,String accessToken) {
Expand All @@ -394,8 +398,11 @@ private String generateStudentTranscriptReportJasper(ReportData sample,String ac
reportParams.setOptions(options);
reportParams.setData(sample);
byte[] bytesSAR = this.restUtils.getTranscriptReport(reportParams, accessToken);
byte[] encoded = org.apache.commons.codec.binary.Base64.encodeBase64(bytesSAR);
return new String(encoded, StandardCharsets.US_ASCII);
if(bytesSAR != null && bytesSAR.length > 0) {
byte[] encoded = org.apache.commons.codec.binary.Base64.encodeBase64(bytesSAR);
return new String(encoded, StandardCharsets.US_ASCII);
}
return null;
}

public List<ProgramCertificateTranscript> getCertificateList(GraduationData graduationDataStatus, String schoolCategoryCode, String accessToken) {
Expand Down Expand Up @@ -431,6 +438,7 @@ public ReportData prepareCertificateData(GraduationData graduationDataStatus, Pr
return data;
}

@Generated
public void saveStudentCertificateReportJasper(GraduationData graduationDataStatus, ConvGradStudent convStudent,
String accessToken, ProgramCertificateTranscript certType, boolean reload) {
ReportData certData = prepareCertificateData(graduationDataStatus, certType, convStudent, accessToken);
Expand Down Expand Up @@ -471,6 +479,7 @@ private Certificate getCertificateData(GradAlgorithmGraduationStudentRecord grad
return cert;
}

@Generated
private String generateStudentCertificateReportJasper(ReportData sample,
String accessToken) {
ReportOptions options = new ReportOptions();
Expand Down
Loading

0 comments on commit 4e301f6

Please sign in to comment.