From f6e84ea8011d329aa0ff7c25ab83e07981fdb77c Mon Sep 17 00:00:00 2001 From: Melih Aydogdu Date: Mon, 27 May 2024 09:37:55 +0200 Subject: [PATCH] search entry mode added to metadata of bundle entries --- .../java/ca/uhn/fhir/rest/client/impl/GenericClient.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/GenericClient.java b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/GenericClient.java index 8b8e00f0d6c..ae0cd079306 100644 --- a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/GenericClient.java +++ b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/GenericClient.java @@ -128,9 +128,11 @@ import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.NotModifiedException; +import ca.uhn.fhir.util.BundleUtil; import ca.uhn.fhir.util.ICallable; import ca.uhn.fhir.util.ParametersUtil; import ca.uhn.fhir.util.UrlUtil; +import ca.uhn.fhir.util.bundle.SearchBundleEntryParts; import com.google.common.base.Charsets; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; @@ -594,6 +596,13 @@ public class GenericClient extends BaseClient implements IGenericClient { myCacheControlDirective, myCustomAcceptHeaderValue, myCustomHeaderValues); + + if (resp instanceof IBaseBundle) { + List searchBundleEntryParts = + BundleUtil.getSearchBundleEntryParts(getFhirContext(), (IBaseBundle) resp); + searchBundleEntryParts.forEach(searchBundleEntryPart -> ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put( + searchBundleEntryPart.getResource(), searchBundleEntryPart.getSearchMode())); + } return resp; }