diff --git a/hapi-fhir-jaxrsserver-example/src/main/kotlin/cn/uhn/fhir/jaxrs/server/example/ExtendedOrganization.kt b/hapi-fhir-jaxrsserver-example/src/main/kotlin/cn/uhn/fhir/jaxrs/server/example/ExtendedOrganization.kt new file mode 100644 index 00000000000..8e1a77c3fc2 --- /dev/null +++ b/hapi-fhir-jaxrsserver-example/src/main/kotlin/cn/uhn/fhir/jaxrs/server/example/ExtendedOrganization.kt @@ -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 = emptyList() +} diff --git a/hapi-fhir-jaxrsserver-example/src/main/kotlin/cn/uhn/fhir/jaxrs/server/example/ExtendedOrganizationResource.kt b/hapi-fhir-jaxrsserver-example/src/main/kotlin/cn/uhn/fhir/jaxrs/server/example/ExtendedOrganizationResource.kt index cf34ce7e4f1..68426328b48 100644 --- a/hapi-fhir-jaxrsserver-example/src/main/kotlin/cn/uhn/fhir/jaxrs/server/example/ExtendedOrganizationResource.kt +++ b/hapi-fhir-jaxrsserver-example/src/main/kotlin/cn/uhn/fhir/jaxrs/server/example/ExtendedOrganizationResource.kt @@ -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(FhirContext.forDstu3()) { - override fun getResourceType(): Class? = Organization::class.java +class ExtendedOrganizationResource : AbstractJaxRsResourceProvider(FhirContext.forDstu3()) { + override fun getResourceType(): Class? = ExtendedOrganization::class.java @Search fun find( @OptionalParam(name = "_id") theId: StringParam?, @IncludeParam(allow = ["Patient:general-practitioner"]) includes: Collection? - ): List { - val organization = Organization().also { + ): List { + val organization = ExtendedOrganization().also { it.id = "id" } return listOf(organization)