Skip to content

Commit 88e9c87

Browse files
committed
Issue #329 - futher refinment of FHIRResource.addLinks
Signed-off-by: John T.E. Timm <johntimm@us.ibm.com>
1 parent aad7d50 commit 88e9c87

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3875,10 +3875,13 @@ private Boolean isUpdateCreateEnabled() {
38753875

38763876
private Bundle addLinks(FHIRPagingContext context, Bundle bundle, String requestUri) {
38773877
String selfUri = null;
3878+
SummaryValueSet summaryParameter = null;
38783879
Bundle.Builder bundleBuilder = bundle.toBuilder();
38793880
if (context instanceof FHIRSearchContext) {
3881+
FHIRSearchContext searchContext = (FHIRSearchContext) context;
3882+
summaryParameter = searchContext.getSummaryParameter();
38803883
try {
3881-
selfUri = SearchUtil.buildSearchSelfUri(requestUri, (FHIRSearchContext) context);
3884+
selfUri = SearchUtil.buildSearchSelfUri(requestUri, searchContext);
38823885
} catch (Exception e) {
38833886
log.log(Level.WARNING, "Unable to construct self link for search result bundle; using the request URI instead.", e);
38843887
}
@@ -3892,7 +3895,6 @@ private Bundle addLinks(FHIRPagingContext context, Bundle bundle, String request
38923895
bundleBuilder.link(selfLink);
38933896

38943897
// 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;
38963898
if (!SummaryValueSet.COUNT.equals(summaryParameter) && context.getPageSize() > 0) {
38973899
int nextPageNumber = context.getPageNumber() + 1;
38983900
if (nextPageNumber <= context.getLastPageNumber()) {

0 commit comments

Comments
 (0)