Skip to content
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
7 changes: 1 addition & 6 deletions Src/java/buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,9 @@ dependencies {
implementation("org.glassfish.jaxb:xsom:4.0.5")
implementation("com.squareup:kotlinpoet:2.1.0")
implementation("com.github.gmazzo.buildconfig:com.github.gmazzo.buildconfig.gradle.plugin:5.6.7")
implementation("org.openrewrite.rewrite:org.openrewrite.rewrite.gradle.plugin:7.17.0")
}

kotlin {
jvmToolchain(17)
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ plugins {
kotlin("jvm")
id("cql.maven-publishing-conventions")
id("jacoco")
id("cql.sca-conventions")
id("org.jetbrains.dokka")
id("io.gitlab.arturbosch.detekt")
id("org.openrewrite.rewrite")
}

repositories {
Expand All @@ -18,19 +18,28 @@ repositories {
}
}

// Reenable once we have time to address the issues
//detekt {
// // Applies the config files on top of detekt's default config.
// buildUponDefaultConfig = true
//
// // The directories where detekt looks for source files.
// source.setFrom(
// "src/main/kotlin",
// "src/test/kotlin",
// )
//
// // Custom config with overrides.
// config.setFrom("$rootDir/config/detekt/detekt.yml")
//}

kotlin {
jvmToolchain(17)
compilerOptions {
freeCompilerArgs.add("-Xwarning-level=DEPRECATION:disabled")
}
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

dependencies {
implementation("org.slf4j:slf4j-api:2.0.13")
testImplementation("org.hamcrest:hamcrest-all:1.3")
Expand All @@ -44,6 +53,8 @@ dependencies {
testRuntimeOnly("org.eclipse.persistence:org.eclipse.persistence.moxy:4.0.2")
testRuntimeOnly("org.eclipse.parsson:parsson:1.1.5")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")

rewrite(project(":rewrite"))
}

tasks.jar {
Expand All @@ -63,7 +74,6 @@ tasks.register<Jar>("dokkaHtmlJar") {

jacoco {
toolVersion = "0.8.11"

}

tasks.withType<Test> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id("ru.vyarus.animalsniffer")
id("cql.java-conventions")
id("cql.kotlin-conventions")
}

dependencies {
Expand Down
28 changes: 0 additions & 28 deletions Src/java/buildSrc/src/main/kotlin/cql.sca-conventions.gradle.kts

This file was deleted.

58 changes: 0 additions & 58 deletions Src/java/config/checkstyle/checkstyle.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,30 @@ import org.hl7.fhir.r5.model.Library
import org.hl7.fhir.utilities.VersionUtilities

class LibraryLoader(private val version: String?) : ILibraryReader {
@Suppress("VariableNaming")
@Throws(FHIRFormatError::class, IOException::class)
override fun readLibrary(stream: InputStream?): Library? {
if (VersionUtilities.isR2Ver(version)) {
throw FHIRException("Library is not supported in R2")
} else if (VersionUtilities.isR2BVer(version)) {
val res = JsonParser().parse(stream)
val versionConvertor_14_50 = VersionConvertor_14_50(BaseAdvisor_14_50())
return versionConvertor_14_50.convertResource(res) as Library?
} else if (VersionUtilities.isR3Ver(version)) {
val res = org.hl7.fhir.dstu3.formats.JsonParser().parse(stream)
val versionConvertor_30_50 = VersionConvertor_30_50(BaseAdvisor_30_50())
return versionConvertor_30_50.convertResource(res) as Library?
} else if (VersionUtilities.isR4Ver(version)) {
val res = org.hl7.fhir.r4.formats.JsonParser().parse(stream)
val versionConvertor_40_50 = VersionConvertor_40_50(BaseAdvisor_40_50())
return versionConvertor_40_50.convertResource(res) as Library?
} else if (VersionUtilities.isR5Ver(version)) {
return org.hl7.fhir.r5.formats.JsonParser().parse(stream) as Library?
} else {
throw FHIRException("Unknown Version '$version'")
return when {
VersionUtilities.isR2Ver(version) ->
throw FHIRException("Library is not supported in R2")
VersionUtilities.isR2BVer(version) -> {
val res = JsonParser().parse(stream)
val versionConvertor_14_50 = VersionConvertor_14_50(BaseAdvisor_14_50())
versionConvertor_14_50.convertResource(res) as Library?
}
VersionUtilities.isR3Ver(version) -> {
val res = org.hl7.fhir.dstu3.formats.JsonParser().parse(stream)
val versionConvertor_30_50 = VersionConvertor_30_50(BaseAdvisor_30_50())
versionConvertor_30_50.convertResource(res) as Library?
}
VersionUtilities.isR4Ver(version) -> {
val res = org.hl7.fhir.r4.formats.JsonParser().parse(stream)
val versionConvertor_40_50 = VersionConvertor_40_50(BaseAdvisor_40_50())
versionConvertor_40_50.convertResource(res) as Library?
}
VersionUtilities.isR5Ver(version) ->
org.hl7.fhir.r5.formats.JsonParser().parse(stream) as Library?
else -> throw FHIRException("Unknown Version '$version'")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package org.cqframework.fhir.npm

import java.io.ByteArrayInputStream
import java.io.IOException
import java.lang.String
import kotlin.plus
import kotlinx.io.Source
import kotlinx.io.asSource
Expand All @@ -19,6 +18,7 @@ class NpmLibrarySourceProvider(
private val reader: ILibraryReader,
private val logger: ILoggingService,
) : LibrarySourceProvider {
@Suppress("NestedBlockDepth")
override fun getLibrarySource(libraryIdentifier: VersionedIdentifier): Source? {
// VersionedIdentifier.id: Name of the library
// VersionedIdentifier.system: Namespace for the library, as a URL
Expand Down Expand Up @@ -52,13 +52,10 @@ class NpmLibrarySourceProvider(
}
}
}
} catch (e: IOException) {
} catch (_: IOException) {
logger.logDebugMessage(
ILoggingService.LogCategory.PROGRESS,
String.format(
"Exceptions occurred attempting to load npm library source for %s",
libraryIdentifier.toString(),
),
"Exceptions occurred attempting to load npm library source for $libraryIdentifier",
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class NpmModelInfoProvider(
private val reader: ILibraryReader,
private val logger: ILoggingService,
) : ModelInfoProvider {
@Suppress("NestedBlockDepth")
override fun load(modelIdentifier: ModelIdentifier): ModelInfo? {
// VersionedIdentifier.id: Name of the model
// VersionedIdentifier.system: Namespace for the model, as a URL
Expand Down Expand Up @@ -53,13 +54,10 @@ class NpmModelInfoProvider(
}
}
}
} catch (e: IOException) {
} catch (_: IOException) {
logger.logDebugMessage(
ILoggingService.LogCategory.PROGRESS,
String.format(
"Exceptions occurred attempting to load npm library for model %s",
modelIdentifier,
),
"Exceptions occurred attempting to load npm library for model $modelIdentifier",
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ constructor(
try {
this.fspcm = fspcm ?: FilesystemPackageCacheManager.Builder().build()
loadDependencies()
} catch (e: Exception) {
} catch (e: IOException) {
logErrorMessage(e.message)
throw NpmPackageManagerException(e.message)
throw NpmPackageManagerException(e.message, e)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@ package org.cqframework.fhir.npm

/** This exception is thrown whenever there is an issue with the NpmPackageManager. */
class NpmPackageManagerException : RuntimeException {
constructor(message: String?) : super(message)

companion object {
const val serialVersionUID: Long = 1L
}
constructor(message: String?, t: Throwable? = null) : super(message, t)
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class NpmProcessor(
// @Inject
init {
if (igContext != null) {
packageManager = NpmPackageManager(igContext.getSourceIg())
packageManager = NpmPackageManager(igContext.sourceIg!!)
}
}

Expand All @@ -45,12 +45,7 @@ class NpmProcessor(
if (packageManager != null) {
val packages = packageManager!!.npmList
for (p in packages) {
if (
p.name() != null &&
!p.name().isEmpty() &&
p.canonical() != null &&
!p.canonical().isEmpty()
) {
if (!p.name().isNullOrBlank() && !p.canonical().isNullOrBlank()) {
val ni = NamespaceInfo(p.name(), p.canonical())
namespaceInfos.add(ni)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.hl7.fhir.r4.model.Parameters
import org.hl7.fhir.r4.model.ValueSet
import org.hl7.fhir.r4.model.codesystems.ConceptSubsumptionOutcome

@Suppress("ForbiddenComment", "TooManyFunctions")
interface FhirTerminologyService : FhirService {
// https://hl7.org/fhir/valueset-operation-expand.html
// TODO: Consider activeOnly, as well as includeDraft and expansion parameters (see Measure
Expand Down
Loading
Loading