diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java index f258891e8..9e06398cd 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java @@ -3037,8 +3037,8 @@ public class ProfileUtilities extends TranslatingUtilities { if (!useTableForFixedValues || definition.getFixed().isPrimitive()) c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, buildJson(definition.getFixed()), null).addStyle("color: darkgreen"))); else { - c.getPieces().add(checkForNoChange(definition.getPattern(), gen.new Piece(null, "As shown", null).addStyle("color: darkgreen"))); - genFixedValue(gen, row, definition.getPattern(), snapshot, false, corePath); + c.getPieces().add(checkForNoChange(definition.getFixed(), gen.new Piece(null, "As shown", null).addStyle("color: darkgreen"))); + genFixedValue(gen, row, definition.getFixed(), snapshot, false, corePath); } if (isCoded(definition.getFixed()) && !hasDescription(definition.getFixed())) { Piece p = describeCoded(gen, definition.getFixed()); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java index e93e5cdd8..beb38579e 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java @@ -1115,5 +1115,15 @@ public abstract class BaseWorkerContext implements IWorkerContext { public void setUcumService(UcumService ucumService) { this.ucumService = ucumService; } + + @Override + public List getStructures() { + List res = new ArrayList<>(); + synchronized (lock) { // tricky, because you need to lock this as well, but it's really not in use yet + res.addAll(structures.values()); + } + return res; + } + } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/IWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/IWorkerContext.java index bf4ac47e6..30fb3dfb0 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/IWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/IWorkerContext.java @@ -22,9 +22,11 @@ package org.hl7.fhir.r5.context; import java.util.List; +import java.util.Map; import java.util.Set; import org.fhir.ucum.UcumService; +import org.hl7.fhir.exceptions.DefinitionException; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.TerminologyServiceException; import org.hl7.fhir.r5.formats.IParser; @@ -210,8 +212,10 @@ public interface IWorkerContext { public List getResourceNames(); public Set getResourceNamesAsSet(); public List getTypeNames(); - public List allStructures(); + public List allStructures(); // ensure snapshot exists... + public List getStructures(); public List allConformanceResources(); + public void generateSnapshot(StructureDefinition p) throws DefinitionException, FHIRException; // -- Terminology services ------------------------------------------------------ diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/ParserBase.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/ParserBase.java index 76d25f40d..c73b65901 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/ParserBase.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/ParserBase.java @@ -117,13 +117,15 @@ public abstract class ParserBase { return null; } // first pass: only look at base definitions - for (StructureDefinition sd : context.allStructures()) { + for (StructureDefinition sd : context.getStructures()) { if (sd.getUrl().equals("http://hl7.org/fhir/StructureDefinition/"+name)) { + context.generateSnapshot(sd); return sd; } } - for (StructureDefinition sd : context.allStructures()) { + for (StructureDefinition sd : context.getStructures()) { if (name.equals(sd.getType()) && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) { + context.generateSnapshot(sd); return sd; } }