001package ca.uhn.fhir.interceptor.api;
002
003/*-
004 * #%L
005 * HAPI FHIR - Core Library
006 * %%
007 * Copyright (C) 2014 - 2020 University Health Network
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;
028
029import javax.annotation.Nonnull;
030import java.io.Writer;
031import java.util.Arrays;
032import java.util.Collections;
033import java.util.HashSet;
034import java.util.List;
035import java.util.Set;
036
037/**
038 * Value for {@link Hook#value()}
039 * <p>
040 * Hook pointcuts are divided into several broad categories:
041 * <ul>
042 * <li>INTERCEPTOR_xxx: Hooks on the interceptor infrastructure itself</li>
043 * <li>CLIENT_xxx: Hooks on the HAPI FHIR Client framework</li>
044 * <li>SERVER_xxx: Hooks on the HAPI FHIR Server framework</li>
045 * <li>SUBSCRIPTION_xxx: Hooks on the HAPI FHIR Subscription framework</li>
046 * <li>STORAGE_xxx: Hooks on the storage engine</li>
047 * <li>JPA_PERFTRACE_xxx: Performance tracing hooks on the JPA server</li>
048 * </ul>
049 * </p>
050 */
051public enum Pointcut {
052
053        /**
054         * <b>Interceptor Framework Hook:</b>
055         * This pointcut will be called once when a given interceptor is registered
056         */
057        INTERCEPTOR_REGISTERED(void.class),
058
059        /**
060         * <b>Client Hook:</b>
061         * This hook is called before an HTTP client request is sent
062         * <p>
063         * Hooks may accept the following parameters:
064         * <ul>
065         * <li>
066         * ca.uhn.fhir.rest.client.api.IHttpRequest - The details of the request
067         * </li>
068         * <li>
069         *    ca.uhn.fhir.rest.client.api.IRestfulClient - The client object making the request
070         * </li>
071         * </ul>
072         * </p>
073         * Hook methods must return <code>void</code>.
074         */
075        CLIENT_REQUEST(void.class,
076                "ca.uhn.fhir.rest.client.api.IHttpRequest",
077                "ca.uhn.fhir.rest.client.api.IRestfulClient"
078        ),
079
080        /**
081         * <b>Client Hook:</b>
082         * This hook is called after an HTTP client request has completed, prior to returning
083         * the results to the calling code. Hook methods may modify the response.
084         * <p>
085         * Hooks may accept the following parameters:
086         * <ul>
087         * <li>
088         * ca.uhn.fhir.rest.client.api.IHttpRequest - The details of the request
089         * </li>
090         * <li>
091         * ca.uhn.fhir.rest.client.api.IHttpResponse - The details of the response
092         * </li>
093         * <li>
094         *    ca.uhn.fhir.rest.client.api.IRestfulClient - The client object making the request
095         * </li>
096         * </ul>
097         * </p>
098         * Hook methods must return <code>void</code>.
099         */
100        CLIENT_RESPONSE(void.class,
101                "ca.uhn.fhir.rest.client.api.IHttpRequest",
102                "ca.uhn.fhir.rest.client.api.IHttpResponse",
103                "ca.uhn.fhir.rest.client.api.IRestfulClient"
104        ),
105
106        /**
107         * <b>Server Hook:</b>
108         * This hook is called before any other processing takes place for each incoming request. It may be used to provide
109         * alternate handling for some requests, or to screen requests before they are handled, etc.
110         * <p>
111         * Note that any exceptions thrown by this method will not be trapped by HAPI (they will be passed up to the server)
112         * </p>
113         * <p>
114         * Hooks may accept the following parameters:
115         * <ul>
116         * <li>
117         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
118         * </li>
119         * <li>
120         * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
121         * </li>
122         * </ul>
123         * </p>
124         * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally.
125         * This is generally the right thing to do. If your interceptor is providing a response rather than
126         * letting HAPI handle the response normally, you must return <code>false</code>. In this case,
127         * no further processing will occur and no further interceptors will be called.
128         */
129        SERVER_INCOMING_REQUEST_PRE_PROCESSED(boolean.class,
130                "javax.servlet.http.HttpServletRequest",
131                "javax.servlet.http.HttpServletResponse"
132        ),
133
134        /**
135         * <b>Server Hook:</b>
136         * This hook is invoked upon any exception being thrown within the server's request processing code. This includes
137         * any exceptions thrown within resource provider methods (e.g. {@link Search} and {@link Read} methods) as well as
138         * any runtime exceptions thrown by the server itself. This also includes any {@link AuthenticationException}
139         * thrown.
140         * <p>
141         * Hooks may accept the following parameters:
142         * <ul>
143         * <li>
144         * 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
145         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
146         * pulled out of the servlet request. Note that the bean
147         * properties are not all guaranteed to be populated, depending on how early during processing the
148         * exception occurred.
149         * </li>
150         * <li>
151         * 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
152         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
153         * pulled out of the servlet request. Note that the bean
154         * properties are not all guaranteed to be populated, depending on how early during processing the
155         * exception occurred. This parameter is identical to the RequestDetails parameter above but will
156         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
157         * </li>
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         * <li>
165         * ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException - The exception that was thrown
166         * </li>
167         * </ul>
168         * </p>
169         * <p>
170         * Implementations of this method may choose to ignore/log/count/etc exceptions, and return <code>true</code> or
171         * <code>void</code>. In
172         * this case, processing will continue, and the server will automatically generate an {@link BaseOperationOutcome
173         * OperationOutcome}. Implementations may also choose to provide their own response to the client. In this case, they
174         * should return <code>false</code>, to indicate that they have handled the request and processing should stop.
175         * </p>
176         */
177        SERVER_HANDLE_EXCEPTION(boolean.class,
178                "ca.uhn.fhir.rest.api.server.RequestDetails",
179                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
180                "javax.servlet.http.HttpServletRequest",
181                "javax.servlet.http.HttpServletResponse",
182                "ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException"
183        ),
184
185        /**
186         * <b>Server Hook:</b>
187         * This method is called just before the actual implementing server method is invoked.
188         * <p>
189         * Hooks may accept the following parameters:
190         * <ul>
191         * <li>
192         * 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
193         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
194         * pulled out of the servlet request. Note that the bean
195         * properties are not all guaranteed to be populated, depending on how early during processing the
196         * exception occurred.
197         * </li>
198         * <li>
199         * 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
200         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
201         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
202         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
203         * </li>
204         * <li>
205         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
206         * </li>
207         * <li>
208         * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
209         * </li>
210         * </ul>
211         * <p>
212         * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally.
213         * This is generally the right thing to do.
214         * If your interceptor is providing an HTTP response rather than letting HAPI handle the response normally, you
215         * must return <code>false</code>. In this case, no further processing will occur and no further interceptors
216         * will be called.
217         * </p>
218         * <p>
219         * Hook methods may also throw {@link AuthenticationException} if they would like. This exception may be thrown
220         * to indicate that the interceptor has detected an unauthorized access
221         * attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client.
222         */
223        SERVER_INCOMING_REQUEST_POST_PROCESSED(boolean.class,
224                "ca.uhn.fhir.rest.api.server.RequestDetails",
225                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
226                "javax.servlet.http.HttpServletRequest",
227                "javax.servlet.http.HttpServletResponse"
228        ),
229
230
231        /**
232         * <b>Server Hook:</b>
233         * This hook is invoked before an incoming request is processed. Note that this method is called
234         * after the server has begun preparing the response to the incoming client request.
235         * As such, it is not able to supply a response to the incoming request in the way that
236         * SERVER_INCOMING_REQUEST_PRE_PROCESSED and
237         * {@link #SERVER_INCOMING_REQUEST_POST_PROCESSED}
238         * are.
239         * <p>
240         * Hooks may accept the following parameters:
241         * <ul>
242         * <li>
243         * 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
244         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
245         * pulled out of the servlet request. Note that the bean
246         * properties are not all guaranteed to be populated, depending on how early during processing the
247         * exception occurred.
248         * </li>
249         * <li>
250         * 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
251         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
252         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
253         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
254         * </li>
255         * <li>
256         * ca.uhn.fhir.rest.api.RestOperationTypeEnum - The type of operation that the FHIR server has determined that the client is trying to invoke
257         * </li>
258         * <li>
259         * 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.
260         * </li>
261         * </ul>
262         * </p>
263         * <p>
264         * Hook methods must return <code>void</code>
265         * </p>
266         * <p>
267         * Hook methods method may throw a subclass of {@link BaseServerResponseException}, and processing
268         * will be aborted with an appropriate error returned to the client.
269         * </p>
270         */
271        SERVER_INCOMING_REQUEST_PRE_HANDLED(void.class,
272                "ca.uhn.fhir.rest.api.server.RequestDetails",
273                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
274                "ca.uhn.fhir.rest.api.RestOperationTypeEnum",
275                "ca.uhn.fhir.rest.server.interceptor.IServerInterceptor$ActionRequestDetails"
276        ),
277
278        /**
279         * <b>Server Hook:</b>
280         * This method is called upon any exception being thrown within the server's request processing code. This includes
281         * any exceptions thrown within resource provider methods (e.g. {@link Search} and {@link Read} methods) as well as
282         * any runtime exceptions thrown by the server itself. This hook method is invoked for each interceptor (until one of them
283         * returns a non-<code>null</code> response or the end of the list is reached), after which
284         * {@link #SERVER_HANDLE_EXCEPTION} is
285         * called for each interceptor.
286         * <p>
287         * This may be used to add an OperationOutcome to a response, or to convert between exception types for any reason.
288         * </p>
289         * <p>
290         * Implementations of this method may choose to ignore/log/count/etc exceptions, and return <code>null</code>. In
291         * this case, processing will continue, and the server will automatically generate an {@link BaseOperationOutcome
292         * OperationOutcome}. Implementations may also choose to provide their own response to the client. In this case, they
293         * should return a non-<code>null</code>, to indicate that they have handled the request and processing should stop.
294         * </p>
295         * <p>
296         * Hooks may accept the following parameters:
297         * <ul>
298         * <li>
299         * 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
300         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
301         * pulled out of the servlet request. Note that the bean
302         * properties are not all guaranteed to be populated, depending on how early during processing the
303         * exception occurred.
304         * </li>
305         * <li>
306         * 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
307         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
308         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
309         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
310         * </li>
311         * <li>
312         * java.lang.Throwable - The exception that was thrown. This will often be an instance of
313         * {@link BaseServerResponseException} but will not necessarily be one (e.g. it could be a
314         * {@link NullPointerException} in the case of a bug being triggered.
315         * </li>
316         * <li>
317         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
318         * </li>
319         * <li>
320         * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
321         * </li>
322         * </ul>
323         * <p>
324         * Hook methods may return a new exception to use for processing, or <code>null</code> if this interceptor is not trying to
325         * modify the exception. For example, if this interceptor has nothing to do with exception processing, it
326         * should always return <code>null</code>. If this interceptor adds an OperationOutcome to the exception, it
327         * should return an exception.
328         * </p>
329         */
330        SERVER_PRE_PROCESS_OUTGOING_EXCEPTION(BaseServerResponseException.class,
331                "ca.uhn.fhir.rest.api.server.RequestDetails",
332                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
333                "java.lang.Throwable",
334                "javax.servlet.http.HttpServletRequest",
335                "javax.servlet.http.HttpServletResponse"
336        ),
337
338        /**
339         * <b>Server Hook:</b>
340         * This method is called after the server implementation method has been called, but before any attempt
341         * to stream the response back to the client. Interceptors may examine or modify the response before it
342         * is returned, or even prevent the response.
343         * <p>
344         * Hooks may accept the following parameters:
345         * <ul>
346         * <li>
347         * 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
348         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
349         * pulled out of the servlet request.
350         * </li>
351         * <li>
352         * 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
353         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
354         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
355         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
356         * </li>
357         * <li>
358         * org.hl7.fhir.instance.model.api.IBaseResource - The resource that will be returned. This parameter may be <code>null</code> for some responses.
359         * </li>
360         * <li>
361         * 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.
362         * </li>
363         * <li>
364         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
365         * </li>
366         * <li>
367         * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
368         * </li>
369         * </ul>
370         * </p>
371         * <p>
372         * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally.
373         * This is generally the right thing to do. If your interceptor is providing a response rather than
374         * letting HAPI handle the response normally, you must return <code>false</code>. In this case,
375         * no further processing will occur and no further interceptors will be called.
376         * </p>
377         * <p>
378         * Hook methods may also throw {@link AuthenticationException} to indicate that the interceptor
379         * has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401
380         * will be returned to the client.
381         */
382        SERVER_OUTGOING_RESPONSE(boolean.class,
383                "ca.uhn.fhir.rest.api.server.RequestDetails",
384                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
385                "org.hl7.fhir.instance.model.api.IBaseResource",
386                "ca.uhn.fhir.rest.api.server.ResponseDetails",
387                "javax.servlet.http.HttpServletRequest",
388                "javax.servlet.http.HttpServletResponse"
389        ),
390
391
392        /**
393         * <b>Server Hook:</b>
394         * This method is called when a stream writer is generated that will be used to stream a non-binary response to
395         * a client. Hooks may return a wrapped writer which adds additional functionality as needed.
396         *
397         * <p>
398         * Hooks may accept the following parameters:
399         * <ul>
400         * <li>
401         * java.io.Writer - The response writing Writer. Typically a hook will wrap this writer and layer additional functionality
402         * into the wrapping writer.
403         * </li>
404         * <li>
405         * 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
406         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
407         * pulled out of the servlet request.
408         * </li>
409         * <li>
410         * 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
411         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
412         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
413         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
414         * </li>
415         * </ul>
416         * </p>
417         * <p>
418         * Hook methods should return a {@link Writer} instance that will be used to stream the response. Hook methods
419         * should not throw any exception.
420         * </p>
421         *
422         * @since 5.0.0
423         */
424        SERVER_OUTGOING_WRITER_CREATED(Writer.class,
425                "java.io.Writer",
426                "ca.uhn.fhir.rest.api.server.RequestDetails",
427                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
428        ),
429
430
431        /**
432         * <b>Server Hook:</b>
433         * This method is called after the server implementation method has been called, but before any attempt
434         * to stream the response back to the client, specifically for GraphQL requests (as these do not fit
435         * cleanly into the model provided by {@link #SERVER_OUTGOING_RESPONSE}).
436         * <p>
437         * Hooks may accept the following parameters:
438         * <ul>
439         * <li>
440         * 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
441         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
442         * pulled out of the servlet request.
443         * </li>
444         * <li>
445         * 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
446         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
447         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
448         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
449         * </li>
450         * <li>
451         * java.lang.String - The GraphQL query
452         * </li>
453         * <li>
454         * java.lang.String - The GraphQL response
455         * </li>
456         * <li>
457         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
458         * </li>
459         * <li>
460         * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
461         * </li>
462         * </ul>
463         * </p>
464         * <p>
465         * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally.
466         * This is generally the right thing to do. If your interceptor is providing a response rather than
467         * letting HAPI handle the response normally, you must return <code>false</code>. In this case,
468         * no further processing will occur and no further interceptors will be called.
469         * </p>
470         * <p>
471         * Hook methods may also throw {@link AuthenticationException} to indicate that the interceptor
472         * has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401
473         * will be returned to the client.
474         */
475        SERVER_OUTGOING_GRAPHQL_RESPONSE(boolean.class,
476                "ca.uhn.fhir.rest.api.server.RequestDetails",
477                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
478                "java.lang.String",
479                "java.lang.String",
480                "javax.servlet.http.HttpServletRequest",
481                "javax.servlet.http.HttpServletResponse"
482        ),
483
484
485        /**
486         * <b>Server Hook:</b>
487         * This method is called when an OperationOutcome is being returned in response to a failure.
488         * Hook methods may use this hook to modify the OperationOutcome being returned.
489         * <p>
490         * Hooks may accept the following parameters:
491         * <ul>
492         * <li>
493         * 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
494         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
495         * pulled out of the servlet request. Note that the bean
496         * properties are not all guaranteed to be populated, depending on how early during processing the
497         * exception occurred.
498         * </li>
499         * <li>
500         * 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
501         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
502         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
503         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
504         * </li>
505         * <li>
506         * org.hl7.fhir.instance.model.api.IBaseOperationOutcome - The OperationOutcome resource that will be
507         * returned.
508         * </ul>
509         * <p>
510         * Hook methods must return <code>void</code>
511         * </p>
512         */
513        SERVER_OUTGOING_FAILURE_OPERATIONOUTCOME(
514                void.class,
515                "ca.uhn.fhir.rest.api.server.RequestDetails",
516                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
517                "org.hl7.fhir.instance.model.api.IBaseOperationOutcome"
518        ),
519
520
521        /**
522         * <b>Server Hook:</b>
523         * This method is called after all processing is completed for a request, but only if the
524         * request completes normally (i.e. no exception is thrown).
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 request. This will be null if the server is not deployed to a RestfulServer environment.
537         * </li>
538         * </ul>
539         * </p>
540         * <p>
541         * This method must return <code>void</code>
542         * </p>
543         * <p>
544         * This method should not throw any exceptions. Any exception that is thrown by this
545         * method will be logged, but otherwise not acted upon (i.e. even if a hook method
546         * throws an exception, processing will continue and other interceptors will be
547         * called). Therefore it is considered a bug to throw an exception from hook methods using this
548         * pointcut.
549         * </p>
550         */
551        SERVER_PROCESSING_COMPLETED_NORMALLY(
552                void.class,
553                new ExceptionHandlingSpec()
554                        .addLogAndSwallow(Throwable.class),
555                "ca.uhn.fhir.rest.api.server.RequestDetails",
556                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
557        ),
558
559        /**
560         * <b>Server Hook:</b>
561         * This method is called after all processing is completed for a request, regardless of whether
562         * the request completed successfully or not. It is called after {@link #SERVER_PROCESSING_COMPLETED_NORMALLY}
563         * in the case of successful operations.
564         * <p>
565         * Hooks may accept the following parameters:
566         * <ul>
567         * <li>
568         * 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
569         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
570         * pulled out of the servlet request.
571         * </li>
572         * <li>
573         * 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
574         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
575         * pulled out of the request. This will be null if the server is not deployed to a RestfulServer environment.
576         * </li>
577         * </ul>
578         * </p>
579         * <p>
580         * This method must return <code>void</code>
581         * </p>
582         * <p>
583         * This method should not throw any exceptions. Any exception that is thrown by this
584         * method will be logged, but otherwise not acted upon (i.e. even if a hook method
585         * throws an exception, processing will continue and other interceptors will be
586         * called). Therefore it is considered a bug to throw an exception from hook methods using this
587         * pointcut.
588         * </p>
589         */
590        SERVER_PROCESSING_COMPLETED(
591                void.class,
592                new ExceptionHandlingSpec()
593                        .addLogAndSwallow(Throwable.class),
594                "ca.uhn.fhir.rest.api.server.RequestDetails",
595                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
596        ),
597
598        /**
599         * <b>Subscription Hook:</b>
600         * Invoked whenever a persisted resource has been modified and is being submitted to the
601         * subscription processing pipeline. This method is called before the resource is placed
602         * on any queues for processing and executes synchronously during the resource modification
603         * operation itself, so it should return quickly.
604         * <p>
605         * Hooks may accept the following parameters:
606         * <ul>
607         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - Hooks may modify this parameter. This will affect the checking process.</li>
608         * </ul>
609         * </p>
610         * <p>
611         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
612         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
613         * returns <code>false</code>, subscription processing will not proceed for the given resource;
614         * </p>
615         */
616        SUBSCRIPTION_RESOURCE_MODIFIED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
617
618
619        /**
620         * <b>Subscription Hook:</b>
621         * Invoked any time that a resource is matched by an individual subscription, and
622         * is about to be queued for delivery.
623         * <p>
624         * Hooks may make changes to the delivery payload, or make changes to the
625         * canonical subscription such as adding headers, modifying the channel
626         * endpoint, etc.
627         * </p>
628         * Hooks may accept the following parameters:
629         * <ul>
630         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
631         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
632         * <li>ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult</li>
633         * </ul>
634         * <p>
635         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
636         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
637         * returns <code>false</code>, delivery will be aborted.
638         * </p>
639         */
640        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"),
641
642        /**
643         * <b>Subscription Hook:</b>
644         * Invoked whenever a persisted resource was checked against all active subscriptions, and did not
645         * match any.
646         * <p>
647         * Hooks may accept the following parameters:
648         * <ul>
649         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - Hooks should not modify this parameter as changes will not have any effect.</li>
650         * </ul>
651         * </p>
652         * <p>
653         * Hooks should return <code>void</code>.
654         * </p>
655         */
656        SUBSCRIPTION_RESOURCE_DID_NOT_MATCH_ANY_SUBSCRIPTIONS(void.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
657
658        /**
659         * <b>Subscription Hook:</b>
660         * Invoked immediately before the delivery of a subscription, and right before any channel-specific
661         * hooks are invoked (e.g. {@link #SUBSCRIPTION_BEFORE_REST_HOOK_DELIVERY}.
662         * <p>
663         * Hooks may make changes to the delivery payload, or make changes to the
664         * canonical subscription such as adding headers, modifying the channel
665         * endpoint, etc.
666         * </p>
667         * Hooks may accept the following parameters:
668         * <ul>
669         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
670         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
671         * </ul>
672         * <p>
673         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
674         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
675         * returns <code>false</code>, processing will be aborted.
676         * </p>
677         */
678        SUBSCRIPTION_BEFORE_DELIVERY(boolean.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
679
680        /**
681         * <b>Subscription Hook:</b>
682         * Invoked immediately after the delivery of a subscription, and right before any channel-specific
683         * hooks are invoked (e.g. {@link #SUBSCRIPTION_AFTER_REST_HOOK_DELIVERY}.
684         * <p>
685         * Hooks may accept the following parameters:
686         * </p>
687         * <ul>
688         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
689         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
690         * </ul>
691         * <p>
692         * Hooks should return <code>void</code>.
693         * </p>
694         */
695        SUBSCRIPTION_AFTER_DELIVERY(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
696
697
698        /**
699         * <b>Subscription Hook:</b>
700         * Invoked immediately after the attempted delivery of a subscription, if the delivery
701         * failed.
702         * <p>
703         * Hooks may accept the following parameters:
704         * </p>
705         * <ul>
706         * <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>
707         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage - the message that triggered the exception</li>
708         * <li>java.lang.Exception</li>
709         * </ul>
710         * <p>
711         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
712         * <code>void</code> or <code>true</code>, processing will continue normally, meaning that
713         * an exception will be thrown by the delivery mechanism. This typically means that the
714         * message will be returned to the processing queue. If the method
715         * returns <code>false</code>, processing will be aborted and no further action will be
716         * taken for the delivery.
717         * </p>
718         */
719        SUBSCRIPTION_AFTER_DELIVERY_FAILED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage", "java.lang.Exception"),
720
721        /**
722         * <b>Subscription Hook:</b>
723         * Invoked immediately after the delivery of a REST HOOK subscription.
724         * <p>
725         * When this hook is called, all processing is complete so this hook should not
726         * make any changes to the parameters.
727         * </p>
728         * Hooks may accept the following parameters:
729         * <ul>
730         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
731         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
732         * </ul>
733         * <p>
734         * Hooks should return <code>void</code>.
735         * </p>
736         */
737        SUBSCRIPTION_AFTER_REST_HOOK_DELIVERY(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
738
739        /**
740         * <b>Subscription Hook:</b>
741         * Invoked immediately before the delivery of a REST HOOK subscription.
742         * <p>
743         * Hooks may make changes to the delivery payload, or make changes to the
744         * canonical subscription such as adding headers, modifying the channel
745         * endpoint, etc.
746         * </p>
747         * Hooks may accept the following parameters:
748         * <ul>
749         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
750         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
751         * </ul>
752         * <p>
753         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
754         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
755         * returns <code>false</code>, processing will be aborted.
756         * </p>
757         */
758        SUBSCRIPTION_BEFORE_REST_HOOK_DELIVERY(boolean.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
759
760        /**
761         * <b>Subscription Hook:</b>
762         * Invoked immediately after the delivery of MESSAGE subscription.
763         * <p>
764         * When this hook is called, all processing is complete so this hook should not
765         * make any changes to the parameters.
766         * </p>
767         * Hooks may accept the following parameters:
768         * <ul>
769         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
770         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
771         * </ul>
772         * <p>
773         * Hooks should return <code>void</code>.
774         * </p>
775         */
776        SUBSCRIPTION_AFTER_MESSAGE_DELIVERY(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
777
778        /**
779         * <b>Subscription Hook:</b>
780         * Invoked immediately before the delivery of a MESSAGE subscription.
781         * <p>
782         * Hooks may make changes to the delivery payload, or make changes to the
783         * canonical subscription such as adding headers, modifying the channel
784         * endpoint, etc.
785         * </p>
786         * Hooks may accept the following parameters:
787         * <ul>
788         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
789         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
790         * </ul>
791         * <p>
792         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
793         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
794         * returns <code>false</code>, processing will be aborted.
795         * </p>
796         */
797        SUBSCRIPTION_BEFORE_MESSAGE_DELIVERY(boolean.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
798
799
800        /**
801         * <b>Subscription Hook:</b>
802         * Invoked whenever a persisted resource (a resource that has just been stored in the
803         * database via a create/update/patch/etc.) is about to be checked for whether any subscriptions
804         * were triggered as a result of the operation.
805         * <p>
806         * Hooks may accept the following parameters:
807         * <ul>
808         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - Hooks may modify this parameter. This will affect the checking process.</li>
809         * </ul>
810         * </p>
811         * <p>
812         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
813         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
814         * returns <code>false</code>, processing will be aborted.
815         * </p>
816         */
817        SUBSCRIPTION_BEFORE_PERSISTED_RESOURCE_CHECKED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
818
819
820        /**
821         * <b>Subscription Hook:</b>
822         * Invoked whenever a persisted resource (a resource that has just been stored in the
823         * database via a create/update/patch/etc.) has been checked for whether any subscriptions
824         * were triggered as a result of the operation.
825         * <p>
826         * Hooks may accept the following parameters:
827         * <ul>
828         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - This parameter should not be modified as processing is complete when this hook is invoked.</li>
829         * </ul>
830         * </p>
831         * <p>
832         * Hooks should return <code>void</code>.
833         * </p>
834         */
835        SUBSCRIPTION_AFTER_PERSISTED_RESOURCE_CHECKED(void.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
836
837
838        /**
839         * <b>Subscription Hook:</b>
840         * Invoked immediately after an active subscription is "registered". In HAPI FHIR, when
841         * a subscription
842         * <p>
843         * Hooks may make changes to the canonicalized subscription and this will have an effect
844         * on processing across this server. Note however that timing issues may occur, since the
845         * subscription is already technically live by the time this hook is called.
846         * </p>
847         * Hooks may accept the following parameters:
848         * <ul>
849         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
850         * </ul>
851         * <p>
852         * Hooks should return <code>void</code>.
853         * </p>
854         */
855        SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_REGISTERED(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription"),
856
857        /**
858         * <b>Subscription Hook:</b>
859         * Invoked immediately after an active subscription is "registered". In HAPI FHIR, when
860         * a subscription
861         * <p>
862         * Hooks may make changes to the canonicalized subscription and this will have an effect
863         * on processing across this server. Note however that timing issues may occur, since the
864         * subscription is already technically live by the time this hook is called.
865         * </p>
866         * No parameters are currently supported.
867         * <p>
868         * Hooks should return <code>void</code>.
869         * </p>
870         */
871        SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_UNREGISTERED(void.class),
872
873        /**
874         * <b>Storage Hook:</b>
875         * Invoked when a resource is being deleted in a cascaded delete. This means that
876         * some other resource is being deleted, but per use request or other
877         * policy, the given resource (the one supplied as a parameter to this hook)
878         * is also being deleted.
879         * <p>
880         * Hooks may accept the following parameters:
881         * </p>
882         * <ul>
883         * <li>
884         * 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
885         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
886         * pulled out of the servlet request. Note that the bean
887         * properties are not all guaranteed to be populated, depending on how early during processing the
888         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
889         * known, such as while processing searches</b>
890         * </li>
891         * <li>
892         * 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
893         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
894         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
895         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
896         * </li>
897         * <li>
898         * ca.uhn.fhir.jpa.util.DeleteConflictList - Contains the details about the delete conflicts that are
899         * being resolved via deletion. The source resource is the resource that will be deleted, and
900         * is a cascade because the target resource is already being deleted.
901         * </li>
902         * <li>
903         * org.hl7.fhir.instance.model.api.IBaseResource - The actual resource that is about to be deleted via a cascading delete
904         * </li>
905         * </ul>
906         * <p>
907         * Hooks should return <code>void</code>. They may choose to throw an exception however, in
908         * which case the delete should be rolled back.
909         * </p>
910         */
911        STORAGE_CASCADE_DELETE(
912                void.class,
913                "ca.uhn.fhir.rest.api.server.RequestDetails",
914                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
915                "ca.uhn.fhir.jpa.api.model.DeleteConflictList",
916                "org.hl7.fhir.instance.model.api.IBaseResource"
917        ),
918
919        /**
920         * <b>Storage Hook:</b>
921         * Invoked when one or more resources may be returned to the user, whether as a part of a READ,
922         * a SEARCH, or even as the response to a CREATE/UPDATE, etc.
923         * <p>
924         * This hook is invoked when a resource has been loaded by the storage engine and
925         * is being returned to the HTTP stack for response. This is not a guarantee that the
926         * client will ultimately see it, since filters/headers/etc may affect what
927         * is returned but if a resource is loaded it is likely to be used.
928         * Note also that caching may affect whether this pointcut is invoked.
929         * </p>
930         * <p>
931         * Hooks will have access to the contents of the resource being returned
932         * and may choose to make modifications. These changes will be reflected in
933         * returned resource but have no effect on storage.
934         * </p>
935         * Hooks may accept the following parameters:
936         * <ul>
937         * <li>
938         * ca.uhn.fhir.rest.api.server.IPreResourceAccessDetails - Contains details about the
939         * specific resources being returned.
940         * </li>
941         * <li>
942         * 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
943         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
944         * pulled out of the servlet request. Note that the bean
945         * properties are not all guaranteed to be populated, depending on how early during processing the
946         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
947         * known, such as while processing searches</b>
948         * </li>
949         * <li>
950         * 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
951         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
952         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
953         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
954         * </li>
955         * </ul>
956         * <p>
957         * Hooks should return <code>void</code>.
958         * </p>
959         */
960        STORAGE_PREACCESS_RESOURCES(void.class,
961                "ca.uhn.fhir.rest.api.server.IPreResourceAccessDetails",
962                "ca.uhn.fhir.rest.api.server.RequestDetails",
963                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
964        ),
965
966        /**
967         * <b>Storage Hook:</b>
968         * Invoked when the storage engine is about to check for the existence of a pre-cached search
969         * whose results match the given search parameters.
970         * <p>
971         * Hooks may accept the following parameters:
972         * </p>
973         * <ul>
974         * <li>
975         * ca.uhn.fhir.jpa.searchparam.SearchParameterMap - Contains the details of the search being checked
976         * </li>
977         * <li>
978         * 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
979         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
980         * pulled out of the servlet request. Note that the bean
981         * properties are not all guaranteed to be populated, depending on how early during processing the
982         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
983         * known, such as while processing searches</b>
984         * </li>
985         * <li>
986         * 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
987         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
988         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
989         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
990         * </li>
991         * </ul>
992         * <p>
993         * Hooks may return <code>boolean</code>. If the hook method returns
994         * <code>false</code>, the server will not attempt to check for a cached
995         * search no matter what.
996         * </p>
997         */
998        STORAGE_PRECHECK_FOR_CACHED_SEARCH(boolean.class,
999                "ca.uhn.fhir.jpa.searchparam.SearchParameterMap",
1000                "ca.uhn.fhir.rest.api.server.RequestDetails",
1001                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1002        ),
1003
1004        /**
1005         * <b>Storage Hook:</b>
1006         * Invoked when a search is starting, prior to creating a record for the search.
1007         * <p>
1008         * Hooks may accept the following parameters:
1009         * </p>
1010         * <ul>
1011         * <li>
1012         * ca.uhn.fhir.rest.server.util.ICachedSearchDetails - Contains the details of the search that
1013         * is being created and initialized
1014         * </li>
1015         * <li>
1016         * 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
1017         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1018         * pulled out of the servlet request. Note that the bean
1019         * properties are not all guaranteed to be populated, depending on how early during processing the
1020         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1021         * known, such as while processing searches</b>
1022         * </li>
1023         * <li>
1024         * 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
1025         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1026         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1027         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1028         * </li>
1029         * </ul>
1030         * <p>
1031         * Hooks should return <code>void</code>.
1032         * </p>
1033         */
1034        STORAGE_PRESEARCH_REGISTERED(void.class,
1035                "ca.uhn.fhir.rest.server.util.ICachedSearchDetails",
1036                "ca.uhn.fhir.rest.api.server.RequestDetails",
1037                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1038        ),
1039
1040        /**
1041         * <b>Storage Hook:</b>
1042         * Invoked when one or more resources may be returned to the user, whether as a part of a READ,
1043         * a SEARCH, or even as the response to a CREATE/UPDATE, etc.
1044         * <p>
1045         * This hook is invoked when a resource has been loaded by the storage engine and
1046         * is being returned to the HTTP stack for response.
1047         * This is not a guarantee that the
1048         * client will ultimately see it, since filters/headers/etc may affect what
1049         * is returned but if a resource is loaded it is likely to be used.
1050         * Note also that caching may affect whether this pointcut is invoked.
1051         * </p>
1052         * <p>
1053         * Hooks will have access to the contents of the resource being returned
1054         * and may choose to make modifications. These changes will be reflected in
1055         * returned resource but have no effect on storage.
1056         * </p>
1057         * Hooks may accept the following parameters:
1058         * <ul>
1059         * <li>
1060         * ca.uhn.fhir.rest.api.server.IPreResourceShowDetails - Contains the resources that
1061         * will be shown to the user. This object may be manipulated in order to modify
1062         * the actual resources being shown to the user (e.g. for masking)
1063         * </li>
1064         * <li>
1065         * 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
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. Note that the bean
1068         * properties are not all guaranteed to be populated, depending on how early during processing the
1069         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1070         * known, such as while processing searches</b>
1071         * </li>
1072         * <li>
1073         * 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
1074         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1075         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1076         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1077         * </li>
1078         * </ul>
1079         * <p>
1080         * Hooks should return <code>void</code>.
1081         * </p>
1082         */
1083        STORAGE_PRESHOW_RESOURCES(void.class,
1084                "ca.uhn.fhir.rest.api.server.IPreResourceShowDetails",
1085                "ca.uhn.fhir.rest.api.server.RequestDetails",
1086                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1087        ),
1088
1089        /**
1090         * <b>Storage Hook:</b>
1091         * Invoked before a resource will be created, immediately before the resource
1092         * is persisted to the database.
1093         * <p>
1094         * Hooks will have access to the contents of the resource being created
1095         * and may choose to make modifications to it. These changes will be
1096         * reflected in permanent storage.
1097         * </p>
1098         * Hooks may accept the following parameters:
1099         * <ul>
1100         * <li>org.hl7.fhir.instance.model.api.IBaseResource</li>
1101         * <li>
1102         * 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
1103         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1104         * pulled out of the servlet request. Note that the bean
1105         * properties are not all guaranteed to be populated, depending on how early during processing the
1106         * exception occurred.
1107         * </li>
1108         * <li>
1109         * 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
1110         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1111         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1112         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1113         * </li>
1114         * <li>
1115         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1116         * </li>
1117         * </ul>
1118         * <p>
1119         * Hooks should return <code>void</code>.
1120         * </p>
1121         */
1122        STORAGE_PRESTORAGE_RESOURCE_CREATED(void.class,
1123                "org.hl7.fhir.instance.model.api.IBaseResource",
1124                "ca.uhn.fhir.rest.api.server.RequestDetails",
1125                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1126                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1127        ),
1128
1129        /**
1130         * <b>Storage Hook:</b>
1131         * Invoked before a resource will be updated, immediately before the resource
1132         * is persisted to the database.
1133         * <p>
1134         * Hooks will have access to the contents of the resource being updated
1135         * (both the previous and new contents) and may choose to make modifications
1136         * to the new contents of the resource. These changes will be reflected in
1137         * permanent storage.
1138         * </p>
1139         * Hooks may accept the following parameters:
1140         * <ul>
1141         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The previous contents of the resource being updated</li>
1142         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The new contents of the resource being updated</li>
1143         * <li>
1144         * 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
1145         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1146         * pulled out of the servlet request. Note that the bean
1147         * properties are not all guaranteed to be populated, depending on how early during processing the
1148         * exception occurred.
1149         * </li>
1150         * <li>
1151         * 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
1152         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1153         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1154         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1155         * </li>
1156         * <li>
1157         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1158         * </li>
1159         * </ul>
1160         * <p>
1161         * Hooks should return <code>void</code>.
1162         * </p>
1163         */
1164        STORAGE_PRESTORAGE_RESOURCE_UPDATED(void.class,
1165                "org.hl7.fhir.instance.model.api.IBaseResource",
1166                "org.hl7.fhir.instance.model.api.IBaseResource",
1167                "ca.uhn.fhir.rest.api.server.RequestDetails",
1168                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1169                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1170        ),
1171
1172        /**
1173         * <b>Storage Hook:</b>
1174         * Invoked before a resource will be created, immediately before the resource
1175         * is persisted to the database.
1176         * <p>
1177         * Hooks will have access to the contents of the resource being created
1178         * and may choose to make modifications to it. These changes will be
1179         * reflected in permanent storage.
1180         * </p>
1181         * Hooks may accept the following parameters:
1182         * <ul>
1183         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li>
1184         * <li>
1185         * 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
1186         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1187         * pulled out of the servlet request. Note that the bean
1188         * properties are not all guaranteed to be populated, depending on how early during processing the
1189         * exception occurred.
1190         * </li>
1191         * <li>
1192         * 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
1193         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1194         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1195         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1196         * </li>
1197         * <li>
1198         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1199         * </li>
1200         * </ul>
1201         * <p>
1202         * Hooks should return <code>void</code>.
1203         * </p>
1204         */
1205        STORAGE_PRESTORAGE_RESOURCE_DELETED(void.class,
1206                "org.hl7.fhir.instance.model.api.IBaseResource",
1207                "ca.uhn.fhir.rest.api.server.RequestDetails",
1208                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1209                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1210        ),
1211
1212
1213        /**
1214         * <b>Storage Hook:</b>
1215         * Invoked before a resource will be created, immediately before the transaction
1216         * is committed (after all validation and other business rules have successfully
1217         * completed, and any other database activity is complete.
1218         * <p>
1219         * Hooks will have access to the contents of the resource being created
1220         * but should generally not make any
1221         * changes as storage has already occurred. Changes will not be reflected
1222         * in storage, but may be reflected in the HTTP response.
1223         * </p>
1224         * Hooks may accept the following parameters:
1225         * <ul>
1226         * <li>org.hl7.fhir.instance.model.api.IBaseResource</li>
1227         * <li>
1228         * 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
1229         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1230         * pulled out of the servlet request. Note that the bean
1231         * properties are not all guaranteed to be populated, depending on how early during processing the
1232         * exception occurred.
1233         * </li>
1234         * <li>
1235         * 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
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. This parameter is identical to the RequestDetails parameter above but will
1238         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1239         * </li>
1240         * <li>
1241         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1242         * </li>
1243         * </ul>
1244         * <p>
1245         * Hooks should return <code>void</code>.
1246         * </p>
1247         */
1248        STORAGE_PRECOMMIT_RESOURCE_CREATED(void.class,
1249                "org.hl7.fhir.instance.model.api.IBaseResource",
1250                "ca.uhn.fhir.rest.api.server.RequestDetails",
1251                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1252                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1253        ),
1254
1255        /**
1256         * <b>Storage Hook:</b>
1257         * Invoked before a resource will be updated, immediately before the transaction
1258         * is committed (after all validation and other business rules have successfully
1259         * completed, and any other database activity is complete.
1260         * <p>
1261         * Hooks will have access to the contents of the resource being updated
1262         * (both the previous and new contents) but should generally not make any
1263         * changes as storage has already occurred. Changes will not be reflected
1264         * in storage, but may be reflected in the HTTP response.
1265         * </p>
1266         * Hooks may accept the following parameters:
1267         * <ul>
1268         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The previous contents of the resource</li>
1269         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The proposed new new contents of the resource</li>
1270         * <li>
1271         * 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
1272         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1273         * pulled out of the servlet request. Note that the bean
1274         * properties are not all guaranteed to be populated, depending on how early during processing the
1275         * exception occurred.
1276         * </li>
1277         * <li>
1278         * 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
1279         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1280         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1281         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1282         * </li>
1283         * <li>
1284         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1285         * </li>
1286         * </ul>
1287         * <p>
1288         * Hooks should return <code>void</code>.
1289         * </p>
1290         */
1291        STORAGE_PRECOMMIT_RESOURCE_UPDATED(void.class,
1292                "org.hl7.fhir.instance.model.api.IBaseResource",
1293                "org.hl7.fhir.instance.model.api.IBaseResource",
1294                "ca.uhn.fhir.rest.api.server.RequestDetails",
1295                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1296                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1297        ),
1298
1299
1300        /**
1301         * <b>Storage Hook:</b>
1302         * Invoked before a resource will be deleted
1303         * <p>
1304         * Hooks will have access to the contents of the resource being deleted
1305         * but should not make any changes as storage has already occurred
1306         * </p>
1307         * Hooks may accept the following parameters:
1308         * <ul>
1309         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li>
1310         * <li>
1311         * 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
1312         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1313         * pulled out of the servlet request. Note that the bean
1314         * properties are not all guaranteed to be populated, depending on how early during processing the
1315         * exception occurred.
1316         * </li>
1317         * <li>
1318         * 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
1319         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1320         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1321         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1322         * </li>
1323         * <li>
1324         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1325         * </li>
1326         * </ul>
1327         * <p>
1328         * Hooks should return <code>void</code>.
1329         * </p>
1330         */
1331        STORAGE_PRECOMMIT_RESOURCE_DELETED(void.class,
1332                "org.hl7.fhir.instance.model.api.IBaseResource",
1333                "ca.uhn.fhir.rest.api.server.RequestDetails",
1334                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1335                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1336        ),
1337
1338        /**
1339         * <b>Storage Hook:</b>
1340         * 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}.
1341         * <p>
1342         * Hooks will have access to the list of resources that have references to the resource being deleted.
1343         * </p>
1344         * Hooks may accept the following parameters:
1345         * <ul>
1346         * <li>ca.uhn.fhir.jpa.api.model.DeleteConflictList - The list of delete conflicts</li>
1347         * <li>
1348         * 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
1349         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1350         * pulled out of the servlet request. Note that the bean
1351         * properties are not all guaranteed to be populated, depending on how early during processing the
1352         * exception occurred.
1353         * </li>
1354         * <li>
1355         * 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
1356         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1357         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1358         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1359         * </li>
1360         * <li>
1361         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1362         * </li>
1363         * </ul>
1364         * <p>
1365         * Hooks should return <code>ca.uhn.fhir.jpa.delete.DeleteConflictOutcome</code>.
1366         * If the interceptor returns a non-null result, the DeleteConflictOutcome can be
1367         * used to indicate a number of times to retry.
1368         * </p>
1369         */
1370        STORAGE_PRESTORAGE_DELETE_CONFLICTS(
1371                // Return type
1372                "ca.uhn.fhir.jpa.delete.DeleteConflictOutcome",
1373                // Params
1374                "ca.uhn.fhir.jpa.api.model.DeleteConflictList",
1375                "ca.uhn.fhir.rest.api.server.RequestDetails",
1376                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1377                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1378        ),
1379
1380        /**
1381         * <b>Storage Hook:</b>
1382         * Invoked before a resource is about to be expunged via the <code>$expunge</code> operation.
1383         * <p>
1384         * Hooks will be passed a reference to a counter containing the current number of records that have been deleted.
1385         * If the hook deletes any records, the hook is expected to increment this counter by the number of records deleted.
1386         * </p>
1387         * <p>
1388         * Hooks may accept the following parameters:
1389         * </p>
1390         * <ul>
1391         * <li>java.util.concurrent.atomic.AtomicInteger - The counter holding the number of records deleted.</li>
1392         * <li>org.hl7.fhir.instance.model.api.IIdType - The ID of the resource that is about to be deleted</li>
1393         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource that is about to be deleted</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         * </ul>
1408         * <p>
1409         * Hooks should return void.
1410         * </p>
1411         */
1412        STORAGE_PRESTORAGE_EXPUNGE_RESOURCE(
1413                // Return type
1414                void.class,
1415                // Params
1416                "java.util.concurrent.atomic.AtomicInteger",
1417                "org.hl7.fhir.instance.model.api.IIdType",
1418                "org.hl7.fhir.instance.model.api.IBaseResource",
1419                "ca.uhn.fhir.rest.api.server.RequestDetails",
1420                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1421        ),
1422
1423        /**
1424         * <b>Storage Hook:</b>
1425         * Invoked before an <code>$expunge</code> operation on all data (expungeEverything) is called.
1426         * <p>
1427         * Hooks will be passed a reference to a counter containing the current number of records that have been deleted.
1428         * If the hook deletes any records, the hook is expected to increment this counter by the number of records deleted.
1429         * </p>
1430         * Hooks may accept the following parameters:
1431         * <ul>
1432         * <li>java.util.concurrent.atomic.AtomicInteger - The counter holding the number of records deleted.</li>
1433         * <li>
1434         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
1435         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1436         * pulled out of the servlet request. Note that the bean
1437         * properties are not all guaranteed to be populated, depending on how early during processing the
1438         * exception occurred.
1439         * </li>
1440         * <li>
1441         * 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
1442         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1443         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1444         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1445         * </li>
1446         * </ul>
1447         * <p>
1448         * Hooks should return void.
1449         * </p>
1450         */
1451        STORAGE_PRESTORAGE_EXPUNGE_EVERYTHING(
1452                // Return type
1453                void.class,
1454                // Params
1455                "java.util.concurrent.atomic.AtomicInteger",
1456                "ca.uhn.fhir.rest.api.server.RequestDetails",
1457                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1458        ),
1459
1460        /**
1461         * <b>Storage Hook:</b>
1462         * Invoked before FHIR <b>create</b> operation to request the identification of the partition ID to be associated
1463         * with the resource being created. This hook will only be called if partitioning is enabled in the JPA
1464         * server.
1465         * <p>
1466         * Hooks may accept the following parameters:
1467         * </p>
1468         * <ul>
1469         * <li>
1470         * org.hl7.fhir.instance.model.api.IBaseResource - The resource that will be created and needs a tenant ID assigned.
1471         * </li>
1472         * <li>
1473         * 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
1474         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1475         * pulled out of the servlet request. Note that the bean
1476         * properties are not all guaranteed to be populated, depending on how early during processing the
1477         * exception occurred.
1478         * </li>
1479         * <li>
1480         * 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
1481         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1482         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1483         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1484         * </li>
1485         * </ul>
1486         * <p>
1487         * Hooks must return an instance of <code>ca.uhn.fhir.interceptor.model.RequestPartitionId</code>.
1488         * </p>
1489         */
1490        STORAGE_PARTITION_IDENTIFY_CREATE(
1491                // Return type
1492                "ca.uhn.fhir.interceptor.model.RequestPartitionId",
1493                // Params
1494                "org.hl7.fhir.instance.model.api.IBaseResource",
1495                "ca.uhn.fhir.rest.api.server.RequestDetails",
1496                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1497        ),
1498
1499        /**
1500         * <b>Storage Hook:</b>
1501         * Invoked before FHIR read/access operation (e.g. <b>read/vread</b>, <b>search</b>, <b>history</b>, etc.) operation to request the
1502         * identification of the partition ID to be associated with the resource(s) being searched for, read, etc.
1503         * <p>
1504         * This hook will only be called if
1505         * partitioning is enabled in the JPA server.
1506         * </p>
1507         * <p>
1508         * Hooks may accept the following parameters:
1509         * </p>
1510         * <ul>
1511         * <li>
1512         * 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
1513         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1514         * pulled out of the servlet request. Note that the bean
1515         * properties are not all guaranteed to be populated, depending on how early during processing the
1516         * exception occurred.
1517         * </li>
1518         * <li>
1519         * 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
1520         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1521         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1522         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1523         * </li>
1524         * </ul>
1525         * <p>
1526         * Hooks must return an instance of <code>ca.uhn.fhir.interceptor.model.RequestPartitionId</code>.
1527         * </p>
1528         */
1529        STORAGE_PARTITION_IDENTIFY_READ(
1530                // Return type
1531                "ca.uhn.fhir.interceptor.model.RequestPartitionId",
1532                // Params
1533                "ca.uhn.fhir.rest.api.server.RequestDetails",
1534                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1535        ),
1536
1537        /**
1538         * <b>Storage Hook:</b>
1539         * Invoked before any partition aware FHIR operation, when the selected partition has been identified (ie. after the
1540         * {@link #STORAGE_PARTITION_IDENTIFY_CREATE} or {@link #STORAGE_PARTITION_IDENTIFY_READ} hook was called. This allows
1541         * a separate hook to register, and potentially make decisions about whether the request should be allowed to proceed.
1542         * <p>
1543         * This hook will only be called if
1544         * partitioning is enabled in the JPA server.
1545         * </p>
1546         * <p>
1547         * Hooks may accept the following parameters:
1548         * </p>
1549         * <ul>
1550         * <li>
1551         * ca.uhn.fhir.interceptor.model.RequestPartitionId - The partition ID that was selected
1552         * </li>
1553         * <li>
1554         * 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
1555         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1556         * pulled out of the servlet request. Note that the bean
1557         * properties are not all guaranteed to be populated, depending on how early during processing the
1558         * exception occurred.
1559         * </li>
1560         * <li>
1561         * 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
1562         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1563         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1564         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1565         * </li>
1566         * </ul>
1567         * <p>
1568         * Hooks must return void.
1569         * </p>
1570         */
1571        STORAGE_PARTITION_SELECTED(
1572                // Return type
1573                void.class,
1574                // Params
1575                "ca.uhn.fhir.interceptor.model.RequestPartitionId",
1576                "ca.uhn.fhir.rest.api.server.RequestDetails",
1577                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1578        ),
1579
1580        /**
1581         * <b>Storage Hook:</b>
1582         * Invoked when a transaction has been rolled back as a result of a {@link ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException},
1583         * meaning that a database constraint has been violated. This pointcut allows an interceptor to specify a resolution strategy
1584         * other than simply returning the error to the client. This interceptor will be fired after the database transaction rollback
1585         * has been completed.
1586         * <p>
1587         * Hooks may accept the following parameters:
1588         * </p>
1589         * <ul>
1590         * <li>
1591         * 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
1592         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1593         * pulled out of the servlet request. Note that the bean
1594         * properties are not all guaranteed to be populated, depending on how early during processing the
1595         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1596         * known, such as while processing searches</b>
1597         * </li>
1598         * <li>
1599         * 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
1600         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1601         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1602         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1603         * </li>
1604         * </ul>
1605         * <p>
1606         * Hooks should return <code>ca.uhn.fhir.jpa.api.model.ResourceVersionConflictResolutionStrategy</code>. Hooks should not
1607         * throw any exception.
1608         * </p>
1609         */
1610        STORAGE_VERSION_CONFLICT(
1611                "ca.uhn.fhir.jpa.api.model.ResourceVersionConflictResolutionStrategy",
1612                "ca.uhn.fhir.rest.api.server.RequestDetails",
1613                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1614        ),
1615
1616        /**
1617         * <b>EMPI Hook:</b>
1618         * Invoked whenever a persisted Patient/Practitioner resource (a resource that has just been stored in the
1619         * database via a create/update/patch/etc.) has been matched against related resources and EMPI links have been updated.
1620         * <p>
1621         * Hooks may accept the following parameters:
1622         * <ul>
1623         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - This parameter should not be modified as processing is complete when this hook is invoked.</li>
1624         * <li>ca.uhn.fhir.empi.model.TransactionLogMessages - This parameter is for informational messages provided by the EMPI module during EMPI procesing. .</li>
1625         * </ul>
1626         * </p>
1627         * <p>
1628         * Hooks should return <code>void</code>.
1629         * </p>
1630         */
1631        EMPI_AFTER_PERSISTED_RESOURCE_CHECKED(void.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage", "ca.uhn.fhir.rest.server.TransactionLogMessages"),
1632
1633        /**
1634         * <b>Performance Tracing Hook:</b>
1635         * This hook is invoked when any informational messages generated by the
1636         * SearchCoordinator are created. It is typically used to provide logging
1637         * or capture details related to a specific request.
1638         * <p>
1639         * Note that this is a performance tracing hook. Use with caution in production
1640         * systems, since calling it may (or may not) carry a cost.
1641         * </p>
1642         * Hooks may accept the following parameters:
1643         * <ul>
1644         * <li>
1645         * 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
1646         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1647         * pulled out of the servlet request. Note that the bean
1648         * properties are not all guaranteed to be populated, depending on how early during processing the
1649         * exception occurred.
1650         * </li>
1651         * <li>
1652         * 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
1653         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1654         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1655         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1656         * </li>
1657         * <li>
1658         * ca.uhn.fhir.jpa.model.search.StorageProcessingMessage - Contains the message
1659         * </li>
1660         * </ul>
1661         * <p>
1662         * Hooks should return <code>void</code>.
1663         * </p>
1664         */
1665        JPA_PERFTRACE_INFO(void.class,
1666                "ca.uhn.fhir.rest.api.server.RequestDetails",
1667                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1668                "ca.uhn.fhir.jpa.model.search.StorageProcessingMessage"
1669        ),
1670
1671        /**
1672         * <b>Performance Tracing Hook:</b>
1673         * This hook is invoked when any warning messages generated by the
1674         * SearchCoordinator are created. It is typically used to provide logging
1675         * or capture details related to a specific request.
1676         * <p>
1677         * Note that this is a performance tracing hook. Use with caution in production
1678         * systems, since calling it may (or may not) carry a cost.
1679         * </p>
1680         * Hooks may accept the following parameters:
1681         * <ul>
1682         * <li>
1683         * 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
1684         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1685         * pulled out of the servlet request. Note that the bean
1686         * properties are not all guaranteed to be populated, depending on how early during processing the
1687         * exception occurred.
1688         * </li>
1689         * <li>
1690         * 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
1691         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1692         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1693         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1694         * </li>
1695         * <li>
1696         * ca.uhn.fhir.jpa.model.search.StorageProcessingMessage - Contains the message
1697         * </li>
1698         * </ul>
1699         * <p>
1700         * Hooks should return <code>void</code>.
1701         * </p>
1702         */
1703        JPA_PERFTRACE_WARNING(void.class,
1704                "ca.uhn.fhir.rest.api.server.RequestDetails",
1705                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1706                "ca.uhn.fhir.jpa.model.search.StorageProcessingMessage"
1707        ),
1708
1709        /**
1710         * <b>Performance Tracing Hook:</b>
1711         * This hook is invoked when a search has returned the very first result
1712         * from the database. The timing on this call can be a good indicator of how
1713         * performant a query is in general.
1714         * <p>
1715         * Note that this is a performance tracing hook. Use with caution in production
1716         * systems, since calling it may (or may not) carry a cost.
1717         * </p>
1718         * Hooks may accept the following parameters:
1719         * <ul>
1720         * <li>
1721         * 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
1722         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1723         * pulled out of the servlet request. Note that the bean
1724         * properties are not all guaranteed to be populated, depending on how early during processing the
1725         * exception occurred.
1726         * </li>
1727         * <li>
1728         * 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
1729         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1730         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1731         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1732         * </li>
1733         * <li>
1734         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
1735         * performed. Hooks should not modify this object.
1736         * </li>
1737         * </ul>
1738         * <p>
1739         * Hooks should return <code>void</code>.
1740         * </p>
1741         */
1742        JPA_PERFTRACE_SEARCH_FIRST_RESULT_LOADED(void.class,
1743                "ca.uhn.fhir.rest.api.server.RequestDetails",
1744                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1745                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
1746        ),
1747
1748        /**
1749         * <b>Performance Tracing Hook:</b>
1750         * This hook is invoked when an individual search query SQL SELECT statement
1751         * has completed and no more results are available from that query. Note that this
1752         * doesn't necessarily mean that no more matching results exist in the database,
1753         * since HAPI FHIR JPA batch loads results in to the query cache in chunks in order
1754         * to provide predicable results without overloading memory or the database.
1755         * <p>
1756         * Note that this is a performance tracing hook. Use with caution in production
1757         * systems, since calling it may (or may not) carry a cost.
1758         * </p>
1759         * Hooks may accept the following parameters:
1760         * <ul>
1761         * <li>
1762         * 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
1763         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1764         * pulled out of the servlet request. Note that the bean
1765         * properties are not all guaranteed to be populated, depending on how early during processing the
1766         * exception occurred.
1767         * </li>
1768         * <li>
1769         * 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
1770         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1771         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1772         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1773         * </li>
1774         * <li>
1775         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
1776         * performed. Hooks should not modify this object.
1777         * </li>
1778         * </ul>
1779         * <p>
1780         * Hooks should return <code>void</code>.
1781         * </p>
1782         */
1783        JPA_PERFTRACE_SEARCH_SELECT_COMPLETE(void.class,
1784                "ca.uhn.fhir.rest.api.server.RequestDetails",
1785                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1786                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
1787        ),
1788
1789
1790        /**
1791         * <b>Performance Tracing Hook:</b>
1792         * This hook is invoked when a search has failed for any reason. When this pointcut
1793         * is invoked, the search has completed unsuccessfully and will not be continued.
1794         * <p>
1795         * Note that this is a performance tracing hook. Use with caution in production
1796         * systems, since calling it may (or may not) carry a cost.
1797         * </p>
1798         * Hooks may accept the following parameters:
1799         * <ul>
1800         * <li>
1801         * 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
1802         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1803         * pulled out of the servlet request. Note that the bean
1804         * properties are not all guaranteed to be populated, depending on how early during processing the
1805         * exception occurred.
1806         * </li>
1807         * <li>
1808         * 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
1809         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1810         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1811         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1812         * </li>
1813         * <li>
1814         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
1815         * performed. Hooks should not modify this object.
1816         * </li>
1817         * </ul>
1818         * <p>
1819         * Hooks should return <code>void</code>.
1820         * </p>
1821         */
1822        JPA_PERFTRACE_SEARCH_FAILED(void.class,
1823                "ca.uhn.fhir.rest.api.server.RequestDetails",
1824                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1825                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
1826        ),
1827
1828        /**
1829         * <b>Performance Tracing Hook:</b>
1830         * This hook is invoked when a search has completed. When this pointcut
1831         * is invoked, a pass in the Search Coordinator has completed successfully, but
1832         * not all possible resources have been loaded yet so a future paging request
1833         * may trigger a new task that will load further resources.
1834         * <p>
1835         * Note that this is a performance tracing hook. Use with caution in production
1836         * systems, since calling it may (or may not) carry a cost.
1837         * </p>
1838         * Hooks may accept the following parameters:
1839         * <ul>
1840         * <li>
1841         * 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
1842         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1843         * pulled out of the servlet request. Note that the bean
1844         * properties are not all guaranteed to be populated, depending on how early during processing the
1845         * exception occurred.
1846         * </li>
1847         * <li>
1848         * 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
1849         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1850         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1851         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1852         * </li>
1853         * <li>
1854         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
1855         * performed. Hooks should not modify this object.
1856         * </li>
1857         * </ul>
1858         * <p>
1859         * Hooks should return <code>void</code>.
1860         * </p>
1861         */
1862        JPA_PERFTRACE_SEARCH_PASS_COMPLETE(void.class,
1863                "ca.uhn.fhir.rest.api.server.RequestDetails",
1864                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1865                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
1866        ),
1867
1868        /**
1869         * <b>Performance Tracing Hook:</b>
1870         * This hook is invoked when a query involving an external index (e.g. Elasticsearch) has completed. When this pointcut
1871         * is invoked, an initial list of resource IDs has been generated which will be used as part of a subsequent database query.
1872         * <p>
1873         * Note that this is a performance tracing hook. Use with caution in production
1874         * systems, since calling it may (or may not) carry a cost.
1875         * </p>
1876         * Hooks may accept the following parameters:
1877         * <ul>
1878         * <li>
1879         * 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
1880         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1881         * pulled out of the servlet request. Note that the bean
1882         * properties are not all guaranteed to be populated, depending on how early during processing the
1883         * exception occurred.
1884         * </li>
1885         * <li>
1886         * 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
1887         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1888         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1889         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1890         * </li>
1891         * <li>
1892         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
1893         * performed. Hooks should not modify this object.
1894         * </li>
1895         * </ul>
1896         * <p>
1897         * Hooks should return <code>void</code>.
1898         * </p>
1899         */
1900        JPA_PERFTRACE_INDEXSEARCH_QUERY_COMPLETE(void.class,
1901                "ca.uhn.fhir.rest.api.server.RequestDetails",
1902                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1903                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
1904        ),
1905
1906        /**
1907         * <b>Performance Tracing Hook:</b>
1908         * Invoked when the storage engine is about to reuse the results of
1909         * a previously cached search.
1910         * <p>
1911         * Note that this is a performance tracing hook. Use with caution in production
1912         * systems, since calling it may (or may not) carry a cost.
1913         * </p>
1914         * <p>
1915         * Hooks may accept the following parameters:
1916         * </p>
1917         * <ul>
1918         * <li>
1919         * ca.uhn.fhir.jpa.searchparam.SearchParameterMap - Contains the details of the search being checked
1920         * </li>
1921         * <li>
1922         * 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
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. Note that the bean
1925         * properties are not all guaranteed to be populated, depending on how early during processing the
1926         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1927         * known, such as while processing searches</b>
1928         * </li>
1929         * <li>
1930         * 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
1931         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1932         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1933         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1934         * </li>
1935         * </ul>
1936         * <p>
1937         * Hooks should return <code>void</code>.
1938         * </p>
1939         */
1940        JPA_PERFTRACE_SEARCH_REUSING_CACHED(boolean.class,
1941                "ca.uhn.fhir.jpa.searchparam.SearchParameterMap",
1942                "ca.uhn.fhir.rest.api.server.RequestDetails",
1943                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1944        ),
1945
1946        /**
1947         * <b>Performance Tracing Hook:</b>
1948         * This hook is invoked when a search has failed for any reason. When this pointcut
1949         * is invoked, a pass in the Search Coordinator has completed successfully, and all
1950         * possible results have been fetched and loaded into the query cache.
1951         * <p>
1952         * Note that this is a performance tracing hook. Use with caution in production
1953         * systems, since calling it may (or may not) carry a cost.
1954         * </p>
1955         * Hooks may accept the following parameters:
1956         * <ul>
1957         * <li>
1958         * 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
1959         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1960         * pulled out of the servlet request. Note that the bean
1961         * properties are not all guaranteed to be populated, depending on how early during processing the
1962         * exception occurred.
1963         * </li>
1964         * <li>
1965         * 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
1966         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1967         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1968         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1969         * </li>
1970         * <li>
1971         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
1972         * performed. Hooks should not modify this object.
1973         * </li>
1974         * </ul>
1975         * <p>
1976         * Hooks should return <code>void</code>.
1977         * </p>
1978         */
1979        JPA_PERFTRACE_SEARCH_COMPLETE(void.class,
1980                "ca.uhn.fhir.rest.api.server.RequestDetails",
1981                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1982                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
1983        ),
1984
1985
1986        /**
1987         * <b>Performance Tracing Hook:</b>
1988         * <p>
1989         * This hook is invoked when a search has found an individual ID.
1990         * </p>
1991         * <p>
1992         * THIS IS AN EXPERIMENTAL HOOK AND MAY BE REMOVED OR CHANGED WITHOUT WARNING.
1993         * </p>
1994         * <p>
1995         * Note that this is a performance tracing hook. Use with caution in production
1996         * systems, since calling it may (or may not) carry a cost.
1997         * </p>
1998         * <p>
1999         * Hooks may accept the following parameters:
2000         * </p>
2001         * <ul>
2002         * <li>
2003         * java.lang.Integer - The query ID
2004         * </li>
2005         * <li>
2006         * java.lang.Object - The ID
2007         * </li>
2008         * </ul>
2009         * <p>
2010         * Hooks should return <code>void</code>.
2011         * </p>
2012         */
2013        JPA_PERFTRACE_SEARCH_FOUND_ID(void.class,
2014                "java.lang.Integer",
2015                "java.lang.Object"
2016        ),
2017
2018
2019        /**
2020         * <b>Performance Tracing Hook:</b>
2021         * This hook is invoked when a query has executed, and includes the raw SQL
2022         * statements that were executed against the database.
2023         * <p>
2024         * Note that this is a performance tracing hook. Use with caution in production
2025         * systems, since calling it may (or may not) carry a cost.
2026         * </p>
2027         * <p>
2028         * Hooks may accept the following parameters:
2029         * </p>
2030         * <ul>
2031         * <li>
2032         * 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
2033         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2034         * pulled out of the servlet request. Note that the bean
2035         * properties are not all guaranteed to be populated, depending on how early during processing the
2036         * exception occurred.
2037         * </li>
2038         * <li>
2039         * 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
2040         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2041         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2042         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2043         * </li>
2044         * <li>
2045         * ca.uhn.fhir.jpa.util.SqlQueryList - Contains details about the raw SQL queries.
2046         * </li>
2047         * </ul>
2048         * <p>
2049         * Hooks should return <code>void</code>.
2050         * </p>
2051         */
2052        JPA_PERFTRACE_RAW_SQL(void.class,
2053                "ca.uhn.fhir.rest.api.server.RequestDetails",
2054                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2055                "ca.uhn.fhir.jpa.util.SqlQueryList"
2056        ),
2057
2058        /**
2059         * This pointcut is used only for unit tests. Do not use in production code as it may be changed or
2060         * removed at any time.
2061         */
2062        TEST_RB(
2063                boolean.class,
2064                new ExceptionHandlingSpec().addLogAndSwallow(IllegalStateException.class),
2065                String.class.getName(),
2066                String.class.getName()),
2067
2068        /**
2069         * This pointcut is used only for unit tests. Do not use in production code as it may be changed or
2070         * removed at any time.
2071         */
2072        TEST_RO(BaseServerResponseException.class, String.class.getName(), String.class.getName());
2073
2074        private final List<String> myParameterTypes;
2075        private final Class<?> myReturnType;
2076        private final ExceptionHandlingSpec myExceptionHandlingSpec;
2077
2078        Pointcut(@Nonnull String theReturnType, String... theParameterTypes) {
2079                this(toReturnTypeClass(theReturnType), new ExceptionHandlingSpec(), theParameterTypes);
2080        }
2081
2082        Pointcut(@Nonnull Class<?> theReturnType, @Nonnull ExceptionHandlingSpec theExceptionHandlingSpec, String... theParameterTypes) {
2083                myReturnType = theReturnType;
2084                myExceptionHandlingSpec = theExceptionHandlingSpec;
2085                myParameterTypes = Collections.unmodifiableList(Arrays.asList(theParameterTypes));
2086        }
2087
2088        Pointcut(@Nonnull Class<?> theReturnType, String... theParameterTypes) {
2089                this(theReturnType, new ExceptionHandlingSpec(), theParameterTypes);
2090        }
2091
2092        public boolean isShouldLogAndSwallowException(@Nonnull Throwable theException) {
2093                for (Class<? extends Throwable> next : myExceptionHandlingSpec.myTypesToLogAndSwallow) {
2094                        if (next.isAssignableFrom(theException.getClass())) {
2095                                return true;
2096                        }
2097                }
2098                return false;
2099        }
2100
2101        @Nonnull
2102        public Class<?> getReturnType() {
2103                return myReturnType;
2104        }
2105
2106        @Nonnull
2107        public List<String> getParameterTypes() {
2108                return myParameterTypes;
2109        }
2110
2111        private static class UnknownType {
2112        }
2113
2114        private static class ExceptionHandlingSpec {
2115
2116                private final Set<Class<? extends Throwable>> myTypesToLogAndSwallow = new HashSet<>();
2117
2118                ExceptionHandlingSpec addLogAndSwallow(@Nonnull Class<? extends Throwable> theType) {
2119                        myTypesToLogAndSwallow.add(theType);
2120                        return this;
2121                }
2122
2123        }
2124
2125        private static Class<?> toReturnTypeClass(String theReturnType) {
2126                try {
2127                        return Class.forName(theReturnType);
2128                } catch (ClassNotFoundException theE) {
2129                        return UnknownType.class;
2130                }
2131        }
2132
2133}