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
|
// toggle status
|
||||||
fileStatusService.toggleExclusion(fileId, excluded);
|
fileStatusService.toggleExclusion(dossierId, fileId, excluded);
|
||||||
|
|
||||||
if (!excluded) {
|
|
||||||
// if file has been re-enabled - process it
|
|
||||||
fileStatusService.setStatusFullReprocess(dossierId, fileId, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void toggleAutomaticAnalysis(String dossierId, String fileId, boolean excludedFromAutomaticAnalysis) {
|
public void toggleAutomaticAnalysis(String dossierId, String fileId, boolean excludedFromAutomaticAnalysis) {
|
||||||
|
|
||||||
// toggle status
|
fileStatusService.toggleAutomaticAnalysis(dossierId, fileId, excludedFromAutomaticAnalysis);
|
||||||
fileStatusService.toggleAutomaticAnalysis(fileId, excludedFromAutomaticAnalysis);
|
|
||||||
|
|
||||||
if (!excludedFromAutomaticAnalysis) {
|
|
||||||
// if file has been re-enabled - process it
|
|
||||||
fileStatusService.setStatusFullReprocess(dossierId, fileId, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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);
|
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);
|
fileStatusPersistenceService.toggleAutomaticAnalysis(fileId, excludedFromAutomaticAnalysis);
|
||||||
|
|
||||||
|
if (!excludedFromAutomaticAnalysis) {
|
||||||
|
setStatusFullReprocess(dossierId, fileId, false, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -577,11 +587,6 @@ public class FileStatusService {
|
|||||||
return;
|
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)) {
|
if (settings.isFigureDetectionEnabled() && !fileManagementStorageService.objectExists(dossierId, fileId, FileType.FIGURE)) {
|
||||||
log.debug("Add file: {} from dossier {} to Figure Detection queue", fileId, dossierId);
|
log.debug("Add file: {} from dossier {} to Figure Detection queue", fileId, dossierId);
|
||||||
addToFigureDetectionRequestQueue(dossierId, fileId);
|
addToFigureDetectionRequestQueue(dossierId, fileId);
|
||||||
@ -600,20 +605,32 @@ public class FileStatusService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var fileModel = convert(fileEntity, FileModel.class, new FileModelMapper());
|
||||||
|
reanalysisRequiredStatusService.enhanceFileStatusWithAnalysisRequirements(fileModel, true);
|
||||||
|
|
||||||
if (settings.isOcrByDefault() && fileModel.getOcrEndTime() == null) {
|
if (settings.isOcrByDefault() && fileModel.getOcrEndTime() == null) {
|
||||||
log.debug("Add file: {} from dossier {} to OCR queue", fileId, dossierId);
|
log.debug("Add file: {} from dossier {} to OCR queue", fileId, dossierId);
|
||||||
setStatusOcrQueued(dossierId, fileId);
|
setStatusOcrQueued(dossierId, fileId);
|
||||||
return;
|
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);
|
log.debug("Add file: {} from dossier {} to NER queue", fileId, dossierId);
|
||||||
addToNerQueue(dossierId, fileId);
|
addToNerQueue(dossierId, fileId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (messageType == null) {
|
||||||
|
boolean reanalyse = fileModel.isReanalysisRequired() || manualRedactionReanalyse;
|
||||||
|
messageType = calculateMessageType(reanalyse, fileModel.getProcessingStatus(), fileModel);
|
||||||
|
}
|
||||||
|
|
||||||
var analyseRequest = AnalyzeRequest.builder()
|
var analyseRequest = AnalyzeRequest.builder()
|
||||||
.messageType(messageType)
|
.messageType(messageType)
|
||||||
.dossierId(dossierId)
|
.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)) {
|
if (ProcessingStatus.NER_ANALYZING.equals(processingStatus)) {
|
||||||
return MessageType.ANALYSE;
|
return MessageType.ANALYSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reanalyse) {
|
if (reanalyse) {
|
||||||
if (fileModel.getLastFileAttributeChange() != null && fileModel.getLastProcessed().isBefore(fileModel.getLastFileAttributeChange())) {
|
if (fileModel.getLastFileAttributeChange() != null && fileModel.getLastProcessed().isBefore(fileModel.getLastFileAttributeChange())) {
|
||||||
return MessageType.ANALYSE;
|
return MessageType.ANALYSE;
|
||||||
|
} else {
|
||||||
|
return MessageType.REANALYSE;
|
||||||
}
|
}
|
||||||
return MessageType.REANALYSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return MessageType.ANALYSE;
|
return MessageType.ANALYSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user