-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow persistence interceptors to modify the incoming resource #2369
Comments
Robin pointed out that, when we allow this, there will be an interesting ordering dependency between the interceptors and the "update-only-if-modified" feature from #2263. Which should come first? In my opinion, I think it would be best for the "update-only-if-modified" check to come first. This way, we will avoid calling the This means that, in cases where the interceptors modify the incoming payload in some way, we might end up performing an unnecessary update (if the incoming resources didn't match the saved resource before the interceptors but does match afterward). It also means that if you have some resources saved and then introduce an interceptor that modifies incoming resources and then perform the update with |
This allows the interceptors to modify the incoming resource. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
This allows the interceptors to modify the incoming resource. Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
QA:
|
issue #2369 - fix the TaggingInterceptor
Is your feature request related to a problem? Please describe.
IBM FHIR Server supports persistence interceptors which can fire arbitrary business logic before or after an interaction for a given resource type.
In some cases, it might be helpful to add or remove fields to the incoming resources (during create or update).
For example, to add some tag.
Unfortunately, the current implementation allows an interceptor to modify the fhirResource in the persistence event, but it uses the original resource for the create/update instead of the updated one in the event.
Describe the solution you'd like
the doCreate and doUpdate methods should use the resource from the event instead of passing in the original payload
Describe alternatives you've considered
the persistencecontext already includes the event, so we could potentially update the Persistence interface to stop duplicating the resources in its signature. that would be a breaking change and it would make implementing persistence layers a bit more annoying, but would prevent the possibility of a resource that is out-of-sync with the corresponding event.
Acceptance Criteria
GIVEN a persistence interceptor that modifies the incoming resources
WHEN you create a resource
THEN the saved resource is the modified one from the interceptor
GIVEN a persistence interceptor that modifies the incoming resources
WHEN you update a resource
THEN the saved resource is the modified one from the interceptor
Additional context
I think this used to work back when our model was mutable...the interceptor would just change the actual object in the event. Now that we are immutable it needs to create a new one and attach that new one to the event.
The text was updated successfully, but these errors were encountered: