Performing queries for repository items using RQL is similar to retrieving them with getItems()., but querying provides for more control over the items included in the results. Use the RestRepositoryHelper.executeRQLQuery() method to execute and RQL query.

To request a range of items, use the atg-rest-index and atg-rest-count parameters with the executeRQLQuery() method, just as you’d use them with getItems(). See Getting Repository Items for more information.

In the following example, the INDEX and COUNT keywords in the RQL language are used instead of the “atg-rest-index” and “atg-rest-count” parameters.

Map<String,String> params = new HashMap<String,String>();
params.put(RestConstants.COUNT, 10);
params.put(RestConstants.INDEX, 0);
RestResult result = RestRepositoryHelper.executeRQLQuery("/atg/commerce/catalog/ProductCatalog",
"product", "age >= 30", params, session);
params.put(RestConstants.INDEX, 10);
result = RestRepositoryHelper.executeRQLQuery("/atg/commerce/catalog/ProductCatalog",
"product", "age >= 30", params, session);
params.put(RestConstants.INDEX, 20);
result = RestRepositoryHelper.executeRQLQuery("/atg/commerce/catalog/ProductCatalog",
"product", "age >= 30", params, session);
 
loading table of contents...