final ResultSetExtractor<List<T>> extractor, final AbstractDocumentsResult<T> result) {
s_logger.debug("with args {}", args);
final NamedParameterJdbcOperations namedJdbc = getJdbcTemplate();
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));