RED-3705 cleanup of deleted status

This commit is contained in:
Timo Bejan 2022-05-10 08:53:50 +03:00
parent b47c908dc9
commit 8688a6358a
4 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,6 @@
package com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier.file;
public enum ProcessingStatus {
ANALYSE, DELETED, ERROR, FULLREPROCESS, IMAGE_ANALYZING, INDEXING, NER_ANALYZING, OCR_PROCESSING, PROCESSED, PROCESSING, REPROCESS, SURROUNDING_TEXT_PROCESSING, UNPROCESSED, FULL_PROCESSING
ANALYSE, ERROR, FULLREPROCESS, IMAGE_ANALYZING, INDEXING, NER_ANALYZING, OCR_PROCESSING, PROCESSED, PROCESSING, REPROCESS, SURROUNDING_TEXT_PROCESSING, UNPROCESSED, FULL_PROCESSING
}

View File

@ -220,7 +220,7 @@ public class FileStatusPersistenceService {
var now = OffsetDateTime.now().truncatedTo(ChronoUnit.MILLIS);
int countUpdate = fileRepository.setHardDelete(fileId, ProcessingStatus.DELETED, now, now, now);
int countUpdate = fileRepository.setHardDelete(fileId, ProcessingStatus.PROCESSED, now, now, now);
if (countUpdate == 0) {
throw new NotFoundException("Unknown file=" + fileId);
}
@ -231,7 +231,7 @@ public class FileStatusPersistenceService {
@Transactional
public void softDelete(String fileId, OffsetDateTime softDeletedTime) {
int countUpdate = fileRepository.setSoftDelete(fileId, ProcessingStatus.DELETED, OffsetDateTime.now()
int countUpdate = fileRepository.setSoftDelete(fileId, ProcessingStatus.PROCESSED, OffsetDateTime.now()
.truncatedTo(ChronoUnit.MILLIS), softDeletedTime);
if (countUpdate == 0) {
throw new NotFoundException("Unknown file=" + fileId);

View File

@ -150,7 +150,7 @@ public interface FileRepository extends JpaRepository<FileEntity, String> {
void setLastManualChangeDate(String fileId, OffsetDateTime lastManualChangeDate, OffsetDateTime lastUpdated);
@Query("select f from FileEntity f join DossierEntity d on d.id = f.dossierId where f.workflowStatus <> 'APPROVED' and f.excludedFromAutomaticAnalysis = false " +
"and ( f.processingStatus = 'PROCESSED' or f.processingStatus = 'UNPROCESSED' or f.processingStatus = 'DELETED' or f.processingStatus = 'ERROR' )" +
"and ( f.processingStatus = 'PROCESSED' or f.processingStatus = 'UNPROCESSED' or f.processingStatus = 'ERROR' )" +
"and d.softDeletedTime is null and d.hardDeletedTime is null and d.archivedTime is null ")
List<FileEntity> getAllRelevantStatusesForReanalysisScheduler();

View File

@ -1 +1 @@
update file set deleted = CURRENT_TIMESTAMP where deleted is null and hard_deleted_time is null and processing_status = 'DELETED';
update file set deleted = CURRENT_TIMESTAMP, processing_status = 'PROCESSED' where deleted is null and hard_deleted_time is null and processing_status = 'DELETED';