Pull request #585: RED-5892
Merge in RED/persistence-service from RED-5892 to master * commit 'af9f68d498a18f6a5069b9674016db347f2a6189': RED-5892: Consolidated attribute changes and state changes. RED-5892: Removed unused method params RED-5892: Corrected next processing step calculation.
This commit is contained in:
commit
40d30c2a87
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -577,11 +587,6 @@ public class FileStatusService {
|
||||
return;
|
||||
}
|
||||
|
||||
var fileModel = convert(fileEntity, FileModel.class, new FileModelMapper());
|
||||
reanalysisRequiredStatusService.enhanceFileStatusWithAnalysisRequirements(fileModel, true);
|
||||
|
||||
boolean reanalyse = fileModel.isReanalysisRequired() || manualRedactionReanalyse;
|
||||
|
||||
if (settings.isFigureDetectionEnabled() && !fileManagementStorageService.objectExists(dossierId, fileId, FileType.FIGURE)) {
|
||||
log.debug("Add file: {} from dossier {} to Figure Detection queue", fileId, dossierId);
|
||||
addToFigureDetectionRequestQueue(dossierId, fileId);
|
||||
@ -600,20 +605,32 @@ public class FileStatusService {
|
||||
return;
|
||||
}
|
||||
|
||||
var fileModel = convert(fileEntity, FileModel.class, new FileModelMapper());
|
||||
reanalysisRequiredStatusService.enhanceFileStatusWithAnalysisRequirements(fileModel, true);
|
||||
|
||||
if (settings.isOcrByDefault() && fileModel.getOcrEndTime() == null) {
|
||||
log.debug("Add file: {} from dossier {} to OCR queue", fileId, dossierId);
|
||||
setStatusOcrQueued(dossierId, fileId);
|
||||
return;
|
||||
}
|
||||
|
||||
MessageType messageType = calculateMessageType(dossierId, fileId, reanalyse, fileModel.getProcessingStatus(), fileModel);
|
||||
MessageType messageType = null;
|
||||
|
||||
if (MessageType.ANALYSE.equals(messageType) && settings.isNerServiceEnabled() && !fileManagementStorageService.objectExists(dossierId, fileId, FileType.NER_ENTITIES)) {
|
||||
if (!fileManagementStorageService.objectExists(dossierId, fileId, FileType.TEXT)) {
|
||||
messageType = MessageType.STRUCTURE_ANALYSE;
|
||||
}
|
||||
|
||||
if (messageType == null && settings.isNerServiceEnabled() && !fileManagementStorageService.objectExists(dossierId, fileId, FileType.NER_ENTITIES)) {
|
||||
log.debug("Add file: {} from dossier {} to NER queue", fileId, dossierId);
|
||||
addToNerQueue(dossierId, fileId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (messageType == null) {
|
||||
boolean reanalyse = fileModel.isReanalysisRequired() || manualRedactionReanalyse;
|
||||
messageType = calculateMessageType(reanalyse, fileModel.getProcessingStatus(), fileModel);
|
||||
}
|
||||
|
||||
var analyseRequest = AnalyzeRequest.builder()
|
||||
.messageType(messageType)
|
||||
.dossierId(dossierId)
|
||||
@ -668,20 +685,20 @@ public class FileStatusService {
|
||||
}
|
||||
|
||||
|
||||
private MessageType calculateMessageType(String dossierId, String fileId, boolean reanalyse, ProcessingStatus processingStatus, FileModel fileModel) {
|
||||
private MessageType calculateMessageType(boolean reanalyse, ProcessingStatus processingStatus, FileModel fileModel) {
|
||||
|
||||
if (!fileManagementStorageService.objectExists(dossierId, fileId, FileType.TEXT)) {
|
||||
return MessageType.STRUCTURE_ANALYSE;
|
||||
}
|
||||
if (ProcessingStatus.NER_ANALYZING.equals(processingStatus)) {
|
||||
return MessageType.ANALYSE;
|
||||
}
|
||||
|
||||
if (reanalyse) {
|
||||
if (fileModel.getLastFileAttributeChange() != null && fileModel.getLastProcessed().isBefore(fileModel.getLastFileAttributeChange())) {
|
||||
return MessageType.ANALYSE;
|
||||
} else {
|
||||
return MessageType.REANALYSE;
|
||||
}
|
||||
return MessageType.REANALYSE;
|
||||
}
|
||||
|
||||
return MessageType.ANALYSE;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user