From 9a4933f536b05f9c86a71e37331a14d8dac0c89a Mon Sep 17 00:00:00 2001 From: Ruth Alkema Date: Wed, 24 Jan 2018 14:59:03 +0100 Subject: [PATCH] Fix problem with _include=MedicationRequest:medication A query for MedicationRequest that should include medication did not work, because the SearchParamDefinition defined the path as MedicationRequest.medication.as(Reference) --- .../java/ca/uhn/fhir/util/ResourceReferenceInfo.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ResourceReferenceInfo.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ResourceReferenceInfo.java index 86fadbc89a9..adac282629e 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ResourceReferenceInfo.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ResourceReferenceInfo.java @@ -101,9 +101,15 @@ public class ResourceReferenceInfo { if (resourceDef != null) { RuntimeSearchParam searchParamDef = resourceDef.getSearchParam(paramName); if (searchParamDef!=null) { - if (searchParamDef.getPathsSplit().contains(myOwningResource + "." + myName)) { - return true; + final String myCompleteName = myOwningResource + "." + myName; + boolean matched = false; + for (String s : searchParamDef.getPathsSplit()) { + if (s.equals(myCompleteName) || + s.startsWith(myCompleteName + ".")) { + matched = true; break; + } } + return matched; } } return false;