This commit is contained in:
Ahmet Melih Aydoğdu 2024-09-26 10:43:19 -04:00 committed by GitHub
commit 4af9be6ebd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 3 deletions

View File

@ -25,6 +25,7 @@ import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
import ca.uhn.fhir.rest.api.PatchTypeEnum;
@ -595,6 +596,16 @@ public class BundleUtil {
return retVal;
}
public static void setSearchModeMetadata(FhirContext theContext, IBaseBundle theBundle) {
List<SearchBundleEntryParts> searchBundleEntryParts = getSearchBundleEntryParts(theContext, theBundle);
searchBundleEntryParts.forEach(searchBundleEntryPart -> {
IBaseResource resource = searchBundleEntryPart.getResource();
if (resource != null) {
ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.put(resource, searchBundleEntryPart.getSearchMode());
}
});
}
private static SearchBundleEntryParts getSearchBundleEntryParts(
BaseRuntimeChildDefinition theFullUrlChildDef,
BaseRuntimeChildDefinition theResourceChildDef,

View File

@ -128,6 +128,7 @@ 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;
@ -582,7 +583,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
myLastRequest = theInvocation.asHttpRequest(getServerBase(), theParams, getEncoding(), myPrettyPrint);
}
Z resp = invokeClient(
return invokeClient(
myContext,
theHandler,
theInvocation,
@ -594,7 +595,6 @@ public class GenericClient extends BaseClient implements IGenericClient {
myCacheControlDirective,
myCustomAcceptHeaderValue,
myCustomHeaderValues);
return resp;
}
protected IBaseResource parseResourceBody(String theResourceBody) {
@ -2198,7 +2198,13 @@ public class GenericClient extends BaseClient implements IGenericClient {
myContext, myResourceName, params, resourceId, myCompartmentName, mySearchStyle);
}
return (OUTPUT) invoke(params, binding, invocation);
OUTPUT invoke = (OUTPUT) invoke(params, binding, invocation);
if (invoke instanceof IBaseBundle) {
BundleUtil.setSearchModeMetadata(myContext, (IBaseBundle) invoke);
}
return invoke;
}
@Override