コード例 #1
0
ファイル: RestQueryHandler.java プロジェクト: nikss/modeshape
  private void setRows(
      long offset,
      long limit,
      Session session,
      QueryResult result,
      RestQueryResult restQueryResult,
      String[] columnNames,
      String baseUrl)
      throws RepositoryException {
    RowIterator resultRows = result.getRows();
    if (offset > 0) {
      resultRows.skip(offset);
    }
    if (limit < 0) {
      limit = Long.MAX_VALUE;
    }

    while (resultRows.hasNext() && limit > 0) {
      limit--;
      Row resultRow = resultRows.nextRow();

      RestQueryResult.RestRow restRow =
          createRestRow(session, result, restQueryResult, columnNames, baseUrl, resultRow);
      createLinksFromNodePaths(result, baseUrl, resultRow, restRow);

      restQueryResult.addRow(restRow);
    }
  }