|
18 | 18 | package de.symeda.sormas.backend.person; |
19 | 19 |
|
20 | 20 | import static de.symeda.sormas.backend.ExtendedPostgreSQL94Dialect.SIMILARITY_OPERATOR; |
| 21 | +import static de.symeda.sormas.backend.common.CriteriaBuilderHelper.and; |
21 | 22 |
|
22 | 23 | import java.sql.Timestamp; |
23 | 24 | import java.util.Collections; |
@@ -311,24 +312,24 @@ public List<PersonNameDto> getMatchingNameDtos(PersonSimilarityCriteria criteria |
311 | 312 | Predicate activeCasesFilter = caseService.createActiveCasesFilter(cb, personCaseJoin); |
312 | 313 | Predicate caseUserFilter = caseService.createUserFilter(cb, personQuery, personCaseJoin); |
313 | 314 | Predicate personCasePredicate = |
314 | | - CriteriaBuilderHelper.and(cb, personCaseJoin.get(Case.ID).isNotNull(), activeCasesFilter, caseUserFilter); |
| 315 | + and(cb, personCaseJoin.get(Case.ID).isNotNull(), activeCasesFilter, caseUserFilter); |
315 | 316 |
|
316 | 317 | // Persons of active contacts |
317 | 318 | Predicate activeContactsFilter = contactService.createActiveContactsFilter(cb, personContactJoin); |
318 | 319 | Predicate contactUserFilter = contactService.createUserFilter(cb, personQuery, personContactJoin); |
319 | 320 | Predicate personContactPredicate = |
320 | | - CriteriaBuilderHelper.and(cb, personContactJoin.get(Contact.ID).isNotNull(), contactUserFilter, activeContactsFilter); |
| 321 | + and(cb, personContactJoin.get(Contact.ID).isNotNull(), contactUserFilter, activeContactsFilter); |
321 | 322 |
|
322 | 323 | // Persons of event participants in active events |
323 | 324 | Predicate activeEventParticipantsFilter = eventParticipantService.createActiveEventParticipantsFilter(cb, personEventParticipantJoin); |
324 | 325 | Predicate eventParticipantUserFilter = eventParticipantService.createUserFilter(cb, personQuery, personEventParticipantJoin); |
325 | 326 | Predicate personEventParticipantPredicate = |
326 | | - CriteriaBuilderHelper.and(cb, personEventParticipantJoin.get(EventParticipant.ID).isNotNull(), activeEventParticipantsFilter, eventParticipantUserFilter); |
| 327 | + and(cb, personEventParticipantJoin.get(EventParticipant.ID).isNotNull(), activeEventParticipantsFilter, eventParticipantUserFilter); |
327 | 328 |
|
328 | 329 | caseContactEventParticipantLinkPredicate = |
329 | 330 | CriteriaBuilderHelper.or(cb, personCasePredicate, personContactPredicate, personEventParticipantPredicate); |
330 | 331 |
|
331 | | - personQuery.where(CriteriaBuilderHelper.and(cb, personSimilarityFilter, caseContactEventParticipantLinkPredicate)); |
| 332 | + personQuery.where(and(cb, personSimilarityFilter, caseContactEventParticipantLinkPredicate)); |
332 | 333 | personQuery.distinct(true); |
333 | 334 |
|
334 | 335 | TypedQuery<PersonNameDto> query = em.createQuery(personQuery); |
@@ -410,34 +411,34 @@ public Predicate buildSimilarityCriteriaFilter(PersonSimilarityCriteria criteria |
410 | 411 |
|
411 | 412 | String name = criteria.getFirstName() + " " + criteria.getLastName(); |
412 | 413 |
|
413 | | - filter = CriteriaBuilderHelper.and(cb, filter, cb.isTrue(cb.function(SIMILARITY_OPERATOR, boolean.class, nameExpr, cb.literal(name)))); |
| 414 | + filter = and(cb, filter, cb.isTrue(cb.function(SIMILARITY_OPERATOR, boolean.class, nameExpr, cb.literal(name)))); |
414 | 415 | } |
415 | 416 |
|
416 | 417 | if (criteria.getSex() != null) { |
417 | | - filter = CriteriaBuilderHelper.and(cb, filter, cb.or(cb.isNull(personFrom.get(Person.SEX)), cb.equal(personFrom.get(Person.SEX), criteria.getSex()))); |
| 418 | + filter = and(cb, filter, cb.or(cb.isNull(personFrom.get(Person.SEX)), cb.equal(personFrom.get(Person.SEX), criteria.getSex()))); |
418 | 419 | } |
419 | 420 | if (criteria.getBirthdateYYYY() != null) { |
420 | | - filter = CriteriaBuilderHelper.and( |
| 421 | + filter = and( |
421 | 422 | cb, |
422 | 423 | filter, |
423 | 424 | cb.or( |
424 | 425 | cb.isNull(personFrom.get(Person.BIRTHDATE_YYYY)), |
425 | 426 | cb.equal(personFrom.get(Person.BIRTHDATE_YYYY), criteria.getBirthdateYYYY()))); |
426 | 427 | } |
427 | 428 | if (criteria.getBirthdateMM() != null) { |
428 | | - filter = CriteriaBuilderHelper.and( |
| 429 | + filter = and( |
429 | 430 | cb, |
430 | 431 | filter, |
431 | 432 | cb.or(cb.isNull(personFrom.get(Person.BIRTHDATE_MM)), cb.equal(personFrom.get(Person.BIRTHDATE_MM), criteria.getBirthdateMM()))); |
432 | 433 | } |
433 | 434 | if (criteria.getBirthdateDD() != null) { |
434 | | - filter = CriteriaBuilderHelper.and( |
| 435 | + filter = and( |
435 | 436 | cb, |
436 | 437 | filter, |
437 | 438 | cb.or(cb.isNull(personFrom.get(Person.BIRTHDATE_DD)), cb.equal(personFrom.get(Person.BIRTHDATE_DD), criteria.getBirthdateDD()))); |
438 | 439 | } |
439 | 440 | if (!StringUtils.isBlank(criteria.getNationalHealthId())) { |
440 | | - filter = CriteriaBuilderHelper.and( |
| 441 | + filter = and( |
441 | 442 | cb, |
442 | 443 | filter, |
443 | 444 | cb.or( |
|
0 commit comments