From 4398040451eafe89d03ce7f0685454abd42f8c31 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Tue, 1 Dec 2015 10:22:50 -0500 Subject: [PATCH] Add count(int) method to fluent client search --- .../ca/uhn/fhir/rest/client/GenericClient.java | 5 +++++ .../main/java/ca/uhn/fhir/rest/gclient/IQuery.java | 14 ++++++++++++++ src/changes/changes.xml | 6 ++++++ 3 files changed, 25 insertions(+) diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/GenericClient.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/GenericClient.java index c929d66320b..6b568af7fde 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/GenericClient.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/GenericClient.java @@ -1854,6 +1854,11 @@ public class GenericClient extends BaseClient implements IGenericClient { @Override public IQuery limitTo(int theLimitTo) { + return count(theLimitTo); + } + + @Override + public IQuery count(int theLimitTo) { if (theLimitTo > 0) { myParamLimit = theLimitTo; } else { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IQuery.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IQuery.java index 4cd7953d12c..e55ff42277f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IQuery.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IQuery.java @@ -41,8 +41,22 @@ public interface IQuery extends IClientExecutable, T>, IBaseQuery sort(); + /** + * Specifies the _count parameter, which indicates to the server how many resources should be returned + * on a single page. + * + * @deprecated This parameter is badly named, since FHIR calls this parameter "_count" and not "_limit". Use {@link #count(int)} instead (it also sets the _count parameter) + */ IQuery limitTo(int theLimitTo); + /** + * Specifies the _count parameter, which indicates to the server how many resources should be returned + * on a single page. + * + * @since 1.4 + */ + IQuery count(int theCount); + /** * Match only resources where the resource has the given tag. This parameter corresponds to * the _tag URL parameter. diff --git a/src/changes/changes.xml b/src/changes/changes.xml index b26c40acc4f..4ee2d3e61f8 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -40,6 +40,12 @@ and a QuestionnaireResponse, it would fail because the QuestionnaireResponse validator wouldn't be able to find the questionnaire. This is now corrected. + + Add a new method to the generic/fluent client for searching: + .count(int)
]]> + This replaces the existing ".limitTo(int)" method which has + now been deprocated because it was badly named and undocumented. +