From 3d312a1863a484de5ec7a922a7ed266bdff7c06f Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Sat, 6 Mar 2021 08:57:44 +1100 Subject: [PATCH 01/10] fix bug generating htmlized XML with no namespaces --- .../src/main/java/org/hl7/fhir/utilities/xml/XmlGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xml/XmlGenerator.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xml/XmlGenerator.java index 9b1091e14..a8cbc6ec9 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xml/XmlGenerator.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xml/XmlGenerator.java @@ -111,7 +111,7 @@ public class XmlGenerator { } private void processElement(Element element) throws IOException, FHIRException { - if (!xml.getDefaultNamespace().equals(element.getNamespaceURI())) + if (xml.getDefaultNamespace() == null || !xml.getDefaultNamespace().equals(element.getNamespaceURI())) xml.setDefaultNamespace(element.getNamespaceURI()); processAttributes(element); From 5e391eeacef16c06dbe4d0603a0ba65b0b44c030 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Sat, 6 Mar 2021 08:58:04 +1100 Subject: [PATCH 02/10] Add R4B support to FHIRVersions --- .../src/main/java/org/hl7/fhir/r5/model/Enumerations.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Enumerations.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Enumerations.java index 7ff2f46fa..334507465 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Enumerations.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Enumerations.java @@ -6824,6 +6824,10 @@ public String toCode(int len) { public String toString() { return toCode(); } + + public boolean isR4B() { + return toCode().startsWith("4.0"); + } // end addition } From 455cc5cf7f905f834b7a51776eb9b4ec54bec5a8 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Sat, 6 Mar 2021 08:58:40 +1100 Subject: [PATCH 03/10] Add resource name mapping for DataRequirement --- .../convertors/VersionConvertor_40_50.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java index b6b7af5dc..3bc4ded03 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java @@ -967,7 +967,7 @@ public class VersionConvertor_40_50 { if (src == null) return null; org.hl7.fhir.r5.model.DataRequirement tgt = new org.hl7.fhir.r5.model.DataRequirement(); copyElement(src, tgt); - if (src.hasType()) tgt.setType(org.hl7.fhir.r5.model.Enumerations.FHIRAllTypes.fromCode(src.getType())); + if (src.hasType()) tgt.setType(org.hl7.fhir.r5.model.Enumerations.FHIRAllTypes.fromCode(convertResourceName4to5(src.getType()))); for (org.hl7.fhir.r4.model.CanonicalType t : src.getProfile()) tgt.getProfile().add(convertCanonical(t)); if (src.hasSubject()) tgt.setSubject(convertType(src.getSubject())); for (org.hl7.fhir.r4.model.StringType t : src.getMustSupport()) tgt.getMustSupport().add(convertString(t)); @@ -981,11 +981,12 @@ public class VersionConvertor_40_50 { return tgt; } + public static org.hl7.fhir.r4.model.DataRequirement convertDataRequirement(org.hl7.fhir.r5.model.DataRequirement src) throws FHIRException { if (src == null) return null; org.hl7.fhir.r4.model.DataRequirement tgt = new org.hl7.fhir.r4.model.DataRequirement(); copyElement(src, tgt); - if (src.hasType()) tgt.setType(src.getType().toCode()); + if (src.hasType()) tgt.setType(convertResourceName5to4(src.getType().toCode())); for (org.hl7.fhir.r5.model.CanonicalType t : src.getProfile()) tgt.getProfile().add(convertCanonical(t)); if (src.hasSubject()) tgt.setSubject(convertType(src.getSubject())); for (org.hl7.fhir.r5.model.StringType t : src.getMustSupport()) tgt.getMustSupport().add(convertString(t)); @@ -999,6 +1000,22 @@ public class VersionConvertor_40_50 { return tgt; } + private static String convertResourceName4to5(String name) { + if (name == null) return null; + if (name.equals("MedicationStatement")) { + return "MedicationUsage"; + } + return name; + } + + private static String convertResourceName5to4(String name) { + if (name == null) return null; + if (name.equals("MedicationUsage")) { + return "MedicationStatement"; + } + return name; + } + public static org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent convertDataRequirementCodeFilterComponent(org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent src) throws FHIRException { if (src == null) return null; org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent tgt = new org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent(); From 67d3ab72e3a78a83ddc64776966147a181c425f6 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Wed, 10 Mar 2021 21:44:42 +1100 Subject: [PATCH 04/10] R4B fixes --- .../src/main/java/org/hl7/fhir/r5/model/Enumerations.java | 4 ++-- .../org/hl7/fhir/r5/utils/GraphQLSchemaGenerator.java | 8 +++++--- .../java/org/hl7/fhir/r5/utils/NPMPackageGenerator.java | 2 ++ .../main/java/org/hl7/fhir/r5/utils/TypesUtilities.java | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Enumerations.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Enumerations.java index 334507465..c283fd6d1 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Enumerations.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Enumerations.java @@ -6568,7 +6568,7 @@ The primary difference between a medicationusage and a medicationadministration */ NULL; - public static final FHIRVersion R4B = FHIRVersion._4_0_1; + public static final FHIRVersion R4B = FHIRVersion._4_1_0; public static FHIRVersion fromCode(String codeString) throws FHIRException { if (codeString == null || "".equals(codeString)) @@ -6826,7 +6826,7 @@ public String toCode(int len) { } public boolean isR4B() { - return toCode().startsWith("4.0"); + return toCode().startsWith("4.1"); } // end addition } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/GraphQLSchemaGenerator.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/GraphQLSchemaGenerator.java index 450d143a0..186ee3d9c 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/GraphQLSchemaGenerator.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/GraphQLSchemaGenerator.java @@ -67,10 +67,12 @@ public class GraphQLSchemaGenerator { private static final String INNER_TYPE_NAME = "gql.type.name"; IWorkerContext context; private ProfileUtilities profileUtilities; + private String version; - public GraphQLSchemaGenerator(IWorkerContext context) { + public GraphQLSchemaGenerator(IWorkerContext context, String version) { super(); this.context = context; + this.version = version; profileUtilities = new ProfileUtilities(context, null, null); } @@ -87,7 +89,7 @@ public class GraphQLSchemaGenerator { tl.put(sd.getName(), sd); } } - writer.write("# FHIR GraphQL Schema. Version "+Constants.VERSION+"\r\n\r\n"); + writer.write("# FHIR GraphQL Schema. Version "+version+"\r\n\r\n"); writer.write("# FHIR Defined Primitive types\r\n"); for (String n : sorted(pl.keySet())) generatePrimitive(writer, pl.get(n)); @@ -107,7 +109,7 @@ public class GraphQLSchemaGenerator { public void generateResource(OutputStream stream, StructureDefinition sd, List parameters, EnumSet operations) throws IOException, FHIRException { BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stream)); - writer.write("# FHIR GraphQL Schema. Version "+Constants.VERSION+"\r\n\r\n"); + writer.write("# FHIR GraphQL Schema. Version "+version+"\r\n\r\n"); writer.write("# import the types from 'types.graphql'\r\n\r\n"); generateType(writer, sd); if (operations.contains(FHIROperationType.READ)) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NPMPackageGenerator.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NPMPackageGenerator.java index 3bbfe0ed3..8a7596a80 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NPMPackageGenerator.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NPMPackageGenerator.java @@ -276,6 +276,8 @@ public class NPMPackageGenerator { return "hl7.fhir.r3.core"; if (v.startsWith("4.0")) return "hl7.fhir.r4.core"; + if (v.startsWith("4.1")) + return "hl7.fhir.r4b.core"; return null; } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/TypesUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/TypesUtilities.java index 24c2169f7..7c210a247 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/TypesUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/TypesUtilities.java @@ -111,7 +111,7 @@ public class TypesUtilities { res.add(new WildcardInformation("id", TypeClassification.PRIMITIVE)); res.add(new WildcardInformation("instant", TypeClassification.PRIMITIVE)); res.add(new WildcardInformation("integer", TypeClassification.PRIMITIVE)); - if (!version.startsWith("4.0")) { + if (!version.startsWith("4.1")) { res.add(new WildcardInformation("integer64", TypeClassification.PRIMITIVE)); } res.add(new WildcardInformation("markdown", TypeClassification.PRIMITIVE)); From c9b3df01925969e476ce56df749c12f5da7009fb Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Wed, 10 Mar 2021 21:45:22 +1100 Subject: [PATCH 05/10] release notes --- RELEASE_NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index e69de29bb..abcc03105 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -0,0 +1 @@ +* minor fixes in code generators for R4B From 5187fdd3982a1b884f317db958ebaf09433258a3 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 12 Mar 2021 06:28:56 +1100 Subject: [PATCH 06/10] fix issues related to R4B generation --- .../convertors/conv40_50/Enumerations40_50.java | 6 ++++++ .../java/org/hl7/fhir/r4/model/Enumerations.java | 16 ++++++++++++++++ .../fhir/r5/conformance/ProfileUtilities.java | 2 +- .../org/hl7/fhir/utilities/VersionUtilities.java | 1 + 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Enumerations40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Enumerations40_50.java index 64a7d25f5..36a628011 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Enumerations40_50.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Enumerations40_50.java @@ -210,6 +210,9 @@ public class Enumerations40_50 extends VersionConvertor_40_50 { case _4_0_1: tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FHIRVersion._4_0_1); break; + case _4_1_0: + tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FHIRVersion._4_1_0); + break; default: tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.NULL); break; @@ -292,6 +295,9 @@ public class Enumerations40_50 extends VersionConvertor_40_50 { case _4_0_1: tgt.setValue(org.hl7.fhir.r4.model.Enumerations.FHIRVersion._4_0_1); break; + case _4_1_0: + tgt.setValue(org.hl7.fhir.r4.model.Enumerations.FHIRVersion._4_1_0); + break; default: tgt.setValue(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.NULL); break; diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Enumerations.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Enumerations.java index 347f92448..25e2b377f 100644 --- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Enumerations.java +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Enumerations.java @@ -10032,6 +10032,10 @@ The primary difference between a medication statement and a medication administr * added to help the parsers */ _4_0_1, + /** + * R4B - manually added + */ + _4_1_0, NULL; public static FHIRVersion fromCode(String codeString) throws FHIRException { if (codeString == null || "".equals(codeString)) @@ -10082,6 +10086,8 @@ The primary difference between a medication statement and a medication administr return _4_0_0; if ("4.0.1".equals(codeString)) return _4_0_1; + if ("4.1.0".equals(codeString)) + return _4_1_0; throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'"); } @Override @@ -10113,6 +10119,7 @@ The primary difference between a medication statement and a medication administr case _3_5_0: return "3.5.0"; case _4_0_0: return "4.0.0"; case _4_0_1: return "4.0.1"; + case _4_1_0: return "4.1.0"; case NULL: return null; default: return "?"; } @@ -10142,6 +10149,7 @@ The primary difference between a medication statement and a medication administr case _3_5_0: return "http://hl7.org/fhir/FHIR-version"; case _4_0_0: return "http://hl7.org/fhir/FHIR-version"; case _4_0_1: return "http://hl7.org/fhir/FHIR-version"; + case _4_1_0: return "http://hl7.org/fhir/FHIR-version"; case NULL: return null; default: return "?"; } @@ -10171,6 +10179,7 @@ The primary difference between a medication statement and a medication administr case _3_5_0: return "R4 Ballot #2."; case _4_0_0: return "FHIR Release 4 (Normative + STU)."; case _4_0_1: return "FHIR Release 4 Technical Correction #1."; + case _4_1_0: return "FHIR Release 4B"; case NULL: return null; default: return "?"; } @@ -10200,6 +10209,7 @@ The primary difference between a medication statement and a medication administr case _3_5_0: return "3.5.0"; case _4_0_0: return "4.0.0"; case _4_0_1: return "4.0.1"; + case _4_1_0: return "4.1.0"; case NULL: return null; default: return "?"; } @@ -10263,6 +10273,8 @@ The primary difference between a medication statement and a medication administr return FHIRVersion._4_0_0; if ("4.0.1".equals(codeString)) return FHIRVersion._4_0_1; + if ("4.1.0".equals(codeString)) + return FHIRVersion._4_1_0; throw new IllegalArgumentException("Unknown FHIRVersion code '"+codeString+"'"); } public Enumeration fromType(Base code) throws FHIRException { @@ -10319,6 +10331,8 @@ The primary difference between a medication statement and a medication administr return new Enumeration(this, FHIRVersion._4_0_0); if ("4.0.1".equals(codeString)) return new Enumeration(this, FHIRVersion._4_0_1); + if ("4.1.0".equals(codeString)) + return new Enumeration(this, FHIRVersion._4_1_0); throw new FHIRException("Unknown FHIRVersion code '"+codeString+"'"); } public String toCode(FHIRVersion code) { @@ -10368,6 +10382,8 @@ The primary difference between a medication statement and a medication administr return "4.0.0"; if (code == FHIRVersion._4_0_1) return "4.0.1"; + if (code == FHIRVersion._4_1_0) + return "4.1.0"; return "?"; } public String toSystem(FHIRVersion code) { 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 6eb607534..2e9e27a05 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 @@ -4628,7 +4628,7 @@ public class ProfileUtilities extends TranslatingUtilities { erow.getSubRows().add(row); Cell c = gen.new Cell(); row.getCells().add(c); - c.addPiece(gen.new Piece((ed.getBase().getPath().equals(ed.getPath()) ? ref+ed.getPath() : corePath+(VersionUtilities.isThisOrLater("4.1", context.getVersion()) ? "types-definitions.html#"+ed.getBase().getPath() : "element-definitions.html#"+ed.getBase().getPath())), t.getName(), null)); + c.addPiece(gen.new Piece((ed.getBase().getPath().equals(ed.getPath()) ? ref+ed.getPath() : corePath+(VersionUtilities.isR5Ver(context.getVersion()) ? "types-definitions.html#"+ed.getBase().getPath() : "element-definitions.html#"+ed.getBase().getPath())), t.getName(), null)); c = gen.new Cell(); row.getCells().add(c); c.addPiece(gen.new Piece(null, null, null)); diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java index bc5dfc0b0..5c4327c49 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/VersionUtilities.java @@ -465,4 +465,5 @@ public class VersionUtilities { return null; } + } \ No newline at end of file From 2d31728d4f0f8ad415989252deb6ae708cd718e0 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 19 Mar 2021 07:50:12 +1100 Subject: [PATCH 07/10] Don't use packages.fhir.org for R2B (hack) + R2B packing tool --- .../convertors/misc/CorePackageTools.java | 50 +++++++++++++++++++ .../npm/BasePackageCacheManager.java | 34 ++++++++----- 2 files changed, 71 insertions(+), 13 deletions(-) create mode 100644 org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/misc/CorePackageTools.java diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/misc/CorePackageTools.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/misc/CorePackageTools.java new file mode 100644 index 000000000..898f59fde --- /dev/null +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/misc/CorePackageTools.java @@ -0,0 +1,50 @@ +package org.hl7.fhir.convertors.misc; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; + +import org.hl7.fhir.exceptions.FHIRFormatError; +import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.json.JsonTrackingParser; +import org.hl7.fhir.utilities.npm.NpmPackage; + +import com.google.gson.JsonObject; + +public class CorePackageTools { + + public static void main(String[] args) throws FHIRFormatError, FileNotFoundException, IOException { + if ("-xml".equals(args[0])) { + new CorePackageTools().buildXml(args[1], args[2], args[3]); + } + if ("-pack".equals(args[0])) { + new CorePackageTools().buildPackage(args[1], args[2]); + } + } + + private void buildPackage(String path, String output) throws IOException { + NpmPackage npm = NpmPackage.fromFolder(path); + npm.loadAllFiles(); + npm.save(new FileOutputStream(output)); + + } + + private void buildXml(String json, String xml, String version) throws FHIRFormatError, FileNotFoundException, IOException { + for (File f : new File(Utilities.path(json, "package")).listFiles()) { + if (f.getName().endsWith(".json")) { + JsonObject j = new JsonTrackingParser().parseJson(f); + if (j.has("resourceType")) { + if ("1.4".equals(version)) { + String n = f.getName(); + System.out.println(n); + String xn = Utilities.changeFileExt(n, ".xml"); + org.hl7.fhir.dstu2016may.model.Resource r = new org.hl7.fhir.dstu2016may.formats.JsonParser().parse(new FileInputStream(f)); + new org.hl7.fhir.dstu2016may.formats.XmlParser().setOutputStyle(org.hl7.fhir.dstu2016may.formats.IParser.OutputStyle.NORMAL).compose(new FileOutputStream(Utilities.path(xml, "package", xn)), r); + } + } + } + } + } +} diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/BasePackageCacheManager.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/BasePackageCacheManager.java index 73d539e4c..19ad52ecc 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/BasePackageCacheManager.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/BasePackageCacheManager.java @@ -64,26 +64,34 @@ public abstract class BasePackageCacheManager implements IPackageCacheManager { protected InputStreamWithSrc loadFromPackageServer(String id, String version) { for (String nextPackageServer : getPackageServers()) { - PackageClient packageClient = myClientFactory.apply(nextPackageServer); - try { - if (Utilities.noString(version)) { - version = packageClient.getLatestVersion(id); + if (okToUsePackageServer(nextPackageServer, id)) { + PackageClient packageClient = myClientFactory.apply(nextPackageServer); + try { + if (Utilities.noString(version)) { + version = packageClient.getLatestVersion(id); + } + if (version.endsWith(".x")) { + version = packageClient.getLatestVersion(id, version); + } + InputStream stream = packageClient.fetch(id, version); + String url = packageClient.url(id, version); + return new InputStreamWithSrc(stream, url, version); + } catch (IOException e) { + ourLog.info("Failed to resolve package {}#{} from server: {}", id, version, nextPackageServer); } - if (version.endsWith(".x")) { - version = packageClient.getLatestVersion(id, version); - } - InputStream stream = packageClient.fetch(id, version); - String url = packageClient.url(id, version); - return new InputStreamWithSrc(stream, url, version); - } catch (IOException e) { - ourLog.info("Failed to resolve package {}#{} from server: {}", id, version, nextPackageServer); } - } return null; } + private boolean okToUsePackageServer(String server, String id) { + if ("http://packages.fhir.org".equals(server) && "hl7.fhir.r2b.core".equals(id)) { + return false; + } + return true; + } + public abstract NpmPackage loadPackageFromCacheOnly(String id, @Nullable String version) throws IOException; @Override From 1ed13f2a2e7f1be059e17e43f4251210f68f8278 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 22 Mar 2021 10:17:48 +1100 Subject: [PATCH 08/10] add doco --- .../org/hl7/fhir/utilities/npm/BasePackageCacheManager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/BasePackageCacheManager.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/BasePackageCacheManager.java index 19ad52ecc..c2b99d54d 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/BasePackageCacheManager.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/BasePackageCacheManager.java @@ -85,6 +85,8 @@ public abstract class BasePackageCacheManager implements IPackageCacheManager { return null; } + // hack - we have a hacked 1.4.0 out there. Only packages2.fhir.org has it. + // this is not a long term thing private boolean okToUsePackageServer(String server, String id) { if ("http://packages.fhir.org".equals(server) && "hl7.fhir.r2b.core".equals(id)) { return false; From ccf13067c41130d4aa4bd14ff2b23ef22983e513 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 22 Mar 2021 11:43:57 +1100 Subject: [PATCH 09/10] fix test case dependency --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a88799e91..5cd9bc545 100644 --- a/pom.xml +++ b/pom.xml @@ -19,7 +19,7 @@ 5.1.0 - 1.1.57 + 1.1.58-SNAPSHOT 5.7.1 1.7.1 3.0.0-M4 From 494137f3226e67ae7fb2658a2dfb026f1364f8b7 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 22 Mar 2021 14:14:54 +1100 Subject: [PATCH 10/10] ping bild --- .../org/hl7/fhir/utilities/npm/BasePackageCacheManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/BasePackageCacheManager.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/BasePackageCacheManager.java index c2b99d54d..c41de02f5 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/BasePackageCacheManager.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/BasePackageCacheManager.java @@ -86,7 +86,8 @@ public abstract class BasePackageCacheManager implements IPackageCacheManager { } // hack - we have a hacked 1.4.0 out there. Only packages2.fhir.org has it. - // this is not a long term thing + // this is not a long term thing, but it's not clear how to release patches for + // 1.4.0 private boolean okToUsePackageServer(String server, String id) { if ("http://packages.fhir.org".equals(server) && "hl7.fhir.r2b.core".equals(id)) { return false;