fix rendering of contained resources in Kindling

This commit is contained in:
Grahame Grieve 2024-03-18 14:35:46 +11:00
parent a058d0ee4d
commit c221488463
1 changed files with 2 additions and 9 deletions

View File

@ -833,19 +833,12 @@ public class ProfileDrivenRenderer extends ResourceRenderer {
if ("DomainResource.contained".equals(child.getBase().getPath())) { if ("DomainResource.contained".equals(child.getBase().getPath())) {
if (round2) { if (round2) {
for (BaseWrapper v : p.getValues()) { for (BaseWrapper v : p.getValues()) {
if (v.getBase() != null && !RendererFactory.hasSpecificRenderer(v.fhirType())) { if (v.getResource() != null && !RendererFactory.hasSpecificRenderer(v.fhirType())) {
x.hr(); x.hr();
RenderingContext ctxt = context.copy(); RenderingContext ctxt = context.copy();
ctxt.setContained(true); ctxt.setContained(true);
ResourceRenderer rnd = RendererFactory.factory(v.fhirType(), ctxt); ResourceRenderer rnd = RendererFactory.factory(v.fhirType(), ctxt);
ResourceWrapper rw = null; ResourceWrapper rw = v.getResource();
if (v.getBase() instanceof org.hl7.fhir.r5.elementmodel.Element) {
rw = new ElementWrappers.ResourceWrapperMetaElement(ctxt, (org.hl7.fhir.r5.elementmodel.Element) v.getBase());
} else if (v.getBase() instanceof Resource){
rw = new DirectWrappers.ResourceWrapperDirect(ctxt, (Resource) v.getBase());
} else {
throw new FHIRException("Not handled: base = "+v.getBase().getClass().getName());
}
rnd.render(x.blockquote(), rw); rnd.render(x.blockquote(), rw);
} }
} }