From 5b2a5d37fd49fce2b2f71c4498fd1660961df8e0 Mon Sep 17 00:00:00 2001 From: dotasek Date: Sat, 4 Jan 2025 11:54:15 -0500 Subject: [PATCH] WIP bump core. --- gradle.properties | 4 ++-- .../specification/DictHTMLGenerator.java | 13 ++++++------- .../hl7/fhir/definitions/model/Definitions.java | 2 +- .../definitions/validation/ResourceValidator.java | 2 +- .../definitions/validation/ValueSetValidator.java | 4 ++-- .../hl7/fhir/tools/publisher/ExampleInspector.java | 12 +++++++++++- .../hl7/fhir/tools/publisher/PageProcessor.java | 3 ++- .../org/hl7/fhir/tools/publisher/Publisher.java | 14 +++++++------- .../org/hl7/fhir/tools/publisher/WinRegistry.java | 6 +++--- 9 files changed, 35 insertions(+), 25 deletions(-) diff --git a/gradle.properties b/gradle.properties index ae09c7bf..6b5db8d9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -fhirCoreVersion = 6.4.1-SNAPSHOT +fhirCoreVersion = 6.5.3-SNAPSHOT apachePoiVersion = 5.2.1 jacksonVersion = 2.16.0 apacheHttpcomponentsVersion = 4.5.13 @@ -8,7 +8,7 @@ log4jVersion = 2.17.1 slf4jVersion = 1.7.36 jettyVersion = 11.0.20 -logbackVersion = 1.2.13 +logbackVersion = 1.5.15 nettyConstrainedVersion = 4.1.101.Final ## Leave the subsequent line blank for additional properties appended by azure builds diff --git a/src/main/java/org/hl7/fhir/definitions/generators/specification/DictHTMLGenerator.java b/src/main/java/org/hl7/fhir/definitions/generators/specification/DictHTMLGenerator.java index 1de8ed92..7bba836c 100644 --- a/src/main/java/org/hl7/fhir/definitions/generators/specification/DictHTMLGenerator.java +++ b/src/main/java/org/hl7/fhir/definitions/generators/specification/DictHTMLGenerator.java @@ -44,7 +44,6 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS import org.hl7.fhir.definitions.model.Invariant; import org.hl7.fhir.definitions.model.TypeRef; import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.r5.conformance.profile.ProfileUtilities; import org.hl7.fhir.r5.formats.IParser.OutputStyle; import org.hl7.fhir.r5.formats.XmlParser; import org.hl7.fhir.r5.model.DataType; @@ -64,6 +63,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionMappingComponent; import org.hl7.fhir.r5.utils.ToolingExtensions; +import org.hl7.fhir.r5.utils.UserDataNames; import org.hl7.fhir.tools.publisher.PageProcessor; import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; import org.hl7.fhir.utilities.StandardsStatus; @@ -84,7 +84,6 @@ public DictHTMLGenerator(OutputStream out, PageProcessor page, String prefix) th } public void generate(StructureDefinition profile) throws Exception { - int i = 1; write("\r\n"); for (ElementDefinition ec : profile.getSnapshot().getElement()) { @@ -112,7 +111,7 @@ public void generate(StructureDefinition profile) throws Exception { } } write("
\r\n"); - i++; + flush(); close(); } @@ -152,7 +151,7 @@ public void generateExtension(StructureDefinition ed) throws Exception { } } write("\r\n"); - i++; + i++; flush(); close(); } @@ -391,7 +390,7 @@ public int compare(String s0, String s1) { return s0.compareTo(s1); int comp = parts0[0].compareTo(parts1[0]); if (comp == 0 && Utilities.isInteger(parts0[1]) && Utilities.isInteger(parts1[1])) - return new Integer(parts0[1]).compareTo(new Integer(parts1[1])); + return Integer.valueOf(parts0[1]).compareTo(Integer.valueOf(parts1[1])); else return parts0[1].compareTo(parts1[1]); } @@ -428,8 +427,8 @@ private String presentLevel(ElementDefinitionConstraintComponent inv) { } private boolean isInherited(ElementDefinitionConstraintComponent id, StructureDefinition sd) { - if (id.hasUserData(ProfileUtilities.UD_IS_DERIVED)) { - Boolean b = (Boolean) id.getUserData(ProfileUtilities.UD_IS_DERIVED); + if (id.hasUserData(UserDataNames.SNAPSHOT_IS_DERIVED)) { + Boolean b = (Boolean) id.getUserData(UserDataNames.SNAPSHOT_IS_DERIVED); return b.booleanValue(); } else { // if it was snapshotted in process? can't happen? - only happens on extensions... no id too, and then definitely inherited. see https://xkcd.com/2200/ diff --git a/src/main/java/org/hl7/fhir/definitions/model/Definitions.java b/src/main/java/org/hl7/fhir/definitions/model/Definitions.java index e6ada828..6c9148ff 100644 --- a/src/main/java/org/hl7/fhir/definitions/model/Definitions.java +++ b/src/main/java/org/hl7/fhir/definitions/model/Definitions.java @@ -591,7 +591,7 @@ public void checkContextValid(StructureDefinitionContextComponent ec, String con throw new Error("The element context '"+ec.getExpression()+"' is not valid @ "+context); } else if (ec.getType() == ExtensionContextType.FHIRPATH) { FHIRPathEngine fpe = new FHIRPathEngine(worker); - TypeDetails td = fpe.check(null, null, null, ec.getExpression()); + TypeDetails td = fpe.check(null, null, null,null, ec.getExpression()); if (td.hasNoTypes()) throw new Error("The resource context '"+ec.getExpression()+"' is not valid @ "+context); else diff --git a/src/main/java/org/hl7/fhir/definitions/validation/ResourceValidator.java b/src/main/java/org/hl7/fhir/definitions/validation/ResourceValidator.java index 86ba9c95..37a1691c 100644 --- a/src/main/java/org/hl7/fhir/definitions/validation/ResourceValidator.java +++ b/src/main/java/org/hl7/fhir/definitions/validation/ResourceValidator.java @@ -93,7 +93,7 @@ public static class UsageT { public ResourceValidator(Definitions definitions, Translations translations, CanonicalResourceManager map, String srcFolder, List fpUsages, List suppressedMessages, IWorkerContext context) throws IOException { - super(context, null, true); + super(context, null, true, null); source = Source.ResourceValidator; this.definitions = definitions; this.translations = translations; diff --git a/src/main/java/org/hl7/fhir/definitions/validation/ValueSetValidator.java b/src/main/java/org/hl7/fhir/definitions/validation/ValueSetValidator.java index d89f340d..1a3685f3 100644 --- a/src/main/java/org/hl7/fhir/definitions/validation/ValueSetValidator.java +++ b/src/main/java/org/hl7/fhir/definitions/validation/ValueSetValidator.java @@ -74,7 +74,7 @@ public VSDuplicateList(ValueSet vs) { private Map codeSystems = new HashMap(); public ValueSetValidator(BuildWorkerContext context, List fixups, Set styleExemptions) { - super(context, null, true); + super(context, null, true, null); this.context = context; this.fixups = fixups; this.styleExemptions = styleExemptions; @@ -354,7 +354,7 @@ private boolean isKnownCodeSystem(String system) { "http://www.radlex.org", "http://www.whocc.no/atc", "urn:ietf:bcp:47", "urn:ietf:bcp:13", "urn:ietf:rfc:3986", "urn:iso:std:iso:4217", "urn:iso:std:iso:11073:10101", "urn:iso-astm:E1762-95:2013", - "urn:iso:std:iso:3166", "urn:iso:std:iso:3166:-2", "urn:iso:std:iso:3166:-3", "http://nucc.org/provider-taxonomy", + "urn:iso:std:iso:3166", "urn:iso:std:iso:3166:-2", "urn:iso:std:iso:3166:-3", "http://nucc.org/provider-taxonomy", "http://example.com", "http://example.org", "https://precision.fda.gov/files/", "http://www.ebi.ac.uk/ipd/imgt/hla", "https://www.iana.org/time-zones", "https://precision.fda.gov/jobs/")) return true; diff --git a/src/main/java/org/hl7/fhir/tools/publisher/ExampleInspector.java b/src/main/java/org/hl7/fhir/tools/publisher/ExampleInspector.java index 3a04ad9c..6b802d85 100644 --- a/src/main/java/org/hl7/fhir/tools/publisher/ExampleInspector.java +++ b/src/main/java/org/hl7/fhir/tools/publisher/ExampleInspector.java @@ -221,7 +221,7 @@ public ExampleInspector(IWorkerContext context, Logger logger, String rootDir, S private FHIRVersion version; public void prepare() throws Exception { - validator = new InstanceValidator(context, hostServices, null); + validator = new InstanceValidator(context, hostServices, null, null); validator.setSuppressLoincSnomedMessages(true); validator.setResourceIdRule(IdStatus.REQUIRED); validator.setBestPracticeWarningLevel(BestPracticeWarningLevel.Warning); @@ -882,6 +882,16 @@ public boolean isSuppressMessageId(String path, String messageId) { return false; } + @Override + public IValidationPolicyAdvisor getPolicyAdvisor() { + return this; + } + + @Override + public IValidationPolicyAdvisor setPolicyAdvisor(IValidationPolicyAdvisor iValidationPolicyAdvisor) { + return this; + } + @Override public ReferenceValidationPolicy getReferencePolicy() { return ReferenceValidationPolicy.IGNORE; diff --git a/src/main/java/org/hl7/fhir/tools/publisher/PageProcessor.java b/src/main/java/org/hl7/fhir/tools/publisher/PageProcessor.java index ce66b8be..c98d36d5 100644 --- a/src/main/java/org/hl7/fhir/tools/publisher/PageProcessor.java +++ b/src/main/java/org/hl7/fhir/tools/publisher/PageProcessor.java @@ -237,6 +237,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS import org.hl7.fhir.r5.utils.TypesUtilities; import org.hl7.fhir.r5.utils.TypesUtilities.TypeClassification; import org.hl7.fhir.r5.utils.TypesUtilities.WildcardInformation; +import org.hl7.fhir.r5.utils.UserDataNames; import org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities; import org.hl7.fhir.r5.utils.validation.IResourceValidator; import org.hl7.fhir.tools.converters.MarkDownPreProcessor; @@ -9704,7 +9705,7 @@ private boolean parentChainHasOptional(ElementDefinition ed, StructureDefinition if (!ed.getPath().contains(".")) return false; - ElementDefinition match = (ElementDefinition) ed.getUserData(ProfileUtilities.UD_DERIVATION_POINTER); + ElementDefinition match = (ElementDefinition) ed.getUserData(UserDataNames.SNAPSHOT_DERIVATION_POINTER); if (match == null) return true; // really, we shouldn't get here, but this appears to be common in the existing profiles? // throw new Error("no matches for "+ed.getPath()+"/"+ed.getName()+" in "+profile.getUrl()); diff --git a/src/main/java/org/hl7/fhir/tools/publisher/Publisher.java b/src/main/java/org/hl7/fhir/tools/publisher/Publisher.java index 11eeb777..adce8e76 100644 --- a/src/main/java/org/hl7/fhir/tools/publisher/Publisher.java +++ b/src/main/java/org/hl7/fhir/tools/publisher/Publisher.java @@ -1015,9 +1015,9 @@ private boolean testSearchParameter(SearchParameter sp, StructureDefinition rd) String exp = sp.getExpression().replace("{{name}}", rd.getType()); // for templates TypeDetails td = null; if (sp.getBase().size() > 1) { - td = fpe.check(null, rd.getType(), page.getWorkerContext().getResourceNames(), fpe.parse(exp), set); + td = fpe.check(null, rd.getType(), rd.getType(), page.getWorkerContext().getResourceNames(), fpe.parse(exp), set); } else { - td = fpe.check(null, rd.getType(), rd.getType(), fpe.parse(exp), set); + td = fpe.check(null, rd.getType(), rd.getType(), rd.getType(), fpe.parse(exp), set); } if (!Utilities.existsInList(sp.getCode(), "_id", "_in") && sp.getType() != SearchParamType.COMPOSITE) { String types = page.getDefinitions().getAllowedSearchTypes().get(sp.getType().toCode()); @@ -1189,9 +1189,9 @@ private boolean checkInvariant(FHIRPathEngine fpe, StructureDefinition sd, try { Set set = new HashSet<>(); if (sd.getKind() == StructureDefinitionKind.RESOURCE) { - fpe.check(null, sd.getType(), ed.getPath(), fpe.parse(inv.getExpression()), set); + fpe.check(null, sd.getType(), sd.getType(), ed.getPath(), fpe.parse(inv.getExpression()), set); } else { - fpe.check(null, "Resource", ed.getPath(), fpe.parse(inv.getExpression()), set); + fpe.check(null, "Resource", "DomainResource", ed.getPath(), fpe.parse(inv.getExpression()), set); } for (ElementDefinition edt : set) { if (!edt.getPath().equals(ed.getPath()) && map.containsKey(edt.getPath())) { @@ -1494,7 +1494,7 @@ private void checkExpression(StringBuilder b, FHIRPathEngine fp, FHIRPathUsage p b.append(p.getResource() + " (" + p.getContext() + "): " + p.getExpression()+"\r\n"); try { if (!"n/a".equals(p.getExpression())) { - fp.check(null, p.getResource(), p.getContext(), p.getExpression()); + fp.check(null, p.getResource(), p.getResource(), p.getContext(), p.getExpression()); } } catch (Exception e) { ValidationMessage validationMessage = new ValidationMessage(Source.Publisher, IssueType.STRUCTURE, -1, -1, p.getLocation(), @@ -1532,7 +1532,7 @@ private Profile makeConformancePack(ResourceDefn r) { private void validateProfile(ConstraintStructure p) throws Exception { if (pv == null) { - pv = new ProfileValidator(page.getWorkerContext(), null); + pv = new ProfileValidator(page.getWorkerContext(), null, null); } page.getValidationErrors().addAll(pv.validate(p.getResource(), true)); } @@ -2534,7 +2534,7 @@ private void validate() throws Exception { page.log("Validating", LogMessageType.Process); ResourceValidator val = new ResourceValidator(page.getDefinitions(), page.getTranslations(), page.getCodeSystems(), page.getFolders().srcDir, fpUsages, page.getSuppressedMessages(), page.getWorkerContext()); val.resolvePatterns(); - ProfileValidator valp = new ProfileValidator(page.getWorkerContext(), null); + ProfileValidator valp = new ProfileValidator(page.getWorkerContext(), null, null); for (String n : page.getDefinitions().getTypes().keySet()) page.getValidationErrors().addAll(val.checkStucture(n, page.getDefinitions().getTypes().get(n))); diff --git a/src/main/java/org/hl7/fhir/tools/publisher/WinRegistry.java b/src/main/java/org/hl7/fhir/tools/publisher/WinRegistry.java index 69af0ee9..e89a22f0 100644 --- a/src/main/java/org/hl7/fhir/tools/publisher/WinRegistry.java +++ b/src/main/java/org/hl7/fhir/tools/publisher/WinRegistry.java @@ -369,10 +369,10 @@ private static String readString(Preferences root, int hkey, String key, String new Integer(hkey), toCstr(key), new Integer(KEY_ALL_ACCESS) }); regSetValueEx.invoke(root, - new Object[] { - new Integer(handles[0]), toCstr(valueName), toCstr(value) + new Object[] { + handles[0], toCstr(valueName), toCstr(value) }); - regCloseKey.invoke(root, new Object[] { new Integer(handles[0]) }); + regCloseKey.invoke(root, new Object[] {handles[0]}); } // utility