public ItemIterable<QueryResult> query(final String statement, final boolean searchAllVersions,
OperationContext context) {
final DiscoveryService discoveryService = getBinding().getDiscoveryService();
final ObjectFactory objectFactory = this.getObjectFactory();
final OperationContext ctxt = new OperationContextImpl(context);
return new CollectionIterable<QueryResult>(new AbstractPageFetcher<QueryResult>(ctxt.getMaxItemsPerPage()) {
@Override
protected AbstractPageFetcher.Page<QueryResult> fetchPage(long skipCount) {
// fetch the data
ObjectList resultList = discoveryService.query(getRepositoryId(), statement, searchAllVersions,
ctxt.isIncludeAllowableActions(), ctxt.getIncludeRelationships(),
ctxt.getRenditionFilterString(), BigInteger.valueOf(this.maxNumItems),
BigInteger.valueOf(skipCount), null);
// convert type definitions
List<QueryResult> page = new ArrayList<QueryResult>();
if (resultList.getObjects() != null) {