From e89da42514b379815b3162c422fc7681377297cb Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Thu, 1 Oct 2020 12:39:10 +1000 Subject: [PATCH] * fix error setting up mapping log * fix rendering of definitions in CodeSystems * fix error rendering bundles in bundles --- RELEASE_NOTES.md | 5 ++++- .../hl7/fhir/r5/renderers/BundleRenderer.java | 4 +++- .../fhir/r5/renderers/RendererFactory.java | 3 +++ .../fhir/r5/renderers/ValueSetRenderer.java | 22 +++++++++++-------- .../hl7/fhir/validation/ValidationEngine.java | 4 +++- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index d773df519..5d6f544b9 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -2,9 +2,12 @@ Validator: * Add date addition/subtraction to FHIRPath + add parsing comments * Fix questionnaire mode parameter support for validator * add extra debugging when valdiator can't fetch content to validate +* fix error setting up mapping log Other code changes: * rename org.hl7.fhir.utilities.cache to org.hl7.fhir.utilities.npm * report error locations for run time FHIRPath errors * add search on IG registry to PackageClient -* add focus to FHIRPath function extensions \ No newline at end of file +* add focus to FHIRPath function extensions +* fix rendering of definitions in CodeSystems +* fix error rendering bundles in bundles diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/BundleRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/BundleRenderer.java index 735b139dd..1817f6994 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/BundleRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/BundleRenderer.java @@ -43,7 +43,9 @@ public class BundleRenderer extends ResourceRenderer { @Override public boolean render(XhtmlNode x, Resource r) throws FHIRFormatError, DefinitionException, IOException, FHIRException, EOperationOutcome { - return render(x, (Bundle) r); + XhtmlNode n = render((Bundle) r); + x.addChildren(n.getChildNodes()); + return false; } @Override diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/RendererFactory.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/RendererFactory.java index f435b97a1..fef306984 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/RendererFactory.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/RendererFactory.java @@ -78,6 +78,9 @@ public class RendererFactory { if ("Parameters".equals(resourceName)) { return new ParametersRenderer(context); } + if ("Bundle".equals(resourceName)) { + return new BundleRenderer(context); + } return new ProfileDrivenRenderer(context); } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ValueSetRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ValueSetRenderer.java index 94ff7037f..cb0919b01 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ValueSetRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ValueSetRenderer.java @@ -829,7 +829,8 @@ public class ValueSetRenderer extends TerminologyRenderer { boolean hasDefinition = false; for (ConceptReferenceComponent c : inc.getConcept()) { hasComments = hasComments || ExtensionHelper.hasExtension(c, ToolingExtensions.EXT_VS_COMMENT); - hasDefinition = hasDefinition || ExtensionHelper.hasExtension(c, ToolingExtensions.EXT_DEFINITION); + ConceptDefinitionComponent cc = definitions.get(c.getCode()); + hasDefinition = hasDefinition || ((cc != null && cc.hasDefinition()) || ExtensionHelper.hasExtension(c, ToolingExtensions.EXT_DEFINITION)); } if (hasComments || hasDefinition) hasExtensions = true; @@ -846,16 +847,19 @@ public class ValueSetRenderer extends TerminologyRenderer { else if (cc != null && !Utilities.noString(cc.getDisplay())) td.addText(cc.getDisplay()); - if (ExtensionHelper.hasExtension(c, ToolingExtensions.EXT_DEFINITION)) { + if (hasDefinition) { td = tr.td(); - smartAddText(td, ToolingExtensions.readStringExtension(c, ToolingExtensions.EXT_DEFINITION)); - } else if (cc != null && !Utilities.noString(cc.getDefinition())) { - td = tr.td(); - smartAddText(td, cc.getDefinition()); + if (ExtensionHelper.hasExtension(c, ToolingExtensions.EXT_DEFINITION)) { + smartAddText(td, ToolingExtensions.readStringExtension(c, ToolingExtensions.EXT_DEFINITION)); + } else if (cc != null && !Utilities.noString(cc.getDefinition())) { + smartAddText(td, cc.getDefinition()); + } } - - if (ExtensionHelper.hasExtension(c, ToolingExtensions.EXT_VS_COMMENT)) { - smartAddText(tr.td(), "Note: "+ToolingExtensions.readStringExtension(c, ToolingExtensions.EXT_VS_COMMENT)); + if (hasComments) { + td = tr.td(); + if (ExtensionHelper.hasExtension(c, ToolingExtensions.EXT_VS_COMMENT)) { + smartAddText(td, "Note: "+ToolingExtensions.readStringExtension(c, ToolingExtensions.EXT_VS_COMMENT)); + } } if (doLangs) { addLangaugesToRow(c, langs, tr); diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java index 506c54680..596055d66 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java @@ -1635,7 +1635,9 @@ public class ValidationEngine implements IValidatorResourceFetcher, IPackageInst } public void setMapLog(String mapLog) throws FileNotFoundException { - this.mapLog = new PrintWriter(mapLog); + if (mapLog != null) { + this.mapLog = new PrintWriter(mapLog); + } } public void prepare() {