From ea543cf7c233b9014ff90fc60426991818092b34 Mon Sep 17 00:00:00 2001 From: "dalia.florinda" Date: Mon, 19 Jan 2026 09:32:03 +0100 Subject: [PATCH] add filter doc/videos --- .../olympus/apollo/services/KSDocumentService.java | 11 ++++++++++- .../com/olympus/apollo/services/KSVideoService.java | 12 +++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/olympus/apollo/services/KSDocumentService.java b/src/main/java/com/olympus/apollo/services/KSDocumentService.java index 22a6741..24bb42c 100644 --- a/src/main/java/com/olympus/apollo/services/KSDocumentService.java +++ b/src/main/java/com/olympus/apollo/services/KSDocumentService.java @@ -51,7 +51,16 @@ public class KSDocumentService { User principal = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); try { - return ksdocRepo.findByProjectName(principal.getSelectedProject().getInternal_name(), Sort.by(Sort.Direction.DESC, "ingestionDate")); + List documents = ksdocRepo.findByProjectName(principal.getSelectedProject().getInternal_name(), Sort.by(Sort.Direction.DESC, "ingestionDate")); + + // Filtra i documenti: mostra solo quelli senza ingestionStatusV2 o con valore vuoto/nullo + if (documents != null) { + return documents.stream() + .filter(doc -> doc.getIngestionStatusV2() == null || doc.getIngestionStatusV2().trim().isEmpty()) + .collect(Collectors.toList()); + } + + return documents; } catch (Exception e) { logger.error("Error in findByProjectNameAndApplicationName function: " + e.getMessage()); } diff --git a/src/main/java/com/olympus/apollo/services/KSVideoService.java b/src/main/java/com/olympus/apollo/services/KSVideoService.java index d52eb75..2d87038 100644 --- a/src/main/java/com/olympus/apollo/services/KSVideoService.java +++ b/src/main/java/com/olympus/apollo/services/KSVideoService.java @@ -4,6 +4,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; +import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -40,7 +41,16 @@ public class KSVideoService { } public List findByGroupId(String groupId) { - return ksVideoRepository.findByGroupId(groupId, Sort.by(Sort.Direction.DESC, "ingestionDate")); + List videos = ksVideoRepository.findByGroupId(groupId, Sort.by(Sort.Direction.DESC, "ingestionDate")); + + // Filtra i video: mostra solo quelli senza ingestionStatusV2 o con valore vuoto/nullo + if (videos != null) { + return videos.stream() + .filter(video -> video.getIngestionStatusV2() == null || video.getIngestionStatusV2().trim().isEmpty()) + .collect(Collectors.toList()); + } + + return videos; } public ResponseEntity downloadKSVideo(KSVideo video) {