Previously the server would not start when using a CodeableConcept in a List in combination with Kotlin

This commit is contained in:
jelmer.terwal 2019-10-22 14:34:07 +02:00 committed by James Agnew
parent c337fdde14
commit a859b210e3
2 changed files with 22 additions and 5 deletions

View File

@ -0,0 +1,18 @@
package cn.uhn.fhir.jaxrs.server.example
import ca.uhn.fhir.model.api.annotation.Child
import ca.uhn.fhir.model.api.annotation.Extension
import ca.uhn.fhir.model.api.annotation.ResourceDef
import org.hl7.fhir.dstu3.model.CodeableConcept
import org.hl7.fhir.dstu3.model.Organization
@ResourceDef(name = "Organization")
class ExtendedOrganization : Organization() {
@Child(name = "someEnumerationInAList")
@Extension(
url = "http://test.url",
definedLocally = false,
isModifier = false
)
var legalStatus: List<CodeableConcept> = emptyList()
}

View File

@ -8,7 +8,6 @@ import ca.uhn.fhir.rest.annotation.OptionalParam
import ca.uhn.fhir.rest.annotation.Search
import ca.uhn.fhir.rest.api.Constants
import ca.uhn.fhir.rest.param.StringParam
import org.hl7.fhir.dstu3.model.Organization
import javax.ejb.Stateless
import javax.ws.rs.Path
import javax.ws.rs.Produces
@ -17,15 +16,15 @@ import javax.ws.rs.core.MediaType
@Path("Organization")
@Stateless
@Produces(MediaType.APPLICATION_JSON, Constants.CT_FHIR_JSON, Constants.CT_FHIR_XML)
class ExtendedOrganizationResource : AbstractJaxRsResourceProvider<Organization>(FhirContext.forDstu3()) {
override fun getResourceType(): Class<Organization>? = Organization::class.java
class ExtendedOrganizationResource : AbstractJaxRsResourceProvider<ExtendedOrganization>(FhirContext.forDstu3()) {
override fun getResourceType(): Class<ExtendedOrganization>? = ExtendedOrganization::class.java
@Search
fun find(
@OptionalParam(name = "_id") theId: StringParam?,
@IncludeParam(allow = ["Patient:general-practitioner"]) includes: Collection<Include>?
): List<Organization> {
val organization = Organization().also {
): List<ExtendedOrganization> {
val organization = ExtendedOrganization().also {
it.id = "id"
}
return listOf(organization)