From be8276bd4abc941fe6c9f4d0da958ea5afc68603 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 31 Jul 2023 14:37:51 +1000 Subject: [PATCH] Add rendering for UsageContext --- .../main/java/org/hl7/fhir/r5/renderers/DataRenderer.java | 7 +++++++ .../org/hl7/fhir/r5/renderers/ProfileDrivenRenderer.java | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DataRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DataRenderer.java index dc5d52178..88adf4f63 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DataRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/DataRenderer.java @@ -67,6 +67,7 @@ import org.hl7.fhir.r5.model.Timing.EventTiming; import org.hl7.fhir.r5.model.Timing.TimingRepeatComponent; import org.hl7.fhir.r5.model.Timing.UnitsOfTime; import org.hl7.fhir.r5.model.UriType; +import org.hl7.fhir.r5.model.UsageContext; import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent; import org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent; @@ -1517,6 +1518,12 @@ public class DataRenderer extends Renderer implements CodeResolver { x.addText(!p.hasEnd() ? "(ongoing)" : displayDateTime(p.getEndElement())); } + public void renderUsageContext(XhtmlNode x, UsageContext u) throws FHIRFormatError, DefinitionException, IOException { + renderCoding(x, u.getCode()); + x.tx(": "); + render(x, u.getValue()); + } + public void renderDataRequirement(XhtmlNode x, DataRequirement dr) throws FHIRFormatError, DefinitionException, IOException { XhtmlNode tbl = x.table("grid"); XhtmlNode tr = tbl.tr(); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ProfileDrivenRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ProfileDrivenRenderer.java index b023613dc..8b890e4c9 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ProfileDrivenRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ProfileDrivenRenderer.java @@ -485,8 +485,11 @@ public class ProfileDrivenRenderer extends ResourceRenderer { } else if (e instanceof Resource) { return; } else if (e instanceof DataRequirement) { - DataRequirement p = (DataRequirement) e; + DataRequirement p = (DataRequirement) e; renderDataRequirement(x, p); + } else if (e instanceof UsageContext) { + UsageContext p = (UsageContext) e; + renderUsageContext(x, p); } else if (e instanceof PrimitiveType) { x.tx(((PrimitiveType) e).primitiveValue()); } else if (e instanceof ElementDefinition) {