Pull request #109: RED-2590: Do not delete text on exclude from redaction to reindex after undelete, fixed reanalyse after include for redaction

Merge in RED/persistence-service from RED-2590 to master

* commit 'ac760c6718f80d2da61cce538c67ee38a93df812':
  RED-2590: Do not delete text on exclude from redaction to reindex after undelete, fixed reanalyse after include for redaction
This commit is contained in:
Dominique Eiflaender 2021-11-09 13:29:54 +01:00
commit 29bc3dcad4
3 changed files with 26 additions and 2 deletions

View File

@ -108,7 +108,7 @@ public interface FileRepository extends JpaRepository<FileEntity, String> {
int setCurrentReviewer(String fileId, String currentReviewer, String lastReviewer, OffsetDateTime lastUpdated,
WorkflowStatus workflowStatus);
@Modifying
@Modifying(clearAutomatically = true)
@Query("update FileEntity f set f.excluded = :excluded, f.lastUpdated = :lastUpdated where f.id = :fileId")
int toggleExclusion(String fileId, boolean excluded, OffsetDateTime lastUpdated);

View File

@ -296,7 +296,6 @@ public class FileStatusService {
OffsetDateTime now = OffsetDateTime.now();
// remove everything related to redaction
fileManagementStorageService.deleteObject(dossierId, fileId, FileType.REDACTION_LOG);
fileManagementStorageService.deleteObject(dossierId, fileId, FileType.TEXT);
fileManagementStorageService.deleteObject(dossierId, fileId, FileType.SECTION_GRID);
// wipe comments

View File

@ -127,4 +127,29 @@ public class FileProcessingTest extends AbstractPersistenceServerServiceTest {
}
@Test
public void testFileReanlyseAfterToggleExclusion(){
var dossier = dossierTesterAndProvider.provideTestDossier();
var file = fileTesterAndProvider.testAndProvideFile(dossier);
fileProcessingClient.analysisSuccessful(dossier.getId(), file.getId(), AnalyzeResult.builder()
.analysisVersion(100)
.fileId(file.getId())
.dossierId(dossier.getId())
.build());
var loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
assertThat(loadedFile.getProcessingStatus()).isEqualTo(ProcessingStatus.PROCESSED);
fileClient.toggleExclusion(file.getDossierId(), file.getId(), true);
fileClient.toggleExclusion(file.getDossierId(), file.getId(), false);
loadedFile = fileClient.getFileStatus(dossier.getId(), file.getId());
assertThat(loadedFile.getProcessingStatus()).isEqualTo(ProcessingStatus.PROCESSING);
}
}