Pull request #182: RED-1755: Fixed hasHints flag at excluded pages

Merge in RED/redaction-service from RED-1755 to master

* commit 'abb48d46f95ab218c790dece094a44b8e9ccf86c':
  RED-1755: Fixed hasHints flag at excluded pages
This commit is contained in:
Dominique Eiflaender 2021-07-08 11:35:48 +02:00
commit e3b8022b54

View File

@ -4,13 +4,19 @@ import com.iqser.red.service.redaction.v1.model.AnalyzeResult;
import com.iqser.red.service.redaction.v1.model.RedactionChangeLog;
import com.iqser.red.service.redaction.v1.model.RedactionLog;
import com.iqser.red.service.redaction.v1.model.RedactionLogEntry;
import org.springframework.stereotype.Service;
@Service
public class AnalyzeResponseService {
public AnalyzeResult createAnalyzeResponse(String dossierId, String fileId, long duration, int pageCount, RedactionLog redactionLog, RedactionChangeLog redactionChangeLog) {
boolean hasHints = redactionLog.getRedactionLogEntry().stream().anyMatch(entry -> entry.isHint() && !entry.getType().equals("false_positive"));
public AnalyzeResult createAnalyzeResponse(String dossierId, String fileId, long duration, int pageCount,
RedactionLog redactionLog, RedactionChangeLog redactionChangeLog) {
boolean hasHints = redactionLog.getRedactionLogEntry()
.stream()
.filter(entry -> !entry.isExcluded())
.anyMatch(entry -> entry.isHint() && !entry.getType().equals("false_positive"));
boolean hasRequests = redactionLog.getRedactionLogEntry()
.stream()
@ -31,7 +37,9 @@ public class AnalyzeResponseService {
boolean hasUpdates = redactionChangeLog != null && redactionChangeLog.getRedactionLogEntry() != null && !redactionChangeLog
.getRedactionLogEntry()
.isEmpty() && redactionChangeLog.getRedactionLogEntry().stream().anyMatch(entry -> !entry.getType().equals("false_positive"));
.isEmpty() && redactionChangeLog.getRedactionLogEntry()
.stream()
.anyMatch(entry -> !entry.getType().equals("false_positive"));
return AnalyzeResult.builder()
.dossierId(dossierId)
@ -49,4 +57,5 @@ public class AnalyzeResponseService {
.dossierDictionaryVersion(redactionLog.getDossierDictionaryVersion())
.build();
}
}