public void enableFilter(String filterName, Map<String, Object> filterParams) {
    Filter filter;
    if (filterName != null) {
      filter = ((Session) this.em.unwrap(Session.class)).enableFilter(filterName);

      if (filterParams == null) return;
      for (String filterParamName : filterParams.keySet()) {
        Object filterParamValue = filterParams.get(filterParamName);
        filter.setParameter(filterParamName, filterParamValue);
      }
    }
  }
  public List<M> doQueryWithFilter(
      String filterName, String filterQueryName, Map inFilterParams, Map inQueryParams) {
    if (BaseRepository.class.isAssignableFrom(this.springDataRepositoryInterface)) {
      Annotation entityFilterAnn =
          this.springDataRepositoryInterface.getAnnotation(EntityFilter.class);

      if (entityFilterAnn != null) {
        EntityFilter entityFilter = (EntityFilter) entityFilterAnn;
        FilterQuery[] filterQuerys = entityFilter.filterQueries();
        for (FilterQuery fQuery : filterQuerys) {
          if (StringUtils.equals(filterQueryName, fQuery.name())) {
            String jpql = fQuery.jpql();
            Filter filter = ((Session) this.em.unwrap(Session.class)).enableFilter(filterName);

            for (Iterator i$ = inFilterParams.keySet().iterator(); i$.hasNext(); ) {
              Object key = i$.next();
              String filterParamName = key.toString();
              Object filterParamValue = inFilterParams.get(key);
              filter.setParameter(filterParamName, filterParamValue);
            }

            Query query = this.em.createQuery(jpql);
            for (Iterator i$ = inQueryParams.keySet().iterator(); i$.hasNext(); ) {
              Object key = i$.next();
              String queryParamName = key.toString();
              Object queryParamValue = inQueryParams.get(key);
              query.setParameter(queryParamName, queryParamValue);
            }

            return query.getResultList();
          }
        }
      }
    }
    return null;
  }