RED-8820: removed property "value" from recategorize

(cherry picked from commit a5e3c0c98abe5546967dfddcb563b70dd86a3c71)
This commit is contained in:
Ali Oezyetimoglu 2024-03-20 12:54:23 +01:00
parent 3824a25a2c
commit 1b9eb72814
7 changed files with 45 additions and 23 deletions

View File

@ -51,8 +51,6 @@ public class ManualRecategorizationEntity implements IBaseAnnotation {
private String legalBasis; private String legalBasis;
@Column(length = 1024) @Column(length = 1024)
private String section; private String section;
@Column
private String value;
@ManyToOne @ManyToOne
private FileEntity fileStatus; private FileEntity fileStatus;

View File

@ -356,9 +356,6 @@ public class EntityLogMergeService {
if (!Strings.isNullOrEmpty(recategorization.getLegalBasis())) { if (!Strings.isNullOrEmpty(recategorization.getLegalBasis())) {
propertyChanges.put("legalBasis", recategorization.getLegalBasis()); propertyChanges.put("legalBasis", recategorization.getLegalBasis());
} }
if (!Strings.isNullOrEmpty(recategorization.getValue())) {
propertyChanges.put("value", recategorization.getValue());
}
if (!Strings.isNullOrEmpty(recategorization.getSection())) { if (!Strings.isNullOrEmpty(recategorization.getSection())) {
propertyChanges.put("section", recategorization.getSection()); propertyChanges.put("section", recategorization.getSection());
} }

View File

@ -171,8 +171,6 @@ public class PendingDictionaryEntryFactory {
manualChange.getType(), manualChange.getType(),
"legalBasis", "legalBasis",
manualChange.getLegalBasis(), manualChange.getLegalBasis(),
"value",
manualChange.getValue(),
"section", "section",
manualChange.getSection())) manualChange.getSection()))
.build()); .build());

View File

@ -9,6 +9,3 @@ databaseChangeLog:
- column: - column:
name: section name: section
type: VARCHAR(1024) type: VARCHAR(1024)
- column:
name: value
type: VARCHAR(4000)

View File

@ -267,6 +267,35 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
} }
@Test
public void testAddToDictionaryEntryWithCarriageReturn() {
var dossierTemplate = dossierTemplateTesterAndProvider.provideTestTemplate();
var dossier = dossierTesterAndProvider.provideTestDossier(dossierTemplate);
var file = fileTesterAndProvider.testAndProvideFile(dossier);
var type = typeProvider.testAndProvideType(dossierTemplate);
manualRedactionClient.addRedactionBulk(dossier.getId(),
file.getId(),
Set.of(AddRedactionRequestModel.builder()
.positions(List.of(Rectangle.builder().topLeftY(1).topLeftX(1).height(1).width(1).build()))
.section("section test")
.addToDictionary(true)
.addToAllDossiers(false)
.type(type.getType())
.reason("1")
.value("Luke Skywalker\r")
.legalBasis("1")
.sourceId("SourceId")
.build()));
var dossierDictionary = internalDictionaryClient.getDictionaryForType(toTypeId(type.getType(), dossierTemplate.getId(), dossier.getId()), null);
assertThat(dossierDictionary.getEntries().size()).isEqualTo(1);
assertEquals(dossierDictionary.getEntries()
.get(0).getValue(), "Luke Skywalker ");
}
@Test @Test
public void testManualRemoveFromAllDossiersAndUndo() { public void testManualRemoveFromAllDossiersAndUndo() {
@ -1170,7 +1199,6 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.addToAllDossiers(true) .addToAllDossiers(true)
.legalBasis("") .legalBasis("")
.section("section") .section("section")
.value("some value")
.build()), .build()),
false); false);
@ -1256,7 +1284,6 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.addToAllDossiers(false) .addToAllDossiers(false)
.legalBasis("") .legalBasis("")
.section("section") .section("section")
.value("some value")
.build()), .build()),
false); false);
@ -1627,7 +1654,10 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
when(entityLogService.getEntityLog(Mockito.any(), Mockito.any(), any(), anyBoolean())).thenReturn(entityLog); when(entityLogService.getEntityLog(Mockito.any(), Mockito.any(), any(), anyBoolean())).thenReturn(entityLog);
manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(RecategorizationRequestModel.builder().annotationId("dv").legalBasis("").section("section").value("").build()), false); manualRedactionClient.recategorizeBulk(dossier.getId(),
file.getId(),
Set.of(RecategorizationRequestModel.builder().annotationId("dv").legalBasis("").section("section").build()),
false);
var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false, true); var allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false, true);
assertEquals(allManualRedactions.getRecategorizations().size(), 1); assertEquals(allManualRedactions.getRecategorizations().size(), 1);
@ -1651,7 +1681,10 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.dossierId(dossier.getId()) .dossierId(dossier.getId())
.build()); .build());
manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(RecategorizationRequestModel.builder().annotationId("dv2").legalBasis("").section("section").value("value").build()), false); manualRedactionClient.recategorizeBulk(dossier.getId(),
file.getId(),
Set.of(RecategorizationRequestModel.builder().annotationId("dv2").legalBasis("").section("section").build()),
false);
allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false, true); allManualRedactions = manualRedactionClient.getManualRedactions(dossier.getId(), file.getId(), false, true);
assertEquals(allManualRedactions.getRecategorizations().size(), 2); assertEquals(allManualRedactions.getRecategorizations().size(), 2);
@ -1855,7 +1888,6 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.addToAllDossiers(true) .addToAllDossiers(true)
.legalBasis("") .legalBasis("")
.section("section") .section("section")
.value("value")
.build(); .build();
var recatModelLongLegalBasis = RecategorizationRequestModel.builder() var recatModelLongLegalBasis = RecategorizationRequestModel.builder()
.type(type.getType()) .type(type.getType())
@ -1864,7 +1896,13 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.addToAllDossiers(true) .addToAllDossiers(true)
.legalBasis(RandomStringUtils.randomAlphanumeric(4001)) .legalBasis(RandomStringUtils.randomAlphanumeric(4001))
.build(); .build();
var recatModelNoLegalBasis = RecategorizationRequestModel.builder().type(type.getType()).annotationId("annotationId3").addToDictionary(true).section("section").value("some value").addToAllDossiers(true).build(); var recatModelNoLegalBasis = RecategorizationRequestModel.builder()
.type(type.getType())
.annotationId("annotationId3")
.addToDictionary(true)
.section("section")
.addToAllDossiers(true)
.build();
manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recatModel, recatModelNoLegalBasis), false); manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recatModel, recatModelNoLegalBasis), false);
@ -2015,7 +2053,6 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.addToAllDossiers(false) .addToAllDossiers(false)
.legalBasis("lb2") .legalBasis("lb2")
.section("section") .section("section")
.value("lukeSkywalker")
.build(); .build();
manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recatModel), false); manualRedactionClient.recategorizeBulk(dossier.getId(), file.getId(), Set.of(recatModel), false);
@ -2031,9 +2068,6 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
assertTrue(allManualRedactions.getRecategorizations() assertTrue(allManualRedactions.getRecategorizations()
.stream() .stream()
.anyMatch(entry -> entry.getSection().equals("section"))); .anyMatch(entry -> entry.getSection().equals("section")));
assertTrue(allManualRedactions.getRecategorizations()
.stream()
.anyMatch(entry -> entry.getValue().equals("lukeSkywalker")));
} }
} }

View File

@ -18,7 +18,6 @@ public class ManualRecategorization extends BaseAnnotation {
private boolean addToDictionary; private boolean addToDictionary;
private boolean addToAllDossiers; private boolean addToAllDossiers;
private String section; private String section;
private String value;
@Override @Override

View File

@ -21,6 +21,5 @@ public class RecategorizationRequestModel {
boolean addToAllDossiers; boolean addToAllDossiers;
String legalBasis; String legalBasis;
String section; String section;
String value;
} }