RED-5892: Consolidated attribute changes and state changes.

Moved the change to the full-reprocess-status after a exclusion or auto-analysis flag toggle into the FileStatusService, so that the changes can be run in a transaction, which will prevent other threads from seeing incomplete changes.
This commit is contained in:
Viktor Seifert 2023-01-10 17:49:45 +01:00
parent 5e7bd282cf
commit af9f68d498
2 changed files with 14 additions and 17 deletions

View File

@ -23,26 +23,13 @@ public class ExcludeFromAnalysisService {
}
// toggle status
fileStatusService.toggleExclusion(fileId, excluded);
if (!excluded) {
// if file has been re-enabled - process it
fileStatusService.setStatusFullReprocess(dossierId, fileId, false, true);
}
fileStatusService.toggleExclusion(dossierId, fileId, excluded);
}
public void toggleAutomaticAnalysis(String dossierId, String fileId, boolean excludedFromAutomaticAnalysis) {
// toggle status
fileStatusService.toggleAutomaticAnalysis(fileId, excludedFromAutomaticAnalysis);
if (!excludedFromAutomaticAnalysis) {
// if file has been re-enabled - process it
fileStatusService.setStatusFullReprocess(dossierId, fileId, false, true);
}
fileStatusService.toggleAutomaticAnalysis(dossierId, fileId, excludedFromAutomaticAnalysis);
}
}

View File

@ -350,15 +350,25 @@ public class FileStatusService {
}
public void toggleExclusion(String fileId, boolean excluded) {
@Transactional
public void toggleExclusion(String dossierId, String fileId, boolean excluded) {
fileStatusPersistenceService.toggleExclusion(fileId, excluded);
if (!excluded) {
setStatusFullReprocess(dossierId, fileId, false, true);
}
}
public void toggleAutomaticAnalysis(String fileId, boolean excludedFromAutomaticAnalysis) {
@Transactional
public void toggleAutomaticAnalysis(String dossierId, String fileId, boolean excludedFromAutomaticAnalysis) {
fileStatusPersistenceService.toggleAutomaticAnalysis(fileId, excludedFromAutomaticAnalysis);
if (!excludedFromAutomaticAnalysis) {
setStatusFullReprocess(dossierId, fileId, false, true);
}
}