From 426b5eb44ad424cc5cdfda201a47d9cd32d0422e Mon Sep 17 00:00:00 2001 From: Joel Dudley <joeldudleyr3@users.noreply.github.com> Date: Tue, 5 Dec 2017 10:25:48 +0000 Subject: [PATCH] Adds an example use of pagination. --- docs/source/api-vault-query.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/source/api-vault-query.rst b/docs/source/api-vault-query.rst index a525a8b413..b0f295268e 100644 --- a/docs/source/api-vault-query.rst +++ b/docs/source/api-vault-query.rst @@ -176,6 +176,17 @@ define a ``PageSpecification`` to correctly process results with efficient memor place to alert API users to the need for pagination where a single query returns more than 200 results and no ``PageSpecification`` has been supplied. +Here's a query that extracts every unconsumed ``ContractState`` from the vault in pages of size 200, starting from the +default page number (page one): + +.. container:: codeset + + .. sourcecode:: kotlin + + val vaultSnapshot = proxy.vaultQueryBy<ContractState>( + QueryCriteria.VaultQueryCriteria(Vault.StateStatus.UNCONSUMED), + PageSpecification(DEFAULT_PAGE_NUM, 200)) + .. note:: A pages maximum size ``MAX_PAGE_SIZE`` is defined as ``Int.MAX_VALUE`` and should be used with extreme caution as results returned may exceed your JVM's memory footprint.