@Test public void executeShortWhereHQLQueryWithoutProgrammingRights() throws QueryException { execute("where doc.space='Main'", false); }
@Override public <T> List<T> execute(final Query query) throws QueryException { checkAllowed(query); String oldDatabase = getContext().getWikiId(); try { this.progress.startStep(query, "query.hql.progress.execute", "Execute HQL query [{}]", query); if (query.getWiki() != null) { getContext().setWikiId(query.getWiki()); } return getStore().executeRead(getContext(), session -> { org.hibernate.query.Query<T> hquery = createHibernateQuery(session, query); List<T> results = hquery.list(); if (query.getFilters() != null && !query.getFilters().isEmpty()) { for (QueryFilter filter : query.getFilters()) { results = filter.filterResults(results); } } return results; }); } catch (XWikiException e) { throw new QueryException("Exception while executing query", query, e); } finally { getContext().setWikiId(oldDatabase); this.progress.endStep(query); } }
HqlQueryExecutor implements QueryExecutor, Initializable { @Override public <T> List<T> execute(final Query query) throws QueryException { checkAllowed(query); String oldDatabase = getContext().getWikiId(); try { this.progress.startStep(query, "query.hql.progress.execute", "Execute HQL query [{}]", query); if (query.getWiki() != null) { getContext().setWikiId(query.getWiki()); } return getStore().executeRead(getContext(), session -> { org.hibernate.query.Query<T> hquery = createHibernateQuery(session, query); List<T> results = hquery.list(); if (query.getFilters() != null && !query.getFilters().isEmpty()) { for (QueryFilter filter : query.getFilters()) { results = filter.filterResults(results); } } return results; }); } catch (XWikiException e) { throw new QueryException("Exception while executing query", query, e); } finally { getContext().setWikiId(oldDatabase); this.progress.endStep(query); } } }
HqlQueryExecutor implements QueryExecutor, Initializable { @Override public <T> List<T> execute(final Query query) throws QueryException { checkAllowed(query); String oldDatabase = getContext().getWikiId(); try { this.progress.startStep(query, "query.hql.progress.execute", "Execute HQL query [{}]", query); if (query.getWiki() != null) { getContext().setWikiId(query.getWiki()); } return getStore().executeRead(getContext(), session -> { org.hibernate.query.Query<T> hquery = createHibernateQuery(session, query); List<T> results = hquery.list(); if (query.getFilters() != null && !query.getFilters().isEmpty()) { for (QueryFilter filter : query.getFilters()) { results = filter.filterResults(results); } } return results; }); } catch (XWikiException e) { throw new QueryException("Exception while executing query", query, e); } finally { getContext().setWikiId(oldDatabase); this.progress.endStep(query); } }  }
HqlQueryExecutor implements QueryExecutor, Initializable { @Override public <T> List<T> execute(final Query query) throws QueryException { checkAllowed(query); String oldDatabase = getContext().getWikiId(); try { this.progress.startStep(query, "query.hql.progress.execute", "Execute HQL query [{}]", query); if (query.getWiki() != null) { getContext().setWikiId(query.getWiki()); } return getStore().executeRead(getContext(), session -> { org.hibernate.query.Query<T> hquery = createHibernateQuery(session, query); List<T> results = hquery.list(); if (query.getFilters() != null && !query.getFilters().isEmpty()) { for (QueryFilter filter : query.getFilters()) { results = filter.filterResults(results); } } return results; }); } catch (XWikiException e) { throw new QueryException("Exception while executing query", query, e); } finally { getContext().setWikiId(oldDatabase); this.progress.endStep(query); } }  @Override void initialize(); @Override List<T> execute(final Query query); }
HqlQueryExecutor implements QueryExecutor, Initializable { @Override public <T> List<T> execute(final Query query) throws QueryException { checkAllowed(query); String oldDatabase = getContext().getWikiId(); try { this.progress.startStep(query, "query.hql.progress.execute", "Execute HQL query [{}]", query); if (query.getWiki() != null) { getContext().setWikiId(query.getWiki()); } return getStore().executeRead(getContext(), session -> { org.hibernate.query.Query<T> hquery = createHibernateQuery(session, query); List<T> results = hquery.list(); if (query.getFilters() != null && !query.getFilters().isEmpty()) { for (QueryFilter filter : query.getFilters()) { results = filter.filterResults(results); } } return results; }); } catch (XWikiException e) { throw new QueryException("Exception while executing query", query, e); } finally { getContext().setWikiId(oldDatabase); this.progress.endStep(query); } }  @Override void initialize(); @Override List<T> execute(final Query query);  }