Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update hapi fhir version 5.5.3 #318

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<cql-engine.version>1.5.1</cql-engine.version>
<cql-evaluator.version>1.2.0</cql-evaluator.version>
<cql-engine.version>1.5.3-SNAPSHOT</cql-engine.version>
<cql-evaluator.version>1.3.1-SNAPSHOT</cql-evaluator.version>
<cqframework.version>1.5.5-SNAPSHOT</cqframework.version>
<hapi.version>5.4.2</hapi.version>
<core.version>5.4.8</core.version>
<hapi.version>5.5.3</hapi.version>
<core.version>5.5.16</core.version>
</properties>

<name>cqf-tooling</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -70,8 +71,9 @@ else if (file.isDirectory()) {

List<String> refreshedLibraryNames = new ArrayList<String>();
List<org.hl7.fhir.r5.model.Library> 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()))
Expand Down Expand Up @@ -118,7 +120,8 @@ else if (file.isDirectory()) {
private void loadLibrary(Map<String, String> fileMap, List<org.hl7.fhir.r5.model.Library> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -50,10 +51,11 @@ protected List<String> refreshLibraries(String libraryPath, String libraryOutput

List<String> refreshedLibraryNames = new ArrayList<String>();
List<org.hl7.fhir.r5.model.Library> 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);

Expand Down Expand Up @@ -114,7 +116,8 @@ private void cleanseRelatedArtifactReferences(Library library) {
private void loadLibrary(Map<String, String> fileMap, List<org.hl7.fhir.r5.model.Library> 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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -59,8 +60,9 @@ else if (file.isDirectory()) {

List<String> refreshedMeasureNames = new ArrayList<String>();
List<org.hl7.fhir.r5.model.Measure> 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()))
Expand Down Expand Up @@ -104,7 +106,8 @@ else if (file.isDirectory()) {
private void loadMeasure(Map<String, String> fileMap, List<org.hl7.fhir.r5.model.Measure> 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) {
Expand Down
18 changes: 12 additions & 6 deletions src/main/java/org/opencds/cqf/tooling/npm/LibraryLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/org/opencds/cqf/tooling/npm/NpmPackageManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
18 changes: 12 additions & 6 deletions src/main/java/org/opencds/cqf/tooling/processor/BaseProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand All @@ -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 {
Expand Down