diff --git a/.gitignore b/.gitignore
index 07c41426..1ca7b04e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,4 +52,7 @@ target/
build/
### VS Code ###
-.vscode/
\ No newline at end of file
+.vscode/
+
+### Local dev ###
+**/application-local.yaml
\ No newline at end of file
diff --git a/api/.gitignore b/api/.gitignore
deleted file mode 100644
index 07c41426..00000000
--- a/api/.gitignore
+++ /dev/null
@@ -1,55 +0,0 @@
-# Compiled class file
-*.class
-
-# Log file
-*.log
-
-# BlueJ files
-*.ctxt
-
-# Mobile Tools for Java (J2ME)
-.mtj.tmp/
-
-# Package Files #
-*.jar
-*.war
-*.nar
-*.ear
-*.zip
-*.tar.gz
-*.rar
-
-# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
-hs_err_pid*
-
-HELP.md
-target/
-!.mvn/wrapper/maven-wrapper.jar
-!**/src/main/**
-!**/src/test/**
-
-### STS ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-.sts4-cache
-
-### IntelliJ IDEA ###
-.idea
-*.iws
-*.iml
-*.ipr
-
-### NetBeans ###
-/nbproject/private/
-/nbbuild/
-/dist/
-/nbdist/
-/.nb-gradle/
-build/
-
-### VS Code ###
-.vscode/
\ No newline at end of file
diff --git a/api/pom.xml b/api/pom.xml
index 97eee1f9..12af4f40 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -6,7 +6,7 @@
ca.bc.gov.educ
educ-grad-graduation-report-api
- 1.8.49
+ 1.8.50
educ-grad-graduation-report-api
Grad Graduation Report API for GRAD team
diff --git a/api/src/main/java/ca/bc/gov/educ/api/grad/report/controller/CommonController.java b/api/src/main/java/ca/bc/gov/educ/api/grad/report/controller/CommonController.java
index dd2f48c8..6e2e4ac2 100644
--- a/api/src/main/java/ca/bc/gov/educ/api/grad/report/controller/CommonController.java
+++ b/api/src/main/java/ca/bc/gov/educ/api/grad/report/controller/CommonController.java
@@ -65,7 +65,7 @@ public ResponseEntity getStudentReport(@PathVariable String reportTypeC
public ResponseEntity> saveStudentReport(@RequestBody GradStudentReports gradStudentReports,@RequestParam(value = "isGraduated", required = false, defaultValue = "false") boolean isGraduated) {
logger.debug("Save student Grad Report for Student ID: {}",gradStudentReports.getStudentID());
validation.requiredField(gradStudentReports.getStudentID(), "Student ID");
- return response.UPDATED(commonService.saveGradReports(gradStudentReports,isGraduated));
+ return response.UPDATED(commonService.saveGradStudentReports(gradStudentReports,isGraduated));
}
@GetMapping(EducGradReportApiConstants.STUDENT_REPORT)
@@ -80,6 +80,28 @@ public ResponseEntity getStudentReportByType(
return commonService.getStudentReportByType(UUID.fromString(studentID),reportType,documentStatusCode);
}
+ @DeleteMapping(EducGradReportApiConstants.STUDENT_REPORT_BY_STUDENTID)
+ @PreAuthorize(PermissionsConstants.DELETE_STUDENT_REPORT)
+ @Operation(summary = "Delete Student Reports by Student ID and Report Type", description = "Delete Student Reports by Student ID and Report Type", tags = { "Reports" })
+ @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
+ public ResponseEntity deleteStudentReportByType(
+ @RequestParam(value = "reportType") String reportType,
+ @PathVariable UUID studentID) {
+ logger.debug("deleteStudentReportByType");
+ return response.GET(commonService.deleteStudentReports(studentID, reportType));
+ }
+
+ @PostMapping(EducGradReportApiConstants.STUDENT_REPORTS)
+ @PreAuthorize(PermissionsConstants.READ_GRADUATION_STUDENT_REPORTS)
+ @Operation(summary = "Read Student Reports by Student ID and Report Type", description = "Read Student Reports by Student ID and Report Type", tags = { "Reports" })
+ @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
+ public ResponseEntity processStudentReports(
+ @RequestParam(value = "reportTypeCode") String reportTypeCode,
+ @RequestBody List studentIDs) {
+ logger.debug("processStudentReports : ");
+ return response.GET(commonService.processStudentReports(studentIDs, reportTypeCode));
+ }
+
@GetMapping(EducGradReportApiConstants.STUDENT_CERTIFICATES)
@PreAuthorize(PermissionsConstants.READ_GRADUATION_STUDENT_CERTIFICATES)
@Operation(summary = "Read Student Certificates by Student ID", description = "Read Student Certificates by Student ID", tags = { "Reports" })
@@ -374,5 +396,41 @@ public ResponseEntity getStudentCredentialByType(@PathVaria
return commonService.getStudentCredentialByType(UUID.fromString(studentID),type);
}
+ @PostMapping (EducGradReportApiConstants.REPORT_COUNT)
+ @PreAuthorize(PermissionsConstants.READ_GRADUATION_STUDENT_REPORTS)
+ @Operation(summary = "Get Reports Count by mincode and status", description = "Get Students Count by mincode and status", tags = { "Business" })
+ @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
+ public ResponseEntity getReportsCount(@RequestParam String reportType, @RequestBody List reportContainerIds) {
+ if(StringUtils.containsAnyIgnoreCase(reportType, "ACHV")) {
+ return response.GET(commonService.countByStudentGuidsAndReportType(reportContainerIds, reportType));
+ } else {
+ return response.GET(commonService.countBySchoolOfRecordsAndReportType(reportContainerIds, reportType));
+ }
+ }
+
+ @PostMapping (EducGradReportApiConstants.STUDENT_REPORTS_BY_GUIDS)
+ @PreAuthorize(PermissionsConstants.READ_GRADUATION_STUDENT_REPORTS)
+ @Operation(summary = "Get Report Students Guids by mincode and type", description = "Get Report Students Guids by mincode and type", tags = { "Business" })
+ @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
+ public ResponseEntity> getStudentIDsByIdentityAndReportType(@RequestParam String reportType, @RequestParam Integer rowCount, @RequestBody List reportContainerIds) {
+ return response.GET(commonService.getStudentIDsByStudentGuidsAndReportType(reportContainerIds, reportType, rowCount));
+ }
+
+ @PostMapping (EducGradReportApiConstants.REPORT_ARCHIVE)
+ @PreAuthorize(PermissionsConstants.ARCHIVE_SCHOOL_REPORT)
+ @Operation(summary = "Archive Reports", description = "Archive Reports", tags = { "Business" })
+ @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
+ public ResponseEntity archiveReports(@RequestParam long batchId, @RequestParam String reportType, @RequestBody List schoolOfRecords) {
+ logger.debug("Archive Reports for batch {}", batchId);
+ return response.GET(commonService.archiveSchoolReports(batchId, schoolOfRecords, reportType));
+ }
+ @PostMapping (EducGradReportApiConstants.REPORT_DELETE)
+ @PreAuthorize(PermissionsConstants.DELETE_STUDENT_REPORT)
+ @Operation(summary = "Delete Reports", description = "Delete Reports", tags = { "Business" })
+ @ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
+ public ResponseEntity deleteReports(@RequestParam long batchId, @RequestParam String reportType, @RequestBody List studentGuids) {
+ logger.debug("Delete Reports for batch {}", batchId);
+ return response.GET(commonService.deleteStudentReports(studentGuids, reportType));
+ }
}
diff --git a/api/src/main/java/ca/bc/gov/educ/api/grad/report/model/dto/Address.java b/api/src/main/java/ca/bc/gov/educ/api/grad/report/model/dto/Address.java
new file mode 100644
index 00000000..95050202
--- /dev/null
+++ b/api/src/main/java/ca/bc/gov/educ/api/grad/report/model/dto/Address.java
@@ -0,0 +1,72 @@
+package ca.bc.gov.educ.api.grad.report.model.dto;
+
+import java.io.Serializable;
+
+public class Address implements Serializable {
+
+ private static final long serialVersionUID = 2L;
+
+ private String streetLine1;
+ private String streetLine2;
+ private String streetLine3;
+ private String city;
+ private String region;
+ private String country;
+ private String code;
+
+ public String getStreetLine1() {
+ return streetLine1;
+ }
+
+ public void setStreetLine1(String value) {
+ this.streetLine1 = value;
+ }
+
+ public String getStreetLine2() {
+ return streetLine2;
+ }
+
+ public void setStreetLine2(String value) {
+ this.streetLine2 = value;
+ }
+
+ public String getStreetLine3() {
+ return streetLine3;
+ }
+
+ public void setStreetLine3(String streetLine3) {
+ this.streetLine3 = streetLine3;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String value) {
+ this.city = value;
+ }
+
+ public String getRegion() {
+ return region;
+ }
+
+ public void setRegion(String value) {
+ this.region = value;
+ }
+
+ public String getCountry() {
+ return country;
+ }
+
+ public void setCountry(String value) {
+ this.country = value;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String value) {
+ this.code = value;
+ }
+}
diff --git a/api/src/main/java/ca/bc/gov/educ/api/grad/report/model/dto/StudentSearchRequest.java b/api/src/main/java/ca/bc/gov/educ/api/grad/report/model/dto/StudentSearchRequest.java
index 2ba36785..2cebfa83 100644
--- a/api/src/main/java/ca/bc/gov/educ/api/grad/report/model/dto/StudentSearchRequest.java
+++ b/api/src/main/java/ca/bc/gov/educ/api/grad/report/model/dto/StudentSearchRequest.java
@@ -10,6 +10,7 @@
import java.io.Serializable;
import java.time.LocalDate;
+import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@@ -19,12 +20,17 @@
@AllArgsConstructor
@Builder
public class StudentSearchRequest implements Serializable {
- private List schoolOfRecords;
- private List districts;
- private List schoolCategoryCodes;
- private List pens;
- private List programs;
- private List studentIDs;
+ private List schoolOfRecords = new ArrayList<>();
+ private List districts = new ArrayList<>();
+ private List schoolCategoryCodes = new ArrayList<>();
+ private List pens = new ArrayList<>();
+ private List programs = new ArrayList<>();
+ private List studentIDs = new ArrayList<>();
+ private List statuses = new ArrayList<>();
+ private List reportTypes = new ArrayList();
+
+ private String user;
+ private Address address;
@JsonFormat(pattern= EducGradReportApiConstants.DEFAULT_DATE_FORMAT)
LocalDate gradDateFrom;
@@ -33,5 +39,15 @@ public class StudentSearchRequest implements Serializable {
Boolean validateInput;
String activityCode;
+ String localDownload;
+
+ public boolean isEmpty() {
+ return schoolOfRecords.isEmpty() &&
+ districts.isEmpty() &&
+ schoolCategoryCodes.isEmpty() &&
+ pens.isEmpty() &&
+ studentIDs.isEmpty() &&
+ programs.isEmpty();
+ }
}
diff --git a/api/src/main/java/ca/bc/gov/educ/api/grad/report/repository/GradStudentReportsRepository.java b/api/src/main/java/ca/bc/gov/educ/api/grad/report/repository/GradStudentReportsRepository.java
index 7a5e1402..08ebad8f 100644
--- a/api/src/main/java/ca/bc/gov/educ/api/grad/report/repository/GradStudentReportsRepository.java
+++ b/api/src/main/java/ca/bc/gov/educ/api/grad/report/repository/GradStudentReportsRepository.java
@@ -2,7 +2,10 @@
import ca.bc.gov.educ.api.grad.report.model.dto.SchoolStudentCredentialDistribution;
import ca.bc.gov.educ.api.grad.report.model.entity.GradStudentReportsEntity;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
@@ -17,8 +20,18 @@ public interface GradStudentReportsRepository extends JpaRepository existsByReportTypeCode(String reportType);
-
- long deleteByStudentID(UUID studentID);
+
+ @Modifying
+ @Query(value="DELETE from STUDENT_REPORT where GRADUATION_STUDENT_RECORD_ID in (:studentIDs) and REPORT_TYPE_CODE = :gradReportTypeCode", nativeQuery = true)
+ Integer deleteByStudentIDInAndGradReportTypeCode(List studentIDs, String gradReportTypeCode);
+
+ @Modifying
+ @Query(value="DELETE from STUDENT_REPORT where REPORT_TYPE_CODE = :gradReportTypeCode", nativeQuery = true)
+ Integer deleteByGradReportTypeCode(String gradReportTypeCode);
+
+ @Modifying
+ @Query(value="DELETE from STUDENT_REPORT where GRADUATION_STUDENT_RECORD_ID = :studentID and REPORT_TYPE_CODE = :gradReportTypeCode", nativeQuery = true)
+ Integer deleteByStudentIDAndGradReportTypeCode(UUID studentID, String gradReportTypeCode);
List findByStudentID(UUID studentID);
@@ -30,4 +43,16 @@ public interface GradStudentReportsRepository extends JpaRepository findByReportUpdateDate();
+
+ @Query("select count(*) from GradStudentReportsEntity c where c.studentID IN (:studentGuids) and c.gradReportTypeCode=:reportType")
+ Integer countByStudentGuidsAndReportType(List studentGuids, String reportType);
+
+ @Query("select c.studentID from GradStudentReportsEntity c where c.studentID IN (:studentGuids) and c.gradReportTypeCode=:reportType")
+ Page getReportStudentIDsByStudentIDsAndReportType(List studentGuids, String reportType, Pageable page);
+
+ @Query("select count(*) from GradStudentReportsEntity c where c.gradReportTypeCode=:reportType")
+ Integer countByReportType(String reportType);
+
+ @Query("select c.studentID from GradStudentReportsEntity c where c.gradReportTypeCode=:reportType")
+ Page findStudentIDByGradReportTypeCode(String reportType, Pageable page);
}
diff --git a/api/src/main/java/ca/bc/gov/educ/api/grad/report/repository/SchoolReportsRepository.java b/api/src/main/java/ca/bc/gov/educ/api/grad/report/repository/SchoolReportsRepository.java
index 886cc975..ea20c0ea 100644
--- a/api/src/main/java/ca/bc/gov/educ/api/grad/report/repository/SchoolReportsRepository.java
+++ b/api/src/main/java/ca/bc/gov/educ/api/grad/report/repository/SchoolReportsRepository.java
@@ -2,6 +2,7 @@
import ca.bc.gov.educ.api.grad.report.model.entity.SchoolReportsEntity;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
@@ -23,4 +24,35 @@ public interface SchoolReportsRepository extends JpaRepository findBySchoolOfRecordAndReportTypeCodeOrderBySchoolOfRecord(String schoolOfRecord, String reportTypeCode);
+ @Query("select count(*) from SchoolReportsLightEntity c where c.schoolOfRecord IN (:schoolOfRecords) and c.reportTypeCode=:reportType")
+ Integer countBySchoolOfRecordsAndReportType(List schoolOfRecords, String reportType);
+
+ @Query("select count(*) from SchoolReportsLightEntity c where c.reportTypeCode=:reportType")
+ Integer countByReportType(String reportType);
+
+ @Query("select c.id from SchoolReportsLightEntity c where c.schoolOfRecord IN (:schoolOfRecords) and c.reportTypeCode=:reportType")
+ List getReportGuidsBySchoolOfRecordsAndReportType(List schoolOfRecords, String reportType);
+
+ @Query("select c.id from SchoolReportsLightEntity c where c.reportTypeCode=:reportType")
+ List getReportGuidsByReportType(String reportType);
+
+ @Query("select c.schoolOfRecord from SchoolReportsLightEntity c where c.reportTypeCode=:reportType")
+ List getReportSchoolOfRecordsByReportType(String reportType);
+
+ @Modifying
+ @Query(value="update SCHOOL_REPORT set REPORT_TYPE_CODE = :reportTypeTo, update_date = SYSDATE, update_user = 'Batch ' || :batchId || ' Archive Process' where school_of_record in (:schoolOfRecords) and REPORT_TYPE_CODE = :reportTypeFrom", nativeQuery=true)
+ Integer archiveSchoolReports(List schoolOfRecords, String reportTypeFrom, String reportTypeTo, long batchId);
+
+ @Modifying
+ @Query(value="update SCHOOL_REPORT set REPORT_TYPE_CODE = :reportTypeTo, update_date = SYSDATE, update_user = 'Batch ' || :batchId || ' Archive Process' where REPORT_TYPE_CODE = :reportTypeFrom", nativeQuery=true)
+ Integer archiveSchoolReports(String reportTypeFrom, String reportTypeTo, long batchId);
+
+ @Modifying
+ @Query(value="delete from SCHOOL_REPORT where SCHOOL_REPORT_ID not in (:schoolReportGuids) and school_of_record in (:schoolOfRecords) and REPORT_TYPE_CODE = :archivedReportType", nativeQuery=true)
+ Integer deleteSchoolOfRecordsNotMatchingSchoolReports(List schoolReportGuids, List schoolOfRecords, String archivedReportType);
+
+ @Modifying
+ @Query(value="delete from SCHOOL_REPORT where SCHOOL_REPORT_ID not in (:schoolReportGuids) and REPORT_TYPE_CODE = :archivedReportType", nativeQuery=true)
+ Integer deleteAllNotMatchingSchoolReports(List schoolReportGuids, String archivedReportType);
+
}
diff --git a/api/src/main/java/ca/bc/gov/educ/api/grad/report/service/CommonService.java b/api/src/main/java/ca/bc/gov/educ/api/grad/report/service/CommonService.java
index 1064aaca..abbc76ac 100644
--- a/api/src/main/java/ca/bc/gov/educ/api/grad/report/service/CommonService.java
+++ b/api/src/main/java/ca/bc/gov/educ/api/grad/report/service/CommonService.java
@@ -20,6 +20,7 @@
import org.springframework.core.io.InputStreamResource;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -88,7 +89,7 @@ public class CommonService extends BaseService {
private static final List SCCP_CERT_TYPES = Arrays.asList("SC", "SCF", "SCI");
@Transactional
- public GradStudentReports saveGradReports(GradStudentReports gradStudentReports, boolean isGraduated) {
+ public GradStudentReports saveGradStudentReports(GradStudentReports gradStudentReports, boolean isGraduated) {
GradStudentReportsEntity toBeSaved = gradStudentReportsTransformer.transformToEntity(gradStudentReports);
Optional existingEntity = gradStudentReportsRepository.findByStudentIDAndGradReportTypeCodeAndDocumentStatusCodeNot(gradStudentReports.getStudentID(), gradStudentReports.getGradReportTypeCode(), "ARCH");
if (existingEntity.isPresent()) {
@@ -319,6 +320,37 @@ public int deleteAllStudentAchievement(UUID studentID) {
}
+ @Transactional
+ public long processStudentReports(List studentIDs, String reportType) {
+ long reportsCount = 0L;
+ for(UUID uuid: studentIDs) {
+ Optional existingEntity = gradStudentReportsRepository.findByStudentIDAndGradReportTypeCode(uuid, reportType);
+ if(existingEntity.isPresent()) {
+ GradStudentReportsEntity reportsEntity = existingEntity.get();
+ reportsEntity.setReportUpdateDate(new Date());
+ gradStudentReportsRepository.save(reportsEntity);
+ reportsCount ++;
+ }
+ }
+ return reportsCount;
+ }
+
+ @Transactional
+ public Integer deleteStudentReports(List studentIDs, String reportType) {
+ Integer result;
+ if(studentIDs != null && !studentIDs.isEmpty()) {
+ result = gradStudentReportsRepository.deleteByStudentIDInAndGradReportTypeCode(studentIDs, StringUtils.upperCase(reportType));
+ } else {
+ result = gradStudentReportsRepository.deleteByGradReportTypeCode(StringUtils.upperCase(reportType));
+ }
+ return result;
+ }
+
+ @Transactional
+ public Integer deleteStudentReports(UUID studentID, String reportType) {
+ return gradStudentReportsRepository.deleteByStudentIDAndGradReportTypeCode(studentID, StringUtils.upperCase(reportType));
+ }
+
public List getAllStudentReportList(UUID studentID) {
List reportList = gradStudentReportsTransformer.transformToDTO(gradStudentReportsRepository.findByStudentID(studentID));
reportList.forEach(rep -> {
@@ -815,6 +847,73 @@ private synchronized List getReportGradStudentData(String
.block();
}
+ public Integer countBySchoolOfRecordsAndReportType(List schoolOfRecords, String reportType) {
+ Integer reportsCount = 0;
+ if(schoolOfRecords != null && !schoolOfRecords.isEmpty()) {
+ reportsCount += schoolReportsRepository.countBySchoolOfRecordsAndReportType(schoolOfRecords, reportType);
+ } else {
+ reportsCount += schoolReportsRepository.countByReportType(reportType);
+ }
+ return reportsCount;
+ }
+
+ public Integer countByStudentGuidsAndReportType(List studentGuidsString, String reportType) {
+ Integer reportsCount = 0;
+ if(studentGuidsString != null && !studentGuidsString.isEmpty()) {
+ List studentGuids = new ArrayList<>();
+ for(String guid: studentGuidsString) {
+ studentGuids.add(UUID.fromString(guid));
+ }
+ reportsCount += gradStudentReportsRepository.countByStudentGuidsAndReportType(studentGuids, reportType);
+ } else {
+ reportsCount += gradStudentReportsRepository.countByReportType(reportType);
+ }
+ return reportsCount;
+ }
+
+ public List getStudentIDsByStudentGuidsAndReportType(List studentGuidsString, String reportType, Integer rowCount) {
+ List result = new ArrayList<>();
+ rowCount = (rowCount) == 0 ? Integer.MAX_VALUE : rowCount;
+ Pageable paging = PageRequest.of(0, rowCount);
+ if(studentGuidsString != null && !studentGuidsString.isEmpty()) {
+ List studentGuids = new ArrayList<>();
+ for(String guid: studentGuidsString) {
+ studentGuids.add(UUID.fromString(guid));
+ }
+ result.addAll(gradStudentReportsRepository.getReportStudentIDsByStudentIDsAndReportType(studentGuids, reportType, paging).getContent());
+ } else {
+ result.addAll(gradStudentReportsRepository.findStudentIDByGradReportTypeCode(reportType, paging).getContent());
+ }
+ return result;
+ }
+
+ @Transactional
+ public Integer archiveSchoolReports(long batchId, List schoolOfRecords, String reportType) {
+ if(schoolOfRecords != null && !schoolOfRecords.isEmpty()) {
+ return archiveSchoolReportsBySchoolOfRecordAndReportType(batchId, schoolOfRecords, reportType);
+ } else {
+ schoolOfRecords = schoolReportsRepository.getReportSchoolOfRecordsByReportType(reportType);
+ return archiveSchoolReportsBySchoolOfRecordAndReportType(batchId, schoolOfRecords, reportType);
+ }
+ }
+
+ private Integer archiveSchoolReportsBySchoolOfRecordAndReportType(long batchId, List schoolOfRecords, String reportType) {
+ Integer updatedReportsCount = 0;
+ Integer deletedReportsCount = 0;
+ Integer originalReportsCount = 0;
+ String archivedReportType = StringUtils.appendIfMissing(reportType, "ARC", "ARC");
+ if(schoolOfRecords != null && !schoolOfRecords.isEmpty()) {
+ List reportGuids = schoolReportsRepository.getReportGuidsBySchoolOfRecordsAndReportType(schoolOfRecords, reportType);
+ originalReportsCount += schoolReportsRepository.countBySchoolOfRecordsAndReportType(schoolOfRecords, reportType);
+ updatedReportsCount += schoolReportsRepository.archiveSchoolReports(schoolOfRecords, reportType, archivedReportType, batchId);
+ if(updatedReportsCount > 0 && originalReportsCount.equals(updatedReportsCount)) {
+ deletedReportsCount += schoolReportsRepository.deleteSchoolOfRecordsNotMatchingSchoolReports(reportGuids, schoolOfRecords, archivedReportType);
+ logger.debug("{} School Reports deleted", deletedReportsCount);
+ }
+ }
+ return updatedReportsCount;
+ }
+
class UUIDPageTask implements Callable