diff --git a/api/pom.xml b/api/pom.xml
index 367b4a5b..676ea159 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -7,7 +7,7 @@
ca.bc.gov.educ
educ-grad-report-api
educ-grad-report-api
- 1.8.54
+ 1.8.55
Ministry of Education and Child Care REPORT API
diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/api/controller/BaseController.java b/api/src/main/java/ca/bc/gov/educ/grad/report/api/controller/BaseController.java
index 89f2534c..ef5ad087 100644
--- a/api/src/main/java/ca/bc/gov/educ/grad/report/api/controller/BaseController.java
+++ b/api/src/main/java/ca/bc/gov/educ/grad/report/api/controller/BaseController.java
@@ -4,7 +4,9 @@
import ca.bc.gov.educ.grad.report.api.service.utils.JsonTransformer;
import ca.bc.gov.educ.grad.report.api.util.JwtTokenUtil;
import ca.bc.gov.educ.grad.report.dao.ReportRequestDataThreadLocal;
+import ca.bc.gov.educ.grad.report.exception.InvalidParameterException;
import ca.bc.gov.educ.grad.report.utils.EducGradReportApiConstants;
+import ca.bc.gov.educ.grad.report.utils.GradValidation;
import jakarta.servlet.http.HttpServletRequest;
import lombok.SneakyThrows;
import org.apache.commons.lang3.StringUtils;
@@ -23,11 +25,16 @@
import java.net.InetAddress;
import java.net.UnknownHostException;
+import static ca.bc.gov.educ.grad.report.utils.EducGradReportApiConstants.NO_ELIGIBLE_COURSES_TRANSCRIPT_REPORT_IS_NOT_CREATED;
+
public abstract class BaseController {
private static final String CLASS_NAME = BaseController.class.getName();
private static Logger log = LoggerFactory.getLogger(CLASS_NAME);
+ @Autowired
+ GradValidation validation;
+
@Value("${endpoint.educ-grad-report-api.get-signature-by-code.url}")
String signatureImageUrlProperty;
@@ -40,7 +47,7 @@ protected void logRequest(Object request) {
((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes())
.getRequest();
- StringBuffer requestURL = httpServletRequest.getRequestURL();
+ StringBuilder requestURL = new StringBuilder(httpServletRequest.getRequestURL().toString());
if (httpServletRequest.getQueryString() != null) {
requestURL.append("?").append(httpServletRequest.getQueryString());
}
@@ -75,36 +82,48 @@ protected void logRequest(Object request) {
String method = httpServletRequest.getMethod();
String accessTokenParam = "?access_token=" + accessToken;
signatureImageUrl = protocol + serverName + ":" + port + path + accessTokenParam;
- log.debug(username + ": " + method + "->" + signatureImageUrl);
+ log.debug("{}: {}->{}", username, method, signatureImageUrl);
} else {
String accessTokenParam = "?access_token=" + accessToken;
signatureImageUrl = signatureImageUrlProperty + "/#signatureCode#" + accessTokenParam;
log.debug(signatureImageUrl);
}
if (StringUtils.trimToNull(signatureImageUrl) == null) {
- throw new RuntimeException("signatureImageUrl is undefined");
+ throw new InvalidParameterException("signatureImageUrl is undefined");
}
ReportRequestDataThreadLocal.setSignatureImageUrl(signatureImageUrl);
}
protected ResponseEntity getInternalServerErrorResponse(Throwable t) {
- ResponseEntity result = null;
+
+ if(validation.containsError(NO_ELIGIBLE_COURSES_TRANSCRIPT_REPORT_IS_NOT_CREATED)) {
+ return ResponseEntity.status(HttpStatus.NO_CONTENT).build();
+ }
+
+ HttpStatus httpStatus = HttpStatus.INTERNAL_SERVER_ERROR;
+
+ StringBuilder sb = new StringBuilder();
+ if(validation.hasErrors()) {
+ for(String error: validation.getErrors()) {
+ sb.append(error).append('\n');
+ }
+ httpStatus = HttpStatus.BAD_REQUEST;
+ }
Throwable tmp = t;
- String message = null;
+ String message = sb.toString();
if (tmp.getCause() != null) {
tmp = tmp.getCause();
- message = tmp.getMessage();
- } else {
+ }
+ if(StringUtils.isBlank(message)) {
message = tmp.getMessage();
}
- if(message == null) {
+ if(StringUtils.isBlank(message)) {
message = tmp.getClass().getName();
}
- result = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(message.getBytes());
- return result;
+ return ResponseEntity.status(httpStatus).body(message.getBytes());
}
protected ResponseEntity handleBinaryResponse(byte[] resultBinary, String reportFile) {
@@ -114,16 +133,27 @@ protected ResponseEntity handleBinaryResponse(byte[] resultBinary, Strin
protected ResponseEntity handleBinaryResponse(byte[] resultBinary, String reportFile, MediaType contentType) {
ResponseEntity response = null;
- if(resultBinary.length > 0) {
- HttpHeaders headers = new HttpHeaders();
- headers.add("Content-Disposition", "inline; filename=" + reportFile);
- response = ResponseEntity
- .ok()
- .headers(headers)
- .contentType(contentType)
- .body(resultBinary);
+ if(validation.containsError(NO_ELIGIBLE_COURSES_TRANSCRIPT_REPORT_IS_NOT_CREATED)) {
+ return ResponseEntity.status(HttpStatus.NO_CONTENT).build();
+ }
+ StringBuilder sb = new StringBuilder();
+ if(validation.hasErrors()) {
+ for(String error: validation.getErrors()) {
+ sb.append(error).append('\n');
+ }
+ response = ResponseEntity.status(HttpStatus.BAD_REQUEST).body(sb.toString().getBytes());
} else {
- response = ResponseEntity.status(HttpStatus.NO_CONTENT).build();
+ if (resultBinary.length > 0) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Disposition", "inline; filename=" + reportFile);
+ response = ResponseEntity
+ .ok()
+ .headers(headers)
+ .contentType(contentType)
+ .body(resultBinary);
+ } else {
+ response = ResponseEntity.status(HttpStatus.NO_CONTENT).build();
+ }
}
return response;
}
diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/api/service/GradReportService.java b/api/src/main/java/ca/bc/gov/educ/grad/report/api/service/GradReportService.java
index 41a550fa..c08162e2 100644
--- a/api/src/main/java/ca/bc/gov/educ/grad/report/api/service/GradReportService.java
+++ b/api/src/main/java/ca/bc/gov/educ/grad/report/api/service/GradReportService.java
@@ -9,7 +9,7 @@
import ca.bc.gov.educ.grad.report.dto.reports.bundle.decorator.SchoolReportOrderTypeImpl;
import ca.bc.gov.educ.grad.report.dto.reports.bundle.service.BCMPBundleService;
import ca.bc.gov.educ.grad.report.dto.reports.bundle.service.DocumentBundle;
-import ca.bc.gov.educ.grad.report.exception.ServiceException;
+import ca.bc.gov.educ.grad.report.exception.ReportApiServiceException;
import ca.bc.gov.educ.grad.report.model.achievement.StudentAchievementReport;
import ca.bc.gov.educ.grad.report.model.achievement.StudentAchievementService;
import ca.bc.gov.educ.grad.report.model.common.BusinessReport;
@@ -108,7 +108,7 @@ public byte[] getPackingSlipReport(ReportRequest reportRequest) {
ReportDocument report = getPackingSlipReportDocument(reportRequest);
response = report.asBytes();
} catch (Exception e) {
- throw new ServiceException(String.format(EXCEPTION_MSG, methodName), e);
+ throw new ReportApiServiceException(String.format(EXCEPTION_MSG, methodName), e);
}
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
return response;
@@ -145,7 +145,7 @@ public byte[] getStudentAchievementReport(ReportRequest reportRequest) {
StudentAchievementReport report = getStudentAchievementReportDocument(reportRequest);
response = report.getReportData();
} catch (Exception e) {
- throw new ServiceException(String.format(EXCEPTION_MSG, methodName), e);
+ throw new ReportApiServiceException(String.format(EXCEPTION_MSG, methodName), e);
}
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
return response;
@@ -172,7 +172,7 @@ public byte[] getStudentTranscriptReport(ReportRequest reportRequest) {
StudentTranscriptReport report = getStudentTranscriptReportDocument(reportRequest);
response = report.getReportData();
} catch (Exception e) {
- throw new ServiceException(String.format(EXCEPTION_MSG, methodName), e);
+ throw new ReportApiServiceException(String.format(EXCEPTION_MSG, methodName), e);
}
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
return response;
@@ -199,7 +199,7 @@ public byte[] getStudentXmlTranscriptReport(XmlReportRequest reportRequest) {
StudentTranscriptReport transcriptReport = getStudentXmlTranscriptReportDocument(reportRequest);
response = transcriptReport.asBytes();
} catch (Exception e) {
- throw new ServiceException(String.format(EXCEPTION_MSG, methodName), e);
+ throw new ReportApiServiceException(String.format(EXCEPTION_MSG, methodName), e);
}
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
return response;
@@ -224,7 +224,7 @@ public byte[] getStudentCertificateReport(ReportRequest reportRequest) {
DocumentBundle documentBundle = getStudentCertificateReportDocument(reportRequest);
response = documentBundle.asBytes();
} catch (Exception e) {
- throw new ServiceException(String.format(EXCEPTION_MSG, methodName), e);
+ throw new ReportApiServiceException(String.format(EXCEPTION_MSG, methodName), e);
}
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
return response;
@@ -258,7 +258,7 @@ public byte[] getSchoolDistributionReport(ReportRequest reportRequest) {
SchoolDistributionReport schoolDistributionReport = getSchoolDistributionReportDocument(reportRequest);
response = schoolDistributionReport.asBytes();
} catch (Exception e) {
- throw new ServiceException(String.format(EXCEPTION_MSG, methodName), e);
+ throw new ReportApiServiceException(String.format(EXCEPTION_MSG, methodName), e);
}
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
return response;
@@ -274,7 +274,7 @@ public byte[] getSchoolDistributionReportYearEnd(ReportRequest reportRequest) {
DocumentBundle schoolDistributionYearEndReport = getSchoolDistributionYearEndReportDocument(reportRequest);
response = schoolDistributionYearEndReport.asBytes();
} catch (Exception e) {
- throw new ServiceException(String.format(EXCEPTION_MSG, methodName), e);
+ throw new ReportApiServiceException(String.format(EXCEPTION_MSG, methodName), e);
}
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
return response;
@@ -290,7 +290,7 @@ public byte[] getDistrictDistributionReportYearEnd(ReportRequest reportRequest)
SchoolDistributionReport districtDistributionYearEndReport = getDistrictDistributionCredentialsReportDocument(reportRequest);
response = districtDistributionYearEndReport.asBytes();
} catch (Exception e) {
- throw new ServiceException(String.format(EXCEPTION_MSG, methodName), e);
+ throw new ReportApiServiceException(String.format(EXCEPTION_MSG, methodName), e);
}
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
return response;
@@ -306,7 +306,7 @@ public byte[] getDistrictDistributionReportYearEndNonGrad(ReportRequest reportRe
SchoolDistributionReport districtDistributionYearEndReport = getDistrictDistributionNonGradCredentialsReportDocument(reportRequest);
response = districtDistributionYearEndReport.asBytes();
} catch (Exception e) {
- throw new ServiceException(String.format(EXCEPTION_MSG, methodName), e);
+ throw new ReportApiServiceException(String.format(EXCEPTION_MSG, methodName), e);
}
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
return response;
@@ -322,7 +322,7 @@ public byte[] getSchoolLabelReport(ReportRequest reportRequest) {
SchoolLabelReport schoolLabelReport = getSchoolLabelReportDocument(reportRequest);
response = schoolLabelReport.asBytes();
} catch (Exception e) {
- throw new ServiceException(String.format(EXCEPTION_MSG, methodName), e);
+ throw new ReportApiServiceException(String.format(EXCEPTION_MSG, methodName), e);
}
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
return response;
@@ -338,7 +338,7 @@ public byte[] getSchoolGraduationReport(ReportRequest reportRequest) {
SchoolGraduationReport schoolGraduationReport = getSchoolGraduationReportDocument(reportRequest);
response = schoolGraduationReport.asBytes();
} catch (Exception e) {
- throw new ServiceException(String.format(EXCEPTION_MSG, methodName), e);
+ throw new ReportApiServiceException(String.format(EXCEPTION_MSG, methodName), e);
}
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
return response;
@@ -354,7 +354,7 @@ public byte[] getSchoolNonGraduationReport(ReportRequest reportRequest) {
SchoolNonGraduationReport schoolNonGraduationReport = getSchoolNonGraduationReportDocument(reportRequest);
response = schoolNonGraduationReport.asBytes();
} catch (Exception e) {
- throw new ServiceException(String.format(EXCEPTION_MSG, methodName), e);
+ throw new ReportApiServiceException(String.format(EXCEPTION_MSG, methodName), e);
}
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
return response;
@@ -370,7 +370,7 @@ public byte[] getStudentNonGradProjectedReport(ReportRequest reportRequest) {
StudentNonGradProjectedReport studentNonGradProjectedReport = getStudentNonGradProjectedReportDocument(reportRequest);
response = studentNonGradProjectedReport.asBytes();
} catch (Exception e) {
- throw new ServiceException(String.format(EXCEPTION_MSG, methodName), e);
+ throw new ReportApiServiceException(String.format(EXCEPTION_MSG, methodName), e);
}
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
return response;
@@ -386,7 +386,7 @@ public byte[] getStudentNonGradReport(ReportRequest reportRequest) {
StudentNonGradReport studentNonGradReport = getStudentNonGradReportDocument(reportRequest);
response = studentNonGradReport.asBytes();
} catch (Exception e) {
- throw new ServiceException(String.format(EXCEPTION_MSG, methodName), e);
+ throw new ReportApiServiceException(String.format(EXCEPTION_MSG, methodName), e);
}
log.debug(DEBUG_LOG_PATTERN, methodName, CLASS_NAME);
return response;
diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/api/service/utils/BaseTransformer.java b/api/src/main/java/ca/bc/gov/educ/grad/report/api/service/utils/BaseTransformer.java
index 98847742..4266b9a4 100644
--- a/api/src/main/java/ca/bc/gov/educ/grad/report/api/service/utils/BaseTransformer.java
+++ b/api/src/main/java/ca/bc/gov/educ/grad/report/api/service/utils/BaseTransformer.java
@@ -1,6 +1,6 @@
package ca.bc.gov.educ.grad.report.api.service.utils;
-import ca.bc.gov.educ.grad.report.exception.ServiceException;
+import ca.bc.gov.educ.grad.report.exception.ReportApiServiceException;
import com.fasterxml.jackson.databind.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -46,7 +46,7 @@ public Object unmarshallWithWrapper(String input, Class> clazz) {
}
public String marshallWithWrapper(Object input) {
- ObjectWriter prettyPrinter = objectMapper.writer();//.writerWithDefaultPrettyPrinter();
+ ObjectWriter prettyPrinter = objectMapper.writer();
String result = null;
try {
result = prettyPrinter
@@ -91,7 +91,7 @@ public String marshall(Object input) {
try {
result = objectMapper.writeValueAsString(input);
} catch (IOException e) {
- throw new ServiceException(e.getMessage());
+ throw new ReportApiServiceException(e.getMessage(), e);
}
return result;
@@ -110,12 +110,4 @@ public String marshallPrettyPrinter(Object input) {
return result;
}
- @Override
- public abstract String getAccept();
-
- @Override
- public abstract String getFormat();
-
- @Override
- public abstract String getContentType();
}
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 a2a9bc9c..e9426587 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
@@ -27,6 +27,7 @@
import ca.bc.gov.educ.grad.report.model.transcript.TranscriptCourse;
import ca.bc.gov.educ.grad.report.model.transcript.TranscriptTypeCode;
import ca.bc.gov.educ.grad.report.service.impl.BaseServiceImpl;
+import ca.bc.gov.educ.grad.report.utils.GradValidation;
import ca.bc.gov.educ.grad.report.utils.TotalCounts;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.RandomStringUtils;
@@ -38,16 +39,20 @@
import org.springframework.data.util.Pair;
import org.springframework.stereotype.Component;
-import java.io.Serializable;
import java.time.ZoneId;
import java.util.*;
import java.util.stream.Collectors;
+import static ca.bc.gov.educ.grad.report.utils.EducGradReportApiConstants.NO_ELIGIBLE_COURSES_TRANSCRIPT_REPORT_IS_NOT_CREATED;
+
@Component
-public class GradDataConvertionBean extends BaseServiceImpl implements Serializable {
+public class GradDataConvertionBean extends BaseServiceImpl {
private static final String CLASS_NAME = GradDataConvertionBean.class.getName();
- private static final Logger log = LoggerFactory.getLogger(CLASS_NAME);
+ private static final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
+ @Autowired
+ GradValidation validation;
@Autowired
TranscriptTypeCodeRepository transcriptTypeCodeRepository;
@@ -196,7 +201,7 @@ public School getSchool(ReportData reportData) {
}
public List getTranscriptCourses(ReportData reportData) {
- Student student = getStudent(reportData);
+ final Student student = getStudent(reportData);
List result = new ArrayList<>();
if (reportData.getTranscript() != null && reportData.getTranscript().getResults() != null) {
for (ca.bc.gov.educ.grad.report.api.client.TranscriptResult r : reportData.getTranscript().getResults()) {
@@ -224,6 +229,12 @@ public List getTranscriptCourses(ReportData reportData) {
result.add(course);
}
}
+ final String pen = student.getPen().getValue();
+ if(StringUtils.isNotBlank(pen) && result.isEmpty()) {
+ String message = NO_ELIGIBLE_COURSES_TRANSCRIPT_REPORT_IS_NOT_CREATED;
+ logger.warn(message);
+ validation.addErrorAndStop(message);
+ }
return result;
}
@@ -439,7 +450,7 @@ public Pair, TotalCounts> getStudents(ReportData reportData) {
List students = school.getStudents();
for (ca.bc.gov.educ.grad.report.api.client.Student st : students) {
if(st.getPen() == null || StringUtils.isBlank(st.getPen().getPen())) {
- log.warn("Skip Student {} without Pen #", st.getPen().getEntityID());
+ logger.warn("Skip Student {} without Pen #", st.getPen().getEntityID());
continue;
}
StudentImpl student = new StudentImpl();
@@ -449,7 +460,7 @@ public Pair, TotalCounts> getStudents(ReportData reportData) {
student.setPen(pen);
if(result.add(student)) {
- log.debug("Student {} added into unique collection for report", student);
+ logger.debug("Student {} added into unique collection for report", student);
} else {
continue;
}
@@ -491,7 +502,7 @@ public Pair, TotalCounts> getStudents(ReportData reportData) {
List studentCertificateTypeCodes = new ArrayList<>();
if(st.getGraduationStatus() != null && StringUtils.isNotBlank(st.getGraduationStatus().getCertificates())) {
String studentCertificateTypeCodesString = st.getGraduationStatus().getCertificates();
- log.debug("Process student {} certificate credentials {}", student.getPen(), studentCertificateTypeCodesString);
+ logger.debug("Process student {} certificate credentials {}", student.getPen(), studentCertificateTypeCodesString);
studentCertificateTypeCodes = Arrays.asList(StringUtils.split(studentCertificateTypeCodesString, ","));
}
diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/dto/reports/bundle/decorator/AchievementReportDecorator.java b/api/src/main/java/ca/bc/gov/educ/grad/report/dto/reports/bundle/decorator/AchievementReportDecorator.java
index 495c3d8e..41ef96a1 100644
--- a/api/src/main/java/ca/bc/gov/educ/grad/report/dto/reports/bundle/decorator/AchievementReportDecorator.java
+++ b/api/src/main/java/ca/bc/gov/educ/grad/report/dto/reports/bundle/decorator/AchievementReportDecorator.java
@@ -70,6 +70,6 @@ public String getFilenamePrefix() {
@Override
protected int getRotateDegree() {
- return 90;
+ return 0;
}
}
diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/dto/reports/bundle/decorator/CertificateReportDecorator.java b/api/src/main/java/ca/bc/gov/educ/grad/report/dto/reports/bundle/decorator/CertificateReportDecorator.java
index e8d2ec77..a7f79945 100644
--- a/api/src/main/java/ca/bc/gov/educ/grad/report/dto/reports/bundle/decorator/CertificateReportDecorator.java
+++ b/api/src/main/java/ca/bc/gov/educ/grad/report/dto/reports/bundle/decorator/CertificateReportDecorator.java
@@ -82,6 +82,6 @@ public String getFilenamePrefix() {
@Override
protected int getRotateDegree() {
- return 90;
+ return 0;
}
}
diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/dto/reports/bundle/decorator/TranscriptReportDecorator.java b/api/src/main/java/ca/bc/gov/educ/grad/report/dto/reports/bundle/decorator/TranscriptReportDecorator.java
index ba96439f..34872cb7 100644
--- a/api/src/main/java/ca/bc/gov/educ/grad/report/dto/reports/bundle/decorator/TranscriptReportDecorator.java
+++ b/api/src/main/java/ca/bc/gov/educ/grad/report/dto/reports/bundle/decorator/TranscriptReportDecorator.java
@@ -81,7 +81,7 @@ public String getFilenamePrefix() {
@Override
protected int getRotateDegree() {
- return 90;
+ return 0;
}
diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/dto/reports/data/impl/PostalAddress.java b/api/src/main/java/ca/bc/gov/educ/grad/report/dto/reports/data/impl/PostalAddress.java
index 2b3be0d4..7ab00e0e 100644
--- a/api/src/main/java/ca/bc/gov/educ/grad/report/dto/reports/data/impl/PostalAddress.java
+++ b/api/src/main/java/ca/bc/gov/educ/grad/report/dto/reports/data/impl/PostalAddress.java
@@ -21,6 +21,7 @@
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlTransient;
+import org.apache.commons.lang3.StringUtils;
import java.util.Locale;
@@ -134,7 +135,7 @@ public String getRegion() {
* @return A non-null, trimmed, possibly empty string instance.
*/
public String getCountryCode() {
- return trimSafe(this.countryCode);
+ return trimSafe("CN".equalsIgnoreCase(this.countryCode) ? "CA" : this.countryCode);
}
/**
@@ -145,9 +146,7 @@ public String getCountryCode() {
*/
public String getPostalCode() {
final String code = nullSafe(this.postalCode);
- final String result = code.replaceAll("\\s", "");
-
- return result;
+ return code.replaceAll("\\s", "");
}
/**
@@ -292,7 +291,7 @@ public String getFormatted() {
final String countryName = getCountryName();
// Suppress the country name if it is Canada.
- if (!"CANADA".equalsIgnoreCase(countryName)) {
+ if (!StringUtils.equalsAnyIgnoreCase(countryName, "CANADA", "WORLD")) {
formatted.append(newLine(left(countryName, LINE_LENGTH)));
}
diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/exception/GradBusinessRuleException.java b/api/src/main/java/ca/bc/gov/educ/grad/report/exception/GradBusinessRuleException.java
index 3c69e024..89aa6ca1 100644
--- a/api/src/main/java/ca/bc/gov/educ/grad/report/exception/GradBusinessRuleException.java
+++ b/api/src/main/java/ca/bc/gov/educ/grad/report/exception/GradBusinessRuleException.java
@@ -1,6 +1,6 @@
package ca.bc.gov.educ.grad.report.exception;
-public class GradBusinessRuleException extends RuntimeException{
+public class GradBusinessRuleException extends RuntimeException {
/**
*
diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/exception/ReportApiServiceException.java b/api/src/main/java/ca/bc/gov/educ/grad/report/exception/ReportApiServiceException.java
new file mode 100644
index 00000000..74c12c34
--- /dev/null
+++ b/api/src/main/java/ca/bc/gov/educ/grad/report/exception/ReportApiServiceException.java
@@ -0,0 +1,9 @@
+package ca.bc.gov.educ.grad.report.exception;
+
+public class ReportApiServiceException extends RuntimeException {
+ private static final long serialVersionUID = -6418563091242776474L;
+
+ public ReportApiServiceException(String msg, Throwable t) {
+ super(msg, t);
+ }
+}
diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/exception/ServiceException.java b/api/src/main/java/ca/bc/gov/educ/grad/report/exception/ServiceException.java
deleted file mode 100644
index c2da5256..00000000
--- a/api/src/main/java/ca/bc/gov/educ/grad/report/exception/ServiceException.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package ca.bc.gov.educ.grad.report.exception;
-
-public class ServiceException extends RuntimeException {
- private static final long serialVersionUID = -6418563091242776474L;
-
- public ServiceException(String msg) {
- super(msg);
- }
-
- public ServiceException(String msg, Throwable t) {
- super(msg, t);
- }
-}
diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/model/common/BusinessService.java b/api/src/main/java/ca/bc/gov/educ/grad/report/model/common/BusinessService.java
index 5b9a4160..b4c4754e 100644
--- a/api/src/main/java/ca/bc/gov/educ/grad/report/model/common/BusinessService.java
+++ b/api/src/main/java/ca/bc/gov/educ/grad/report/model/common/BusinessService.java
@@ -15,13 +15,11 @@
* ********************************************************************** */
package ca.bc.gov.educ.grad.report.model.common;
-import java.io.Serializable;
-
/**
* Provides the super-interface for all business services provided by the ISD
* business layer components.
*
* @author CGI Information Management Consultants Inc.
*/
-public interface BusinessService extends Serializable {
+public interface BusinessService {
}
diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/model/common/DataException.java b/api/src/main/java/ca/bc/gov/educ/grad/report/model/common/DataException.java
index 6558748e..752522bc 100644
--- a/api/src/main/java/ca/bc/gov/educ/grad/report/model/common/DataException.java
+++ b/api/src/main/java/ca/bc/gov/educ/grad/report/model/common/DataException.java
@@ -27,7 +27,7 @@ public class DataException extends DomainServiceException {
private static final long serialVersionUID = 1817217871285315446L;
- private String eid;
+ private final String eid;
/**
* Creates a new exception due to a data access layer anomaly.
@@ -40,6 +40,17 @@ public DataException(final String eID, final DomainEntity entity) {
this.eid = eID;
}
+ /**
+ * Creates a new exception due to a data access layer anomaly.
+ *
+ * @param message The entity instance involved in the failed transaction.
+ * @param message Descriptive message explaining the problem.
+ */
+ public DataException(final String message) {
+ super(message);
+ this.eid = null;
+ }
+
/**
* Creates a new exception due to a data access layer anomaly.
*
@@ -108,12 +119,4 @@ String getEid() {
return this.eid;
}
- /**
- *
- * @param eid The globally unique entity ID string.
- */
- void setEid(final String eid) {
- this.eid = eid;
- }
-
}
diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/model/transcript/StudentTranscriptService.java b/api/src/main/java/ca/bc/gov/educ/grad/report/model/transcript/StudentTranscriptService.java
index 3c8574dc..3bfabf10 100644
--- a/api/src/main/java/ca/bc/gov/educ/grad/report/model/transcript/StudentTranscriptService.java
+++ b/api/src/main/java/ca/bc/gov/educ/grad/report/model/transcript/StudentTranscriptService.java
@@ -24,7 +24,6 @@
import java.io.IOException;
import java.util.List;
-import java.util.concurrent.Future;
/**
* Provides an interface for generating official an unofficial student
@@ -34,22 +33,6 @@
*/
public interface StudentTranscriptService extends BusinessService {
- /**
- * Performs an asynchronous call to
- * buildTranscriptReport(ReportFormat)
.
- *
- * This is intended to be used when loading the transcript report should be
- * started and can continue asynchronously.
- *
- * @param format The final format for the filled report.
- * @return Report data for consumption by the GUI.
- * @throws DomainServiceException
- * @throws IOException
- * @throws DataException
- */
- Future buildUnofficialTranscriptReportAsync(ReportFormat format)
- throws DomainServiceException, IOException, DataException;
-
/**
* Builds the official transcript report in PDF format.
*
diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/service/GradReportCodeService.java b/api/src/main/java/ca/bc/gov/educ/grad/report/service/GradReportCodeService.java
index d7eee92f..bbc4f54c 100644
--- a/api/src/main/java/ca/bc/gov/educ/grad/report/service/GradReportCodeService.java
+++ b/api/src/main/java/ca/bc/gov/educ/grad/report/service/GradReportCodeService.java
@@ -3,7 +3,7 @@
import ca.bc.gov.educ.grad.report.dao.*;
import ca.bc.gov.educ.grad.report.dto.*;
import ca.bc.gov.educ.grad.report.entity.*;
-import ca.bc.gov.educ.grad.report.exception.ServiceException;
+import ca.bc.gov.educ.grad.report.exception.ReportApiServiceException;
import ca.bc.gov.educ.grad.report.transformer.*;
import ca.bc.gov.educ.grad.report.utils.SerializableMap;
import jakarta.transaction.Transactional;
@@ -12,18 +12,19 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
-import java.io.Serializable;
import java.util.List;
import java.util.Optional;
import static ca.bc.gov.educ.grad.report.model.common.Constants.DEBUG_LOG_PATTERN;
@Service
-public class GradReportCodeService implements Serializable {
+public class GradReportCodeService {
private static final String CLASS_NAME = GradReportCodeService.class.getName();
private static Logger log = LoggerFactory.getLogger(CLASS_NAME);
+ private static final String UNABLE_TO_RETRIEVE_RESOURCE = "Unable to retrieve %s";
+
@Autowired
CertificateTypeCodeRepository certificateTypeCodeRepository;
@Autowired
@@ -58,7 +59,7 @@ public List getCertificateTypeCodes() {
result = gradReportCertificateTypeCodeTransformer.transformToDTO(dtos);
} catch (Exception e) {
- throw new ServiceException(String.format("Unable to retrieve %s", "List"));
+ throw new ReportApiServiceException(String.format(UNABLE_TO_RETRIEVE_RESOURCE, "List"), e);
}
return result;
@@ -77,7 +78,7 @@ public CertificateTypeCode getCertificateTypeCode(String code) {
result = gradReportCertificateTypeCodeTransformer.transformToDTO(dto);
} catch (Exception e) {
- throw new ServiceException(String.format("Unable to retrieve %s", "CertificateTypeCode"));
+ throw new ReportApiServiceException(String.format(UNABLE_TO_RETRIEVE_RESOURCE, "CertificateTypeCode"), e);
}
return result;
@@ -96,7 +97,7 @@ public List getTranscriptTypeCodes() {
result = gradReportTranscriptTypeCodeTransformer.transformToDTO(dtos);
} catch (Exception e) {
- throw new ServiceException(String.format("Unable to retrieve %s", "List"));
+ throw new ReportApiServiceException(String.format(UNABLE_TO_RETRIEVE_RESOURCE, "List"), e);
}
return result;
@@ -115,7 +116,7 @@ public TranscriptTypeCode getTranscriptTypeCode(String code) {
result = gradReportTranscriptTypeCodeTransformer.transformToDTO(dto);
} catch (Exception e) {
- throw new ServiceException(String.format("Unable to retrieve %s", "TranscriptTypeCode"));
+ throw new ReportApiServiceException(String.format(UNABLE_TO_RETRIEVE_RESOURCE, "TranscriptTypeCode"), e);
}
return result;
@@ -134,7 +135,7 @@ public List getSignatureBlockTypeCodes() {
result = gradReportSignatureBlockTypeCodeTransformer.transformToDTO(dtos);
} catch (Exception e) {
- throw new ServiceException(String.format("Unable to retrieve %s", "List"));
+ throw new ReportApiServiceException(String.format(UNABLE_TO_RETRIEVE_RESOURCE, "List"), e);
}
return result;
@@ -155,7 +156,7 @@ public SerializableMap getSignatureBlockTypeCode
}
} catch (Exception e) {
- throw new ServiceException(String.format("Unable to retrieve %s", "Map"));
+ throw new ReportApiServiceException(String.format(UNABLE_TO_RETRIEVE_RESOURCE, "Map"), e);
}
return result;
@@ -174,7 +175,7 @@ public SignatureBlockTypeCode getSignatureBlockTypeCode(String code) {
result = gradReportSignatureBlockTypeCodeTransformer.transformToDTO(dto);
} catch (Exception e) {
- throw new ServiceException(String.format("Unable to retrieve %s", "SignatureBlockTypeCode"));
+ throw new ReportApiServiceException(String.format(UNABLE_TO_RETRIEVE_RESOURCE, "SignatureBlockTypeCode"), e);
}
return result;
@@ -208,7 +209,7 @@ public List getDocumentStatusCodes() {
result = gradReportDocumentStatusCodeTransformer.transformToDTO(dtos);
} catch (Exception e) {
- throw new ServiceException(String.format("Unable to retrieve %s", "List"));
+ throw new ReportApiServiceException(String.format(UNABLE_TO_RETRIEVE_RESOURCE, "List"), e);
}
return result;
@@ -227,7 +228,7 @@ public DocumentStatusCode getDocumentStatusCode(String code) {
result = gradReportDocumentStatusCodeTransformer.transformToDTO(dto);
} catch (Exception e) {
- throw new ServiceException(String.format("Unable to retrieve %s", "DocumentStatusCode"));
+ throw new ReportApiServiceException(String.format(UNABLE_TO_RETRIEVE_RESOURCE, "DocumentStatusCode"), e);
}
return result;
@@ -246,7 +247,7 @@ public List getReportTypeCodes() {
result = gradReportReportTypeCodeTransformer.transformToDTO(dtos);
} catch (Exception e) {
- throw new ServiceException(String.format("Unable to retrieve %s", "List"));
+ throw new ReportApiServiceException(String.format(UNABLE_TO_RETRIEVE_RESOURCE, "List"), e);
}
return result;
@@ -265,7 +266,7 @@ public ReportTypeCode getReportTypeCode(String code) {
result = gradReportReportTypeCodeTransformer.transformToDTO(dto);
} catch (Exception e) {
- throw new ServiceException(String.format("Unable to retrieve %s", "ReportTypeCode"));
+ throw new ReportApiServiceException(String.format(UNABLE_TO_RETRIEVE_RESOURCE, "ReportTypeCode"), e);
}
return result;
diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/service/impl/StudentTranscriptServiceImpl.java b/api/src/main/java/ca/bc/gov/educ/grad/report/service/impl/StudentTranscriptServiceImpl.java
index 1787947a..e484ee81 100644
--- a/api/src/main/java/ca/bc/gov/educ/grad/report/service/impl/StudentTranscriptServiceImpl.java
+++ b/api/src/main/java/ca/bc/gov/educ/grad/report/service/impl/StudentTranscriptServiceImpl.java
@@ -40,15 +40,13 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.CompareToBuilder;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;
import java.io.IOException;
+import java.io.Serial;
import java.text.NumberFormat;
import java.time.LocalDate;
import java.util.*;
-import java.util.concurrent.Future;
-import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -94,6 +92,7 @@
@DeclareRoles({STUDENT_TRANSCRIPT_REPORT, USER, FULFILLMENT_SERVICES_USER})
public class StudentTranscriptServiceImpl extends GradReportServiceImpl implements StudentTranscriptService {
+ @Serial
private static final long serialVersionUID = 5L;
private static final String CLASSNAME = StudentTranscriptServiceImpl.class.getName();
@@ -154,19 +153,10 @@ public StudentTranscriptReport buildUnOfficialTranscriptReport(final ReportForma
* createTranscriptReport(ReportFormat, true)
and returns the
* result wrapped in an AsyncResult.
*
- * @param format PDF, HTML, etc.
* @return
* @throws DomainServiceException
- * @throws IOException
* @throws DataException
*/
- @Override
- @RolesAllowed({STUDENT_TRANSCRIPT_REPORT, USER})
- public Future buildUnofficialTranscriptReportAsync(
- final ReportFormat format)
- throws DomainServiceException, IOException, DataException {
- return new AsyncResult<>(createTranscriptReport(format, true));
- }
@Override
@RolesAllowed({STUDENT_TRANSCRIPT_REPORT, USER})
@@ -284,7 +274,7 @@ private StudentTranscriptReport createTranscriptReport(
*/
private List getTranscriptCourseList(
final String pen, final boolean interim)
- throws DataException, DomainServiceException {
+ throws DomainServiceException {
final String methodName = "getTranscriptCourseList(String, boolean)";
LOG.entering(CLASSNAME, methodName);
@@ -323,7 +313,7 @@ private List getTranscriptCourseList(
*
* @param transcriptTypeCode
* @param graduationProgramCode The graduation program code that influences sort order.
- * @param transcriptCourses
+ * @param transcriptCourses Transcript Courses
* @param issueDate
*/
private Transcript adapt(
@@ -553,8 +543,9 @@ private synchronized StudentTranscriptReport createReport(
report.setBlank(StringUtils.isBlank(student.getPen().getPen()));
ca.bc.gov.educ.grad.report.dto.reports.data.impl.Student stu = (ca.bc.gov.educ.grad.report.dto.reports.data.impl.Student)report.getDataSource();
- final ReportDocument document = reportService.export(report);
+ LOG.log(Level.FINE, "DataSource Student created {0}.", new Object[]{stu.getPEN()});
+ final ReportDocument document = reportService.export(report);
LOG.log(Level.FINE, "Created document {0} for student {1}.", new Object[]{document, student.getPen()});
final String filename = report.getFilename();
@@ -649,7 +640,6 @@ private String getCreditsUsedForGrad(final Transcript transcript) {
return "" + totalCredits;
}
- // FIXME: Pass in GraduationProgramCode enum
private GraduationData adaptGraduationData(
final StudentInfo studentInfo,
final Transcript transcript) {
@@ -767,8 +757,7 @@ private Comparator createComparator(
final Comparator result;
switch (code) {
- case PROGRAM_1950:
- case PROGRAM_1986:
+ case PROGRAM_1950, PROGRAM_1986:
// 1995, 2004, 2018, etc.
default:
result = createRegularComparator();
@@ -784,21 +773,13 @@ private Comparator createComparator(
* @return A comparator for sorting by course code.
*/
private Comparator createAdultComparator() {
- return new Comparator() {
- @Override
- public int compare(
- final TranscriptResult tr1,
- final TranscriptResult tr2) {
- final String reportCourseType1 = getReportCourseType(tr1);
- final String reportCourseType2 = getReportCourseType(tr2);
- final String code1 = getCourseCode(tr1);
- final String code2 = getCourseCode(tr2);
-
- return new CompareToBuilder()
- //.append(reportCourseType1, reportCourseType2)
- .append(code1, code2)
- .toComparison();
- }
+ return (tr1, tr2) -> {
+ final String code1 = getCourseCode(tr1);
+ final String code2 = getCourseCode(tr2);
+
+ return new CompareToBuilder()
+ .append(code1, code2)
+ .toComparison();
};
}
@@ -810,19 +791,16 @@ public int compare(
* sort the transcript results.
*/
private Comparator createRegularComparator() {
- return new Comparator() {
- @Override
- public int compare(final TranscriptResult tr1, final TranscriptResult tr2) {
- final int level1 = getCourseLevel(tr1);
- final int level2 = getCourseLevel(tr2);
- final String name1 = getCourseName(tr1);
- final String name2 = getCourseName(tr2);
-
- return new CompareToBuilder()
- .append(level1, level2)
- .append(name1, name2)
- .toComparison();
- }
+ return (tr1, tr2) -> {
+ final int level1 = getCourseLevel(tr1);
+ final int level2 = getCourseLevel(tr2);
+ final String name1 = getCourseName(tr1);
+ final String name2 = getCourseName(tr2);
+
+ return new CompareToBuilder()
+ .append(level1, level2)
+ .append(name1, name2)
+ .toComparison();
};
}
@@ -832,22 +810,19 @@ public int compare(final TranscriptResult tr1, final TranscriptResult tr2) {
* @return A comparator that can sort ungraded results.
*/
private Comparator createUngradedComparator() {
- return new Comparator() {
- @Override
- public int compare(final TranscriptResult tr1, final TranscriptResult tr2) {
- final int level1 = getCourseLevel(tr1);
- final int level2 = getCourseLevel(tr2);
+ return (tr1, tr2) -> {
+ final int level1 = getCourseLevel(tr1);
+ final int level2 = getCourseLevel(tr2);
- final int comparison = new CompareToBuilder()
- .append(level1, level2)
- .toComparison();
+ final int comparison = new CompareToBuilder()
+ .append(level1, level2)
+ .toComparison();
- return SORT_UNGRADED.equals("" + level1)
- || SORT_UNGRADED.equals("" + level2)
- ? comparison
- : 0;
+ return SORT_UNGRADED.equals("" + level1)
+ || SORT_UNGRADED.equals("" + level2)
+ ? comparison
+ : 0;
- }
};
}
@@ -857,29 +832,26 @@ public int compare(final TranscriptResult tr1, final TranscriptResult tr2) {
* @return A comparator that can sort assessment results.
*/
private Comparator createAssessmentComparator() {
- return new Comparator() {
- @Override
- public int compare(final TranscriptResult tr1, final TranscriptResult tr2) {
- final int level1 = getCourseLevel(tr1);
- final int level2 = getCourseLevel(tr2);
-
- final String reportCourseType1 = getReportCourseType(tr1);
- final String reportCourseType2 = getReportCourseType(tr2);
-
- final String courseCode1 = getCourseCode(tr1);
- final String courseCode2 = getCourseCode(tr2);
-
- final int comparison = new CompareToBuilder()
- .append(level1, level2)
- .append(reportCourseType1, reportCourseType2)
- .append(courseCode1, courseCode2)
- .toComparison();
-
- return ASSESSMENT.isCode(reportCourseType1)
- || ASSESSMENT.isCode(reportCourseType2)
- ? comparison
- : 0;
- }
+ return (tr1, tr2) -> {
+ final int level1 = getCourseLevel(tr1);
+ final int level2 = getCourseLevel(tr2);
+
+ final String reportCourseType1 = getReportCourseType(tr1);
+ final String reportCourseType2 = getReportCourseType(tr2);
+
+ final String courseCode1 = getCourseCode(tr1);
+ final String courseCode2 = getCourseCode(tr2);
+
+ final int comparison = new CompareToBuilder()
+ .append(level1, level2)
+ .append(reportCourseType1, reportCourseType2)
+ .append(courseCode1, courseCode2)
+ .toComparison();
+
+ return ASSESSMENT.isCode(reportCourseType1)
+ || ASSESSMENT.isCode(reportCourseType2)
+ ? comparison
+ : 0;
};
}
@@ -892,11 +864,9 @@ public int compare(final TranscriptResult tr1, final TranscriptResult tr2) {
*/
private String getReportCourseType(final TranscriptResult tr) {
final Course c = tr.getCourse();
- final String reportCourseType = c == null
+ return c == null
? PROVINCIALLY_EXAMINABLE.getCode()
: c.getType();
-
- return reportCourseType;
}
/**
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 fe5fcfc2..917d8213 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
@@ -30,6 +30,8 @@ public class EducGradReportApiConstants {
public static final String SECOND_DEFAULT_DATE_TIME_FORMAT = "yyyy/MM/dd HH:mm:ss";
public static final String TRAX_DATE_FORMAT = "yyyyMM";
+ public static final String NO_ELIGIBLE_COURSES_TRANSCRIPT_REPORT_IS_NOT_CREATED = "Transcript has no eligible courses. Transcript Report is not created";
+
@Value("${endpoint.educ-grad-trax-api.get-district-details.url}")
private String districtDetails;
diff --git a/api/src/main/java/ca/bc/gov/educ/grad/report/utils/GradValidation.java b/api/src/main/java/ca/bc/gov/educ/grad/report/utils/GradValidation.java
index 3368ed46..32785889 100644
--- a/api/src/main/java/ca/bc/gov/educ/grad/report/utils/GradValidation.java
+++ b/api/src/main/java/ca/bc/gov/educ/grad/report/utils/GradValidation.java
@@ -39,14 +39,13 @@ public void addError(String formattedErrorMessage, Object... args) {
public void addErrorAndStop(String errorMessage) {
errorList.get().add(errorMessage);
- throw new GradBusinessRuleException();
-
+ throw new GradBusinessRuleException(errorMessage);
}
public void addErrorAndStop(String formattedErrorMessage, Object... args) {
- errorList.get().add(String.format(formattedErrorMessage, args));
- throw new GradBusinessRuleException();
-
+ String completeErrorMessage = String.format(formattedErrorMessage, args);
+ errorList.get().add(completeErrorMessage);
+ throw new GradBusinessRuleException(completeErrorMessage);
}
@@ -75,11 +74,10 @@ public boolean requiredField(Object requiredValue, String fieldName) {
addError(messagesHelper.missingValue(fieldName));
return false;
}
- if (requiredValue instanceof String) {
- if (StringUtils.isBlank((String)requiredValue)) {
+ if (requiredValue instanceof String && (StringUtils.isBlank((String)requiredValue))) {
addError(messagesHelper.missingValue(fieldName));
return false;
- }
+
}
return true;
}
@@ -97,10 +95,16 @@ public boolean hasErrors() {
public boolean hasWarnings() {
return !warningList.get().isEmpty();
}
-
+
+ public boolean containsError(String error) {
+ if(hasErrors()) {
+ return errorList.get().contains(error);
+ }
+ return false;
+ }
+
public void clear() {
errorList.get().clear();
warningList.get().clear();
-
}
}
\ No newline at end of file
diff --git a/api/src/main/resources/reports/PackingSlip.jrxml b/api/src/main/resources/reports/PackingSlip.jrxml
index 385b0023..a81f8325 100644
--- a/api/src/main/resources/reports/PackingSlip.jrxml
+++ b/api/src/main/resources/reports/PackingSlip.jrxml
@@ -1,6 +1,5 @@
-
-
+
@@ -63,30 +62,30 @@
-
+
-
+
-
-
+
+
-
+
-
+
@@ -130,7 +129,7 @@
-
+
diff --git a/api/src/main/resources/reports/subreports/certificate/AB.jrxml b/api/src/main/resources/reports/subreports/certificate/AB.jrxml
index f568621e..081f4e95 100644
--- a/api/src/main/resources/reports/subreports/certificate/AB.jrxml
+++ b/api/src/main/resources/reports/subreports/certificate/AB.jrxml
@@ -160,7 +160,7 @@
-
+
diff --git a/api/src/main/resources/reports/subreports/certificate/AIB.jrxml b/api/src/main/resources/reports/subreports/certificate/AIB.jrxml
index c7393bc7..a50e74ed 100644
--- a/api/src/main/resources/reports/subreports/certificate/AIB.jrxml
+++ b/api/src/main/resources/reports/subreports/certificate/AIB.jrxml
@@ -160,7 +160,7 @@
-
+
diff --git a/api/src/main/resources/reports/subreports/certificate/EB.jrxml b/api/src/main/resources/reports/subreports/certificate/EB.jrxml
index 152cfbab..0c024def 100644
--- a/api/src/main/resources/reports/subreports/certificate/EB.jrxml
+++ b/api/src/main/resources/reports/subreports/certificate/EB.jrxml
@@ -122,7 +122,7 @@
-
+
diff --git a/api/src/main/resources/reports/subreports/certificate/EIB.jrxml b/api/src/main/resources/reports/subreports/certificate/EIB.jrxml
index 9af265a2..571305ee 100644
--- a/api/src/main/resources/reports/subreports/certificate/EIB.jrxml
+++ b/api/src/main/resources/reports/subreports/certificate/EIB.jrxml
@@ -123,7 +123,7 @@
-
+
diff --git a/api/src/main/resources/reports/subreports/certificate/FB.jrxml b/api/src/main/resources/reports/subreports/certificate/FB.jrxml
index bcf8fb88..b325c66d 100644
--- a/api/src/main/resources/reports/subreports/certificate/FB.jrxml
+++ b/api/src/main/resources/reports/subreports/certificate/FB.jrxml
@@ -122,7 +122,7 @@
-
+
diff --git a/api/src/main/resources/reports/subreports/certificate/FNAB.jrxml b/api/src/main/resources/reports/subreports/certificate/FNAB.jrxml
index 48637eb5..3c2f64cc 100644
--- a/api/src/main/resources/reports/subreports/certificate/FNAB.jrxml
+++ b/api/src/main/resources/reports/subreports/certificate/FNAB.jrxml
@@ -160,7 +160,7 @@
-
+
diff --git a/api/src/main/resources/reports/subreports/certificate/FNB.jrxml b/api/src/main/resources/reports/subreports/certificate/FNB.jrxml
index ba8127a4..5dc0d0c8 100644
--- a/api/src/main/resources/reports/subreports/certificate/FNB.jrxml
+++ b/api/src/main/resources/reports/subreports/certificate/FNB.jrxml
@@ -122,7 +122,7 @@
-
+
diff --git a/api/src/main/resources/reports/subreports/certificate/OB.jrxml b/api/src/main/resources/reports/subreports/certificate/OB.jrxml
index cc8f3eba..7f9cffed 100644
--- a/api/src/main/resources/reports/subreports/certificate/OB.jrxml
+++ b/api/src/main/resources/reports/subreports/certificate/OB.jrxml
@@ -122,7 +122,7 @@
-
+
diff --git a/api/src/main/resources/reports/subreports/certificate/SB.jrxml b/api/src/main/resources/reports/subreports/certificate/SB.jrxml
index 0918062f..3256b1fa 100644
--- a/api/src/main/resources/reports/subreports/certificate/SB.jrxml
+++ b/api/src/main/resources/reports/subreports/certificate/SB.jrxml
@@ -122,7 +122,7 @@
-
+
diff --git a/api/src/main/resources/reports/subreports/certificate/SCB.jrxml b/api/src/main/resources/reports/subreports/certificate/SCB.jrxml
index 8f697e30..42913a73 100644
--- a/api/src/main/resources/reports/subreports/certificate/SCB.jrxml
+++ b/api/src/main/resources/reports/subreports/certificate/SCB.jrxml
@@ -179,7 +179,7 @@
-
+
diff --git a/api/src/main/resources/reports/subreports/certificate/SCFNB.jrxml b/api/src/main/resources/reports/subreports/certificate/SCFNB.jrxml
index 012cec6e..795a03d7 100644
--- a/api/src/main/resources/reports/subreports/certificate/SCFNB.jrxml
+++ b/api/src/main/resources/reports/subreports/certificate/SCFNB.jrxml
@@ -179,7 +179,7 @@
-
+
diff --git a/api/src/main/resources/reports/subreports/certificate/SCIB.jrxml b/api/src/main/resources/reports/subreports/certificate/SCIB.jrxml
index 66f3496a..1187cdf4 100644
--- a/api/src/main/resources/reports/subreports/certificate/SCIB.jrxml
+++ b/api/src/main/resources/reports/subreports/certificate/SCIB.jrxml
@@ -179,7 +179,7 @@
-
+
diff --git a/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/controller/StudentReportApiControllerTest.java b/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/controller/StudentReportApiControllerTest.java
index cf64371f..7c6bef99 100644
--- a/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/controller/StudentReportApiControllerTest.java
+++ b/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/controller/StudentReportApiControllerTest.java
@@ -11,6 +11,7 @@
import ca.bc.gov.educ.grad.report.model.common.BusinessReport;
import ca.bc.gov.educ.grad.report.model.graduation.StudentCertificateService;
import ca.bc.gov.educ.grad.report.model.transcript.StudentTranscriptService;
+import ca.bc.gov.educ.grad.report.utils.GradValidation;
import org.junit.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
@@ -54,6 +55,9 @@ public class StudentReportApiControllerTest extends GradReportBaseTest {
@Mock
GradReportService reportService;
+ @Mock
+ GradValidation gradValidation;
+
@InjectMocks
private ReportController reportController;
diff --git a/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/service/GradReportApiCertificateServiceTests.java b/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/service/GradReportApiCertificateServiceTests.java
index e02ec438..1338676a 100644
--- a/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/service/GradReportApiCertificateServiceTests.java
+++ b/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/service/GradReportApiCertificateServiceTests.java
@@ -5,7 +5,7 @@
import ca.bc.gov.educ.grad.report.api.service.GradReportService;
import ca.bc.gov.educ.grad.report.api.test.GradReportBaseTest;
import ca.bc.gov.educ.grad.report.dao.ReportRequestDataThreadLocal;
-import ca.bc.gov.educ.grad.report.exception.ServiceException;
+import ca.bc.gov.educ.grad.report.exception.ReportApiServiceException;
import ca.bc.gov.educ.grad.report.model.common.BusinessReport;
import ca.bc.gov.educ.grad.report.model.common.DomainServiceException;
import ca.bc.gov.educ.grad.report.model.graduation.StudentCertificateService;
@@ -54,7 +54,7 @@ public void createCertificateReport_NOTELIG_E() throws Exception {
mockTraxSchool(school);
ReportRequestDataThreadLocal.setReportData(reportRequest.getData());
- assertThrows("REPORT_DATA_NOT_VALID=School is not eligible for certificates", ServiceException.class, () -> {
+ assertThrows("REPORT_DATA_NOT_VALID=School is not eligible for certificates", ReportApiServiceException.class, () -> {
apiReportService.getStudentCertificateReport(reportRequest);
});
diff --git a/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/service/GradReportApiSchoolServiceTests.java b/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/service/GradReportApiSchoolServiceTests.java
index 666456e9..0dc0fa05 100644
--- a/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/service/GradReportApiSchoolServiceTests.java
+++ b/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/service/GradReportApiSchoolServiceTests.java
@@ -9,6 +9,7 @@
import ca.bc.gov.educ.grad.report.dao.ReportRequestDataThreadLocal;
import ca.bc.gov.educ.grad.report.entity.CertificateTypeCodeEntity;
import ca.bc.gov.educ.grad.report.entity.TranscriptTypeCodeEntity;
+import ca.bc.gov.educ.grad.report.exception.ReportApiServiceException;
import org.apache.commons.lang3.StringUtils;
import org.junit.Before;
import org.junit.Test;
@@ -79,6 +80,17 @@ public void createSchoolDistributionReport() throws Exception {
LOG.debug(">createSchoolDistributionReport");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void createSchoolDistributionReportException() throws Exception {
+ LOG.debug("<{}.createSchoolDistributionReportException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ ReportRequest reportRequest = createReportRequest("json/schoolDistributionReportRequest.json");
+
+ reportRequest.setData(null);
+
+ apiReportService.getSchoolDistributionReport(reportRequest);
+ LOG.debug(">createSchoolDistributionReportException");
+ }
+
@Test
public void createDistrictDistributionYearEndReport() throws Exception {
LOG.debug("<{}.createDistrictDistributionYearEndReport at {}", CLASS_NAME, dateFormat.format(new Date()));
@@ -113,6 +125,18 @@ public void createDistrictDistributionYearEndReport() throws Exception {
LOG.debug(">createDistrictDistributionYearEndReport");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void createDistrictDistributionYearEndReportException() throws Exception {
+ LOG.debug("<{}.createDistrictDistributionYearEndReport at {}", CLASS_NAME, dateFormat.format(new Date()));
+ ReportRequest reportRequest = createReportRequest("json/districtDistributionYearEndReportRequest.json");
+
+ reportRequest.setData(null);
+
+ apiReportService.getDistrictDistributionReportYearEnd(reportRequest);
+
+ LOG.debug(">createDistrictDistributionYearEndReport");
+ }
+
@Test
public void createDistrictDistributionYearEndNonGradReport() throws Exception {
LOG.debug("<{}.createDistrictDistributionYearEndNonGradReport at {}", CLASS_NAME, dateFormat.format(new Date()));
@@ -147,6 +171,18 @@ public void createDistrictDistributionYearEndNonGradReport() throws Exception {
LOG.debug(">createDistrictDistributionYearEndNonGradReport");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void createDistrictDistributionYearEndNonGradReportException() throws Exception {
+ LOG.debug("<{}.createDistrictDistributionYearEndNonGradReportException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ ReportRequest reportRequest = createReportRequest("json/districtDistributionYearEndNonGradReportRequest.json");
+
+ reportRequest.setData(null);
+
+ apiReportService.getDistrictDistributionReportYearEndNonGrad(reportRequest);
+
+ LOG.debug(">createDistrictDistributionYearEndNonGradReportException");
+ }
+
@Test
public void createSchoolDistributionYearEndReport() throws Exception {
LOG.debug("<{}.createSchoolDistributionYearEndReport at {}", CLASS_NAME, dateFormat.format(new Date()));
@@ -181,6 +217,13 @@ public void createSchoolDistributionYearEndReport() throws Exception {
LOG.debug(">createSchoolDistributionYearEndReport");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void createSchoolDistributionYearEndReportException() throws Exception {
+ LOG.debug("<{}.createSchoolDistributionYearEndReportException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ apiReportService.getSchoolDistributionReportYearEnd(null);
+ LOG.debug(">createSchoolDistributionYearEndReportException");
+ }
+
@Test
public void createSchoolDistributionReport_NOSTUDENTS() throws Exception {
LOG.debug("<{}.createSchoolDistributionReport_NOSTUDENTS at {}", CLASS_NAME, dateFormat.format(new Date()));
@@ -250,6 +293,18 @@ public void createSchoolLabelReport() throws Exception {
LOG.debug(">createSchoolLabelReport");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void createSchoolLabelReportException() throws Exception {
+ LOG.debug("<{}.createSchoolLabelReportException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ ReportRequest reportRequest = createReportRequest("json/schoolLabelReportRequest.json");
+
+ reportRequest.setData(null);
+
+ apiReportService.getSchoolLabelReport(reportRequest);
+
+ LOG.debug(">createSchoolLabelReportException");
+ }
+
@Test
public void createSchoolGraduationReport() throws Exception {
LOG.debug("<{}.createSchoolGraduationReport at {}", CLASS_NAME, dateFormat.format(new Date()));
@@ -277,6 +332,18 @@ public void createSchoolGraduationReport() throws Exception {
LOG.debug(">createSchoolGraduationReport");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void createSchoolGraduationReportException() throws Exception {
+ LOG.debug("<{}.createSchoolGraduationReportException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ ReportRequest reportRequest = createReportRequest("json/schoolGraduationReportRequest.json");
+
+ reportRequest.setData(null);
+
+ apiReportService.getSchoolGraduationReport(reportRequest);
+
+ LOG.debug(">createSchoolGraduationReportException");
+ }
+
@Test
public void createSchoolGraduationReport_NOSTUDENTS() throws Exception {
LOG.debug("<{}.createSchoolGraduationReport_NOSTUDENTS at {}", CLASS_NAME, dateFormat.format(new Date()));
@@ -325,6 +392,18 @@ public void createSchoolNonGraduationReport() throws Exception {
LOG.debug(">createSchoolNonGraduationReport");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void createSchoolNonGraduationReportException() throws Exception {
+ LOG.debug("<{}.createSchoolNonGraduationReportException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ ReportRequest reportRequest = createReportRequest("json/schoolNonGraduationReportRequest.json");
+
+ reportRequest.setData(null);
+
+ apiReportService.getSchoolNonGraduationReport(reportRequest);
+
+ LOG.debug(">createSchoolNonGraduationReportException");
+ }
+
@Test
public void createSchoolNonGraduationReport_NOSTUDENTS() throws Exception {
LOG.debug("<{}.createSchoolNonGraduationReport_NOSTUDENTS at {}", CLASS_NAME, dateFormat.format(new Date()));
@@ -367,6 +446,18 @@ public void createStudentNonGradReport() throws Exception {
LOG.debug(">createStudentNonGradReport");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void createStudentNonGradReportException() throws Exception {
+ LOG.debug("<{}.createStudentNonGradReportException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ ReportRequest reportRequest = createReportRequest("json/studentNonGradReportRequest.json");
+
+ reportRequest.setData(null);
+
+ apiReportService.getStudentNonGradReport(reportRequest);
+
+ LOG.debug(">createStudentNonGradReportException");
+ }
+
@Test
public void createStudentNonGradReport_NOSTUDENTS() throws Exception {
LOG.debug("<{}.createStudentNonGradReport_NOSTUDENTS at {}", CLASS_NAME, dateFormat.format(new Date()));
diff --git a/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/service/GradReportApiTranscriptServiceTests.java b/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/service/GradReportApiTranscriptServiceTests.java
index 33b6bd9c..e020e313 100644
--- a/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/service/GradReportApiTranscriptServiceTests.java
+++ b/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/service/GradReportApiTranscriptServiceTests.java
@@ -8,7 +8,7 @@
import ca.bc.gov.educ.grad.report.dao.ReportRequestDataThreadLocal;
import ca.bc.gov.educ.grad.report.dto.impl.GradProgramImpl;
import ca.bc.gov.educ.grad.report.exception.EntityNotFoundException;
-import ca.bc.gov.educ.grad.report.exception.ServiceException;
+import ca.bc.gov.educ.grad.report.exception.ReportApiServiceException;
import ca.bc.gov.educ.grad.report.model.common.DataException;
import ca.bc.gov.educ.grad.report.model.graduation.GraduationProgramCode;
import ca.bc.gov.educ.grad.report.model.transcript.StudentTranscriptService;
@@ -27,6 +27,7 @@
import java.util.List;
import static org.junit.Assert.*;
+import static org.mockito.Mockito.when;
@WebAppConfiguration
public class GradReportApiTranscriptServiceTests extends GradReportBaseTest {
@@ -79,6 +80,24 @@ public void createStudentAchievementReport() throws Exception {
LOG.debug(">createStudentAchievementReport");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void createStudentAchievementReportException() throws Exception {
+ LOG.debug("<{}.createStudentAchievementReportException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ ReportRequest reportRequest = createReportRequest("json/studentAchievementReportRequest.json");
+
+ reportRequest.getData().setAccessToken("accessToken");
+
+ mockTraxSchool(adaptTraxSchool(getReportDataSchool(reportRequest.getData())));
+ ReportRequestDataThreadLocal.setReportData(reportRequest.getData());
+
+ String pen = reportRequest.getData().getStudent().getPen().getPen();
+ reportRequest.getOptions().setReportFile(String.format(reportRequest.getOptions().getReportFile(), pen));
+
+ when(apiReportService.getStudentAchievementReportDocument(reportRequest)).thenThrow(new ReportApiServiceException(String.format("Unable to retrieve %s", "getStudentAchievementReport(ReportRequest reportRequest)"), new Exception()));
+ apiReportService.getStudentAchievementReport(reportRequest);
+ LOG.debug(">createStudentAchievementReportException");
+ }
+
@Test
public void createStudentAchievementReportError() throws Exception {
LOG.debug("<{}.createStudentAchievementReportError at {}", CLASS_NAME, dateFormat.format(new Date()));
@@ -384,7 +403,7 @@ public void createTranscriptReport_NOTELIG_NOPROG() throws Exception {
assertNotNull(graduationStudentRecord);
assertNotNull(graduationStudentRecord.getLastUpdateDate());
- assertThrows("REPORT_DATA_NOT_VALID=School is not eligible for transcripts", ServiceException.class, () -> {
+ assertThrows("REPORT_DATA_NOT_VALID=School is not eligible for transcripts", ReportApiServiceException.class, () -> {
apiReportService.getStudentTranscriptReport(reportRequest);
});
@@ -420,6 +439,18 @@ public void createXmlTranscriptReport() throws Exception {
LOG.debug(">createXmlTranscriptReport");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void createXmlTranscriptReportException() throws Exception {
+ LOG.debug("<{}.createXmlTranscriptReportException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ XmlReportRequest reportRequest = createXmlReportRequest("json/xmlTranscriptReportRequest.json");
+
+ reportRequest.setData(null);
+
+ apiReportService.getStudentXmlTranscriptReport(reportRequest);
+
+ LOG.debug(">createXmlTranscriptReportException");
+ }
+
@Test
public void createTranscriptReportDuplicateInterimCourses_BC2018_PUB() throws Exception {
LOG.debug("<{}.createTranscriptReportDuplicateInterimCourses_BC2018_PUB at {}", CLASS_NAME, dateFormat.format(new Date()));
diff --git a/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/service/GradReportCodeServiceTests.java b/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/service/GradReportCodeServiceTests.java
index 6e53f927..27c301f2 100644
--- a/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/service/GradReportCodeServiceTests.java
+++ b/api/src/test/java/ca/bc/gov/educ/grad/report/api/test/service/GradReportCodeServiceTests.java
@@ -2,6 +2,7 @@
import ca.bc.gov.educ.grad.report.api.test.GradReportBaseTest;
import ca.bc.gov.educ.grad.report.entity.*;
+import ca.bc.gov.educ.grad.report.exception.ReportApiServiceException;
import ca.bc.gov.educ.grad.report.service.GradReportCodeService;
import org.junit.Before;
import org.junit.Test;
@@ -15,6 +16,7 @@
import java.util.List;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
@WebAppConfiguration
@@ -45,6 +47,18 @@ public void getCertificateTypeCodes() throws Exception {
LOG.debug(">getCertificateTypeCodes");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void getCertificateTypeCodesException() {
+ LOG.debug("<{}.getCertificateTypeCodesException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ CertificateTypeCodeEntity certificateTypeCodeEntity = new CertificateTypeCodeEntity();
+ certificateTypeCodeEntity.setCertificateTypeCode("E");
+ certificateTypeCodeEntity.setLabel("Dogwood (Public)");
+ certificateTypeCodeEntity.setDescription("B.C. Certificate of Graduation - Public School");
+ when(certificateTypeCodeRepository.findAll()).thenThrow(new ReportApiServiceException(String.format("Unable to retrieve %s", "List"), new Exception()));
+ gradReportCodeService.getCertificateTypeCodes();
+ LOG.debug(">getCertificateTypeCodesException");
+ }
+
@Test
public void getCertificateTypeCode() throws Exception {
LOG.debug("<{}.getCertificateTypeCode at {}", CLASS_NAME, dateFormat.format(new Date()));
@@ -58,6 +72,18 @@ public void getCertificateTypeCode() throws Exception {
LOG.debug(">getCertificateTypeCode");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void getCertificateTypeCodeException() throws Exception {
+ LOG.debug("<{}.getCertificateTypeCodeException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ CertificateTypeCodeEntity certificateTypeCodeEntity = new CertificateTypeCodeEntity();
+ certificateTypeCodeEntity.setCertificateTypeCode("E");
+ certificateTypeCodeEntity.setLabel("Dogwood (Public)");
+ certificateTypeCodeEntity.setDescription("B.C. Certificate of Graduation - Public School");
+ when(certificateTypeCodeRepository.findByCertificateCode(certificateTypeCodeEntity.getCertificateTypeCode())).thenThrow(new ReportApiServiceException(String.format("Unable to retrieve %s", "CertificateTypeCode"), new Exception()));
+ gradReportCodeService.getCertificateTypeCode(certificateTypeCodeEntity.getCertificateTypeCode());
+ LOG.debug(">getCertificateTypeCodeException");
+ }
+
@Test
public void getTranscriptTypeCodes() throws Exception {
LOG.debug("<{}.getTranscriptTypeCodes at {}", CLASS_NAME, dateFormat.format(new Date()));
@@ -71,6 +97,18 @@ public void getTranscriptTypeCodes() throws Exception {
LOG.debug(">getTranscriptTypeCodes");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void getTranscriptTypeCodesException() throws Exception {
+ LOG.debug("<{}.getTranscriptTypeCodesException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ TranscriptTypeCodeEntity transcriptTypeCodeEntity = new TranscriptTypeCodeEntity();
+ transcriptTypeCodeEntity.setTranscriptTypeCode("BC2018-PUB");
+ transcriptTypeCodeEntity.setLabel("Graduation Program 2018");
+ transcriptTypeCodeEntity.setDescription("2018 Public School Transcript BC");
+ when(transcriptTypeCodeRepository.findAll()).thenThrow(new ReportApiServiceException(String.format("Unable to retrieve %s", "List"), new Exception()));
+ gradReportCodeService.getTranscriptTypeCodes();
+ LOG.debug(">getTranscriptTypeCodesException");
+ }
+
@Test
public void getTranscriptTypeCode() throws Exception {
LOG.debug("<{}.getTranscriptTypeCode at {}", CLASS_NAME, dateFormat.format(new Date()));
@@ -84,6 +122,18 @@ public void getTranscriptTypeCode() throws Exception {
LOG.debug(">getTranscriptTypeCode");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void getTranscriptTypeCodeException() throws Exception {
+ LOG.debug("<{}.getTranscriptTypeCodeException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ TranscriptTypeCodeEntity transcriptTypeCodeEntity = new TranscriptTypeCodeEntity();
+ transcriptTypeCodeEntity.setTranscriptTypeCode("BC2018-PUB");
+ transcriptTypeCodeEntity.setLabel("Graduation Program 2018");
+ transcriptTypeCodeEntity.setDescription("2018 Public School Transcript BC");
+ when(transcriptTypeCodeRepository.findByTranscriptCode(transcriptTypeCodeEntity.getTranscriptTypeCode())).thenThrow(new ReportApiServiceException(String.format("Unable to retrieve %s", "TranscriptTypeCode"), new Exception()));
+ gradReportCodeService.getTranscriptTypeCode(transcriptTypeCodeEntity.getTranscriptTypeCode());
+ LOG.debug(">getTranscriptTypeCodeException");
+ }
+
@Test
public void getSignatureBlockTypeCodes() throws Exception {
LOG.debug("<{}.getSignatureBlockTypeCodes at {}", CLASS_NAME, dateFormat.format(new Date()));
@@ -97,6 +147,46 @@ public void getSignatureBlockTypeCodes() throws Exception {
LOG.debug(">getSignatureBlockTypeCodes");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void getSignatureBlockTypeCodesException() throws Exception {
+ LOG.debug("<{}.getSignatureBlockTypeCodesException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ SignatureBlockTypeCodeEntity signatureBlockTypeCodeEntity = new SignatureBlockTypeCodeEntity();
+ signatureBlockTypeCodeEntity.setSignatureBlockType("MOE");
+ signatureBlockTypeCodeEntity.setLabel("Minister of Education and Child Care");
+ signatureBlockTypeCodeEntity.setDescription("Minister of Education and Child Care");
+ when(signatureBlockTypeRepository.findAll()).thenThrow(new ReportApiServiceException(String.format("Unable to retrieve %s", "List"), new Exception()));
+ gradReportCodeService.getSignatureBlockTypeCodes();
+ LOG.debug(">getSignatureBlockTypeCodesException");
+ }
+
+ @Test
+ public void getSignatureBlockTypeCodesMap() throws Exception {
+ LOG.debug("<{}.getSignatureBlockTypeCodesMap at {}", CLASS_NAME, dateFormat.format(new Date()));
+
+ SignatureBlockTypeCodeEntity signatureBlockTypeCodeEntity = new SignatureBlockTypeCodeEntity();
+ signatureBlockTypeCodeEntity.setSignatureBlockType("MOE");
+ signatureBlockTypeCodeEntity.setLabel("Minister of Education and Child Care");
+ signatureBlockTypeCodeEntity.setDescription("Minister of Education and Child Care");
+ when(signatureBlockTypeRepository.findAll()).thenReturn(List.of(signatureBlockTypeCodeEntity));
+
+ var result = gradReportCodeService.getSignatureBlockTypeCodesMap();
+ assertTrue(!result.isEmpty());
+ LOG.debug(">getSignatureBlockTypeCodesMap");
+ }
+
+ @Test(expected = ReportApiServiceException.class)
+ public void getSignatureBlockTypeCodesMapException() throws Exception {
+ LOG.debug("<{}.getSignatureBlockTypeCodesMapException at {}", CLASS_NAME, dateFormat.format(new Date()));
+
+ SignatureBlockTypeCodeEntity signatureBlockTypeCodeEntity = new SignatureBlockTypeCodeEntity();
+ signatureBlockTypeCodeEntity.setSignatureBlockType("MOE");
+ signatureBlockTypeCodeEntity.setLabel("Minister of Education and Child Care");
+ signatureBlockTypeCodeEntity.setDescription("Minister of Education and Child Care");
+ when(signatureBlockTypeRepository.findAll()).thenThrow(new ReportApiServiceException(String.format("Unable to retrieve %s", "Map"), new Exception()));
+ gradReportCodeService.getSignatureBlockTypeCodesMap();
+ LOG.debug(">getSignatureBlockTypeCodesMapException");
+ }
+
@Test
public void getSignatureBlockTypeCode() throws Exception {
LOG.debug("<{}.getSignatureBlockTypeCode at {}", CLASS_NAME, dateFormat.format(new Date()));
@@ -110,6 +200,18 @@ public void getSignatureBlockTypeCode() throws Exception {
LOG.debug(">getSignatureBlockTypeCode");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void getSignatureBlockTypeCodeException() throws Exception {
+ LOG.debug("<{}.getSignatureBlockTypeCodeException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ SignatureBlockTypeCodeEntity signatureBlockTypeCodeEntity = new SignatureBlockTypeCodeEntity();
+ signatureBlockTypeCodeEntity.setSignatureBlockType("MOE");
+ signatureBlockTypeCodeEntity.setLabel("Minister of Education and Child Care");
+ signatureBlockTypeCodeEntity.setDescription("Minister of Education and Child Care");
+ when(signatureBlockTypeRepository.findBySignatureBlockTypeCode(signatureBlockTypeCodeEntity.getSignatureBlockType())).thenThrow(new ReportApiServiceException(String.format("Unable to retrieve %s", "SignatureBlockTypeCode"), new Exception()));
+ gradReportCodeService.getSignatureBlockTypeCode(signatureBlockTypeCodeEntity.getSignatureBlockType());
+ LOG.debug(">getSignatureBlockTypeCodeException");
+ }
+
@Test
public void getDocumentStatusTypeCodes() throws Exception {
LOG.debug("<{}.getDocumentStatusTypeCodes at {}", CLASS_NAME, dateFormat.format(new Date()));
@@ -123,6 +225,18 @@ public void getDocumentStatusTypeCodes() throws Exception {
LOG.debug(">getDocumentStatusCodes");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void getDocumentStatusTypeCodesException() throws Exception {
+ LOG.debug("<{}.getDocumentStatusTypeCodesException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ DocumentStatusCodeEntity documentStatusCodeEntity = new DocumentStatusCodeEntity();
+ documentStatusCodeEntity.setDocumentStatusCode("COMPL");
+ documentStatusCodeEntity.setLabel("Completed");
+ documentStatusCodeEntity.setDescription("Student has met their program requirements");
+ when(documentStatusCodeRepository.findAll()).thenThrow(new ReportApiServiceException(String.format("Unable to retrieve %s", "List"), new Exception()));
+ gradReportCodeService.getDocumentStatusCodes();
+ LOG.debug(">getDocumentStatusTypeCodesException");
+ }
+
@Test
public void getDocumentStatusCode() throws Exception {
LOG.debug("<{}.getDocumentStatusCode at {}", CLASS_NAME, dateFormat.format(new Date()));
@@ -136,6 +250,18 @@ public void getDocumentStatusCode() throws Exception {
LOG.debug(">getDocumentStatusCode");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void getDocumentStatusCodeException() throws Exception {
+ LOG.debug("<{}.getDocumentStatusCodeException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ DocumentStatusCodeEntity documentStatusCodeEntity = new DocumentStatusCodeEntity();
+ documentStatusCodeEntity.setDocumentStatusCode("COMPL");
+ documentStatusCodeEntity.setLabel("Completed");
+ documentStatusCodeEntity.setDescription("Student has met their program requirements");
+ when(documentStatusCodeRepository.findByDocumentStatusCode(documentStatusCodeEntity.getDocumentStatusCode())).thenThrow(new ReportApiServiceException(String.format("Unable to retrieve %s", "DocumentStatusCode"), new Exception()));
+ gradReportCodeService.getDocumentStatusCode(documentStatusCodeEntity.getDocumentStatusCode());
+ LOG.debug(">getDocumentStatusCodeException");
+ }
+
@Test
public void getReportTypeTypeCodes() throws Exception {
LOG.debug("<{}.getReportTypeTypeCodes at {}", CLASS_NAME, dateFormat.format(new Date()));
@@ -149,6 +275,18 @@ public void getReportTypeTypeCodes() throws Exception {
LOG.debug(">getReportTypeCodes");
}
+ @Test(expected = ReportApiServiceException.class)
+ public void getReportTypeTypeCodesException() throws Exception {
+ LOG.debug("<{}.getReportTypeTypeCodesException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ ReportTypeCodeEntity reportTypeCodeEntity = new ReportTypeCodeEntity();
+ reportTypeCodeEntity.setReportTypeCode("GRADREG");
+ reportTypeCodeEntity.setLabel("Graduated Students (MM YY to MM YY)");
+ reportTypeCodeEntity.setDescription("A daily, cumulative list of student in the current cycle who have graduated, based on the latest information submitted by the school. Produced as part of the Batch Graduation Algorithm Run.");
+ when(reportTypeCodeRepository.findAll()).thenThrow(new ReportApiServiceException(String.format("Unable to retrieve %s", "List"), new Exception()));
+ gradReportCodeService.getReportTypeCodes();
+ LOG.debug(">getReportTypeTypeCodesException");
+ }
+
@Test
public void getReportTypeCode() throws Exception {
LOG.debug("<{}.getReportTypeCode at {}", CLASS_NAME, dateFormat.format(new Date()));
@@ -161,4 +299,16 @@ public void getReportTypeCode() throws Exception {
assertNotNull(result);
LOG.debug(">getReportTypeCode");
}
+
+ @Test(expected = ReportApiServiceException.class)
+ public void getReportTypeCodeException() throws Exception {
+ LOG.debug("<{}.getReportTypeCodeException at {}", CLASS_NAME, dateFormat.format(new Date()));
+ ReportTypeCodeEntity reportTypeCodeEntity = new ReportTypeCodeEntity();
+ reportTypeCodeEntity.setReportTypeCode("GRADREG");
+ reportTypeCodeEntity.setLabel("Graduated Students (MM YY to MM YY)");
+ reportTypeCodeEntity.setDescription("A daily, cumulative list of student in the current cycle who have graduated, based on the latest information submitted by the school. Produced as part of the Batch Graduation Algorithm Run.");
+ when(reportTypeCodeRepository.findByReportTypeCode(reportTypeCodeEntity.getReportTypeCode())).thenThrow(new ReportApiServiceException(String.format("Unable to retrieve %s", "ReportTypeCode"), new Exception()));
+ gradReportCodeService.getReportTypeCode(reportTypeCodeEntity.getReportTypeCode());
+ LOG.debug(">getReportTypeCodeException");
+ }
}
diff --git a/api/src/test/resources/json/packingSlipReportRequest.json b/api/src/test/resources/json/packingSlipReportRequest.json
index 71957e0a..c29934c9 100644
--- a/api/src/test/resources/json/packingSlipReportRequest.json
+++ b/api/src/test/resources/json/packingSlipReportRequest.json
@@ -30,12 +30,12 @@
"distno": "036",
"schlno": "03699064",
"address": {
- "streetLine1": "300-10183 152A ST",
- "streetLine2": "",
- "city": "SURREY",
- "region": "BC",
- "country": "",
- "code": "VER4H6"
+ "streetLine1": "4TH FLOOR 620 SUPERIOR",
+ "streetLine2": "PO BOX 9886 STN PROV GOVT",
+ "city": "VICTORIA",
+ "region": "BRITISH COLUMBIA",
+ "country": "CANADA",
+ "code": "V8W9T6"
}
}
}
diff --git a/api/src/test/resources/json/schoolLabelReportRequest.json b/api/src/test/resources/json/schoolLabelReportRequest.json
index 5d20d76c..e4288e12 100644
--- a/api/src/test/resources/json/schoolLabelReportRequest.json
+++ b/api/src/test/resources/json/schoolLabelReportRequest.json
@@ -7,7 +7,7 @@
"schools":[
{
"mincode": "03939008",
- "name": "LORD BYNG SECONDARY",
+ "name": "Ecole Secondaire Mark R. Isfeld Secondary",
"typeIndicator": "",
"typeBanner": "Principal",
"signatureCode": "039",
@@ -15,12 +15,12 @@
"schlno": "03939008",
"schoolCategoryCode": "",
"address": {
- "streetLine1": "3939 16TH AVENUE W",
- "streetLine2": "",
- "city": "VANCOUVER",
- "region": "BC",
- "country": "",
- "code": "V6R3C9"
+ "streetLine1": "4TH FLOOR 620 SUPERIOR",
+ "streetLine2": "PO BOX 9886 STN PROV GOVT",
+ "city": "VICTORIA",
+ "region": "BRITISH COLUMBIA",
+ "country": "CANADA",
+ "code": "V8W9T6"
}
},
{
@@ -52,12 +52,12 @@
"schlno": "03434052",
"schoolCategoryCode": null,
"address": {
- "streetLine1": "31150 BLUE RIDGE DRIVE",
- "streetLine2": "",
- "city": "ABBOTSFORD",
- "region": "BC",
- "country": "CN",
- "code": "V2T5R2"
+ "streetLine1": "4TH FLOOR 620 SUPERIOR",
+ "streetLine2": "PO BOX 9886 STN PROV GOVT",
+ "city": "VICTORIA",
+ "region": "BRITISH COLUMBIA",
+ "country": "CANADA",
+ "code": "V8W9T6"
},
"phoneNumber": "",
"dogwoodElig": "",
@@ -202,12 +202,12 @@
"schlno": "03939008",
"schoolCategoryCode": "",
"address": {
- "streetLine1": "3939 16TH AVENUE W",
- "streetLine2": "",
- "city": "VANCOUVER",
- "region": "BC",
- "country": "",
- "code": "V6R3C9"
+ "streetLine1": "4TH FLOOR 620 SUPERIOR",
+ "streetLine2": "PO BOX 9886 STN PROV GOVT",
+ "city": "VICTORIA",
+ "region": "BRITISH COLUMBIA",
+ "country": "CANADA",
+ "code": "V8W9T6"
}
},
{
@@ -499,12 +499,12 @@
"schlno": "03939000",
"schoolCategoryCode": null,
"address": {
- "streetLine1": "6010 FRASER ST",
- "streetLine2": "",
- "city": "VANCOUVER",
- "region": "BC",
- "country": "CN",
- "code": "V5W2Z7"
+ "streetLine1": "4TH FLOOR 620 SUPERIOR",
+ "streetLine2": "PO BOX 9886 STN PROV GOVT",
+ "city": "VICTORIA",
+ "region": "BRITISH COLUMBIA",
+ "country": "CANADA",
+ "code": "V8W9T6"
}
},
{