@ SuppressWarnings ( { "unchecked" } ) private Predicate convertParametersToPredicate ( Root < ? > from , CriteriaQuery < ? > query ) { List < Predicate > predicates = new ArrayList <> ( ) ; for ( Map . Entry < String , Set < Object > > value : request . getParameters ( ) . entrySet ( ) ) { Subquery < JPAEntry > subquery = buildJPAEntrySubquery ( value . getKey ( ) , value . getValue ( ) , from , query ) ; predicates . add ( builder . exists ( subquery ) ) ; } if ( request . isAndJoined ( ) ) { return builder . and ( Iterables . toArray ( predicates , Predicate . class ) ) ; } else { return builder . or ( Iterables . toArray ( predicates , Predicate . class ) ) ; } }
Converts a query request parameter map for a query operation into a list of predicates which need to be added to the criteria query .