fix bug with type at root of statement

This commit is contained in:
Grahame Grieve 2020-03-31 10:14:45 +11:00
parent 232f1ff8ff
commit d6ee58d47a
1 changed files with 20 additions and 2 deletions

View File

@ -2329,8 +2329,21 @@ public class FHIRPathEngine {
}
}
if (atEntry && Character.isUpperCase(exp.getName().charAt(0))) {// special case for start up
if (item.isResource() && item.fhirType().equals(exp.getName()))
result.add(item);
StructureDefinition sd = worker.fetchTypeDefinition(item.fhirType());
if (sd == null) {
// logical model
if (exp.getName().equals(item.fhirType())) {
result.add(item);
}
} else {
while (sd != null) {
if (sd.getType().equals(exp.getName())) {
result.add(item);
break;
}
sd = worker.fetchResource(StructureDefinition.class, sd.getBaseDefinition());
}
}
} else
getChildrenByName(item, exp.getName(), result);
if (atEntry && context.appInfo != null && hostServices != null && result.isEmpty()) {
@ -2344,6 +2357,11 @@ public class FHIRPathEngine {
return result;
}
private String getParent(String rn) {
return null;
}
private TypeDetails executeContextType(ExecutionTypeContext context, String name) throws PathEngineException, DefinitionException {
if (hostServices == null)
throw new PathEngineException("Unable to resolve context reference since no host services are provided");