RED-1098: Added files generated by pdftron to the list of files that are deleted when the download archive has been created

This commit is contained in:
Viktor Seifert 2022-07-01 15:31:06 +02:00
parent 42ff8978f8
commit afc8371636
2 changed files with 12 additions and 6 deletions

View File

@ -130,7 +130,14 @@ public class DownloadPreparationService {
.build());
}
downloadReportCleanupService.deleteTmpReportFiles(downloadStatus.getGeneratedReportsInformation());
downloadReportCleanupService.deleteTmpReportFiles(downloadStatus.getGeneratedReportsInformation()
.stream()
.map(StoredFileInformation::getStorageId)
.collect(Collectors.toSet()));
downloadReportCleanupService.deleteTmpReportFiles(reportResultMessage.getRedactionResultDetails()
.stream()
.map(RedactionResultDetail::getStorageId)
.collect(Collectors.toSet()));
}

View File

@ -6,7 +6,6 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import com.iqser.red.service.peristence.v1.server.service.FileManagementStorageService;
import com.iqser.red.service.redaction.report.v1.api.model.StoredFileInformation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -19,11 +18,11 @@ public class DownloadReportCleanupService {
private final FileManagementStorageService fileManagementStorageService;
@Async
public void deleteTmpReportFiles(Collection<StoredFileInformation> fileInformationList) {
public void deleteTmpReportFiles(Collection<String> storageIds) {
for (StoredFileInformation storedFileInformation : fileInformationList) {
fileManagementStorageService.deleteObject(storedFileInformation.getStorageId());
log.info("Deleted tmp report file {}", storedFileInformation.getStorageId());
for (String storageId : storageIds) {
fileManagementStorageService.deleteObject(storageId);
log.info("Deleted tmp report file {}", storageId);
}
}
}