diff --git a/Src/java/buildSrc/src/main/groovy/cql.fhir-conventions.gradle b/Src/java/buildSrc/src/main/groovy/cql.fhir-conventions.gradle index c854a5b2d..c18a58771 100644 --- a/Src/java/buildSrc/src/main/groovy/cql.fhir-conventions.gradle +++ b/Src/java/buildSrc/src/main/groovy/cql.fhir-conventions.gradle @@ -10,6 +10,7 @@ ext { dependencies { api platform("ca.uhn.hapi.fhir:hapi-fhir-bom:${hapiVersion}") { exclude group: 'org.eclipse.jetty' + exclude group: 'xpp3' } implementation "ca.uhn.hapi.fhir:org.hl7.fhir.r5:${coreVersion}" @@ -23,4 +24,12 @@ dependencies { implementation "ca.uhn.hapi.fhir:hapi-fhir-structures-dstu3" implementation "ca.uhn.hapi.fhir:hapi-fhir-structures-r4" implementation "ca.uhn.hapi.fhir:hapi-fhir-structures-r5" + + // This is to align with the FHIR core dependencies + // Note that this dependency hasn't been updated since 2013 + // we probably need to standardize on a fork up the dependency chain + implementation ('org.ogce:xpp3:1.1.6') { + exclude group: 'junit' + exclude group: 'org.hamcrest' + } } \ No newline at end of file diff --git a/Src/java/buildSrc/src/main/groovy/cql.java-conventions.gradle b/Src/java/buildSrc/src/main/groovy/cql.java-conventions.gradle index 34c143413..761950844 100644 --- a/Src/java/buildSrc/src/main/groovy/cql.java-conventions.gradle +++ b/Src/java/buildSrc/src/main/groovy/cql.java-conventions.gradle @@ -33,8 +33,8 @@ dependencies { // These are JAXB dependencies excluded because the libraries need to work // on Android. But for test purposes we use them pretty much everywhere. - testRuntimeOnly 'org.eclipse.persistence:org.eclipse.persistence.moxy:2.7.7' - testRuntimeOnly 'xpp3:xpp3:1.1.4c' + testRuntimeOnly 'org.eclipse.persistence:org.eclipse.persistence.moxy:4.0.2' + testRuntimeOnly 'org.eclipse.parsson:parsson:1.1.5' } jar { diff --git a/Src/java/buildSrc/src/main/groovy/cql.xjc-conventions.gradle b/Src/java/buildSrc/src/main/groovy/cql.xjc-conventions.gradle index fadb08ec5..0c562d6e8 100644 --- a/Src/java/buildSrc/src/main/groovy/cql.xjc-conventions.gradle +++ b/Src/java/buildSrc/src/main/groovy/cql.xjc-conventions.gradle @@ -7,19 +7,19 @@ configurations { } dependencies { - xjc 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.13.1' - xjc 'org.jvnet.jaxb2_commons:jaxb2-basics:0.13.1' - xjc 'org.jvnet.jaxb2_commons:jaxb2-fluent-api:3.0' + xjc 'codes.rafael.jaxb2_commons:jaxb2-basics-ant:3.0.0' + xjc 'codes.rafael.jaxb2_commons:jaxb2-basics:3.0.0' + xjc 'codes.rafael.jaxb2_commons:jaxb2-fluent-api:3.0.0' // Eclipse has taken over all Java EE reference components // https://www.infoworld.com/article/3310042/eclipse-takes-over-all-java-ee-reference-components.html // https://wiki.eclipse.org/Jakarta_EE_Maven_Coordinates - xjc 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.3' - xjc 'org.glassfish.jaxb:jaxb-xjc:2.4.0-b180830.0438' - xjc 'org.eclipse.persistence:org.eclipse.persistence.moxy:2.7.7' + xjc 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.1' + xjc 'org.glassfish.jaxb:jaxb-xjc:3.0.2' + xjc 'org.glassfish.jaxb:jaxb-runtime:4.0.3' + xjc 'org.eclipse.persistence:org.eclipse.persistence.moxy:4.0.2' xjc 'org.slf4j:slf4j-simple:1.7.36' - - api 'org.jvnet.jaxb2_commons:jaxb2-basics-runtime:0.13.1' - api 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.3' + api 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.1' + api 'codes.rafael.jaxb2_commons:jaxb2-basics-runtime:3.0.0' } ext.xjc = [ @@ -66,4 +66,4 @@ sourceSets { clean { delete xjc.destDir -} \ No newline at end of file +} diff --git a/Src/java/cqf-fhir-npm/src/main/java/org/cqframework/fhir/npm/NpmModelInfoProvider.java b/Src/java/cqf-fhir-npm/src/main/java/org/cqframework/fhir/npm/NpmModelInfoProvider.java index 4914c7535..092c1b97d 100644 --- a/Src/java/cqf-fhir-npm/src/main/java/org/cqframework/fhir/npm/NpmModelInfoProvider.java +++ b/Src/java/cqf-fhir-npm/src/main/java/org/cqframework/fhir/npm/NpmModelInfoProvider.java @@ -1,10 +1,6 @@ package org.cqframework.fhir.npm; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; - +import jakarta.xml.bind.JAXB; import org.hl7.cql.model.ModelIdentifier; import org.hl7.cql.model.ModelInfoProvider; import org.hl7.elm_modelinfo.r1.ModelInfo; @@ -12,7 +8,10 @@ import org.hl7.fhir.r5.model.Library; import org.hl7.fhir.utilities.npm.NpmPackage; -import javax.xml.bind.JAXB; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; /** * Provides a model info provider that can resolve CQL model info from an Npm package diff --git a/Src/java/cql-to-elm-cli/build.gradle b/Src/java/cql-to-elm-cli/build.gradle index b292cb04c..a7c1677a3 100644 --- a/Src/java/cql-to-elm-cli/build.gradle +++ b/Src/java/cql-to-elm-cli/build.gradle @@ -14,10 +14,6 @@ dependencies { implementation project(':model-jaxb') implementation project(':elm-jaxb') implementation 'net.sf.jopt-simple:jopt-simple:4.7' - runtimeOnly 'org.eclipse.persistence:org.eclipse.persistence.moxy:2.7.7' - runtimeOnly 'xpp3:xpp3_min:1.1.4c' - runtimeOnly 'xmlpull:xmlpull:1.1.3.1' - testImplementation project(':model-jaxb') testImplementation project(':model-jackson') testImplementation project(':elm-jaxb') diff --git a/Src/java/cql-to-elm/build.gradle b/Src/java/cql-to-elm/build.gradle index d735a4058..4cf4dd0c3 100644 --- a/Src/java/cql-to-elm/build.gradle +++ b/Src/java/cql-to-elm/build.gradle @@ -1,27 +1,20 @@ plugins { id 'cql.library-conventions' + id 'cql.xjc-conventions' } dependencies { api project(':cql') api project(':model') api project(':elm') + api 'org.fhir:ucum:1.0.8' + api 'org.apache.commons:commons-text:1.10.0' - // The FHIR ucum service depends on an - // XML pull-parser being present on the classpath, and have a compile-time reference to xpp3. - // However, some platfoms such as Android provide their own pull-parser implementations. - // Additionally, The xpp3.xpp3 dependency includes the javax.xml packagename, which is invalid in - // Java 9+ because split packages (i.e. the same packagename being available in multipe jar) are - // disallowed. For those reasons xpp3 is excluded here, and included as a runtime dependency for - // tests. Users of the CQL translator will need to supply their own implementation or add xpp3 - // at runtime. - api ('org.fhir:ucum:1.0.3') { - exclude group: 'xpp3' - } - - implementation 'org.apache.commons:commons-text:1.10.0' - implementation 'com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.15.2' - + // TODO: This dependencies are required due the the fact that the CqlTranslatorOptionsMapper lives + // in the cql-to-elm project. Ideally, we'd factor out all serialization depedencies into common + // libraries such that we could swap out jackson for something else. In the meantime, these are + // "implementation" dependencies so that they are not exported downstream. + implementation 'com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations:2.15.2' testImplementation project(':elm-jackson') testImplementation project(':model-jackson') testImplementation project(':quick') diff --git a/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/preprocessor/CqlPreprocessorElmCommonVisitor.java b/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/preprocessor/CqlPreprocessorElmCommonVisitor.java index 6891a5ecf..73f01e684 100644 --- a/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/preprocessor/CqlPreprocessorElmCommonVisitor.java +++ b/Src/java/cql-to-elm/src/main/java/org/cqframework/cql/cql2elm/preprocessor/CqlPreprocessorElmCommonVisitor.java @@ -19,14 +19,13 @@ import org.hl7.cql_annotations.r1.Tag; import org.hl7.elm.r1.*; -import javax.xml.bind.JAXBElement; +import jakarta.xml.bind.JAXBElement; import javax.xml.namespace.QName; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Stack; -import java.util.stream.Collectors; /** * Common functionality used by {@link CqlPreprocessorVisitor} and {@link Cql2ElmVisitor} diff --git a/Src/java/cql-to-elm/src/test/java/org/cqframework/cql/cql2elm/CommentTests.java b/Src/java/cql-to-elm/src/test/java/org/cqframework/cql/cql2elm/CommentTests.java index 033caa6ca..6977eea91 100644 --- a/Src/java/cql-to-elm/src/test/java/org/cqframework/cql/cql2elm/CommentTests.java +++ b/Src/java/cql-to-elm/src/test/java/org/cqframework/cql/cql2elm/CommentTests.java @@ -10,7 +10,7 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import javax.xml.bind.JAXBElement; +import jakarta.xml.bind.JAXBElement; import java.io.IOException; import java.util.HashMap; import java.util.Map; diff --git a/Src/java/cql-to-elm/src/test/java/org/cqframework/cql/cql2elm/TranslationTests.java b/Src/java/cql-to-elm/src/test/java/org/cqframework/cql/cql2elm/TranslationTests.java index 6490086a0..2d0c2a297 100644 --- a/Src/java/cql-to-elm/src/test/java/org/cqframework/cql/cql2elm/TranslationTests.java +++ b/Src/java/cql-to-elm/src/test/java/org/cqframework/cql/cql2elm/TranslationTests.java @@ -7,7 +7,7 @@ import org.testng.annotations.Ignore; import org.testng.annotations.Test; -import javax.xml.bind.JAXBException; +import jakarta.xml.bind.JAXBException; import java.io.File; import java.io.IOException; import java.util.ArrayList; diff --git a/Src/java/elm-fhir/build.gradle b/Src/java/elm-fhir/build.gradle index b2eff4222..3f4b66ba5 100644 --- a/Src/java/elm-fhir/build.gradle +++ b/Src/java/elm-fhir/build.gradle @@ -8,10 +8,9 @@ ext { } dependencies { - implementation project(':cql-to-elm') - implementation project(':engine') - implementation project(":engine-fhir") - implementation "org.mapstruct:mapstruct:${mapstructVersion}" + api project(':cql-to-elm') + api project(':engine') + api project(":engine-fhir") testImplementation project(':quick') testImplementation "org.reflections:reflections:0.10.2" diff --git a/Src/java/elm-fhir/src/main/java/org/cqframework/cql/elm/requirements/fhir/DataRequirementsProcessor.java b/Src/java/elm-fhir/src/main/java/org/cqframework/cql/elm/requirements/fhir/DataRequirementsProcessor.java index d450d9a9c..cc0094979 100644 --- a/Src/java/elm-fhir/src/main/java/org/cqframework/cql/elm/requirements/fhir/DataRequirementsProcessor.java +++ b/Src/java/elm-fhir/src/main/java/org/cqframework/cql/elm/requirements/fhir/DataRequirementsProcessor.java @@ -30,8 +30,7 @@ import org.opencds.cqf.cql.engine.fhir.converter.FhirTypeConverter; import org.opencds.cqf.cql.engine.fhir.converter.FhirTypeConverterFactory; -import javax.xml.bind.JAXBElement; -import javax.xml.namespace.QName; +import jakarta.xml.bind.JAXBElement; import java.io.Serializable; import java.math.BigDecimal; import java.time.ZonedDateTime; diff --git a/Src/java/elm-jackson/build.gradle b/Src/java/elm-jackson/build.gradle index 86932ef88..9adbb354d 100644 --- a/Src/java/elm-jackson/build.gradle +++ b/Src/java/elm-jackson/build.gradle @@ -7,7 +7,5 @@ dependencies { api project(':elm') implementation 'org.apache.commons:commons-text:1.10.0' implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.15.2' - implementation 'com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.15.2' - // needs javax.json.JsonException when using SAXUnmarshaller.getNewXMLReader - implementation 'org.glassfish:javax.json:1.0.4' + implementation 'com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations:2.15.2' } diff --git a/Src/java/elm-jackson/src/main/java/org/cqframework/cql/elm/serializing/jackson/ElmJsonLibraryReader.java b/Src/java/elm-jackson/src/main/java/org/cqframework/cql/elm/serializing/jackson/ElmJsonLibraryReader.java index a399636ed..3f724caae 100644 --- a/Src/java/elm-jackson/src/main/java/org/cqframework/cql/elm/serializing/jackson/ElmJsonLibraryReader.java +++ b/Src/java/elm-jackson/src/main/java/org/cqframework/cql/elm/serializing/jackson/ElmJsonLibraryReader.java @@ -1,17 +1,8 @@ package org.cqframework.cql.elm.serializing.jackson; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.databind.json.JsonMapper; -import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; import org.cqframework.cql.elm.serializing.ElmLibraryReader; import org.cqframework.cql.elm.serializing.LibraryWrapper; -import org.cqframework.cql.elm.serializing.jackson.mixins.CqlToElmBaseMixIn; -import org.cqframework.cql.elm.serializing.jackson.mixins.TypeSpecifierMixIn; -import org.hl7.cql_annotations.r1.CqlToElmBase; import org.hl7.elm.r1.Library; -import org.hl7.elm.r1.TypeSpecifier; import java.io.File; import java.io.IOException; diff --git a/Src/java/elm-jackson/src/main/java/org/cqframework/cql/elm/serializing/jackson/ElmJsonMapper.java b/Src/java/elm-jackson/src/main/java/org/cqframework/cql/elm/serializing/jackson/ElmJsonMapper.java index 713ff58ad..cf8c61461 100644 --- a/Src/java/elm-jackson/src/main/java/org/cqframework/cql/elm/serializing/jackson/ElmJsonMapper.java +++ b/Src/java/elm-jackson/src/main/java/org/cqframework/cql/elm/serializing/jackson/ElmJsonMapper.java @@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.MapperFeature; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.databind.json.JsonMapper; -import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; +import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule; import org.cqframework.cql.elm.serializing.jackson.mixins.CqlToElmBaseMixIn; import org.cqframework.cql.elm.serializing.jackson.mixins.TrackableMixIn; import org.cqframework.cql.elm.serializing.jackson.mixins.TypeSpecifierMixIn; @@ -20,7 +20,7 @@ public class ElmJsonMapper { .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY) .enable(MapperFeature.USE_BASE_TYPE_AS_DEFAULT_IMPL) .defaultPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL)) - .addModule(new JaxbAnnotationModule()) + .addModule(new JakartaXmlBindAnnotationModule()) .addMixIn(Trackable.class, TrackableMixIn.class) .addMixIn(TypeSpecifier.class, TypeSpecifierMixIn.class) .addMixIn(CqlToElmBase.class, CqlToElmBaseMixIn.class) diff --git a/Src/java/elm-jackson/src/main/java/org/cqframework/cql/elm/serializing/jackson/ElmXmlLibraryReader.java b/Src/java/elm-jackson/src/main/java/org/cqframework/cql/elm/serializing/jackson/ElmXmlLibraryReader.java index 89b3bff9f..ad3fbf461 100644 --- a/Src/java/elm-jackson/src/main/java/org/cqframework/cql/elm/serializing/jackson/ElmXmlLibraryReader.java +++ b/Src/java/elm-jackson/src/main/java/org/cqframework/cql/elm/serializing/jackson/ElmXmlLibraryReader.java @@ -1,17 +1,7 @@ package org.cqframework.cql.elm.serializing.jackson; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.dataformat.xml.XmlMapper; -import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator; -import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; import org.cqframework.cql.elm.serializing.ElmLibraryReader; -import org.cqframework.cql.elm.serializing.jackson.mixins.CqlToElmBaseMixIn; -import org.cqframework.cql.elm.serializing.jackson.mixins.TypeSpecifierMixIn; -import org.hl7.cql_annotations.r1.CqlToElmBase; import org.hl7.elm.r1.Library; -import org.hl7.elm.r1.TypeSpecifier; import java.io.File; import java.io.IOException; diff --git a/Src/java/elm-jackson/src/main/java/org/cqframework/cql/elm/serializing/jackson/ElmXmlMapper.java b/Src/java/elm-jackson/src/main/java/org/cqframework/cql/elm/serializing/jackson/ElmXmlMapper.java index 5902054a7..e8f255c20 100644 --- a/Src/java/elm-jackson/src/main/java/org/cqframework/cql/elm/serializing/jackson/ElmXmlMapper.java +++ b/Src/java/elm-jackson/src/main/java/org/cqframework/cql/elm/serializing/jackson/ElmXmlMapper.java @@ -9,7 +9,7 @@ import com.fasterxml.jackson.dataformat.xml.XmlFactory; import com.fasterxml.jackson.dataformat.xml.XmlMapper; import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator; -import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; +import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule; import org.cqframework.cql.elm.serializing.jackson.mixins.CqlToElmBaseMixIn; import org.cqframework.cql.elm.serializing.jackson.mixins.TrackableMixIn; import org.cqframework.cql.elm.serializing.jackson.mixins.TypeSpecifierMixIn; @@ -31,7 +31,7 @@ public class ElmXmlMapper { .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY) .enable(MapperFeature.USE_BASE_TYPE_AS_DEFAULT_IMPL) .defaultPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL)) - .addModule(new JaxbAnnotationModule()) + .addModule(new JakartaXmlBindAnnotationModule()) .addMixIn(Trackable.class, TrackableMixIn.class) .addMixIn(TypeSpecifier.class, TypeSpecifierMixIn.class) .addMixIn(CqlToElmBase.class, CqlToElmBaseMixIn.class) diff --git a/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmJsonLibraryReader.java b/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmJsonLibraryReader.java index f2a1dc603..058ea501c 100644 --- a/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmJsonLibraryReader.java +++ b/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmJsonLibraryReader.java @@ -1,18 +1,18 @@ package org.cqframework.cql.elm.serializing.jaxb; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.PropertyException; +import jakarta.xml.bind.Unmarshaller; +import jakarta.xml.bind.ValidationEvent; +import jakarta.xml.bind.ValidationEventHandler; import org.cqframework.cql.elm.serializing.ElmLibraryReader; import org.hl7.elm.r1.Library; -import javax.xml.bind.*; -import javax.xml.transform.Source; -import javax.xml.transform.stream.StreamSource; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.Reader; -import java.net.MalformedURLException; import java.net.URI; -import java.net.URISyntaxException; import java.net.URL; public class ElmJsonLibraryReader implements ElmLibraryReader { diff --git a/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmJsonLibraryWriter.java b/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmJsonLibraryWriter.java index e341e4629..dfd4332de 100644 --- a/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmJsonLibraryWriter.java +++ b/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmJsonLibraryWriter.java @@ -4,9 +4,9 @@ import org.hl7.elm.r1.Library; import org.hl7.elm.r1.ObjectFactory; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.PropertyException; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; +import jakarta.xml.bind.PropertyException; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; diff --git a/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmJsonMapper.java b/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmJsonMapper.java index db95f0904..2c1207471 100644 --- a/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmJsonMapper.java +++ b/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmJsonMapper.java @@ -3,8 +3,8 @@ import org.hl7.cql_annotations.r1.CqlToElmBase; import org.hl7.elm.r1.Library; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; public class ElmJsonMapper { diff --git a/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmXmlLibraryReader.java b/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmXmlLibraryReader.java index d8281a30e..88a837234 100644 --- a/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmXmlLibraryReader.java +++ b/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmXmlLibraryReader.java @@ -3,9 +3,9 @@ import org.cqframework.cql.elm.serializing.ElmLibraryReader; import org.hl7.elm.r1.Library; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; +import jakarta.xml.bind.JAXBElement; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Unmarshaller; import javax.xml.transform.Source; import java.io.File; import java.io.IOException; diff --git a/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmXmlLibraryWriter.java b/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmXmlLibraryWriter.java index e0868b0ca..0b5167e15 100644 --- a/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmXmlLibraryWriter.java +++ b/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmXmlLibraryWriter.java @@ -4,9 +4,9 @@ import org.hl7.elm.r1.Library; import org.hl7.elm.r1.ObjectFactory; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.PropertyException; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; +import jakarta.xml.bind.PropertyException; import java.io.*; public class ElmXmlLibraryWriter implements ElmLibraryWriter { diff --git a/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmXmlMapper.java b/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmXmlMapper.java index 97b811220..422b5dd62 100644 --- a/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmXmlMapper.java +++ b/Src/java/elm-jaxb/src/main/java/org/cqframework/cql/elm/serializing/jaxb/ElmXmlMapper.java @@ -3,8 +3,8 @@ import org.hl7.cql_annotations.r1.CqlToElmBase; import org.hl7.elm.r1.Library; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; public class ElmXmlMapper { diff --git a/Src/java/elm-jaxb/src/main/resources/org/cqframework/cql/elm/serializing/jaxb/jaxb.properties b/Src/java/elm-jaxb/src/main/resources/org/cqframework/cql/elm/serializing/jaxb/jaxb.properties index 5837a4c25..b48bb869b 100644 --- a/Src/java/elm-jaxb/src/main/resources/org/cqframework/cql/elm/serializing/jaxb/jaxb.properties +++ b/Src/java/elm-jaxb/src/main/resources/org/cqframework/cql/elm/serializing/jaxb/jaxb.properties @@ -1 +1 @@ -javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory \ No newline at end of file +jakarta.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory \ No newline at end of file diff --git a/Src/java/elm-test/build.gradle b/Src/java/elm-test/build.gradle index 378f5d694..0e9c83526 100644 --- a/Src/java/elm-test/build.gradle +++ b/Src/java/elm-test/build.gradle @@ -4,7 +4,8 @@ plugins { dependencies { implementation project(':cql-to-elm') - implementation project(':model-jaxb') - implementation project(':elm-jackson') + // implementation project(':model-jaxb') implementation project(':elm-jaxb') + implementation project(':model-jackson') + implementation project(':elm-jackson') } diff --git a/Src/java/elm-test/src/test/java/org/cqframework/cql/elm/ElmDeserializeTests.java b/Src/java/elm-test/src/test/java/org/cqframework/cql/elm/ElmDeserializeTests.java index 7b9832fd5..2c1988f1a 100644 --- a/Src/java/elm-test/src/test/java/org/cqframework/cql/elm/ElmDeserializeTests.java +++ b/Src/java/elm-test/src/test/java/org/cqframework/cql/elm/ElmDeserializeTests.java @@ -7,7 +7,7 @@ import java.util.List; import java.util.stream.Collectors; -import javax.xml.bind.JAXBException; +import jakarta.xml.bind.JAXBException; import org.cqframework.cql.cql2elm.CqlTranslator; import org.cqframework.cql.cql2elm.CqlCompilerOptions; diff --git a/Src/java/elm/build.gradle b/Src/java/elm/build.gradle index bc1b7c62e..2b9842213 100644 --- a/Src/java/elm/build.gradle +++ b/Src/java/elm/build.gradle @@ -4,7 +4,7 @@ plugins { } dependencies { - implementation project(':model') + api project(':model') } generateSources { diff --git a/Src/java/elm/src/main/java/org/cqframework/cql/elm/tracking/Trackable.java b/Src/java/elm/src/main/java/org/cqframework/cql/elm/tracking/Trackable.java index 2ea4e330d..1d4cdd771 100644 --- a/Src/java/elm/src/main/java/org/cqframework/cql/elm/tracking/Trackable.java +++ b/Src/java/elm/src/main/java/org/cqframework/cql/elm/tracking/Trackable.java @@ -2,7 +2,7 @@ import org.hl7.cql.model.DataType; -import javax.xml.bind.annotation.XmlTransient; +import jakarta.xml.bind.annotation.XmlTransient; import java.util.ArrayList; import java.util.List; import java.util.UUID; diff --git a/Src/java/elm/src/main/java/org/hl7/cql_annotations/r1/package-info.java b/Src/java/elm/src/main/java/org/hl7/cql_annotations/r1/package-info.java index e955375fb..97935a845 100644 --- a/Src/java/elm/src/main/java/org/hl7/cql_annotations/r1/package-info.java +++ b/Src/java/elm/src/main/java/org/hl7/cql_annotations/r1/package-info.java @@ -1,6 +1,6 @@ -@javax.xml.bind.annotation.XmlSchema(namespace = "urn:hl7-org:cql-annotations:r1", xmlns = { +@jakarta.xml.bind.annotation.XmlSchema(namespace = "urn:hl7-org:cql-annotations:r1", xmlns = { @XmlNs(prefix="a", namespaceURI = "urn:hl7-org:cql-annotations:r1")}, - elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) + elementFormDefault = jakarta.xml.bind.annotation.XmlNsForm.QUALIFIED) package org.hl7.cql_annotations.r1; -import javax.xml.bind.annotation.XmlNs; \ No newline at end of file +import jakarta.xml.bind.annotation.XmlNs; \ No newline at end of file diff --git a/Src/java/elm/src/main/java/org/hl7/elm/r1/package-info.java b/Src/java/elm/src/main/java/org/hl7/elm/r1/package-info.java index ecc7fe531..3122f1eb2 100644 --- a/Src/java/elm/src/main/java/org/hl7/elm/r1/package-info.java +++ b/Src/java/elm/src/main/java/org/hl7/elm/r1/package-info.java @@ -1,4 +1,4 @@ -@javax.xml.bind.annotation.XmlSchema(namespace = "urn:hl7-org:elm:r1", xmlns = { +@jakarta.xml.bind.annotation.XmlSchema(namespace = "urn:hl7-org:elm:r1", xmlns = { @XmlNs(prefix = "", namespaceURI = "urn:hl7-org:elm:r1"), @XmlNs(prefix = "t", namespaceURI = "urn:hl7-org:elm-types:r1"), @XmlNs(prefix = "xsi", namespaceURI = "http://www.w3.org/2001/XMLSchema-instance"), @@ -7,7 +7,7 @@ @XmlNs(prefix = "qdm43", namespaceURI = "urn:healthit-gov:qdm:v4_3"), @XmlNs(prefix = "qdm53", namespaceURI = "urn:healthit-gov:qdm:v5_3"), @XmlNs(prefix = "a", namespaceURI = "urn:hl7-org:cql-annotations:r1")}, - elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) + elementFormDefault = jakarta.xml.bind.annotation.XmlNsForm.QUALIFIED) package org.hl7.elm.r1; -import javax.xml.bind.annotation.XmlNs; \ No newline at end of file +import jakarta.xml.bind.annotation.XmlNs; \ No newline at end of file diff --git a/Src/java/elm/src/main/resources/org/hl7/cql_annotations/r1/jaxb.properties b/Src/java/elm/src/main/resources/org/hl7/cql_annotations/r1/jaxb.properties index 5837a4c25..b48bb869b 100644 --- a/Src/java/elm/src/main/resources/org/hl7/cql_annotations/r1/jaxb.properties +++ b/Src/java/elm/src/main/resources/org/hl7/cql_annotations/r1/jaxb.properties @@ -1 +1 @@ -javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory \ No newline at end of file +jakarta.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory \ No newline at end of file diff --git a/Src/java/elm/src/main/resources/org/hl7/elm/r1/jaxb.properties b/Src/java/elm/src/main/resources/org/hl7/elm/r1/jaxb.properties index 5837a4c25..b48bb869b 100644 --- a/Src/java/elm/src/main/resources/org/hl7/elm/r1/jaxb.properties +++ b/Src/java/elm/src/main/resources/org/hl7/elm/r1/jaxb.properties @@ -1 +1 @@ -javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory \ No newline at end of file +jakarta.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory \ No newline at end of file diff --git a/Src/java/engine-fhir/build.gradle b/Src/java/engine-fhir/build.gradle index 6ba8344e0..389a431bd 100644 --- a/Src/java/engine-fhir/build.gradle +++ b/Src/java/engine-fhir/build.gradle @@ -6,9 +6,6 @@ plugins { dependencies { api project(':engine') - api 'org.apache.commons:commons-text:1.10.0' - api 'xpp3:xpp3_min:1.1.4c' - api 'xmlpull:xmlpull:1.1.3.1' testImplementation 'com.github.tomakehurst:wiremock-jre8:2.35.0' testImplementation project(':cql-to-elm') testImplementation project(':model-jackson') diff --git a/Src/java/engine-fhir/src/test/java/org/hl7/fhirpath/TestFhirPath.java b/Src/java/engine-fhir/src/test/java/org/hl7/fhirpath/TestFhirPath.java index 4933db4b6..bb99e22b4 100644 --- a/Src/java/engine-fhir/src/test/java/org/hl7/fhirpath/TestFhirPath.java +++ b/Src/java/engine-fhir/src/test/java/org/hl7/fhirpath/TestFhirPath.java @@ -9,7 +9,7 @@ import java.time.ZoneOffset; import java.util.*; -import javax.xml.bind.JAXB; +import jakarta.xml.bind.JAXB; import org.hl7.elm.r1.Library; import org.fhir.ucum.UcumException; diff --git a/Src/java/engine-fhir/src/test/java/org/opencds/cqf/cql/engine/fhir/data/FhirExecutionTestBase.java b/Src/java/engine-fhir/src/test/java/org/opencds/cqf/cql/engine/fhir/data/FhirExecutionTestBase.java index 9fc7bcd8a..b29938b61 100644 --- a/Src/java/engine-fhir/src/test/java/org/opencds/cqf/cql/engine/fhir/data/FhirExecutionTestBase.java +++ b/Src/java/engine-fhir/src/test/java/org/opencds/cqf/cql/engine/fhir/data/FhirExecutionTestBase.java @@ -16,7 +16,7 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; -import javax.xml.bind.JAXBException; +import jakarta.xml.bind.JAXBException; import java.io.File; import java.io.IOException; import java.net.URLDecoder; diff --git a/Src/java/engine-fhir/src/test/java/org/opencds/cqf/cql/engine/fhir/data/Issue1225.java b/Src/java/engine-fhir/src/test/java/org/opencds/cqf/cql/engine/fhir/data/Issue1225.java new file mode 100644 index 000000000..623f68912 --- /dev/null +++ b/Src/java/engine-fhir/src/test/java/org/opencds/cqf/cql/engine/fhir/data/Issue1225.java @@ -0,0 +1,43 @@ +package org.opencds.cqf.cql.engine.fhir.data; + +import static org.junit.Assert.assertEquals; + +import java.util.Collections; + +import org.hl7.fhir.r4.model.Address; +import org.hl7.fhir.r4.model.Patient; +import org.opencds.cqf.cql.engine.data.CompositeDataProvider; +import org.opencds.cqf.cql.engine.retrieve.RetrieveProvider; +import org.opencds.cqf.cql.engine.runtime.Code; +import org.opencds.cqf.cql.engine.runtime.Interval; +import org.testng.annotations.Test; + +// https://github.com/cqframework/clinical_quality_language/issues/1225 +public class Issue1225 extends FhirExecutionTestBase { + + @Test + public void addressResolvesWithoutError() { + var r = new RetrieveProvider() { + @Override + public Iterable retrieve(String context, String contextPath, Object contextValue, String dataType, + String templateId, String codePath, Iterable codes, String valueSet, String datePath, + String dateLowPath, String dateHighPath, Interval dateRange) { + + if (dataType != null && dataType.equals("Patient")) { + var p = new Patient(); + p.getAddress().add(new Address().addLine("123").addLine("456")); + return Collections.singletonList(p); + } + + return Collections.emptyList(); + } + }; + + var engine = getEngine(); + engine.getState().getEnvironment().registerDataProvider("http://hl7.org/fhir", new CompositeDataProvider(r4ModelResolver, r)); + var result = engine.evaluate("Issue1225"); + + assertEquals("123", result.forExpression("Address Line 1").value()); + } + +} diff --git a/Src/java/engine-fhir/src/test/java/org/opencds/cqf/cql/engine/fhir/data/Issue1226.java b/Src/java/engine-fhir/src/test/java/org/opencds/cqf/cql/engine/fhir/data/Issue1226.java new file mode 100644 index 000000000..b4b2918b9 --- /dev/null +++ b/Src/java/engine-fhir/src/test/java/org/opencds/cqf/cql/engine/fhir/data/Issue1226.java @@ -0,0 +1,53 @@ +package org.opencds.cqf.cql.engine.fhir.data; + +import static org.junit.Assert.assertEquals; + +import java.util.Collections; + +import org.hl7.fhir.r4.model.Patient; +import org.hl7.fhir.r4.model.MedicationRequest; +import org.hl7.fhir.r4.model.Reference; +import org.opencds.cqf.cql.engine.data.CompositeDataProvider; +import org.opencds.cqf.cql.engine.retrieve.RetrieveProvider; +import org.opencds.cqf.cql.engine.runtime.Code; +import org.opencds.cqf.cql.engine.runtime.Interval; +import org.testng.annotations.Test; + +// https://github.com/cqframework/clinical_quality_language/issues/1226 +public class Issue1226 extends FhirExecutionTestBase { + + @Test + public void medicationReferenceFound() { + var r = new RetrieveProvider() { + @Override + public Iterable retrieve(String context, String contextPath, Object contextValue, String dataType, + String templateId, String codePath, Iterable codes, String valueSet, String datePath, + String dateLowPath, String dateHighPath, Interval dateRange) { + + switch(dataType) { + case "Patient" : return Collections.singletonList(new Patient().setId("123")); + case "MedicationRequest": return Collections.singletonList( + new MedicationRequest() + .setMedication( + new Reference("Medication/456"))); + } + + return Collections.emptyList(); + } + }; + + var engine = getEngine(); + + engine.getState().getEnvironment() + .registerDataProvider( + "http://hl7.org/fhir", + new CompositeDataProvider(r4ModelResolver, r)); + + var result = engine.evaluate("Issue1226") + .forExpression("Most Recent Medication Request reference") + .value(); + + assertEquals("Medication/456", result); + } + +} diff --git a/Src/java/engine-fhir/src/test/resources/org/hl7/fhirpath/tests/jaxb.properties b/Src/java/engine-fhir/src/test/resources/org/hl7/fhirpath/tests/jaxb.properties index 5837a4c25..b48bb869b 100644 --- a/Src/java/engine-fhir/src/test/resources/org/hl7/fhirpath/tests/jaxb.properties +++ b/Src/java/engine-fhir/src/test/resources/org/hl7/fhirpath/tests/jaxb.properties @@ -1 +1 @@ -javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory \ No newline at end of file +jakarta.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory \ No newline at end of file diff --git a/Src/java/engine-fhir/src/test/resources/org/opencds/cqf/cql/engine/fhir/data/Issue1225.cql b/Src/java/engine-fhir/src/test/resources/org/opencds/cqf/cql/engine/fhir/data/Issue1225.cql new file mode 100644 index 000000000..17d14fc53 --- /dev/null +++ b/Src/java/engine-fhir/src/test/resources/org/opencds/cqf/cql/engine/fhir/data/Issue1225.cql @@ -0,0 +1,13 @@ +library Issue1225 + +using USCore version '3.1.1' + +include FHIRHelpers version '4.0.1' + +context Patient + +define "Address": + Patient.address.line + +define "Address Line 1": + Patient.address.line[0] \ No newline at end of file diff --git a/Src/java/engine-fhir/src/test/resources/org/opencds/cqf/cql/engine/fhir/data/Issue1226.cql b/Src/java/engine-fhir/src/test/resources/org/opencds/cqf/cql/engine/fhir/data/Issue1226.cql new file mode 100644 index 000000000..9cc155355 --- /dev/null +++ b/Src/java/engine-fhir/src/test/resources/org/opencds/cqf/cql/engine/fhir/data/Issue1226.cql @@ -0,0 +1,16 @@ +library Issue1226 + +using USCore version '3.1.1' + +include FHIRHelpers version '4.0.1' + +context Patient + +define "All Medication Requests": + ["MedicationRequestProfile"] + +define "Most Recent Medication Request": + First("All Medication Requests") + +define "Most Recent Medication Request reference": + "Most Recent Medication Request".medication.reference \ No newline at end of file diff --git a/Src/java/engine/build.gradle b/Src/java/engine/build.gradle index e8e2b94d3..b7b3e9535 100644 --- a/Src/java/engine/build.gradle +++ b/Src/java/engine/build.gradle @@ -3,14 +3,9 @@ plugins { } dependencies { - api 'org.apache.commons:commons-text:1.10.0' - api 'org.fhir:ucum:1.0.3' - api 'xpp3:xpp3_min:1.1.4c' - api 'xmlpull:xmlpull:1.1.3.1' - implementation project(path: ':elm') - implementation project(path: ':cql-to-elm') + api project(':elm') + api project(':cql-to-elm') - testImplementation project(':cql-to-elm') testImplementation project(':model-jackson') testImplementation project(':elm-jackson') testImplementation 'org.mockito:mockito-core:5.4.0' diff --git a/Src/java/engine/src/main/cql-lm/schema/elm/binding.xjb b/Src/java/engine/src/main/cql-lm/schema/elm/binding.xjb index 6e27c1a61..1e425e461 100644 --- a/Src/java/engine/src/main/cql-lm/schema/elm/binding.xjb +++ b/Src/java/engine/src/main/cql-lm/schema/elm/binding.xjb @@ -1,10 +1,10 @@ diff --git a/Src/java/engine/src/main/java/org/opencds/cqf/cql/engine/elm/executing/AggregateClauseEvaluator.java b/Src/java/engine/src/main/java/org/opencds/cqf/cql/engine/elm/executing/AggregateClauseEvaluator.java new file mode 100644 index 000000000..cac336562 --- /dev/null +++ b/Src/java/engine/src/main/java/org/opencds/cqf/cql/engine/elm/executing/AggregateClauseEvaluator.java @@ -0,0 +1,69 @@ +package org.opencds.cqf.cql.engine.elm.executing; + +import org.cqframework.cql.elm.visiting.ElmLibraryVisitor; +import org.hl7.elm.r1.AggregateClause; +import org.opencds.cqf.cql.engine.exception.CqlException; +import org.opencds.cqf.cql.engine.execution.State; +import org.opencds.cqf.cql.engine.execution.Variable; +import org.opencds.cqf.cql.engine.runtime.Tuple; + +import java.util.List; +import java.util.Objects; + +/* +CQL provides support for a limited class of recursive problems +using the aggregate clause of the query construct. +This clause is similar in function to the JavaScript .reduce() function, +in that it allows an expression to be repeatedly evaluated for each element of a list, +and that expression can access the current value of the aggregation. + +https://cql.hl7.org/03-developersguide.html#aggregate-queries +*/ + +public class AggregateClauseEvaluator { + + public static Object aggregate(AggregateClause elm, State state, ElmLibraryVisitor visitor, List elements) { + Objects.requireNonNull(elm, "elm can not be null"); + Objects.requireNonNull(visitor, "visitor can not be null"); + Objects.requireNonNull(elements, "elements can not be null"); + Objects.requireNonNull(state, "state can not be null"); + + if (elm.isDistinct()) { + elements = DistinctEvaluator.distinct(elements, state); + } + + Object aggregatedValue = null; + if (elm.getStarting() != null) { + aggregatedValue = visitor.visitExpression(elm.getStarting(), state); + } + + for(var e : elements) { + if (!(e instanceof Tuple)) { + throw new CqlException("expected aggregation source to be a Tuple"); + } + var tuple = (Tuple)e; + + int pushes = 0; + + try { + state.push(new Variable().withName(elm.getIdentifier()).withValue(aggregatedValue)); + pushes++; + + for (var p : tuple.getElements().entrySet()) { + state.push(new Variable().withName(p.getKey()).withValue(p.getValue())); + pushes++; + } + + aggregatedValue = visitor.visitExpression(elm.getExpression(), state); + } + finally { + while(pushes > 0) { + state.pop(); + pushes--; + } + } + } + + return aggregatedValue; + } +} \ No newline at end of file diff --git a/Src/java/engine/src/main/java/org/opencds/cqf/cql/engine/elm/executing/FunctionRefEvaluator.java b/Src/java/engine/src/main/java/org/opencds/cqf/cql/engine/elm/executing/FunctionRefEvaluator.java index ccf5b186b..124d69a8e 100644 --- a/Src/java/engine/src/main/java/org/opencds/cqf/cql/engine/elm/executing/FunctionRefEvaluator.java +++ b/Src/java/engine/src/main/java/org/opencds/cqf/cql/engine/elm/executing/FunctionRefEvaluator.java @@ -18,7 +18,7 @@ public class FunctionRefEvaluator { - private static final Logger logger =LoggerFactory.getLogger(FunctionRefEvaluator.class); + private static final Logger logger = LoggerFactory.getLogger(FunctionRefEvaluator.class); public static Object internalEvaluate(FunctionRef functionRef, State state, ElmLibraryVisitor visitor) { ArrayList arguments = new ArrayList<>(functionRef.getOperand().size()); diff --git a/Src/java/engine/src/main/java/org/opencds/cqf/cql/engine/elm/executing/QueryEvaluator.java b/Src/java/engine/src/main/java/org/opencds/cqf/cql/engine/elm/executing/QueryEvaluator.java index 2ce831177..0d7ff1d61 100644 --- a/Src/java/engine/src/main/java/org/opencds/cqf/cql/engine/elm/executing/QueryEvaluator.java +++ b/Src/java/engine/src/main/java/org/opencds/cqf/cql/engine/elm/executing/QueryEvaluator.java @@ -2,6 +2,7 @@ import org.cqframework.cql.elm.visiting.ElmLibraryVisitor; import org.hl7.elm.r1.*; +import org.opencds.cqf.cql.engine.exception.CqlException; import org.opencds.cqf.cql.engine.execution.State; import org.opencds.cqf.cql.engine.execution.Variable; import org.opencds.cqf.cql.engine.runtime.CqlList; @@ -9,6 +10,7 @@ import org.opencds.cqf.cql.engine.runtime.iterators.QueryIterator; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; @@ -27,26 +29,30 @@ public static Iterable ensureIterable(Object source) { } } - private static void evaluateLets(Query elm, State state, List letVariables, ElmLibraryVisitor visitor) { + private static void evaluateLets(Query elm, State state, List letVariables, + ElmLibraryVisitor visitor) { for (int i = 0; i < elm.getLet().size(); i++) { letVariables.get(i).setValue(visitor.visitExpression(elm.getLet().get(i).getExpression(), state)); } } private static boolean evaluateRelationships(Query elm, State state, ElmLibraryVisitor visitor) { - // TODO: This is the most naive possible implementation here, but it should perform okay with 1) caching and 2) small data sets + // TODO: This is the most naive possible implementation here, but it should + // perform okay with 1) caching and 2) small data sets boolean shouldInclude = true; for (org.hl7.elm.r1.RelationshipClause relationship : elm.getRelationship()) { boolean hasSatisfyingData = false; - Iterable relatedSourceData = ensureIterable(visitor.visitExpression(relationship.getExpression(), state)); + Iterable relatedSourceData = ensureIterable( + visitor.visitExpression(relationship.getExpression(), state)); for (Object relatedElement : relatedSourceData) { state.push(new Variable().withName(relationship.getAlias()).withValue(relatedElement)); try { Object satisfiesRelatedCondition = visitor.visitExpression(relationship.getSuchThat(), state); if ((relationship instanceof org.hl7.elm.r1.With - || relationship instanceof org.hl7.elm.r1.Without) && Boolean.TRUE.equals(satisfiesRelatedCondition)) { - hasSatisfyingData = true; - break; // Once we have detected satisfying data, no need to continue testing + || relationship instanceof org.hl7.elm.r1.Without) + && Boolean.TRUE.equals(satisfiesRelatedCondition)) { + hasSatisfyingData = true; + break; // Once we have detected satisfying data, no need to continue testing } } finally { state.pop(); @@ -56,7 +62,8 @@ private static boolean evaluateRelationships(Query elm, State state, ElmLibraryV if ((relationship instanceof org.hl7.elm.r1.With && !hasSatisfyingData) || (relationship instanceof org.hl7.elm.r1.Without && hasSatisfyingData)) { shouldInclude = false; - break; // Once we have determined the row should not be included, no need to continue testing other related information + break; // Once we have determined the row should not be included, no need to continue + // testing other related information } } @@ -74,24 +81,21 @@ private static boolean evaluateWhere(Query elm, State state, ElmLibraryVisitor variables, List elements, ElmLibraryVisitor visitor) { - return elm.getReturn() != null ? visitor.visitExpression(elm.getReturn().getExpression(), state) : constructResult(state, variables, elements); + private static List evaluateAggregate(AggregateClause elm, State state, ElmLibraryVisitor visitor, List elements) { + return Collections.singletonList(AggregateClauseEvaluator.aggregate(elm, state, visitor, elements)); } - private static Object constructResult(State state, List variables, List elements) { - if (variables.size() > 1) { - LinkedHashMap elementMap = new LinkedHashMap<>(); - for (int i = 0; i < variables.size(); i++) { - elementMap.put(variables.get(i).getName(), variables.get(i).getValue()); - } - - return new Tuple(state).withElements(elementMap); + private static Object constructTuple(State state, List variables) { + var elementMap = new LinkedHashMap(); + for (var v : variables) { + elementMap.put(v.getName(), v.getValue()); } - return elements.get(0); + return new Tuple(state).withElements(elementMap); } - public static void sortResult(Query elm, List result, State state, String alias, ElmLibraryVisitor visitor) { + public static void sortResult(Query elm, List result, State state, String alias, + ElmLibraryVisitor visitor) { SortClause sortClause = elm.getSort(); @@ -100,7 +104,8 @@ public static void sortResult(Query elm, List result, State state, Strin for (SortByItem byItem : sortClause.getBy()) { if (byItem instanceof ByExpression) { - result.sort(new CqlList(state, visitor, alias, ((ByExpression) byItem).getExpression()).expressionSort); + result.sort( + new CqlList(state, visitor, alias, ((ByExpression) byItem).getExpression()).expressionSort); } else if (byItem instanceof ByColumn) { result.sort(new CqlList(state, ((ByColumn) byItem).getPath()).columnSort); } else { @@ -141,6 +146,9 @@ public Iterable getData() { @SuppressWarnings("unchecked") public static Object internalEvaluate(Query elm, State state, ElmLibraryVisitor visitor) { + if (elm.getAggregate() != null && elm.getReturn() != null) { + throw new CqlException("aggregate and return are mutually exclusive"); + } var sources = new ArrayList>(); var variables = new ArrayList(); @@ -174,12 +182,11 @@ public static Object internalEvaluate(Query elm, State state, ElmLibraryVisitor< while (iterator.hasNext()) { List elements = (List) iterator.next(); - // Assign range variables + // Assign variables assignVariables(variables, elements); evaluateLets(elm, state, letVariables, visitor); - // Evaluate relationships if (!evaluateRelationships(elm, state, visitor)) { continue; } @@ -188,7 +195,18 @@ public static Object internalEvaluate(Query elm, State state, ElmLibraryVisitor< continue; } - result.add(evaluateReturn(elm, state, variables, elements, visitor)); + // There's a "return" clause in the CQL + if (elm.getReturn() != null) { + result.add(visitor.visitExpression(elm.getReturn().getExpression(), state)); + } + // There's an "aggregate" clause in the CQL OR there's an implicit multi-source return + else if (elm.getAggregate() != null || variables.size() > 1) { + result.add(constructTuple(state, variables)); + } + // implicit return with 1 source + else { + result.add(elements.get(0)); + } } } finally { while (pushCount > 0) { @@ -201,13 +219,17 @@ public static Object internalEvaluate(Query elm, State state, ElmLibraryVisitor< result = DistinctEvaluator.distinct(result, state); } + if (elm.getAggregate() != null) { + result = evaluateAggregate(elm.getAggregate(), state, visitor, result); + } + sortResult(elm, result, state, null, visitor); if ((result == null || result.isEmpty()) && !sourceIsList) { return null; } - return sourceIsList ? result : result.get(0); + return elm.getAggregate() != null || !sourceIsList ? result.get(0) : result; } private static void assignVariables(List variables, List elements) { diff --git a/Src/java/engine/src/main/java/org/opencds/cqf/cql/engine/elm/executing/package-info.java b/Src/java/engine/src/main/java/org/opencds/cqf/cql/engine/elm/executing/package-info.java index 23385f61a..33b8b057d 100644 --- a/Src/java/engine/src/main/java/org/opencds/cqf/cql/engine/elm/executing/package-info.java +++ b/Src/java/engine/src/main/java/org/opencds/cqf/cql/engine/elm/executing/package-info.java @@ -1,11 +1,11 @@ -@javax.xml.bind.annotation.XmlSchema(namespace = "urn:hl7-org:elm:r1", xmlns = { +@jakarta.xml.bind.annotation.XmlSchema(namespace = "urn:hl7-org:elm:r1", xmlns = { @XmlNs(prefix = "", namespaceURI = "urn:hl7-org:elm:r1"), @XmlNs(prefix = "t", namespaceURI = "urn:hl7-org:elm-types:r1"), @XmlNs(prefix = "xsi", namespaceURI = "http://www.w3.org/2001/XMLSchema-instance"), @XmlNs(prefix = "xsd", namespaceURI = "http://www.w3.org/2001/XMLSchema"), @XmlNs(prefix = "quick", namespaceURI = "http://hl7.org/fhir"), @XmlNs(prefix = "a", namespaceURI = "urn:hl7-org:cql-annotations:r1")}, - elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) + elementFormDefault = jakarta.xml.bind.annotation.XmlNsForm.QUALIFIED) package org.opencds.cqf.cql.engine.elm.executing; -import javax.xml.bind.annotation.XmlNs; +import jakarta.xml.bind.annotation.XmlNs; diff --git a/Src/java/engine/src/test/java/org/opencds/cqf/cql/engine/execution/CqlAggregateFunctionsTest.java b/Src/java/engine/src/test/java/org/opencds/cqf/cql/engine/execution/CqlAggregateFunctionsTest.java index 1e9dcd21d..44757ba3d 100644 --- a/Src/java/engine/src/test/java/org/opencds/cqf/cql/engine/execution/CqlAggregateFunctionsTest.java +++ b/Src/java/engine/src/test/java/org/opencds/cqf/cql/engine/execution/CqlAggregateFunctionsTest.java @@ -20,9 +20,7 @@ public class CqlAggregateFunctionsTest extends CqlTestBase { @Test public void test_all_aggregate_function_tests() { - EvaluationResult evaluationResult; - - evaluationResult = engine.evaluate(toElmIdentifier("CqlAggregateFunctionsTest")); + var evaluationResult = engine.evaluate(toElmIdentifier("CqlAggregateFunctionsTest")); Object result = evaluationResult.forExpression("AllTrueAllTrue").value(); assertThat(result, is(true)); diff --git a/Src/java/engine/src/test/java/org/opencds/cqf/cql/engine/execution/CqlAggregateQueryTest.java b/Src/java/engine/src/test/java/org/opencds/cqf/cql/engine/execution/CqlAggregateQueryTest.java new file mode 100644 index 000000000..1e8bc1f14 --- /dev/null +++ b/Src/java/engine/src/test/java/org/opencds/cqf/cql/engine/execution/CqlAggregateQueryTest.java @@ -0,0 +1,33 @@ +package org.opencds.cqf.cql.engine.execution; + +import org.testng.annotations.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +public class CqlAggregateQueryTest extends CqlTestBase { + @Test + void test_all_aggregate_clause_tests() { + var evaluationResult = engine.evaluate(toElmIdentifier("CqlAggregateQueryTest")); + var result = evaluationResult.forExpression("AggregateSumWithStart").value(); + assertThat(result, is(16)); + + result = evaluationResult.forExpression("AggregateSumWithNull").value(); + assertThat(result, is(15)); + + result = evaluationResult.forExpression("AggregateSumAll").value(); + assertThat(result, is(24)); + + result = evaluationResult.forExpression("AggregateSumDistinct").value(); + assertThat(result, is(15)); + + result = evaluationResult.forExpression("Multi").value(); + assertThat(result, is(6)); + + result = evaluationResult.forExpression("MegaMulti").value(); + assertThat(result, is(36)); + + result = evaluationResult.forExpression("MegaMultiDistinct").value(); + assertThat(result, is(37)); + } +} diff --git a/Src/java/engine/src/test/resources/org/opencds/cqf/cql/engine/execution/CqlAggregateFunctionsTest.cql b/Src/java/engine/src/test/resources/org/opencds/cqf/cql/engine/execution/CqlAggregateFunctionsTest.cql index 32b34827c..4930fa1a4 100644 --- a/Src/java/engine/src/test/resources/org/opencds/cqf/cql/engine/execution/CqlAggregateFunctionsTest.cql +++ b/Src/java/engine/src/test/resources/org/opencds/cqf/cql/engine/execution/CqlAggregateFunctionsTest.cql @@ -71,4 +71,4 @@ define SumTestQuantity: Sum({1 'ml',2 'ml',3 'ml',4 'ml',5 'ml'}) define SumTestNull: Sum({ null, 1, null }) //Variance -define VarianceTest1: Variance({ 1.0, 2.0, 3.0, 4.0, 5.0 }) +define VarianceTest1: Variance({ 1.0, 2.0, 3.0, 4.0, 5.0 }) \ No newline at end of file diff --git a/Src/java/engine/src/test/resources/org/opencds/cqf/cql/engine/execution/CqlAggregateQueryTest.cql b/Src/java/engine/src/test/resources/org/opencds/cqf/cql/engine/execution/CqlAggregateQueryTest.cql new file mode 100644 index 000000000..dd0c3763c --- /dev/null +++ b/Src/java/engine/src/test/resources/org/opencds/cqf/cql/engine/execution/CqlAggregateQueryTest.cql @@ -0,0 +1,45 @@ +library CqlAggregateQueryTest + +//Aggregate clause +define AggregateSumWithStart: + ({ 1, 2, 3, 4, 5 }) Num + aggregate Result starting 1: Result + Num // 15 + 1 (the initial value) + +define AggregateSumWithNull: + ({ 1, 2, 3, 4, 5 }) Num + aggregate Result: Coalesce(Result, 0) + Num // 15 + 0 (the initial value from null) + +define AggregateSumAll: + ({ 1, 1, 2, 2, 2, 3, 4, 4, 5 }) Num + aggregate all Result: Coalesce(Result, 0) + Num // 24 + 0 + +define AggregateSumDistinct: + ({ 1, 1, 2, 2, 2, 3, 4, 4, 5 }) Num + aggregate distinct Result: Coalesce(Result, 0) + Num // 15 + 0 (the initial value) + + +define First: {1} +define Second: {2} +define Third: {3} + +define Multi: + from First X, Second Y, Third Z + aggregate Agg: Coalesce(Agg, 0) + X + Y + Z // 6 + +define "A": {1, 2} +define "B": {1, 2} +define "C": {1, 2} + +define MegaMulti: + from "A" X, "B" Y, "C" Z + aggregate Agg starting 0: Agg + X + Y + Z // 36 -- (1+1+1)+(1+1+2)+(1+2+1)+(1+2+2)+(2+1+1)+(2+1+2)+(2+2+1)+(2+2+2) + + +define "1": {1, 2, 2, 1} +define "2": {1, 2, 1, 2} +define "3": {2, 1, 2, 1} + +define MegaMultiDistinct: + from "1" X, "2" Y, "3" Z + aggregate distinct Agg starting 1: Agg + X + Y + Z // 37 -- 1 + (1+1+1)+(1+1+2)+(1+2+1)+(1+2+2)+(2+1+1)+(2+1+2)+(2+2+1)+(2+2+2) + diff --git a/Src/java/gradle.properties b/Src/java/gradle.properties index e62af31a4..6d1d2809d 100644 --- a/Src/java/gradle.properties +++ b/Src/java/gradle.properties @@ -2,9 +2,9 @@ org.gradle.caching=true org.gradle.parallel=true group=info.cqframework -version=3.4.0-SNAPSHOT +version=3.5.0-SNAPSHOT specification.version=1.5.2 -hapi.version=6.8.3 +hapi.version=6.8.5 fhir-core.version=6.0.22.2 antlr.version=4.10.1 android.api.level=28 diff --git a/Src/java/model-jackson/build.gradle b/Src/java/model-jackson/build.gradle index bf6d81ff1..79ed1b4e3 100644 --- a/Src/java/model-jackson/build.gradle +++ b/Src/java/model-jackson/build.gradle @@ -5,7 +5,7 @@ plugins { dependencies { api project(':model') implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.15.2' - implementation 'com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.15.2' + implementation 'com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations:2.15.2' testImplementation project(":quick") testImplementation project(":qdm") diff --git a/Src/java/model-jackson/src/main/java/org/hl7/elm_modelinfo/r1/serializing/jackson/XmlModelInfoReader.java b/Src/java/model-jackson/src/main/java/org/hl7/elm_modelinfo/r1/serializing/jackson/XmlModelInfoReader.java index c9c7165ab..4f38201fe 100644 --- a/Src/java/model-jackson/src/main/java/org/hl7/elm_modelinfo/r1/serializing/jackson/XmlModelInfoReader.java +++ b/Src/java/model-jackson/src/main/java/org/hl7/elm_modelinfo/r1/serializing/jackson/XmlModelInfoReader.java @@ -8,7 +8,7 @@ import com.fasterxml.jackson.dataformat.xml.XmlFactory; import com.fasterxml.jackson.dataformat.xml.XmlMapper; import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator; -import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; +import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule; import org.hl7.elm_modelinfo.r1.ModelInfo; import org.hl7.elm_modelinfo.r1.TypeInfo; import org.hl7.elm_modelinfo.r1.TypeSpecifier; @@ -33,7 +33,7 @@ public class XmlModelInfoReader implements ModelInfoReader { .enable(SerializationFeature.INDENT_OUTPUT) .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY) .enable(MapperFeature.USE_BASE_TYPE_AS_DEFAULT_IMPL) - .addModule(new JaxbAnnotationModule()) + .addModule(new JakartaXmlBindAnnotationModule()) .addMixIn(TypeInfo.class, TypeInfoMixIn.class) .addMixIn(TypeSpecifier.class, TypeSpecifierMixIn.class) .build(); diff --git a/Src/java/model-jaxb/build.gradle b/Src/java/model-jaxb/build.gradle index 5bb1dfda5..990a7efaf 100644 --- a/Src/java/model-jaxb/build.gradle +++ b/Src/java/model-jaxb/build.gradle @@ -3,5 +3,5 @@ plugins { } dependencies { - implementation project(':model') + api project(':model') } diff --git a/Src/java/model-jaxb/src/main/java/org/hl7/elm_modelinfo/r1/serializing/jaxb/XmlModelInfoReader.java b/Src/java/model-jaxb/src/main/java/org/hl7/elm_modelinfo/r1/serializing/jaxb/XmlModelInfoReader.java index 31e9288eb..9d1b5f475 100644 --- a/Src/java/model-jaxb/src/main/java/org/hl7/elm_modelinfo/r1/serializing/jaxb/XmlModelInfoReader.java +++ b/Src/java/model-jaxb/src/main/java/org/hl7/elm_modelinfo/r1/serializing/jaxb/XmlModelInfoReader.java @@ -3,7 +3,7 @@ import org.hl7.elm_modelinfo.r1.ModelInfo; import org.hl7.elm_modelinfo.r1.serializing.ModelInfoReader; -import javax.xml.bind.JAXB; +import jakarta.xml.bind.JAXB; import java.io.*; import java.net.URI; import java.net.URL; diff --git a/Src/java/model-jaxb/src/main/resources/java/org/hl7/elm_modelinfo/r1/serializing/jaxb/jaxb.properties b/Src/java/model-jaxb/src/main/resources/java/org/hl7/elm_modelinfo/r1/serializing/jaxb/jaxb.properties index 5837a4c25..b48bb869b 100644 --- a/Src/java/model-jaxb/src/main/resources/java/org/hl7/elm_modelinfo/r1/serializing/jaxb/jaxb.properties +++ b/Src/java/model-jaxb/src/main/resources/java/org/hl7/elm_modelinfo/r1/serializing/jaxb/jaxb.properties @@ -1 +1 @@ -javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory \ No newline at end of file +jakarta.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory \ No newline at end of file diff --git a/Src/java/model/build.gradle b/Src/java/model/build.gradle index 9f83b90ac..1bb18cc98 100644 --- a/Src/java/model/build.gradle +++ b/Src/java/model/build.gradle @@ -15,4 +15,4 @@ generateSources { arg(line: "${xjc.args} -npa") } } -} \ No newline at end of file +} diff --git a/Src/java/model/src/main/java/org/hl7/cql/model/ModelIdentifier.java b/Src/java/model/src/main/java/org/hl7/cql/model/ModelIdentifier.java index 6260a4d8f..0a9587e20 100644 --- a/Src/java/model/src/main/java/org/hl7/cql/model/ModelIdentifier.java +++ b/Src/java/model/src/main/java/org/hl7/cql/model/ModelIdentifier.java @@ -4,7 +4,7 @@ import org.jvnet.jaxb2_commons.locator.ObjectLocator; import org.jvnet.jaxb2_commons.locator.util.LocatorUtils; -import javax.xml.bind.annotation.*; +import jakarta.xml.bind.annotation.*; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ModelIdentifier", namespace = "urn:hl7-org:model") diff --git a/Src/java/model/src/main/java/org/hl7/elm_modelinfo/r1/package-info.java b/Src/java/model/src/main/java/org/hl7/elm_modelinfo/r1/package-info.java index 227addf83..f06b8bb59 100644 --- a/Src/java/model/src/main/java/org/hl7/elm_modelinfo/r1/package-info.java +++ b/Src/java/model/src/main/java/org/hl7/elm_modelinfo/r1/package-info.java @@ -5,11 +5,11 @@ // Generated on: 2015.01.05 at 11:42:59 AM MST // -@javax.xml.bind.annotation.XmlSchema(namespace = "urn:hl7-org:elm-modelinfo:r1", xmlns = { +@jakarta.xml.bind.annotation.XmlSchema(namespace = "urn:hl7-org:elm-modelinfo:r1", xmlns = { @XmlNs(prefix = "", namespaceURI = "urn:hl7-org:elm-modelinfo:r1"), @XmlNs(prefix = "xsi", namespaceURI = "http://www.w3.org/2001/XMLSchema-instance"), @XmlNs(prefix = "xsd", namespaceURI = "http://www.w3.org/2001/XMLSchema")}, - elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) + elementFormDefault = jakarta.xml.bind.annotation.XmlNsForm.QUALIFIED) package org.hl7.elm_modelinfo.r1; -import javax.xml.bind.annotation.XmlNs; \ No newline at end of file +import jakarta.xml.bind.annotation.XmlNs; \ No newline at end of file diff --git a/Src/java/model/src/main/resources/org/hl7/elm_modelinfo/r1/jaxb.properties b/Src/java/model/src/main/resources/org/hl7/elm_modelinfo/r1/jaxb.properties index 5837a4c25..b48bb869b 100644 --- a/Src/java/model/src/main/resources/org/hl7/elm_modelinfo/r1/jaxb.properties +++ b/Src/java/model/src/main/resources/org/hl7/elm_modelinfo/r1/jaxb.properties @@ -1 +1 @@ -javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory \ No newline at end of file +jakarta.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory \ No newline at end of file diff --git a/Src/java/model/src/test/java/org/hl7/cql/model/ModelInfoComparer.java b/Src/java/model/src/test/java/org/hl7/cql/model/ModelInfoComparer.java index 46dd767ca..5519b25b2 100644 --- a/Src/java/model/src/test/java/org/hl7/cql/model/ModelInfoComparer.java +++ b/Src/java/model/src/test/java/org/hl7/cql/model/ModelInfoComparer.java @@ -3,7 +3,7 @@ import org.hl7.elm_modelinfo.r1.*; import org.testng.annotations.Test; -import javax.xml.bind.JAXB; +import jakarta.xml.bind.JAXB; import static org.hamcrest.Matchers.is; import static org.junit.Assert.*; diff --git a/Src/java/qdm/build.gradle b/Src/java/qdm/build.gradle index 8740cbda9..2047aec7c 100644 --- a/Src/java/qdm/build.gradle +++ b/Src/java/qdm/build.gradle @@ -4,8 +4,8 @@ plugins { } dependencies { - implementation project(':elm') - implementation project(':model') + api project(':elm') + api project(':model') } generateSources{ diff --git a/Src/java/quick/build.gradle b/Src/java/quick/build.gradle index 4f3dad17e..97275a85d 100644 --- a/Src/java/quick/build.gradle +++ b/Src/java/quick/build.gradle @@ -4,8 +4,8 @@ plugins { } dependencies { - implementation project(':elm') - implementation project(':model') + api project(':elm') + api project(':model') } generateSources{ diff --git a/Src/java/quick/schema/v1.4/quick-binding.xjb b/Src/java/quick/schema/v1.4/quick-binding.xjb index 6f6c088b8..67ea3ea52 100644 --- a/Src/java/quick/schema/v1.4/quick-binding.xjb +++ b/Src/java/quick/schema/v1.4/quick-binding.xjb @@ -1,7 +1,7 @@ - + version="3.0"> diff --git a/Src/java/tools/xsd-to-modelinfo/build.gradle b/Src/java/tools/xsd-to-modelinfo/build.gradle index bdc474883..de960982e 100644 --- a/Src/java/tools/xsd-to-modelinfo/build.gradle +++ b/Src/java/tools/xsd-to-modelinfo/build.gradle @@ -1,5 +1,6 @@ plugins { id 'cql.java-conventions' + id 'cql.library-conventions' id 'application' } @@ -8,7 +9,7 @@ application { } dependencies { - implementation project(':model') + api project(':model') implementation 'net.sf.jopt-simple:jopt-simple:4.7' implementation 'org.apache.ws.xmlschema:xmlschema-core:2.2.5' implementation 'org.apache.ws.xmlschema:xmlschema-walker:2.2.5' diff --git a/Src/java/tools/xsd-to-modelinfo/src/main/java/org/cqframework/cql/tools/xsd2modelinfo/Main.java b/Src/java/tools/xsd-to-modelinfo/src/main/java/org/cqframework/cql/tools/xsd2modelinfo/Main.java index df58c805e..b182b5ff2 100644 --- a/Src/java/tools/xsd-to-modelinfo/src/main/java/org/cqframework/cql/tools/xsd2modelinfo/Main.java +++ b/Src/java/tools/xsd-to-modelinfo/src/main/java/org/cqframework/cql/tools/xsd2modelinfo/Main.java @@ -8,10 +8,10 @@ import org.hl7.elm_modelinfo.r1.ModelInfo; import org.hl7.elm_modelinfo.r1.ObjectFactory; -import javax.xml.bind.JAXB; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; +import jakarta.xml.bind.JAXB; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; import javax.xml.transform.stream.StreamSource; import java.io.*; diff --git a/Src/java/tools/xsd-to-modelinfo/src/main/java/org/cqframework/cql/tools/xsd2modelinfo/ModelImporter.java b/Src/java/tools/xsd-to-modelinfo/src/main/java/org/cqframework/cql/tools/xsd2modelinfo/ModelImporter.java index 0243ef5f5..b665af14c 100644 --- a/Src/java/tools/xsd-to-modelinfo/src/main/java/org/cqframework/cql/tools/xsd2modelinfo/ModelImporter.java +++ b/Src/java/tools/xsd-to-modelinfo/src/main/java/org/cqframework/cql/tools/xsd2modelinfo/ModelImporter.java @@ -4,7 +4,7 @@ import org.hl7.cql.model.*; import org.hl7.elm_modelinfo.r1.*; -import javax.xml.bind.JAXB; +import jakarta.xml.bind.JAXB; import javax.xml.namespace.QName; import java.io.IOException; import java.io.InputStream;