RED-7241: cleaned up unneeded imports
This commit is contained in:
parent
e454533758
commit
a561f4f2da
@ -347,6 +347,7 @@ public class ManualRedactionController implements ManualRedactionResource {
|
|||||||
.positions(resizeRedactionRequest.getPositions())
|
.positions(resizeRedactionRequest.getPositions())
|
||||||
.value(resizeRedactionRequest.getValue())
|
.value(resizeRedactionRequest.getValue())
|
||||||
.updateDictionary(resizeRedactionRequest.getUpdateDictionary())
|
.updateDictionary(resizeRedactionRequest.getUpdateDictionary())
|
||||||
|
.addToAllDossiers(resizeRedactionRequest.isAddToAllDossiers())
|
||||||
.build())
|
.build())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
@ -1127,6 +1128,7 @@ public class ManualRedactionController implements ManualRedactionResource {
|
|||||||
.value(resizeRedactionRequest.getValue())
|
.value(resizeRedactionRequest.getValue())
|
||||||
.comment(resizeRedactionRequest.getComment())
|
.comment(resizeRedactionRequest.getComment())
|
||||||
.updateDictionary(resizeRedactionRequest.getUpdateDictionary())
|
.updateDictionary(resizeRedactionRequest.getUpdateDictionary())
|
||||||
|
.addToAllDossiers(resizeRedactionRequest.isAddToAllDossiers())
|
||||||
.build())
|
.build())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,12 @@ import java.time.OffsetDateTime;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.Fetch;
|
||||||
|
import org.hibernate.annotations.FetchMode;
|
||||||
|
|
||||||
|
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.FileEntity;
|
||||||
|
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.AnnotationStatus;
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.ElementCollection;
|
import jakarta.persistence.ElementCollection;
|
||||||
import jakarta.persistence.EmbeddedId;
|
import jakarta.persistence.EmbeddedId;
|
||||||
@ -13,13 +19,6 @@ import jakarta.persistence.Enumerated;
|
|||||||
import jakarta.persistence.FetchType;
|
import jakarta.persistence.FetchType;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.Fetch;
|
|
||||||
import org.hibernate.annotations.FetchMode;
|
|
||||||
|
|
||||||
import com.iqser.red.service.persistence.management.v1.processor.entity.dossier.FileEntity;
|
|
||||||
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.AnnotationStatus;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -65,4 +64,7 @@ public class ManualResizeRedactionEntity implements IBaseAnnotation {
|
|||||||
@Column
|
@Column
|
||||||
private String textAfter;
|
private String textAfter;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
private boolean addToAllDossiers;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -729,14 +729,27 @@ public class ManualRedactionService {
|
|||||||
.equals(AnnotationStatus.APPROVED) && (redactionLogEntry.isDictionaryEntry() || redactionLogEntry.isDossierDictionaryEntry())) {
|
.equals(AnnotationStatus.APPROVED) && (redactionLogEntry.isDictionaryEntry() || redactionLogEntry.isDossierDictionaryEntry())) {
|
||||||
var dossier = dossierPersistenceService.findByDossierId(dossierId);
|
var dossier = dossierPersistenceService.findByDossierId(dossierId);
|
||||||
|
|
||||||
var typeId = buildTypeId(redactionLogEntry, dossier);
|
var typeId = computeTypeIdForResizeRedaction(redactionLogEntry, resizeRedaction, dossier);
|
||||||
var newValue = resizeRedaction.getValue();
|
var newValue = resizeRedaction.getValue();
|
||||||
var oldValue = redactionLogEntry.getValue();
|
var oldValue = redactionLogEntry.getValue();
|
||||||
var dictionaryEntryType = getDictionaryEntryType(redactionLogEntry);
|
var dictionaryEntryType = getDictionaryEntryType(redactionLogEntry);
|
||||||
|
|
||||||
if (oldValue != null && oldValue.length() > newValue.length()) {
|
boolean isShrinking = oldValue != null && oldValue.length() > newValue.length();
|
||||||
|
|
||||||
|
if (isShrinking) {
|
||||||
log.info("Remove old value '{}' from dictionary", oldValue);
|
log.info("Remove old value '{}' from dictionary", oldValue);
|
||||||
removeFromDictionary(buildTypeId(redactionLogEntry, dossier), oldValue, dossierId, fileId, dictionaryEntryType);
|
removeFromDictionary(typeId, oldValue, dossierId, fileId, dictionaryEntryType);
|
||||||
|
|
||||||
|
if (resizeRedaction.isAddToAllDossiers() && redactionLogEntry.isDossierDictionaryEntry()) {
|
||||||
|
String dossierTemplateId = dossier.getDossierTemplateId();
|
||||||
|
var dossiersOfThisDossierTemplate = dossierPersistenceService.findAllDossiersForDossierTemplateId(dossierTemplateId);
|
||||||
|
var type = redactionLogEntry.getType();
|
||||||
|
dossiersOfThisDossierTemplate.forEach(dossierEntity -> {
|
||||||
|
var typeIdOfDossierEntity = toTypeId(type, dossierTemplateId, dossierEntity.getId());
|
||||||
|
removeFromDictionary(typeIdOfDossierEntity, oldValue, dossierId, fileId, dictionaryEntryType);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Add new value '{}' to dictionary", newValue);
|
log.info("Add new value '{}' to dictionary", newValue);
|
||||||
@ -745,6 +758,20 @@ public class ManualRedactionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String computeTypeIdForResizeRedaction(RedactionLogEntry redactionLogEntry, ManualResizeRedactionEntity resizeRedaction, DossierEntity dossier) {
|
||||||
|
if (resizeRedaction.isAddToAllDossiers()) {
|
||||||
|
if (redactionLogEntry.isDossierDictionaryEntry()) {
|
||||||
|
return toTypeId(redactionLogEntry.getType(), dossier.getDossierTemplateId());
|
||||||
|
} else {
|
||||||
|
return toTypeId(redactionLogEntry.getType(), dossier.getDossierTemplateId(), dossier.getId());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return buildTypeId(redactionLogEntry, dossier);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private DictionaryEntryType getDictionaryEntryType(RedactionLogEntry redactionLogEntry) {
|
private DictionaryEntryType getDictionaryEntryType(RedactionLogEntry redactionLogEntry) {
|
||||||
|
|
||||||
if (redactionLogEntry.isRecommendation() && redactionLogEntry.isFalsePositive()) {
|
if (redactionLogEntry.isRecommendation() && redactionLogEntry.isFalsePositive()) {
|
||||||
|
|||||||
@ -151,3 +151,5 @@ databaseChangeLog:
|
|||||||
file: db/changelog/tenant/104-add-ocr-by-default-to-dossier-template.yaml
|
file: db/changelog/tenant/104-add-ocr-by-default-to-dossier-template.yaml
|
||||||
- include:
|
- include:
|
||||||
file: db/changelog/tenant/105-add-remove-watermark-to-dossier-template.yaml
|
file: db/changelog/tenant/105-add-remove-watermark-to-dossier-template.yaml
|
||||||
|
- include:
|
||||||
|
file: db/changelog/tenant/106-add-add-to-all-dossiers-to-resize-redactions.yaml
|
||||||
|
|||||||
@ -0,0 +1,11 @@
|
|||||||
|
databaseChangeLog:
|
||||||
|
- changeSet:
|
||||||
|
id: add-add-to-all-dossiers-to-resize-redactions
|
||||||
|
author: ali
|
||||||
|
changes:
|
||||||
|
- addColumn:
|
||||||
|
columns:
|
||||||
|
- column:
|
||||||
|
name: add_to_all_dossiers
|
||||||
|
type: BOOLEAN
|
||||||
|
tableName: manual_resize_redaction
|
||||||
@ -28,4 +28,6 @@ public class ResizeRedactionRequest {
|
|||||||
private String textBefore;
|
private String textBefore;
|
||||||
private String textAfter;
|
private String textAfter;
|
||||||
|
|
||||||
|
private boolean addToAllDossiers;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,8 @@ public class ResizeRedactionRequest {
|
|||||||
|
|
||||||
private Boolean updateDictionary;
|
private Boolean updateDictionary;
|
||||||
|
|
||||||
|
private boolean addToAllDossiers;
|
||||||
|
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private List<Rectangle> positions = new ArrayList<>();
|
private List<Rectangle> positions = new ArrayList<>();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user