diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionsR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionsR4Test.java index 9ad6d5a1578..cbb53ea3afc 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionsR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionsR4Test.java @@ -193,8 +193,8 @@ public abstract class BaseSubscriptionsR4Test extends BaseResourceProviderR4Test @Update public MethodOutcome update(@ResourceParam Observation theObservation, HttpServletRequest theRequest) { ourLog.info("Received Listener Update"); - ourUpdatedObservations.add(theObservation); ourContentTypes.add(theRequest.getHeader(Constants.HEADER_CONTENT_TYPE).replaceAll(";.*", "")); + ourUpdatedObservations.add(theObservation); extractHeaders(theRequest); return new MethodOutcome(new IdType("Observation/1"), false); } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/FhirClientSubscriptionProviderTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/FhirClientSubscriptionProviderTest.java index 5d23b900dc1..59bfd9b6c99 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/FhirClientSubscriptionProviderTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/FhirClientSubscriptionProviderTest.java @@ -56,6 +56,7 @@ public class FhirClientSubscriptionProviderTest extends BaseSubscriptionsR4Test waitForSize(0, ourCreatedObservations); waitForSize(1, ourUpdatedObservations); + waitForSize(1, ourContentTypes); assertEquals(Constants.CT_FHIR_JSON_NEW, ourContentTypes.get(0)); } } diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/cross/IResourceLookup.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/cross/IResourceLookup.java index 1e4b1de0026..06b9decfc8c 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/cross/IResourceLookup.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/cross/IResourceLookup.java @@ -1,5 +1,25 @@ package ca.uhn.fhir.jpa.model.cross; +/*- + * #%L + * HAPI FHIR Model + * %% + * Copyright (C) 2014 - 2020 University Health Network + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + import java.util.Date; public interface IResourceLookup { diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/cross/ResourceLookup.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/cross/ResourceLookup.java index 9920c9a3dc6..661b635e691 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/cross/ResourceLookup.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/cross/ResourceLookup.java @@ -1,5 +1,25 @@ package ca.uhn.fhir.jpa.model.cross; +/*- + * #%L + * HAPI FHIR Model + * %% + * Copyright (C) 2014 - 2020 University Health Network + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + import java.util.Date; public class ResourceLookup implements IResourceLookup { diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceLink.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceLink.java index 238e002f60a..44438c28626 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceLink.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceLink.java @@ -85,7 +85,7 @@ public class ResourceLink extends BaseResourceIndex { public String getTargetResourceId() { if (myTargetResourceId == null && myTargetResource != null) { - myTargetResourceId = myTargetResource.getIdDt().getIdPart(); + myTargetResourceId = getTargetResource().getIdDt().getIdPart(); } return myTargetResourceId; } @@ -216,6 +216,10 @@ public class ResourceLink extends BaseResourceIndex { return b.toString(); } + public ResourceTable getTargetResource() { + return myTargetResource; + } + public static ResourceLink forAbsoluteReference(String theSourcePath, ResourceTable theSourceResource, IIdType theTargetResourceUrl, Date theUpdated) { ResourceLink retVal = new ResourceLink(); retVal.setSourcePath(theSourcePath);