use of de.symeda.sormas.backend.caze.CaseJurisdictionPredicateValidator in project SORMAS-Project by hzi-braunschweig.
the class UserFacadeEjb method getUsersHavingCaseInJurisdiction.
@Override
public List<UserReferenceDto> getUsersHavingCaseInJurisdiction(CaseReferenceDto caseReferenceDto) {
return getUsersHavingEntityInJurisdiction((cb, cq, userRoot) -> {
final Subquery<Case> caseJurisdictionSubquery = cq.subquery(Case.class);
final Root<Case> caseRoot = caseJurisdictionSubquery.from(Case.class);
final CaseJurisdictionPredicateValidator caseJurisdictionPredicateValidator = CaseJurisdictionPredicateValidator.of(new CaseQueryContext(cb, cq, caseRoot), userRoot);
caseJurisdictionSubquery.select(caseRoot).where(cb.and(cb.equal(caseRoot.get(Case.UUID), caseReferenceDto.getUuid()), cb.isTrue(caseJurisdictionPredicateValidator.inJurisdictionOrOwned()), cb.or(cb.isNull(userRoot.get(User.LIMITED_DISEASE)), cb.equal(userRoot.get(User.LIMITED_DISEASE), caseRoot.get(Case.DISEASE)))));
return caseJurisdictionSubquery;
});
}
Aggregations