Merge branch 'RED-9104' into 'master'

RED-9104: Rectangle redaction cannot be removed

Closes RED-9104

See merge request redactmanager/redaction-service!390
This commit is contained in:
Maverick Studer 2024-05-03 13:36:32 +02:00
commit af8a7dac42
3 changed files with 53 additions and 2 deletions

View File

@ -7,7 +7,7 @@ description = "redaction-service-api-v1"
dependencies {
implementation("org.springframework:spring-web:6.0.12")
implementation("com.iqser.red.service:persistence-service-internal-api-v1:2.407.0")
implementation("com.iqser.red.service:persistence-service-internal-api-v1:2.410.0")
}
publishing {

View File

@ -16,7 +16,7 @@ val layoutParserVersion = "0.116.0"
val jacksonVersion = "2.15.2"
val droolsVersion = "9.44.0.Final"
val pdfBoxVersion = "3.0.0"
val persistenceServiceVersion = "2.407.0"
val persistenceServiceVersion = "2.410.0"
val springBootStarterVersion = "3.1.5"
val springCloudVersion = "4.0.4"
val testContainersVersion = "1.19.7"

View File

@ -1531,6 +1531,57 @@ public class RedactionIntegrationTest extends RulesIntegrationTest {
.get().getState(), EntryState.APPLIED);
}
@Test
@SneakyThrows
public void testRemoveRectangleRedaction() {
String pdfFile = "files/syngenta/CustomerFiles/SinglePages/test1S1T1.pdf";
String manualAddId = UUID.randomUUID().toString();
List<Rectangle> positions = List.of(Rectangle.builder().topLeftX(305.35f).topLeftY(332.5033f).width(71.40744f).height(13.645125f).page(1).build());
ManualRedactionEntry manualRedactionEntry = getManualRedactionEntry(manualAddId,
positions,
"the manufacturing or production process, including the method and innovative aspects thereof, as well as other technical and industrial specifications inherent to that process or method, except for information which is relevant to the assessment of safety");
manualRedactionEntry.setRectangle(true);
IdRemoval idRemoval = getIdRemoval(manualAddId);
AnalyzeRequest request = uploadFileToStorage(pdfFile);
request.setManualRedactions(ManualRedactions.builder().entriesToAdd(Set.of(manualRedactionEntry)).build());
analyzeDocumentStructure(LayoutParsingType.REDACT_MANAGER, request);
request.setAnalysisNumber(1);
analyzeService.analyze(request);
var entityLog = redactionStorageService.getEntityLog(TEST_DOSSIER_ID, TEST_FILE_ID);
assertTrue(entityLog.getEntityLogEntry()
.stream()
.anyMatch(entityLogEntry -> entityLogEntry.getId().equals(manualAddId)));
assertEquals(entityLog.getEntityLogEntry()
.stream()
.filter(entityLogEntry -> entityLogEntry.getId().equals(manualAddId))
.findFirst()
.get().getState(), EntryState.APPLIED);
manualRedactionEntry.setProcessedDate(OffsetDateTime.now());
request.setManualRedactions(ManualRedactions.builder().entriesToAdd(Set.of(manualRedactionEntry)).idsToRemove(Set.of(idRemoval)).build());
request.setAnalysisNumber(2);
analyzeService.reanalyze(request);
entityLog = redactionStorageService.getEntityLog(TEST_DOSSIER_ID, TEST_FILE_ID);
assertTrue(entityLog.getEntityLogEntry()
.stream()
.anyMatch(entityLogEntry -> entityLogEntry.getId().equals(manualAddId)));
assertEquals(entityLog.getEntityLogEntry()
.stream()
.filter(entityLogEntry -> entityLogEntry.getId().equals(manualAddId))
.findFirst()
.get().getState(), EntryState.REMOVED);
}
@Test
@SneakyThrows