RED-3705-Remove DELETED status for dossiers and files and use deleted timestamps instead
- remove dependency of ProcessingStatus.DELETED
This commit is contained in:
parent
eb438dc234
commit
d035e2ecb7
@ -69,6 +69,6 @@ public class FileModel {
|
||||
}
|
||||
|
||||
public boolean isSoftOrHardDeleted() {
|
||||
return deleted != null || hardDeletedTime != null || ProcessingStatus.DELETED.equals(processingStatus);
|
||||
return deleted != null || hardDeletedTime != null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ public class FileEntity {
|
||||
}
|
||||
|
||||
public boolean isSoftOrHardDeleted() {
|
||||
return deleted != null || hardDeletedTime != null || ProcessingStatus.DELETED.equals(processingStatus);
|
||||
return deleted != null || hardDeletedTime != null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ public class FileAttributesController implements FileAttributesResource {
|
||||
|
||||
Map<String, FileModel> fileStatusByFilename = fileStatusService.getDossierStatus(dossierId)
|
||||
.stream()
|
||||
.filter(f -> !f.getProcessingStatus().equals(ProcessingStatus.DELETED))
|
||||
.filter(f -> !f.isSoftOrHardDeleted())
|
||||
.collect(Collectors.toMap(FileModel::getFilename, Function.identity()));
|
||||
|
||||
List<List<String>> rows = getCsvRecords(importCsvRequest.getCsvFile(), generalConfiguration.getDelimiter());
|
||||
|
||||
@ -44,14 +44,14 @@ public class FileStatusController implements StatusResource {
|
||||
public List<FileModel> getDossierStatus(@PathVariable(DOSSIER_ID_PARAM) String dossierId) {
|
||||
|
||||
return fileStatusService.getDossierStatus(dossierId).stream()
|
||||
.filter(f -> !f.getProcessingStatus().equals(ProcessingStatus.DELETED))
|
||||
.filter(f -> !f.isSoftOrHardDeleted())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FileModel> getSoftDeletedDossierStatus(@PathVariable(DOSSIER_ID_PARAM) String dossierId) {
|
||||
return fileStatusService.getDossierStatus(dossierId).stream()
|
||||
.filter(f3 -> f3.getProcessingStatus().equals(ProcessingStatus.DELETED) && f3.getHardDeletedTime() == null)
|
||||
.filter(f3 -> f3.getDeleted() != null && f3.getHardDeletedTime() == null)
|
||||
.sorted((f11, f21) -> f21.getDeleted().compareTo(f11.getDeleted())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@ -101,7 +101,7 @@ public class ReanalysisController implements ReanalysisResource {
|
||||
fileStatusService.setStatusOcrProcessing(dossierId, fileId);
|
||||
} else {
|
||||
FileModel dossierFile = fileStatusService.getStatus(fileId);
|
||||
if (dossierFile.getProcessingStatus().equals(ProcessingStatus.DELETED) || dossierFile.getWorkflowStatus()
|
||||
if (dossierFile.isSoftOrHardDeleted() || dossierFile.getWorkflowStatus()
|
||||
.equals(WorkflowStatus.APPROVED)) {
|
||||
throw new ConflictException("Cannot analyse a deleted/approved file");
|
||||
}
|
||||
@ -173,7 +173,7 @@ public class ReanalysisController implements ReanalysisResource {
|
||||
if (filterOnlyValidFiles) {
|
||||
return fileStatusService.getDossierStatus(dossier.getId())
|
||||
.stream()
|
||||
.filter(fileStatus -> !fileStatus.getProcessingStatus().equals(ProcessingStatus.DELETED))
|
||||
.filter(fileStatus -> !fileStatus.isSoftOrHardDeleted())
|
||||
.filter(fileStatus -> !fileStatus.getWorkflowStatus().equals(WorkflowStatus.APPROVED))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
|
||||
@ -54,7 +54,7 @@ public class IndexingService {
|
||||
for (Pair<String, String> reindexDossierId : reindexDossierIds) {
|
||||
List<FileEntity> fileStatuses = fileStatusPersistenceService.getStatusesForDossier(reindexDossierId.getRight());
|
||||
for (FileEntity fileStatus : fileStatuses) {
|
||||
if (fileStatus.getProcessingStatus().equals(ProcessingStatus.DELETED)) {
|
||||
if (fileStatus.isSoftOrHardDeleted()) {
|
||||
continue;
|
||||
}
|
||||
if (fileIds != null && !fileIds.isEmpty() && !fileIds.contains(fileStatus.getId())) {
|
||||
|
||||
@ -114,24 +114,28 @@ public class FileProcessingTest extends AbstractPersistenceServerServiceTest {
|
||||
// Delete file
|
||||
uploadClient.deleteFile(dossier.getId(), file.getId());
|
||||
loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
|
||||
assertThat(loadedFile.getProcessingStatus()).isEqualTo(ProcessingStatus.DELETED);
|
||||
// assertThat(loadedFile.getProcessingStatus()).isEqualTo(ProcessingStatus.DELETED);
|
||||
assertThat(loadedFile.getDeleted()).isNotNull();
|
||||
|
||||
fileProcessingClient.ocrSuccessful(dossier.getId(), file.getId());
|
||||
loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
|
||||
assertThat(loadedFile.getProcessingStatus()).isEqualTo(ProcessingStatus.DELETED);
|
||||
// assertThat(loadedFile.getProcessingStatus()).isEqualTo(ProcessingStatus.DELETED);
|
||||
assertThat(loadedFile.getDeleted()).isNotNull();
|
||||
|
||||
fileProcessingClient.indexing(dossier.getId(), file.getId());
|
||||
loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
|
||||
assertThat(loadedFile.getProcessingStatus()).isEqualTo(ProcessingStatus.DELETED);
|
||||
// assertThat(loadedFile.getProcessingStatus()).isEqualTo(ProcessingStatus.DELETED);
|
||||
assertThat(loadedFile.getDeleted()).isNotNull();
|
||||
|
||||
fileProcessingClient.indexingFailed(dossier.getId(), file.getId());
|
||||
loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
|
||||
assertThat(loadedFile.getProcessingStatus()).isEqualTo(ProcessingStatus.DELETED);
|
||||
// assertThat(loadedFile.getProcessingStatus()).isEqualTo(ProcessingStatus.DELETED);
|
||||
assertThat(loadedFile.getDeleted()).isNotNull();
|
||||
|
||||
fileProcessingClient.indexingSuccessful(dossier.getId(), file.getId());
|
||||
loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
|
||||
assertThat(loadedFile.getProcessingStatus()).isEqualTo(ProcessingStatus.DELETED);
|
||||
// assertThat(loadedFile.getProcessingStatus()).isEqualTo(ProcessingStatus.DELETED);
|
||||
assertThat(loadedFile.getDeleted()).isNotNull();
|
||||
|
||||
}
|
||||
|
||||
@ -182,7 +186,6 @@ public class FileProcessingTest extends AbstractPersistenceServerServiceTest {
|
||||
// Delete file
|
||||
uploadClient.deleteFile(dossier.getId(), file.getId());
|
||||
loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
|
||||
assertThat(loadedFile.getProcessingStatus()).isEqualTo(ProcessingStatus.DELETED);
|
||||
assertThat(loadedFile.getDeleted()).isNotNull();
|
||||
|
||||
var fileList = fileClient.getSoftDeletedForDossierList(List.of(dossier.getId()));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user