Skip to content

Commit

Permalink
CCMSPUI-454: Stop filtering when param is empty string
Browse files Browse the repository at this point in the history
Signed-off-by: Jamie Briggs <[email protected]>
  • Loading branch information
JamieBriggs-MoJ committed Dec 20, 2024
1 parent ccd49bf commit 398d49f
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,18 @@ public static Specification<Notification> withFilters(
List<Predicate> 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) {
Expand All @@ -89,7 +89,7 @@ public static Specification<Notification> 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) {
Expand Down

0 comments on commit 398d49f

Please sign in to comment.