|
|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.iqser.red.service.redaction.v1.server.redaction.model;
|
|
|
|
|
|
|
|
|
|
import com.iqser.red.service.redaction.v1.model.ArgumentType;
|
|
|
|
|
import com.iqser.red.service.redaction.v1.model.FileAttribute;
|
|
|
|
|
import com.iqser.red.service.redaction.v1.server.classification.model.TextBlock;
|
|
|
|
|
import com.iqser.red.service.redaction.v1.server.redaction.utils.EntitySearchUtils;
|
|
|
|
|
@ -9,13 +10,11 @@ import lombok.Data;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.lang.annotation.ElementType;
|
|
|
|
|
import java.lang.annotation.Retention;
|
|
|
|
|
import java.lang.annotation.RetentionPolicy;
|
|
|
|
|
import java.lang.annotation.Target;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@ -59,33 +58,45 @@ public class Section {
|
|
|
|
|
private List<FileAttribute> fileAttributes = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean fileAttributeByIdEquals(String id, String value){
|
|
|
|
|
@WhenCondition
|
|
|
|
|
public boolean fileAttributeByIdEquals(@Argument(ArgumentType.FILE_ATTRIBUTE) String id,
|
|
|
|
|
@Argument(ArgumentType.STRING) String value) {
|
|
|
|
|
return fileAttributes != null && fileAttributes.stream().filter(attribute -> id.equals(attribute.getId()) && value.equals(attribute.getValue())).findFirst().isPresent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean fileAttributeByPlaceholderEquals(String placeholder, String value){
|
|
|
|
|
@WhenCondition
|
|
|
|
|
public boolean fileAttributeByPlaceholderEquals(@Argument(ArgumentType.FILE_ATTRIBUTE) String placeholder,
|
|
|
|
|
@Argument(ArgumentType.STRING) String value) {
|
|
|
|
|
return fileAttributes != null && fileAttributes.stream().filter(attribute -> placeholder.equals(attribute.getPlaceholder()) && value.equals(attribute.getValue())).findFirst().isPresent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean fileAttributeByLabelEquals(String label, String value){
|
|
|
|
|
@WhenCondition
|
|
|
|
|
public boolean fileAttributeByLabelEquals(@Argument(ArgumentType.FILE_ATTRIBUTE) String label,
|
|
|
|
|
@Argument(ArgumentType.STRING) String value) {
|
|
|
|
|
return fileAttributes != null && fileAttributes.stream().filter(attribute -> label.equals(attribute.getLabel()) && value.equals(attribute.getValue())).findFirst().isPresent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean fileAttributeByIdEqualsIgnoreCase(String id, String value){
|
|
|
|
|
@WhenCondition
|
|
|
|
|
public boolean fileAttributeByIdEqualsIgnoreCase(@Argument(ArgumentType.FILE_ATTRIBUTE) String id,
|
|
|
|
|
@Argument(ArgumentType.STRING) String value) {
|
|
|
|
|
return fileAttributes != null && fileAttributes.stream().filter(attribute -> id.equals(attribute.getId()) && value.equalsIgnoreCase(attribute.getValue())).findFirst().isPresent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean fileAttributeByPlaceholderEqualsIgnoreCase(String placeholder, String value){
|
|
|
|
|
@WhenCondition
|
|
|
|
|
public boolean fileAttributeByPlaceholderEqualsIgnoreCase(@Argument(ArgumentType.FILE_ATTRIBUTE) String placeholder,
|
|
|
|
|
@Argument(ArgumentType.STRING) String value) {
|
|
|
|
|
return fileAttributes != null && fileAttributes.stream().filter(attribute -> placeholder.equals(attribute.getPlaceholder()) && value.equalsIgnoreCase(attribute.getValue())).findFirst().isPresent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean fileAttributeByLabelEqualsIgnoreCase(String label, String value){
|
|
|
|
|
@WhenCondition
|
|
|
|
|
public boolean fileAttributeByLabelEqualsIgnoreCase(@Argument(ArgumentType.FILE_ATTRIBUTE) String label,
|
|
|
|
|
@Argument(ArgumentType.STRING) String value) {
|
|
|
|
|
return fileAttributes != null && fileAttributes.stream().filter(attribute -> label.equals(attribute.getLabel()) && value.equalsIgnoreCase(attribute.getValue())).findFirst().isPresent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean rowEquals(String headerName, String value) {
|
|
|
|
|
@WhenCondition
|
|
|
|
|
public boolean rowEquals(@Argument(ArgumentType.STRING) String headerName,
|
|
|
|
|
@Argument(ArgumentType.STRING) String value) {
|
|
|
|
|
|
|
|
|
|
String cleanHeaderName = headerName.replaceAll("\n", "").replaceAll(" ", "").replaceAll("-", "");
|
|
|
|
|
|
|
|
|
|
@ -94,33 +105,36 @@ public class Section {
|
|
|
|
|
.equals(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean hasTableHeader(String headerName) {
|
|
|
|
|
@WhenCondition
|
|
|
|
|
public boolean hasTableHeader(@Argument(ArgumentType.STRING) String headerName) {
|
|
|
|
|
|
|
|
|
|
String cleanHeaderName = headerName.replaceAll("\n", "").replaceAll(" ", "").replaceAll("-", "");
|
|
|
|
|
return tabularData != null && tabularData.containsKey(cleanHeaderName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean matchesType(String type) {
|
|
|
|
|
@WhenCondition
|
|
|
|
|
public boolean matchesType(@Argument(ArgumentType.TYPE) String type) {
|
|
|
|
|
|
|
|
|
|
return entities.stream().anyMatch(entity -> entity.getType().equals(type));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean matchesImageType(String type) {
|
|
|
|
|
@WhenCondition
|
|
|
|
|
public boolean matchesImageType(@Argument(ArgumentType.TYPE) String type) {
|
|
|
|
|
|
|
|
|
|
return images.stream().anyMatch(image -> image.getType().equals(type));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean headlineContainsWord(String word) {
|
|
|
|
|
@WhenCondition
|
|
|
|
|
public boolean headlineContainsWord(@Argument(ArgumentType.STRING) String word) {
|
|
|
|
|
|
|
|
|
|
return StringUtils.containsIgnoreCase(headline, word);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void expandByRegEx(String type, String pattern, boolean patternCaseInsensitive, int group) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void expandByRegEx(@Argument(ArgumentType.TYPE) String type,
|
|
|
|
|
@Argument(ArgumentType.REGEX) String pattern,
|
|
|
|
|
@Argument(ArgumentType.BOOLEAN) boolean patternCaseInsensitive,
|
|
|
|
|
@Argument(ArgumentType.INTEGER) int group) {
|
|
|
|
|
|
|
|
|
|
Pattern compiledPattern = Patterns.getCompiledPattern(pattern, patternCaseInsensitive);
|
|
|
|
|
|
|
|
|
|
@ -147,8 +161,11 @@ public class Section {
|
|
|
|
|
EntitySearchUtils.removeEntitiesContainedInLarger(entities);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void redactImage(String type, int ruleNumber, String reason, String legalBasis) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void redactImage(@Argument(ArgumentType.TYPE) String type,
|
|
|
|
|
@Argument(ArgumentType.RULE_NUMBER) int ruleNumber,
|
|
|
|
|
@Argument(ArgumentType.STRING) String reason,
|
|
|
|
|
@Argument(ArgumentType.LEGAL_BASIS) String legalBasis) {
|
|
|
|
|
|
|
|
|
|
images.forEach(image -> {
|
|
|
|
|
if (image.getType().equals(type)) {
|
|
|
|
|
@ -160,8 +177,11 @@ public class Section {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void redact(String type, int ruleNumber, String reason, String legalBasis) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void redact(@Argument(ArgumentType.TYPE) String type,
|
|
|
|
|
@Argument(ArgumentType.RULE_NUMBER) int ruleNumber,
|
|
|
|
|
@Argument(ArgumentType.STRING) String reason,
|
|
|
|
|
@Argument(ArgumentType.LEGAL_BASIS) String legalBasis) {
|
|
|
|
|
|
|
|
|
|
boolean hasRecommendationDictionary = dictionaryTypes.contains(RECOMMENDATION_PREFIX + type);
|
|
|
|
|
|
|
|
|
|
@ -176,8 +196,10 @@ public class Section {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void redactNotImage(String type, int ruleNumber, String reason) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void redactNotImage(@Argument(ArgumentType.TYPE) String type,
|
|
|
|
|
@Argument(ArgumentType.RULE_NUMBER) int ruleNumber,
|
|
|
|
|
@Argument(ArgumentType.STRING) String reason) {
|
|
|
|
|
|
|
|
|
|
images.forEach(image -> {
|
|
|
|
|
if (image.getType().equals(type)) {
|
|
|
|
|
@ -188,8 +210,10 @@ public class Section {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void redactNot(String type, int ruleNumber, String reason) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void redactNot(@Argument(ArgumentType.TYPE) String type,
|
|
|
|
|
@Argument(ArgumentType.RULE_NUMBER) int ruleNumber,
|
|
|
|
|
@Argument(ArgumentType.STRING) String reason) {
|
|
|
|
|
|
|
|
|
|
boolean hasRecommendationDictionary = dictionaryTypes.contains(RECOMMENDATION_PREFIX + type);
|
|
|
|
|
|
|
|
|
|
@ -203,9 +227,12 @@ public class Section {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void expandToHintAnnotationByRegEx(String type, String pattern, boolean patternCaseInsensitive, int group,
|
|
|
|
|
String asType) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void expandToHintAnnotationByRegEx(@Argument(ArgumentType.TYPE) String type,
|
|
|
|
|
@Argument(ArgumentType.STRING) String pattern,
|
|
|
|
|
@Argument(ArgumentType.BOOLEAN) boolean patternCaseInsensitive,
|
|
|
|
|
@Argument(ArgumentType.INTEGER) int group,
|
|
|
|
|
@Argument(ArgumentType.TYPE) String asType) {
|
|
|
|
|
|
|
|
|
|
Pattern compiledPattern = Patterns.getCompiledPattern(pattern, patternCaseInsensitive);
|
|
|
|
|
|
|
|
|
|
@ -230,8 +257,11 @@ public class Section {
|
|
|
|
|
EntitySearchUtils.removeEntitiesContainedInLarger(entities);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void addHintAnnotationByRegEx(String pattern, boolean patternCaseInsensitive, int group, String asType) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void addHintAnnotationByRegEx(@Argument(ArgumentType.REGEX) String pattern,
|
|
|
|
|
@Argument(ArgumentType.BOOLEAN) boolean patternCaseInsensitive,
|
|
|
|
|
@Argument(ArgumentType.INTEGER) int group,
|
|
|
|
|
@Argument(ArgumentType.TYPE) String asType) {
|
|
|
|
|
|
|
|
|
|
Pattern compiledPattern = Patterns.getCompiledPattern(pattern, patternCaseInsensitive);
|
|
|
|
|
|
|
|
|
|
@ -246,8 +276,12 @@ public class Section {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void redactIfPrecededBy(String prefix, String type, int ruleNumber, String reason, String legalBasis) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void redactIfPrecededBy(@Argument(ArgumentType.STRING) String prefix,
|
|
|
|
|
@Argument(ArgumentType.TYPE) String type,
|
|
|
|
|
@Argument(ArgumentType.RULE_NUMBER) int ruleNumber,
|
|
|
|
|
@Argument(ArgumentType.STRING) String reason,
|
|
|
|
|
@Argument(ArgumentType.LEGAL_BASIS) String legalBasis) {
|
|
|
|
|
|
|
|
|
|
entities.forEach(entity -> {
|
|
|
|
|
if (entity.getType().equals(type) && searchText.indexOf(prefix + entity.getWord()) != 1) {
|
|
|
|
|
@ -259,23 +293,32 @@ public class Section {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void addHintAnnotation(String value, String asType) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void addHintAnnotation(@Argument(ArgumentType.STRING) String value,
|
|
|
|
|
@Argument(ArgumentType.TYPE) String asType) {
|
|
|
|
|
|
|
|
|
|
Set<Entity> found = findEntities(value.trim(), asType, true, false, 0, null, null);
|
|
|
|
|
EntitySearchUtils.addEntitiesIgnoreRank(entities, found);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void addRedaction(String value, String asType, int ruleNumber, String reason, String legalBasis) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void addRedaction(@Argument(ArgumentType.STRING) String value,
|
|
|
|
|
@Argument(ArgumentType.TYPE) String asType,
|
|
|
|
|
@Argument(ArgumentType.RULE_NUMBER) int ruleNumber,
|
|
|
|
|
@Argument(ArgumentType.STRING) String reason,
|
|
|
|
|
@Argument(ArgumentType.LEGAL_BASIS) String legalBasis) {
|
|
|
|
|
|
|
|
|
|
Set<Entity> found = findEntities(value.trim(), asType, true, true, ruleNumber, reason, legalBasis);
|
|
|
|
|
EntitySearchUtils.addEntitiesIgnoreRank(entities, found);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void redactLineAfter(String start, String asType, int ruleNumber, boolean redactEverywhere, String reason,
|
|
|
|
|
String legalBasis) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void redactLineAfter(@Argument(ArgumentType.STRING) String start,
|
|
|
|
|
@Argument(ArgumentType.TYPE) String asType,
|
|
|
|
|
@Argument(ArgumentType.RULE_NUMBER) int ruleNumber,
|
|
|
|
|
@Argument(ArgumentType.BOOLEAN) boolean redactEverywhere,
|
|
|
|
|
@Argument(ArgumentType.STRING) String reason,
|
|
|
|
|
@Argument(ArgumentType.LEGAL_BASIS) String legalBasis) {
|
|
|
|
|
|
|
|
|
|
String[] values = StringUtils.substringsBetween(text, start, "\n");
|
|
|
|
|
|
|
|
|
|
@ -293,8 +336,9 @@ public class Section {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void recommendLineAfter(String start, String asType) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void recommendLineAfter(@Argument(ArgumentType.STRING) String start,
|
|
|
|
|
@Argument(ArgumentType.TYPE) String asType) {
|
|
|
|
|
|
|
|
|
|
String[] values = StringUtils.substringsBetween(text, start, "\n");
|
|
|
|
|
|
|
|
|
|
@ -317,9 +361,14 @@ public class Section {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void redactByRegEx(String pattern, boolean patternCaseInsensitive, int group, String asType, int ruleNumber,
|
|
|
|
|
String reason, String legalBasis) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void redactByRegEx(@Argument(ArgumentType.REGEX) String pattern,
|
|
|
|
|
@Argument(ArgumentType.BOOLEAN) boolean patternCaseInsensitive,
|
|
|
|
|
@Argument(ArgumentType.INTEGER) int group,
|
|
|
|
|
@Argument(ArgumentType.TYPE) String asType,
|
|
|
|
|
@Argument(ArgumentType.RULE_NUMBER) int ruleNumber,
|
|
|
|
|
@Argument(ArgumentType.STRING) String reason,
|
|
|
|
|
@Argument(ArgumentType.LEGAL_BASIS) String legalBasis) {
|
|
|
|
|
|
|
|
|
|
Pattern compiledPattern = Patterns.getCompiledPattern(pattern, patternCaseInsensitive);
|
|
|
|
|
|
|
|
|
|
@ -334,8 +383,11 @@ public class Section {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void addRecommendationByRegEx(String pattern, boolean patternCaseInsensitive, int group, String asType) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void addRecommendationByRegEx(@Argument(ArgumentType.REGEX) String pattern,
|
|
|
|
|
@Argument(ArgumentType.BOOLEAN) boolean patternCaseInsensitive,
|
|
|
|
|
@Argument(ArgumentType.INTEGER) int group,
|
|
|
|
|
@Argument(ArgumentType.TYPE) String asType) {
|
|
|
|
|
|
|
|
|
|
Pattern compiledPattern = Patterns.getCompiledPattern(pattern, patternCaseInsensitive);
|
|
|
|
|
|
|
|
|
|
@ -349,9 +401,14 @@ public class Section {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void redactAndRecommendByRegEx(String pattern, boolean patternCaseInsensitive, int group, String asType,
|
|
|
|
|
int ruleNumber, String reason, String legalBasis) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void redactAndRecommendByRegEx(@Argument(ArgumentType.REGEX) String pattern,
|
|
|
|
|
@Argument(ArgumentType.BOOLEAN) boolean patternCaseInsensitive,
|
|
|
|
|
@Argument(ArgumentType.INTEGER) int group,
|
|
|
|
|
@Argument(ArgumentType.TYPE) String asType,
|
|
|
|
|
@Argument(ArgumentType.RULE_NUMBER) int ruleNumber,
|
|
|
|
|
@Argument(ArgumentType.STRING) String reason,
|
|
|
|
|
@Argument(ArgumentType.LEGAL_BASIS) String legalBasis) {
|
|
|
|
|
|
|
|
|
|
Pattern compiledPattern = Patterns.getCompiledPattern(pattern, patternCaseInsensitive);
|
|
|
|
|
|
|
|
|
|
@ -366,9 +423,14 @@ public class Section {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void redactBetween(String start, String stop, String asType, int ruleNumber, boolean redactEverywhere,
|
|
|
|
|
String reason, String legalBasis) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void redactBetween(@Argument(ArgumentType.STRING) String start,
|
|
|
|
|
@Argument(ArgumentType.STRING) String stop,
|
|
|
|
|
@Argument(ArgumentType.TYPE) String asType,
|
|
|
|
|
@Argument(ArgumentType.RULE_NUMBER) int ruleNumber,
|
|
|
|
|
@Argument(ArgumentType.BOOLEAN) boolean redactEverywhere,
|
|
|
|
|
@Argument(ArgumentType.STRING) String reason,
|
|
|
|
|
@Argument(ArgumentType.LEGAL_BASIS) String legalBasis) {
|
|
|
|
|
|
|
|
|
|
String[] values = StringUtils.substringsBetween(searchText, start, stop);
|
|
|
|
|
|
|
|
|
|
@ -387,9 +449,14 @@ public class Section {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void redactLinesBetween(String start, String stop, String asType, int ruleNumber, boolean redactEverywhere,
|
|
|
|
|
String reason, String legalBasis) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void redactLinesBetween(@Argument(ArgumentType.STRING) String start,
|
|
|
|
|
@Argument(ArgumentType.STRING) String stop,
|
|
|
|
|
@Argument(ArgumentType.TYPE) String asType,
|
|
|
|
|
@Argument(ArgumentType.RULE_NUMBER) int ruleNumber,
|
|
|
|
|
@Argument(ArgumentType.BOOLEAN) boolean redactEverywhere,
|
|
|
|
|
@Argument(ArgumentType.STRING) String reason,
|
|
|
|
|
@Argument(ArgumentType.LEGAL_BASIS) String legalBasis) {
|
|
|
|
|
|
|
|
|
|
String[] values = StringUtils.substringsBetween(text, start, stop);
|
|
|
|
|
|
|
|
|
|
@ -416,29 +483,43 @@ public class Section {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void highlightCell(String cellHeader, int ruleNumber, String type) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void highlightCell(@Argument(ArgumentType.STRING) String cellHeader,
|
|
|
|
|
@Argument(ArgumentType.RULE_NUMBER) int ruleNumber,
|
|
|
|
|
@Argument(ArgumentType.TYPE) String type) {
|
|
|
|
|
|
|
|
|
|
annotateCell(cellHeader, ruleNumber, type, false, false, null, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void redactCell(String cellHeader, int ruleNumber, String type, boolean addAsRecommendations, String reason,
|
|
|
|
|
String legalBasis) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void redactCell(@Argument(ArgumentType.STRING) String cellHeader,
|
|
|
|
|
@Argument(ArgumentType.RULE_NUMBER) int ruleNumber,
|
|
|
|
|
@Argument(ArgumentType.TYPE) String type,
|
|
|
|
|
@Argument(ArgumentType.BOOLEAN) boolean addAsRecommendations,
|
|
|
|
|
@Argument(ArgumentType.STRING) String reason,
|
|
|
|
|
@Argument(ArgumentType.LEGAL_BASIS) String legalBasis) {
|
|
|
|
|
|
|
|
|
|
annotateCell(cellHeader, ruleNumber, type, true, addAsRecommendations, reason, legalBasis);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void redactNotCell(String cellHeader, int ruleNumber, String type, boolean addAsRecommendations,
|
|
|
|
|
String reason) {
|
|
|
|
|
@ThenAction
|
|
|
|
|
public void redactNotCell(@Argument(ArgumentType.STRING) String cellHeader,
|
|
|
|
|
@Argument(ArgumentType.RULE_NUMBER) int ruleNumber,
|
|
|
|
|
@Argument(ArgumentType.TYPE) String type,
|
|
|
|
|
@Argument(ArgumentType.BOOLEAN) boolean addAsRecommendations,
|
|
|
|
|
@Argument(ArgumentType.STRING) String reason) {
|
|
|
|
|
|
|
|
|
|
annotateCell(cellHeader, ruleNumber, type, false, addAsRecommendations, reason, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Set<Entity> findEntities(String value, String asType, boolean caseInsensitive, boolean redacted,
|
|
|
|
|
int ruleNumber, String reason, String legalBasis) {
|
|
|
|
|
private Set<Entity> findEntities(@Argument(ArgumentType.STRING) String value,
|
|
|
|
|
@Argument(ArgumentType.TYPE) String asType,
|
|
|
|
|
@Argument(ArgumentType.BOOLEAN) boolean caseInsensitive,
|
|
|
|
|
@Argument(ArgumentType.BOOLEAN) boolean redacted,
|
|
|
|
|
@Argument(ArgumentType.RULE_NUMBER) int ruleNumber,
|
|
|
|
|
@Argument(ArgumentType.STRING) String reason,
|
|
|
|
|
@Argument(ArgumentType.LEGAL_BASIS) String legalBasis) {
|
|
|
|
|
|
|
|
|
|
String text = caseInsensitive ? searchText.toLowerCase() : searchText;
|
|
|
|
|
String searchValue = caseInsensitive ? value.toLowerCase() : value;
|
|
|
|
|
@ -507,6 +588,25 @@ public class Section {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Retention(RetentionPolicy.RUNTIME)
|
|
|
|
|
@Target(ElementType.METHOD)
|
|
|
|
|
public @interface WhenCondition {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Retention(RetentionPolicy.RUNTIME)
|
|
|
|
|
@Target(ElementType.METHOD)
|
|
|
|
|
public @interface ThenAction {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Retention(RetentionPolicy.RUNTIME)
|
|
|
|
|
@Target(ElementType.PARAMETER)
|
|
|
|
|
public @interface Argument {
|
|
|
|
|
|
|
|
|
|
ArgumentType value() default ArgumentType.STRING;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|