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)
This commit is contained in:
Ruth Alkema 2018-01-24 14:59:03 +01:00
parent 0677f35847
commit 9a4933f536
1 changed files with 8 additions and 2 deletions

View File

@ -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;