diff --git a/data-service/src/main/java/uk/gov/laa/ccms/data/repository/specification/NotificationSpecification.java b/data-service/src/main/java/uk/gov/laa/ccms/data/repository/specification/NotificationSpecification.java index 65c4d4d..1d7fc07 100644 --- a/data-service/src/main/java/uk/gov/laa/ccms/data/repository/specification/NotificationSpecification.java +++ b/data-service/src/main/java/uk/gov/laa/ccms/data/repository/specification/NotificationSpecification.java @@ -69,18 +69,18 @@ public static Specification withFilters( List predicates = new ArrayList<>(); // Add predicates for each filter only if they are non-null - if (caseReferenceNumber != null) { + if (caseReferenceNumber != null && !caseReferenceNumber.isBlank()) { predicates.add(criteriaBuilder.like(root.get("lscCaseRefReference"), "%" + caseReferenceNumber + "%")); } - if (providerCaseReference != null) { + if (providerCaseReference != null && !providerCaseReference.isBlank()) { predicates.add(criteriaBuilder.like(root.get("providerCaseReference"), "%" + providerCaseReference + "%")); } - if (assignedToUserId != null) { + if (assignedToUserId != null && !assignedToUserId.isBlank()) { predicates.add(criteriaBuilder.equal(root.get("assignedTo"), assignedToUserId)); } - if (clientSurname != null) { + if (clientSurname != null && !clientSurname.isBlank()) { predicates.add(criteriaBuilder.like(root.get("personLastName"), "%" + clientSurname + "%")); } if (feeEarnerId != null) { @@ -89,7 +89,7 @@ public static Specification withFilters( if (!includeClosed) { predicates.add(criteriaBuilder.equal(root.get("isOpen"), "true")); } - if (notificationType != null) { + if (notificationType != null && !notificationType.isBlank()) { predicates.add(criteriaBuilder.equal(root.get("actionNotificationInd"), notificationType)); } if (dateFrom != null) {