if (pagingRequest.equals(PagingRequest.ALL)) {
result.getDocuments().addAll(namedJdbc.query(sql[0], args, extractor));
result.setPaging(Paging.of(pagingRequest, result.getDocuments()));
} else {
s_logger.debug("executing sql {}", sql[1]);
final int count = namedJdbc.queryForObject(sql[1], args, Integer.class);
result.setPaging(Paging.of(pagingRequest, count));
if (count > 0 && pagingRequest.equals(PagingRequest.NONE) == false) {
s_logger.debug("executing sql {}", sql[0]);
result.getDocuments().addAll(namedJdbc.query(sql[0], args, extractor));
}