From e01216b7f3ee3fce92499d818363140e468f35c1 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 11 Nov 2022 12:29:45 +1100 Subject: [PATCH] more xver package related changes --- .../hl7/fhir/r4/conformance/ProfileUtilities.java | 1 + org.hl7.fhir.r4b/.project | 4 ++-- .../org/hl7/fhir/utilities/VersionUtilities.java | 15 ++++++++++++++- .../org/hl7/fhir/utilities/npm/NpmPackage.java | 14 ++++++++++++++ 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/conformance/ProfileUtilities.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/conformance/ProfileUtilities.java index e831a773a..80aebef51 100644 --- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/conformance/ProfileUtilities.java +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/conformance/ProfileUtilities.java @@ -4680,6 +4680,7 @@ public class ProfileUtilities extends TranslatingUtilities { case PROFILE: return t.getPath()+"/@profile"; case TYPE: return t.getPath()+"/@type"; case VALUE: return t.getPath(); + case PATTERN: return t.getPath(); case EXISTS: return t.getPath(); // determination of value vs. exists is based on whether there's only 2 slices - one with minOccurs=1 and other with maxOccur=0 default: throw new FHIRException("Unable to represent "+t.getType().toCode()+":"+t.getPath()+" in R2"); } diff --git a/org.hl7.fhir.r4b/.project b/org.hl7.fhir.r4b/.project index 50e7ef90f..dc20d573e 100644 --- a/org.hl7.fhir.r4b/.project +++ b/org.hl7.fhir.r4b/.project @@ -22,12 +22,12 @@ - 1662504185037 + 1668080803768 30 org.eclipse.core.resources.regexFilterMatcher - node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ 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 3f9fae531..2df607c7d 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 @@ -570,12 +570,25 @@ public class VersionUtilities { case "1.4" : return "http://hl7.org/fhir/DSTU2"; case "3.0" : return "http://hl7.org/fhir/STU3"; case "4.0" : return "http://hl7.org/fhir/R4"; - case "4.5" : return "http://build.fhir.org"; + case "4.3" : return "http://hl7.org/fhir/R4B"; case "5.0" : return "http://build.fhir.org"; default: return "http://hl7.org/fhir"; } } + public static String getNameForVersion(String v) { + switch (getMajMin(v)) { + case "1.0" : return "R2"; + case "1.4" : return "R2B"; + case "3.0" : return "R3"; + case "4.0" : return "R4"; + case "4.3" : return "R4B"; + case "5.0" : return "R5"; + default: + return "R?"; + } + } + } \ No newline at end of file diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java index fa812425f..7d5a38edd 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/npm/NpmPackage.java @@ -283,6 +283,14 @@ public class NpmPackage { return retVal; } + /** + * Factory method that starts a new empty package using the given PackageGenerator to create the manifest + */ + public static NpmPackage empty() { + NpmPackage retVal = new NpmPackage(); + return retVal; + } + public Map getUserData() { return userData; } @@ -1061,6 +1069,12 @@ public class NpmPackage { if (!folder.types.containsKey(type)) folder.types.put(type, new ArrayList<>()); folder.types.get(type).add(name); + if ("package".equals(folderName) && "package.json".equals(name)) { + try { + npm = JsonTrackingParser.parseJson(cnt); + } catch (IOException e) { + } + } } public void loadAllFiles() throws IOException {