mirror of
https://github.com/hapifhir/hapi-fhir.git
synced 2025-02-07 05:28:21 +00:00
Merge branch 'master' into windows-fixes
This commit is contained in:
commit
29f483d7b4
@ -92,6 +92,11 @@
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-jpaserver-base</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
|
@ -0,0 +1,25 @@
|
||||
package example.interceptor;
|
||||
|
||||
import ca.uhn.fhir.jpa.model.interceptor.api.Hook;
|
||||
import ca.uhn.fhir.jpa.model.interceptor.api.Interceptor;
|
||||
import ca.uhn.fhir.jpa.model.interceptor.api.Pointcut;
|
||||
import ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription;
|
||||
import ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryMessage;
|
||||
|
||||
/**
|
||||
* Interceptor class
|
||||
*/
|
||||
@Interceptor
|
||||
public class MyTestInterceptor {
|
||||
|
||||
@Hook(Pointcut.SUBSCRIPTION_BEFORE_REST_HOOK_DELIVERY)
|
||||
public boolean beforeRestHookDelivery(ResourceDeliveryMessage theDeliveryMessage, CanonicalSubscription theSubscription) {
|
||||
|
||||
String header = "Authorization: Bearer 1234567";
|
||||
|
||||
theSubscription.addHeader(header);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -26,7 +26,6 @@ import static org.junit.Assert.*;
|
||||
@ContextConfiguration(classes = {InterceptorRegistryTest.InterceptorRegistryTestCtxConfig.class})
|
||||
public class InterceptorRegistryTest {
|
||||
|
||||
private static boolean ourNext_beforeRestHookDelivery_Return2;
|
||||
private static boolean ourNext_beforeRestHookDelivery_Return1;
|
||||
private static List<String> ourInvocations = new ArrayList<>();
|
||||
private static CanonicalSubscription ourLastCanonicalSubscription;
|
||||
@ -88,7 +87,6 @@ public class InterceptorRegistryTest {
|
||||
@Before
|
||||
public void before() {
|
||||
ourNext_beforeRestHookDelivery_Return1 = true;
|
||||
ourNext_beforeRestHookDelivery_Return2 = true;
|
||||
ourLastCanonicalSubscription = null;
|
||||
ourLastResourceDeliveryMessage0 = null;
|
||||
ourLastResourceDeliveryMessage1 = null;
|
||||
@ -140,11 +138,10 @@ public class InterceptorRegistryTest {
|
||||
@Order(200)
|
||||
public static class MyTestInterceptorTwo {
|
||||
@Hook(Pointcut.SUBSCRIPTION_BEFORE_REST_HOOK_DELIVERY)
|
||||
public boolean beforeRestHookDelivery(ResourceDeliveryMessage theResourceDeliveryMessage0, ResourceDeliveryMessage theResourceDeliveryMessage1) {
|
||||
public void beforeRestHookDelivery(ResourceDeliveryMessage theResourceDeliveryMessage0, ResourceDeliveryMessage theResourceDeliveryMessage1) {
|
||||
ourLastResourceDeliveryMessage0 = theResourceDeliveryMessage0;
|
||||
ourLastResourceDeliveryMessage1 = theResourceDeliveryMessage1;
|
||||
ourInvocations.add("MyTestInterceptorTwo.beforeRestHookDelivery");
|
||||
return ourNext_beforeRestHookDelivery_Return2;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.model.interceptor.api;
|
||||
* 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.
|
||||
|
@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.model.interceptor.executor;
|
||||
* 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.
|
||||
@ -254,10 +254,10 @@ public class InterceptorRegistry implements IInterceptorRegistry, ApplicationCon
|
||||
myMethod = theHookMethod;
|
||||
|
||||
Class<?> returnType = theHookMethod.getReturnType();
|
||||
if (returnType.equals(boolean.class) || returnType.equals(Boolean.class)) {
|
||||
if (returnType.equals(boolean.class)) {
|
||||
myReturnsBoolean = true;
|
||||
} else {
|
||||
Validate.isTrue(Void.class.equals(returnType), "Method does not return boolean or void: %s", theHookMethod);
|
||||
Validate.isTrue(void.class.equals(returnType), "Method does not return boolean or void: %s", theHookMethod);
|
||||
myReturnsBoolean = false;
|
||||
}
|
||||
|
||||
|
@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.subscription.module.cache;
|
||||
* 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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user