Merge branch 'RED-8480-bp2' into 'release/2.349.x'

RED-8480: added property value for recategorizations and fixed bugs not...

See merge request redactmanager/persistence-service!407
This commit is contained in:
Ali Oezyetimoglu 2024-03-27 09:56:00 +01:00
commit 3a6f39dc48
9 changed files with 40 additions and 2 deletions

View File

@ -51,6 +51,8 @@ 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

@ -347,10 +347,21 @@ public class EntityLogMergeService {
boolean isHint = isHint(recategorization.getType(), dossier); 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.setEntryType(getEntryType(isHint, recategorization.getType()));
entityLogEntry.setState(isHint ? EntryState.SKIPPED : EntryState.APPLIED); entityLogEntry.setState(isHint ? EntryState.SKIPPED : EntryState.APPLIED);
entityLogEntry.getEngines().add(Engine.MANUAL); 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()); addChanges(entityLogEntry.getChanges(), ChangeType.CHANGED, analysisNumber, recategorization.getRequestDate());
entityLogEntry.getManualChanges() entityLogEntry.getManualChanges()
@ -376,6 +387,9 @@ public class EntityLogMergeService {
if (!Strings.isNullOrEmpty(recategorization.getSection())) { if (!Strings.isNullOrEmpty(recategorization.getSection())) {
propertyChanges.put("section", recategorization.getSection()); propertyChanges.put("section", recategorization.getSection());
} }
if (!Strings.isNullOrEmpty(recategorization.getValue())) {
propertyChanges.put("value", recategorization.getValue());
}
return propertyChanges; return propertyChanges;
} }

View File

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

View File

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

View File

@ -191,3 +191,5 @@ databaseChangeLog:
file: db/changelog/tenant/sql/206-remove-manual-redactions-on-non-existing-pages.sql file: db/changelog/tenant/sql/206-remove-manual-redactions-on-non-existing-pages.sql
- include: - include:
file: db/changelog/tenant/122-add-legal-basis-variables-to-recategorize.yaml 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) .addToAllDossiers(true)
.legalBasis("") .legalBasis("")
.section("section") .section("section")
.value(lukeSkywalker)
.build()), .build()),
false); false);
@ -1284,6 +1285,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.addToAllDossiers(false) .addToAllDossiers(false)
.legalBasis("") .legalBasis("")
.section("section") .section("section")
.value(lukeSkywalker)
.build()), .build()),
false); false);
@ -1888,6 +1890,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.addToAllDossiers(true) .addToAllDossiers(true)
.legalBasis("") .legalBasis("")
.section("section") .section("section")
.value("other value")
.build(); .build();
var recatModelLongLegalBasis = RecategorizationRequestModel.builder() var recatModelLongLegalBasis = RecategorizationRequestModel.builder()
.type(type.getType()) .type(type.getType())
@ -1901,6 +1904,7 @@ public class ManualRedactionTest extends AbstractPersistenceServerServiceTest {
.annotationId("annotationId3") .annotationId("annotationId3")
.addToDictionary(true) .addToDictionary(true)
.section("section") .section("section")
.value("some value")
.addToAllDossiers(true) .addToAllDossiers(true)
.build(); .build();

View File

@ -18,6 +18,7 @@ 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,5 +21,6 @@ public class RecategorizationRequestModel {
boolean addToAllDossiers; boolean addToAllDossiers;
String legalBasis; String legalBasis;
String section; String section;
String value;
} }