From c337fdde14aba0a4f86776f341a784202291266f Mon Sep 17 00:00:00 2001 From: "jelmer.terwal" Date: Tue, 22 Oct 2019 14:23:37 +0200 Subject: [PATCH] Override breakes stuff here for Kotlin --- .../hl7/fhir/instance/model/api/IAnyResource.java | 2 -- .../jaxrs/server/example/ExtendedOrganization.kt | 14 -------------- .../server/example/ExtendedOrganizationResource.kt | 12 +++++------- 3 files changed, 5 insertions(+), 23 deletions(-) delete mode 100644 hapi-fhir-jaxrsserver-example/src/main/kotlin/cn/uhn/fhir/jaxrs/server/example/ExtendedOrganization.kt diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IAnyResource.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IAnyResource.java index 5f69fdfadec..51ba817b81c 100644 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IAnyResource.java +++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IAnyResource.java @@ -50,14 +50,12 @@ public interface IAnyResource extends IBaseResource { String getId(); - @Override IIdType getIdElement(); IPrimitiveType getLanguageElement(); Object getUserData(String name); - @Override IAnyResource setId(String theId); void setUserData(String name, Object value); 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 deleted file mode 100644 index 05d61056891..00000000000 --- a/hapi-fhir-jaxrsserver-example/src/main/kotlin/cn/uhn/fhir/jaxrs/server/example/ExtendedOrganization.kt +++ /dev/null @@ -1,14 +0,0 @@ -package cn.uhn.fhir.jaxrs.server.example - -import ca.uhn.fhir.model.api.annotation.ResourceDef -import org.hl7.fhir.dstu3.model.BaseResource -import org.hl7.fhir.dstu3.model.Organization -import org.hl7.fhir.instance.model.api.IIdType - -@ResourceDef(name = "Organization") -open class ExtendedOrganization : Organization() { - - override fun setId(value: IIdType?): BaseResource? { - return this - } -} 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 54ff9db16ba..cf34ce7e4f1 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,7 @@ 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.instance.model.api.IAnyResource +import org.hl7.fhir.dstu3.model.Organization import javax.ejb.Stateless import javax.ws.rs.Path import javax.ws.rs.Produces @@ -17,19 +17,17 @@ import javax.ws.rs.core.MediaType @Path("Organization") @Stateless @Produces(MediaType.APPLICATION_JSON, Constants.CT_FHIR_JSON, Constants.CT_FHIR_XML) -class ExtendedOrganizationResource : BaseResource() { - override fun getResourceType(): Class? = ExtendedOrganization::class.java +class ExtendedOrganizationResource : AbstractJaxRsResourceProvider(FhirContext.forDstu3()) { + override fun getResourceType(): Class? = Organization::class.java @Search fun find( @OptionalParam(name = "_id") theId: StringParam?, @IncludeParam(allow = ["Patient:general-practitioner"]) includes: Collection? - ): List { - val organization = ExtendedOrganization().also { + ): List { + val organization = Organization().also { it.id = "id" } return listOf(organization) } } - -abstract class BaseResource: AbstractJaxRsResourceProvider(FhirContext.forDstu3())