Search in sources :

Example 1 with ViewQuery

use of com.day.cq.wcm.core.contentfinder.ViewQuery in project acs-aem-commons by Adobe-Consulting-Services.

the class QueryBuilderViewHandler method createQuery.

@Override
protected ViewQuery createQuery(SlingHttpServletRequest slingRequest, Session session, String queryString) throws Exception {
    final ResourceResolver resolver = slingRequest.getResourceResolver();
    final QueryBuilder qb = resolver.adaptTo(QueryBuilder.class);
    Map<String, String> map;
    if (GQLToQueryBuilderConverter.convertToQueryBuilder(slingRequest)) {
        map = this.convertToQueryBuilderParams(slingRequest, queryString);
        log.debug("Forced QueryBuilder Parameter Map: {}", map);
    } else {
        map = this.getQueryBuilderParams(slingRequest, queryString);
        log.debug("Converted QueryBuilder Parameter Map: {}", map);
    }
    final Query query = qb.createQuery(PredicateGroup.create(map), session);
    return new QueryBuilderViewQuery(query);
}
Also used : ViewQuery(com.day.cq.wcm.core.contentfinder.ViewQuery) Query(com.day.cq.search.Query) ResourceResolver(org.apache.sling.api.resource.ResourceResolver) QueryBuilder(com.day.cq.search.QueryBuilder)

Aggregations

Query (com.day.cq.search.Query)1 QueryBuilder (com.day.cq.search.QueryBuilder)1 ViewQuery (com.day.cq.wcm.core.contentfinder.ViewQuery)1 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)1