Skip to content

Commit aad7d50

Browse files
committed
Issue #329 - clean up logic in FHIRResource.addLinks
Signed-off-by: John T.E. Timm <johntimm@us.ibm.com>
1 parent 40ac10a commit aad7d50

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

fhir-server/src/main/java/com/ibm/fhir/server/resources/FHIRResource.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3891,11 +3891,9 @@ private Bundle addLinks(FHIRPagingContext context, Bundle bundle, String request
38913891
Bundle.Link.builder().relation(string("self")).url(Url.of(selfUri)).build();
38923892
bundleBuilder.link(selfLink);
38933893

3894-
// If for search with _summary=count, then don't add previous and next links.
3895-
if (!(context instanceof FHIRSearchContext
3896-
&& ((FHIRSearchContext) context).getSummaryParameter() != null
3897-
&& ((FHIRSearchContext) context).getSummaryParameter().equals(SummaryValueSet.COUNT))
3898-
&& ((FHIRSearchContext) context).getPageSize() > 0) {
3894+
// If for search with _summary=count or pageSize == 0, then don't add previous and next links.
3895+
SummaryValueSet summaryParameter = (context instanceof FHIRSearchContext) ? ((FHIRSearchContext) context).getSummaryParameter() : null;
3896+
if (!SummaryValueSet.COUNT.equals(summaryParameter) && context.getPageSize() > 0) {
38993897
int nextPageNumber = context.getPageNumber() + 1;
39003898
if (nextPageNumber <= context.getLastPageNumber()) {
39013899

0 commit comments

Comments
 (0)