From c64778063db74a52e1989772dbfe7ec621fd5193 Mon Sep 17 00:00:00 2001 From: mdnazmulkarim Date: Wed, 24 Nov 2021 13:15:37 -0700 Subject: [PATCH 1/2] update hapi fhir version 5.5.3 --- pom.xml | 8 ++++---- .../tooling/library/r4/R4LibraryProcessor.java | 9 ++++++--- .../library/stu3/STU3LibraryProcessor.java | 9 ++++++--- .../tooling/measure/r4/R4MeasureProcessor.java | 9 ++++++--- .../opencds/cqf/tooling/npm/LibraryLoader.java | 18 ++++++++++++------ .../cqf/tooling/npm/NpmPackageManager.java | 10 ++++++---- .../cqf/tooling/processor/BaseProcessor.java | 18 ++++++++++++------ 7 files changed, 52 insertions(+), 29 deletions(-) diff --git a/pom.xml b/pom.xml index deaaba1f2..141f957b0 100644 --- a/pom.xml +++ b/pom.xml @@ -11,11 +11,11 @@ UTF-8 UTF-8 - 1.5.1 - 1.2.0 + 1.5.3-SNAPSHOT + 1.3.1-SNAPSHOT 1.5.5-SNAPSHOT - 5.4.2 - 5.4.8 + 5.5.3 + 5.5.16 cqf-tooling diff --git a/src/main/java/org/opencds/cqf/tooling/library/r4/R4LibraryProcessor.java b/src/main/java/org/opencds/cqf/tooling/library/r4/R4LibraryProcessor.java index b5413babb..9ec75ad65 100644 --- a/src/main/java/org/opencds/cqf/tooling/library/r4/R4LibraryProcessor.java +++ b/src/main/java/org/opencds/cqf/tooling/library/r4/R4LibraryProcessor.java @@ -8,7 +8,8 @@ import com.google.common.base.Strings; -import org.hl7.fhir.convertors.VersionConvertor_40_50; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50; +import org.hl7.fhir.convertors.conv40_50.VersionConvertor_40_50; import org.hl7.fhir.r4.formats.FormatUtilities; import org.hl7.fhir.r4.model.Library; import org.hl7.fhir.r4.model.Resource; @@ -70,8 +71,9 @@ else if (file.isDirectory()) { List refreshedLibraryNames = new ArrayList(); List refreshedLibraries = super.refreshGeneratedContent(libraries); + VersionConvertor_40_50 versionConvertor_40_50 = new VersionConvertor_40_50(new BaseAdvisor_40_50()); for (org.hl7.fhir.r5.model.Library refreshedLibrary : refreshedLibraries) { - Library library = (Library) VersionConvertor_40_50.convertResource(refreshedLibrary); + Library library = (Library) versionConvertor_40_50.convertResource(refreshedLibrary); String filePath = null; Encoding fileEncoding = null; if (fileMap.containsKey(refreshedLibrary.getId())) @@ -118,7 +120,8 @@ else if (file.isDirectory()) { private void loadLibrary(Map fileMap, List libraries, File libraryFile) { try { Resource resource = FormatUtilities.loadFile(libraryFile.getAbsolutePath()); - org.hl7.fhir.r5.model.Library library = (org.hl7.fhir.r5.model.Library) VersionConvertor_40_50.convertResource(resource); + VersionConvertor_40_50 versionConvertor_40_50 = new VersionConvertor_40_50(new BaseAdvisor_40_50()); + org.hl7.fhir.r5.model.Library library = (org.hl7.fhir.r5.model.Library) versionConvertor_40_50.convertResource(resource); fileMap.put(library.getId(), libraryFile.getAbsolutePath()); libraries.add(library); } catch (Exception ex) { diff --git a/src/main/java/org/opencds/cqf/tooling/library/stu3/STU3LibraryProcessor.java b/src/main/java/org/opencds/cqf/tooling/library/stu3/STU3LibraryProcessor.java index 29f83ca58..78046582a 100644 --- a/src/main/java/org/opencds/cqf/tooling/library/stu3/STU3LibraryProcessor.java +++ b/src/main/java/org/opencds/cqf/tooling/library/stu3/STU3LibraryProcessor.java @@ -9,7 +9,8 @@ import com.google.common.base.Strings; -import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_50; +import org.hl7.fhir.convertors.conv30_50.VersionConvertor_30_50; import org.hl7.fhir.dstu3.model.Library; import org.hl7.fhir.dstu3.model.RelatedArtifact; import org.hl7.fhir.dstu3.model.Resource; @@ -50,10 +51,11 @@ protected List refreshLibraries(String libraryPath, String libraryOutput List refreshedLibraryNames = new ArrayList(); List refreshedLibraries = super.refreshGeneratedContent(libraries); + VersionConvertor_30_50 versionConvertor_30_50 = new VersionConvertor_30_50(new BaseAdvisor_30_50()); for (org.hl7.fhir.r5.model.Library refreshedLibrary : refreshedLibraries) { String filePath = fileMap.get(refreshedLibrary.getId()); if(null != filePath) { - org.hl7.fhir.dstu3.model.Library library = (org.hl7.fhir.dstu3.model.Library) VersionConvertor_30_50.convertResource(refreshedLibrary); + org.hl7.fhir.dstu3.model.Library library = (org.hl7.fhir.dstu3.model.Library) versionConvertor_30_50.convertResource(refreshedLibrary); cleanseRelatedArtifactReferences(library); @@ -114,7 +116,8 @@ private void cleanseRelatedArtifactReferences(Library library) { private void loadLibrary(Map fileMap, List libraries, File libraryFile) { try { Resource resource = (Resource) IOUtils.readResource(libraryFile.getAbsolutePath(), fhirContext); - org.hl7.fhir.r5.model.Library library = (org.hl7.fhir.r5.model.Library) VersionConvertor_30_50.convertResource(resource); + VersionConvertor_30_50 versionConvertor_30_50 = new VersionConvertor_30_50(new BaseAdvisor_30_50()); + org.hl7.fhir.r5.model.Library library = (org.hl7.fhir.r5.model.Library) versionConvertor_30_50.convertResource(resource); fileMap.put(library.getId(), libraryFile.getAbsolutePath()); libraries.add(library); } catch (Exception ex) { diff --git a/src/main/java/org/opencds/cqf/tooling/measure/r4/R4MeasureProcessor.java b/src/main/java/org/opencds/cqf/tooling/measure/r4/R4MeasureProcessor.java index 79a3c9d2d..673dd63a2 100644 --- a/src/main/java/org/opencds/cqf/tooling/measure/r4/R4MeasureProcessor.java +++ b/src/main/java/org/opencds/cqf/tooling/measure/r4/R4MeasureProcessor.java @@ -1,6 +1,7 @@ package org.opencds.cqf.tooling.measure.r4; -import org.hl7.fhir.convertors.VersionConvertor_40_50; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50; +import org.hl7.fhir.convertors.conv40_50.VersionConvertor_40_50; import org.hl7.fhir.r4.formats.FormatUtilities; import org.opencds.cqf.tooling.common.r4.CqfmSoftwareSystemHelper; import org.opencds.cqf.tooling.measure.MeasureProcessor; @@ -59,8 +60,9 @@ else if (file.isDirectory()) { List refreshedMeasureNames = new ArrayList(); List refreshedMeasures = super.refreshGeneratedContent(measures); + VersionConvertor_40_50 versionConvertor_40_50 = new VersionConvertor_40_50(new BaseAdvisor_40_50()); for (org.hl7.fhir.r5.model.Measure refreshedMeasure : refreshedMeasures) { - org.hl7.fhir.r4.model.Measure measure = (org.hl7.fhir.r4.model.Measure) VersionConvertor_40_50.convertResource(refreshedMeasure); + org.hl7.fhir.r4.model.Measure measure = (org.hl7.fhir.r4.model.Measure) versionConvertor_40_50.convertResource(refreshedMeasure); String filePath = null; IOUtils.Encoding fileEncoding = null; if (fileMap.containsKey(refreshedMeasure.getId())) @@ -104,7 +106,8 @@ else if (file.isDirectory()) { private void loadMeasure(Map fileMap, List measures, File measureFile) { try { org.hl7.fhir.r4.model.Resource resource = FormatUtilities.loadFile(measureFile.getAbsolutePath()); - org.hl7.fhir.r5.model.Measure measure = (org.hl7.fhir.r5.model.Measure) VersionConvertor_40_50.convertResource(resource); + VersionConvertor_40_50 versionConvertor_40_50 = new VersionConvertor_40_50(new BaseAdvisor_40_50()); + org.hl7.fhir.r5.model.Measure measure = (org.hl7.fhir.r5.model.Measure) versionConvertor_40_50.convertResource(resource); fileMap.put(measure.getId(), measureFile.getAbsolutePath()); measures.add(measure); } catch (Exception ex) { diff --git a/src/main/java/org/opencds/cqf/tooling/npm/LibraryLoader.java b/src/main/java/org/opencds/cqf/tooling/npm/LibraryLoader.java index 5092bc401..96bb72493 100644 --- a/src/main/java/org/opencds/cqf/tooling/npm/LibraryLoader.java +++ b/src/main/java/org/opencds/cqf/tooling/npm/LibraryLoader.java @@ -3,9 +3,12 @@ import java.io.IOException; import java.io.InputStream; -import org.hl7.fhir.convertors.VersionConvertor_14_50; -import org.hl7.fhir.convertors.VersionConvertor_30_50; -import org.hl7.fhir.convertors.VersionConvertor_40_50; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_14_50; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_50; +import org.hl7.fhir.convertors.conv14_50.VersionConvertor_14_50; +import org.hl7.fhir.convertors.conv30_50.VersionConvertor_30_50; +import org.hl7.fhir.convertors.conv40_50.VersionConvertor_40_50; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRFormatError; import org.hl7.fhir.r5.formats.JsonParser; @@ -26,13 +29,16 @@ public Library readLibrary(InputStream stream) throws FHIRFormatError, IOExcepti throw new FHIRException("Library is not supported in R2"); } else if (VersionUtilities.isR2BVer(version)) { org.hl7.fhir.dstu2016may.model.Resource res = new org.hl7.fhir.dstu2016may.formats.JsonParser().parse(stream); - return (Library) VersionConvertor_14_50.convertResource(res); + VersionConvertor_14_50 versionConvertor_14_50 = new VersionConvertor_14_50(new BaseAdvisor_14_50()); + return (Library) versionConvertor_14_50.convertResource(res); } else if (VersionUtilities.isR3Ver(version)) { org.hl7.fhir.dstu3.model.Resource res = new org.hl7.fhir.dstu3.formats.JsonParser().parse(stream); - return (Library) VersionConvertor_30_50.convertResource(res); + VersionConvertor_30_50 versionConvertor_30_50 = new VersionConvertor_30_50(new BaseAdvisor_30_50()); + return (Library) versionConvertor_30_50.convertResource(res); } else if (VersionUtilities.isR4Ver(version)) { org.hl7.fhir.r4.model.Resource res = new org.hl7.fhir.r4.formats.JsonParser().parse(stream); - return (Library) VersionConvertor_40_50.convertResource(res); + VersionConvertor_40_50 versionConvertor_40_50 = new VersionConvertor_40_50(new BaseAdvisor_40_50()); + return (Library) versionConvertor_40_50.convertResource(res); } else if (VersionUtilities.isR5Ver(version)) { return (Library) new JsonParser().parse(stream); } else { diff --git a/src/main/java/org/opencds/cqf/tooling/npm/NpmPackageManager.java b/src/main/java/org/opencds/cqf/tooling/npm/NpmPackageManager.java index 85dc3cfb1..41f5732ec 100644 --- a/src/main/java/org/opencds/cqf/tooling/npm/NpmPackageManager.java +++ b/src/main/java/org/opencds/cqf/tooling/npm/NpmPackageManager.java @@ -11,7 +11,8 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import org.hl7.fhir.convertors.VersionConvertor_40_50; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50; +import org.hl7.fhir.convertors.conv40_50.VersionConvertor_40_50; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r4.formats.FormatUtilities; import org.hl7.fhir.r5.context.IWorkerContext; @@ -48,12 +49,13 @@ public static NpmPackageManager fromPath(String igPath, String version) throws I if (igPath == null || igPath.equals("")) { throw new IllegalArgumentException("igPath is required"); } - - return new NpmPackageManager((ImplementationGuide) VersionConvertor_40_50.convertResource(FormatUtilities.loadFile(igPath)), version); + VersionConvertor_40_50 versionConvertor_40_50 = new VersionConvertor_40_50(new BaseAdvisor_40_50()); + return new NpmPackageManager((ImplementationGuide) versionConvertor_40_50.convertResource(FormatUtilities.loadFile(igPath)), version); } public static NpmPackageManager fromStream(InputStream is, String version) throws IOException { - return new NpmPackageManager((ImplementationGuide) VersionConvertor_40_50.convertResource(FormatUtilities.loadFile(is)), version); + VersionConvertor_40_50 versionConvertor_40_50 = new VersionConvertor_40_50(new BaseAdvisor_40_50()); + return new NpmPackageManager((ImplementationGuide) versionConvertor_40_50.convertResource(FormatUtilities.loadFile(is)), version); } public NpmPackageManager(ImplementationGuide sourceIg, String version) throws IOException { diff --git a/src/main/java/org/opencds/cqf/tooling/processor/BaseProcessor.java b/src/main/java/org/opencds/cqf/tooling/processor/BaseProcessor.java index bc22f943b..d326dd890 100644 --- a/src/main/java/org/opencds/cqf/tooling/processor/BaseProcessor.java +++ b/src/main/java/org/opencds/cqf/tooling/processor/BaseProcessor.java @@ -7,11 +7,13 @@ import org.fhir.ucum.UcumEssenceService; import org.fhir.ucum.UcumException; import org.fhir.ucum.UcumService; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_50; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r5.elementmodel.Manager; import org.hl7.fhir.r5.model.ImplementationGuide; -import org.hl7.fhir.convertors.VersionConvertor_30_50; -import org.hl7.fhir.convertors.VersionConvertor_40_50; +import org.hl7.fhir.convertors.conv30_50.VersionConvertor_30_50; +import org.hl7.fhir.convertors.conv40_50.VersionConvertor_40_50; import org.hl7.fhir.r5.context.IWorkerContext; import org.hl7.fhir.utilities.IniFile; import org.hl7.fhir.utilities.TextFile; @@ -173,13 +175,15 @@ private ImplementationGuide loadSourceIG(String igPath) throws Exception { sourceIg = (ImplementationGuide) org.hl7.fhir.r5.formats.FormatUtilities.loadFile(igPath); } catch (Exception e) { try { - sourceIg = (ImplementationGuide) VersionConvertor_40_50.convertResource(org.hl7.fhir.r4.formats.FormatUtilities.loadFile(igPath)); + VersionConvertor_40_50 versionConvertor_40_50 = new VersionConvertor_40_50(new BaseAdvisor_40_50()); + sourceIg = (ImplementationGuide) versionConvertor_40_50.convertResource(org.hl7.fhir.r4.formats.FormatUtilities.loadFile(igPath)); } catch (Exception ex) { byte[] src = TextFile.fileToBytes(igPath); Manager.FhirFormat fmt = org.hl7.fhir.r5.formats.FormatUtilities.determineFormat(src); org.hl7.fhir.dstu3.formats.ParserBase parser = org.hl7.fhir.dstu3.formats.FormatUtilities.makeParser(fmt.toString()); - sourceIg = (ImplementationGuide) VersionConvertor_30_50.convertResource(parser.parse(src)); + VersionConvertor_30_50 versionConvertor_30_50 = new VersionConvertor_30_50(new BaseAdvisor_30_50()); + sourceIg = (ImplementationGuide) versionConvertor_30_50.convertResource(parser.parse(src)); } } } catch (Exception e) { @@ -195,10 +199,12 @@ private ImplementationGuide loadSourceIG(String igPath, String specifiedFhirVers byte[] src = TextFile.fileToBytes(igPath); Manager.FhirFormat fmt = org.hl7.fhir.r5.formats.FormatUtilities.determineFormat(src); org.hl7.fhir.dstu3.formats.ParserBase parser = org.hl7.fhir.dstu3.formats.FormatUtilities.makeParser(fmt.toString()); - sourceIg = (ImplementationGuide) VersionConvertor_30_50.convertResource(parser.parse(src)); + VersionConvertor_30_50 versionConvertor_30_50 = new VersionConvertor_30_50(new BaseAdvisor_30_50()); + sourceIg = (ImplementationGuide) versionConvertor_30_50.convertResource(parser.parse(src)); } else if (VersionUtilities.isR4Ver(specifiedFhirVersion)) { org.hl7.fhir.r4.model.Resource res = org.hl7.fhir.r4.formats.FormatUtilities.loadFile(igPath); - sourceIg = (ImplementationGuide) VersionConvertor_40_50.convertResource(res); + VersionConvertor_40_50 versionConvertor_40_50 = new VersionConvertor_40_50(new BaseAdvisor_40_50()); + sourceIg = (ImplementationGuide) versionConvertor_40_50.convertResource(res); } else if (VersionUtilities.isR5Ver(specifiedFhirVersion)) { sourceIg = (ImplementationGuide) org.hl7.fhir.r5.formats.FormatUtilities.loadFile(igPath); } else { From e9f487a7f3ff30ecbf2f3b2df552049a3e9fea3b Mon Sep 17 00:00:00 2001 From: mdnazmulkarim Date: Fri, 3 Dec 2021 10:40:56 -0700 Subject: [PATCH 2/2] dummy push --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index 141f957b0..208f5a0d7 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,6 @@ UTF-8 UTF-8 - 1.5.3-SNAPSHOT 1.3.1-SNAPSHOT 1.5.5-SNAPSHOT