001/*-
002 * #%L
003 * HAPI FHIR - Core Library
004 * %%
005 * Copyright (C) 2014 - 2024 Smile CDR, Inc.
006 * %%
007 * Licensed under the Apache License, Version 2.0 (the "License");
008 * you may not use this file except in compliance with the License.
009 * You may obtain a copy of the License at
010 *
011 *      http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 * #L%
019 */
020package ca.uhn.fhir.interceptor.api;
021
022import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
023import ca.uhn.fhir.rest.annotation.Read;
024import ca.uhn.fhir.rest.annotation.Search;
025import ca.uhn.fhir.rest.server.exceptions.AuthenticationException;
026import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
027import ca.uhn.fhir.validation.ValidationResult;
028import jakarta.annotation.Nonnull;
029import org.hl7.fhir.instance.model.api.IBaseConformance;
030
031import java.io.Writer;
032import java.util.Arrays;
033import java.util.Collections;
034import java.util.HashSet;
035import java.util.List;
036import java.util.Set;
037
038/**
039 * Value for {@link Hook#value()}
040 * <p>
041 * Hook pointcuts are divided into several broad categories:
042 * <ul>
043 * <li>INTERCEPTOR_xxx: Hooks on the interceptor infrastructure itself</li>
044 * <li>CLIENT_xxx: Hooks on the HAPI FHIR Client framework</li>
045 * <li>SERVER_xxx: Hooks on the HAPI FHIR Server framework</li>
046 * <li>SUBSCRIPTION_xxx: Hooks on the HAPI FHIR Subscription framework</li>
047 * <li>STORAGE_xxx: Hooks on the storage engine</li>
048 * <li>VALIDATION_xxx: Hooks on the HAPI FHIR Validation framework</li>
049 * <li>JPA_PERFTRACE_xxx: Performance tracing hooks on the JPA server</li>
050 * </ul>
051 * </p>
052 */
053public enum Pointcut implements IPointcut {
054
055        /**
056         * <b>Interceptor Framework Hook:</b>
057         * This pointcut will be called once when a given interceptor is registered
058         */
059        INTERCEPTOR_REGISTERED(void.class),
060
061        /**
062         * <b>Client Hook:</b>
063         * This hook is called before an HTTP client request is sent
064         * <p>
065         * Hooks may accept the following parameters:
066         * <ul>
067         * <li>
068         * ca.uhn.fhir.rest.client.api.IHttpRequest - The details of the request
069         * </li>
070         * <li>
071         *    ca.uhn.fhir.rest.client.api.IRestfulClient - The client object making the request
072         * </li>
073         * </ul>
074         * </p>
075         * Hook methods must return <code>void</code>.
076         */
077        CLIENT_REQUEST(
078                        void.class, "ca.uhn.fhir.rest.client.api.IHttpRequest", "ca.uhn.fhir.rest.client.api.IRestfulClient"),
079
080        /**
081         * <b>Client Hook:</b>
082         * This hook is called after an HTTP client request has completed, prior to returning
083         * the results to the calling code. Hook methods may modify the response.
084         * <p>
085         * Hooks may accept the following parameters:
086         * <ul>
087         * <li>
088         * ca.uhn.fhir.rest.client.api.IHttpRequest - The details of the request
089         * </li>
090         * <li>
091         * ca.uhn.fhir.rest.client.api.IHttpResponse - The details of the response
092         * </li>
093         * <li>
094         *    ca.uhn.fhir.rest.client.api.IRestfulClient - The client object making the request
095         * </li>
096         * <li>
097         *    ca.uhn.fhir.rest.client.api.ClientResponseContext - Contains an IHttpRequest, an IHttpResponse, and an IRestfulClient
098         *    and also allows the client to mutate the contained IHttpResponse
099         * </li>
100         * </ul>
101         * </p>
102         * Hook methods must return <code>void</code>.
103         */
104        CLIENT_RESPONSE(
105                        void.class,
106                        "ca.uhn.fhir.rest.client.api.IHttpRequest",
107                        "ca.uhn.fhir.rest.client.api.IHttpResponse",
108                        "ca.uhn.fhir.rest.client.api.IRestfulClient",
109                        "ca.uhn.fhir.rest.client.api.ClientResponseContext"),
110
111        /**
112         * <b>Server Hook:</b>
113         * This hook is called when a server CapabilityStatement is generated for returning to a client.
114         * <p>
115         * This pointcut will not necessarily be invoked for every client request to the `/metadata` endpoint.
116         * If caching of the generated CapabilityStatement is enabled, a new CapabilityStatement will be
117         * generated periodically and this pointcut will be invoked at that time.
118         * </p>
119         * <p>
120         * Hooks may accept the following parameters:
121         * <ul>
122         * <li>
123         * org.hl7.fhir.instance.model.api.IBaseConformance - The <code>CapabilityStatement</code> resource that will
124         * be returned to the client by the server. Interceptors may make changes to this resource. The parameter
125         * must be of type <code>IBaseConformance</code>, so it is the responsibility of the interceptor hook method
126         * code to cast to the appropriate version.
127         * </li>
128         * <li>
129         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to
130         * be processed
131         * </li>
132         * <li>
133         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that
134         * is about to be processed. This parameter is identical to the RequestDetails parameter above but will only
135         * be populated when operating in a RestfulServer implementation. It is provided as a convenience.
136         * </li>
137         * </ul>
138         * </p>
139         * Hook methods may an instance of a new <code>CapabilityStatement</code> resource which will replace the
140         * one that was supplied to the interceptor, or <code>void</code> to use the original one. If the interceptor
141         * chooses to modify the <code>CapabilityStatement</code> that was supplied to the interceptor, it is fine
142         * for your hook method to return <code>void</code> or <code>null</code>.
143         */
144        SERVER_CAPABILITY_STATEMENT_GENERATED(
145                        IBaseConformance.class,
146                        "org.hl7.fhir.instance.model.api.IBaseConformance",
147                        "ca.uhn.fhir.rest.api.server.RequestDetails",
148                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
149
150        /**
151         * <b>Server Hook:</b>
152         * This hook is called before any other processing takes place for each incoming request. It may be used to provide
153         * alternate handling for some requests, or to screen requests before they are handled, etc.
154         * <p>
155         * Note that any exceptions thrown by this method will not be trapped by HAPI (they will be passed up to the server)
156         * </p>
157         * <p>
158         * Hooks may accept the following parameters:
159         * <ul>
160         * <li>
161         * jakarta.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
162         * </li>
163         * <li>
164         * jakarta.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
165         * </li>
166         * </ul>
167         * </p>
168         * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally.
169         * This is generally the right thing to do. If your interceptor is providing a response rather than
170         * letting HAPI handle the response normally, you must return <code>false</code>. In this case,
171         * no further processing will occur and no further interceptors will be called.
172         */
173        SERVER_INCOMING_REQUEST_PRE_PROCESSED(
174                        boolean.class, "jakarta.servlet.http.HttpServletRequest", "jakarta.servlet.http.HttpServletResponse"),
175
176        /**
177         * <b>Server Hook:</b>
178         * This hook is invoked upon any exception being thrown within the server's request processing code. This includes
179         * any exceptions thrown within resource provider methods (e.g. {@link Search} and {@link Read} methods) as well as
180         * any runtime exceptions thrown by the server itself. This also includes any {@link AuthenticationException}
181         * thrown.
182         * <p>
183         * Hooks may accept the following parameters:
184         * <ul>
185         * <li>
186         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
187         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
188         * pulled out of the servlet request. Note that the bean
189         * properties are not all guaranteed to be populated, depending on how early during processing the
190         * exception occurred.
191         * </li>
192         * <li>
193         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
194         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
195         * pulled out of the servlet request. Note that the bean
196         * properties are not all guaranteed to be populated, depending on how early during processing the
197         * exception occurred. This parameter is identical to the RequestDetails parameter above but will
198         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
199         * </li>
200         * <li>
201         * jakarta.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
202         * </li>
203         * <li>
204         * jakarta.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
205         * </li>
206         * <li>
207         * ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException - The exception that was thrown
208         * </li>
209         * </ul>
210         * </p>
211         * <p>
212         * Implementations of this method may choose to ignore/log/count/etc exceptions, and return <code>true</code> or
213         * <code>void</code>. In
214         * this case, processing will continue, and the server will automatically generate an {@link BaseOperationOutcome
215         * OperationOutcome}. Implementations may also choose to provide their own response to the client. In this case, they
216         * should return <code>false</code>, to indicate that they have handled the request and processing should stop.
217         * </p>
218         */
219        SERVER_HANDLE_EXCEPTION(
220                        boolean.class,
221                        "ca.uhn.fhir.rest.api.server.RequestDetails",
222                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
223                        "jakarta.servlet.http.HttpServletRequest",
224                        "jakarta.servlet.http.HttpServletResponse",
225                        "ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException"),
226
227        /**
228         * <b>Server Hook:</b>
229         * This method is immediately before the handling method is selected. Interceptors may make changes
230         * to the request that can influence which handler will ultimately be called.
231         * <p>
232         * Hooks may accept the following parameters:
233         * <ul>
234         * <li>
235         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
236         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
237         * pulled out of the servlet request.
238         * Note that the bean properties are not all guaranteed to be populated at the time this hook is called.
239         * </li>
240         * <li>
241         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
242         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
243         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
244         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
245         * </li>
246         * <li>
247         * jakarta.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
248         * </li>
249         * <li>
250         * jakarta.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
251         * </li>
252         * </ul>
253         * <p>
254         * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally.
255         * This is generally the right thing to do.
256         * If your interceptor is providing an HTTP response rather than letting HAPI handle the response normally, you
257         * must return <code>false</code>. In this case, no further processing will occur and no further interceptors
258         * will be called.
259         * </p>
260         * <p>
261         * Hook methods may also throw {@link AuthenticationException} if they would like. This exception may be thrown
262         * to indicate that the interceptor has detected an unauthorized access
263         * attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client.
264         *
265         * @since 5.4.0
266         */
267        SERVER_INCOMING_REQUEST_PRE_HANDLER_SELECTED(
268                        boolean.class,
269                        "ca.uhn.fhir.rest.api.server.RequestDetails",
270                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
271                        "jakarta.servlet.http.HttpServletRequest",
272                        "jakarta.servlet.http.HttpServletResponse"),
273
274        /**
275         * <b>Server Hook:</b>
276         * This method is called just before the actual implementing server method is invoked.
277         * <p>
278         * Hooks may accept the following parameters:
279         * <ul>
280         * <li>
281         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
282         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
283         * pulled out of the servlet request. Note that the bean
284         * properties are not all guaranteed to be populated, depending on how early during processing the
285         * exception occurred.
286         * </li>
287         * <li>
288         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
289         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
290         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
291         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
292         * </li>
293         * <li>
294         * jakarta.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
295         * </li>
296         * <li>
297         * jakarta.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
298         * </li>
299         * </ul>
300         * <p>
301         * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally.
302         * This is generally the right thing to do.
303         * If your interceptor is providing an HTTP response rather than letting HAPI handle the response normally, you
304         * must return <code>false</code>. In this case, no further processing will occur and no further interceptors
305         * will be called.
306         * </p>
307         * <p>
308         * Hook methods may also throw {@link AuthenticationException} if they would like. This exception may be thrown
309         * to indicate that the interceptor has detected an unauthorized access
310         * attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client.
311         */
312        SERVER_INCOMING_REQUEST_POST_PROCESSED(
313                        boolean.class,
314                        "ca.uhn.fhir.rest.api.server.RequestDetails",
315                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
316                        "jakarta.servlet.http.HttpServletRequest",
317                        "jakarta.servlet.http.HttpServletResponse"),
318
319        /**
320         * <b>Server Hook:</b>
321         * This hook is invoked before an incoming request is processed. Note that this method is called
322         * after the server has begun preparing the response to the incoming client request.
323         * As such, it is not able to supply a response to the incoming request in the way that
324         * SERVER_INCOMING_REQUEST_PRE_PROCESSED and {@link #SERVER_INCOMING_REQUEST_POST_PROCESSED} are.
325         * At this point the request has already been passed to the handler so any changes
326         * (e.g. adding parameters) will not be considered.
327         * If you'd like to modify request parameters before they are passed to the handler,
328         * use {@link Pointcut#SERVER_INCOMING_REQUEST_PRE_HANDLER_SELECTED} or {@link Pointcut#SERVER_INCOMING_REQUEST_POST_PROCESSED}.
329         * If you are attempting to modify a search before it occurs, use {@link Pointcut#STORAGE_PRESEARCH_REGISTERED}.
330         * <p>
331         * Hooks may accept the following parameters:
332         * <ul>
333         * <li>
334         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
335         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
336         * pulled out of the servlet request. Note that the bean
337         * properties are not all guaranteed to be populated, depending on how early during processing the
338         * exception occurred.
339         * </li>
340         * <li>
341         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
342         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
343         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
344         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
345         * </li>
346         * <li>
347         * ca.uhn.fhir.rest.api.RestOperationTypeEnum - The type of operation that the FHIR server has determined that the client is trying to invoke
348         * </li>
349         * </ul>
350         * </p>
351         * <p>
352         * Hook methods must return <code>void</code>
353         * </p>
354         * <p>
355         * Hook methods method may throw a subclass of {@link BaseServerResponseException}, and processing
356         * will be aborted with an appropriate error returned to the client.
357         * </p>
358         */
359        SERVER_INCOMING_REQUEST_PRE_HANDLED(
360                        void.class,
361                        "ca.uhn.fhir.rest.api.server.RequestDetails",
362                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
363                        "ca.uhn.fhir.rest.api.RestOperationTypeEnum"),
364
365        /**
366         * <b>Server Hook:</b>
367         * This method is called when a resource provider method is registered and being bound
368         * by the HAPI FHIR Plain Server / RestfulServer.
369         * <p>
370         * Hooks may accept the following parameters:
371         * <ul>
372         * <li>
373         * ca.uhn.fhir.rest.server.method.BaseMethodBinding - The method binding.
374         * </li>
375         * </ul>
376         * <p>
377         * Hook methods  may modify the method binding, replace it, or return <code>null</code> to cancel the binding.
378         * </p>
379         */
380        SERVER_PROVIDER_METHOD_BOUND(
381                        "ca.uhn.fhir.rest.server.method.BaseMethodBinding", "ca.uhn.fhir.rest.server.method.BaseMethodBinding"),
382
383        /**
384         * <b>Server Hook:</b>
385         * This method is called upon any exception being thrown within the server's request processing code. This includes
386         * any exceptions thrown within resource provider methods (e.g. {@link Search} and {@link Read} methods) as well as
387         * any runtime exceptions thrown by the server itself. This hook method is invoked for each interceptor (until one of them
388         * returns a non-<code>null</code> response or the end of the list is reached), after which
389         * {@link #SERVER_HANDLE_EXCEPTION} is
390         * called for each interceptor.
391         * <p>
392         * This may be used to add an OperationOutcome to a response, or to convert between exception types for any reason.
393         * </p>
394         * <p>
395         * Implementations of this method may choose to ignore/log/count/etc exceptions, and return <code>null</code>. In
396         * this case, processing will continue, and the server will automatically generate an {@link BaseOperationOutcome
397         * OperationOutcome}. Implementations may also choose to provide their own response to the client. In this case, they
398         * should return a non-<code>null</code>, to indicate that they have handled the request and processing should stop.
399         * </p>
400         * <p>
401         * Hooks may accept the following parameters:
402         * <ul>
403         * <li>
404         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
405         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
406         * pulled out of the servlet request. Note that the bean
407         * properties are not all guaranteed to be populated, depending on how early during processing the
408         * exception occurred.
409         * </li>
410         * <li>
411         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
412         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
413         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
414         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
415         * </li>
416         * <li>
417         * java.lang.Throwable - The exception that was thrown. This will often be an instance of
418         * {@link BaseServerResponseException} but will not necessarily be one (e.g. it could be a
419         * {@link NullPointerException} in the case of a bug being triggered.
420         * </li>
421         * <li>
422         * jakarta.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
423         * </li>
424         * <li>
425         * jakarta.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
426         * </li>
427         * </ul>
428         * <p>
429         * Hook methods may return a new exception to use for processing, or <code>null</code> if this interceptor is not trying to
430         * modify the exception. For example, if this interceptor has nothing to do with exception processing, it
431         * should always return <code>null</code>. If this interceptor adds an OperationOutcome to the exception, it
432         * should return an exception.
433         * </p>
434         */
435        SERVER_PRE_PROCESS_OUTGOING_EXCEPTION(
436                        BaseServerResponseException.class,
437                        "ca.uhn.fhir.rest.api.server.RequestDetails",
438                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
439                        "java.lang.Throwable",
440                        "jakarta.servlet.http.HttpServletRequest",
441                        "jakarta.servlet.http.HttpServletResponse"),
442
443        /**
444         * <b>Server Hook:</b>
445         * This method is called after the server implementation method has been called, but before any attempt
446         * to stream the response back to the client. Interceptors may examine or modify the response before it
447         * is returned, or even prevent the response.
448         * <p>
449         * Hooks may accept the following parameters:
450         * <ul>
451         * <li>
452         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
453         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
454         * pulled out of the servlet request.
455         * </li>
456         * <li>
457         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
458         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
459         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
460         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
461         * </li>
462         * <li>
463         * org.hl7.fhir.instance.model.api.IBaseResource - The resource that will be returned. This parameter may be <code>null</code> for some responses.
464         * </li>
465         * <li>
466         * ca.uhn.fhir.rest.api.server.ResponseDetails - This object contains details about the response, including the contents. Hook methods may modify this object to change or replace the response.
467         * </li>
468         * <li>
469         * jakarta.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
470         * </li>
471         * <li>
472         * jakarta.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
473         * </li>
474         * </ul>
475         * </p>
476         * <p>
477         * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally.
478         * This is generally the right thing to do. If your interceptor is providing a response rather than
479         * letting HAPI handle the response normally, you must return <code>false</code>. In this case,
480         * no further processing will occur and no further interceptors will be called.
481         * </p>
482         * <p>
483         * Hook methods may also throw {@link AuthenticationException} to indicate that the interceptor
484         * has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401
485         * will be returned to the client.
486         */
487        SERVER_OUTGOING_RESPONSE(
488                        boolean.class,
489                        "ca.uhn.fhir.rest.api.server.RequestDetails",
490                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
491                        "org.hl7.fhir.instance.model.api.IBaseResource",
492                        "ca.uhn.fhir.rest.api.server.ResponseDetails",
493                        "jakarta.servlet.http.HttpServletRequest",
494                        "jakarta.servlet.http.HttpServletResponse"),
495
496        /**
497         * <b>Server Hook:</b>
498         * This method is called when a stream writer is generated that will be used to stream a non-binary response to
499         * a client. Hooks may return a wrapped writer which adds additional functionality as needed.
500         *
501         * <p>
502         * Hooks may accept the following parameters:
503         * <ul>
504         * <li>
505         * java.io.Writer - The response writing Writer. Typically a hook will wrap this writer and layer additional functionality
506         * into the wrapping writer.
507         * </li>
508         * <li>
509         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
510         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
511         * pulled out of the servlet request.
512         * </li>
513         * <li>
514         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
515         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
516         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
517         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
518         * </li>
519         * </ul>
520         * </p>
521         * <p>
522         * Hook methods should return a {@link Writer} instance that will be used to stream the response. Hook methods
523         * should not throw any exception.
524         * </p>
525         *
526         * @since 5.0.0
527         */
528        SERVER_OUTGOING_WRITER_CREATED(
529                        Writer.class,
530                        "java.io.Writer",
531                        "ca.uhn.fhir.rest.api.server.RequestDetails",
532                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
533
534        /**
535         * <b>Server Hook:</b>
536         * This method is called after the server implementation method has been called, but before any attempt
537         * to stream the response back to the client, specifically for GraphQL requests (as these do not fit
538         * cleanly into the model provided by {@link #SERVER_OUTGOING_RESPONSE}).
539         * <p>
540         * Hooks may accept the following parameters:
541         * <ul>
542         * <li>
543         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
544         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
545         * pulled out of the servlet request.
546         * </li>
547         * <li>
548         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
549         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
550         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
551         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
552         * </li>
553         * <li>
554         * java.lang.String - The GraphQL query
555         * </li>
556         * <li>
557         * java.lang.String - The GraphQL response
558         * </li>
559         * <li>
560         * jakarta.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
561         * </li>
562         * <li>
563         * jakarta.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
564         * </li>
565         * </ul>
566         * </p>
567         * <p>
568         * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally.
569         * This is generally the right thing to do. If your interceptor is providing a response rather than
570         * letting HAPI handle the response normally, you must return <code>false</code>. In this case,
571         * no further processing will occur and no further interceptors will be called.
572         * </p>
573         * <p>
574         * Hook methods may also throw {@link AuthenticationException} to indicate that the interceptor
575         * has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401
576         * will be returned to the client.
577         */
578        SERVER_OUTGOING_GRAPHQL_RESPONSE(
579                        boolean.class,
580                        "ca.uhn.fhir.rest.api.server.RequestDetails",
581                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
582                        "java.lang.String",
583                        "java.lang.String",
584                        "jakarta.servlet.http.HttpServletRequest",
585                        "jakarta.servlet.http.HttpServletResponse"),
586
587        /**
588         * <b>Server Hook:</b>
589         * This method is called when an OperationOutcome is being returned in response to a failure.
590         * Hook methods may use this hook to modify the OperationOutcome being returned.
591         * <p>
592         * Hooks may accept the following parameters:
593         * <ul>
594         * <li>
595         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
596         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
597         * pulled out of the servlet request. Note that the bean
598         * properties are not all guaranteed to be populated, depending on how early during processing the
599         * exception occurred.
600         * </li>
601         * <li>
602         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
603         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
604         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
605         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
606         * </li>
607         * <li>
608         * org.hl7.fhir.instance.model.api.IBaseOperationOutcome - The OperationOutcome resource that will be
609         * returned.
610         * </ul>
611         * <p>
612         * Hook methods must return <code>void</code>
613         * </p>
614         */
615        SERVER_OUTGOING_FAILURE_OPERATIONOUTCOME(
616                        void.class,
617                        "ca.uhn.fhir.rest.api.server.RequestDetails",
618                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
619                        "org.hl7.fhir.instance.model.api.IBaseOperationOutcome"),
620
621        /**
622         * <b>Server Hook:</b>
623         * This method is called after all processing is completed for a request, but only if the
624         * request completes normally (i.e. no exception is thrown).
625         * <p>
626         * This pointcut is called after the response has completely finished, meaning that the HTTP respsonse to the client
627         * may or may not have already completely been returned to the client by the time this pointcut is invoked. Use caution
628         * if you have timing-dependent logic, since there is no guarantee about whether the client will have already moved on
629         * by the time your method is invoked. If you need a guarantee that your method is invoked before returning to the
630         * client, consider using {@link #SERVER_OUTGOING_RESPONSE} instead.
631         * </p>
632         * <p>
633         * Hooks may accept the following parameters:
634         * <ul>
635         * <li>
636         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
637         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
638         * pulled out of the servlet request.
639         * </li>
640         * <li>
641         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
642         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
643         * pulled out of the request. This will be null if the server is not deployed to a RestfulServer environment.
644         * </li>
645         * </ul>
646         * </p>
647         * <p>
648         * This method must return <code>void</code>
649         * </p>
650         * <p>
651         * This method should not throw any exceptions. Any exception that is thrown by this
652         * method will be logged, but otherwise not acted upon (i.e. even if a hook method
653         * throws an exception, processing will continue and other interceptors will be
654         * called). Therefore it is considered a bug to throw an exception from hook methods using this
655         * pointcut.
656         * </p>
657         */
658        SERVER_PROCESSING_COMPLETED_NORMALLY(
659                        void.class,
660                        new ExceptionHandlingSpec().addLogAndSwallow(Throwable.class),
661                        "ca.uhn.fhir.rest.api.server.RequestDetails",
662                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
663
664        /**
665         * <b>Server Hook:</b>
666         * This method is called after all processing is completed for a request, regardless of whether
667         * the request completed successfully or not. It is called after {@link #SERVER_PROCESSING_COMPLETED_NORMALLY}
668         * in the case of successful operations.
669         * <p>
670         * Hooks may accept the following parameters:
671         * <ul>
672         * <li>
673         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
674         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
675         * pulled out of the servlet request.
676         * </li>
677         * <li>
678         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
679         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
680         * pulled out of the request. This will be null if the server is not deployed to a RestfulServer environment.
681         * </li>
682         * </ul>
683         * </p>
684         * <p>
685         * This method must return <code>void</code>
686         * </p>
687         * <p>
688         * This method should not throw any exceptions. Any exception that is thrown by this
689         * method will be logged, but otherwise not acted upon (i.e. even if a hook method
690         * throws an exception, processing will continue and other interceptors will be
691         * called). Therefore it is considered a bug to throw an exception from hook methods using this
692         * pointcut.
693         * </p>
694         */
695        SERVER_PROCESSING_COMPLETED(
696                        void.class,
697                        new ExceptionHandlingSpec().addLogAndSwallow(Throwable.class),
698                        "ca.uhn.fhir.rest.api.server.RequestDetails",
699                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
700
701        /**
702         * <b>Subscription Hook:</b>
703         * Invoked whenever a persisted resource has been modified and is being submitted to the
704         * subscription processing pipeline. This method is called before the resource is placed
705         * on any queues for processing and executes synchronously during the resource modification
706         * operation itself, so it should return quickly.
707         * <p>
708         * Hooks may accept the following parameters:
709         * <ul>
710         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - Hooks may modify this parameter. This will affect the checking process.</li>
711         * </ul>
712         * </p>
713         * <p>
714         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
715         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
716         * returns <code>false</code>, subscription processing will not proceed for the given resource;
717         * </p>
718         */
719        SUBSCRIPTION_RESOURCE_MODIFIED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
720
721        /**
722         * <b>Subscription Hook:</b>
723         * Invoked any time that a resource is matched by an individual subscription, and
724         * is about to be queued for delivery.
725         * <p>
726         * Hooks may make changes to the delivery payload, or make changes to the
727         * canonical subscription such as adding headers, modifying the channel
728         * endpoint, etc.
729         * </p>
730         * Hooks may accept the following parameters:
731         * <ul>
732         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
733         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
734         * <li>ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult</li>
735         * </ul>
736         * <p>
737         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
738         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
739         * returns <code>false</code>, delivery will be aborted.
740         * </p>
741         */
742        SUBSCRIPTION_RESOURCE_MATCHED(
743                        boolean.class,
744                        "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription",
745                        "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage",
746                        "ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult"),
747
748        /**
749         * <b>Subscription Hook:</b>
750         * Invoked whenever a persisted resource was checked against all active subscriptions, and did not
751         * match any.
752         * <p>
753         * Hooks may accept the following parameters:
754         * <ul>
755         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - Hooks should not modify this parameter as changes will not have any effect.</li>
756         * </ul>
757         * </p>
758         * <p>
759         * Hooks should return <code>void</code>.
760         * </p>
761         */
762        SUBSCRIPTION_RESOURCE_DID_NOT_MATCH_ANY_SUBSCRIPTIONS(
763                        void.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
764
765        /**
766         * <b>Subscription Hook:</b>
767         * Invoked immediately before the delivery of a subscription, and right before any channel-specific
768         * hooks are invoked (e.g. {@link #SUBSCRIPTION_BEFORE_REST_HOOK_DELIVERY}.
769         * <p>
770         * Hooks may make changes to the delivery payload, or make changes to the
771         * canonical subscription such as adding headers, modifying the channel
772         * endpoint, etc.
773         * </p>
774         * Hooks may accept the following parameters:
775         * <ul>
776         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
777         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
778         * </ul>
779         * <p>
780         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
781         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
782         * returns <code>false</code>, processing will be aborted.
783         * </p>
784         */
785        SUBSCRIPTION_BEFORE_DELIVERY(
786                        boolean.class,
787                        "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription",
788                        "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
789
790        /**
791         * <b>Subscription Hook:</b>
792         * Invoked immediately after the delivery of a subscription, and right before any channel-specific
793         * hooks are invoked (e.g. {@link #SUBSCRIPTION_AFTER_REST_HOOK_DELIVERY}.
794         * <p>
795         * Hooks may accept the following parameters:
796         * </p>
797         * <ul>
798         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
799         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
800         * </ul>
801         * <p>
802         * Hooks should return <code>void</code>.
803         * </p>
804         */
805        SUBSCRIPTION_AFTER_DELIVERY(
806                        void.class,
807                        "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription",
808                        "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
809
810        /**
811         * <b>Subscription Hook:</b>
812         * Invoked immediately after the attempted delivery of a subscription, if the delivery
813         * failed.
814         * <p>
815         * Hooks may accept the following parameters:
816         * </p>
817         * <ul>
818         * <li>java.lang.Exception - The exception that caused the failure.  Note this could be an exception thrown by a SUBSCRIPTION_BEFORE_DELIVERY or SUBSCRIPTION_AFTER_DELIVERY interceptor</li>
819         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage - the message that triggered the exception</li>
820         * <li>java.lang.Exception</li>
821         * </ul>
822         * <p>
823         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
824         * <code>void</code> or <code>true</code>, processing will continue normally, meaning that
825         * an exception will be thrown by the delivery mechanism. This typically means that the
826         * message will be returned to the processing queue. If the method
827         * returns <code>false</code>, processing will be aborted and no further action will be
828         * taken for the delivery.
829         * </p>
830         */
831        SUBSCRIPTION_AFTER_DELIVERY_FAILED(
832                        boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage", "java.lang.Exception"),
833
834        /**
835         * <b>Subscription Hook:</b>
836         * Invoked immediately after the delivery of a REST HOOK subscription.
837         * <p>
838         * When this hook is called, all processing is complete so this hook should not
839         * make any changes to the parameters.
840         * </p>
841         * Hooks may accept the following parameters:
842         * <ul>
843         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
844         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
845         * </ul>
846         * <p>
847         * Hooks should return <code>void</code>.
848         * </p>
849         */
850        SUBSCRIPTION_AFTER_REST_HOOK_DELIVERY(
851                        void.class,
852                        "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription",
853                        "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
854
855        /**
856         * <b>Subscription Hook:</b>
857         * Invoked immediately before the delivery of a REST HOOK subscription.
858         * <p>
859         * Hooks may make changes to the delivery payload, or make changes to the
860         * canonical subscription such as adding headers, modifying the channel
861         * endpoint, etc.
862         * </p>
863         * Hooks may accept the following parameters:
864         * <ul>
865         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
866         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
867         * </ul>
868         * <p>
869         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
870         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
871         * returns <code>false</code>, processing will be aborted.
872         * </p>
873         */
874        SUBSCRIPTION_BEFORE_REST_HOOK_DELIVERY(
875                        boolean.class,
876                        "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription",
877                        "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
878
879        /**
880         * <b>Subscription Hook:</b>
881         * Invoked immediately after the delivery of MESSAGE subscription.
882         * <p>
883         * When this hook is called, all processing is complete so this hook should not
884         * make any changes to the parameters.
885         * </p>
886         * Hooks may accept the following parameters:
887         * <ul>
888         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
889         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
890         * </ul>
891         * <p>
892         * Hooks should return <code>void</code>.
893         * </p>
894         */
895        SUBSCRIPTION_AFTER_MESSAGE_DELIVERY(
896                        void.class,
897                        "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription",
898                        "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
899
900        /**
901         * <b>Subscription Hook:</b>
902         * Invoked immediately before the delivery of a MESSAGE subscription.
903         * <p>
904         * Hooks may make changes to the delivery payload, or make changes to the
905         * canonical subscription such as adding headers, modifying the channel
906         * endpoint, etc.
907         * Furthermore, you may modify the outgoing message wrapper, for example adding headers via ResourceModifiedJsonMessage field.
908         * </p>
909         * Hooks may accept the following parameters:
910         * <ul>
911         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
912         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
913         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage</li>
914         *
915         * </ul>
916         * <p>
917         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
918         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
919         * returns <code>false</code>, processing will be aborted.
920         * </p>
921         */
922        SUBSCRIPTION_BEFORE_MESSAGE_DELIVERY(
923                        boolean.class,
924                        "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription",
925                        "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage",
926                        "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage"),
927
928        /**
929         * <b>Subscription Hook:</b>
930         * Invoked whenever a persisted resource (a resource that has just been stored in the
931         * database via a create/update/patch/etc.) is about to be checked for whether any subscriptions
932         * were triggered as a result of the operation.
933         * <p>
934         * Hooks may accept the following parameters:
935         * <ul>
936         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - Hooks may modify this parameter. This will affect the checking process.</li>
937         * </ul>
938         * </p>
939         * <p>
940         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
941         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
942         * returns <code>false</code>, processing will be aborted.
943         * </p>
944         */
945        SUBSCRIPTION_BEFORE_PERSISTED_RESOURCE_CHECKED(
946                        boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
947
948        /**
949         * <b>Subscription Hook:</b>
950         * Invoked whenever a persisted resource (a resource that has just been stored in the
951         * database via a create/update/patch/etc.) has been checked for whether any subscriptions
952         * were triggered as a result of the operation.
953         * <p>
954         * Hooks may accept the following parameters:
955         * <ul>
956         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - This parameter should not be modified as processing is complete when this hook is invoked.</li>
957         * </ul>
958         * </p>
959         * <p>
960         * Hooks should return <code>void</code>.
961         * </p>
962         */
963        SUBSCRIPTION_AFTER_PERSISTED_RESOURCE_CHECKED(
964                        void.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
965
966        /**
967         * <b>Subscription Hook:</b>
968         * Invoked immediately after an active subscription is "registered". In HAPI FHIR, when
969         * a subscription
970         * <p>
971         * Hooks may make changes to the canonicalized subscription and this will have an effect
972         * on processing across this server. Note however that timing issues may occur, since the
973         * subscription is already technically live by the time this hook is called.
974         * </p>
975         * Hooks may accept the following parameters:
976         * <ul>
977         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
978         * </ul>
979         * <p>
980         * Hooks should return <code>void</code>.
981         * </p>
982         */
983        SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_REGISTERED(
984                        void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription"),
985
986        /**
987         * <b>Subscription Hook:</b>
988         * Invoked immediately after an active subscription is "registered". In HAPI FHIR, when
989         * a subscription
990         * <p>
991         * Hooks may make changes to the canonicalized subscription and this will have an effect
992         * on processing across this server. Note however that timing issues may occur, since the
993         * subscription is already technically live by the time this hook is called.
994         * </p>
995         * No parameters are currently supported.
996         * <p>
997         * Hooks should return <code>void</code>.
998         * </p>
999         */
1000        SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_UNREGISTERED(void.class),
1001
1002        /**
1003         * <b>Storage Hook:</b>
1004         * Invoked when a resource is being deleted in a cascaded delete. This means that
1005         * some other resource is being deleted, but per use request or other
1006         * policy, the given resource (the one supplied as a parameter to this hook)
1007         * is also being deleted.
1008         * <p>
1009         * Hooks may accept the following parameters:
1010         * </p>
1011         * <ul>
1012         * <li>
1013         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1014         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1015         * pulled out of the servlet request. Note that the bean
1016         * properties are not all guaranteed to be populated, depending on how early during processing the
1017         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1018         * known, such as while processing searches</b>
1019         * </li>
1020         * <li>
1021         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1022         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1023         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1024         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1025         * </li>
1026         * <li>
1027         * ca.uhn.fhir.jpa.util.DeleteConflictList - Contains the details about the delete conflicts that are
1028         * being resolved via deletion. The source resource is the resource that will be deleted, and
1029         * is a cascade because the target resource is already being deleted.
1030         * </li>
1031         * <li>
1032         * org.hl7.fhir.instance.model.api.IBaseResource - The actual resource that is about to be deleted via a cascading delete
1033         * </li>
1034         * </ul>
1035         * <p>
1036         * Hooks should return <code>void</code>. They may choose to throw an exception however, in
1037         * which case the delete should be rolled back.
1038         * </p>
1039         */
1040        STORAGE_CASCADE_DELETE(
1041                        void.class,
1042                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1043                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1044                        "ca.uhn.fhir.jpa.api.model.DeleteConflictList",
1045                        "org.hl7.fhir.instance.model.api.IBaseResource"),
1046
1047        /**
1048         * <b>Subscription Topic Hook:</b>
1049         * Invoked whenever a persisted resource (a resource that has just been stored in the
1050         * database via a create/update/patch/etc.) is about to be checked for whether any subscription topics
1051         * were triggered as a result of the operation.
1052         * <p>
1053         * Hooks may accept the following parameters:
1054         * <ul>
1055         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - Hooks may modify this parameter. This will affect the checking process.</li>
1056         * </ul>
1057         * </p>
1058         * <p>
1059         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
1060         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
1061         * returns <code>false</code>, processing will be aborted.
1062         * </p>
1063         */
1064        SUBSCRIPTION_TOPIC_BEFORE_PERSISTED_RESOURCE_CHECKED(
1065                        boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
1066
1067        /**
1068         * <b>Subscription Topic Hook:</b>
1069         * Invoked whenever a persisted resource (a resource that has just been stored in the
1070         * database via a create/update/patch/etc.) has been checked for whether any subscription topics
1071         * were triggered as a result of the operation.
1072         * <p>
1073         * Hooks may accept the following parameters:
1074         * <ul>
1075         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - This parameter should not be modified as processing is complete when this hook is invoked.</li>
1076         * </ul>
1077         * </p>
1078         * <p>
1079         * Hooks should return <code>void</code>.
1080         * </p>
1081         */
1082        SUBSCRIPTION_TOPIC_AFTER_PERSISTED_RESOURCE_CHECKED(
1083                        void.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
1084
1085        /**
1086         * <b>Storage Hook:</b>
1087         * Invoked when a Bulk Export job is being kicked off, but before any permission checks
1088         * have been done.
1089         * This hook can be used to modify or update parameters as need be before
1090         * authorization/permission checks are done.
1091         * <p>
1092         * Hooks may accept the following parameters:
1093         * </p>
1094         * <ul>
1095         * <li>
1096         * ca.uhn.fhir.jpa.bulk.export.api.BulkDataExportOptions - The details of the job being kicked off
1097         * </li>
1098         * <li>
1099         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1100         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1101         * pulled out of the servlet request. Note that the bean
1102         * properties are not all guaranteed to be populated, depending on how early during processing the
1103         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1104         * known, such as while processing searches</b>
1105         * </li>
1106         * <li>
1107         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1108         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1109         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1110         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1111         * </li>
1112         * </ul>
1113         * <p>
1114         * Hooks should return <code>void</code>, and can throw exceptions.
1115         * </p>
1116         */
1117        STORAGE_PRE_INITIATE_BULK_EXPORT(
1118                        void.class,
1119                        "ca.uhn.fhir.rest.api.server.bulk.BulkExportJobParameters",
1120                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1121                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
1122
1123        /**
1124         * <b>Storage Hook:</b>
1125         * Invoked when a Bulk Export job is being kicked off. Hook methods may modify
1126         * the request, or raise an exception to prevent it from being initiated.
1127         * This hook is not guaranteed to be called before permission checks, and so
1128         * anu implementers should be cautious of changing the options in ways that would
1129         * affect permissions.
1130         * <p>
1131         * Hooks may accept the following parameters:
1132         * </p>
1133         * <ul>
1134         * <li>
1135         * ca.uhn.fhir.jpa.bulk.export.api.BulkDataExportOptions - The details of the job being kicked off
1136         * </li>
1137         * <li>
1138         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1139         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1140         * pulled out of the servlet request. Note that the bean
1141         * properties are not all guaranteed to be populated, depending on how early during processing the
1142         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1143         * known, such as while processing searches</b>
1144         * </li>
1145         * <li>
1146         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1147         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1148         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1149         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1150         * </li>
1151         * </ul>
1152         * <p>
1153         * Hooks should return <code>void</code>, and can throw exceptions.
1154         * </p>
1155         */
1156        STORAGE_INITIATE_BULK_EXPORT(
1157                        void.class,
1158                        "ca.uhn.fhir.rest.api.server.bulk.BulkExportJobParameters",
1159                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1160                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
1161
1162        /**
1163         * <b>Storage Hook:</b>
1164         * Invoked when a Bulk Export job is being processed. If any hook method is registered
1165         * for this pointcut, the hook method will be called once for each resource that is
1166         * loaded for inclusion in a bulk export file. Hook methods may modify
1167         * the resource object and this modification will affect the copy that is stored in the
1168         * bulk export data file (but will not affect the original). Hook methods may also
1169         * return <code>false</code> in order to request that the resource be filtered
1170         * from the export.
1171         * <p>
1172         * Hooks may accept the following parameters:
1173         * </p>
1174         * <ul>
1175         * <li>
1176         * ca.uhn.fhir.rest.api.server.bulk.BulkExportJobParameters - The details of the job being kicked off
1177         * </li>
1178         * <li>
1179         *org.hl7.fhir.instance.model.api.IBaseResource - The resource that will be included in the file
1180         * </li>
1181         * </ul>
1182         * <p>
1183         * Hooks methods may return <code>false</code> to indicate that the resource should be
1184         * filtered out. Otherwise, hook methods should return <code>true</code>.
1185         * </p>
1186         *
1187         * @since 6.8.0
1188         */
1189        STORAGE_BULK_EXPORT_RESOURCE_INCLUSION(
1190                        boolean.class,
1191                        "ca.uhn.fhir.rest.api.server.bulk.BulkExportJobParameters",
1192                        "org.hl7.fhir.instance.model.api.IBaseResource"),
1193
1194        /**
1195         * <b>Storage Hook:</b>
1196         * Invoked when a set of resources are about to be deleted and expunged via url like {@code http://localhost/Patient?active=false&_expunge=true}.
1197         * <p>
1198         * Hooks may accept the following parameters:
1199         * </p>
1200         * <ul>
1201         * <li>
1202         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1203         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1204         * pulled out of the servlet request. Note that the bean
1205         * properties are not all guaranteed to be populated, depending on how early during processing the
1206         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1207         * known, such as while processing searches</b>
1208         * </li>
1209         * <li>
1210         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1211         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1212         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1213         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1214         * </li>
1215         * <li>
1216         * java.lang.String - Contains the url used to delete and expunge the resources
1217         * </li>
1218         * </ul>
1219         * <p>
1220         * Hooks should return <code>void</code>. They may choose to throw an exception however, in
1221         * which case the delete expunge will not occur.
1222         * </p>
1223         */
1224        STORAGE_PRE_DELETE_EXPUNGE(
1225                        void.class,
1226                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1227                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1228                        "java.lang.String"),
1229
1230        /**
1231         * <b>Storage Hook:</b>
1232         * Invoked when a batch of resource pids are about to be deleted and expunged via url like {@code http://localhost/Patient?active=false&_expunge=true}.
1233         * <p>
1234         * Hooks may accept the following parameters:
1235         * </p>
1236         * <ul>
1237         * <li>
1238         * java.lang.String - the name of the resource type being deleted
1239         * </li>
1240         * <li>
1241         * java.util.List - the list of Long pids of the resources about to be deleted
1242         * </li>
1243         * <li>
1244         * java.util.concurrent.atomic.AtomicLong - holds a running tally of all entities deleted so far.
1245         * If the pointcut callback deletes any entities, then this parameter should be incremented by the total number
1246         * of additional entities deleted.
1247         * </li>
1248         * <li>
1249         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1250         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1251         * pulled out of the servlet request. Note that the bean
1252         * properties are not all guaranteed to be populated, depending on how early during processing the
1253         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1254         * known, such as while processing searches</b>
1255         * </li>
1256         * <li>
1257         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1258         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1259         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1260         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1261         * </li>
1262         * <li>
1263         * java.lang.String - Contains the url used to delete and expunge the resources
1264         * </li>
1265         * </ul>
1266         * <p>
1267         * Hooks should return <code>void</code>. They may choose to throw an exception however, in
1268         * which case the delete expunge will not occur.
1269         * </p>
1270         */
1271        STORAGE_PRE_DELETE_EXPUNGE_PID_LIST(
1272                        void.class,
1273                        "java.lang.String",
1274                        "java.util.List",
1275                        "java.util.concurrent.atomic.AtomicLong",
1276                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1277                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
1278
1279        /**
1280         * <b>Storage Hook:</b>
1281         * Invoked when one or more resources may be returned to the user, whether as a part of a READ,
1282         * a SEARCH, or even as the response to a CREATE/UPDATE, etc.
1283         * <p>
1284         * This hook is invoked when a resource has been loaded by the storage engine and
1285         * is being returned to the HTTP stack for response. This is not a guarantee that the
1286         * client will ultimately see it, since filters/headers/etc may affect what
1287         * is returned but if a resource is loaded it is likely to be used.
1288         * Note also that caching may affect whether this pointcut is invoked.
1289         * </p>
1290         * <p>
1291         * Hooks will have access to the contents of the resource being returned
1292         * and may choose to make modifications. These changes will be reflected in
1293         * returned resource but have no effect on storage.
1294         * </p>
1295         * Hooks may accept the following parameters:
1296         * <ul>
1297         * <li>
1298         * ca.uhn.fhir.rest.api.server.IPreResourceAccessDetails - Contains details about the
1299         * specific resources being returned.
1300         * </li>
1301         * <li>
1302         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1303         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1304         * pulled out of the servlet request. Note that the bean
1305         * properties are not all guaranteed to be populated, depending on how early during processing the
1306         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1307         * known, such as while processing searches</b>
1308         * </li>
1309         * <li>
1310         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1311         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1312         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1313         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1314         * </li>
1315         * </ul>
1316         * <p>
1317         * Hooks should return <code>void</code>.
1318         * </p>
1319         */
1320        STORAGE_PREACCESS_RESOURCES(
1321                        void.class,
1322                        "ca.uhn.fhir.rest.api.server.IPreResourceAccessDetails",
1323                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1324                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
1325
1326        /**
1327         * <b>Storage Hook:</b>
1328         * Invoked when the storage engine is about to check for the existence of a pre-cached search
1329         * whose results match the given search parameters.
1330         * <p>
1331         * Hooks may accept the following parameters:
1332         * </p>
1333         * <ul>
1334         * <li>
1335         * ca.uhn.fhir.jpa.searchparam.SearchParameterMap - Contains the details of the search being checked
1336         * </li>
1337         * <li>
1338         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1339         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1340         * pulled out of the servlet request. Note that the bean
1341         * properties are not all guaranteed to be populated, depending on how early during processing the
1342         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1343         * known, such as while processing searches</b>
1344         * </li>
1345         * <li>
1346         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1347         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1348         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1349         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1350         * </li>
1351         * </ul>
1352         * <p>
1353         * Hooks may return <code>boolean</code>. If the hook method returns
1354         * <code>false</code>, the server will not attempt to check for a cached
1355         * search no matter what.
1356         * </p>
1357         */
1358        STORAGE_PRECHECK_FOR_CACHED_SEARCH(
1359                        boolean.class,
1360                        "ca.uhn.fhir.jpa.searchparam.SearchParameterMap",
1361                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1362                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
1363
1364        /**
1365         * <b>Storage Hook:</b>
1366         * Invoked when a search is starting, prior to creating a record for the search.
1367         * <p>
1368         * Hooks may accept the following parameters:
1369         * </p>
1370         * <ul>
1371         * <li>
1372         * ca.uhn.fhir.rest.server.util.ICachedSearchDetails - Contains the details of the search that
1373         * is being created and initialized. Interceptors may use this parameter to modify aspects of the search
1374         * before it is stored and executed.
1375         * </li>
1376         * <li>
1377         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1378         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1379         * pulled out of the servlet request. Note that the bean
1380         * properties are not all guaranteed to be populated, depending on how early during processing the
1381         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1382         * known, such as while processing searches</b>
1383         * </li>
1384         * <li>
1385         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1386         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1387         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1388         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1389         * </li>
1390         * <li>
1391         * ca.uhn.fhir.jpa.searchparam.SearchParameterMap - Contains the details of the search being checked. This can be modified.
1392         * </li>
1393         * <li>
1394         * ca.uhn.fhir.interceptor.model.RequestPartitionId - The partition associated with the request (or {@literal null} if the server is not partitioned)
1395         * </li>
1396         * </ul>
1397         * <p>
1398         * Hooks should return <code>void</code>.
1399         * </p>
1400         */
1401        STORAGE_PRESEARCH_REGISTERED(
1402                        void.class,
1403                        "ca.uhn.fhir.rest.server.util.ICachedSearchDetails",
1404                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1405                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1406                        "ca.uhn.fhir.jpa.searchparam.SearchParameterMap",
1407                        "ca.uhn.fhir.interceptor.model.RequestPartitionId"),
1408
1409        /**
1410         * <b>Storage Hook:</b>
1411         * Invoked when one or more resources may be returned to the user, whether as a part of a READ,
1412         * a SEARCH, or even as the response to a CREATE/UPDATE, etc.
1413         * <p>
1414         * This hook is invoked when a resource has been loaded by the storage engine and
1415         * is being returned to the HTTP stack for response.
1416         * This is not a guarantee that the
1417         * client will ultimately see it, since filters/headers/etc may affect what
1418         * is returned but if a resource is loaded it is likely to be used.
1419         * Note also that caching may affect whether this pointcut is invoked.
1420         * </p>
1421         * <p>
1422         * Hooks will have access to the contents of the resource being returned
1423         * and may choose to make modifications. These changes will be reflected in
1424         * returned resource but have no effect on storage.
1425         * </p>
1426         * Hooks may accept the following parameters:
1427         * <ul>
1428         * <li>
1429         * ca.uhn.fhir.rest.api.server.IPreResourceShowDetails - Contains the resources that
1430         * will be shown to the user. This object may be manipulated in order to modify
1431         * the actual resources being shown to the user (e.g. for masking)
1432         * </li>
1433         * <li>
1434         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1435         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1436         * pulled out of the servlet request. Note that the bean
1437         * properties are not all guaranteed to be populated, depending on how early during processing the
1438         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1439         * known, such as while processing searches</b>
1440         * </li>
1441         * <li>
1442         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1443         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1444         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1445         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1446         * </li>
1447         * </ul>
1448         * <p>
1449         * Hooks should return <code>void</code>.
1450         * </p>
1451         */
1452        STORAGE_PRESHOW_RESOURCES(
1453                        void.class,
1454                        "ca.uhn.fhir.rest.api.server.IPreResourceShowDetails",
1455                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1456                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
1457
1458        /**
1459         * <b>Storage Hook:</b>
1460         * Invoked before a resource will be created, immediately before the resource
1461         * is persisted to the database.
1462         * <p>
1463         * Hooks will have access to the contents of the resource being created
1464         * and may choose to make modifications to it. These changes will be
1465         * reflected in permanent storage.
1466         * </p>
1467         * Hooks may accept the following parameters:
1468         * <ul>
1469         * <li>org.hl7.fhir.instance.model.api.IBaseResource</li>
1470         * <li>
1471         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1472         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1473         * pulled out of the servlet request. Note that the bean
1474         * properties are not all guaranteed to be populated, depending on how early during processing the
1475         * exception occurred.
1476         * </li>
1477         * <li>
1478         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1479         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1480         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1481         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1482         * </li>
1483         * <li>
1484         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1485         * </li>
1486         * </ul>
1487         * <p>
1488         * Hooks should return <code>void</code>.
1489         * </p>
1490         */
1491        STORAGE_PRESTORAGE_RESOURCE_CREATED(
1492                        void.class,
1493                        "org.hl7.fhir.instance.model.api.IBaseResource",
1494                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1495                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1496                        "ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
1497                        "ca.uhn.fhir.interceptor.model.RequestPartitionId"),
1498
1499        /**
1500         * <b>Storage Hook:</b>
1501         * Invoked before client-assigned id is created.
1502         * <p>
1503         * Hooks will have access to the contents of the resource being created
1504         * so that client-assigned ids can be allowed/denied. These changes will
1505         * be reflected in permanent storage.
1506         * </p>
1507         * Hooks may accept the following parameters:
1508         * <ul>
1509         * <li>org.hl7.fhir.instance.model.api.IBaseResource</li>
1510         * <li>
1511         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1512         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1513         * pulled out of the servlet request. Note that the bean
1514         * properties are not all guaranteed to be populated, depending on how early during processing the
1515         * exception occurred.
1516         * </li>
1517         * </ul>
1518         * <p>
1519         * Hooks should return <code>void</code>.
1520         * </p>
1521         */
1522        STORAGE_PRESTORAGE_CLIENT_ASSIGNED_ID(
1523                        void.class, "org.hl7.fhir.instance.model.api.IBaseResource", "ca.uhn.fhir.rest.api.server.RequestDetails"),
1524
1525        /**
1526         * <b>Storage Hook:</b>
1527         * Invoked before a resource will be updated, immediately before the resource
1528         * is persisted to the database.
1529         * <p>
1530         * Hooks will have access to the contents of the resource being updated
1531         * (both the previous and new contents) and may choose to make modifications
1532         * to the new contents of the resource. These changes will be reflected in
1533         * permanent storage.
1534         * </p>
1535         * <p>
1536         * <b>NO-OPS:</b> If the client has submitted an update that does not actually make any changes
1537         * (i.e. the resource they include in the PUT body is identical to the content that
1538         * was already stored) the server may choose to ignore the update and perform
1539         * a "NO-OP". In this case, this pointcut is still invoked, but {@link #STORAGE_PRECOMMIT_RESOURCE_UPDATED}
1540         * will not be. Hook methods for this pointcut may make changes to the new contents of the
1541         * resource being updated, and in this case the NO-OP will be cancelled and
1542         * {@link #STORAGE_PRECOMMIT_RESOURCE_UPDATED} will also be invoked.
1543         * </p>
1544         * Hooks may accept the following parameters:
1545         * <ul>
1546         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The previous contents of the resource being updated</li>
1547         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The new contents of the resource being updated</li>
1548         * <li>
1549         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1550         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1551         * pulled out of the servlet request. Note that the bean
1552         * properties are not all guaranteed to be populated, depending on how early during processing the
1553         * exception occurred.
1554         * </li>
1555         * <li>
1556         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1557         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1558         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1559         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1560         * </li>
1561         * <li>
1562         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1563         * </li>
1564         * </ul>
1565         * <p>
1566         * Hooks should return <code>void</code>.
1567         * </p>
1568         */
1569        STORAGE_PRESTORAGE_RESOURCE_UPDATED(
1570                        void.class,
1571                        "org.hl7.fhir.instance.model.api.IBaseResource",
1572                        "org.hl7.fhir.instance.model.api.IBaseResource",
1573                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1574                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1575                        "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"),
1576
1577        /**
1578         * <b>Storage Hook:</b>
1579         * Invoked before a resource will be created, immediately before the resource
1580         * is persisted to the database.
1581         * <p>
1582         * Hooks will have access to the contents of the resource being created
1583         * and may choose to make modifications to it. These changes will be
1584         * reflected in permanent storage.
1585         * </p>
1586         * Hooks may accept the following parameters:
1587         * <ul>
1588         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li>
1589         * <li>
1590         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1591         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1592         * pulled out of the servlet request. Note that the bean
1593         * properties are not all guaranteed to be populated, depending on how early during processing the
1594         * exception occurred.
1595         * </li>
1596         * <li>
1597         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1598         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1599         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1600         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1601         * </li>
1602         * <li>
1603         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1604         * </li>
1605         * </ul>
1606         * <p>
1607         * Hooks should return <code>void</code>.
1608         * </p>
1609         */
1610        STORAGE_PRESTORAGE_RESOURCE_DELETED(
1611                        void.class,
1612                        "org.hl7.fhir.instance.model.api.IBaseResource",
1613                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1614                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1615                        "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"),
1616
1617        /**
1618         * <b>Storage Hook:</b>
1619         * Invoked before a resource will be created, immediately before the transaction
1620         * is committed (after all validation and other business rules have successfully
1621         * completed, and any other database activity is complete.
1622         * <p>
1623         * Hooks will have access to the contents of the resource being created
1624         * but should generally not make any
1625         * changes as storage has already occurred. Changes will not be reflected
1626         * in storage, but may be reflected in the HTTP response.
1627         * </p>
1628         * Hooks may accept the following parameters:
1629         * <ul>
1630         * <li>org.hl7.fhir.instance.model.api.IBaseResource</li>
1631         * <li>
1632         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1633         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1634         * pulled out of the servlet request. Note that the bean
1635         * properties are not all guaranteed to be populated, depending on how early during processing the
1636         * exception occurred.
1637         * </li>
1638         * <li>
1639         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1640         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1641         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1642         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1643         * </li>
1644         * <li>
1645         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1646         * </li>
1647         * <li>
1648         * Boolean - Whether this pointcut invocation was deferred or not(since 5.4.0)
1649         * </li>
1650         * <li>
1651         * ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum - The timing at which the invocation of the interceptor took place. Options are ACTIVE and DEFERRED.
1652         * </li>
1653         * </ul>
1654         * <p>
1655         * Hooks should return <code>void</code>.
1656         * </p>
1657         */
1658        STORAGE_PRECOMMIT_RESOURCE_CREATED(
1659                        void.class,
1660                        "org.hl7.fhir.instance.model.api.IBaseResource",
1661                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1662                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1663                        "ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
1664                        "ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum"),
1665
1666        /**
1667         * <b>Storage Hook:</b>
1668         * Invoked before a resource will be updated, immediately before the transaction
1669         * is committed (after all validation and other business rules have successfully
1670         * completed, and any other database activity is complete.
1671         * <p>
1672         * Hooks will have access to the contents of the resource being updated
1673         * (both the previous and new contents) but should generally not make any
1674         * changes as storage has already occurred. Changes will not be reflected
1675         * in storage, but may be reflected in the HTTP response.
1676         * </p>
1677         * <p>
1678         * NO-OP note: See {@link #STORAGE_PRESTORAGE_RESOURCE_UPDATED} for a note on
1679         * no-op updates when no changes are detected.
1680         * </p>
1681         * Hooks may accept the following parameters:
1682         * <ul>
1683         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The previous contents of the resource</li>
1684         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The proposed new contents of the resource</li>
1685         * <li>
1686         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1687         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1688         * pulled out of the servlet request. Note that the bean
1689         * properties are not all guaranteed to be populated, depending on how early during processing the
1690         * exception occurred.
1691         * </li>
1692         * <li>
1693         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1694         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1695         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1696         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1697         * </li>
1698         * <li>
1699         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1700         * </li>
1701         * <li>
1702         * ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum - The timing at which the invocation of the interceptor took place. Options are ACTIVE and DEFERRED.
1703         * </li>
1704         * </ul>
1705         * <p>
1706         * Hooks should return <code>void</code>.
1707         * </p>
1708         */
1709        STORAGE_PRECOMMIT_RESOURCE_UPDATED(
1710                        void.class,
1711                        "org.hl7.fhir.instance.model.api.IBaseResource",
1712                        "org.hl7.fhir.instance.model.api.IBaseResource",
1713                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1714                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1715                        "ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
1716                        "ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum"),
1717
1718        /**
1719         * <b>Storage Hook:</b>
1720         * Invoked before a resource will be deleted
1721         * <p>
1722         * Hooks will have access to the contents of the resource being deleted
1723         * but should not make any changes as storage has already occurred
1724         * </p>
1725         * Hooks may accept the following parameters:
1726         * <ul>
1727         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li>
1728         * <li>
1729         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1730         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1731         * pulled out of the servlet request. Note that the bean
1732         * properties are not all guaranteed to be populated, depending on how early during processing the
1733         * exception occurred.
1734         * </li>
1735         * <li>
1736         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1737         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1738         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1739         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1740         * </li>
1741         * <li>
1742         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1743         * </li>
1744         * <li>
1745         * ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum - The timing at which the invocation of the interceptor took place. Options are ACTIVE and DEFERRED.
1746         * </li>
1747         * </ul>
1748         * <p>
1749         * Hooks should return <code>void</code>.
1750         * </p>
1751         */
1752        STORAGE_PRECOMMIT_RESOURCE_DELETED(
1753                        void.class,
1754                        "org.hl7.fhir.instance.model.api.IBaseResource",
1755                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1756                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1757                        "ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
1758                        "ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum"),
1759
1760        /**
1761         * <b>Storage Hook:</b>
1762         * Invoked when a FHIR transaction bundle is about to begin processing. Hooks may choose to
1763         * modify the bundle, and may affect processing by doing so.
1764         * <p>
1765         * Hooks will have access to the original bundle, as well as all the deferred interceptor broadcasts related to the
1766         * processing of the transaction bundle
1767         * </p>
1768         * Hooks may accept the following parameters:
1769         * <ul>
1770         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li>
1771         * <li>
1772         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1773         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1774         * pulled out of the servlet request.
1775         * </li>
1776         * <li>
1777         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1778         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1779         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1780         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1781         * </li>
1782         * </ul>
1783         * <p>
1784         * Hooks should return <code>void</code>.
1785         * </p>
1786         *
1787         * @see #STORAGE_TRANSACTION_PROCESSED
1788         * @since 6.2.0
1789         */
1790        STORAGE_TRANSACTION_PROCESSING(
1791                        void.class,
1792                        "org.hl7.fhir.instance.model.api.IBaseBundle",
1793                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1794                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
1795
1796        /**
1797         * <b>Storage Hook:</b>
1798         * Invoked after all entries in a transaction bundle have been executed
1799         * <p>
1800         * Hooks will have access to the original bundle, as well as all the deferred interceptor broadcasts related to the
1801         * processing of the transaction bundle
1802         * </p>
1803         * Hooks may accept the following parameters:
1804         * <ul>
1805         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li>
1806         * <li>
1807         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1808         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1809         * pulled out of the servlet request.
1810         * </li>
1811         * <li>
1812         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1813         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1814         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1815         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1816         * </li>
1817         * <li>
1818         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1819         * </li>
1820         * <li>
1821         * ca.uhn.fhir.rest.api.server.storage.DeferredInterceptorBroadcasts- A collection of pointcut invocations and their parameters which were deferred.
1822         * </li>
1823         * </ul>
1824         * <p>
1825         * Hooks should return <code>void</code>.
1826         * </p>
1827         *
1828         * @see #STORAGE_TRANSACTION_PROCESSING
1829         */
1830        STORAGE_TRANSACTION_PROCESSED(
1831                        void.class,
1832                        "org.hl7.fhir.instance.model.api.IBaseBundle",
1833                        "ca.uhn.fhir.rest.api.server.storage.DeferredInterceptorBroadcasts",
1834                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1835                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1836                        "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"),
1837
1838        /**
1839         * <b>Storage Hook:</b>
1840         * Invoked during a FHIR transaction, immediately before processing all write operations (i.e. immediately
1841         * before a database transaction will be opened)
1842         * <p>
1843         * Hooks may accept the following parameters:
1844         * </p>
1845         * <ul>
1846         * <li>
1847         * ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails - Contains details about the transaction that is about to start
1848         * </li>
1849         * <li>
1850         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1851         * </li>
1852         * </ul>
1853         * <p>
1854         * Hooks should return <code>void</code>.
1855         * </p>
1856         */
1857        STORAGE_TRANSACTION_WRITE_OPERATIONS_PRE(
1858                        void.class,
1859                        "ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails",
1860                        "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"),
1861
1862        /**
1863         * <b>Storage Hook:</b>
1864         * Invoked during a FHIR transaction, immediately after processing all write operations (i.e. immediately
1865         * after the transaction has been committed or rolled back). This hook will always be called if
1866         * {@link #STORAGE_TRANSACTION_WRITE_OPERATIONS_PRE} has been called, regardless of whether the operation
1867         * succeeded or failed.
1868         * <p>
1869         * Hooks may accept the following parameters:
1870         * </p>
1871         * <ul>
1872         * <li>
1873         * ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails - Contains details about the transaction that is about to start
1874         * </li>
1875         * <li>
1876         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1877         * </li>
1878         * </ul>
1879         * <p>
1880         * Hooks should return <code>void</code>.
1881         * </p>
1882         */
1883        STORAGE_TRANSACTION_WRITE_OPERATIONS_POST(
1884                        void.class,
1885                        "ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails",
1886                        "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"),
1887
1888        /**
1889         * <b>Storage Hook:</b>
1890         * Invoked when a resource delete operation is about to fail due to referential integrity checks. Intended for use with {@literal ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor}.
1891         * <p>
1892         * Hooks will have access to the list of resources that have references to the resource being deleted.
1893         * </p>
1894         * Hooks may accept the following parameters:
1895         * <ul>
1896         * <li>ca.uhn.fhir.jpa.api.model.DeleteConflictList - The list of delete conflicts</li>
1897         * <li>
1898         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1899         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1900         * pulled out of the servlet request. Note that the bean
1901         * properties are not all guaranteed to be populated, depending on how early during processing the
1902         * exception occurred.
1903         * </li>
1904         * <li>
1905         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1906         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1907         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1908         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1909         * </li>
1910         * <li>
1911         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1912         * </li>
1913         * </ul>
1914         * <p>
1915         * Hooks should return <code>ca.uhn.fhir.jpa.delete.DeleteConflictOutcome</code>.
1916         * If the interceptor returns a non-null result, the DeleteConflictOutcome can be
1917         * used to indicate a number of times to retry.
1918         * </p>
1919         */
1920        STORAGE_PRESTORAGE_DELETE_CONFLICTS(
1921                        // Return type
1922                        "ca.uhn.fhir.jpa.delete.DeleteConflictOutcome",
1923                        // Params
1924                        "ca.uhn.fhir.jpa.api.model.DeleteConflictList",
1925                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1926                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1927                        "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"),
1928
1929        /**
1930         * <b>Storage Hook:</b>
1931         * Invoked before a resource is about to be expunged via the <code>$expunge</code> operation.
1932         * <p>
1933         * Hooks will be passed a reference to a counter containing the current number of records that have been deleted.
1934         * If the hook deletes any records, the hook is expected to increment this counter by the number of records deleted.
1935         * </p>
1936         * <p>
1937         * Hooks may accept the following parameters:
1938         * </p>
1939         * <ul>
1940         * <li>java.util.concurrent.atomic.AtomicInteger - The counter holding the number of records deleted.</li>
1941         * <li>org.hl7.fhir.instance.model.api.IIdType - The ID of the resource that is about to be deleted</li>
1942         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource that is about to be deleted</li>
1943         * <li>
1944         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1945         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1946         * pulled out of the servlet request. Note that the bean
1947         * properties are not all guaranteed to be populated, depending on how early during processing the
1948         * exception occurred.
1949         * </li>
1950         * <li>
1951         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1952         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1953         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1954         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1955         * </li>
1956         * </ul>
1957         * <p>
1958         * Hooks should return void.
1959         * </p>
1960         */
1961        STORAGE_PRESTORAGE_EXPUNGE_RESOURCE(
1962                        // Return type
1963                        void.class,
1964                        // Params
1965                        "java.util.concurrent.atomic.AtomicInteger",
1966                        "org.hl7.fhir.instance.model.api.IIdType",
1967                        "org.hl7.fhir.instance.model.api.IBaseResource",
1968                        "ca.uhn.fhir.rest.api.server.RequestDetails",
1969                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
1970
1971        /**
1972         * <b>Storage Hook:</b>
1973         * Invoked before an <code>$expunge</code> operation on all data (expungeEverything) is called.
1974         * <p>
1975         * Hooks will be passed a reference to a counter containing the current number of records that have been deleted.
1976         * If the hook deletes any records, the hook is expected to increment this counter by the number of records deleted.
1977         * </p>
1978         * Hooks may accept the following parameters:
1979         * <ul>
1980         * <li>java.util.concurrent.atomic.AtomicInteger - The counter holding the number of records deleted.</li>
1981         * <li>
1982         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1983         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1984         * pulled out of the servlet request. Note that the bean
1985         * properties are not all guaranteed to be populated, depending on how early during processing the
1986         * exception occurred.
1987         * </li>
1988         * <li>
1989         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1990         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1991         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1992         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1993         * </li>
1994         * </ul>
1995         * <p>
1996         * Hooks should return void.
1997         * </p>
1998         */
1999        STORAGE_PRESTORAGE_EXPUNGE_EVERYTHING(
2000                        // Return type
2001                        void.class,
2002                        // Params
2003                        "java.util.concurrent.atomic.AtomicInteger",
2004                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2005                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
2006
2007        /**
2008         * <b>Storage Hook:</b>
2009         * Invoked before FHIR <b>create</b> operation to request the identification of the partition ID to be associated
2010         * with the resource being created. This hook will only be called if partitioning is enabled in the JPA
2011         * server.
2012         * <p>
2013         * Hooks may accept the following parameters:
2014         * </p>
2015         * <ul>
2016         * <li>
2017         * org.hl7.fhir.instance.model.api.IBaseResource - The resource that will be created and needs a tenant ID assigned.
2018         * </li>
2019         * <li>
2020         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2021         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2022         * pulled out of the servlet request. Note that the bean
2023         * properties are not all guaranteed to be populated, depending on how early during processing the
2024         * exception occurred.
2025         * </li>
2026         * <li>
2027         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2028         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2029         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2030         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2031         * </li>
2032         * </ul>
2033         * <p>
2034         * Hooks must return an instance of <code>ca.uhn.fhir.interceptor.model.RequestPartitionId</code>.
2035         * </p>
2036         *
2037         * @see #STORAGE_PARTITION_IDENTIFY_ANY For an alternative that is not read/write specific
2038         */
2039        STORAGE_PARTITION_IDENTIFY_CREATE(
2040                        // Return type
2041                        "ca.uhn.fhir.interceptor.model.RequestPartitionId",
2042                        // Params
2043                        "org.hl7.fhir.instance.model.api.IBaseResource",
2044                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2045                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
2046
2047        /**
2048         * <b>Storage Hook:</b>
2049         * Invoked before any FHIR read/access/extended operation (e.g. <b>read/vread</b>, <b>search</b>, <b>history</b>,
2050         * <b>$reindex</b>, etc.) operation to request the identification of the partition ID to be associated with
2051         * the resource(s) being searched for, read, etc. Essentially any operations in the JPA server that are not
2052         * creating a resource will use this pointcut. Creates will use {@link #STORAGE_PARTITION_IDENTIFY_CREATE}.
2053         *
2054         * <p>
2055         * This hook will only be called if
2056         * partitioning is enabled in the JPA server.
2057         * </p>
2058         * <p>
2059         * Hooks may accept the following parameters:
2060         * </p>
2061         * <ul>
2062         * <li>
2063         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2064         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2065         * pulled out of the servlet request. Note that the bean
2066         * properties are not all guaranteed to be populated, depending on how early during processing the
2067         * exception occurred.
2068         * </li>
2069         * <li>
2070         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2071         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2072         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2073         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2074         * </li>
2075         * <li>ca.uhn.fhir.interceptor.model.ReadPartitionIdRequestDetails - Contains details about what is being read</li>
2076         * </ul>
2077         * <p>
2078         * Hooks must return an instance of <code>ca.uhn.fhir.interceptor.model.RequestPartitionId</code>.
2079         * </p>
2080         *
2081         * @see #STORAGE_PARTITION_IDENTIFY_ANY For an alternative that is not read/write specific
2082         */
2083        STORAGE_PARTITION_IDENTIFY_READ(
2084                        // Return type
2085                        "ca.uhn.fhir.interceptor.model.RequestPartitionId",
2086                        // Params
2087                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2088                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2089                        "ca.uhn.fhir.interceptor.model.ReadPartitionIdRequestDetails"),
2090
2091        /**
2092         * <b>Storage Hook:</b>
2093         * Invoked before FHIR operations to request the identification of the partition ID to be associated with the
2094         * request being made.
2095         * <p>
2096         * This hook is an alternative to {@link #STORAGE_PARTITION_IDENTIFY_READ} and {@link #STORAGE_PARTITION_IDENTIFY_CREATE}
2097         * and can be used in cases where a partition interceptor does not need knowledge of the specific resources being
2098         * accessed/read/written in order to determine the appropriate partition.
2099         * </p>
2100         * <p>
2101         * This hook will only be called if
2102         * partitioning is enabled in the JPA server.
2103         * </p>
2104         * <p>
2105         * Hooks may accept the following parameters:
2106         * </p>
2107         * <ul>
2108         * <li>
2109         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2110         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2111         * pulled out of the servlet request. Note that the bean
2112         * properties are not all guaranteed to be populated, depending on how early during processing the
2113         * exception occurred.
2114         * </li>
2115         * <li>
2116         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2117         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2118         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2119         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2120         * </li>
2121         * </ul>
2122         * <p>
2123         * Hooks must return an instance of <code>ca.uhn.fhir.interceptor.model.RequestPartitionId</code>.
2124         * </p>
2125         *
2126         * @see #STORAGE_PARTITION_IDENTIFY_READ
2127         * @see #STORAGE_PARTITION_IDENTIFY_CREATE
2128         */
2129        STORAGE_PARTITION_IDENTIFY_ANY(
2130                        // Return type
2131                        "ca.uhn.fhir.interceptor.model.RequestPartitionId",
2132                        // Params
2133                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2134                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
2135
2136        /**
2137         * <b>Storage Hook:</b>
2138         * Invoked when a partition has been created, typically meaning the <code>$partition-management-create-partition</code>
2139         * operation has been invoked.
2140         * <p>
2141         * This hook will only be called if
2142         * partitioning is enabled in the JPA server.
2143         * </p>
2144         * <p>
2145         * Hooks may accept the following parameters:
2146         * </p>
2147         * <ul>
2148         * <li>
2149         * ca.uhn.fhir.interceptor.model.RequestPartitionId - The partition ID that was selected
2150         * </li>
2151         * <li>
2152         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2153         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2154         * pulled out of the servlet request. Note that the bean
2155         * properties are not all guaranteed to be populated, depending on how early during processing the
2156         * exception occurred.
2157         * </li>
2158         * <li>
2159         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2160         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2161         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2162         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2163         * </li>
2164         * </ul>
2165         * <p>
2166         * Hooks must return void.
2167         * </p>
2168         */
2169        STORAGE_PARTITION_CREATED(
2170                        // Return type
2171                        void.class,
2172                        // Params
2173                        "ca.uhn.fhir.interceptor.model.RequestPartitionId",
2174                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2175                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
2176
2177        /**
2178         * <b>Storage Hook:</b>
2179         * Invoked before any partition aware FHIR operation, when the selected partition has been identified (ie. after the
2180         * {@link #STORAGE_PARTITION_IDENTIFY_CREATE} or {@link #STORAGE_PARTITION_IDENTIFY_READ} hook was called. This allows
2181         * a separate hook to register, and potentially make decisions about whether the request should be allowed to proceed.
2182         * <p>
2183         * This hook will only be called if
2184         * partitioning is enabled in the JPA server.
2185         * </p>
2186         * <p>
2187         * Hooks may accept the following parameters:
2188         * </p>
2189         * <ul>
2190         * <li>
2191         * ca.uhn.fhir.interceptor.model.RequestPartitionId - The partition ID that was selected
2192         * </li>
2193         * <li>
2194         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2195         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2196         * pulled out of the servlet request. Note that the bean
2197         * properties are not all guaranteed to be populated, depending on how early during processing the
2198         * exception occurred.
2199         * </li>
2200         * <li>
2201         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2202         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2203         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2204         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2205         * </li>
2206         * <li>
2207         * ca.uhn.fhir.context.RuntimeResourceDefinition - The resource type being accessed, or {@literal null} if no specific type is associated with the request.
2208         * </li>
2209         * </ul>
2210         * <p>
2211         * Hooks must return void.
2212         * </p>
2213         */
2214        STORAGE_PARTITION_SELECTED(
2215                        // Return type
2216                        void.class,
2217                        // Params
2218                        "ca.uhn.fhir.interceptor.model.RequestPartitionId",
2219                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2220                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2221                        "ca.uhn.fhir.context.RuntimeResourceDefinition"),
2222
2223        /**
2224         * <b>Storage Hook:</b>
2225         * Invoked when a transaction has been rolled back as a result of a {@link ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException},
2226         * meaning that a database constraint has been violated. This pointcut allows an interceptor to specify a resolution strategy
2227         * other than simply returning the error to the client. This interceptor will be fired after the database transaction rollback
2228         * has been completed.
2229         * <p>
2230         * Hooks may accept the following parameters:
2231         * </p>
2232         * <ul>
2233         * <li>
2234         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2235         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2236         * pulled out of the servlet request. Note that the bean
2237         * properties are not all guaranteed to be populated, depending on how early during processing the
2238         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
2239         * known, such as while processing searches</b>
2240         * </li>
2241         * <li>
2242         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2243         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2244         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2245         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2246         * </li>
2247         * </ul>
2248         * <p>
2249         * Hooks should return <code>ca.uhn.fhir.jpa.api.model.ResourceVersionConflictResolutionStrategy</code>. Hooks should not
2250         * throw any exception.
2251         * </p>
2252         */
2253        STORAGE_VERSION_CONFLICT(
2254                        "ca.uhn.fhir.jpa.api.model.ResourceVersionConflictResolutionStrategy",
2255                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2256                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
2257
2258        /**
2259         * <b>Validation Hook:</b>
2260         * This hook is called after validation has completed, regardless of whether the validation was successful or failed.
2261         * Typically this is used to modify validation results.
2262         * <p>
2263         * <b>Note on validation Pointcuts:</b> The HAPI FHIR interceptor framework is a part of the client and server frameworks and
2264         * not a part of the core FhirContext. Therefore this Pointcut is invoked by the
2265         * </p>
2266         * <p>
2267         * Hooks may accept the following parameters:
2268         * <ul>
2269         * <li>
2270         * org.hl7.fhir.instance.model.api.IBaseResource - The resource being validated, if a parsed version is available (null otherwise)
2271         * </li>
2272         * <li>
2273         * java.lang.String - The resource being validated, if a raw version is available (null otherwise)
2274         * </li>
2275         * <li>
2276         * ca.uhn.fhir.validation.ValidationResult - The outcome of the validation. Hooks methods should not modify this object, but they can return a new one.
2277         * </li>
2278         * </ul>
2279         * </p>
2280         * Hook methods may return an instance of {@link ca.uhn.fhir.validation.ValidationResult} if they wish to override the validation results, or they may return <code>null</code> or <code>void</code> otherwise.
2281         */
2282        VALIDATION_COMPLETED(
2283                        ValidationResult.class,
2284                        "org.hl7.fhir.instance.model.api.IBaseResource",
2285                        "java.lang.String",
2286                        "ca.uhn.fhir.validation.ValidationResult"),
2287
2288        /**
2289         * <b>MDM(EMPI) Hook:</b>
2290         * Invoked when a persisted resource (a resource that has just been stored in the
2291         * database via a create/update/patch/etc.) enters the MDM module. The purpose of the pointcut is to permit a pseudo
2292         * modification of the resource elements to influence the MDM linking process.  Any modifications to the resource are not persisted.
2293         * <p>
2294         * Hooks may accept the following parameters:
2295         * <ul>
2296         * <li>org.hl7.fhir.instance.model.api.IBaseResource - </li>
2297         * </ul>
2298         * </p>
2299         * <p>
2300         * Hooks should return <code>void</code>.
2301         * </p>
2302         */
2303        MDM_BEFORE_PERSISTED_RESOURCE_CHECKED(void.class, "org.hl7.fhir.instance.model.api.IBaseResource"),
2304
2305        /**
2306         * <b>MDM(EMPI) Hook:</b>
2307         * Invoked whenever a persisted resource (a resource that has just been stored in the
2308         * database via a create/update/patch/etc.) has been matched against related resources and MDM links have been updated.
2309         * <p>
2310         * Hooks may accept the following parameters:
2311         * <ul>
2312         * <li>ca.uhn.fhir.rest.server.messaging.ResourceOperationMessage - This parameter should not be modified as processing is complete when this hook is invoked.</li>
2313         * <li>ca.uhn.fhir.rest.server.TransactionLogMessages - This parameter is for informational messages provided by the MDM module during MDM processing.</li>
2314         * <li>ca.uhn.fhir.mdm.model.mdmevents.MdmLinkEvent - Contains information about the change event, including target and golden resource IDs and the operation type.</li>
2315         * </ul>
2316         * </p>
2317         * <p>
2318         * Hooks should return <code>void</code>.
2319         * </p>
2320         */
2321        MDM_AFTER_PERSISTED_RESOURCE_CHECKED(
2322                        void.class,
2323                        "ca.uhn.fhir.rest.server.messaging.ResourceOperationMessage",
2324                        "ca.uhn.fhir.rest.server.TransactionLogMessages",
2325                        "ca.uhn.fhir.mdm.model.mdmevents.MdmLinkEvent"),
2326
2327        /**
2328         * <b>MDM Create Link</b>
2329         * This hook is invoked after an MDM link is created,
2330         * and changes have been persisted to the database.
2331         * <p>
2332         * Hook may accept the following parameters:
2333         * </p>
2334         * <ul>
2335         * <li>
2336         * ca.uhn.fhir.rest.api.server.RequestDetails - An object containing details about the request that is about to be processed, including details such as the
2337         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2338         * pulled out of the servlet request.
2339         * </li>
2340         * <li>
2341         * ca.uhn.fhir.mdm.api.MdmLinkChangeEvent - Contains information about the link event, including target and golden resource IDs and the operation type.
2342         * </li>
2343         * </ul>
2344         * <p>
2345         * Hooks should return <code>void</code>.
2346         * </p>
2347         */
2348        MDM_POST_CREATE_LINK(
2349                        void.class, "ca.uhn.fhir.rest.api.server.RequestDetails", "ca.uhn.fhir.mdm.model.mdmevents.MdmLinkEvent"),
2350
2351        /**
2352         * <b>MDM Update Link</b>
2353         * This hook is invoked after an MDM link is updated,
2354         * and changes have been persisted to the database.
2355         * <p>
2356         * Hook may accept the following parameters:
2357         * </p>
2358         * <ul>
2359         * <li>
2360         * ca.uhn.fhir.rest.api.server.RequestDetails - An object containing details about the request that is about to be processed, including details such as the
2361         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2362         * pulled out of the servlet request.
2363         * </li>
2364         * <li>
2365         * ca.uhn.fhir.mdm.api.MdmLinkChangeEvent - Contains information about the link event, including target and golden resource IDs and the operation type.
2366         * </li>
2367         * </ul>
2368         * <p>
2369         * Hooks should return <code>void</code>.
2370         * </p>
2371         */
2372        MDM_POST_UPDATE_LINK(
2373                        void.class, "ca.uhn.fhir.rest.api.server.RequestDetails", "ca.uhn.fhir.mdm.model.mdmevents.MdmLinkEvent"),
2374
2375        /**
2376         * <b>MDM Merge Golden Resources</b>
2377         * This hook is invoked after 2 golden resources have been
2378         * merged together and results persisted.
2379         * <p>
2380         * Hook may accept the following parameters:
2381         * </p>
2382         * <ul>
2383         * <li>
2384         * ca.uhn.fhir.rest.api.server.RequestDetails - An object containing details about the request that is about to be processed, including details such as the
2385         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2386         * pulled out of the servlet request.
2387         * </li>
2388         * <li>
2389         * ca.uhn.fhir.mdm.model.mdmevents.MdmMergeEvent - Contains information about the from and to resources.
2390         * </li>
2391         * <li>
2392         * ca.uhn.fhir.mdm.model.mdmevents.MdmTransactionContext - Contains information about the Transaction context, e.g. merge or link.
2393         * </li>
2394         * </ul>
2395         * <p>
2396         * Hooks should return <code>void</code>.
2397         * </p>
2398         */
2399        MDM_POST_MERGE_GOLDEN_RESOURCES(
2400                        void.class,
2401                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2402                        "ca.uhn.fhir.mdm.model.mdmevents.MdmMergeEvent",
2403                        "ca.uhn.fhir.mdm.model.MdmTransactionContext"),
2404
2405        /**
2406         * <b>MDM Link History Hook:</b>
2407         * This hook is invoked after link histories are queried,
2408         * but before the results are returned to the caller.
2409         * <p>
2410         * Hook may accept the following parameters:
2411         * </p>
2412         * <ul>
2413         * <li>
2414         * ca.uhn.fhir.rest.api.server.RequestDetails - An object containing details about the request that is about to be processed.
2415         * </li>
2416         * <li>
2417         * ca.uhn.fhir.mdm.model.mdmevents.MdmHistoryEvent - An MDM History Event containing
2418         * information about the requested golden resource ids and/or source ids input, and
2419         * the returned link histories.
2420         * </li>
2421         * </ul>
2422         */
2423        MDM_POST_LINK_HISTORY(
2424                        void.class,
2425                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2426                        "ca.uhn.fhir.mdm.model.mdmevents.MdmHistoryEvent"),
2427
2428        /**
2429         * <b>MDM Not Duplicate/Unduplicate Hook:</b>
2430         * This hook is invoked after 2 golden resources with an existing link
2431         * of "POSSIBLE_DUPLICATE" get unlinked/unduplicated.
2432         * <p>
2433         * This hook accepts the following parameters:
2434         * </p>
2435         * <ul>
2436         * <li>
2437         * ca.uhn.fhir.rest.api.server.RequestDetails - An object containing details about the request that is about to be processed.
2438         * </li>
2439         * <li>
2440         * ca.uhn.fhir.mdm.model.mdmevents.MdmLinkEvent - the resulting final link
2441         * between the 2 golden resources; now a NO_MATCH link.
2442         * </li>
2443         * </ul>
2444         */
2445        MDM_POST_NOT_DUPLICATE(
2446                        void.class, "ca.uhn.fhir.rest.api.server.RequestDetails", "ca.uhn.fhir.mdm.model.mdmevents.MdmLinkEvent"),
2447
2448        /**
2449         * <b>MDM Clear Hook:</b>
2450         * This hook is invoked when an mdm clear operation is requested.
2451         * <p>
2452         * This hook accepts the following parameters:
2453         * </p>
2454         * <ul>
2455         * <li>
2456         * ca.uhn.fhir.rest.api.server.RequestDetails - An object containing details about the request that is about to be processed.
2457         * </li>
2458         * <li>
2459         * ca.uhn.fhir.mdm.model.mdmevents.MdmClearEvent - the event containing information on the clear command,
2460         * including the type filter (if any) and the batch size (if any).
2461         * </li>
2462         * </ul>
2463         */
2464        MDM_CLEAR(
2465                        void.class, "ca.uhn.fhir.rest.api.server.RequestDetails", "ca.uhn.fhir.mdm.model.mdmevents.MdmClearEvent"),
2466
2467        /**
2468         * <b>MDM Submit Hook:</b>
2469         * This hook is invoked whenever when mdm submit operation is requested.
2470         * MDM submits can be invoked in multiple ways.
2471         * Some of which accept asynchronous calling, and some of which do not.
2472         * <p>
2473         * If the MDM Submit operation is asynchronous
2474         * (typically because the Prefer: respond-async header has been provided)
2475         * this hook will be invoked after the job is submitted, but before it has
2476         * necessarily been executed.
2477         * </p>
2478         * <p>
2479         * If the MDM Submit operation is synchronous,
2480         * this hook will be invoked immediately after the submit operation
2481         * has been executed, but before the call is returned to the caller.
2482         * </p>
2483         * <ul>
2484         * <li>
2485         * On Patient Type. Can be synchronous or asynchronous.
2486         * </li>
2487         * <li>
2488         * On Practitioner Type. Can be synchronous or asynchronous.
2489         * </li>
2490         * <li>
2491         * On specific patient instances. Is always synchronous.
2492         * </li>
2493         * <li>
2494         * On specific practitioner instances. Is always synchronous.
2495         * </li>
2496         * <li>
2497         * On the server (ie, not on any resource) with or without a resource filter.
2498         * Can be synchronous or asynchronous.
2499         * </li>
2500         * </ul>
2501         * <p>
2502         * In all cases, this hook will take the following parameters:
2503         * </p>
2504         * <ul>
2505         * <li>
2506         * ca.uhn.fhir.rest.api.server.RequestDetails - An object containing details about the request that is about to be processed.
2507         * </li>
2508         * <li>
2509         * ca.uhn.fhir.mdm.model.mdmevents.MdmSubmitEvent - An event with the Mdm Submit information
2510         * (urls specifying paths that will be searched for MDM submit, as well as
2511         * if this was an asynchronous request or not).
2512         * </li>
2513         * </ul>
2514         */
2515        MDM_SUBMIT(
2516                        void.class, "ca.uhn.fhir.rest.api.server.RequestDetails", "ca.uhn.fhir.mdm.model.mdmevents.MdmSubmitEvent"),
2517
2518        /**
2519         * <b>JPA Hook:</b>
2520         * This hook is invoked when a cross-partition reference is about to be
2521         * stored in the database.
2522         * <p>
2523         * <b>This is an experimental API - It may change in the future, use with caution.</b>
2524         * </p>
2525         * <p>
2526         * Hooks may accept the following parameters:
2527         * </p>
2528         * <ul>
2529         * <li>
2530         * {@literal ca.uhn.fhir.jpa.searchparam.extractor.CrossPartitionReferenceDetails} - Contains details about the
2531         * cross partition reference.
2532         * </li>
2533         * </ul>
2534         * <p>
2535         * Hooks should return <code>void</code>.
2536         * </p>
2537         */
2538        JPA_RESOLVE_CROSS_PARTITION_REFERENCE(
2539                        "ca.uhn.fhir.jpa.model.cross.IResourceLookup",
2540                        "ca.uhn.fhir.jpa.searchparam.extractor.CrossPartitionReferenceDetails"),
2541
2542        /**
2543         * <b>Performance Tracing Hook:</b>
2544         * This hook is invoked when any informational messages generated by the
2545         * SearchCoordinator are created. It is typically used to provide logging
2546         * or capture details related to a specific request.
2547         * <p>
2548         * Note that this is a performance tracing hook. Use with caution in production
2549         * systems, since calling it may (or may not) carry a cost.
2550         * </p>
2551         * Hooks may accept the following parameters:
2552         * <ul>
2553         * <li>
2554         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2555         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2556         * pulled out of the servlet request. Note that the bean
2557         * properties are not all guaranteed to be populated, depending on how early during processing the
2558         * exception occurred.
2559         * </li>
2560         * <li>
2561         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2562         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2563         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2564         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2565         * </li>
2566         * <li>
2567         * ca.uhn.fhir.jpa.model.search.StorageProcessingMessage - Contains the message
2568         * </li>
2569         * </ul>
2570         * <p>
2571         * Hooks should return <code>void</code>.
2572         * </p>
2573         */
2574        JPA_PERFTRACE_INFO(
2575                        void.class,
2576                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2577                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2578                        "ca.uhn.fhir.jpa.model.search.StorageProcessingMessage"),
2579
2580        /**
2581         * <b>Performance Tracing Hook:</b>
2582         * This hook is invoked when any warning messages generated by the
2583         * SearchCoordinator are created. It is typically used to provide logging
2584         * or capture details related to a specific request.
2585         * <p>
2586         * Note that this is a performance tracing hook. Use with caution in production
2587         * systems, since calling it may (or may not) carry a cost.
2588         * </p>
2589         * Hooks may accept the following parameters:
2590         * <ul>
2591         * <li>
2592         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2593         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2594         * pulled out of the servlet request. Note that the bean
2595         * properties are not all guaranteed to be populated, depending on how early during processing the
2596         * exception occurred.
2597         * </li>
2598         * <li>
2599         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2600         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2601         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2602         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2603         * </li>
2604         * <li>
2605         * ca.uhn.fhir.jpa.model.search.StorageProcessingMessage - Contains the message
2606         * </li>
2607         * </ul>
2608         * <p>
2609         * Hooks should return <code>void</code>.
2610         * </p>
2611         */
2612        JPA_PERFTRACE_WARNING(
2613                        void.class,
2614                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2615                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2616                        "ca.uhn.fhir.jpa.model.search.StorageProcessingMessage"),
2617
2618        /**
2619         * <b>Performance Tracing Hook:</b>
2620         * This hook is invoked when a search has returned the very first result
2621         * from the database. The timing on this call can be a good indicator of how
2622         * performant a query is in general.
2623         * <p>
2624         * Note that this is a performance tracing hook. Use with caution in production
2625         * systems, since calling it may (or may not) carry a cost.
2626         * </p>
2627         * Hooks may accept the following parameters:
2628         * <ul>
2629         * <li>
2630         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2631         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2632         * pulled out of the servlet request. Note that the bean
2633         * properties are not all guaranteed to be populated, depending on how early during processing the
2634         * exception occurred.
2635         * </li>
2636         * <li>
2637         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2638         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2639         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2640         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2641         * </li>
2642         * <li>
2643         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2644         * performed. Hooks should not modify this object.
2645         * </li>
2646         * </ul>
2647         * <p>
2648         * Hooks should return <code>void</code>.
2649         * </p>
2650         */
2651        JPA_PERFTRACE_SEARCH_FIRST_RESULT_LOADED(
2652                        void.class,
2653                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2654                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2655                        "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"),
2656
2657        /**
2658         * <b>Performance Tracing Hook:</b>
2659         * This hook is invoked when an individual search query SQL SELECT statement
2660         * has completed and no more results are available from that query. Note that this
2661         * doesn't necessarily mean that no more matching results exist in the database,
2662         * since HAPI FHIR JPA batch loads results in to the query cache in chunks in order
2663         * to provide predicable results without overloading memory or the database.
2664         * <p>
2665         * Note that this is a performance tracing hook. Use with caution in production
2666         * systems, since calling it may (or may not) carry a cost.
2667         * </p>
2668         * Hooks may accept the following parameters:
2669         * <ul>
2670         * <li>
2671         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2672         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2673         * pulled out of the servlet request. Note that the bean
2674         * properties are not all guaranteed to be populated, depending on how early during processing the
2675         * exception occurred.
2676         * </li>
2677         * <li>
2678         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2679         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2680         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2681         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2682         * </li>
2683         * <li>
2684         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2685         * performed. Hooks should not modify this object.
2686         * </li>
2687         * </ul>
2688         * <p>
2689         * Hooks should return <code>void</code>.
2690         * </p>
2691         */
2692        JPA_PERFTRACE_SEARCH_SELECT_COMPLETE(
2693                        void.class,
2694                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2695                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2696                        "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"),
2697
2698        /**
2699         * <b>Performance Tracing Hook:</b>
2700         * This hook is invoked when a search has failed for any reason. When this pointcut
2701         * is invoked, the search has completed unsuccessfully and will not be continued.
2702         * <p>
2703         * Note that this is a performance tracing hook. Use with caution in production
2704         * systems, since calling it may (or may not) carry a cost.
2705         * </p>
2706         * Hooks may accept the following parameters:
2707         * <ul>
2708         * <li>
2709         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2710         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2711         * pulled out of the servlet request. Note that the bean
2712         * properties are not all guaranteed to be populated, depending on how early during processing the
2713         * exception occurred.
2714         * </li>
2715         * <li>
2716         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2717         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2718         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2719         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2720         * </li>
2721         * <li>
2722         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2723         * performed. Hooks should not modify this object.
2724         * </li>
2725         * </ul>
2726         * <p>
2727         * Hooks should return <code>void</code>.
2728         * </p>
2729         */
2730        JPA_PERFTRACE_SEARCH_FAILED(
2731                        void.class,
2732                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2733                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2734                        "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"),
2735
2736        /**
2737         * <b>Performance Tracing Hook:</b>
2738         * This hook is invoked when a search has completed. When this pointcut
2739         * is invoked, a pass in the Search Coordinator has completed successfully, but
2740         * not all possible resources have been loaded yet so a future paging request
2741         * may trigger a new task that will load further resources.
2742         * <p>
2743         * Note that this is a performance tracing hook. Use with caution in production
2744         * systems, since calling it may (or may not) carry a cost.
2745         * </p>
2746         * Hooks may accept the following parameters:
2747         * <ul>
2748         * <li>
2749         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2750         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2751         * pulled out of the servlet request. Note that the bean
2752         * properties are not all guaranteed to be populated, depending on how early during processing the
2753         * exception occurred.
2754         * </li>
2755         * <li>
2756         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2757         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2758         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2759         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2760         * </li>
2761         * <li>
2762         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2763         * performed. Hooks should not modify this object.
2764         * </li>
2765         * </ul>
2766         * <p>
2767         * Hooks should return <code>void</code>.
2768         * </p>
2769         */
2770        JPA_PERFTRACE_SEARCH_PASS_COMPLETE(
2771                        void.class,
2772                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2773                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2774                        "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"),
2775
2776        /**
2777         * <b>Performance Tracing Hook:</b>
2778         * This hook is invoked when a query involving an external index (e.g. Elasticsearch) has completed. When this pointcut
2779         * is invoked, an initial list of resource IDs has been generated which will be used as part of a subsequent database query.
2780         * <p>
2781         * Note that this is a performance tracing hook. Use with caution in production
2782         * systems, since calling it may (or may not) carry a cost.
2783         * </p>
2784         * Hooks may accept the following parameters:
2785         * <ul>
2786         * <li>
2787         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2788         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2789         * pulled out of the servlet request. Note that the bean
2790         * properties are not all guaranteed to be populated, depending on how early during processing the
2791         * exception occurred.
2792         * </li>
2793         * <li>
2794         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2795         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2796         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2797         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2798         * </li>
2799         * <li>
2800         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2801         * performed. Hooks should not modify this object.
2802         * </li>
2803         * </ul>
2804         * <p>
2805         * Hooks should return <code>void</code>.
2806         * </p>
2807         */
2808        JPA_PERFTRACE_INDEXSEARCH_QUERY_COMPLETE(
2809                        void.class,
2810                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2811                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2812                        "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"),
2813
2814        /**
2815         * <b>Performance Tracing Hook:</b>
2816         * Invoked when the storage engine is about to reuse the results of
2817         * a previously cached search.
2818         * <p>
2819         * Note that this is a performance tracing hook. Use with caution in production
2820         * systems, since calling it may (or may not) carry a cost.
2821         * </p>
2822         * <p>
2823         * Hooks may accept the following parameters:
2824         * </p>
2825         * <ul>
2826         * <li>
2827         * ca.uhn.fhir.jpa.searchparam.SearchParameterMap - Contains the details of the search being checked
2828         * </li>
2829         * <li>
2830         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2831         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2832         * pulled out of the servlet request. Note that the bean
2833         * properties are not all guaranteed to be populated, depending on how early during processing the
2834         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
2835         * known, such as while processing searches</b>
2836         * </li>
2837         * <li>
2838         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2839         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2840         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2841         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2842         * </li>
2843         * </ul>
2844         * <p>
2845         * Hooks should return <code>void</code>.
2846         * </p>
2847         */
2848        JPA_PERFTRACE_SEARCH_REUSING_CACHED(
2849                        boolean.class,
2850                        "ca.uhn.fhir.jpa.searchparam.SearchParameterMap",
2851                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2852                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"),
2853
2854        /**
2855         * <b>Performance Tracing Hook:</b>
2856         * This hook is invoked when a search has failed for any reason. When this pointcut
2857         * is invoked, a pass in the Search Coordinator has completed successfully, and all
2858         * possible results have been fetched and loaded into the query cache.
2859         * <p>
2860         * Note that this is a performance tracing hook. Use with caution in production
2861         * systems, since calling it may (or may not) carry a cost.
2862         * </p>
2863         * Hooks may accept the following parameters:
2864         * <ul>
2865         * <li>
2866         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2867         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2868         * pulled out of the servlet request. Note that the bean
2869         * properties are not all guaranteed to be populated, depending on how early during processing the
2870         * exception occurred.
2871         * </li>
2872         * <li>
2873         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2874         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2875         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2876         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2877         * </li>
2878         * <li>
2879         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2880         * performed. Hooks should not modify this object.
2881         * </li>
2882         * </ul>
2883         * <p>
2884         * Hooks should return <code>void</code>.
2885         * </p>
2886         */
2887        JPA_PERFTRACE_SEARCH_COMPLETE(
2888                        void.class,
2889                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2890                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2891                        "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"),
2892
2893        /**
2894         * <b>Performance Tracing Hook:</b>
2895         * <p>
2896         * This hook is invoked when a search has found an individual ID.
2897         * </p>
2898         * <p>
2899         * THIS IS AN EXPERIMENTAL HOOK AND MAY BE REMOVED OR CHANGED WITHOUT WARNING.
2900         * </p>
2901         * <p>
2902         * Note that this is a performance tracing hook. Use with caution in production
2903         * systems, since calling it may (or may not) carry a cost.
2904         * </p>
2905         * <p>
2906         * Hooks may accept the following parameters:
2907         * </p>
2908         * <ul>
2909         * <li>
2910         * java.lang.Integer - The query ID
2911         * </li>
2912         * <li>
2913         * java.lang.Object - The ID
2914         * </li>
2915         * </ul>
2916         * <p>
2917         * Hooks should return <code>void</code>.
2918         * </p>
2919         */
2920        JPA_PERFTRACE_SEARCH_FOUND_ID(void.class, "java.lang.Integer", "java.lang.Object"),
2921
2922        /**
2923         * <b>Performance Tracing Hook:</b>
2924         * This hook is invoked when a query has executed, and includes the raw SQL
2925         * statements that were executed against the database.
2926         * <p>
2927         * Note that this is a performance tracing hook. Use with caution in production
2928         * systems, since calling it may (or may not) carry a cost.
2929         * </p>
2930         * <p>
2931         * Hooks may accept the following parameters:
2932         * </p>
2933         * <ul>
2934         * <li>
2935         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2936         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2937         * pulled out of the servlet request. Note that the bean
2938         * properties are not all guaranteed to be populated, depending on how early during processing the
2939         * exception occurred.
2940         * </li>
2941         * <li>
2942         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2943         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2944         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2945         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2946         * </li>
2947         * <li>
2948         * ca.uhn.fhir.jpa.util.SqlQueryList - Contains details about the raw SQL queries.
2949         * </li>
2950         * </ul>
2951         * <p>
2952         * Hooks should return <code>void</code>.
2953         * </p>
2954         */
2955        JPA_PERFTRACE_RAW_SQL(
2956                        void.class,
2957                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2958                        "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2959                        "ca.uhn.fhir.jpa.util.SqlQueryList"),
2960
2961        /**
2962         * <b> Deprecated but still supported.  Will eventually be removed.  <code>Please use Pointcut.STORAGE_BINARY_ASSIGN_BINARY_CONTENT_ID_PREFIX</code>  </b>
2963         * <b> Binary Blob Prefix Assigning Hook:</b>
2964         * <p>
2965         * Immediately before a binary blob is stored to its eventual data sink, this hook is called.
2966         * This hook allows implementers to provide a prefix to the binary blob's ID.
2967         * This is helpful in cases where you want to identify this blob for later retrieval outside of HAPI-FHIR. Note that allowable characters will depend on the specific storage sink being used.
2968         * <ul>
2969         * <li>
2970         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2971         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2972         * pulled out of the servlet request. Note that the bean
2973         * properties are not all guaranteed to be populated.
2974         * </li>
2975         * <li>
2976         * org.hl7.fhir.instance.model.api.IBaseBinary - The binary resource that is about to be stored.
2977         * </li>
2978         * </ul>
2979         * <p>
2980         * Hooks should return <code>String</code>, which represents the full prefix to be applied to the blob.
2981         * </p>
2982         */
2983        @Deprecated(since = "7.2.0 - Use STORAGE_BINARY_ASSIGN_BINARY_CONTENT_ID_PREFIX instead.")
2984        STORAGE_BINARY_ASSIGN_BLOB_ID_PREFIX(
2985                        String.class,
2986                        "ca.uhn.fhir.rest.api.server.RequestDetails",
2987                        "org.hl7.fhir.instance.model.api.IBaseResource"),
2988
2989        /**
2990         * <b> Binary Content Prefix Assigning Hook:</b>
2991         * <p>
2992         * Immediately before binary content is stored to its eventual data sink, this hook is called.
2993         * This hook allows implementers to provide a prefix to the binary content's ID.
2994         * This is helpful in cases where you want to identify this blob for later retrieval outside of HAPI-FHIR. Note that allowable characters will depend on the specific storage sink being used.
2995         * <ul>
2996         * <li>
2997         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
2998         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2999         * pulled out of the servlet request. Note that the bean
3000         * properties are not all guaranteed to be populated.
3001         * </li>
3002         * <li>
3003         * org.hl7.fhir.instance.model.api.IBaseBinary - The binary resource that is about to be stored.
3004         * </li>
3005         * </ul>
3006         * <p>
3007         * Hooks should return <code>String</code>, which represents the full prefix to be applied to the blob.
3008         * </p>
3009         */
3010        STORAGE_BINARY_ASSIGN_BINARY_CONTENT_ID_PREFIX(
3011                        String.class,
3012                        "ca.uhn.fhir.rest.api.server.RequestDetails",
3013                        "org.hl7.fhir.instance.model.api.IBaseResource"),
3014
3015        /**
3016         * <b>Storage Hook:</b>
3017         * Invoked before a batch job is persisted to the database.
3018         * <p>
3019         * Hooks will have access to the content of the job being created
3020         * and may choose to make modifications to it. These changes will be
3021         * reflected in permanent storage.
3022         * </p>
3023         * Hooks may accept the following parameters:
3024         * <ul>
3025         * <li>
3026         * ca.uhn.fhir.batch2.model.JobInstance
3027         * </li>
3028         * <li>
3029         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that lead to the creation
3030         * of the jobInstance.
3031         * </li>
3032         * </ul>
3033         * <p>
3034         * Hooks should return <code>void</code>.
3035         * </p>
3036         */
3037        STORAGE_PRESTORAGE_BATCH_JOB_CREATE(
3038                        void.class, "ca.uhn.fhir.batch2.model.JobInstance", "ca.uhn.fhir.rest.api.server.RequestDetails"),
3039
3040        /**
3041         * This pointcut is used only for unit tests. Do not use in production code as it may be changed or
3042         * removed at any time.
3043         */
3044        TEST_RB(
3045                        boolean.class,
3046                        new ExceptionHandlingSpec().addLogAndSwallow(IllegalStateException.class),
3047                        String.class.getName(),
3048                        String.class.getName()),
3049
3050        /**
3051         * This pointcut is used only for unit tests. Do not use in production code as it may be changed or
3052         * removed at any time.
3053         */
3054        TEST_RO(BaseServerResponseException.class, String.class.getName(), String.class.getName());
3055
3056        private final List<String> myParameterTypes;
3057        private final Class<?> myReturnType;
3058        private final ExceptionHandlingSpec myExceptionHandlingSpec;
3059
3060        Pointcut(@Nonnull String theReturnType, String... theParameterTypes) {
3061                this(toReturnTypeClass(theReturnType), new ExceptionHandlingSpec(), theParameterTypes);
3062        }
3063
3064        Pointcut(
3065                        @Nonnull Class<?> theReturnType,
3066                        @Nonnull ExceptionHandlingSpec theExceptionHandlingSpec,
3067                        String... theParameterTypes) {
3068                myReturnType = theReturnType;
3069                myExceptionHandlingSpec = theExceptionHandlingSpec;
3070                myParameterTypes = Collections.unmodifiableList(Arrays.asList(theParameterTypes));
3071        }
3072
3073        Pointcut(@Nonnull Class<?> theReturnType, String... theParameterTypes) {
3074                this(theReturnType, new ExceptionHandlingSpec(), theParameterTypes);
3075        }
3076
3077        @Override
3078        public boolean isShouldLogAndSwallowException(@Nonnull Throwable theException) {
3079                for (Class<? extends Throwable> next : myExceptionHandlingSpec.myTypesToLogAndSwallow) {
3080                        if (next.isAssignableFrom(theException.getClass())) {
3081                                return true;
3082                        }
3083                }
3084                return false;
3085        }
3086
3087        @Override
3088        @Nonnull
3089        public Class<?> getReturnType() {
3090                return myReturnType;
3091        }
3092
3093        @Override
3094        @Nonnull
3095        public List<String> getParameterTypes() {
3096                return myParameterTypes;
3097        }
3098
3099        private static class UnknownType {}
3100
3101        private static class ExceptionHandlingSpec {
3102
3103                private final Set<Class<? extends Throwable>> myTypesToLogAndSwallow = new HashSet<>();
3104
3105                ExceptionHandlingSpec addLogAndSwallow(@Nonnull Class<? extends Throwable> theType) {
3106                        myTypesToLogAndSwallow.add(theType);
3107                        return this;
3108                }
3109        }
3110
3111        private static Class<?> toReturnTypeClass(String theReturnType) {
3112                try {
3113                        return Class.forName(theReturnType);
3114                } catch (ClassNotFoundException theE) {
3115                        return UnknownType.class;
3116                }
3117        }
3118}