RED-6098: added SKIPPED_PLACEHOLDER and its logic to list skipped redactions in Excel reports

This commit is contained in:
Ali Oezyetimoglu 2023-02-21 16:37:41 +01:00
parent f21b0519e7
commit fe86da316c
6 changed files with 29 additions and 20 deletions

View File

@ -17,5 +17,6 @@ public class ReportRedactionEntry {
private String excerpt;
private String value;
private String entityDisplayName;
private boolean isSkipped;
}

View File

@ -26,6 +26,7 @@ import static com.iqser.red.service.redaction.report.v1.server.service.Placehold
import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.SCM_FUNCTION_PLACEHOLDER;
import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.SEEDS_FUNCTION_JUSTIFICATION_PLACEHOLDER;
import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.SEEDS_FUNCTION_REDACTION_GROUPED_BY_JUSTIFICATION_PAGES_PLACEHOLDER;
import static com.iqser.red.service.redaction.report.v1.server.service.PlaceholderService.SKIPPED_PLACEHOLDER;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
@ -338,7 +339,7 @@ public class ExcelReportGenerationService {
JUSTIFICATION_PARAGRAPH_PLACEHOLDER) || text.contains(JUSTIFICATION_REASON_PLACEHOLDER) || text.contains(REDACTION_VALUE_PLACEHOLDER) || text.contains(
JUSTIFICATION_LEGAL_BASIS_PLACEHOLDER) || text.contains(JUSTIFICATION_TEXT_PLACEHOLDER) || text.contains(
SEEDS_FUNCTION_REDACTION_GROUPED_BY_JUSTIFICATION_PAGES_PLACEHOLDER) || text.contains(SEEDS_FUNCTION_JUSTIFICATION_PLACEHOLDER) || text.contains(
REDACTION_ENTITY_DISPLAY_NAME_PLACEHOLDER) || text.contains(SCM_FUNCTION_PLACEHOLDER);
REDACTION_ENTITY_DISPLAY_NAME_PLACEHOLDER) || text.contains(SCM_FUNCTION_PLACEHOLDER) || text.contains(SKIPPED_PLACEHOLDER);
}
@ -385,6 +386,9 @@ public class ExcelReportGenerationService {
if (placeholder.equals(REDACTION_ENTITY_DISPLAY_NAME_PLACEHOLDER)) {
return input -> input.getEntry().getEntityDisplayName();
}
if (placeholder.equals(SKIPPED_PLACEHOLDER)) {
return input -> input.getEntry().isSkipped() ? "true" : "";
}
return input -> "";
}

View File

@ -48,6 +48,7 @@ public class PlaceholderService {
public static final String EXCERPT_PLACEHOLDER = "{{redaction.excerpt}}";
public static final String REDACTION_VALUE_PLACEHOLDER = "{{redaction.value}}";
public static final String REDACTION_ENTITY_DISPLAY_NAME_PLACEHOLDER = "{{redaction.entity.displayName}}";
public static final String SKIPPED_PLACEHOLDER = "{{redaction.skipped}}";
public static final String SCM_FUNCTION_PLACEHOLDER = "{{function.scm}}";
public static final String FILE_ATTRIBUTE_PLACEHOLDER_BASE = "{{file.attribute.";
public static final String DOSSIER_ATTRIBUTE_PLACEHOLDER_BASE = "{{dossier.attribute.";
@ -94,7 +95,8 @@ public class PlaceholderService {
JUSTIFICATION_TEXT_PLACEHOLDER,
SEEDS_FUNCTION_REDACTION_GROUPED_BY_JUSTIFICATION_PAGES_PLACEHOLDER,
SEEDS_FUNCTION_JUSTIFICATION_PLACEHOLDER,
REDACTION_ENTITY_DISPLAY_NAME_PLACEHOLDER);
REDACTION_ENTITY_DISPLAY_NAME_PLACEHOLDER,
SKIPPED_PLACEHOLDER);
}

View File

@ -82,8 +82,8 @@ public class RedactionLogConverterService {
List<ReportRedactionEntry> reportEntries = new ArrayList<>();
redactionLog.getRedactionLogEntry().forEach(entry -> {
if (entry.isRedacted()) {
var isSkipped = !entry.isRedacted() && !entry.isHint();
if (entry.isRedacted() || isSkipped) {
if (entry.lastChangeIsRemoved()) {
return;
@ -133,7 +133,8 @@ public class RedactionLogConverterService {
.orElse(""),
checkTextForNull(entry.getTextBefore()) + entry.getValue() + checkTextForNull(entry.getTextAfter()),
entry.getValue(),
mapOfEntityDisplayName.get(entry.getType())));
mapOfEntityDisplayName.get(entry.getType()),
isSkipped));
}
}
}

View File

@ -256,21 +256,6 @@ public class RedactionReportV2IntegrationTest {
}
@Configuration
@EnableAutoConfiguration(exclude = {StorageAutoConfiguration.class, RabbitAutoConfiguration.class})
@ComponentScan("com.iqser.red.service.persistence")
public static class TestConfiguration {
@Bean
@Primary
public StorageService inmemoryStorage() {
return new FileSystemBackedStorageService();
}
}
private List<FileModel> createFileModels(int numOfFileModelsToCreate) {
if (numOfFileModelsToCreate <= 0) {
@ -284,4 +269,20 @@ public class RedactionReportV2IntegrationTest {
return fileModels;
}
@Configuration
@EnableAutoConfiguration(exclude = {StorageAutoConfiguration.class, RabbitAutoConfiguration.class})
@ComponentScan("com.iqser.red.service.persistence")
public static class TestConfiguration {
@Bean
@Primary
public StorageService inmemoryStorage() {
return new FileSystemBackedStorageService();
}
}
}