Fix broken links in Bundle rendering
This commit is contained in:
parent
1888925293
commit
477bf66108
|
@ -4,6 +4,7 @@ import org.hl7.fhir.r5.model.DomainResource;
|
|||
import org.hl7.fhir.r5.model.Resource;
|
||||
import org.hl7.fhir.r5.renderers.utils.BaseWrappers.ResourceWrapper;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||
import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
|
||||
|
||||
public class RendererFactory {
|
||||
|
||||
|
@ -87,7 +88,7 @@ public class RendererFactory {
|
|||
}
|
||||
|
||||
|
||||
public static ResourceRenderer factory(ResourceWrapper resource, RenderingContext context) {
|
||||
public static ResourceRenderer factory(ResourceWrapper resource, RenderingContext context, ResourceContext resourceContext) {
|
||||
if (context.getTemplateProvider() != null) {
|
||||
String liquidTemplate = context.getTemplateProvider().findTemplate(context, resource.getName());
|
||||
if (liquidTemplate != null) {
|
||||
|
@ -102,7 +103,11 @@ public class RendererFactory {
|
|||
return new DiagnosticReportRenderer(context);
|
||||
}
|
||||
|
||||
return new ProfileDrivenRenderer(context);
|
||||
return new ProfileDrivenRenderer(context, resourceContext);
|
||||
}
|
||||
|
||||
public static ResourceRenderer factory(ResourceWrapper rw, RenderingContext lrc) {
|
||||
return factory(rw, lrc, null);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.apache.commons.lang3.NotImplementedException;
|
|||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
import org.hl7.fhir.r5.elementmodel.Element;
|
||||
import org.hl7.fhir.r5.model.Base;
|
||||
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
|
||||
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent;
|
||||
|
@ -208,8 +209,9 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
org.hl7.fhir.r5.elementmodel.Element bundleElement = rcontext.resolveElement(url);
|
||||
if (bundleElement != null) {
|
||||
String bundleUrl = null;
|
||||
if (bundleElement.getNamedChild("resource").getChildValue("id") != null) {
|
||||
bundleUrl = "#" + bundleElement.fhirType().toLowerCase() + "_" + bundleElement.getNamedChild("resource").getChildValue("id");
|
||||
Element br = bundleElement.getNamedChild("resource");
|
||||
if (br.getChildValue("id") != null) {
|
||||
bundleUrl = "#" + br.fhirType().toLowerCase() + "_" + br.getChildValue("id");
|
||||
} else {
|
||||
bundleUrl = "#" +fullUrlToAnchor(bundleElement.getChildValue("fullUrl"));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue