DM-285: fully deprecated RedactionLog, added component rule file
* return 404, when component rule file hasn't been created yet
This commit is contained in:
parent
91b13c41ce
commit
db40f5a1a9
@ -20,8 +20,8 @@ import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.client.redactionservice.RedactionClient;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.exception.FileUploadException;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.RulesValidationService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.AuditPersistenceService;
|
||||
import com.iqser.red.service.persistence.management.v1.processor.service.persistence.RulesPersistenceService;
|
||||
import com.iqser.red.service.persistence.service.v1.api.external.resource.RulesResource;
|
||||
@ -45,7 +45,7 @@ public class RulesController implements RulesResource {
|
||||
private static final String DOWNLOAD_FILE_NAME = "rules.drl";
|
||||
|
||||
private final RulesPersistenceService rulesPersistenceService;
|
||||
private final RedactionClient redactionServiceClient;
|
||||
private final RulesValidationService rulesValidationService;
|
||||
private final AuditPersistenceService auditPersistenceService;
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ public class RulesController implements RulesResource {
|
||||
@PreAuthorize("hasAuthority('" + WRITE_RULES + "')")
|
||||
public ResponseEntity<?> upload(@RequestBody RulesUploadRequest rules) {
|
||||
|
||||
DroolsSyntaxValidation droolsSyntaxValidation = redactionServiceClient.testRules(rules.getRules());
|
||||
DroolsSyntaxValidation droolsSyntaxValidation = rulesValidationService.validateRules(rules.getRuleFileType(), rules.getRules());
|
||||
if (!droolsSyntaxValidation.isCompiled()) {
|
||||
var rulesSyntaxErrorMessages = droolsSyntaxValidation.getDroolsSyntaxErrorMessages()
|
||||
.stream()
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
package com.iqser.red.service.persistence.management.v1.processor.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.iqser.red.service.persistence.management.v1.processor.client.redactionservice.RedactionClient;
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.RuleFileType;
|
||||
import com.iqser.red.service.redaction.v1.model.DroolsSyntaxValidation;
|
||||
import com.iqser.red.service.redaction.v1.model.RuleValidationModel;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RulesValidationService {
|
||||
|
||||
private final RedactionClient redactionServiceClient;
|
||||
|
||||
|
||||
public DroolsSyntaxValidation validateRules(RuleFileType ruleFileType, String rules) {
|
||||
|
||||
return redactionServiceClient.testRules(new RuleValidationModel(ruleFileType.name(), rules));
|
||||
}
|
||||
|
||||
}
|
||||
@ -3,11 +3,8 @@ package com.iqser.red.service.persistence.service.v1.api.shared.model.analysislo
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.AnnotationStatus;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@ -31,7 +28,6 @@ public class EntityLogEntry {
|
||||
String value;
|
||||
String reason;
|
||||
String matchedRule;
|
||||
boolean rectangle;
|
||||
String legalBasis;
|
||||
|
||||
boolean imported;
|
||||
@ -51,13 +47,11 @@ public class EntityLogEntry {
|
||||
|
||||
boolean imageHasTransparency;
|
||||
|
||||
boolean isDictionaryEntry;
|
||||
boolean isDossierDictionaryEntry;
|
||||
boolean dictionaryEntry;
|
||||
boolean dossierDictionaryEntry;
|
||||
|
||||
boolean excluded;
|
||||
|
||||
String sourceId;
|
||||
|
||||
@EqualsAndHashCode.Exclude
|
||||
@Builder.Default
|
||||
List<Change> changes = new ArrayList<>();
|
||||
@ -75,23 +69,4 @@ public class EntityLogEntry {
|
||||
@Builder.Default
|
||||
Set<String> importedRedactionIntersections = new HashSet<>();
|
||||
|
||||
|
||||
public boolean lastChangeIsRemoved() {
|
||||
|
||||
return last(changes).map(c -> c.getType() == ChangeType.REMOVED).orElse(false);
|
||||
}
|
||||
|
||||
|
||||
public boolean isManuallyRemoved() {
|
||||
|
||||
return manualChanges != null && manualChanges.stream()
|
||||
.anyMatch(mc -> mc.getManualRedactionType() == ManualRedactionType.REMOVE_LOCALLY && mc.getAnnotationStatus() == AnnotationStatus.APPROVED);
|
||||
}
|
||||
|
||||
|
||||
private <T> Optional<T> last(List<T> list) {
|
||||
|
||||
return list == null || list.isEmpty() ? Optional.empty() : Optional.of(list.get(list.size() - 1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,5 +6,6 @@ public enum EntryType {
|
||||
FALSE_POSITIVE,
|
||||
RECOMMENDATION,
|
||||
FALSE_RECOMMENDATION,
|
||||
IMAGE
|
||||
IMAGE,
|
||||
AREA
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.iqser.red.service.persistence.service.v1.api.shared.model.analysislog.entitylog;
|
||||
|
||||
import java.awt.geom.Rectangle2D;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@ -15,4 +17,48 @@ public class Position {
|
||||
float[] rectangle; // x, y, w, h
|
||||
int pageNumber;
|
||||
|
||||
|
||||
public Position(float x, float y, float w, float h, int pageNumber) {
|
||||
|
||||
this.rectangle = new float[]{x, y, w, h};
|
||||
this.pageNumber = pageNumber;
|
||||
}
|
||||
|
||||
|
||||
public Position(Rectangle2D rectangle2D, int pageNumber) {
|
||||
|
||||
this.rectangle = new float[]{(float) rectangle2D.getX(), (float) rectangle2D.getY(), (float) rectangle2D.getWidth(), (float) rectangle2D.getHeight()};
|
||||
this.pageNumber = pageNumber;
|
||||
}
|
||||
|
||||
|
||||
public Rectangle2D toRectangle2D() {
|
||||
|
||||
return new Rectangle2D.Float(x(), y(), w(), h());
|
||||
}
|
||||
|
||||
|
||||
public float x() {
|
||||
|
||||
return rectangle[0];
|
||||
}
|
||||
|
||||
|
||||
public float y() {
|
||||
|
||||
return rectangle[1];
|
||||
}
|
||||
|
||||
|
||||
public float w() {
|
||||
|
||||
return rectangle[2];
|
||||
}
|
||||
|
||||
|
||||
public float h() {
|
||||
|
||||
return rectangle[3];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<redaction-service.version>4.112.0</redaction-service.version>
|
||||
<redaction-service.version>DM-285-1</redaction-service.version>
|
||||
<search-service.version>2.71.0</search-service.version>
|
||||
<pdftron-redaction-service.version>4.29.0</pdftron-redaction-service.version>
|
||||
<redaction-report-service.version>4.13.0</redaction-report-service.version>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user