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