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 8bbb1f519..d04e3909f 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 @@ -2922,7 +2922,10 @@ public class ProfileUtilities extends TranslatingUtilities { } else { StructureDefinition sd = context.fetchTypeDefinition(t); - if (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) { + if (sd == null) { + System.out.println("Unable to find "+t); + sd = context.fetchTypeDefinition(t); + } else if (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE) { choicerow.getCells().add(gen.new Cell(null, null, tail(element.getPath()).replace("[x]", Utilities.capitalize(t)), sd.getDescription(), null)); choicerow.getCells().add(gen.new Cell()); choicerow.getCells().add(gen.new Cell(null, null, "", null, null)); 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 61679e4f8..adc4eaeb0 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 @@ -124,18 +124,18 @@ public abstract class BaseWorkerContext implements IWorkerContext { private Map> allResourcesById = new HashMap>(); // all maps are to the full URI - private MetadataResourceManager codeSystems = new MetadataResourceManager(); + private MetadataResourceManager codeSystems = new MetadataResourceManager(false); private Set supportedCodeSystems = new HashSet(); - private MetadataResourceManager valueSets = new MetadataResourceManager(); - private MetadataResourceManager maps = new MetadataResourceManager(); - protected MetadataResourceManager transforms = new MetadataResourceManager(); - private MetadataResourceManager structures = new MetadataResourceManager(); - private MetadataResourceManager guides = new MetadataResourceManager(); - private MetadataResourceManager capstmts = new MetadataResourceManager(); - private MetadataResourceManager searchParameters = new MetadataResourceManager(); - private MetadataResourceManager questionnaires = new MetadataResourceManager(); - private MetadataResourceManager operations = new MetadataResourceManager(); - private MetadataResourceManager plans = new MetadataResourceManager(); + private MetadataResourceManager valueSets = new MetadataResourceManager(false); + private MetadataResourceManager maps = new MetadataResourceManager(false); + protected MetadataResourceManager transforms = new MetadataResourceManager(false); + private MetadataResourceManager structures = new MetadataResourceManager(false); + private MetadataResourceManager guides = new MetadataResourceManager(false); + private MetadataResourceManager capstmts = new MetadataResourceManager(false); + private MetadataResourceManager searchParameters = new MetadataResourceManager(false); + private MetadataResourceManager questionnaires = new MetadataResourceManager(false); + private MetadataResourceManager operations = new MetadataResourceManager(false); + private MetadataResourceManager plans = new MetadataResourceManager(false); private List systems = new ArrayList(); private UcumService ucumService; diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/MetadataResourceManager.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/MetadataResourceManager.java index 75a04ea07..1b9f159e8 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/MetadataResourceManager.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/MetadataResourceManager.java @@ -48,9 +48,16 @@ public class MetadataResourceManager { } + private boolean enforceUniqueId; private List list = new ArrayList<>(); private Map map = new HashMap<>(); + + public MetadataResourceManager(boolean enforceUniqueId) { + super(); + this.enforceUniqueId = enforceUniqueId; + } + public void copy(MetadataResourceManager source) { list.clear(); map.clear(); @@ -62,7 +69,7 @@ public class MetadataResourceManager { if (!r.hasId()) { r.setId(UUID.randomUUID().toString()); } - if (map.containsKey(r.getId())) { + if (enforceUniqueId && map.containsKey(r.getId())) { drop(r.getId()); } list.add(r); @@ -98,7 +105,9 @@ public class MetadataResourceManager { } } if (latest != null) { // might be null if it's not using semver - map.put(url+"|"+VersionUtilities.getMajMin(latest.getVersion()), rl.get(rl.size()-1)); + String lv = VersionUtilities.getMajMin(latest.getVersion()); + if (lv != null && !lv.equals(version)) + map.put(url+"|"+lv, rl.get(rl.size()-1)); } } } @@ -176,5 +185,9 @@ public class MetadataResourceManager { public Set keys() { return map.keySet(); } + + public boolean isEnforceUniqueId() { + return enforceUniqueId; + } } diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/MetadataResourceManagerTester.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/MetadataResourceManagerTester.java index c9ff93b1a..f7939ab8f 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/MetadataResourceManagerTester.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/MetadataResourceManagerTester.java @@ -10,7 +10,7 @@ import org.junit.Test; public class MetadataResourceManagerTester { - private MetadataResourceManager mrm = new MetadataResourceManager<>(); + private MetadataResourceManager mrm = new MetadataResourceManager<>(true); @Test public void testSingleNoVersion() { diff --git a/pom.xml b/pom.xml index c35c522e8..e85dfdcf0 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ each other. It is fine to bump the point version of this POM without affecting HAPI FHIR. --> - 4.1.1 + 4.1.1-SNAPSHOT 4.1.0 diff --git a/release.bat b/release.bat index 8305afa22..a247c036e 100644 --- a/release.bat +++ b/release.bat @@ -1,7 +1,7 @@ @echo off -set oldver=4.0.35 -set newver=4.0.36 +set oldver=4.1.1 +set newver=4.1.2 echo .. echo =====================================================================