RED-3618: Fixed renalyse after removing hint, add also to priority queue on approve
This commit is contained in:
parent
c43f052afb
commit
8ab286da94
@ -144,6 +144,14 @@ public class ManualRedactionService {
|
|||||||
commentId = addComment(fileId, removeRedactionRequest.getAnnotationId(), removeRedactionRequest.getComment(), removeRedactionRequest.getUser()).getId();
|
commentId = addComment(fileId, removeRedactionRequest.getAnnotationId(), removeRedactionRequest.getComment(), removeRedactionRequest.getUser()).getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!removeRedactionRequest.isRemoveFromDictionary()) {
|
||||||
|
Optional<RedactionLogEntry> redactionLogEntryOptional = redactionLog.getRedactionLogEntry()
|
||||||
|
.stream()
|
||||||
|
.filter(entry -> entry.getId().equals(removeRedactionRequest.getAnnotationId()))
|
||||||
|
.findFirst();
|
||||||
|
actionPerformed = actionPerformed || redactionLogEntryOptional.isPresent() && redactionLogEntryOptional.get().isHint();
|
||||||
|
}
|
||||||
|
|
||||||
actionPerformed = actionPerformed || handleRemoveFromDictionary(redactionLog, dossier, fileId, removeRedactionRequest.getAnnotationId(), removeRedactionRequest.getStatus(), removeRedactionRequest.isRemoveFromDictionary(), false);
|
actionPerformed = actionPerformed || handleRemoveFromDictionary(redactionLog, dossier, fileId, removeRedactionRequest.getAnnotationId(), removeRedactionRequest.getStatus(), removeRedactionRequest.isRemoveFromDictionary(), false);
|
||||||
|
|
||||||
response.add(ManualAddResponse.builder()
|
response.add(ManualAddResponse.builder()
|
||||||
@ -445,22 +453,25 @@ public class ManualRedactionService {
|
|||||||
|
|
||||||
for (var annotationId : annotationIds) {
|
for (var annotationId : annotationIds) {
|
||||||
IdRemovalEntity idRemoval = removeRedactionPersistenceService.findRemoveRedaction(fileId, annotationId);
|
IdRemovalEntity idRemoval = removeRedactionPersistenceService.findRemoveRedaction(fileId, annotationId);
|
||||||
|
|
||||||
|
Optional<RedactionLogEntry> redactionLogEntryOptional = redactionLog.getRedactionLogEntry()
|
||||||
|
.stream()
|
||||||
|
.filter(entry -> entry.getId().equals(idRemoval.getId().getAnnotationId()))
|
||||||
|
.findFirst();
|
||||||
|
|
||||||
|
if (redactionLogEntryOptional.isEmpty()) {
|
||||||
|
throw new NotFoundException("Annotation does not exist in redaction log.");
|
||||||
|
}
|
||||||
|
|
||||||
if (idRemoval.isRemoveFromDictionary()) {
|
if (idRemoval.isRemoveFromDictionary()) {
|
||||||
|
|
||||||
Optional<RedactionLogEntry> redactionLogEntryOptional = redactionLog.getRedactionLogEntry()
|
|
||||||
.stream()
|
|
||||||
.filter(entry -> entry.getId().equals(idRemoval.getId().getAnnotationId()))
|
|
||||||
.findFirst();
|
|
||||||
|
|
||||||
if (redactionLogEntryOptional.isEmpty()) {
|
|
||||||
throw new NotFoundException("Annotation does not exist in redaction log.");
|
|
||||||
}
|
|
||||||
|
|
||||||
var redactionLogEntry = redactionLogEntryOptional.get();
|
var redactionLogEntry = redactionLogEntryOptional.get();
|
||||||
|
|
||||||
if (annotationStatus == AnnotationStatus.APPROVED) {
|
if (annotationStatus == AnnotationStatus.APPROVED) {
|
||||||
removeFromDictionary(buildTypeId(redactionLogEntry, dossier), redactionLogEntry.getValue(), dossierId, fileId, DictionaryEntryType.ENTRY);
|
removeFromDictionary(buildTypeId(redactionLogEntry, dossier), redactionLogEntry.getValue(), dossierId, fileId, DictionaryEntryType.ENTRY);
|
||||||
approveStatusForRedactionsWithSameValue(dossier, false, true, redactionLogEntry.getValue());
|
approveStatusForRedactionsWithSameValue(dossier, false, true, redactionLogEntry.getValue());
|
||||||
|
reprocess(dossierId, fileId);
|
||||||
|
|
||||||
} else if (annotationStatus == AnnotationStatus.DECLINED) {
|
} else if (annotationStatus == AnnotationStatus.DECLINED) {
|
||||||
|
|
||||||
@ -469,6 +480,8 @@ public class ManualRedactionService {
|
|||||||
addToDictionary(buildTypeId(redactionLogEntry, dossier), redactionLogEntry.getValue(), dossierId, fileId, DictionaryEntryType.ENTRY);
|
addToDictionary(buildTypeId(redactionLogEntry, dossier), redactionLogEntry.getValue(), dossierId, fileId, DictionaryEntryType.ENTRY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if(redactionLogEntryOptional.isPresent() && redactionLogEntryOptional.get().isHint()){
|
||||||
|
reprocess(dossierId, fileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
removeRedactionPersistenceService.updateStatus(fileId, annotationId, annotationStatus);
|
removeRedactionPersistenceService.updateStatus(fileId, annotationId, annotationStatus);
|
||||||
@ -560,7 +573,7 @@ public class ManualRedactionService {
|
|||||||
if (manualRedactionEntry.isAddToDictionary() || manualRedactionEntry.isAddToDossierDictionary()) {
|
if (manualRedactionEntry.isAddToDictionary() || manualRedactionEntry.isAddToDossierDictionary()) {
|
||||||
if (annotationStatus == AnnotationStatus.APPROVED) {
|
if (annotationStatus == AnnotationStatus.APPROVED) {
|
||||||
addToDictionary(manualRedactionEntry.getTypeId(), manualRedactionEntry.getValue(), dossierId, fileId, manualRedactionEntry.getDictionaryEntryType());
|
addToDictionary(manualRedactionEntry.getTypeId(), manualRedactionEntry.getValue(), dossierId, fileId, manualRedactionEntry.getDictionaryEntryType());
|
||||||
|
reprocess(dossierId, fileId);
|
||||||
approveStatusForRedactionsWithSameValue(dossier, manualRedactionEntry.isAddToDictionary(), manualRedactionEntry.isAddToDossierDictionary(), manualRedactionEntry.getValue());
|
approveStatusForRedactionsWithSameValue(dossier, manualRedactionEntry.isAddToDictionary(), manualRedactionEntry.isAddToDossierDictionary(), manualRedactionEntry.getValue());
|
||||||
|
|
||||||
} else if (annotationStatus == AnnotationStatus.DECLINED) {
|
} else if (annotationStatus == AnnotationStatus.DECLINED) {
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.iqser.red.service.peristence.v1.server.service.FileManagementStorageService;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.model.annotations.*;
|
import com.iqser.red.service.persistence.service.v1.api.model.annotations.*;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -17,6 +19,11 @@ import com.iqser.red.service.peristence.v1.server.integration.service.DossierTes
|
|||||||
import com.iqser.red.service.peristence.v1.server.integration.service.FileTesterAndProvider;
|
import com.iqser.red.service.peristence.v1.server.integration.service.FileTesterAndProvider;
|
||||||
import com.iqser.red.service.peristence.v1.server.integration.service.TypeProvider;
|
import com.iqser.red.service.peristence.v1.server.integration.service.TypeProvider;
|
||||||
import com.iqser.red.service.peristence.v1.server.integration.utils.AbstractPersistenceServerServiceTest;
|
import com.iqser.red.service.peristence.v1.server.integration.utils.AbstractPersistenceServerServiceTest;
|
||||||
|
import com.iqser.red.service.persistence.service.v1.api.model.dossiertemplate.dossier.file.FileType;
|
||||||
|
import com.iqser.red.service.redaction.v1.model.RedactionLog;
|
||||||
|
import com.iqser.red.service.redaction.v1.model.RedactionLogEntry;
|
||||||
|
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
|
||||||
public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||||
|
|
||||||
@ -38,8 +45,15 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DictionaryClient dictionaryClient;
|
private DictionaryClient dictionaryClient;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FileManagementStorageService fileManagementStorageService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ObjectMapper objectMapper;
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@SneakyThrows
|
||||||
public void testManualRedaction() {
|
public void testManualRedaction() {
|
||||||
|
|
||||||
var dossierTemplate = dossierTemplateTesterAndProvider.provideTestTemplate();
|
var dossierTemplate = dossierTemplateTesterAndProvider.provideTestTemplate();
|
||||||
@ -126,6 +140,11 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
.user("test")
|
.user("test")
|
||||||
.removeFromDictionary(false)
|
.removeFromDictionary(false)
|
||||||
.build())).get(0);
|
.build())).get(0);
|
||||||
|
|
||||||
|
fileManagementStorageService.storeObject(dossier.getId(), file.getId(), FileType.REDACTION_LOG, objectMapper.writeValueAsBytes(new RedactionLog(1, 1,
|
||||||
|
List.of(RedactionLogEntry.builder().id(removeRedaction.getAnnotationId()).type("manual").value("value entry").build()),
|
||||||
|
null, 0, 0, 0, 0)));
|
||||||
|
|
||||||
manualRedactionClient.updateRemoveRedactionStatus(dossier.getId(), file.getId(),
|
manualRedactionClient.updateRemoveRedactionStatus(dossier.getId(), file.getId(),
|
||||||
UpdateRedactionRequest.builder()
|
UpdateRedactionRequest.builder()
|
||||||
.annotationIds(List.of(removeRedaction.getAnnotationId()))
|
.annotationIds(List.of(removeRedaction.getAnnotationId()))
|
||||||
@ -148,6 +167,10 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
loadedRemoveRedaction = manualRedactionClient.getRemoveRedaction(file.getId(), addRedaction.getAnnotationId());
|
loadedRemoveRedaction = manualRedactionClient.getRemoveRedaction(file.getId(), addRedaction.getAnnotationId());
|
||||||
assertThat(loadedRemoveRedaction.getStatus()).isEqualTo(AnnotationStatus.DECLINED);
|
assertThat(loadedRemoveRedaction.getStatus()).isEqualTo(AnnotationStatus.DECLINED);
|
||||||
|
|
||||||
|
fileManagementStorageService.storeObject(dossier.getId(), file.getId(), FileType.REDACTION_LOG, objectMapper.writeValueAsBytes(new RedactionLog(1, 1,
|
||||||
|
List.of(RedactionLogEntry.builder().id("annotationId").type("manual").value("value entry").build()),
|
||||||
|
null, 0, 0, 0, 0)));
|
||||||
|
|
||||||
var removeRedaction2 = manualRedactionClient.addRemoveRedaction(dossier.getId(), file.getId(), List.of(RemoveRedactionRequest.builder()
|
var removeRedaction2 = manualRedactionClient.addRemoveRedaction(dossier.getId(), file.getId(), List.of(RemoveRedactionRequest.builder()
|
||||||
.annotationId("annotationId")
|
.annotationId("annotationId")
|
||||||
.comment("comment")
|
.comment("comment")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user