Pull request #225: RED-2167 rs1

Merge in RED/redaction-service from RED-2167-rs1 to master

* commit 'ff97cba0c8935a44edf912310a459df879522c71':
  RED-2167: added computation of cellstarts for tables with two colums
  Adding persistence tests for  file-management-service-processor
  Testcommit
This commit is contained in:
Ali Oezyetimoglu 2021-09-15 13:40:50 +02:00
commit 86b28b0612
4 changed files with 15 additions and 4 deletions

View File

@ -142,7 +142,11 @@ public class SectionTextBuilderService {
SearchableText entireTableText = new SearchableText();
SectionText sectionText = new SectionText();
int start = 0;
List<Integer> cellStarts = new ArrayList<>();
for (List<Cell> row : table.getRows()) {
for (Cell cell : row) {
if (CollectionUtils.isEmpty(cell.getTextBlocks())) {
continue;
@ -160,8 +164,14 @@ public class SectionTextBuilderService {
for (TextBlock textBlock : cell.getTextBlocks()) {
entireTableText.addAll(textBlock.getSequences());
}
cellStarts.add(start);
start = start + cell.toString().trim().length() + 1;
}
}
sectionText.setCellStarts(cellStarts);
sectionText.setText(entireTableText.toString());
sectionText.setHeadline(table.getHeadline());

View File

@ -176,6 +176,7 @@ public class RedactionIntegrationTest {
@Before
public void stubClients() {
//Testkommentar
when(rulesClient.getVersion(TEST_DOSSIER_TEMPLATE_ID)).thenReturn(0L);
when(rulesClient.getRules(TEST_DOSSIER_TEMPLATE_ID)).thenReturn(new RulesResponse(RULES));
@ -663,7 +664,7 @@ public class RedactionIntegrationTest {
public void redactionTest() throws IOException {
long start = System.currentTimeMillis();
ClassPathResource pdfFileResource = new ClassPathResource("files/new/Single Study - Oral (Gavage) Mouse.pdf");
ClassPathResource pdfFileResource = new ClassPathResource("files/S11.pdf");
AnalyzeRequest request = prepareStorage(pdfFileResource.getInputStream());
request.setExcludedPages(Set.of(1));
@ -888,7 +889,7 @@ public class RedactionIntegrationTest {
public void classificationTest() throws IOException {
System.out.println("classificationTest");
ClassPathResource pdfFileResource = new ClassPathResource("files/new/Single Study - Oral (Gavage) Mouse.pdf");
ClassPathResource pdfFileResource = new ClassPathResource("files/S11.pdf");
AnalyzeRequest request = prepareStorage(pdfFileResource.getInputStream());
@ -910,7 +911,7 @@ public class RedactionIntegrationTest {
public void sectionsTest() throws IOException {
System.out.println("sectionsTest");
ClassPathResource pdfFileResource = new ClassPathResource("files/Fludioxonil/51 " + "Fludioxonil_RAR_02_Volume_2_2018-02-21.pdf");
ClassPathResource pdfFileResource = new ClassPathResource("files/S11.pdf");
AnalyzeRequest request = prepareStorage(pdfFileResource.getInputStream());
@ -932,7 +933,7 @@ public class RedactionIntegrationTest {
public void htmlTablesTest() throws IOException {
System.out.println("htmlTablesTest");
ClassPathResource pdfFileResource = new ClassPathResource("files/Metolachlor/S-Metolachlor_RAR_02_Volume_2_2018-09-06.pdf");
ClassPathResource pdfFileResource = new ClassPathResource("files/S11.pdf");
AnalyzeRequest request = prepareStorage(pdfFileResource.getInputStream());