DM-504: always exclude hard deleted files

* adjusted error message
* also removed annotationStatus since it is always APPROVED anyway
* removed inactive options from FilteredEntityLogRequest
This commit is contained in:
Kilian Schuettler 2023-10-10 10:27:10 +02:00
parent 6ec370ad01
commit 781b761aad
5 changed files with 4 additions and 11 deletions

View File

@ -98,7 +98,7 @@ public class FileControllerV2 implements FileResource {
FileStatus status = statusController.getFileStatus(dossierId, fileId);
if (status.getHardDeletedTime() != null) {
throw new NotFoundException(String.format("The requested file has been hard deleted on %s.", status.getHardDeletedTime().format(DateTimeFormatter.ISO_LOCAL_DATE)));
throw new NotFoundException("File not found");
}
if (!includeSoftDeleted && status.getSoftDeletedTime() != null) {

View File

@ -41,7 +41,7 @@ public class EntityLogService {
}
if (excludedTypes != null) {
redactionLog.getEntityLogEntry().removeIf(nextEntry -> excludedTypes.contains(nextEntry.getType()));
redactionLog.getEntityLogEntry().removeIf(entry -> excludedTypes.contains(entry.getType()));
}
return redactionLog;
@ -68,9 +68,8 @@ public class EntityLogService {
}
}
for (var manualChange : redactionLogEntry.getManualChanges()) {
if (manualChange.getProcessedDate() != null && manualChange.getProcessedDate()
.isAfter(filteredEntityLogRequest.getSpecifiedDate()) || manualChange.getRequestedDate() != null && manualChange.getRequestedDate()
.isAfter(filteredEntityLogRequest.getSpecifiedDate())) {
if (manualChange.getProcessedDate() != null && manualChange.getProcessedDate().isAfter(filteredEntityLogRequest.getSpecifiedDate()) || //
manualChange.getRequestedDate() != null && manualChange.getRequestedDate().isAfter(filteredEntityLogRequest.getSpecifiedDate())) {
isAfterSpecifiedDate = true;
break;
}

View File

@ -1,6 +1,5 @@
package com.iqser.red.service.persistence.management.v1.processor.service.layoutparsing;
import java.util.Map;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Value;

View File

@ -15,8 +15,6 @@ import lombok.NoArgsConstructor;
public class FilteredEntityLogRequest {
private List<String> excludedTypes;
private boolean withManualRedactions;
private boolean includeFalsePositives;
private OffsetDateTime specifiedDate;
}

View File

@ -4,7 +4,6 @@ import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.AnnotationStatus;
import com.iqser.red.service.persistence.service.v1.api.shared.model.annotations.entitymapped.BaseAnnotation;
import lombok.AllArgsConstructor;
@ -18,7 +17,6 @@ import lombok.NoArgsConstructor;
@Builder
public class ManualChange {
private AnnotationStatus annotationStatus;
private ManualRedactionType manualRedactionType;
private OffsetDateTime processedDate;
private OffsetDateTime requestedDate;
@ -29,7 +27,6 @@ public class ManualChange {
public static ManualChange from(BaseAnnotation baseAnnotation) {
ManualChange manualChange = new ManualChange();
manualChange.annotationStatus = baseAnnotation.getStatus();
manualChange.processedDate = baseAnnotation.getProcessedDate();
manualChange.requestedDate = baseAnnotation.getRequestDate();
manualChange.userId = baseAnnotation.getUser();