Merge branch 'RED-8524' into 'master'
RED-8524 - update persistence service version to include RESIZE_IN_DICTIONARY Closes RED-8524 See merge request redactmanager/redaction-report-service!53
This commit is contained in:
commit
540748f28c
@ -16,7 +16,7 @@ val springCommonsVersion = "2.1.0"
|
||||
val storageCommonsVersion = "2.45.0"
|
||||
val poiVersion = "5.2.3"
|
||||
val metricCommonsVersion = "2.1.0"
|
||||
val persistenceServiceVersion = "2.326.0"
|
||||
val persistenceServiceVersion = "2.348.0"
|
||||
val springBootStarterVersion = "3.1.5"
|
||||
|
||||
configurations {
|
||||
|
||||
@ -99,91 +99,98 @@ public class EntityLogConverterService {
|
||||
|
||||
List<ReportRedactionEntry> reportEntries = new ArrayList<>();
|
||||
|
||||
entityLog.getEntityLogEntry().forEach(entry -> {
|
||||
entityLog.getEntityLogEntry()
|
||||
.forEach(entry -> {
|
||||
|
||||
if (entry.getState().equals(EntryState.REMOVED)) {
|
||||
return;
|
||||
}
|
||||
if (entry.getState().equals(EntryState.REMOVED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (entry.getEntryType() == EntryType.HINT || entry.getEntryType() == EntryType.IMAGE_HINT) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (entry.isExcluded()) {
|
||||
return;
|
||||
}
|
||||
if (entry.getEntryType() == EntryType.HINT || entry.getEntryType() == EntryType.IMAGE_HINT) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (entry.getEntryType() == EntryType.RECOMMENDATION) {
|
||||
return;
|
||||
}
|
||||
if (entry.isExcluded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (entry.getEntryType() == EntryType.FALSE_POSITIVE) {
|
||||
return;
|
||||
}
|
||||
if (entry.getEntryType() == EntryType.RECOMMENDATION) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entry.getManualChanges().isEmpty() && (entry.getEntryType() == EntryType.IMAGE || entry.getEntryType() == EntryType.IMAGE_HINT) && entry.getManualChanges()
|
||||
.get(entry.getManualChanges().size() - 1)
|
||||
.getProcessedDate() == null && entry.getManualChanges()
|
||||
.get(entry.getManualChanges().size() - 1)
|
||||
.getManualRedactionType()
|
||||
.equals(ManualRedactionType.RECATEGORIZE)) {
|
||||
return;
|
||||
}
|
||||
if (entry.getEntryType() == EntryType.FALSE_POSITIVE) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!entry.getManualChanges().isEmpty() && (entry.isDictionaryEntry() || entry.isDossierDictionaryEntry()) && entry.getManualChanges()
|
||||
.get(entry.getManualChanges().size() - 1)
|
||||
.getProcessedDate() == null && entry.getManualChanges()
|
||||
.get(entry.getManualChanges().size() - 1)
|
||||
.getManualRedactionType()
|
||||
.equals(ManualRedactionType.ADD_TO_DICTIONARY)) {
|
||||
return;
|
||||
}
|
||||
if (!entry.getManualChanges().isEmpty()
|
||||
&& (entry.getEntryType() == EntryType.IMAGE || entry.getEntryType() == EntryType.IMAGE_HINT)
|
||||
&& entry.getManualChanges()
|
||||
.get(entry.getManualChanges().size() - 1).getProcessedDate() == null
|
||||
&& entry.getManualChanges()
|
||||
.get(entry.getManualChanges().size() - 1).getManualRedactionType().equals(ManualRedactionType.RECATEGORIZE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings.getMaxRedactionEntryValueLength() > 0 && entry.getValue() != null && entry.getValue().length() > settings.getMaxRedactionEntryValueLength()) {
|
||||
entry.setValue(entry.getValue().substring(0, settings.getMaxRedactionEntryValueLength()) + "...");
|
||||
log.warn("Truncated value in dossier {}, file {} on pages {} to {} chars",
|
||||
dossierId,
|
||||
fileId,
|
||||
entry.getPositions().stream().map(Position::getPageNumber).collect(Collectors.toList()),
|
||||
settings.getMaxRedactionEntryValueLength());
|
||||
}
|
||||
if (!entry.getManualChanges().isEmpty()
|
||||
&& (entry.isDictionaryEntry() || entry.isDossierDictionaryEntry())
|
||||
&& entry.getManualChanges()
|
||||
.get(entry.getManualChanges().size() - 1).getProcessedDate() == null
|
||||
&& entry.getManualChanges()
|
||||
.get(entry.getManualChanges().size() - 1).getManualRedactionType().equals(ManualRedactionType.ADD_TO_DICTIONARY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (settings.getMaxSectionLength() > 0 && entry.getSection() != null && entry.getSection().length() > settings.getMaxSectionLength()) {
|
||||
entry.setSection(entry.getSection().substring(0, settings.getMaxSectionLength()) + "...");
|
||||
log.warn("Truncated section in dossier {}, file {} on pages {} to {} chars",
|
||||
dossierId,
|
||||
fileId,
|
||||
entry.getPositions().stream().map(Position::getPageNumber).collect(Collectors.toList()),
|
||||
settings.getMaxSectionLength());
|
||||
}
|
||||
if (settings.getMaxRedactionEntryValueLength() > 0 && entry.getValue() != null && entry.getValue().length() > settings.getMaxRedactionEntryValueLength()) {
|
||||
entry.setValue(entry.getValue().substring(0, settings.getMaxRedactionEntryValueLength()) + "...");
|
||||
log.warn("Truncated value in dossier {}, file {} on pages {} to {} chars",
|
||||
dossierId,
|
||||
fileId,
|
||||
entry.getPositions()
|
||||
.stream()
|
||||
.map(Position::getPageNumber)
|
||||
.collect(Collectors.toList()),
|
||||
settings.getMaxRedactionEntryValueLength());
|
||||
}
|
||||
|
||||
Set<Integer> pages = new HashSet<>();
|
||||
for (Position position : entry.getPositions()) {
|
||||
if (settings.getMaxSectionLength() > 0 && entry.getSection() != null && entry.getSection().length() > settings.getMaxSectionLength()) {
|
||||
entry.setSection(entry.getSection().substring(0, settings.getMaxSectionLength()) + "...");
|
||||
log.warn("Truncated section in dossier {}, file {} on pages {} to {} chars",
|
||||
dossierId,
|
||||
fileId,
|
||||
entry.getPositions()
|
||||
.stream()
|
||||
.map(Position::getPageNumber)
|
||||
.collect(Collectors.toList()),
|
||||
settings.getMaxSectionLength());
|
||||
}
|
||||
|
||||
if (pages.isEmpty() || !pages.contains(position.getPageNumber())) {
|
||||
pages.add(position.getPageNumber());
|
||||
reportEntries.add(new ReportRedactionEntry(position.getPageNumber(),
|
||||
position.x(),
|
||||
position.y(),
|
||||
getSection(entry, position),
|
||||
checkTextForNull(entry.getLegalBasis()) + " " + legalBasisMappings.stream()
|
||||
.filter(lbm -> lbm.getReason().equalsIgnoreCase(entry.getLegalBasis()))
|
||||
.findAny()
|
||||
.map(EntityLogLegalBasis::getDescription)
|
||||
.orElse(""),
|
||||
entry.getLegalBasis(),
|
||||
legalBasisMappings.stream()
|
||||
.filter(lbm -> lbm.getReason().equalsIgnoreCase(entry.getLegalBasis()))
|
||||
.findAny()
|
||||
.map(EntityLogLegalBasis::getDescription)
|
||||
.orElse(""),
|
||||
checkTextForNull(entry.getTextBefore()) + entry.getValue() + checkTextForNull(entry.getTextAfter()),
|
||||
determineValue(entry),
|
||||
mapOfEntityDisplayName.get(entry.getType()),
|
||||
entry.getState() == EntryState.SKIPPED || entry.getState() == EntryState.IGNORED));
|
||||
}
|
||||
}
|
||||
});
|
||||
Set<Integer> pages = new HashSet<>();
|
||||
for (Position position : entry.getPositions()) {
|
||||
|
||||
if (pages.isEmpty() || !pages.contains(position.getPageNumber())) {
|
||||
pages.add(position.getPageNumber());
|
||||
reportEntries.add(new ReportRedactionEntry(position.getPageNumber(),
|
||||
position.x(),
|
||||
position.y(),
|
||||
getSection(entry, position),
|
||||
checkTextForNull(entry.getLegalBasis()) + " " + legalBasisMappings.stream()
|
||||
.filter(lbm -> lbm.getReason().equalsIgnoreCase(entry.getLegalBasis()))
|
||||
.findAny()
|
||||
.map(EntityLogLegalBasis::getDescription)
|
||||
.orElse(""),
|
||||
entry.getLegalBasis(),
|
||||
legalBasisMappings.stream()
|
||||
.filter(lbm -> lbm.getReason().equalsIgnoreCase(entry.getLegalBasis()))
|
||||
.findAny()
|
||||
.map(EntityLogLegalBasis::getDescription)
|
||||
.orElse(""),
|
||||
checkTextForNull(entry.getTextBefore()) + entry.getValue() + checkTextForNull(entry.getTextAfter()),
|
||||
determineValue(entry),
|
||||
mapOfEntityDisplayName.get(entry.getType()),
|
||||
entry.getState() == EntryState.SKIPPED || entry.getState() == EntryState.IGNORED));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
reportEntries.sort((entry1, entry2) -> {
|
||||
if (entry1.getPage() == entry2.getPage()) {
|
||||
@ -203,9 +210,12 @@ public class EntityLogConverterService {
|
||||
private String determineValue(EntityLogEntry entry) {
|
||||
|
||||
if (entry.getManualChanges() != null && !entry.getManualChanges().isEmpty()) {
|
||||
ManualChange lastChange = entry.getManualChanges().get(entry.getManualChanges().size() - 1);
|
||||
if (lastChange.getManualRedactionType().equals(ManualRedactionType.RESIZE) && lastChange.getPropertyChanges() != null) {
|
||||
return lastChange.getPropertyChanges().get("value");
|
||||
ManualChange lastChange = entry.getManualChanges()
|
||||
.get(entry.getManualChanges().size() - 1);
|
||||
if ((lastChange.getManualRedactionType().equals(ManualRedactionType.RESIZE) || lastChange.getManualRedactionType().equals(ManualRedactionType.RESIZE_IN_DICTIONARY))
|
||||
&& lastChange.getPropertyChanges() != null) {
|
||||
return lastChange.getPropertyChanges()
|
||||
.get("value");
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,7 +270,8 @@ public class EntityLogConverterService {
|
||||
|
||||
private boolean lastChangeIsRemoved(List<Change> changes) {
|
||||
|
||||
return last(changes).map(c -> c.getType() == ChangeType.REMOVED).orElse(false);
|
||||
return last(changes).map(c -> c.getType() == ChangeType.REMOVED)
|
||||
.orElse(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user