fix paging

This commit is contained in:
petervanhoute 2015-10-29 15:54:09 +01:00
parent d2cb35b6a1
commit a262bf64d0
1 changed files with 8 additions and 1 deletions

View File

@ -338,8 +338,15 @@ abstract class BaseResourceReturningMethodBinding extends BaseMethodBinding<Obje
count = result.preferredPageSize();
}
Integer offsetI = RestfulServerUtils.tryToExtractNamedParameter(theRequest, Constants.PARAM_PAGINGOFFSET);
if (offsetI == null || offsetI < 0) {
offsetI = 0;
}
int start = Math.max(0, Math.min(offsetI, result.size() - 1));
IVersionSpecificBundleFactory bundleFactory = theServer.getFhirContext().newBundleFactory();
bundleFactory.initializeBundleFromBundleProvider(theServer, result, responseEncoding, theRequest.getFhirServerBase(), linkSelf, prettyPrint, 0, count, null, getResponseBundleType(),
bundleFactory.initializeBundleFromBundleProvider(theServer, result, responseEncoding, theRequest.getFhirServerBase(), linkSelf, prettyPrint, start, count, null, getResponseBundleType(),
includes);
Bundle bundle = bundleFactory.getDstu1Bundle();
if (bundle != null) {