RED-8480: added property value for recategorizations and fixed bugs not updating legal basis and section

This commit is contained in:
Ali Oezyetimoglu 2024-03-26 17:36:58 +01:00
parent 45a0ca1800
commit 6601ee0188
9 changed files with 40 additions and 2 deletions

View File

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

View File

@ -345,10 +345,21 @@ public class EntityLogMergeService {
boolean isHint = isHint(recategorization.getType(), dossier);
entityLogEntry.setType(recategorization.getType());
if (!Strings.isNullOrEmpty(recategorization.getType())) {
entityLogEntry.setType(recategorization.getType());
}
entityLogEntry.setEntryType(getEntryType(isHint, recategorization.getType()));
entityLogEntry.setState(isHint ? EntryState.SKIPPED : EntryState.APPLIED);
entityLogEntry.getEngines().add(Engine.MANUAL);
if (!Strings.isNullOrEmpty(recategorization.getLegalBasis())) {
entityLogEntry.setLegalBasis(recategorization.getLegalBasis());
}
if (!Strings.isNullOrEmpty(recategorization.getSection())) {
entityLogEntry.setSection(recategorization.getSection());
}
if (!Strings.isNullOrEmpty(recategorization.getValue())) {
entityLogEntry.setValue(recategorization.getValue());
}
addChanges(entityLogEntry.getChanges(), ChangeType.CHANGED, analysisNumber, recategorization.getRequestDate());
entityLogEntry.getManualChanges()
.add(ManualChange.builder()
@ -373,6 +384,9 @@ public class EntityLogMergeService {
if (!Strings.isNullOrEmpty(recategorization.getSection())) {
propertyChanges.put("section", recategorization.getSection());
}
if (!Strings.isNullOrEmpty(recategorization.getValue())) {
propertyChanges.put("value", recategorization.getValue());
}
return propertyChanges;
}

View File

@ -161,6 +161,7 @@ public class ManualRedactionMapper {
.legalBasis(Optional.ofNullable(recategorizationRequest.getLegalBasis())
.orElse(""))
.section(recategorizationRequest.getSection())
.value(recategorizationRequest.getValue())
.build();
requests.add(build);
}

View File

@ -172,7 +172,9 @@ public class PendingDictionaryEntryFactory {
"legalBasis",
manualChange.getLegalBasis(),
"section",
manualChange.getSection()))
manualChange.getSection(),
"value",
manualChange.getValue()))
.build());
return EntityLogEntry.builder()

View File

@ -191,3 +191,5 @@ databaseChangeLog:
file: db/changelog/tenant/sql/206-remove-manual-redactions-on-non-existing-pages.sql
- include:
file: db/changelog/tenant/122-add-legal-basis-variables-to-recategorize.yaml
- include:
file: db/changelog/tenant/123-add-value-to-recategorize.yaml

View File

@ -0,0 +1,11 @@
databaseChangeLog:
- changeSet:
id: add-legal-basis-variables-to-recategorize
author: ali
changes:
- addColumn:
tableName: manual_recategorization
columns:
- column:
name: value
type: VARCHAR(4000)

View File

@ -1199,6 +1199,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.addToAllDossiers(true)
.legalBasis("")
.section("section")
.value(lukeSkywalker)
.build()),
false);
@ -1284,6 +1285,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.addToAllDossiers(false)
.legalBasis("")
.section("section")
.value(lukeSkywalker)
.build()),
false);
@ -1966,6 +1968,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.addToAllDossiers(true)
.legalBasis("")
.section("section")
.value("other value")
.build();
var recatModelLongLegalBasis = RecategorizationRequestModel.builder()
.type(type.getType())
@ -1979,6 +1982,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.annotationId("annotationId3")
.addToDictionary(true)
.section("section")
.value("some value")
.addToAllDossiers(true)
.build();

View File

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

View File

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