DM-285: Change component log #135
@ -48,9 +48,9 @@ public class AnalysisLogController implements AnalysisLogResource {
|
||||
|
||||
|
||||
@Override
|
||||
public ComponentLog getComponentLog(String dossierId, String fileId) {
|
||||
public ComponentLog getComponentLog(String dossierId, String fileId, boolean includeOverrides) {
|
||||
|
||||
return componentLogService.getComponentLog(dossierId, fileId);
|
||||
return componentLogService.getComponentLog(dossierId, fileId, includeOverrides);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4,24 +4,22 @@ import static com.iqser.red.service.persistence.service.v2.api.external.resource
|
||||
import static com.iqser.red.service.persistence.service.v2.api.external.resource.DossierTemplateResource.DOSSIER_TEMPLATE_ID_PARAM;
|
||||
import static com.iqser.red.service.persistence.service.v2.api.external.resource.FileResource.FILE_ID_PARAM;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.iqser.red.persistence.service.v1.external.api.impl.controller.AnalysisLogController;
|
||||
import com.iqser.red.persistence.service.v1.external.api.impl.controller.DossierTemplateController;
|
||||
import com.iqser.red.persistence.service.v1.external.api.impl.controller.StatusController;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.ComponentOverrideService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.ComponentLogService;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.componentlog.Component;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.componentlog.ComponentValue;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.componentlog.EntityReference;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.component.ComponentsOverrides;
|
||||
import com.iqser.red.service.persistence.service.v2.api.external.model.Entity;
|
||||
import com.iqser.red.service.persistence.service.v2.api.external.model.FileComponents;
|
||||
import com.iqser.red.service.persistence.service.v2.api.external.model.FileComponentsList;
|
||||
@ -36,9 +34,8 @@ import lombok.RequiredArgsConstructor;
|
||||
public class ComponentControllerV2 implements ComponentResource {
|
||||
|
||||
private final DossierTemplateController dossierTemplateController;
|
||||
private final AnalysisLogController analysisLogController;
|
||||
private final ComponentLogService componentLogService;
|
||||
private final StatusController statusController;
|
||||
private final ComponentOverrideService componentOverrideService;
|
||||
|
||||
|
||||
@Override
|
||||
@ -49,41 +46,42 @@ public class ComponentControllerV2 implements ComponentResource {
|
||||
|
||||
dossierTemplateController.getDossierTemplate(dossierTemplateId);
|
||||
|
||||
var componentLog = analysisLogController.getComponentLog(dossierId, fileId);
|
||||
var overrides = componentOverrideService.getOverrides(dossierId, fileId);
|
||||
var componentLog = componentLogService.getComponentLog(dossierId, fileId, true);
|
||||
|
||||
Map<String, List<String>> components = new HashMap<>();
|
||||
List<Component> componentLogCategories = componentLog.getComponents();
|
||||
if (componentLogCategories != null && !componentLogCategories.isEmpty()) {
|
||||
componentLogCategories.forEach(c -> {
|
||||
Map<String, List<String>> basicComponent = componentLog.getComponents()
|
||||
.stream()
|
||||
.collect(Collectors.toMap(Component::getName, component -> component.getComponentValues().stream().map(ComponentValue::getValue).toList()));
|
||||
|
||||
if (overrides.getComponentOverrides() != null && overrides.getComponentOverrides().containsKey(c.getName())) {
|
||||
components.computeIfAbsent(c.getName(), (x) -> new ArrayList<>()).add(overrides.getComponentOverrides().get(c.getName()));
|
||||
} else {
|
||||
components.computeIfAbsent(c.getName(), (x) -> new ArrayList<>()).addAll(c.getComponentValues().stream().map(ComponentValue::getValue).toList());
|
||||
}
|
||||
});
|
||||
}
|
||||
Map<String, List<com.iqser.red.service.persistence.service.v2.api.external.model.Component>> componentsDetails = Collections.emptyMap();
|
||||
|
||||
Map<String, List<com.iqser.red.service.persistence.service.v2.api.external.model.Component>> componentsDetails = new HashMap<>();
|
||||
if (includeDetails) {
|
||||
componentLog.getComponents().forEach(c -> {
|
||||
componentsDetails.computeIfAbsent(c.getName(), (x) -> new ArrayList<>())
|
||||
.addAll(c.getComponentValues().stream().map(entry -> convert(entry, overrides, c.getName())).toList());
|
||||
});
|
||||
componentsDetails = componentLog.getComponents().stream().collect(Collectors.toMap(Component::getName, this::toComponentList));
|
||||
}
|
||||
|
||||
return FileComponents.builder().dossierTemplateId(dossierTemplateId).dossierId(dossierId).fileId(fileId).components(components).componentDetails(componentsDetails).build();
|
||||
return FileComponents.builder()
|
||||
.dossierTemplateId(dossierTemplateId)
|
||||
.dossierId(dossierId)
|
||||
.fileId(fileId)
|
||||
.components(basicComponent)
|
||||
.componentDetails(componentsDetails)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
private com.iqser.red.service.persistence.service.v2.api.external.model.Component convert(ComponentValue componentValue, ComponentsOverrides overrides, String category) {
|
||||
private List<com.iqser.red.service.persistence.service.v2.api.external.model.Component> toComponentList(Component component) {
|
||||
|
||||
return component.getComponentValues().stream().map(entry -> convert(entry, component.getName())).toList();
|
||||
}
|
||||
|
||||
|
||||
private com.iqser.red.service.persistence.service.v2.api.external.model.Component convert(ComponentValue componentValue, String name) {
|
||||
|
||||
return com.iqser.red.service.persistence.service.v2.api.external.model.Component.builder()
|
||||
.name(name)
|
||||
.componentRule(componentValue.getComponentRuleId())
|
||||
.entityReferences(componentValue.getEntityReferences().stream().map(this::convertComponentEntityReference).toList())
|
||||
.originalValues(List.of(componentValue.getValue()))
|
||||
.values(overrides.getComponentOverrides().containsKey(category) ? List.of(overrides.getComponentOverrides().get(category)) : List.of(componentValue.getValue()))
|
||||
.originalValues(List.of(componentValue.getOriginalValue()))
|
||||
.values(List.of(componentValue.getValue()))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@ -53,6 +53,8 @@ public interface AnalysisLogResource {
|
||||
@GetMapping(value = COMPONENT_LOG_PATH + DOSSIER_ID_PATH_VARIABLE + FILE_ID_PATH_VARIABLE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "Gets the component log for a fileId", description = "None")
|
||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK"), @ApiResponse(responseCode = "400", description = "Request contains error."), @ApiResponse(responseCode = "404", description = "The component log is not found.")})
|
||||
ComponentLog getComponentLog(@PathVariable(DOSSIER_ID) String dossierId, @PathVariable(FILE_ID) String fileId);
|
||||
ComponentLog getComponentLog(@PathVariable(DOSSIER_ID) String dossierId,
|
||||
@PathVariable(FILE_ID) String fileId,
|
||||
@RequestParam(name = "includeOverrides", defaultValue = "true") boolean includeOverrides);
|
||||
|
||||
}
|
||||
|
||||
@ -1,8 +1,13 @@
|
||||
package com.iqser.red.service.persistence.management.v1.processor.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.componentlog.Component;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.componentlog.ComponentLog;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.component.ComponentsOverrides;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@ -11,11 +16,39 @@ import lombok.RequiredArgsConstructor;
|
||||
public class ComponentLogService {
|
||||
|
||||
private final FileManagementStorageService fileManagementStorageService;
|
||||
private final ComponentOverrideService componentOverrideService;
|
||||
|
||||
|
||||
public ComponentLog getComponentLog(String dossierId, String fileId) {
|
||||
public ComponentLog getComponentLog(String dossierId, String fileId, boolean includeOverrides) {
|
||||
|
||||
return fileManagementStorageService.getComponentLog(dossierId, fileId);
|
||||
ComponentLog componentLog = fileManagementStorageService.getComponentLog(dossierId, fileId);
|
||||
if (!includeOverrides) {
|
||||
return componentLog;
|
||||
}
|
||||
|
||||
ComponentsOverrides componentsOverrides = componentOverrideService.getOverrides(dossierId, fileId);
|
||||
if (Objects.isNull(componentsOverrides.getComponentOverrides()) || componentsOverrides.getComponentOverrides().isEmpty()) {
|
||||
return componentLog;
|
||||
}
|
||||
|
||||
List<Component> overriddenComponents = componentLog.getComponents()
|
||||
.stream()
|
||||
.map(component -> applyOverride(component, componentsOverrides.getComponentOverrides().get(component.getName())))
|
||||
.toList();
|
||||
|
||||
componentLog.setComponents(overriddenComponents);
|
||||
return componentLog;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private Component applyOverride(Component component, String override) {
|
||||
|
||||
if (Objects.isNull(override)) {
|
||||
return component;
|
||||
}
|
||||
component.getComponentValues().forEach(componentValue -> componentValue.setValue(override));
|
||||
return component;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.iqser.red.service.persistence.management.v1.processor.service;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -41,7 +42,7 @@ public class ComponentOverrideService {
|
||||
|
||||
var exists = fileManagementStorageService.objectExists(dossierId, fileId, FileType.COMPONENTS);
|
||||
if (!exists) {
|
||||
return ComponentsOverrides.builder().build();
|
||||
return ComponentsOverrides.builder().componentOverrides(Collections.emptyMap()).build();
|
||||
}
|
||||
var existingComponentsBytes = fileManagementStorageService.getStoredObjectBytes(dossierId, fileId, FileType.COMPONENTS);
|
||||
return objectMapper.readValue(existingComponentsBytes, ComponentsOverrides.class);
|
||||
|
||||
@ -1,11 +1,28 @@
|
||||
package com.iqser.red.service.peristence.v1.server.integration.tests;
|
||||
|
||||
import static com.iqser.red.service.persistence.management.v1.processor.utils.TypeIdUtils.toTypeId;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.client.DictionaryClient;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.client.FileClient;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.client.InternalDictionaryClient;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.client.ManualRedactionClient;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.service.*;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.service.DossierTemplateTesterAndProvider;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.service.DossierTesterAndProvider;
|
||||
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.UserProvider;
|
||||
import com.iqser.red.service.peristence.v1.server.integration.utils.AbstractPersistenceServerServiceTest;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.DictionaryManagementService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.FileManagementStorageService;
|
||||
@ -23,19 +40,8 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.Remo
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.ResizeRedactionRequestModel;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.redactionlog.RedactionLog;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.redactionlog.RedactionLogEntry;
|
||||
|
||||
import feign.FeignException;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.iqser.red.service.persistence.management.v1.processor.utils.TypeIdUtils.toTypeId;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
|
||||
@ -464,7 +470,9 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
assertThat(loadedRedactionsFile1.getResizeRedactions()).hasSize(1);
|
||||
assertThat(loadedRedactionsFile1.getResizeRedactions().stream().toList().get(0).getValue()).isEqualTo("test redaction in dossier dictionary");
|
||||
|
||||
var dictEntries = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getDossierTemplateId(), "test redaction in dossier dictionary", DictionaryEntryType.ENTRY);
|
||||
var dictEntries = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getDossierTemplateId(),
|
||||
"test redaction in dossier dictionary",
|
||||
DictionaryEntryType.ENTRY);
|
||||
assertThat(dictEntries.stream().filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier dictionary"))).isNotEmpty();
|
||||
|
||||
var dictionaryOfTypeDosDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier1.getDossierTemplateId(), dossier1.getDossierId());
|
||||
@ -611,10 +619,16 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
assertThat(loadedRedactionsFile1.getResizeRedactions()).hasSize(1);
|
||||
assertThat(loadedRedactionsFile1.getResizeRedactions().stream().toList().get(0).getValue()).isEqualTo("test redaction in dossier");
|
||||
|
||||
var dictEntriesOldValue = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getDossierTemplateId(), "test redaction in dossier yayy", DictionaryEntryType.ENTRY);
|
||||
assertThat(dictEntriesOldValue.stream().filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier yayy") && dictionaryEntry.isDeleted())).hasSize(1);
|
||||
assertThat(dictEntriesOldValue.stream().filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier yayy") && !dictionaryEntry.isDeleted())).hasSize(1);
|
||||
var dictEntriesNewValue = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getDossierTemplateId(), "test redaction in dossier", DictionaryEntryType.ENTRY);
|
||||
var dictEntriesOldValue = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getDossierTemplateId(),
|
||||
"test redaction in dossier yayy",
|
||||
DictionaryEntryType.ENTRY);
|
||||
assertThat(dictEntriesOldValue.stream()
|
||||
.filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier yayy") && dictionaryEntry.isDeleted())).hasSize(1);
|
||||
assertThat(dictEntriesOldValue.stream()
|
||||
.filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier yayy") && !dictionaryEntry.isDeleted())).hasSize(1);
|
||||
var dictEntriesNewValue = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getDossierTemplateId(),
|
||||
"test redaction in dossier",
|
||||
DictionaryEntryType.ENTRY);
|
||||
assertThat(dictEntriesNewValue.stream().filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier"))).isNotEmpty();
|
||||
|
||||
var dictionaryOfTypeDosDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier1.getDossierTemplateId(), dossier1.getDossierId());
|
||||
@ -760,7 +774,9 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
assertThat(loadedRedactionsFile2.getResizeRedactions()).hasSize(1);
|
||||
assertThat(loadedRedactionsFile2.getResizeRedactions().stream().toList().get(0).getValue()).isEqualTo("test redaction in dossier template dictionary");
|
||||
|
||||
var dictEntries = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getDossierTemplateId(), "test redaction in dossier template dictionary", DictionaryEntryType.ENTRY);
|
||||
var dictEntries = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getDossierTemplateId(),
|
||||
"test redaction in dossier template dictionary",
|
||||
DictionaryEntryType.ENTRY);
|
||||
assertThat(dictEntries.stream().filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier template dictionary"))).hasSize(1);
|
||||
|
||||
var dictionaryOfTypeDosDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier1.getDossierTemplateId(), dossier1.getDossierId());
|
||||
@ -906,12 +922,16 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
assertThat(loadedRedactionsFile2.getResizeRedactions()).hasSize(1);
|
||||
assertThat(loadedRedactionsFile2.getResizeRedactions().stream().toList().get(0).getValue()).isEqualTo("test redaction in dossier template");
|
||||
|
||||
var dictEntriesOldValue = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getDossierTemplateId(), "test redaction in dossier template yayy", DictionaryEntryType.ENTRY);
|
||||
var dictEntriesOldValue = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getDossierTemplateId(),
|
||||
"test redaction in dossier template yayy",
|
||||
DictionaryEntryType.ENTRY);
|
||||
assertThat(dictEntriesOldValue.stream()
|
||||
.filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier template yayy") && dictionaryEntry.isDeleted())).hasSize(3);
|
||||
assertThat(dictEntriesOldValue.stream()
|
||||
.filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier template yayy") && !dictionaryEntry.isDeleted())).isEmpty();
|
||||
var dictEntriesNewValue = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getDossierTemplateId(), "test redaction in dossier template", DictionaryEntryType.ENTRY);
|
||||
var dictEntriesNewValue = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getDossierTemplateId(),
|
||||
"test redaction in dossier template",
|
||||
DictionaryEntryType.ENTRY);
|
||||
assertThat(dictEntriesNewValue.stream().filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier template"))).isNotEmpty();
|
||||
|
||||
var dictionaryOfTypeDosDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier1.getDossierTemplateId(), dossier1.getDossierId());
|
||||
@ -950,6 +970,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
assertThat(mergedDictForTypeDosTempDictInDossier2.getEntries().get(0)).isEqualTo("test redaction in dossier template");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testManualRecategorizeAndUndo() {
|
||||
|
||||
@ -1019,4 +1040,75 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
||||
dossierDictionary2 = dictionaryClient.getDictionaryForType(type2.getType(), type.getDossierTemplateId(), dossier.getDossierId());
|
||||
assertThat(dossierDictionary2.getEntries()).isEmpty();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testManualRecategorizeAndUndoDossierLevelOnly() {
|
||||
|
||||
var dossierTemplate = dossierTemplateTesterAndProvider.provideTestTemplate();
|
||||
var dossier = dossierTesterAndProvider.provideTestDossier(dossierTemplate);
|
||||
var file = fileTesterAndProvider.testAndProvideFile(dossier);
|
||||
|
||||
var type = typeProvider.testAndProvideType(dossierTemplate, dossier, "test", true, 66);
|
||||
var type2 = typeProvider.testAndProvideType(dossierTemplate, dossier, "test2", true, 100);
|
||||
|
||||
var entries = new ArrayList<String>();
|
||||
|
||||
var lukeSkywalker = "Luke Skywalker";
|
||||
var darthVader = "Darth Vader";
|
||||
entries.add(lukeSkywalker);
|
||||
entries.add(darthVader);
|
||||
|
||||
dictionaryClient.addEntry(type.getType(), type.getDossierTemplateId(), entries, false, dossier.getDossierId(), DictionaryEntryType.ENTRY);
|
||||
|
||||
Dictionary dossierTemplateDictionary = dictionaryClient.getDictionaryForType(type.getType(), type.getDossierTemplateId(), null);
|
||||
assertThat(dossierTemplateDictionary.getEntries()).isEmpty();
|
||||
Dictionary dossierDictionary = dictionaryClient.getDictionaryForType(type.getType(), type.getDossierTemplateId(), dossier.getDossierId());
|
||||
assertThat(dossierDictionary.getEntries()).containsExactlyInAnyOrder(lukeSkywalker, darthVader);
|
||||
|
||||
Dictionary dossierTemplateDictionary2 = dictionaryClient.getDictionaryForType(type2.getType(), type.getDossierTemplateId(), null);
|
||||
assertThat(dossierTemplateDictionary2.getEntries()).isEmpty();
|
||||
Dictionary dossierDictionary2 = dictionaryClient.getDictionaryForType(type2.getType(), type.getDossierTemplateId(), dossier.getDossierId());
|
||||
assertThat(dossierDictionary2.getEntries()).isEmpty();
|
||||
|
||||
var annotationId = "AnnotationId";
|
||||
var redactionLog = new RedactionLog(1,
|
||||
1,
|
||||
List.of(RedactionLogEntry.builder().id(annotationId).type(type.getType()).value(lukeSkywalker).isDictionaryEntry(true).build()),
|
||||
null,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
fileManagementStorageService.storeJSONObject(dossier.getId(), file.getId(), FileType.REDACTION_LOG, redactionLog);
|
||||
|
||||
when(redactionLogService.getRedactionLog(Mockito.any(), Mockito.any())).thenReturn(redactionLog);
|
||||
|
||||
manualRedactionClient.recategorizeBulk(dossier.getId(),
|
||||
file.getId(),
|
||||
Set.of(RecategorizationRequestModel.builder().type(type2.getType()).annotationId(annotationId).addToDictionary(true).addToAllDossiers(false).build()));
|
||||
|
||||
dossierTemplateDictionary = dictionaryClient.getDictionaryForType(type.getType(), type.getDossierTemplateId(), null);
|
||||
assertThat(dossierTemplateDictionary.getEntries()).isEmpty();
|
||||
dossierDictionary = dictionaryClient.getDictionaryForType(type.getType(), type.getDossierTemplateId(), dossier.getDossierId());
|
||||
assertThat(dossierDictionary.getEntries()).containsExactlyInAnyOrder(darthVader);
|
||||
|
||||
dossierTemplateDictionary2 = dictionaryClient.getDictionaryForType(type2.getType(), type.getDossierTemplateId(), null);
|
||||
assertThat(dossierTemplateDictionary2.getEntries()).isEmpty();
|
||||
dossierDictionary2 = dictionaryClient.getDictionaryForType(type2.getType(), type.getDossierTemplateId(), dossier.getDossierId());
|
||||
assertThat(dossierDictionary2.getEntries()).containsExactlyInAnyOrder(lukeSkywalker);
|
||||
|
||||
manualRedactionClient.undo(dossier.getDossierId(), file.getFileId(), Set.of(annotationId));
|
||||
|
||||
dossierTemplateDictionary = dictionaryClient.getDictionaryForType(type.getType(), type.getDossierTemplateId(), null);
|
||||
assertThat(dossierTemplateDictionary.getEntries()).isEmpty();
|
||||
dossierDictionary = dictionaryClient.getDictionaryForType(type.getType(), type.getDossierTemplateId(), dossier.getDossierId());
|
||||
assertThat(dossierDictionary.getEntries()).containsExactlyInAnyOrder(lukeSkywalker, darthVader);
|
||||
|
||||
dossierTemplateDictionary2 = dictionaryClient.getDictionaryForType(type2.getType(), type.getDossierTemplateId(), null);
|
||||
assertThat(dossierTemplateDictionary2.getEntries()).isEmpty();
|
||||
dossierDictionary2 = dictionaryClient.getDictionaryForType(type2.getType(), type.getDossierTemplateId(), dossier.getDossierId());
|
||||
assertThat(dossierDictionary2.getEntries()).isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user