code: public static <T> CriteriaQuery<T> buildQuery(final Filter filter, final IFilterQueryBuilder<T> filterQueryBuilder) {
          final CriteriaQuery<T> query = filterQueryBuilder.getBaseCriteriaQuery();
  
          final Predicate condition = buildQueryConditions(filter, filterQueryBuilder);
  
          return condition == null ? query : query.where(condition);
      }
docs: This function is used to create the HQL query where clause that is
  appended to the generic EJBQL (as created in default EntityList objects)
  select statement. It takes the request parameters to get the tags that
  are to be included in the clause, groups them by category, and then take
  additional request parameters to define the boolean operations to use
  between tags in a category, and between categories.
  
  @return the clause to append to the EJBQL select statement