001package ca.uhn.fhir.interceptor.api;
002
003/*-
004 * #%L
005 * HAPI FHIR - Core Library
006 * %%
007 * Copyright (C) 2014 - 2022 Smile CDR, Inc.
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 *
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 *
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
024import ca.uhn.fhir.rest.annotation.Read;
025import ca.uhn.fhir.rest.annotation.Search;
026import ca.uhn.fhir.rest.server.exceptions.AuthenticationException;
027import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
028import ca.uhn.fhir.validation.ValidationResult;
029import org.hl7.fhir.instance.model.api.IBaseConformance;
030
031import javax.annotation.Nonnull;
032import java.io.Writer;
033import java.util.Arrays;
034import java.util.Collections;
035import java.util.HashSet;
036import java.util.List;
037import java.util.Set;
038
039/**
040 * Value for {@link Hook#value()}
041 * <p>
042 * Hook pointcuts are divided into several broad categories:
043 * <ul>
044 * <li>INTERCEPTOR_xxx: Hooks on the interceptor infrastructure itself</li>
045 * <li>CLIENT_xxx: Hooks on the HAPI FHIR Client framework</li>
046 * <li>SERVER_xxx: Hooks on the HAPI FHIR Server framework</li>
047 * <li>SUBSCRIPTION_xxx: Hooks on the HAPI FHIR Subscription framework</li>
048 * <li>STORAGE_xxx: Hooks on the storage engine</li>
049 * <li>VALIDATION_xxx: Hooks on the HAPI FHIR Validation framework</li>
050 * <li>JPA_PERFTRACE_xxx: Performance tracing hooks on the JPA server</li>
051 * </ul>
052 * </p>
053 */
054public enum Pointcut implements IPointcut {
055
056        /**
057         * <b>Interceptor Framework Hook:</b>
058         * This pointcut will be called once when a given interceptor is registered
059         */
060        INTERCEPTOR_REGISTERED(void.class),
061
062        /**
063         * <b>Client Hook:</b>
064         * This hook is called before an HTTP client request is sent
065         * <p>
066         * Hooks may accept the following parameters:
067         * <ul>
068         * <li>
069         * ca.uhn.fhir.rest.client.api.IHttpRequest - The details of the request
070         * </li>
071         * <li>
072         *    ca.uhn.fhir.rest.client.api.IRestfulClient - The client object making the request
073         * </li>
074         * </ul>
075         * </p>
076         * Hook methods must return <code>void</code>.
077         */
078        CLIENT_REQUEST(void.class,
079                "ca.uhn.fhir.rest.client.api.IHttpRequest",
080                "ca.uhn.fhir.rest.client.api.IRestfulClient"
081        ),
082
083        /**
084         * <b>Client Hook:</b>
085         * This hook is called after an HTTP client request has completed, prior to returning
086         * the results to the calling code. Hook methods may modify the response.
087         * <p>
088         * Hooks may accept the following parameters:
089         * <ul>
090         * <li>
091         * ca.uhn.fhir.rest.client.api.IHttpRequest - The details of the request
092         * </li>
093         * <li>
094         * ca.uhn.fhir.rest.client.api.IHttpResponse - The details of the response
095         * </li>
096         * <li>
097         *    ca.uhn.fhir.rest.client.api.IRestfulClient - The client object making the request
098         * </li>
099         * </ul>
100         * </p>
101         * Hook methods must return <code>void</code>.
102         */
103        CLIENT_RESPONSE(void.class,
104                "ca.uhn.fhir.rest.client.api.IHttpRequest",
105                "ca.uhn.fhir.rest.client.api.IHttpResponse",
106                "ca.uhn.fhir.rest.client.api.IRestfulClient"
107        ),
108
109        /**
110         * <b>Server Hook:</b>
111         * This hook is called when a server CapabilityStatement is generated for returning to a client.
112         * <p>
113         * This pointcut will not necessarily be invoked for every client request to the `/metadata` endpoint.
114         * If caching of the generated CapabilityStatement is enabled, a new CapabilityStatement will be
115         * generated periodically and this pointcut will be invoked at that time.
116         * </p>
117         * <p>
118         * Hooks may accept the following parameters:
119         * <ul>
120         * <li>
121         * org.hl7.fhir.instance.model.api.IBaseConformance - The <code>CapabilityStatement</code> resource that will
122         * be returned to the client by the server. Interceptors may make changes to this resource. The parameter
123         * must be of type <code>IBaseConformance</code>, so it is the responsibility of the interceptor hook method
124         * code to cast to the appropriate version.
125         * </li>
126         * <li>
127         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to
128         * be processed
129         * </li>
130         * <li>
131         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that
132         * is about to be processed. This parameter is identical to the RequestDetails parameter above but will only
133         * be populated when operating in a RestfulServer implementation. It is provided as a convenience.
134         * </li>
135         * </ul>
136         * </p>
137         * Hook methods may an instance of a new <code>CapabilityStatement</code> resource which will replace the
138         * one that was supplied to the interceptor, or <code>void</code> to use the original one. If the interceptor
139         * chooses to modify the <code>CapabilityStatement</code> that was supplied to the interceptor, it is fine
140         * for your hook method to return <code>void</code> or <code>null</code>.
141         */
142        SERVER_CAPABILITY_STATEMENT_GENERATED(IBaseConformance.class,
143                "org.hl7.fhir.instance.model.api.IBaseConformance",
144                "ca.uhn.fhir.rest.api.server.RequestDetails",
145                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
146        ),
147
148        /**
149         * <b>Server Hook:</b>
150         * This hook is called before any other processing takes place for each incoming request. It may be used to provide
151         * alternate handling for some requests, or to screen requests before they are handled, etc.
152         * <p>
153         * Note that any exceptions thrown by this method will not be trapped by HAPI (they will be passed up to the server)
154         * </p>
155         * <p>
156         * Hooks may accept the following parameters:
157         * <ul>
158         * <li>
159         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
160         * </li>
161         * <li>
162         * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
163         * </li>
164         * </ul>
165         * </p>
166         * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally.
167         * This is generally the right thing to do. If your interceptor is providing a response rather than
168         * letting HAPI handle the response normally, you must return <code>false</code>. In this case,
169         * no further processing will occur and no further interceptors will be called.
170         */
171        SERVER_INCOMING_REQUEST_PRE_PROCESSED(boolean.class,
172                "javax.servlet.http.HttpServletRequest",
173                "javax.servlet.http.HttpServletResponse"
174        ),
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         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
202         * </li>
203         * <li>
204         * javax.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(boolean.class,
220                "ca.uhn.fhir.rest.api.server.RequestDetails",
221                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
222                "javax.servlet.http.HttpServletRequest",
223                "javax.servlet.http.HttpServletResponse",
224                "ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException"
225        ),
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         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
248         * </li>
249         * <li>
250         * javax.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(boolean.class,
268                "ca.uhn.fhir.rest.api.server.RequestDetails",
269                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
270                "javax.servlet.http.HttpServletRequest",
271                "javax.servlet.http.HttpServletResponse"
272        ),
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         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
295         * </li>
296         * <li>
297         * javax.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(boolean.class,
313                "ca.uhn.fhir.rest.api.server.RequestDetails",
314                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
315                "javax.servlet.http.HttpServletRequest",
316                "javax.servlet.http.HttpServletResponse"
317        ),
318
319
320        /**
321         * <b>Server Hook:</b>
322         * This hook is invoked before an incoming request is processed. Note that this method is called
323         * after the server has begun preparing the response to the incoming client request.
324         * As such, it is not able to supply a response to the incoming request in the way that
325         * SERVER_INCOMING_REQUEST_PRE_PROCESSED and
326         * {@link #SERVER_INCOMING_REQUEST_POST_PROCESSED}
327         * are.
328         * <p>
329         * Hooks may accept the following parameters:
330         * <ul>
331         * <li>
332         * 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
333         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
334         * pulled out of the servlet request. Note that the bean
335         * properties are not all guaranteed to be populated, depending on how early during processing the
336         * exception occurred.
337         * </li>
338         * <li>
339         * 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
340         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
341         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
342         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
343         * </li>
344         * <li>
345         * ca.uhn.fhir.rest.api.RestOperationTypeEnum - The type of operation that the FHIR server has determined that the client is trying to invoke
346         * </li>
347         * <li>
348         * ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails - This parameter is provided for legacy reasons only and will be removed in the future. Do not use.
349         * </li>
350         * </ul>
351         * </p>
352         * <p>
353         * Hook methods must return <code>void</code>
354         * </p>
355         * <p>
356         * Hook methods method may throw a subclass of {@link BaseServerResponseException}, and processing
357         * will be aborted with an appropriate error returned to the client.
358         * </p>
359         */
360        SERVER_INCOMING_REQUEST_PRE_HANDLED(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                "ca.uhn.fhir.rest.server.interceptor.IServerInterceptor$ActionRequestDetails"
365        ),
366
367        /**
368         * <b>Server Hook:</b>
369         * This method is called upon any exception being thrown within the server's request processing code. This includes
370         * any exceptions thrown within resource provider methods (e.g. {@link Search} and {@link Read} methods) as well as
371         * any runtime exceptions thrown by the server itself. This hook method is invoked for each interceptor (until one of them
372         * returns a non-<code>null</code> response or the end of the list is reached), after which
373         * {@link #SERVER_HANDLE_EXCEPTION} is
374         * called for each interceptor.
375         * <p>
376         * This may be used to add an OperationOutcome to a response, or to convert between exception types for any reason.
377         * </p>
378         * <p>
379         * Implementations of this method may choose to ignore/log/count/etc exceptions, and return <code>null</code>. In
380         * this case, processing will continue, and the server will automatically generate an {@link BaseOperationOutcome
381         * OperationOutcome}. Implementations may also choose to provide their own response to the client. In this case, they
382         * should return a non-<code>null</code>, to indicate that they have handled the request and processing should stop.
383         * </p>
384         * <p>
385         * Hooks may accept the following parameters:
386         * <ul>
387         * <li>
388         * 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
389         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
390         * pulled out of the servlet request. Note that the bean
391         * properties are not all guaranteed to be populated, depending on how early during processing the
392         * exception occurred.
393         * </li>
394         * <li>
395         * 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
396         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
397         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
398         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
399         * </li>
400         * <li>
401         * java.lang.Throwable - The exception that was thrown. This will often be an instance of
402         * {@link BaseServerResponseException} but will not necessarily be one (e.g. it could be a
403         * {@link NullPointerException} in the case of a bug being triggered.
404         * </li>
405         * <li>
406         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
407         * </li>
408         * <li>
409         * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
410         * </li>
411         * </ul>
412         * <p>
413         * Hook methods may return a new exception to use for processing, or <code>null</code> if this interceptor is not trying to
414         * modify the exception. For example, if this interceptor has nothing to do with exception processing, it
415         * should always return <code>null</code>. If this interceptor adds an OperationOutcome to the exception, it
416         * should return an exception.
417         * </p>
418         */
419        SERVER_PRE_PROCESS_OUTGOING_EXCEPTION(BaseServerResponseException.class,
420                "ca.uhn.fhir.rest.api.server.RequestDetails",
421                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
422                "java.lang.Throwable",
423                "javax.servlet.http.HttpServletRequest",
424                "javax.servlet.http.HttpServletResponse"
425        ),
426
427        /**
428         * <b>Server Hook:</b>
429         * This method is called after the server implementation method has been called, but before any attempt
430         * to stream the response back to the client. Interceptors may examine or modify the response before it
431         * is returned, or even prevent the response.
432         * <p>
433         * Hooks may accept the following parameters:
434         * <ul>
435         * <li>
436         * 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
437         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
438         * pulled out of the servlet request.
439         * </li>
440         * <li>
441         * 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
442         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
443         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
444         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
445         * </li>
446         * <li>
447         * org.hl7.fhir.instance.model.api.IBaseResource - The resource that will be returned. This parameter may be <code>null</code> for some responses.
448         * </li>
449         * <li>
450         * 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.
451         * </li>
452         * <li>
453         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
454         * </li>
455         * <li>
456         * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
457         * </li>
458         * </ul>
459         * </p>
460         * <p>
461         * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally.
462         * This is generally the right thing to do. If your interceptor is providing a response rather than
463         * letting HAPI handle the response normally, you must return <code>false</code>. In this case,
464         * no further processing will occur and no further interceptors will be called.
465         * </p>
466         * <p>
467         * Hook methods may also throw {@link AuthenticationException} to indicate that the interceptor
468         * has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401
469         * will be returned to the client.
470         */
471        SERVER_OUTGOING_RESPONSE(boolean.class,
472                "ca.uhn.fhir.rest.api.server.RequestDetails",
473                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
474                "org.hl7.fhir.instance.model.api.IBaseResource",
475                "ca.uhn.fhir.rest.api.server.ResponseDetails",
476                "javax.servlet.http.HttpServletRequest",
477                "javax.servlet.http.HttpServletResponse"
478        ),
479
480
481        /**
482         * <b>Server Hook:</b>
483         * This method is called when a stream writer is generated that will be used to stream a non-binary response to
484         * a client. Hooks may return a wrapped writer which adds additional functionality as needed.
485         *
486         * <p>
487         * Hooks may accept the following parameters:
488         * <ul>
489         * <li>
490         * java.io.Writer - The response writing Writer. Typically a hook will wrap this writer and layer additional functionality
491         * into the wrapping writer.
492         * </li>
493         * <li>
494         * 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
495         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
496         * pulled out of the servlet request.
497         * </li>
498         * <li>
499         * 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
500         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
501         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
502         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
503         * </li>
504         * </ul>
505         * </p>
506         * <p>
507         * Hook methods should return a {@link Writer} instance that will be used to stream the response. Hook methods
508         * should not throw any exception.
509         * </p>
510         *
511         * @since 5.0.0
512         */
513        SERVER_OUTGOING_WRITER_CREATED(Writer.class,
514                "java.io.Writer",
515                "ca.uhn.fhir.rest.api.server.RequestDetails",
516                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
517        ),
518
519
520        /**
521         * <b>Server Hook:</b>
522         * This method is called after the server implementation method has been called, but before any attempt
523         * to stream the response back to the client, specifically for GraphQL requests (as these do not fit
524         * cleanly into the model provided by {@link #SERVER_OUTGOING_RESPONSE}).
525         * <p>
526         * Hooks may accept the following parameters:
527         * <ul>
528         * <li>
529         * 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
530         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
531         * pulled out of the servlet request.
532         * </li>
533         * <li>
534         * 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
535         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
536         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
537         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
538         * </li>
539         * <li>
540         * java.lang.String - The GraphQL query
541         * </li>
542         * <li>
543         * java.lang.String - The GraphQL response
544         * </li>
545         * <li>
546         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
547         * </li>
548         * <li>
549         * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
550         * </li>
551         * </ul>
552         * </p>
553         * <p>
554         * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally.
555         * This is generally the right thing to do. If your interceptor is providing a response rather than
556         * letting HAPI handle the response normally, you must return <code>false</code>. In this case,
557         * no further processing will occur and no further interceptors will be called.
558         * </p>
559         * <p>
560         * Hook methods may also throw {@link AuthenticationException} to indicate that the interceptor
561         * has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401
562         * will be returned to the client.
563         */
564        SERVER_OUTGOING_GRAPHQL_RESPONSE(boolean.class,
565                "ca.uhn.fhir.rest.api.server.RequestDetails",
566                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
567                "java.lang.String",
568                "java.lang.String",
569                "javax.servlet.http.HttpServletRequest",
570                "javax.servlet.http.HttpServletResponse"
571        ),
572
573
574        /**
575         * <b>Server Hook:</b>
576         * This method is called when an OperationOutcome is being returned in response to a failure.
577         * Hook methods may use this hook to modify the OperationOutcome being returned.
578         * <p>
579         * Hooks may accept the following parameters:
580         * <ul>
581         * <li>
582         * 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
583         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
584         * pulled out of the servlet request. Note that the bean
585         * properties are not all guaranteed to be populated, depending on how early during processing the
586         * exception occurred.
587         * </li>
588         * <li>
589         * 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
590         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
591         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
592         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
593         * </li>
594         * <li>
595         * org.hl7.fhir.instance.model.api.IBaseOperationOutcome - The OperationOutcome resource that will be
596         * returned.
597         * </ul>
598         * <p>
599         * Hook methods must return <code>void</code>
600         * </p>
601         */
602        SERVER_OUTGOING_FAILURE_OPERATIONOUTCOME(
603                void.class,
604                "ca.uhn.fhir.rest.api.server.RequestDetails",
605                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
606                "org.hl7.fhir.instance.model.api.IBaseOperationOutcome"
607        ),
608
609
610        /**
611         * <b>Server Hook:</b>
612         * This method is called after all processing is completed for a request, but only if the
613         * request completes normally (i.e. no exception is thrown).
614         * <p>
615         * Hooks may accept the following parameters:
616         * <ul>
617         * <li>
618         * 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
619         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
620         * pulled out of the servlet request.
621         * </li>
622         * <li>
623         * 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
624         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
625         * pulled out of the request. This will be null if the server is not deployed to a RestfulServer environment.
626         * </li>
627         * </ul>
628         * </p>
629         * <p>
630         * This method must return <code>void</code>
631         * </p>
632         * <p>
633         * This method should not throw any exceptions. Any exception that is thrown by this
634         * method will be logged, but otherwise not acted upon (i.e. even if a hook method
635         * throws an exception, processing will continue and other interceptors will be
636         * called). Therefore it is considered a bug to throw an exception from hook methods using this
637         * pointcut.
638         * </p>
639         */
640        SERVER_PROCESSING_COMPLETED_NORMALLY(
641                void.class,
642                new ExceptionHandlingSpec()
643                        .addLogAndSwallow(Throwable.class),
644                "ca.uhn.fhir.rest.api.server.RequestDetails",
645                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
646        ),
647
648        /**
649         * <b>Server Hook:</b>
650         * This method is called after all processing is completed for a request, regardless of whether
651         * the request completed successfully or not. It is called after {@link #SERVER_PROCESSING_COMPLETED_NORMALLY}
652         * in the case of successful operations.
653         * <p>
654         * Hooks may accept the following parameters:
655         * <ul>
656         * <li>
657         * 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
658         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
659         * pulled out of the servlet request.
660         * </li>
661         * <li>
662         * 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
663         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
664         * pulled out of the request. This will be null if the server is not deployed to a RestfulServer environment.
665         * </li>
666         * </ul>
667         * </p>
668         * <p>
669         * This method must return <code>void</code>
670         * </p>
671         * <p>
672         * This method should not throw any exceptions. Any exception that is thrown by this
673         * method will be logged, but otherwise not acted upon (i.e. even if a hook method
674         * throws an exception, processing will continue and other interceptors will be
675         * called). Therefore it is considered a bug to throw an exception from hook methods using this
676         * pointcut.
677         * </p>
678         */
679        SERVER_PROCESSING_COMPLETED(
680                void.class,
681                new ExceptionHandlingSpec()
682                        .addLogAndSwallow(Throwable.class),
683                "ca.uhn.fhir.rest.api.server.RequestDetails",
684                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
685        ),
686
687        /**
688         * <b>Subscription Hook:</b>
689         * Invoked whenever a persisted resource has been modified and is being submitted to the
690         * subscription processing pipeline. This method is called before the resource is placed
691         * on any queues for processing and executes synchronously during the resource modification
692         * operation itself, so it should return quickly.
693         * <p>
694         * Hooks may accept the following parameters:
695         * <ul>
696         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - Hooks may modify this parameter. This will affect the checking process.</li>
697         * </ul>
698         * </p>
699         * <p>
700         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
701         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
702         * returns <code>false</code>, subscription processing will not proceed for the given resource;
703         * </p>
704         */
705        SUBSCRIPTION_RESOURCE_MODIFIED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
706
707
708        /**
709         * <b>Subscription Hook:</b>
710         * Invoked any time that a resource is matched by an individual subscription, and
711         * is about to be queued for delivery.
712         * <p>
713         * Hooks may make changes to the delivery payload, or make changes to the
714         * canonical subscription such as adding headers, modifying the channel
715         * endpoint, etc.
716         * </p>
717         * Hooks may accept the following parameters:
718         * <ul>
719         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
720         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
721         * <li>ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult</li>
722         * </ul>
723         * <p>
724         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
725         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
726         * returns <code>false</code>, delivery will be aborted.
727         * </p>
728         */
729        SUBSCRIPTION_RESOURCE_MATCHED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage", "ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult"),
730
731        /**
732         * <b>Subscription Hook:</b>
733         * Invoked whenever a persisted resource was checked against all active subscriptions, and did not
734         * match any.
735         * <p>
736         * Hooks may accept the following parameters:
737         * <ul>
738         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - Hooks should not modify this parameter as changes will not have any effect.</li>
739         * </ul>
740         * </p>
741         * <p>
742         * Hooks should return <code>void</code>.
743         * </p>
744         */
745        SUBSCRIPTION_RESOURCE_DID_NOT_MATCH_ANY_SUBSCRIPTIONS(void.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
746
747        /**
748         * <b>Subscription Hook:</b>
749         * Invoked immediately before the delivery of a subscription, and right before any channel-specific
750         * hooks are invoked (e.g. {@link #SUBSCRIPTION_BEFORE_REST_HOOK_DELIVERY}.
751         * <p>
752         * Hooks may make changes to the delivery payload, or make changes to the
753         * canonical subscription such as adding headers, modifying the channel
754         * endpoint, etc.
755         * </p>
756         * Hooks may accept the following parameters:
757         * <ul>
758         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
759         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
760         * </ul>
761         * <p>
762         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
763         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
764         * returns <code>false</code>, processing will be aborted.
765         * </p>
766         */
767        SUBSCRIPTION_BEFORE_DELIVERY(boolean.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
768
769        /**
770         * <b>Subscription Hook:</b>
771         * Invoked immediately after the delivery of a subscription, and right before any channel-specific
772         * hooks are invoked (e.g. {@link #SUBSCRIPTION_AFTER_REST_HOOK_DELIVERY}.
773         * <p>
774         * Hooks may accept the following parameters:
775         * </p>
776         * <ul>
777         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
778         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
779         * </ul>
780         * <p>
781         * Hooks should return <code>void</code>.
782         * </p>
783         */
784        SUBSCRIPTION_AFTER_DELIVERY(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
785
786
787        /**
788         * <b>Subscription Hook:</b>
789         * Invoked immediately after the attempted delivery of a subscription, if the delivery
790         * failed.
791         * <p>
792         * Hooks may accept the following parameters:
793         * </p>
794         * <ul>
795         * <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>
796         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage - the message that triggered the exception</li>
797         * <li>java.lang.Exception</li>
798         * </ul>
799         * <p>
800         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
801         * <code>void</code> or <code>true</code>, processing will continue normally, meaning that
802         * an exception will be thrown by the delivery mechanism. This typically means that the
803         * message will be returned to the processing queue. If the method
804         * returns <code>false</code>, processing will be aborted and no further action will be
805         * taken for the delivery.
806         * </p>
807         */
808        SUBSCRIPTION_AFTER_DELIVERY_FAILED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage", "java.lang.Exception"),
809
810        /**
811         * <b>Subscription Hook:</b>
812         * Invoked immediately after the delivery of a REST HOOK subscription.
813         * <p>
814         * When this hook is called, all processing is complete so this hook should not
815         * make any changes to the parameters.
816         * </p>
817         * Hooks may accept the following parameters:
818         * <ul>
819         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
820         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
821         * </ul>
822         * <p>
823         * Hooks should return <code>void</code>.
824         * </p>
825         */
826        SUBSCRIPTION_AFTER_REST_HOOK_DELIVERY(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
827
828        /**
829         * <b>Subscription Hook:</b>
830         * Invoked immediately before the delivery of a REST HOOK subscription.
831         * <p>
832         * Hooks may make changes to the delivery payload, or make changes to the
833         * canonical subscription such as adding headers, modifying the channel
834         * endpoint, etc.
835         * </p>
836         * Hooks may accept the following parameters:
837         * <ul>
838         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
839         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
840         * </ul>
841         * <p>
842         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
843         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
844         * returns <code>false</code>, processing will be aborted.
845         * </p>
846         */
847        SUBSCRIPTION_BEFORE_REST_HOOK_DELIVERY(boolean.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
848
849        /**
850         * <b>Subscription Hook:</b>
851         * Invoked immediately after the delivery of MESSAGE subscription.
852         * <p>
853         * When this hook is called, all processing is complete so this hook should not
854         * make any changes to the parameters.
855         * </p>
856         * Hooks may accept the following parameters:
857         * <ul>
858         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
859         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
860         * </ul>
861         * <p>
862         * Hooks should return <code>void</code>.
863         * </p>
864         */
865        SUBSCRIPTION_AFTER_MESSAGE_DELIVERY(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
866
867        /**
868         * <b>Subscription Hook:</b>
869         * Invoked immediately before the delivery of a MESSAGE subscription.
870         * <p>
871         * Hooks may make changes to the delivery payload, or make changes to the
872         * canonical subscription such as adding headers, modifying the channel
873         * endpoint, etc.
874         * Furthermore, you may modify the outgoing message wrapper, for example adding headers via ResourceModifiedJsonMessage field.
875         *
876         * </p>
877         * Hooks may accept the following parameters:
878         * <ul>
879         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
880         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
881         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage</li>
882         *
883         * </ul>
884         * <p>
885         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
886         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
887         * returns <code>false</code>, processing will be aborted.
888         * </p>
889         */
890        SUBSCRIPTION_BEFORE_MESSAGE_DELIVERY(boolean.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage", "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage"),
891
892
893        /**
894         * <b>Subscription Hook:</b>
895         * Invoked whenever a persisted resource (a resource that has just been stored in the
896         * database via a create/update/patch/etc.) is about to be checked for whether any subscriptions
897         * were triggered as a result of the operation.
898         * <p>
899         * Hooks may accept the following parameters:
900         * <ul>
901         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - Hooks may modify this parameter. This will affect the checking process.</li>
902         * </ul>
903         * </p>
904         * <p>
905         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
906         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
907         * returns <code>false</code>, processing will be aborted.
908         * </p>
909         */
910        SUBSCRIPTION_BEFORE_PERSISTED_RESOURCE_CHECKED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
911
912
913        /**
914         * <b>Subscription Hook:</b>
915         * Invoked whenever a persisted resource (a resource that has just been stored in the
916         * database via a create/update/patch/etc.) has been checked for whether any subscriptions
917         * were triggered as a result of the operation.
918         * <p>
919         * Hooks may accept the following parameters:
920         * <ul>
921         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - This parameter should not be modified as processing is complete when this hook is invoked.</li>
922         * </ul>
923         * </p>
924         * <p>
925         * Hooks should return <code>void</code>.
926         * </p>
927         */
928        SUBSCRIPTION_AFTER_PERSISTED_RESOURCE_CHECKED(void.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
929
930
931        /**
932         * <b>Subscription Hook:</b>
933         * Invoked immediately after an active subscription is "registered". In HAPI FHIR, when
934         * a subscription
935         * <p>
936         * Hooks may make changes to the canonicalized subscription and this will have an effect
937         * on processing across this server. Note however that timing issues may occur, since the
938         * subscription is already technically live by the time this hook is called.
939         * </p>
940         * Hooks may accept the following parameters:
941         * <ul>
942         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
943         * </ul>
944         * <p>
945         * Hooks should return <code>void</code>.
946         * </p>
947         */
948        SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_REGISTERED(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription"),
949
950        /**
951         * <b>Subscription Hook:</b>
952         * Invoked immediately after an active subscription is "registered". In HAPI FHIR, when
953         * a subscription
954         * <p>
955         * Hooks may make changes to the canonicalized subscription and this will have an effect
956         * on processing across this server. Note however that timing issues may occur, since the
957         * subscription is already technically live by the time this hook is called.
958         * </p>
959         * No parameters are currently supported.
960         * <p>
961         * Hooks should return <code>void</code>.
962         * </p>
963         */
964        SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_UNREGISTERED(void.class),
965
966        /**
967         * <b>Storage Hook:</b>
968         * Invoked when a resource is being deleted in a cascaded delete. This means that
969         * some other resource is being deleted, but per use request or other
970         * policy, the given resource (the one supplied as a parameter to this hook)
971         * is also being deleted.
972         * <p>
973         * Hooks may accept the following parameters:
974         * </p>
975         * <ul>
976         * <li>
977         * 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
978         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
979         * pulled out of the servlet request. Note that the bean
980         * properties are not all guaranteed to be populated, depending on how early during processing the
981         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
982         * known, such as while processing searches</b>
983         * </li>
984         * <li>
985         * 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
986         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
987         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
988         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
989         * </li>
990         * <li>
991         * ca.uhn.fhir.jpa.util.DeleteConflictList - Contains the details about the delete conflicts that are
992         * being resolved via deletion. The source resource is the resource that will be deleted, and
993         * is a cascade because the target resource is already being deleted.
994         * </li>
995         * <li>
996         * org.hl7.fhir.instance.model.api.IBaseResource - The actual resource that is about to be deleted via a cascading delete
997         * </li>
998         * </ul>
999         * <p>
1000         * Hooks should return <code>void</code>. They may choose to throw an exception however, in
1001         * which case the delete should be rolled back.
1002         * </p>
1003         */
1004        STORAGE_CASCADE_DELETE(
1005                void.class,
1006                "ca.uhn.fhir.rest.api.server.RequestDetails",
1007                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1008                "ca.uhn.fhir.jpa.api.model.DeleteConflictList",
1009                "org.hl7.fhir.instance.model.api.IBaseResource"
1010        ),
1011
1012
1013        /**
1014         * <b>Storage Hook:</b>
1015         * Invoked when a Bulk Export job is being kicked off. Hook methods may modify
1016         * the request, or raise an exception to prevent it from being initiated.
1017         * <p>
1018         * Hooks may accept the following parameters:
1019         * </p>
1020         * <ul>
1021         * <li>
1022         * ca.uhn.fhir.jpa.bulk.export.api.BulkDataExportOptions - The details of the job being kicked off
1023         * </li>
1024         * <li>
1025         * 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
1026         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1027         * pulled out of the servlet request. Note that the bean
1028         * properties are not all guaranteed to be populated, depending on how early during processing the
1029         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1030         * known, such as while processing searches</b>
1031         * </li>
1032         * <li>
1033         * 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
1034         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1035         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1036         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1037         * </li>
1038         * </ul>
1039         * <p>
1040         * Hooks should return <code>void</code>, and can throw exceptions.
1041         * </p>
1042         */
1043        STORAGE_INITIATE_BULK_EXPORT(
1044                void.class,
1045                "ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions",
1046                "ca.uhn.fhir.rest.api.server.RequestDetails",
1047                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1048        ),
1049        /**
1050         * <b>Storage Hook:</b>
1051         * Invoked when a set of resources are about to be deleted and expunged via url like http://localhost/Patient?active=false&_expunge=true
1052         * <p>
1053         * Hooks may accept the following parameters:
1054         * </p>
1055         * <ul>
1056         * <li>
1057         * 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
1058         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1059         * pulled out of the servlet request. Note that the bean
1060         * properties are not all guaranteed to be populated, depending on how early during processing the
1061         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1062         * known, such as while processing searches</b>
1063         * </li>
1064         * <li>
1065         * 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
1066         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1067         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1068         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1069         * </li>
1070         * <li>
1071         * java.lang.String - Contains the url used to delete and expunge the resources
1072         * </li>
1073         * </ul>
1074         * <p>
1075         * Hooks should return <code>void</code>. They may choose to throw an exception however, in
1076         * which case the delete expunge will not occur.
1077         * </p>
1078         */
1079
1080        STORAGE_PRE_DELETE_EXPUNGE(
1081                void.class,
1082                "ca.uhn.fhir.rest.api.server.RequestDetails",
1083                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1084                "java.lang.String"
1085        ),
1086
1087        /**
1088         * <b>Storage Hook:</b>
1089         * Invoked when a batch of resource pids are about to be deleted and expunged via url like http://localhost/Patient?active=false&_expunge=true
1090         * <p>
1091         * Hooks may accept the following parameters:
1092         * </p>
1093         * <ul>
1094         * <li>
1095         * java.lang.String - the name of the resource type being deleted
1096         * </li>
1097         * <li>
1098         * java.util.List - the list of Long pids of the resources about to be deleted
1099         * </li>
1100         * <li>
1101         * java.util.concurrent.atomic.AtomicLong - holds a running tally of all entities deleted so far.
1102         * If the pointcut callback deletes any entities, then this parameter should be incremented by the total number
1103         * of additional entities deleted.
1104         * </li>
1105         * <li>
1106         * 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
1107         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1108         * pulled out of the servlet request. Note that the bean
1109         * properties are not all guaranteed to be populated, depending on how early during processing the
1110         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1111         * known, such as while processing searches</b>
1112         * </li>
1113         * <li>
1114         * 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
1115         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1116         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1117         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1118         * </li>
1119         * <li>
1120         * java.lang.String - Contains the url used to delete and expunge the resources
1121         * </li>
1122         * </ul>
1123         * <p>
1124         * Hooks should return <code>void</code>. They may choose to throw an exception however, in
1125         * which case the delete expunge will not occur.
1126         * </p>
1127         */
1128
1129        STORAGE_PRE_DELETE_EXPUNGE_PID_LIST(
1130                void.class,
1131                "java.lang.String",
1132                "java.util.List",
1133                "java.util.concurrent.atomic.AtomicLong",
1134                "ca.uhn.fhir.rest.api.server.RequestDetails",
1135                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1136        ),
1137
1138        /**
1139         * <b>Storage Hook:</b>
1140         * Invoked when one or more resources may be returned to the user, whether as a part of a READ,
1141         * a SEARCH, or even as the response to a CREATE/UPDATE, etc.
1142         * <p>
1143         * This hook is invoked when a resource has been loaded by the storage engine and
1144         * is being returned to the HTTP stack for response. This is not a guarantee that the
1145         * client will ultimately see it, since filters/headers/etc may affect what
1146         * is returned but if a resource is loaded it is likely to be used.
1147         * Note also that caching may affect whether this pointcut is invoked.
1148         * </p>
1149         * <p>
1150         * Hooks will have access to the contents of the resource being returned
1151         * and may choose to make modifications. These changes will be reflected in
1152         * returned resource but have no effect on storage.
1153         * </p>
1154         * Hooks may accept the following parameters:
1155         * <ul>
1156         * <li>
1157         * ca.uhn.fhir.rest.api.server.IPreResourceAccessDetails - Contains details about the
1158         * specific resources being returned.
1159         * </li>
1160         * <li>
1161         * 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
1162         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1163         * pulled out of the servlet request. Note that the bean
1164         * properties are not all guaranteed to be populated, depending on how early during processing the
1165         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1166         * known, such as while processing searches</b>
1167         * </li>
1168         * <li>
1169         * 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
1170         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1171         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1172         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1173         * </li>
1174         * </ul>
1175         * <p>
1176         * Hooks should return <code>void</code>.
1177         * </p>
1178         */
1179        STORAGE_PREACCESS_RESOURCES(void.class,
1180                "ca.uhn.fhir.rest.api.server.IPreResourceAccessDetails",
1181                "ca.uhn.fhir.rest.api.server.RequestDetails",
1182                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1183        ),
1184
1185        /**
1186         * <b>Storage Hook:</b>
1187         * Invoked when the storage engine is about to check for the existence of a pre-cached search
1188         * whose results match the given search parameters.
1189         * <p>
1190         * Hooks may accept the following parameters:
1191         * </p>
1192         * <ul>
1193         * <li>
1194         * ca.uhn.fhir.jpa.searchparam.SearchParameterMap - Contains the details of the search being checked
1195         * </li>
1196         * <li>
1197         * 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
1198         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1199         * pulled out of the servlet request. Note that the bean
1200         * properties are not all guaranteed to be populated, depending on how early during processing the
1201         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1202         * known, such as while processing searches</b>
1203         * </li>
1204         * <li>
1205         * 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
1206         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1207         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1208         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1209         * </li>
1210         * </ul>
1211         * <p>
1212         * Hooks may return <code>boolean</code>. If the hook method returns
1213         * <code>false</code>, the server will not attempt to check for a cached
1214         * search no matter what.
1215         * </p>
1216         */
1217        STORAGE_PRECHECK_FOR_CACHED_SEARCH(boolean.class,
1218                "ca.uhn.fhir.jpa.searchparam.SearchParameterMap",
1219                "ca.uhn.fhir.rest.api.server.RequestDetails",
1220                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1221        ),
1222
1223        /**
1224         * <b>Storage Hook:</b>
1225         * Invoked when a search is starting, prior to creating a record for the search.
1226         * <p>
1227         * Hooks may accept the following parameters:
1228         * </p>
1229         * <ul>
1230         * <li>
1231         * ca.uhn.fhir.rest.server.util.ICachedSearchDetails - Contains the details of the search that
1232         * is being created and initialized
1233         * </li>
1234         * <li>
1235         * 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
1236         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1237         * pulled out of the servlet request. Note that the bean
1238         * properties are not all guaranteed to be populated, depending on how early during processing the
1239         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1240         * known, such as while processing searches</b>
1241         * </li>
1242         * <li>
1243         * 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
1244         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1245         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1246         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1247         * </li>
1248         * <li>
1249         * ca.uhn.fhir.jpa.searchparam.SearchParameterMap - Contains the details of the search being checked. This can be modified.
1250         * </li>
1251         * </ul>
1252         * <p>
1253         * Hooks should return <code>void</code>.
1254         * </p>
1255         */
1256        STORAGE_PRESEARCH_REGISTERED(void.class,
1257                "ca.uhn.fhir.rest.server.util.ICachedSearchDetails",
1258                "ca.uhn.fhir.rest.api.server.RequestDetails",
1259                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1260                "ca.uhn.fhir.jpa.searchparam.SearchParameterMap"
1261        ),
1262
1263        /**
1264         * <b>Storage Hook:</b>
1265         * Invoked when one or more resources may be returned to the user, whether as a part of a READ,
1266         * a SEARCH, or even as the response to a CREATE/UPDATE, etc.
1267         * <p>
1268         * This hook is invoked when a resource has been loaded by the storage engine and
1269         * is being returned to the HTTP stack for response.
1270         * This is not a guarantee that the
1271         * client will ultimately see it, since filters/headers/etc may affect what
1272         * is returned but if a resource is loaded it is likely to be used.
1273         * Note also that caching may affect whether this pointcut is invoked.
1274         * </p>
1275         * <p>
1276         * Hooks will have access to the contents of the resource being returned
1277         * and may choose to make modifications. These changes will be reflected in
1278         * returned resource but have no effect on storage.
1279         * </p>
1280         * Hooks may accept the following parameters:
1281         * <ul>
1282         * <li>
1283         * ca.uhn.fhir.rest.api.server.IPreResourceShowDetails - Contains the resources that
1284         * will be shown to the user. This object may be manipulated in order to modify
1285         * the actual resources being shown to the user (e.g. for masking)
1286         * </li>
1287         * <li>
1288         * 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
1289         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1290         * pulled out of the servlet request. Note that the bean
1291         * properties are not all guaranteed to be populated, depending on how early during processing the
1292         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1293         * known, such as while processing searches</b>
1294         * </li>
1295         * <li>
1296         * 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
1297         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1298         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1299         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1300         * </li>
1301         * </ul>
1302         * <p>
1303         * Hooks should return <code>void</code>.
1304         * </p>
1305         */
1306        STORAGE_PRESHOW_RESOURCES(void.class,
1307                "ca.uhn.fhir.rest.api.server.IPreResourceShowDetails",
1308                "ca.uhn.fhir.rest.api.server.RequestDetails",
1309                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1310        ),
1311
1312        /**
1313         * <b>Storage Hook:</b>
1314         * Invoked before a resource will be created, immediately before the resource
1315         * is persisted to the database.
1316         * <p>
1317         * Hooks will have access to the contents of the resource being created
1318         * and may choose to make modifications to it. These changes will be
1319         * reflected in permanent storage.
1320         * </p>
1321         * Hooks may accept the following parameters:
1322         * <ul>
1323         * <li>org.hl7.fhir.instance.model.api.IBaseResource</li>
1324         * <li>
1325         * 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
1326         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1327         * pulled out of the servlet request. Note that the bean
1328         * properties are not all guaranteed to be populated, depending on how early during processing the
1329         * exception occurred.
1330         * </li>
1331         * <li>
1332         * 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
1333         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1334         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1335         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1336         * </li>
1337         * <li>
1338         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1339         * </li>
1340         * </ul>
1341         * <p>
1342         * Hooks should return <code>void</code>.
1343         * </p>
1344         */
1345        STORAGE_PRESTORAGE_RESOURCE_CREATED(void.class,
1346                "org.hl7.fhir.instance.model.api.IBaseResource",
1347                "ca.uhn.fhir.rest.api.server.RequestDetails",
1348                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1349                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1350        ),
1351
1352        /**
1353         * <b>Storage Hook:</b>
1354         * Invoked before client-assigned id is created.
1355         * <p>
1356         * Hooks will have access to the contents of the resource being created
1357         * so that client-assigned ids can be allowed/denied. These changes will
1358         * be reflected in permanent storage.
1359         * </p>
1360         * Hooks may accept the following parameters:
1361         * <ul>
1362         * <li>org.hl7.fhir.instance.model.api.IBaseResource</li>
1363         * <li>
1364         * 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
1365         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1366         * pulled out of the servlet request. Note that the bean
1367         * properties are not all guaranteed to be populated, depending on how early during processing the
1368         * exception occurred.
1369         * </li>
1370         * </ul>
1371         * <p>
1372         * Hooks should return <code>void</code>.
1373         * </p>
1374         */
1375        STORAGE_PRESTORAGE_CLIENT_ASSIGNED_ID(void.class,
1376                "org.hl7.fhir.instance.model.api.IBaseResource",
1377                "ca.uhn.fhir.rest.api.server.RequestDetails"
1378        ),
1379
1380        /**
1381         * <b>Storage Hook:</b>
1382         * Invoked before a resource will be updated, immediately before the resource
1383         * is persisted to the database.
1384         * <p>
1385         * Hooks will have access to the contents of the resource being updated
1386         * (both the previous and new contents) and may choose to make modifications
1387         * to the new contents of the resource. These changes will be reflected in
1388         * permanent storage.
1389         * </p>
1390         * Hooks may accept the following parameters:
1391         * <ul>
1392         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The previous contents of the resource being updated</li>
1393         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The new contents of the resource being updated</li>
1394         * <li>
1395         * 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
1396         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1397         * pulled out of the servlet request. Note that the bean
1398         * properties are not all guaranteed to be populated, depending on how early during processing the
1399         * exception occurred.
1400         * </li>
1401         * <li>
1402         * 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
1403         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1404         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1405         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1406         * </li>
1407         * <li>
1408         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1409         * </li>
1410         * </ul>
1411         * <p>
1412         * Hooks should return <code>void</code>.
1413         * </p>
1414         */
1415        STORAGE_PRESTORAGE_RESOURCE_UPDATED(void.class,
1416                "org.hl7.fhir.instance.model.api.IBaseResource",
1417                "org.hl7.fhir.instance.model.api.IBaseResource",
1418                "ca.uhn.fhir.rest.api.server.RequestDetails",
1419                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1420                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1421        ),
1422
1423        /**
1424         * <b>Storage Hook:</b>
1425         * Invoked before a resource will be created, immediately before the resource
1426         * is persisted to the database.
1427         * <p>
1428         * Hooks will have access to the contents of the resource being created
1429         * and may choose to make modifications to it. These changes will be
1430         * reflected in permanent storage.
1431         * </p>
1432         * Hooks may accept the following parameters:
1433         * <ul>
1434         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li>
1435         * <li>
1436         * 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
1437         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1438         * pulled out of the servlet request. Note that the bean
1439         * properties are not all guaranteed to be populated, depending on how early during processing the
1440         * exception occurred.
1441         * </li>
1442         * <li>
1443         * 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
1444         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1445         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1446         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1447         * </li>
1448         * <li>
1449         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1450         * </li>
1451         * </ul>
1452         * <p>
1453         * Hooks should return <code>void</code>.
1454         * </p>
1455         */
1456        STORAGE_PRESTORAGE_RESOURCE_DELETED(void.class,
1457                "org.hl7.fhir.instance.model.api.IBaseResource",
1458                "ca.uhn.fhir.rest.api.server.RequestDetails",
1459                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1460                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1461        ),
1462
1463
1464        /**
1465         * <b>Storage Hook:</b>
1466         * Invoked before a resource will be created, immediately before the transaction
1467         * is committed (after all validation and other business rules have successfully
1468         * completed, and any other database activity is complete.
1469         * <p>
1470         * Hooks will have access to the contents of the resource being created
1471         * but should generally not make any
1472         * changes as storage has already occurred. Changes will not be reflected
1473         * in storage, but may be reflected in the HTTP response.
1474         * </p>
1475         * Hooks may accept the following parameters:
1476         * <ul>
1477         * <li>org.hl7.fhir.instance.model.api.IBaseResource</li>
1478         * <li>
1479         * 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
1480         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1481         * pulled out of the servlet request. Note that the bean
1482         * properties are not all guaranteed to be populated, depending on how early during processing the
1483         * exception occurred.
1484         * </li>
1485         * <li>
1486         * 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
1487         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1488         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1489         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1490         * </li>
1491         * <li>
1492         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1493         * </li>
1494         * <li>
1495         * Boolean - Whether this pointcut invocation was deferred or not(since 5.4.0)
1496         * </li>
1497         * <li>
1498         * ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum - The timing at which the invocation of the interceptor took place. Options are ACTIVE and DEFERRED.
1499         * </li>
1500         * </ul>
1501         * <p>
1502         * Hooks should return <code>void</code>.
1503         * </p>
1504         */
1505        STORAGE_PRECOMMIT_RESOURCE_CREATED(void.class,
1506                "org.hl7.fhir.instance.model.api.IBaseResource",
1507                "ca.uhn.fhir.rest.api.server.RequestDetails",
1508                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1509                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
1510                "ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum"
1511        ),
1512
1513        /**
1514         * <b>Storage Hook:</b>
1515         * Invoked before a resource will be updated, immediately before the transaction
1516         * is committed (after all validation and other business rules have successfully
1517         * completed, and any other database activity is complete.
1518         * <p>
1519         * Hooks will have access to the contents of the resource being updated
1520         * (both the previous and new contents) but should generally not make any
1521         * changes as storage has already occurred. Changes will not be reflected
1522         * in storage, but may be reflected in the HTTP response.
1523         * </p>
1524         * Hooks may accept the following parameters:
1525         * <ul>
1526         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The previous contents of the resource</li>
1527         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The proposed new contents of the resource</li>
1528         * <li>
1529         * 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
1530         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1531         * pulled out of the servlet request. Note that the bean
1532         * properties are not all guaranteed to be populated, depending on how early during processing the
1533         * exception occurred.
1534         * </li>
1535         * <li>
1536         * 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
1537         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1538         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1539         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1540         * </li>
1541         * <li>
1542         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1543         * </li>
1544         * <li>
1545         * ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum - The timing at which the invocation of the interceptor took place. Options are ACTIVE and DEFERRED.
1546         * </li>
1547         * </ul>
1548         * <p>
1549         * Hooks should return <code>void</code>.
1550         * </p>
1551         */
1552        STORAGE_PRECOMMIT_RESOURCE_UPDATED(void.class,
1553                "org.hl7.fhir.instance.model.api.IBaseResource",
1554                "org.hl7.fhir.instance.model.api.IBaseResource",
1555                "ca.uhn.fhir.rest.api.server.RequestDetails",
1556                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1557                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
1558                "ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum"
1559        ),
1560
1561
1562        /**
1563         * <b>Storage Hook:</b>
1564         * Invoked before a resource will be deleted
1565         * <p>
1566         * Hooks will have access to the contents of the resource being deleted
1567         * but should not make any changes as storage has already occurred
1568         * </p>
1569         * Hooks may accept the following parameters:
1570         * <ul>
1571         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li>
1572         * <li>
1573         * 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
1574         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1575         * pulled out of the servlet request. Note that the bean
1576         * properties are not all guaranteed to be populated, depending on how early during processing the
1577         * exception occurred.
1578         * </li>
1579         * <li>
1580         * 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
1581         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1582         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1583         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1584         * </li>
1585         * <li>
1586         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1587         * </li>
1588         * <li>
1589         * ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum - The timing at which the invocation of the interceptor took place. Options are ACTIVE and DEFERRED.
1590         * </li>
1591         * </ul>
1592         * <p>
1593         * Hooks should return <code>void</code>.
1594         * </p>
1595         */
1596        STORAGE_PRECOMMIT_RESOURCE_DELETED(void.class,
1597                "org.hl7.fhir.instance.model.api.IBaseResource",
1598                "ca.uhn.fhir.rest.api.server.RequestDetails",
1599                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1600                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
1601                "ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum"
1602        ),
1603
1604        /**
1605         * <b>Storage Hook:</b>
1606         * Invoked after all entries in a transaction bundle have been executed
1607         * <p>
1608         * Hooks will have access to the original bundle, as well as all the deferred interceptor broadcasts related to the
1609         * processing of the transaction bundle
1610         * </p>
1611         * Hooks may accept the following parameters:
1612         * <ul>
1613         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li>
1614         * <li>
1615         * 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
1616         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1617         * pulled out of the servlet request. Note that the bean
1618         * properties are not all guaranteed to be populated, depending on how early during processing the
1619         * exception occurred.
1620         * </li>
1621         * <li>
1622         * 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
1623         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1624         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1625         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1626         * </li>
1627         * <li>
1628         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1629         * </li>
1630         * <li>
1631         * ca.uhn.fhir.rest.api.server.storage.DeferredInterceptorBroadcasts- A collection of pointcut invocations and their parameters which were deferred.
1632         * </li>
1633         * </ul>
1634         * <p>
1635         * Hooks should return <code>void</code>.
1636         * </p>
1637         */
1638        STORAGE_TRANSACTION_PROCESSED(void.class,
1639                "org.hl7.fhir.instance.model.api.IBaseBundle",
1640                "ca.uhn.fhir.rest.api.server.storage.DeferredInterceptorBroadcasts",
1641                "ca.uhn.fhir.rest.api.server.RequestDetails",
1642                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1643                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1644        ),
1645
1646
1647        /**
1648         * <b>Storage Hook:</b>
1649         * Invoked during a FHIR transaction, immediately before processing all write operations (i.e. immediately
1650         * before a database transaction will be opened)
1651         * <p>
1652         * Hooks may accept the following parameters:
1653         * </p>
1654         * <ul>
1655         * <li>
1656         * ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails - Contains details about the transaction that is about to start
1657         * </li>
1658         * <li>
1659         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1660         * </li>
1661         * </ul>
1662         * <p>
1663         * Hooks should return <code>void</code>.
1664         * </p>
1665         */
1666        STORAGE_TRANSACTION_WRITE_OPERATIONS_PRE(void.class,
1667                "ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails",
1668                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1669        ),
1670
1671        /**
1672         * <b>Storage Hook:</b>
1673         * Invoked during a FHIR transaction, immediately after processing all write operations (i.e. immediately
1674         * after the transaction has been committed or rolled back). This hook will always be called if
1675         * {@link #STORAGE_TRANSACTION_WRITE_OPERATIONS_PRE} has been called, regardless of whether the operation
1676         * succeeded or failed.
1677         * <p>
1678         * Hooks may accept the following parameters:
1679         * </p>
1680         * <ul>
1681         * <li>
1682         * ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails - Contains details about the transaction that is about to start
1683         * </li>
1684         * <li>
1685         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1686         * </li>
1687         * </ul>
1688         * <p>
1689         * Hooks should return <code>void</code>.
1690         * </p>
1691         */
1692        STORAGE_TRANSACTION_WRITE_OPERATIONS_POST(void.class,
1693                "ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails",
1694                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1695        ),
1696
1697        /**
1698         * <b>Storage Hook:</b>
1699         * 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}.
1700         * <p>
1701         * Hooks will have access to the list of resources that have references to the resource being deleted.
1702         * </p>
1703         * Hooks may accept the following parameters:
1704         * <ul>
1705         * <li>ca.uhn.fhir.jpa.api.model.DeleteConflictList - The list of delete conflicts</li>
1706         * <li>
1707         * 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
1708         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1709         * pulled out of the servlet request. Note that the bean
1710         * properties are not all guaranteed to be populated, depending on how early during processing the
1711         * exception occurred.
1712         * </li>
1713         * <li>
1714         * 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
1715         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1716         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1717         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1718         * </li>
1719         * <li>
1720         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1721         * </li>
1722         * </ul>
1723         * <p>
1724         * Hooks should return <code>ca.uhn.fhir.jpa.delete.DeleteConflictOutcome</code>.
1725         * If the interceptor returns a non-null result, the DeleteConflictOutcome can be
1726         * used to indicate a number of times to retry.
1727         * </p>
1728         */
1729        STORAGE_PRESTORAGE_DELETE_CONFLICTS(
1730                // Return type
1731                "ca.uhn.fhir.jpa.delete.DeleteConflictOutcome",
1732                // Params
1733                "ca.uhn.fhir.jpa.api.model.DeleteConflictList",
1734                "ca.uhn.fhir.rest.api.server.RequestDetails",
1735                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1736                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1737        ),
1738
1739        /**
1740         * <b>Storage Hook:</b>
1741         * Invoked before a resource is about to be expunged via the <code>$expunge</code> operation.
1742         * <p>
1743         * Hooks will be passed a reference to a counter containing the current number of records that have been deleted.
1744         * If the hook deletes any records, the hook is expected to increment this counter by the number of records deleted.
1745         * </p>
1746         * <p>
1747         * Hooks may accept the following parameters:
1748         * </p>
1749         * <ul>
1750         * <li>java.util.concurrent.atomic.AtomicInteger - The counter holding the number of records deleted.</li>
1751         * <li>org.hl7.fhir.instance.model.api.IIdType - The ID of the resource that is about to be deleted</li>
1752         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource that is about to be deleted</li>
1753         * <li>
1754         * 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
1755         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1756         * pulled out of the servlet request. Note that the bean
1757         * properties are not all guaranteed to be populated, depending on how early during processing the
1758         * exception occurred.
1759         * </li>
1760         * <li>
1761         * 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
1762         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1763         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1764         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1765         * </li>
1766         * </ul>
1767         * <p>
1768         * Hooks should return void.
1769         * </p>
1770         */
1771        STORAGE_PRESTORAGE_EXPUNGE_RESOURCE(
1772                // Return type
1773                void.class,
1774                // Params
1775                "java.util.concurrent.atomic.AtomicInteger",
1776                "org.hl7.fhir.instance.model.api.IIdType",
1777                "org.hl7.fhir.instance.model.api.IBaseResource",
1778                "ca.uhn.fhir.rest.api.server.RequestDetails",
1779                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1780        ),
1781
1782        /**
1783         * <b>Storage Hook:</b>
1784         * Invoked before an <code>$expunge</code> operation on all data (expungeEverything) is called.
1785         * <p>
1786         * Hooks will be passed a reference to a counter containing the current number of records that have been deleted.
1787         * If the hook deletes any records, the hook is expected to increment this counter by the number of records deleted.
1788         * </p>
1789         * Hooks may accept the following parameters:
1790         * <ul>
1791         * <li>java.util.concurrent.atomic.AtomicInteger - The counter holding the number of records deleted.</li>
1792         * <li>
1793         * 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
1794         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1795         * pulled out of the servlet request. Note that the bean
1796         * properties are not all guaranteed to be populated, depending on how early during processing the
1797         * exception occurred.
1798         * </li>
1799         * <li>
1800         * 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
1801         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1802         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1803         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1804         * </li>
1805         * </ul>
1806         * <p>
1807         * Hooks should return void.
1808         * </p>
1809         */
1810        STORAGE_PRESTORAGE_EXPUNGE_EVERYTHING(
1811                // Return type
1812                void.class,
1813                // Params
1814                "java.util.concurrent.atomic.AtomicInteger",
1815                "ca.uhn.fhir.rest.api.server.RequestDetails",
1816                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1817        ),
1818
1819        /**
1820         * <b>Storage Hook:</b>
1821         * Invoked before FHIR <b>create</b> operation to request the identification of the partition ID to be associated
1822         * with the resource being created. This hook will only be called if partitioning is enabled in the JPA
1823         * server.
1824         * <p>
1825         * Hooks may accept the following parameters:
1826         * </p>
1827         * <ul>
1828         * <li>
1829         * org.hl7.fhir.instance.model.api.IBaseResource - The resource that will be created and needs a tenant ID assigned.
1830         * </li>
1831         * <li>
1832         * 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
1833         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1834         * pulled out of the servlet request. Note that the bean
1835         * properties are not all guaranteed to be populated, depending on how early during processing the
1836         * exception occurred.
1837         * </li>
1838         * <li>
1839         * 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
1840         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1841         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1842         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1843         * </li>
1844         * </ul>
1845         * <p>
1846         * Hooks must return an instance of <code>ca.uhn.fhir.interceptor.model.RequestPartitionId</code>.
1847         * </p>
1848         */
1849        STORAGE_PARTITION_IDENTIFY_CREATE(
1850                // Return type
1851                "ca.uhn.fhir.interceptor.model.RequestPartitionId",
1852                // Params
1853                "org.hl7.fhir.instance.model.api.IBaseResource",
1854                "ca.uhn.fhir.rest.api.server.RequestDetails",
1855                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1856        ),
1857
1858        /**
1859         * <b>Storage Hook:</b>
1860         * Invoked before FHIR read/access operation (e.g. <b>read/vread</b>, <b>search</b>, <b>history</b>, etc.) operation to request the
1861         * identification of the partition ID to be associated with the resource(s) being searched for, read, etc.
1862         * <p>
1863         * This hook will only be called if
1864         * partitioning is enabled in the JPA server.
1865         * </p>
1866         * <p>
1867         * Hooks may accept the following parameters:
1868         * </p>
1869         * <ul>
1870         * <li>
1871         * 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
1872         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1873         * pulled out of the servlet request. Note that the bean
1874         * properties are not all guaranteed to be populated, depending on how early during processing the
1875         * exception occurred.
1876         * </li>
1877         * <li>
1878         * 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
1879         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1880         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1881         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1882         * </li>
1883         * <li>ca.uhn.fhir.interceptor.model.ReadPartitionIdRequestDetails - Contains details about what is being read</li>
1884         * </ul>
1885         * <p>
1886         * Hooks must return an instance of <code>ca.uhn.fhir.interceptor.model.RequestPartitionId</code>.
1887         * </p>
1888         */
1889        STORAGE_PARTITION_IDENTIFY_READ(
1890                // Return type
1891                "ca.uhn.fhir.interceptor.model.RequestPartitionId",
1892                // Params
1893                "ca.uhn.fhir.rest.api.server.RequestDetails",
1894                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1895                "ca.uhn.fhir.interceptor.model.ReadPartitionIdRequestDetails"
1896        ),
1897
1898        /**
1899         * <b>Storage Hook:</b>
1900         * Invoked before any partition aware FHIR operation, when the selected partition has been identified (ie. after the
1901         * {@link #STORAGE_PARTITION_IDENTIFY_CREATE} or {@link #STORAGE_PARTITION_IDENTIFY_READ} hook was called. This allows
1902         * a separate hook to register, and potentially make decisions about whether the request should be allowed to proceed.
1903         * <p>
1904         * This hook will only be called if
1905         * partitioning is enabled in the JPA server.
1906         * </p>
1907         * <p>
1908         * Hooks may accept the following parameters:
1909         * </p>
1910         * <ul>
1911         * <li>
1912         * ca.uhn.fhir.interceptor.model.RequestPartitionId - The partition ID that was selected
1913         * </li>
1914         * <li>
1915         * 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
1916         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1917         * pulled out of the servlet request. Note that the bean
1918         * properties are not all guaranteed to be populated, depending on how early during processing the
1919         * exception occurred.
1920         * </li>
1921         * <li>
1922         * 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
1923         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1924         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1925         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1926         * </li>
1927         * <li>
1928         * ca.uhn.fhir.context.RuntimeResourceDefinition - the resource type being accessed
1929         * </li>
1930         * </ul>
1931         * <p>
1932         * Hooks must return void.
1933         * </p>
1934         */
1935        STORAGE_PARTITION_SELECTED(
1936                // Return type
1937                void.class,
1938                // Params
1939                "ca.uhn.fhir.interceptor.model.RequestPartitionId",
1940                "ca.uhn.fhir.rest.api.server.RequestDetails",
1941                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1942                "ca.uhn.fhir.context.RuntimeResourceDefinition"
1943        ),
1944
1945        /**
1946         * <b>Storage Hook:</b>
1947         * Invoked when a transaction has been rolled back as a result of a {@link ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException},
1948         * meaning that a database constraint has been violated. This pointcut allows an interceptor to specify a resolution strategy
1949         * other than simply returning the error to the client. This interceptor will be fired after the database transaction rollback
1950         * has been completed.
1951         * <p>
1952         * Hooks may accept the following parameters:
1953         * </p>
1954         * <ul>
1955         * <li>
1956         * 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
1957         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1958         * pulled out of the servlet request. Note that the bean
1959         * properties are not all guaranteed to be populated, depending on how early during processing the
1960         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1961         * known, such as while processing searches</b>
1962         * </li>
1963         * <li>
1964         * 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
1965         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1966         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1967         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1968         * </li>
1969         * </ul>
1970         * <p>
1971         * Hooks should return <code>ca.uhn.fhir.jpa.api.model.ResourceVersionConflictResolutionStrategy</code>. Hooks should not
1972         * throw any exception.
1973         * </p>
1974         */
1975        STORAGE_VERSION_CONFLICT(
1976                "ca.uhn.fhir.jpa.api.model.ResourceVersionConflictResolutionStrategy",
1977                "ca.uhn.fhir.rest.api.server.RequestDetails",
1978                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1979        ),
1980
1981        /**
1982         * <b>Validation Hook:</b>
1983         * This hook is called after validation has completed, regardless of whether the validation was successful or failed.
1984         * Typically this is used to modify validation results.
1985         * <p>
1986         * <b>Note on validation Pointcuts:</b> The HAPI FHIR interceptor framework is a part of the client and server frameworks and
1987         * not a part of the core FhirContext. Therefore this Pointcut is invoked by the
1988         * </p>
1989         * <p>
1990         * Hooks may accept the following parameters:
1991         * <ul>
1992         * <li>
1993         * org.hl7.fhir.instance.model.api.IBaseResource - The resource being validated, if a parsed version is available (null otherwise)
1994         * </li>
1995         * <li>
1996         * java.lang.String - The resource being validated, if a raw version is available (null otherwise)
1997         * </li>
1998         * <li>
1999         * ca.uhn.fhir.validation.ValidationResult - The outcome of the validation. Hooks methods should not modify this object, but they can return a new one.
2000         * </li>
2001         * </ul>
2002         * </p>
2003         * 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.
2004         */
2005        VALIDATION_COMPLETED(ValidationResult.class,
2006                "org.hl7.fhir.instance.model.api.IBaseResource",
2007                "java.lang.String",
2008                "ca.uhn.fhir.validation.ValidationResult"
2009        ),
2010
2011
2012        /**
2013         * <b>MDM(EMPI) Hook:</b>
2014         * Invoked whenever a persisted resource (a resource that has just been stored in the
2015         * database via a create/update/patch/etc.) has been matched against related resources and MDM links have been updated.
2016         * <p>
2017         * Hooks may accept the following parameters:
2018         * <ul>
2019         * <li>ca.uhn.fhir.rest.server.messaging.ResourceOperationMessage - This parameter should not be modified as processing is complete when this hook is invoked.</li>
2020         * <li>ca.uhn.fhir.rest.server.TransactionLogMessages - This parameter is for informational messages provided by the MDM module during MDM processing.</li>
2021         * <li>ca.uhn.fhir.mdm.api.MdmLinkChangeEvent - Contains information about the change event, including target and golden resource IDs and the operation type.</li>
2022         * </ul>
2023         * </p>
2024         * <p>
2025         * Hooks should return <code>void</code>.
2026         * </p>
2027         */
2028        MDM_AFTER_PERSISTED_RESOURCE_CHECKED(void.class,
2029                "ca.uhn.fhir.rest.server.messaging.ResourceOperationMessage",
2030                "ca.uhn.fhir.rest.server.TransactionLogMessages",
2031                "ca.uhn.fhir.mdm.api.MdmLinkEvent"),
2032
2033        /**
2034         * <b>Performance Tracing Hook:</b>
2035         * This hook is invoked when any informational messages generated by the
2036         * SearchCoordinator are created. It is typically used to provide logging
2037         * or capture details related to a specific request.
2038         * <p>
2039         * Note that this is a performance tracing hook. Use with caution in production
2040         * systems, since calling it may (or may not) carry a cost.
2041         * </p>
2042         * Hooks may accept the following parameters:
2043         * <ul>
2044         * <li>
2045         * 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
2046         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2047         * pulled out of the servlet request. Note that the bean
2048         * properties are not all guaranteed to be populated, depending on how early during processing the
2049         * exception occurred.
2050         * </li>
2051         * <li>
2052         * 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
2053         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2054         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2055         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2056         * </li>
2057         * <li>
2058         * ca.uhn.fhir.jpa.model.search.StorageProcessingMessage - Contains the message
2059         * </li>
2060         * </ul>
2061         * <p>
2062         * Hooks should return <code>void</code>.
2063         * </p>
2064         */
2065        JPA_PERFTRACE_INFO(void.class,
2066                "ca.uhn.fhir.rest.api.server.RequestDetails",
2067                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2068                "ca.uhn.fhir.jpa.model.search.StorageProcessingMessage"
2069        ),
2070
2071        /**
2072         * <b>Performance Tracing Hook:</b>
2073         * This hook is invoked when any warning messages generated by the
2074         * SearchCoordinator are created. It is typically used to provide logging
2075         * or capture details related to a specific request.
2076         * <p>
2077         * Note that this is a performance tracing hook. Use with caution in production
2078         * systems, since calling it may (or may not) carry a cost.
2079         * </p>
2080         * Hooks may accept the following parameters:
2081         * <ul>
2082         * <li>
2083         * 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
2084         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2085         * pulled out of the servlet request. Note that the bean
2086         * properties are not all guaranteed to be populated, depending on how early during processing the
2087         * exception occurred.
2088         * </li>
2089         * <li>
2090         * 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
2091         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2092         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2093         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2094         * </li>
2095         * <li>
2096         * ca.uhn.fhir.jpa.model.search.StorageProcessingMessage - Contains the message
2097         * </li>
2098         * </ul>
2099         * <p>
2100         * Hooks should return <code>void</code>.
2101         * </p>
2102         */
2103        JPA_PERFTRACE_WARNING(void.class,
2104                "ca.uhn.fhir.rest.api.server.RequestDetails",
2105                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2106                "ca.uhn.fhir.jpa.model.search.StorageProcessingMessage"
2107        ),
2108
2109        /**
2110         * <b>Performance Tracing Hook:</b>
2111         * This hook is invoked when a search has returned the very first result
2112         * from the database. The timing on this call can be a good indicator of how
2113         * performant a query is in general.
2114         * <p>
2115         * Note that this is a performance tracing hook. Use with caution in production
2116         * systems, since calling it may (or may not) carry a cost.
2117         * </p>
2118         * Hooks may accept the following parameters:
2119         * <ul>
2120         * <li>
2121         * 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
2122         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2123         * pulled out of the servlet request. Note that the bean
2124         * properties are not all guaranteed to be populated, depending on how early during processing the
2125         * exception occurred.
2126         * </li>
2127         * <li>
2128         * 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
2129         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2130         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2131         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2132         * </li>
2133         * <li>
2134         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2135         * performed. Hooks should not modify this object.
2136         * </li>
2137         * </ul>
2138         * <p>
2139         * Hooks should return <code>void</code>.
2140         * </p>
2141         */
2142        JPA_PERFTRACE_SEARCH_FIRST_RESULT_LOADED(void.class,
2143                "ca.uhn.fhir.rest.api.server.RequestDetails",
2144                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2145                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
2146        ),
2147
2148        /**
2149         * <b>Performance Tracing Hook:</b>
2150         * This hook is invoked when an individual search query SQL SELECT statement
2151         * has completed and no more results are available from that query. Note that this
2152         * doesn't necessarily mean that no more matching results exist in the database,
2153         * since HAPI FHIR JPA batch loads results in to the query cache in chunks in order
2154         * to provide predicable results without overloading memory or the database.
2155         * <p>
2156         * Note that this is a performance tracing hook. Use with caution in production
2157         * systems, since calling it may (or may not) carry a cost.
2158         * </p>
2159         * Hooks may accept the following parameters:
2160         * <ul>
2161         * <li>
2162         * 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
2163         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2164         * pulled out of the servlet request. Note that the bean
2165         * properties are not all guaranteed to be populated, depending on how early during processing the
2166         * exception occurred.
2167         * </li>
2168         * <li>
2169         * 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
2170         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2171         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2172         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2173         * </li>
2174         * <li>
2175         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2176         * performed. Hooks should not modify this object.
2177         * </li>
2178         * </ul>
2179         * <p>
2180         * Hooks should return <code>void</code>.
2181         * </p>
2182         */
2183        JPA_PERFTRACE_SEARCH_SELECT_COMPLETE(void.class,
2184                "ca.uhn.fhir.rest.api.server.RequestDetails",
2185                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2186                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
2187        ),
2188
2189
2190        /**
2191         * <b>Performance Tracing Hook:</b>
2192         * This hook is invoked when a search has failed for any reason. When this pointcut
2193         * is invoked, the search has completed unsuccessfully and will not be continued.
2194         * <p>
2195         * Note that this is a performance tracing hook. Use with caution in production
2196         * systems, since calling it may (or may not) carry a cost.
2197         * </p>
2198         * Hooks may accept the following parameters:
2199         * <ul>
2200         * <li>
2201         * 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
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. Note that the bean
2204         * properties are not all guaranteed to be populated, depending on how early during processing the
2205         * exception occurred.
2206         * </li>
2207         * <li>
2208         * 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
2209         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2210         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2211         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2212         * </li>
2213         * <li>
2214         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2215         * performed. Hooks should not modify this object.
2216         * </li>
2217         * </ul>
2218         * <p>
2219         * Hooks should return <code>void</code>.
2220         * </p>
2221         */
2222        JPA_PERFTRACE_SEARCH_FAILED(void.class,
2223                "ca.uhn.fhir.rest.api.server.RequestDetails",
2224                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2225                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
2226        ),
2227
2228        /**
2229         * <b>Performance Tracing Hook:</b>
2230         * This hook is invoked when a search has completed. When this pointcut
2231         * is invoked, a pass in the Search Coordinator has completed successfully, but
2232         * not all possible resources have been loaded yet so a future paging request
2233         * may trigger a new task that will load further resources.
2234         * <p>
2235         * Note that this is a performance tracing hook. Use with caution in production
2236         * systems, since calling it may (or may not) carry a cost.
2237         * </p>
2238         * Hooks may accept the following parameters:
2239         * <ul>
2240         * <li>
2241         * 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
2242         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2243         * pulled out of the servlet request. Note that the bean
2244         * properties are not all guaranteed to be populated, depending on how early during processing the
2245         * exception occurred.
2246         * </li>
2247         * <li>
2248         * 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
2249         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2250         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2251         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2252         * </li>
2253         * <li>
2254         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2255         * performed. Hooks should not modify this object.
2256         * </li>
2257         * </ul>
2258         * <p>
2259         * Hooks should return <code>void</code>.
2260         * </p>
2261         */
2262        JPA_PERFTRACE_SEARCH_PASS_COMPLETE(void.class,
2263                "ca.uhn.fhir.rest.api.server.RequestDetails",
2264                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2265                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
2266        ),
2267
2268        /**
2269         * <b>Performance Tracing Hook:</b>
2270         * This hook is invoked when a query involving an external index (e.g. Elasticsearch) has completed. When this pointcut
2271         * is invoked, an initial list of resource IDs has been generated which will be used as part of a subsequent database query.
2272         * <p>
2273         * Note that this is a performance tracing hook. Use with caution in production
2274         * systems, since calling it may (or may not) carry a cost.
2275         * </p>
2276         * Hooks may accept the following parameters:
2277         * <ul>
2278         * <li>
2279         * 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
2280         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2281         * pulled out of the servlet request. Note that the bean
2282         * properties are not all guaranteed to be populated, depending on how early during processing the
2283         * exception occurred.
2284         * </li>
2285         * <li>
2286         * 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
2287         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2288         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2289         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2290         * </li>
2291         * <li>
2292         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2293         * performed. Hooks should not modify this object.
2294         * </li>
2295         * </ul>
2296         * <p>
2297         * Hooks should return <code>void</code>.
2298         * </p>
2299         */
2300        JPA_PERFTRACE_INDEXSEARCH_QUERY_COMPLETE(void.class,
2301                "ca.uhn.fhir.rest.api.server.RequestDetails",
2302                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2303                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
2304        ),
2305
2306        /**
2307         * <b>Performance Tracing Hook:</b>
2308         * Invoked when the storage engine is about to reuse the results of
2309         * a previously cached search.
2310         * <p>
2311         * Note that this is a performance tracing hook. Use with caution in production
2312         * systems, since calling it may (or may not) carry a cost.
2313         * </p>
2314         * <p>
2315         * Hooks may accept the following parameters:
2316         * </p>
2317         * <ul>
2318         * <li>
2319         * ca.uhn.fhir.jpa.searchparam.SearchParameterMap - Contains the details of the search being checked
2320         * </li>
2321         * <li>
2322         * 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
2323         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2324         * pulled out of the servlet request. Note that the bean
2325         * properties are not all guaranteed to be populated, depending on how early during processing the
2326         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
2327         * known, such as while processing searches</b>
2328         * </li>
2329         * <li>
2330         * 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
2331         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2332         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2333         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2334         * </li>
2335         * </ul>
2336         * <p>
2337         * Hooks should return <code>void</code>.
2338         * </p>
2339         */
2340        JPA_PERFTRACE_SEARCH_REUSING_CACHED(boolean.class,
2341                "ca.uhn.fhir.jpa.searchparam.SearchParameterMap",
2342                "ca.uhn.fhir.rest.api.server.RequestDetails",
2343                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
2344        ),
2345
2346        /**
2347         * <b>Performance Tracing Hook:</b>
2348         * This hook is invoked when a search has failed for any reason. When this pointcut
2349         * is invoked, a pass in the Search Coordinator has completed successfully, and all
2350         * possible results have been fetched and loaded into the query cache.
2351         * <p>
2352         * Note that this is a performance tracing hook. Use with caution in production
2353         * systems, since calling it may (or may not) carry a cost.
2354         * </p>
2355         * Hooks may accept the following parameters:
2356         * <ul>
2357         * <li>
2358         * 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
2359         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2360         * pulled out of the servlet request. Note that the bean
2361         * properties are not all guaranteed to be populated, depending on how early during processing the
2362         * exception occurred.
2363         * </li>
2364         * <li>
2365         * 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
2366         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2367         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2368         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2369         * </li>
2370         * <li>
2371         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2372         * performed. Hooks should not modify this object.
2373         * </li>
2374         * </ul>
2375         * <p>
2376         * Hooks should return <code>void</code>.
2377         * </p>
2378         */
2379        JPA_PERFTRACE_SEARCH_COMPLETE(void.class,
2380                "ca.uhn.fhir.rest.api.server.RequestDetails",
2381                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2382                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
2383        ),
2384
2385
2386        /**
2387         * <b>Performance Tracing Hook:</b>
2388         * <p>
2389         * This hook is invoked when a search has found an individual ID.
2390         * </p>
2391         * <p>
2392         * THIS IS AN EXPERIMENTAL HOOK AND MAY BE REMOVED OR CHANGED WITHOUT WARNING.
2393         * </p>
2394         * <p>
2395         * Note that this is a performance tracing hook. Use with caution in production
2396         * systems, since calling it may (or may not) carry a cost.
2397         * </p>
2398         * <p>
2399         * Hooks may accept the following parameters:
2400         * </p>
2401         * <ul>
2402         * <li>
2403         * java.lang.Integer - The query ID
2404         * </li>
2405         * <li>
2406         * java.lang.Object - The ID
2407         * </li>
2408         * </ul>
2409         * <p>
2410         * Hooks should return <code>void</code>.
2411         * </p>
2412         */
2413        JPA_PERFTRACE_SEARCH_FOUND_ID(void.class,
2414                "java.lang.Integer",
2415                "java.lang.Object"
2416        ),
2417
2418
2419        /**
2420         * <b>Performance Tracing Hook:</b>
2421         * This hook is invoked when a query has executed, and includes the raw SQL
2422         * statements that were executed against the database.
2423         * <p>
2424         * Note that this is a performance tracing hook. Use with caution in production
2425         * systems, since calling it may (or may not) carry a cost.
2426         * </p>
2427         * <p>
2428         * Hooks may accept the following parameters:
2429         * </p>
2430         * <ul>
2431         * <li>
2432         * 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
2433         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2434         * pulled out of the servlet request. Note that the bean
2435         * properties are not all guaranteed to be populated, depending on how early during processing the
2436         * exception occurred.
2437         * </li>
2438         * <li>
2439         * 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
2440         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2441         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2442         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2443         * </li>
2444         * <li>
2445         * ca.uhn.fhir.jpa.util.SqlQueryList - Contains details about the raw SQL queries.
2446         * </li>
2447         * </ul>
2448         * <p>
2449         * Hooks should return <code>void</code>.
2450         * </p>
2451         */
2452        JPA_PERFTRACE_RAW_SQL(void.class,
2453                "ca.uhn.fhir.rest.api.server.RequestDetails",
2454                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2455                "ca.uhn.fhir.jpa.util.SqlQueryList"
2456        ),
2457
2458        /**
2459         * This pointcut is used only for unit tests. Do not use in production code as it may be changed or
2460         * removed at any time.
2461         */
2462        TEST_RB(
2463                boolean.class,
2464                new ExceptionHandlingSpec().addLogAndSwallow(IllegalStateException.class),
2465                String.class.getName(),
2466                String.class.getName()),
2467
2468        /**
2469         * This pointcut is used only for unit tests. Do not use in production code as it may be changed or
2470         * removed at any time.
2471         */
2472        TEST_RO(BaseServerResponseException.class, String.class.getName(), String.class.getName());
2473
2474        private final List<String> myParameterTypes;
2475        private final Class<?> myReturnType;
2476        private final ExceptionHandlingSpec myExceptionHandlingSpec;
2477
2478        Pointcut(@Nonnull String theReturnType, String... theParameterTypes) {
2479                this(toReturnTypeClass(theReturnType), new ExceptionHandlingSpec(), theParameterTypes);
2480        }
2481
2482        Pointcut(@Nonnull Class<?> theReturnType, @Nonnull ExceptionHandlingSpec theExceptionHandlingSpec, String... theParameterTypes) {
2483                myReturnType = theReturnType;
2484                myExceptionHandlingSpec = theExceptionHandlingSpec;
2485                myParameterTypes = Collections.unmodifiableList(Arrays.asList(theParameterTypes));
2486        }
2487
2488        Pointcut(@Nonnull Class<?> theReturnType, String... theParameterTypes) {
2489                this(theReturnType, new ExceptionHandlingSpec(), theParameterTypes);
2490        }
2491
2492        @Override
2493        public boolean isShouldLogAndSwallowException(@Nonnull Throwable theException) {
2494                for (Class<? extends Throwable> next : myExceptionHandlingSpec.myTypesToLogAndSwallow) {
2495                        if (next.isAssignableFrom(theException.getClass())) {
2496                                return true;
2497                        }
2498                }
2499                return false;
2500        }
2501
2502        @Override
2503        @Nonnull
2504        public Class<?> getReturnType() {
2505                return myReturnType;
2506        }
2507
2508        @Override
2509        @Nonnull
2510        public List<String> getParameterTypes() {
2511                return myParameterTypes;
2512        }
2513
2514        private static class UnknownType {
2515        }
2516
2517        private static class ExceptionHandlingSpec {
2518
2519                private final Set<Class<? extends Throwable>> myTypesToLogAndSwallow = new HashSet<>();
2520
2521                ExceptionHandlingSpec addLogAndSwallow(@Nonnull Class<? extends Throwable> theType) {
2522                        myTypesToLogAndSwallow.add(theType);
2523                        return this;
2524                }
2525
2526        }
2527
2528        private static Class<?> toReturnTypeClass(String theReturnType) {
2529                try {
2530                        return Class.forName(theReturnType);
2531                } catch (ClassNotFoundException theE) {
2532                        return UnknownType.class;
2533                }
2534        }
2535
2536}