DM-285: flush add redaction removal
* only remove add redactions
This commit is contained in:
parent
50c731d6f4
commit
c65a93bf1b
@ -509,21 +509,21 @@ public class DossierTemplateImportService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setRulesWhenCompiled(ImportTemplateResult request, String dossierTemplateEntity) {
|
private void setRulesWhenCompiled(ImportTemplateResult request, String dossierTemplateId) {
|
||||||
|
|
||||||
DroolsSyntaxValidation droolsSyntaxValidation = rulesValidationService.validateRules(RuleFileType.ENTITY, request.getRuleSet());
|
DroolsSyntaxValidation droolsSyntaxValidation = rulesValidationService.validateRules(RuleFileType.ENTITY, request.getRuleSet());
|
||||||
if (!droolsSyntaxValidation.isCompiled()) {
|
if (!droolsSyntaxValidation.isCompiled()) {
|
||||||
droolsSyntaxValidation.getDroolsSyntaxErrorMessages().forEach(errorMessage -> log.error(errorMessage.getMessage()));
|
droolsSyntaxValidation.getDroolsSyntaxErrorMessages().forEach(errorMessage -> log.error(errorMessage.getMessage()));
|
||||||
throw new BadRequestException("The entity rules do not compile!");
|
throw new BadRequestException("The entity rules do not compile!");
|
||||||
}
|
}
|
||||||
rulesPersistenceService.setRules(request.getRuleSet(), dossierTemplateEntity, RuleFileType.ENTITY);
|
rulesPersistenceService.setRules(request.getRuleSet(), dossierTemplateId, RuleFileType.ENTITY);
|
||||||
if (request.getComponentRuleSet() != null) {
|
if (request.getComponentRuleSet() != null) {
|
||||||
DroolsSyntaxValidation componentDroolsSyntaxValidation = rulesValidationService.validateRules(RuleFileType.COMPONENT, request.getComponentRuleSet());
|
DroolsSyntaxValidation componentDroolsSyntaxValidation = rulesValidationService.validateRules(RuleFileType.COMPONENT, request.getComponentRuleSet());
|
||||||
if (!componentDroolsSyntaxValidation.isCompiled()) {
|
if (!componentDroolsSyntaxValidation.isCompiled()) {
|
||||||
componentDroolsSyntaxValidation.getDroolsSyntaxErrorMessages().forEach(errorMessage -> log.error(errorMessage.getMessage()));
|
componentDroolsSyntaxValidation.getDroolsSyntaxErrorMessages().forEach(errorMessage -> log.error(errorMessage.getMessage()));
|
||||||
throw new BadRequestException("The component rules do not compile!");
|
throw new BadRequestException("The component rules do not compile!");
|
||||||
}
|
}
|
||||||
rulesPersistenceService.setRules(request.getComponentRuleSet(), dossierTemplateEntity, RuleFileType.COMPONENT);
|
rulesPersistenceService.setRules(request.getComponentRuleSet(), dossierTemplateId, RuleFileType.COMPONENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import org.springframework.dao.EmptyResultDataAccessException;
|
import org.springframework.dao.EmptyResultDataAccessException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.CommentEntity;
|
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.CommentEntity;
|
||||||
@ -50,11 +51,14 @@ public class ManualRedactionProviderService {
|
|||||||
private final LegalBasisChangePersistenceService legalBasisChangePersistenceService;
|
private final LegalBasisChangePersistenceService legalBasisChangePersistenceService;
|
||||||
private final ResizeRedactionPersistenceService resizeRedactionPersistenceService;
|
private final ResizeRedactionPersistenceService resizeRedactionPersistenceService;
|
||||||
|
|
||||||
|
|
||||||
|
@Transactional
|
||||||
public ManualRedactions getManualRedactions(String fileId) {
|
public ManualRedactions getManualRedactions(String fileId) {
|
||||||
|
|
||||||
return getManualRedactions(fileId, false);
|
return getManualRedactions(fileId, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public ManualRedactions getManualRedactions(String fileId, boolean unprocessed) {
|
public ManualRedactions getManualRedactions(String fileId, boolean unprocessed) {
|
||||||
|
|
||||||
@ -98,20 +102,13 @@ public class ManualRedactionProviderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public ManualRedactionEntry getAddRedaction(String fileId, String annotationId) {
|
|
||||||
|
|
||||||
return convert(addRedactionPersistenceService.findAddRedaction(fileId, annotationId), ManualRedactionEntry.class, new ManualRedactionMapper());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private Set<ManualRedactionEntry> convertEntriesToAdd(List<ManualRedactionEntryEntity> source) {
|
private Set<ManualRedactionEntry> convertEntriesToAdd(List<ManualRedactionEntryEntity> source) {
|
||||||
|
|
||||||
return source.stream().map(entry -> convert(entry, ManualRedactionEntry.class, new ManualRedactionMapper())).collect(Collectors.toSet());
|
return source.stream().map(entry -> convert(entry, ManualRedactionEntry.class, new ManualRedactionMapper())).collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional(noRollbackFor = {EmptyResultDataAccessException.class})
|
@Transactional(noRollbackFor = {EmptyResultDataAccessException.class}, propagation = Propagation.REQUIRES_NEW)
|
||||||
public void hardDeleteManualRedactions(String fileId, String annotationId) {
|
public void hardDeleteManualRedactions(String fileId, String annotationId) {
|
||||||
|
|
||||||
addRedactionPersistenceService.hardDelete(fileId, annotationId);
|
addRedactionPersistenceService.hardDelete(fileId, annotationId);
|
||||||
|
|||||||
@ -113,6 +113,8 @@ public class ManualRedactionService {
|
|||||||
manualRedactionDictionaryUpdateHandler.validateDictionariesForDelete(removeRedactionRequest,
|
manualRedactionDictionaryUpdateHandler.validateDictionariesForDelete(removeRedactionRequest,
|
||||||
removeRedactionRequest.getTypeToRemove(),
|
removeRedactionRequest.getTypeToRemove(),
|
||||||
removeRedactionRequest.getDossierTemplateId());
|
removeRedactionRequest.getDossierTemplateId());
|
||||||
|
|
||||||
|
log.info("add removeRedaction for file {} and annotation {}", fileId, removeRedactionRequest.getAnnotationId());
|
||||||
removeRedactionPersistenceService.insert(fileId, removeRedactionRequest);
|
removeRedactionPersistenceService.insert(fileId, removeRedactionRequest);
|
||||||
|
|
||||||
if (manualAddRedactionsContains(manualRedactions, removeRedactionRequest.getAnnotationId())) {
|
if (manualAddRedactionsContains(manualRedactions, removeRedactionRequest.getAnnotationId())) {
|
||||||
@ -121,8 +123,6 @@ public class ManualRedactionService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("add removeRedaction for file {} and annotation {}", fileId, removeRedactionRequest.getAnnotationId());
|
|
||||||
|
|
||||||
Long commentId = commentService.addCommentAndGetId(fileId,
|
Long commentId = commentService.addCommentAndGetId(fileId,
|
||||||
removeRedactionRequest.getAnnotationId(),
|
removeRedactionRequest.getAnnotationId(),
|
||||||
removeRedactionRequest.getComment(),
|
removeRedactionRequest.getComment(),
|
||||||
|
|||||||
@ -58,7 +58,6 @@ public class AddRedactionPersistenceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ManualRedactionEntryEntity findAddRedaction(String fileId, String annotationId) {
|
public ManualRedactionEntryEntity findAddRedaction(String fileId, String annotationId) {
|
||||||
|
|
||||||
return manualRedactionRepository.findAddRedaction(new AnnotationEntityId(annotationId, fileId))
|
return manualRedactionRepository.findAddRedaction(new AnnotationEntityId(annotationId, fileId))
|
||||||
@ -66,9 +65,6 @@ public class AddRedactionPersistenceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public List<ManualRedactionEntryEntity> findAddRedactions(String fileId, boolean includeDeletions) {
|
public List<ManualRedactionEntryEntity> findAddRedactions(String fileId, boolean includeDeletions) {
|
||||||
|
|
||||||
return manualRedactionRepository.findByFileIdIncludeDeletions(fileId, includeDeletions);
|
return manualRedactionRepository.findByFileIdIncludeDeletions(fileId, includeDeletions);
|
||||||
@ -80,6 +76,7 @@ public class AddRedactionPersistenceService {
|
|||||||
return manualRedactionRepository.findAll();
|
return manualRedactionRepository.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<ManualRedactionEntryEntity> findUnprocessedRedactions(String fileId) {
|
public List<ManualRedactionEntryEntity> findUnprocessedRedactions(String fileId) {
|
||||||
|
|
||||||
return manualRedactionRepository.findByFileIdAndUnprocessed(fileId);
|
return manualRedactionRepository.findByFileIdAndUnprocessed(fileId);
|
||||||
@ -113,6 +110,7 @@ public class AddRedactionPersistenceService {
|
|||||||
manualRedactionRepository.updateStatus(new AnnotationEntityId(annotationId, fileId), annotationStatus, processedDate);
|
manualRedactionRepository.updateStatus(new AnnotationEntityId(annotationId, fileId), annotationStatus, processedDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void updateStatus(String fileId,
|
public void updateStatus(String fileId,
|
||||||
String annotationId,
|
String annotationId,
|
||||||
@ -131,7 +129,6 @@ public class AddRedactionPersistenceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void approveStatusForRequestedRedactionsWithSameValue(Set<String> fileIds, String value) {
|
public void approveStatusForRequestedRedactionsWithSameValue(Set<String> fileIds, String value) {
|
||||||
|
|
||||||
|
|||||||
@ -77,11 +77,13 @@ public class ForceRedactionPersistenceService {
|
|||||||
return new HashSet<>(forceRedactionRepository.findByFileIdIncludeDeletions(fileId, includeDeletions));
|
return new HashSet<>(forceRedactionRepository.findByFileIdIncludeDeletions(fileId, includeDeletions));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Set<ManualForceRedactionEntity> findUnprocessedForceRedactions(String fileId) {
|
public Set<ManualForceRedactionEntity> findUnprocessedForceRedactions(String fileId) {
|
||||||
|
|
||||||
return new HashSet<>(forceRedactionRepository.findByFileIdAndUnprocessed(fileId));
|
return new HashSet<>(forceRedactionRepository.findByFileIdAndUnprocessed(fileId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void markAsProcessed(String annotationId, String fileId) {
|
public void markAsProcessed(String annotationId, String fileId) {
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,6 @@ import java.time.OffsetDateTime;
|
|||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
@ -43,6 +42,7 @@ public class LegalBasisChangePersistenceService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void checkSection(String section) {
|
private void checkSection(String section) {
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(section) && section.length() > SECTION_MAX_LENGTH) {
|
if (!StringUtils.isEmpty(section) && section.length() > SECTION_MAX_LENGTH) {
|
||||||
@ -91,6 +91,7 @@ public class LegalBasisChangePersistenceService {
|
|||||||
return new HashSet<>(legalBasisChangeRepository.findByFileIdIncludeDeletions(fileId, includeDeletions));
|
return new HashSet<>(legalBasisChangeRepository.findByFileIdIncludeDeletions(fileId, includeDeletions));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Set<ManualLegalBasisChangeEntity> findUnprocessedLegalBasisChanges(String fileId) {
|
public Set<ManualLegalBasisChangeEntity> findUnprocessedLegalBasisChanges(String fileId) {
|
||||||
|
|
||||||
return new HashSet<>(legalBasisChangeRepository.findUnprocessedByFileId(fileId));
|
return new HashSet<>(legalBasisChangeRepository.findUnprocessedByFileId(fileId));
|
||||||
|
|||||||
@ -99,6 +99,7 @@ public class RecategorizationPersistenceService {
|
|||||||
return recategorizationRepository.findByFileIdIncludeDeletions(fileId, includeDeletions);
|
return recategorizationRepository.findByFileIdIncludeDeletions(fileId, includeDeletions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<ManualRecategorizationEntity> findUnprocessedRecategorizations(String fileId) {
|
public List<ManualRecategorizationEntity> findUnprocessedRecategorizations(String fileId) {
|
||||||
|
|
||||||
return recategorizationRepository.findUnprocessedByFileId(fileId);
|
return recategorizationRepository.findUnprocessedByFileId(fileId);
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import java.time.temporal.ChronoUnit;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -54,6 +53,7 @@ public class RemoveRedactionPersistenceService {
|
|||||||
return new HashSet<>(removeRedactionRepository.findByFileIdIncludeDeletions(fileId, includeDeletions));
|
return new HashSet<>(removeRedactionRepository.findByFileIdIncludeDeletions(fileId, includeDeletions));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Set<IdRemovalEntity> findUnprocessedRemoveRedactions(String fileId) {
|
public Set<IdRemovalEntity> findUnprocessedRemoveRedactions(String fileId) {
|
||||||
|
|
||||||
return new HashSet<>(removeRedactionRepository.findByFileIdAndUnprocessed(fileId));
|
return new HashSet<>(removeRedactionRepository.findByFileIdAndUnprocessed(fileId));
|
||||||
|
|||||||
@ -93,6 +93,7 @@ public class ResizeRedactionPersistenceService {
|
|||||||
return resizeRedactionRepository.findByFileIdIncludeDeletions(fileId, includeDeletions);
|
return resizeRedactionRepository.findByFileIdIncludeDeletions(fileId, includeDeletions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<ManualResizeRedactionEntity> findUnprocessedResizeRedactions(String fileId) {
|
public List<ManualResizeRedactionEntity> findUnprocessedResizeRedactions(String fileId) {
|
||||||
|
|
||||||
return resizeRedactionRepository.findUnprocessedByFileId(fileId);
|
return resizeRedactionRepository.findUnprocessedByFileId(fileId);
|
||||||
|
|||||||
@ -49,6 +49,7 @@ import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.Lega
|
|||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.RecategorizationRequestModel;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.RecategorizationRequestModel;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.RemoveRedactionRequestModel;
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.RemoveRedactionRequestModel;
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.manual.ResizeRedactionRequestModel;
|
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.Point;
|
||||||
|
|
||||||
import feign.FeignException;
|
import feign.FeignException;
|
||||||
|
|
||||||
@ -117,7 +118,14 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
var entityLog = new EntityLog(1,
|
var entityLog = new EntityLog(1,
|
||||||
1,
|
1,
|
||||||
List.of(EntityLogEntry.builder().id("AnnotationId").type(type.getType()).value("Luke Skywalker").entryType(EntryType.ENTITY).state(EntryState.APPLIED).dictionaryEntry(true).build()),
|
List.of(EntityLogEntry.builder()
|
||||||
|
.id("AnnotationId")
|
||||||
|
.type(type.getType())
|
||||||
|
.value("Luke Skywalker")
|
||||||
|
.entryType(EntryType.ENTITY)
|
||||||
|
.state(EntryState.APPLIED)
|
||||||
|
.dictionaryEntry(true)
|
||||||
|
.build()),
|
||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -266,7 +274,14 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
var entityLog = new EntityLog(1,
|
var entityLog = new EntityLog(1,
|
||||||
1,
|
1,
|
||||||
List.of(EntityLogEntry.builder().id("AnnotationId").type("test").value("Luke Skywalker").entryType(EntryType.ENTITY).state(EntryState.APPLIED).dictionaryEntry(true).build()),
|
List.of(EntityLogEntry.builder()
|
||||||
|
.id("AnnotationId")
|
||||||
|
.type("test")
|
||||||
|
.value("Luke Skywalker")
|
||||||
|
.entryType(EntryType.ENTITY)
|
||||||
|
.state(EntryState.APPLIED)
|
||||||
|
.dictionaryEntry(true)
|
||||||
|
.build()),
|
||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -314,7 +329,14 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
var entityLog = new EntityLog(1,
|
var entityLog = new EntityLog(1,
|
||||||
1,
|
1,
|
||||||
List.of(EntityLogEntry.builder().id("AnnotationId").type("test").value("Luke Skywalker").entryType(EntryType.ENTITY).state(EntryState.APPLIED).dictionaryEntry(true).build()),
|
List.of(EntityLogEntry.builder()
|
||||||
|
.id("AnnotationId")
|
||||||
|
.type("test")
|
||||||
|
.value("Luke Skywalker")
|
||||||
|
.entryType(EntryType.ENTITY)
|
||||||
|
.state(EntryState.APPLIED)
|
||||||
|
.dictionaryEntry(true)
|
||||||
|
.build()),
|
||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -355,7 +377,14 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
var entityLog = new EntityLog(1,
|
var entityLog = new EntityLog(1,
|
||||||
1,
|
1,
|
||||||
List.of(EntityLogEntry.builder().id("AnnotationId").type("test").value("Luke Skywalker").entryType(EntryType.ENTITY).state(EntryState.APPLIED).dictionaryEntry(true).build()),
|
List.of(EntityLogEntry.builder()
|
||||||
|
.id("AnnotationId")
|
||||||
|
.type("test")
|
||||||
|
.value("Luke Skywalker")
|
||||||
|
.entryType(EntryType.ENTITY)
|
||||||
|
.state(EntryState.APPLIED)
|
||||||
|
.dictionaryEntry(true)
|
||||||
|
.build()),
|
||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -488,9 +517,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
assertThat(loadedRedactionsFile1.getResizeRedactions()).hasSize(1);
|
assertThat(loadedRedactionsFile1.getResizeRedactions()).hasSize(1);
|
||||||
assertThat(loadedRedactionsFile1.getResizeRedactions().stream().toList().get(0).getValue()).isEqualTo("test redaction in dossier dictionary");
|
assertThat(loadedRedactionsFile1.getResizeRedactions().stream().toList().get(0).getValue()).isEqualTo("test redaction in dossier dictionary");
|
||||||
|
|
||||||
var dictEntries = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getId(),
|
var dictEntries = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getId(), "test redaction in dossier dictionary", DictionaryEntryType.ENTRY);
|
||||||
"test redaction in dossier dictionary",
|
|
||||||
DictionaryEntryType.ENTRY);
|
|
||||||
assertThat(dictEntries.stream().filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier dictionary"))).isNotEmpty();
|
assertThat(dictEntries.stream().filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier dictionary"))).isNotEmpty();
|
||||||
|
|
||||||
var dictionaryOfTypeDosDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
|
var dictionaryOfTypeDosDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
|
||||||
@ -643,16 +670,12 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
assertThat(loadedRedactionsFile1.getResizeRedactions()).hasSize(1);
|
assertThat(loadedRedactionsFile1.getResizeRedactions()).hasSize(1);
|
||||||
assertThat(loadedRedactionsFile1.getResizeRedactions().stream().toList().get(0).getValue()).isEqualTo("test redaction in dossier");
|
assertThat(loadedRedactionsFile1.getResizeRedactions().stream().toList().get(0).getValue()).isEqualTo("test redaction in dossier");
|
||||||
|
|
||||||
var dictEntriesOldValue = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getId(),
|
var dictEntriesOldValue = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getId(), "test redaction in dossier yayy", DictionaryEntryType.ENTRY);
|
||||||
"test redaction in dossier yayy",
|
|
||||||
DictionaryEntryType.ENTRY);
|
|
||||||
assertThat(dictEntriesOldValue.stream()
|
assertThat(dictEntriesOldValue.stream()
|
||||||
.filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier yayy") && dictionaryEntry.isDeleted())).hasSize(1);
|
.filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier yayy") && dictionaryEntry.isDeleted())).hasSize(1);
|
||||||
assertThat(dictEntriesOldValue.stream()
|
assertThat(dictEntriesOldValue.stream()
|
||||||
.filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier yayy") && !dictionaryEntry.isDeleted())).hasSize(1);
|
.filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier yayy") && !dictionaryEntry.isDeleted())).hasSize(1);
|
||||||
var dictEntriesNewValue = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getId(),
|
var dictEntriesNewValue = dictionaryManagementService.getAllEntriesInDossierTemplate(dossierTemplate.getId(), "test redaction in dossier", DictionaryEntryType.ENTRY);
|
||||||
"test redaction in dossier",
|
|
||||||
DictionaryEntryType.ENTRY);
|
|
||||||
assertThat(dictEntriesNewValue.stream().filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier"))).isNotEmpty();
|
assertThat(dictEntriesNewValue.stream().filter(dictionaryEntry -> dictionaryEntry.getValue().equals("test redaction in dossier"))).isNotEmpty();
|
||||||
|
|
||||||
var dictionaryOfTypeDosDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
|
var dictionaryOfTypeDosDictInDossier1 = dictionaryClient.getDictionaryForType(typeDosDict.getType(), dossier1.getDossierTemplateId(), dossier1.getId());
|
||||||
@ -1040,7 +1063,14 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
var annotationId = "AnnotationId";
|
var annotationId = "AnnotationId";
|
||||||
var entityLog = new EntityLog(1,
|
var entityLog = new EntityLog(1,
|
||||||
1,
|
1,
|
||||||
List.of(EntityLogEntry.builder().id(annotationId).type(type.getType()).value(lukeSkywalker).dictionaryEntry(true).entryType(EntryType.ENTITY).state(EntryState.APPLIED).build()),
|
List.of(EntityLogEntry.builder()
|
||||||
|
.id(annotationId)
|
||||||
|
.type(type.getType())
|
||||||
|
.value(lukeSkywalker)
|
||||||
|
.dictionaryEntry(true)
|
||||||
|
.entryType(EntryType.ENTITY)
|
||||||
|
.state(EntryState.APPLIED)
|
||||||
|
.build()),
|
||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -1110,7 +1140,14 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
var annotationId = "AnnotationId";
|
var annotationId = "AnnotationId";
|
||||||
var entityLog = new EntityLog(1,
|
var entityLog = new EntityLog(1,
|
||||||
1,
|
1,
|
||||||
List.of(EntityLogEntry.builder().id(annotationId).type(type.getType()).value(lukeSkywalker).dictionaryEntry(true).entryType(EntryType.ENTITY).state(EntryState.APPLIED).build()),
|
List.of(EntityLogEntry.builder()
|
||||||
|
.id(annotationId)
|
||||||
|
.type(type.getType())
|
||||||
|
.value(lukeSkywalker)
|
||||||
|
.dictionaryEntry(true)
|
||||||
|
.entryType(EntryType.ENTITY)
|
||||||
|
.state(EntryState.APPLIED)
|
||||||
|
.build()),
|
||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -1147,6 +1184,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
assertThat(dossierDictionary2.getEntries()).isEmpty();
|
assertThat(dossierDictionary2.getEntries()).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnprocessedManualRedactionsAddRedaction() {
|
public void testUnprocessedManualRedactionsAddRedaction() {
|
||||||
|
|
||||||
@ -1180,9 +1218,15 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
assertEquals(unprocessedManualRedactions.getEntriesToAdd().size(), 1);
|
assertEquals(unprocessedManualRedactions.getEntriesToAdd().size(), 1);
|
||||||
assertTrue(unprocessedManualRedactions.getEntriesToAdd().stream().anyMatch(entry -> entry.getValue().equals("Luke Skywalker")));
|
assertTrue(unprocessedManualRedactions.getEntriesToAdd().stream().anyMatch(entry -> entry.getValue().equals("Luke Skywalker")));
|
||||||
|
|
||||||
fileProcessingClient.analysisSuccessful(dossier.getId(), file.getId(), AnalyzeResult.builder()
|
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
||||||
.manualRedactions(allManualRedactions)
|
file.getId(),
|
||||||
.messageType(MessageType.ANALYSE).analysisVersion(0).fileId(file.getId()).dossierId(dossier.getId()).build());
|
AnalyzeResult.builder()
|
||||||
|
.manualRedactions(allManualRedactions)
|
||||||
|
.messageType(MessageType.ANALYSE)
|
||||||
|
.analysisVersion(0)
|
||||||
|
.fileId(file.getId())
|
||||||
|
.dossierId(dossier.getId())
|
||||||
|
.build());
|
||||||
|
|
||||||
manualRedactionClient.addRedactionBulk(dossier.getId(),
|
manualRedactionClient.addRedactionBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
@ -1209,9 +1253,15 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
assertTrue(unprocessedManualRedactions.getEntriesToAdd().stream().anyMatch(entry -> entry.getValue().equals("Skywalker Luke")));
|
assertTrue(unprocessedManualRedactions.getEntriesToAdd().stream().anyMatch(entry -> entry.getValue().equals("Skywalker Luke")));
|
||||||
assertTrue(unprocessedManualRedactions.getEntriesToAdd().stream().noneMatch(entry -> entry.getValue().equals("Luke Skywalker")));
|
assertTrue(unprocessedManualRedactions.getEntriesToAdd().stream().noneMatch(entry -> entry.getValue().equals("Luke Skywalker")));
|
||||||
|
|
||||||
fileProcessingClient.analysisSuccessful(dossier.getId(), file.getId(), AnalyzeResult.builder()
|
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
||||||
.manualRedactions(allManualRedactions)
|
file.getId(),
|
||||||
.messageType(MessageType.ANALYSE).analysisVersion(1).fileId(file.getId()).dossierId(dossier.getId()).build());
|
AnalyzeResult.builder()
|
||||||
|
.manualRedactions(allManualRedactions)
|
||||||
|
.messageType(MessageType.ANALYSE)
|
||||||
|
.analysisVersion(1)
|
||||||
|
.fileId(file.getId())
|
||||||
|
.dossierId(dossier.getId())
|
||||||
|
.build());
|
||||||
|
|
||||||
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
||||||
assertEquals(allManualRedactions.getEntriesToAdd().size(), 2);
|
assertEquals(allManualRedactions.getEntriesToAdd().size(), 2);
|
||||||
@ -1224,6 +1274,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
dictionaryClient.addEntry(type.getType(), type.getDossierTemplateId(), List.of("Luke Skywalker"), false, dossier.getId(), DictionaryEntryType.ENTRY);
|
dictionaryClient.addEntry(type.getType(), type.getDossierTemplateId(), List.of("Luke Skywalker"), false, dossier.getId(), DictionaryEntryType.ENTRY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnprocessedManualRedactionsRemoveRedaction() {
|
public void testUnprocessedManualRedactionsRemoveRedaction() {
|
||||||
|
|
||||||
@ -1237,8 +1288,22 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
var entityLog = new EntityLog(1,
|
var entityLog = new EntityLog(1,
|
||||||
1,
|
1,
|
||||||
List.of(EntityLogEntry.builder().id("AnnotationId").type(type.getType()).value("Anakin").entryType(EntryType.ENTITY).state(EntryState.APPLIED).dictionaryEntry(false).build(),
|
List.of(EntityLogEntry.builder()
|
||||||
EntityLogEntry.builder().id("AnnotationId2").type(type.getType()).value("Anakin2").entryType(EntryType.ENTITY).state(EntryState.APPLIED).dictionaryEntry(false).build()),
|
.id("AnnotationId")
|
||||||
|
.type(type.getType())
|
||||||
|
.value("Anakin")
|
||||||
|
.entryType(EntryType.ENTITY)
|
||||||
|
.state(EntryState.APPLIED)
|
||||||
|
.dictionaryEntry(false)
|
||||||
|
.build(),
|
||||||
|
EntityLogEntry.builder()
|
||||||
|
.id("AnnotationId2")
|
||||||
|
.type(type.getType())
|
||||||
|
.value("Anakin2")
|
||||||
|
.entryType(EntryType.ENTITY)
|
||||||
|
.state(EntryState.APPLIED)
|
||||||
|
.dictionaryEntry(false)
|
||||||
|
.build()),
|
||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -1262,7 +1327,13 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
AnalyzeResult.builder().manualRedactions(allManualRedactions).messageType(MessageType.ANALYSE).analysisVersion(0).fileId(file.getId()).dossierId(dossier.getId()).build());
|
AnalyzeResult.builder()
|
||||||
|
.manualRedactions(allManualRedactions)
|
||||||
|
.messageType(MessageType.ANALYSE)
|
||||||
|
.analysisVersion(0)
|
||||||
|
.fileId(file.getId())
|
||||||
|
.dossierId(dossier.getId())
|
||||||
|
.build());
|
||||||
|
|
||||||
manualRedactionClient.removeRedactionBulk(dossier.getId(),
|
manualRedactionClient.removeRedactionBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
@ -1280,7 +1351,13 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
AnalyzeResult.builder().manualRedactions(allManualRedactions).messageType(MessageType.ANALYSE).analysisVersion(1).fileId(file.getId()).dossierId(dossier.getId()).build());
|
AnalyzeResult.builder()
|
||||||
|
.manualRedactions(allManualRedactions)
|
||||||
|
.messageType(MessageType.ANALYSE)
|
||||||
|
.analysisVersion(1)
|
||||||
|
.fileId(file.getId())
|
||||||
|
.dossierId(dossier.getId())
|
||||||
|
.build());
|
||||||
|
|
||||||
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
||||||
assertEquals(allManualRedactions.getIdsToRemove().size(), 2);
|
assertEquals(allManualRedactions.getIdsToRemove().size(), 2);
|
||||||
@ -1291,6 +1368,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
assertTrue(unprocessedManualRedactions.getIdsToRemove().isEmpty());
|
assertTrue(unprocessedManualRedactions.getIdsToRemove().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnprocessedManualRedactionsForceRedaction() {
|
public void testUnprocessedManualRedactionsForceRedaction() {
|
||||||
|
|
||||||
@ -1312,7 +1390,13 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
AnalyzeResult.builder().manualRedactions(allManualRedactions).messageType(MessageType.ANALYSE).analysisVersion(0).fileId(file.getId()).dossierId(dossier.getId()).build());
|
AnalyzeResult.builder()
|
||||||
|
.manualRedactions(allManualRedactions)
|
||||||
|
.messageType(MessageType.ANALYSE)
|
||||||
|
.analysisVersion(0)
|
||||||
|
.fileId(file.getId())
|
||||||
|
.dossierId(dossier.getId())
|
||||||
|
.build());
|
||||||
|
|
||||||
manualRedactionClient.forceRedactionBulk(dossier.getId(),
|
manualRedactionClient.forceRedactionBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
@ -1330,7 +1414,13 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
AnalyzeResult.builder().manualRedactions(allManualRedactions).messageType(MessageType.ANALYSE).analysisVersion(1).fileId(file.getId()).dossierId(dossier.getId()).build());
|
AnalyzeResult.builder()
|
||||||
|
.manualRedactions(allManualRedactions)
|
||||||
|
.messageType(MessageType.ANALYSE)
|
||||||
|
.analysisVersion(1)
|
||||||
|
.fileId(file.getId())
|
||||||
|
.dossierId(dossier.getId())
|
||||||
|
.build());
|
||||||
|
|
||||||
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
||||||
assertEquals(allManualRedactions.getForceRedactions().size(), 2);
|
assertEquals(allManualRedactions.getForceRedactions().size(), 2);
|
||||||
@ -1341,8 +1431,9 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
assertTrue(unprocessedManualRedactions.getForceRedactions().isEmpty());
|
assertTrue(unprocessedManualRedactions.getForceRedactions().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testUnprocessedManualRedactionsRecategorizations() {
|
@Test
|
||||||
|
public void testUnprocessedManualRedactionsRecategorizations() {
|
||||||
|
|
||||||
var dossierTemplate = dossierTemplateTesterAndProvider.provideTestTemplate();
|
var dossierTemplate = dossierTemplateTesterAndProvider.provideTestTemplate();
|
||||||
var dossier = dossierTesterAndProvider.provideTestDossier(dossierTemplate);
|
var dossier = dossierTesterAndProvider.provideTestDossier(dossierTemplate);
|
||||||
@ -1354,8 +1445,22 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
var entityLog = new EntityLog(1,
|
var entityLog = new EntityLog(1,
|
||||||
1,
|
1,
|
||||||
List.of(EntityLogEntry.builder().id("dv").type(type.getType()).value("Darth Vader").entryType(EntryType.ENTITY).state(EntryState.APPLIED).dictionaryEntry(false).build(),
|
List.of(EntityLogEntry.builder()
|
||||||
EntityLogEntry.builder().id("dv2").type(type.getType()).value("Vader Darth").entryType(EntryType.ENTITY).state(EntryState.APPLIED).dictionaryEntry(false).build()),
|
.id("dv")
|
||||||
|
.type(type.getType())
|
||||||
|
.value("Darth Vader")
|
||||||
|
.entryType(EntryType.ENTITY)
|
||||||
|
.state(EntryState.APPLIED)
|
||||||
|
.dictionaryEntry(false)
|
||||||
|
.build(),
|
||||||
|
EntityLogEntry.builder()
|
||||||
|
.id("dv2")
|
||||||
|
.type(type.getType())
|
||||||
|
.value("Vader Darth")
|
||||||
|
.entryType(EntryType.ENTITY)
|
||||||
|
.state(EntryState.APPLIED)
|
||||||
|
.dictionaryEntry(false)
|
||||||
|
.build()),
|
||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -1365,9 +1470,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
when(entityLogService.getEntityLog(Mockito.any(), Mockito.any())).thenReturn(entityLog);
|
when(entityLogService.getEntityLog(Mockito.any(), Mockito.any())).thenReturn(entityLog);
|
||||||
|
|
||||||
manualRedactionClient.recategorizeBulk(dossier.getId(),
|
manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(RecategorizationRequestModel.builder().annotationId("dv").build()));
|
||||||
file.getId(),
|
|
||||||
Set.of(RecategorizationRequestModel.builder().annotationId("dv").build()));
|
|
||||||
|
|
||||||
var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
||||||
assertEquals(allManualRedactions.getRecategorizations().size(), 1);
|
assertEquals(allManualRedactions.getRecategorizations().size(), 1);
|
||||||
@ -1379,11 +1482,15 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
AnalyzeResult.builder().manualRedactions(allManualRedactions).messageType(MessageType.ANALYSE).analysisVersion(0).fileId(file.getId()).dossierId(dossier.getId()).build());
|
AnalyzeResult.builder()
|
||||||
|
.manualRedactions(allManualRedactions)
|
||||||
|
.messageType(MessageType.ANALYSE)
|
||||||
|
.analysisVersion(0)
|
||||||
|
.fileId(file.getId())
|
||||||
|
.dossierId(dossier.getId())
|
||||||
|
.build());
|
||||||
|
|
||||||
manualRedactionClient.recategorizeBulk(dossier.getId(),
|
manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(RecategorizationRequestModel.builder().annotationId("dv2").build()));
|
||||||
file.getId(),
|
|
||||||
Set.of(RecategorizationRequestModel.builder().annotationId("dv2").build()));
|
|
||||||
|
|
||||||
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
||||||
assertEquals(allManualRedactions.getRecategorizations().size(), 2);
|
assertEquals(allManualRedactions.getRecategorizations().size(), 2);
|
||||||
@ -1397,7 +1504,13 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
AnalyzeResult.builder().manualRedactions(allManualRedactions).messageType(MessageType.ANALYSE).analysisVersion(1).fileId(file.getId()).dossierId(dossier.getId()).build());
|
AnalyzeResult.builder()
|
||||||
|
.manualRedactions(allManualRedactions)
|
||||||
|
.messageType(MessageType.ANALYSE)
|
||||||
|
.analysisVersion(1)
|
||||||
|
.fileId(file.getId())
|
||||||
|
.dossierId(dossier.getId())
|
||||||
|
.build());
|
||||||
|
|
||||||
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
||||||
assertEquals(allManualRedactions.getRecategorizations().size(), 2);
|
assertEquals(allManualRedactions.getRecategorizations().size(), 2);
|
||||||
@ -1408,6 +1521,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
assertTrue(unprocessedManualRedactions.getRecategorizations().isEmpty());
|
assertTrue(unprocessedManualRedactions.getRecategorizations().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnprocessedManualRedactionsLegalBasisChanges() {
|
public void testUnprocessedManualRedactionsLegalBasisChanges() {
|
||||||
|
|
||||||
@ -1421,8 +1535,22 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
var entityLog = new EntityLog(1,
|
var entityLog = new EntityLog(1,
|
||||||
1,
|
1,
|
||||||
List.of(EntityLogEntry.builder().id("AnnotationId").type(type.getType()).value("Luke Skywalker").entryType(EntryType.ENTITY).state(EntryState.APPLIED).dictionaryEntry(false).build(),
|
List.of(EntityLogEntry.builder()
|
||||||
EntityLogEntry.builder().id("AnnotationId2").type(type.getType()).value("Skywalker Luke").entryType(EntryType.ENTITY).state(EntryState.APPLIED).dictionaryEntry(false).build()),
|
.id("AnnotationId")
|
||||||
|
.type(type.getType())
|
||||||
|
.value("Luke Skywalker")
|
||||||
|
.entryType(EntryType.ENTITY)
|
||||||
|
.state(EntryState.APPLIED)
|
||||||
|
.dictionaryEntry(false)
|
||||||
|
.build(),
|
||||||
|
EntityLogEntry.builder()
|
||||||
|
.id("AnnotationId2")
|
||||||
|
.type(type.getType())
|
||||||
|
.value("Skywalker Luke")
|
||||||
|
.entryType(EntryType.ENTITY)
|
||||||
|
.state(EntryState.APPLIED)
|
||||||
|
.dictionaryEntry(false)
|
||||||
|
.build()),
|
||||||
null,
|
null,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -1446,7 +1574,13 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
AnalyzeResult.builder().manualRedactions(allManualRedactions).messageType(MessageType.ANALYSE).analysisVersion(0).fileId(file.getId()).dossierId(dossier.getId()).build());
|
AnalyzeResult.builder()
|
||||||
|
.manualRedactions(allManualRedactions)
|
||||||
|
.messageType(MessageType.ANALYSE)
|
||||||
|
.analysisVersion(0)
|
||||||
|
.fileId(file.getId())
|
||||||
|
.dossierId(dossier.getId())
|
||||||
|
.build());
|
||||||
|
|
||||||
manualRedactionClient.legalBasisChangeBulk(dossier.getId(),
|
manualRedactionClient.legalBasisChangeBulk(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
@ -1464,7 +1598,13 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
|
|
||||||
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
fileProcessingClient.analysisSuccessful(dossier.getId(),
|
||||||
file.getId(),
|
file.getId(),
|
||||||
AnalyzeResult.builder().manualRedactions(allManualRedactions).messageType(MessageType.ANALYSE).analysisVersion(1).fileId(file.getId()).dossierId(dossier.getId()).build());
|
AnalyzeResult.builder()
|
||||||
|
.manualRedactions(allManualRedactions)
|
||||||
|
.messageType(MessageType.ANALYSE)
|
||||||
|
.analysisVersion(1)
|
||||||
|
.fileId(file.getId())
|
||||||
|
.dossierId(dossier.getId())
|
||||||
|
.build());
|
||||||
|
|
||||||
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false);
|
||||||
assertEquals(allManualRedactions.getLegalBasisChanges().size(), 2);
|
assertEquals(allManualRedactions.getLegalBasisChanges().size(), 2);
|
||||||
@ -1475,4 +1615,59 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
|
|||||||
assertTrue(unprocessedManualRedactions.getResizeRedactions().isEmpty());
|
assertTrue(unprocessedManualRedactions.getResizeRedactions().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRemoveManualRedactionEntityRemovesAllManualRedactions() {
|
||||||
|
|
||||||
|
var dossierTemplate = dossierTemplateTesterAndProvider.provideTestTemplate();
|
||||||
|
var dossier = dossierTesterAndProvider.provideTestDossier(dossierTemplate);
|
||||||
|
var file = fileTesterAndProvider.testAndProvideFile(dossier);
|
||||||
|
String type = "manual";
|
||||||
|
String value = "Luke Skywalker";
|
||||||
|
var manualAddResponse = manualRedactionClient.addRedactionBulk(dossier.getId(),
|
||||||
|
file.getId(),
|
||||||
|
Set.of(AddRedactionRequestModel.builder()
|
||||||
|
.sourceId("sourceId")
|
||||||
|
.type(type)
|
||||||
|
.value(value)
|
||||||
|
.reason("Reason")
|
||||||
|
.positions(List.of(new Rectangle(new Point(0, 0), 100, 100, 0)))
|
||||||
|
.build())).get(0);
|
||||||
|
String annotationId = manualAddResponse.getAnnotationId();
|
||||||
|
var entityLog = new EntityLog(1,
|
||||||
|
1,
|
||||||
|
List.of(EntityLogEntry.builder().id(annotationId).type(type).value(value).entryType(EntryType.ENTITY).state(EntryState.APPLIED).dictionaryEntry(false).build()),
|
||||||
|
null,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
fileManagementStorageService.storeJSONObject(dossier.getId(), file.getId(), FileType.ENTITY_LOG, entityLog);
|
||||||
|
|
||||||
|
when(entityLogService.getEntityLog(Mockito.any(), Mockito.any())).thenReturn(entityLog);
|
||||||
|
|
||||||
|
assertEquals(1, manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getEntriesToAdd().size());
|
||||||
|
assertEquals(annotationId,
|
||||||
|
manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getEntriesToAdd().stream().findFirst().orElseThrow().getAnnotationId());
|
||||||
|
manualRedactionClient.legalBasisChangeBulk(dossier.getId(),
|
||||||
|
file.getId(),
|
||||||
|
Set.of(LegalBasisChangeRequestModel.builder().annotationId(annotationId).legalBasis("some legal basis").build()));
|
||||||
|
manualRedactionClient.forceRedactionBulk(dossier.getId(), file.getId(), Set.of(ForceRedactionRequestModel.builder().annotationId(annotationId).build()));
|
||||||
|
manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(RecategorizationRequestModel.builder().annotationId(annotationId).type("other type").build()));
|
||||||
|
manualRedactionClient.resizeRedactionBulk(dossier.getId(),
|
||||||
|
file.getId(),
|
||||||
|
Set.of(ResizeRedactionRequestModel.builder()
|
||||||
|
.annotationId(annotationId)
|
||||||
|
.value("Luke Skywalker and some more text")
|
||||||
|
.positions(List.of(new Rectangle(new Point(10, 10), 100, 100, 1)))
|
||||||
|
.build()));
|
||||||
|
manualRedactionClient.removeRedactionBulk(dossier.getId(), file.getId(), Set.of(RemoveRedactionRequestModel.builder().annotationId(annotationId).build()));
|
||||||
|
assertTrue(manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getEntriesToAdd().isEmpty());
|
||||||
|
assertTrue(manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getLegalBasisChanges().isEmpty());
|
||||||
|
assertTrue(manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getForceRedactions().isEmpty());
|
||||||
|
assertTrue(manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getRecategorizations().isEmpty());
|
||||||
|
assertTrue(manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getResizeRedactions().isEmpty());
|
||||||
|
assertEquals(1, manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false).getIdsToRemove().size());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user