From 405507882b295a331bea1f0ebb1c902d98ef7333 Mon Sep 17 00:00:00 2001 From: leif stawnyczy Date: Wed, 22 Nov 2023 15:20:47 -0500 Subject: [PATCH] adding changelog --- .../ca/uhn/fhir/interceptor/api/Pointcut.java | 2 +- .../5478-adding-member-match-pointcut.yaml | 10 ++++++++++ .../ca/uhn/fhir/jpa/config/r4/JpaR4Config.java | 8 ++++---- .../r4/MemberMatchR4ResourceProvider.java | 18 +++++++----------- .../jpa/provider/r4/MemberMatcherR4Helper.java | 2 +- 5 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/7_0_0/5478-adding-member-match-pointcut.yaml diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Pointcut.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Pointcut.java index a9ab31bdf2b..48998d3065e 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Pointcut.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Pointcut.java @@ -2482,7 +2482,7 @@ public enum Pointcut implements IPointcut { * */ P2P_MEMBER_MATCH_PRE_HOOK( - void.class, "ca.uhn.fhir.rest.api.server.RequestDetails", "ca.uhn.fhir.jpa.model.MemberMatchPreHookEvent"), + void.class, "ca.uhn.fhir.rest.api.server.RequestDetails", "ca.uhn.fhir.jpa.model.MemberMatchPreHookEvent"), /** * JPA Hook: diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/7_0_0/5478-adding-member-match-pointcut.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/7_0_0/5478-adding-member-match-pointcut.yaml new file mode 100644 index 00000000000..e3206954a19 --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/7_0_0/5478-adding-member-match-pointcut.yaml @@ -0,0 +1,10 @@ +--- +type: add +issue: 5478 +title: "Added a pointcut (P2P_MEMBER_MATCH_PRE_HOOK) that is invoked + after basic parameter validation, but before persisted member-match + operations have occurred. + This pointcut takes RequestDetails and a MemberMatchPreHookEvent + (which contains the patient, coverages, and consent resources) + object. + " diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/r4/JpaR4Config.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/r4/JpaR4Config.java index fd2ca7b658f..96bdb81a41e 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/r4/JpaR4Config.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/r4/JpaR4Config.java @@ -119,9 +119,9 @@ public class JpaR4Config { @Bean public MemberMatchR4ResourceProvider memberMatchR4ResourceProvider( - FhirContext theFhirContext, IInterceptorBroadcaster theIInterceptorBroadcaster, MemberMatcherR4Helper theMemberMatchR4Helper) { - return new MemberMatchR4ResourceProvider(theFhirContext, - theMemberMatchR4Helper, - theIInterceptorBroadcaster); + FhirContext theFhirContext, + IInterceptorBroadcaster theIInterceptorBroadcaster, + MemberMatcherR4Helper theMemberMatchR4Helper) { + return new MemberMatchR4ResourceProvider(theFhirContext, theMemberMatchR4Helper, theIInterceptorBroadcaster); } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatchR4ResourceProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatchR4ResourceProvider.java index 4b3ea0f046d..8b2096ba178 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatchR4ResourceProvider.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatchR4ResourceProvider.java @@ -38,8 +38,8 @@ import org.hl7.fhir.r4.model.Coverage; import org.hl7.fhir.r4.model.Parameters; import org.hl7.fhir.r4.model.Patient; -import javax.annotation.Nullable; import java.util.Optional; +import javax.annotation.Nullable; public class MemberMatchR4ResourceProvider { @@ -48,10 +48,9 @@ public class MemberMatchR4ResourceProvider { private final IInterceptorBroadcaster myInterceptorBroadcaster; public MemberMatchR4ResourceProvider( - FhirContext theFhirContext, - MemberMatcherR4Helper theMemberMatcherR4Helper, - IInterceptorBroadcaster theIInterceptorBroadcaster - ) { + FhirContext theFhirContext, + MemberMatcherR4Helper theMemberMatcherR4Helper, + IInterceptorBroadcaster theIInterceptorBroadcaster) { myFhirContext = theFhirContext; myMemberMatcherR4Helper = theMemberMatcherR4Helper; myInterceptorBroadcaster = theIInterceptorBroadcaster; @@ -138,7 +137,8 @@ public class MemberMatchR4ResourceProvider { throw new UnprocessableEntityException(Msg.code(2147) + i18nMessage); } - if (CompositeInterceptorBroadcaster.hasHooks(Pointcut.P2P_MEMBER_MATCH_PRE_HOOK, myInterceptorBroadcaster, theRequestDetails)) { + if (CompositeInterceptorBroadcaster.hasHooks( + Pointcut.P2P_MEMBER_MATCH_PRE_HOOK, myInterceptorBroadcaster, theRequestDetails)) { MemberMatchPreHookEvent preHookParams = new MemberMatchPreHookEvent(); preHookParams.setConsent(theConsent); preHookParams.setPatient(theMemberPatient); @@ -149,11 +149,7 @@ public class MemberMatchR4ResourceProvider { params.add(MemberMatchPreHookEvent.class, preHookParams); params.add(RequestDetails.class, theRequestDetails); CompositeInterceptorBroadcaster.doCallHooks( - myInterceptorBroadcaster, - theRequestDetails, - Pointcut.P2P_MEMBER_MATCH_PRE_HOOK, - params - ); + myInterceptorBroadcaster, theRequestDetails, Pointcut.P2P_MEMBER_MATCH_PRE_HOOK, params); } myMemberMatcherR4Helper.addMemberIdentifierToMemberPatient(theMemberPatient, patient.getIdentifierFirstRep()); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatcherR4Helper.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatcherR4Helper.java index 31b98f09ac5..d9a271feac9 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatcherR4Helper.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatcherR4Helper.java @@ -46,10 +46,10 @@ import org.hl7.fhir.r4.model.Parameters; import org.hl7.fhir.r4.model.Patient; import org.hl7.fhir.r4.model.Reference; -import javax.annotation.Nullable; import java.util.List; import java.util.Optional; import java.util.function.Consumer; +import javax.annotation.Nullable; import static ca.uhn.fhir.rest.api.Constants.PARAM_CONSENT; import static ca.uhn.fhir.rest.api.Constants.PARAM_MEMBER_IDENTIFIER;