001package ca.uhn.fhir.interceptor.api;
002
003/*-
004 * #%L
005 * HAPI FHIR - Core Library
006 * %%
007 * Copyright (C) 2014 - 2022 Smile CDR, Inc.
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 *
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 *
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
024import ca.uhn.fhir.rest.annotation.Read;
025import ca.uhn.fhir.rest.annotation.Search;
026import ca.uhn.fhir.rest.server.exceptions.AuthenticationException;
027import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
028import ca.uhn.fhir.validation.ValidationResult;
029import org.hl7.fhir.instance.model.api.IBaseConformance;
030
031import javax.annotation.Nonnull;
032import java.io.Writer;
033import java.util.Arrays;
034import java.util.Collections;
035import java.util.HashSet;
036import java.util.List;
037import java.util.Set;
038
039/**
040 * Value for {@link Hook#value()}
041 * <p>
042 * Hook pointcuts are divided into several broad categories:
043 * <ul>
044 * <li>INTERCEPTOR_xxx: Hooks on the interceptor infrastructure itself</li>
045 * <li>CLIENT_xxx: Hooks on the HAPI FHIR Client framework</li>
046 * <li>SERVER_xxx: Hooks on the HAPI FHIR Server framework</li>
047 * <li>SUBSCRIPTION_xxx: Hooks on the HAPI FHIR Subscription framework</li>
048 * <li>STORAGE_xxx: Hooks on the storage engine</li>
049 * <li>VALIDATION_xxx: Hooks on the HAPI FHIR Validation framework</li>
050 * <li>JPA_PERFTRACE_xxx: Performance tracing hooks on the JPA server</li>
051 * </ul>
052 * </p>
053 */
054public enum Pointcut implements IPointcut {
055
056        /**
057         * <b>Interceptor Framework Hook:</b>
058         * This pointcut will be called once when a given interceptor is registered
059         */
060        INTERCEPTOR_REGISTERED(void.class),
061
062        /**
063         * <b>Client Hook:</b>
064         * This hook is called before an HTTP client request is sent
065         * <p>
066         * Hooks may accept the following parameters:
067         * <ul>
068         * <li>
069         * ca.uhn.fhir.rest.client.api.IHttpRequest - The details of the request
070         * </li>
071         * <li>
072         *    ca.uhn.fhir.rest.client.api.IRestfulClient - The client object making the request
073         * </li>
074         * </ul>
075         * </p>
076         * Hook methods must return <code>void</code>.
077         */
078        CLIENT_REQUEST(void.class,
079                "ca.uhn.fhir.rest.client.api.IHttpRequest",
080                "ca.uhn.fhir.rest.client.api.IRestfulClient"
081        ),
082
083        /**
084         * <b>Client Hook:</b>
085         * This hook is called after an HTTP client request has completed, prior to returning
086         * the results to the calling code. Hook methods may modify the response.
087         * <p>
088         * Hooks may accept the following parameters:
089         * <ul>
090         * <li>
091         * ca.uhn.fhir.rest.client.api.IHttpRequest - The details of the request
092         * </li>
093         * <li>
094         * ca.uhn.fhir.rest.client.api.IHttpResponse - The details of the response
095         * </li>
096         * <li>
097         *    ca.uhn.fhir.rest.client.api.IRestfulClient - The client object making the request
098         * </li>
099         * </ul>
100         * </p>
101         * Hook methods must return <code>void</code>.
102         */
103        CLIENT_RESPONSE(void.class,
104                "ca.uhn.fhir.rest.client.api.IHttpRequest",
105                "ca.uhn.fhir.rest.client.api.IHttpResponse",
106                "ca.uhn.fhir.rest.client.api.IRestfulClient"
107        ),
108
109        /**
110         * <b>Server Hook:</b>
111         * This hook is called when a server CapabilityStatement is generated for returning to a client.
112         * <p>
113         * This pointcut will not necessarily be invoked for every client request to the `/metadata` endpoint.
114         * If caching of the generated CapabilityStatement is enabled, a new CapabilityStatement will be
115         * generated periodically and this pointcut will be invoked at that time.
116         * </p>
117         * <p>
118         * Hooks may accept the following parameters:
119         * <ul>
120         * <li>
121         * org.hl7.fhir.instance.model.api.IBaseConformance - The <code>CapabilityStatement</code> resource that will
122         * be returned to the client by the server. Interceptors may make changes to this resource. The parameter
123         * must be of type <code>IBaseConformance</code>, so it is the responsibility of the interceptor hook method
124         * code to cast to the appropriate version.
125         * </li>
126         * <li>
127         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to
128         * be processed
129         * </li>
130         * <li>
131         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that
132         * is about to be processed. This parameter is identical to the RequestDetails parameter above but will only
133         * be populated when operating in a RestfulServer implementation. It is provided as a convenience.
134         * </li>
135         * </ul>
136         * </p>
137         * Hook methods may an instance of a new <code>CapabilityStatement</code> resource which will replace the
138         * one that was supplied to the interceptor, or <code>void</code> to use the original one. If the interceptor
139         * chooses to modify the <code>CapabilityStatement</code> that was supplied to the interceptor, it is fine
140         * for your hook method to return <code>void</code> or <code>null</code>.
141         */
142        SERVER_CAPABILITY_STATEMENT_GENERATED(IBaseConformance.class,
143                "org.hl7.fhir.instance.model.api.IBaseConformance",
144                "ca.uhn.fhir.rest.api.server.RequestDetails",
145                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
146        ),
147
148        /**
149         * <b>Server Hook:</b>
150         * This hook is called before any other processing takes place for each incoming request. It may be used to provide
151         * alternate handling for some requests, or to screen requests before they are handled, etc.
152         * <p>
153         * Note that any exceptions thrown by this method will not be trapped by HAPI (they will be passed up to the server)
154         * </p>
155         * <p>
156         * Hooks may accept the following parameters:
157         * <ul>
158         * <li>
159         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
160         * </li>
161         * <li>
162         * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
163         * </li>
164         * </ul>
165         * </p>
166         * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally.
167         * This is generally the right thing to do. If your interceptor is providing a response rather than
168         * letting HAPI handle the response normally, you must return <code>false</code>. In this case,
169         * no further processing will occur and no further interceptors will be called.
170         */
171        SERVER_INCOMING_REQUEST_PRE_PROCESSED(boolean.class,
172                "javax.servlet.http.HttpServletRequest",
173                "javax.servlet.http.HttpServletResponse"
174        ),
175
176        /**
177         * <b>Server Hook:</b>
178         * This hook is invoked upon any exception being thrown within the server's request processing code. This includes
179         * any exceptions thrown within resource provider methods (e.g. {@link Search} and {@link Read} methods) as well as
180         * any runtime exceptions thrown by the server itself. This also includes any {@link AuthenticationException}
181         * thrown.
182         * <p>
183         * Hooks may accept the following parameters:
184         * <ul>
185         * <li>
186         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
187         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
188         * pulled out of the servlet request. Note that the bean
189         * properties are not all guaranteed to be populated, depending on how early during processing the
190         * exception occurred.
191         * </li>
192         * <li>
193         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
194         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
195         * pulled out of the servlet request. Note that the bean
196         * properties are not all guaranteed to be populated, depending on how early during processing the
197         * exception occurred. This parameter is identical to the RequestDetails parameter above but will
198         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
199         * </li>
200         * <li>
201         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
202         * </li>
203         * <li>
204         * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
205         * </li>
206         * <li>
207         * ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException - The exception that was thrown
208         * </li>
209         * </ul>
210         * </p>
211         * <p>
212         * Implementations of this method may choose to ignore/log/count/etc exceptions, and return <code>true</code> or
213         * <code>void</code>. In
214         * this case, processing will continue, and the server will automatically generate an {@link BaseOperationOutcome
215         * OperationOutcome}. Implementations may also choose to provide their own response to the client. In this case, they
216         * should return <code>false</code>, to indicate that they have handled the request and processing should stop.
217         * </p>
218         */
219        SERVER_HANDLE_EXCEPTION(boolean.class,
220                "ca.uhn.fhir.rest.api.server.RequestDetails",
221                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
222                "javax.servlet.http.HttpServletRequest",
223                "javax.servlet.http.HttpServletResponse",
224                "ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException"
225        ),
226
227        /**
228         * <b>Server Hook:</b>
229         * This method is immediately before the handling method is selected. Interceptors may make changes
230         * to the request that can influence which handler will ultimately be called.
231         * <p>
232         * Hooks may accept the following parameters:
233         * <ul>
234         * <li>
235         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
236         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
237         * pulled out of the servlet request.
238         * Note that the bean properties are not all guaranteed to be populated at the time this hook is called.
239         * </li>
240         * <li>
241         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
242         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
243         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
244         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
245         * </li>
246         * <li>
247         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
248         * </li>
249         * <li>
250         * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
251         * </li>
252         * </ul>
253         * <p>
254         * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally.
255         * This is generally the right thing to do.
256         * If your interceptor is providing an HTTP response rather than letting HAPI handle the response normally, you
257         * must return <code>false</code>. In this case, no further processing will occur and no further interceptors
258         * will be called.
259         * </p>
260         * <p>
261         * Hook methods may also throw {@link AuthenticationException} if they would like. This exception may be thrown
262         * to indicate that the interceptor has detected an unauthorized access
263         * attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client.
264         *
265         * @since 5.4.0
266         */
267        SERVER_INCOMING_REQUEST_PRE_HANDLER_SELECTED(boolean.class,
268                "ca.uhn.fhir.rest.api.server.RequestDetails",
269                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
270                "javax.servlet.http.HttpServletRequest",
271                "javax.servlet.http.HttpServletResponse"
272        ),
273
274        /**
275         * <b>Server Hook:</b>
276         * This method is called just before the actual implementing server method is invoked.
277         * <p>
278         * Hooks may accept the following parameters:
279         * <ul>
280         * <li>
281         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
282         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
283         * pulled out of the servlet request. Note that the bean
284         * properties are not all guaranteed to be populated, depending on how early during processing the
285         * exception occurred.
286         * </li>
287         * <li>
288         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
289         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
290         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
291         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
292         * </li>
293         * <li>
294         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
295         * </li>
296         * <li>
297         * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
298         * </li>
299         * </ul>
300         * <p>
301         * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally.
302         * This is generally the right thing to do.
303         * If your interceptor is providing an HTTP response rather than letting HAPI handle the response normally, you
304         * must return <code>false</code>. In this case, no further processing will occur and no further interceptors
305         * will be called.
306         * </p>
307         * <p>
308         * Hook methods may also throw {@link AuthenticationException} if they would like. This exception may be thrown
309         * to indicate that the interceptor has detected an unauthorized access
310         * attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client.
311         */
312        SERVER_INCOMING_REQUEST_POST_PROCESSED(boolean.class,
313                "ca.uhn.fhir.rest.api.server.RequestDetails",
314                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
315                "javax.servlet.http.HttpServletRequest",
316                "javax.servlet.http.HttpServletResponse"
317        ),
318
319
320        /**
321         * <b>Server Hook:</b>
322         * This hook is invoked before an incoming request is processed. Note that this method is called
323         * after the server has begun preparing the response to the incoming client request.
324         * As such, it is not able to supply a response to the incoming request in the way that
325         * SERVER_INCOMING_REQUEST_PRE_PROCESSED and
326         * {@link #SERVER_INCOMING_REQUEST_POST_PROCESSED}
327         * are.
328         * <p>
329         * Hooks may accept the following parameters:
330         * <ul>
331         * <li>
332         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
333         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
334         * pulled out of the servlet request. Note that the bean
335         * properties are not all guaranteed to be populated, depending on how early during processing the
336         * exception occurred.
337         * </li>
338         * <li>
339         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
340         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
341         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
342         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
343         * </li>
344         * <li>
345         * ca.uhn.fhir.rest.api.RestOperationTypeEnum - The type of operation that the FHIR server has determined that the client is trying to invoke
346         * </li>
347         * <li>
348         * ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails - This parameter is provided for legacy reasons only and will be removed in the future. Do not use.
349         * </li>
350         * </ul>
351         * </p>
352         * <p>
353         * Hook methods must return <code>void</code>
354         * </p>
355         * <p>
356         * Hook methods method may throw a subclass of {@link BaseServerResponseException}, and processing
357         * will be aborted with an appropriate error returned to the client.
358         * </p>
359         */
360        SERVER_INCOMING_REQUEST_PRE_HANDLED(void.class,
361                "ca.uhn.fhir.rest.api.server.RequestDetails",
362                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
363                "ca.uhn.fhir.rest.api.RestOperationTypeEnum",
364                "ca.uhn.fhir.rest.server.interceptor.IServerInterceptor$ActionRequestDetails"
365        ),
366
367        /**
368         * <b>Server Hook:</b>
369         * This method is called upon any exception being thrown within the server's request processing code. This includes
370         * any exceptions thrown within resource provider methods (e.g. {@link Search} and {@link Read} methods) as well as
371         * any runtime exceptions thrown by the server itself. This hook method is invoked for each interceptor (until one of them
372         * returns a non-<code>null</code> response or the end of the list is reached), after which
373         * {@link #SERVER_HANDLE_EXCEPTION} is
374         * called for each interceptor.
375         * <p>
376         * This may be used to add an OperationOutcome to a response, or to convert between exception types for any reason.
377         * </p>
378         * <p>
379         * Implementations of this method may choose to ignore/log/count/etc exceptions, and return <code>null</code>. In
380         * this case, processing will continue, and the server will automatically generate an {@link BaseOperationOutcome
381         * OperationOutcome}. Implementations may also choose to provide their own response to the client. In this case, they
382         * should return a non-<code>null</code>, to indicate that they have handled the request and processing should stop.
383         * </p>
384         * <p>
385         * Hooks may accept the following parameters:
386         * <ul>
387         * <li>
388         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
389         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
390         * pulled out of the servlet request. Note that the bean
391         * properties are not all guaranteed to be populated, depending on how early during processing the
392         * exception occurred.
393         * </li>
394         * <li>
395         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
396         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
397         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
398         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
399         * </li>
400         * <li>
401         * java.lang.Throwable - The exception that was thrown. This will often be an instance of
402         * {@link BaseServerResponseException} but will not necessarily be one (e.g. it could be a
403         * {@link NullPointerException} in the case of a bug being triggered.
404         * </li>
405         * <li>
406         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
407         * </li>
408         * <li>
409         * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
410         * </li>
411         * </ul>
412         * <p>
413         * Hook methods may return a new exception to use for processing, or <code>null</code> if this interceptor is not trying to
414         * modify the exception. For example, if this interceptor has nothing to do with exception processing, it
415         * should always return <code>null</code>. If this interceptor adds an OperationOutcome to the exception, it
416         * should return an exception.
417         * </p>
418         */
419        SERVER_PRE_PROCESS_OUTGOING_EXCEPTION(BaseServerResponseException.class,
420                "ca.uhn.fhir.rest.api.server.RequestDetails",
421                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
422                "java.lang.Throwable",
423                "javax.servlet.http.HttpServletRequest",
424                "javax.servlet.http.HttpServletResponse"
425        ),
426
427        /**
428         * <b>Server Hook:</b>
429         * This method is called after the server implementation method has been called, but before any attempt
430         * to stream the response back to the client. Interceptors may examine or modify the response before it
431         * is returned, or even prevent the response.
432         * <p>
433         * Hooks may accept the following parameters:
434         * <ul>
435         * <li>
436         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
437         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
438         * pulled out of the servlet request.
439         * </li>
440         * <li>
441         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
442         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
443         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
444         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
445         * </li>
446         * <li>
447         * org.hl7.fhir.instance.model.api.IBaseResource - The resource that will be returned. This parameter may be <code>null</code> for some responses.
448         * </li>
449         * <li>
450         * ca.uhn.fhir.rest.api.server.ResponseDetails - This object contains details about the response, including the contents. Hook methods may modify this object to change or replace the response.
451         * </li>
452         * <li>
453         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
454         * </li>
455         * <li>
456         * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
457         * </li>
458         * </ul>
459         * </p>
460         * <p>
461         * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally.
462         * This is generally the right thing to do. If your interceptor is providing a response rather than
463         * letting HAPI handle the response normally, you must return <code>false</code>. In this case,
464         * no further processing will occur and no further interceptors will be called.
465         * </p>
466         * <p>
467         * Hook methods may also throw {@link AuthenticationException} to indicate that the interceptor
468         * has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401
469         * will be returned to the client.
470         */
471        SERVER_OUTGOING_RESPONSE(boolean.class,
472                "ca.uhn.fhir.rest.api.server.RequestDetails",
473                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
474                "org.hl7.fhir.instance.model.api.IBaseResource",
475                "ca.uhn.fhir.rest.api.server.ResponseDetails",
476                "javax.servlet.http.HttpServletRequest",
477                "javax.servlet.http.HttpServletResponse"
478        ),
479
480
481        /**
482         * <b>Server Hook:</b>
483         * This method is called when a stream writer is generated that will be used to stream a non-binary response to
484         * a client. Hooks may return a wrapped writer which adds additional functionality as needed.
485         *
486         * <p>
487         * Hooks may accept the following parameters:
488         * <ul>
489         * <li>
490         * java.io.Writer - The response writing Writer. Typically a hook will wrap this writer and layer additional functionality
491         * into the wrapping writer.
492         * </li>
493         * <li>
494         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
495         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
496         * pulled out of the servlet request.
497         * </li>
498         * <li>
499         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
500         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
501         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
502         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
503         * </li>
504         * </ul>
505         * </p>
506         * <p>
507         * Hook methods should return a {@link Writer} instance that will be used to stream the response. Hook methods
508         * should not throw any exception.
509         * </p>
510         *
511         * @since 5.0.0
512         */
513        SERVER_OUTGOING_WRITER_CREATED(Writer.class,
514                "java.io.Writer",
515                "ca.uhn.fhir.rest.api.server.RequestDetails",
516                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
517        ),
518
519
520        /**
521         * <b>Server Hook:</b>
522         * This method is called after the server implementation method has been called, but before any attempt
523         * to stream the response back to the client, specifically for GraphQL requests (as these do not fit
524         * cleanly into the model provided by {@link #SERVER_OUTGOING_RESPONSE}).
525         * <p>
526         * Hooks may accept the following parameters:
527         * <ul>
528         * <li>
529         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
530         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
531         * pulled out of the servlet request.
532         * </li>
533         * <li>
534         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
535         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
536         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
537         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
538         * </li>
539         * <li>
540         * java.lang.String - The GraphQL query
541         * </li>
542         * <li>
543         * java.lang.String - The GraphQL response
544         * </li>
545         * <li>
546         * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
547         * </li>
548         * <li>
549         * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
550         * </li>
551         * </ul>
552         * </p>
553         * <p>
554         * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally.
555         * This is generally the right thing to do. If your interceptor is providing a response rather than
556         * letting HAPI handle the response normally, you must return <code>false</code>. In this case,
557         * no further processing will occur and no further interceptors will be called.
558         * </p>
559         * <p>
560         * Hook methods may also throw {@link AuthenticationException} to indicate that the interceptor
561         * has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401
562         * will be returned to the client.
563         */
564        SERVER_OUTGOING_GRAPHQL_RESPONSE(boolean.class,
565                "ca.uhn.fhir.rest.api.server.RequestDetails",
566                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
567                "java.lang.String",
568                "java.lang.String",
569                "javax.servlet.http.HttpServletRequest",
570                "javax.servlet.http.HttpServletResponse"
571        ),
572
573
574        /**
575         * <b>Server Hook:</b>
576         * This method is called when an OperationOutcome is being returned in response to a failure.
577         * Hook methods may use this hook to modify the OperationOutcome being returned.
578         * <p>
579         * Hooks may accept the following parameters:
580         * <ul>
581         * <li>
582         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
583         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
584         * pulled out of the servlet request. Note that the bean
585         * properties are not all guaranteed to be populated, depending on how early during processing the
586         * exception occurred.
587         * </li>
588         * <li>
589         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
590         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
591         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
592         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
593         * </li>
594         * <li>
595         * org.hl7.fhir.instance.model.api.IBaseOperationOutcome - The OperationOutcome resource that will be
596         * returned.
597         * </ul>
598         * <p>
599         * Hook methods must return <code>void</code>
600         * </p>
601         */
602        SERVER_OUTGOING_FAILURE_OPERATIONOUTCOME(
603                void.class,
604                "ca.uhn.fhir.rest.api.server.RequestDetails",
605                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
606                "org.hl7.fhir.instance.model.api.IBaseOperationOutcome"
607        ),
608
609
610        /**
611         * <b>Server Hook:</b>
612         * This method is called after all processing is completed for a request, but only if the
613         * request completes normally (i.e. no exception is thrown).
614         * <p>
615         * Hooks may accept the following parameters:
616         * <ul>
617         * <li>
618         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
619         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
620         * pulled out of the servlet request.
621         * </li>
622         * <li>
623         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
624         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
625         * pulled out of the request. This will be null if the server is not deployed to a RestfulServer environment.
626         * </li>
627         * </ul>
628         * </p>
629         * <p>
630         * This method must return <code>void</code>
631         * </p>
632         * <p>
633         * This method should not throw any exceptions. Any exception that is thrown by this
634         * method will be logged, but otherwise not acted upon (i.e. even if a hook method
635         * throws an exception, processing will continue and other interceptors will be
636         * called). Therefore it is considered a bug to throw an exception from hook methods using this
637         * pointcut.
638         * </p>
639         */
640        SERVER_PROCESSING_COMPLETED_NORMALLY(
641                void.class,
642                new ExceptionHandlingSpec()
643                        .addLogAndSwallow(Throwable.class),
644                "ca.uhn.fhir.rest.api.server.RequestDetails",
645                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
646        ),
647
648        /**
649         * <b>Server Hook:</b>
650         * This method is called after all processing is completed for a request, regardless of whether
651         * the request completed successfully or not. It is called after {@link #SERVER_PROCESSING_COMPLETED_NORMALLY}
652         * in the case of successful operations.
653         * <p>
654         * Hooks may accept the following parameters:
655         * <ul>
656         * <li>
657         * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the
658         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
659         * pulled out of the servlet request.
660         * </li>
661         * <li>
662         * ca.uhn.fhir.rest.server.servlet.ServletRequestDetails - A bean containing details about the request that is about to be processed, including details such as the
663         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
664         * pulled out of the request. This will be null if the server is not deployed to a RestfulServer environment.
665         * </li>
666         * </ul>
667         * </p>
668         * <p>
669         * This method must return <code>void</code>
670         * </p>
671         * <p>
672         * This method should not throw any exceptions. Any exception that is thrown by this
673         * method will be logged, but otherwise not acted upon (i.e. even if a hook method
674         * throws an exception, processing will continue and other interceptors will be
675         * called). Therefore it is considered a bug to throw an exception from hook methods using this
676         * pointcut.
677         * </p>
678         */
679        SERVER_PROCESSING_COMPLETED(
680                void.class,
681                new ExceptionHandlingSpec()
682                        .addLogAndSwallow(Throwable.class),
683                "ca.uhn.fhir.rest.api.server.RequestDetails",
684                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
685        ),
686
687        /**
688         * <b>Subscription Hook:</b>
689         * Invoked whenever a persisted resource has been modified and is being submitted to the
690         * subscription processing pipeline. This method is called before the resource is placed
691         * on any queues for processing and executes synchronously during the resource modification
692         * operation itself, so it should return quickly.
693         * <p>
694         * Hooks may accept the following parameters:
695         * <ul>
696         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - Hooks may modify this parameter. This will affect the checking process.</li>
697         * </ul>
698         * </p>
699         * <p>
700         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
701         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
702         * returns <code>false</code>, subscription processing will not proceed for the given resource;
703         * </p>
704         */
705        SUBSCRIPTION_RESOURCE_MODIFIED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
706
707
708        /**
709         * <b>Subscription Hook:</b>
710         * Invoked any time that a resource is matched by an individual subscription, and
711         * is about to be queued for delivery.
712         * <p>
713         * Hooks may make changes to the delivery payload, or make changes to the
714         * canonical subscription such as adding headers, modifying the channel
715         * endpoint, etc.
716         * </p>
717         * Hooks may accept the following parameters:
718         * <ul>
719         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
720         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
721         * <li>ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult</li>
722         * </ul>
723         * <p>
724         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
725         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
726         * returns <code>false</code>, delivery will be aborted.
727         * </p>
728         */
729        SUBSCRIPTION_RESOURCE_MATCHED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage", "ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult"),
730
731        /**
732         * <b>Subscription Hook:</b>
733         * Invoked whenever a persisted resource was checked against all active subscriptions, and did not
734         * match any.
735         * <p>
736         * Hooks may accept the following parameters:
737         * <ul>
738         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - Hooks should not modify this parameter as changes will not have any effect.</li>
739         * </ul>
740         * </p>
741         * <p>
742         * Hooks should return <code>void</code>.
743         * </p>
744         */
745        SUBSCRIPTION_RESOURCE_DID_NOT_MATCH_ANY_SUBSCRIPTIONS(void.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"),
746
747        /**
748         * <b>Subscription Hook:</b>
749         * Invoked immediately before the delivery of a subscription, and right before any channel-specific
750         * hooks are invoked (e.g. {@link #SUBSCRIPTION_BEFORE_REST_HOOK_DELIVERY}.
751         * <p>
752         * Hooks may make changes to the delivery payload, or make changes to the
753         * canonical subscription such as adding headers, modifying the channel
754         * endpoint, etc.
755         * </p>
756         * Hooks may accept the following parameters:
757         * <ul>
758         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
759         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
760         * </ul>
761         * <p>
762         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
763         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
764         * returns <code>false</code>, processing will be aborted.
765         * </p>
766         */
767        SUBSCRIPTION_BEFORE_DELIVERY(boolean.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
768
769        /**
770         * <b>Subscription Hook:</b>
771         * Invoked immediately after the delivery of a subscription, and right before any channel-specific
772         * hooks are invoked (e.g. {@link #SUBSCRIPTION_AFTER_REST_HOOK_DELIVERY}.
773         * <p>
774         * Hooks may accept the following parameters:
775         * </p>
776         * <ul>
777         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
778         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
779         * </ul>
780         * <p>
781         * Hooks should return <code>void</code>.
782         * </p>
783         */
784        SUBSCRIPTION_AFTER_DELIVERY(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
785
786
787        /**
788         * <b>Subscription Hook:</b>
789         * Invoked immediately after the attempted delivery of a subscription, if the delivery
790         * failed.
791         * <p>
792         * Hooks may accept the following parameters:
793         * </p>
794         * <ul>
795         * <li>java.lang.Exception - The exception that caused the failure.  Note this could be an exception thrown by a SUBSCRIPTION_BEFORE_DELIVERY or SUBSCRIPTION_AFTER_DELIVERY interceptor</li>
796         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage - the message that triggered the exception</li>
797         * <li>java.lang.Exception</li>
798         * </ul>
799         * <p>
800         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
801         * <code>void</code> or <code>true</code>, processing will continue normally, meaning that
802         * an exception will be thrown by the delivery mechanism. This typically means that the
803         * message will be returned to the processing queue. If the method
804         * returns <code>false</code>, processing will be aborted and no further action will be
805         * taken for the delivery.
806         * </p>
807         */
808        SUBSCRIPTION_AFTER_DELIVERY_FAILED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage", "java.lang.Exception"),
809
810        /**
811         * <b>Subscription Hook:</b>
812         * Invoked immediately after the delivery of a REST HOOK subscription.
813         * <p>
814         * When this hook is called, all processing is complete so this hook should not
815         * make any changes to the parameters.
816         * </p>
817         * Hooks may accept the following parameters:
818         * <ul>
819         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
820         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
821         * </ul>
822         * <p>
823         * Hooks should return <code>void</code>.
824         * </p>
825         */
826        SUBSCRIPTION_AFTER_REST_HOOK_DELIVERY(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
827
828        /**
829         * <b>Subscription Hook:</b>
830         * Invoked immediately before the delivery of a REST HOOK subscription.
831         * <p>
832         * Hooks may make changes to the delivery payload, or make changes to the
833         * canonical subscription such as adding headers, modifying the channel
834         * endpoint, etc.
835         * </p>
836         * Hooks may accept the following parameters:
837         * <ul>
838         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
839         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
840         * </ul>
841         * <p>
842         * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns
843         * <code>void</code> or <code>true</code>, processing will continue normally. If the method
844         * returns <code>false</code>, processing will be aborted.
845         * </p>
846         */
847        SUBSCRIPTION_BEFORE_REST_HOOK_DELIVERY(boolean.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
848
849        /**
850         * <b>Subscription Hook:</b>
851         * Invoked immediately after the delivery of MESSAGE subscription.
852         * <p>
853         * When this hook is called, all processing is complete so this hook should not
854         * make any changes to the parameters.
855         * </p>
856         * Hooks may accept the following parameters:
857         * <ul>
858         * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li>
859         * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li>
860         * </ul>
861         * <p>
862         * Hooks should return <code>void</code>.
863         * </p>
864         */
865        SUBSCRIPTION_AFTER_MESSAGE_DELIVERY(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"),
866
867        /**
868         * <b>Subscription Hook:</b>
869         * Invoked immediately before the delivery of a MESSAGE subscription.
870         * <p>
871         * Hooks may make changes to the delivery payload, or make changes to the
872         * canonical subscription such as adding headers, modifying the channel
873         * endpoint, etc.
874         * </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 client-assigned id is created.
1351         * <p>
1352         * Hooks will have access to the contents of the resource being created
1353         * so that client-assigned ids can be allowed/denied. These changes will
1354         * be reflected in permanent storage.
1355         * </p>
1356         * Hooks may accept the following parameters:
1357         * <ul>
1358         * <li>org.hl7.fhir.instance.model.api.IBaseResource</li>
1359         * <li>
1360         * 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
1361         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1362         * pulled out of the servlet request. Note that the bean
1363         * properties are not all guaranteed to be populated, depending on how early during processing the
1364         * exception occurred.
1365         * </li>
1366         * </ul>
1367         * <p>
1368         * Hooks should return <code>void</code>.
1369         * </p>
1370         */
1371        STORAGE_PRESTORAGE_CLIENT_ASSIGNED_ID(void.class,
1372                "org.hl7.fhir.instance.model.api.IBaseResource",
1373                "ca.uhn.fhir.rest.api.server.RequestDetails"
1374        ),
1375
1376        /**
1377         * <b>Storage Hook:</b>
1378         * Invoked before a resource will be updated, immediately before the resource
1379         * is persisted to the database.
1380         * <p>
1381         * Hooks will have access to the contents of the resource being updated
1382         * (both the previous and new contents) and may choose to make modifications
1383         * to the new contents of the resource. These changes will be reflected in
1384         * permanent storage.
1385         * </p>
1386         * Hooks may accept the following parameters:
1387         * <ul>
1388         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The previous contents of the resource being updated</li>
1389         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The new contents of the resource being updated</li>
1390         * <li>
1391         * 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
1392         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1393         * pulled out of the servlet request. Note that the bean
1394         * properties are not all guaranteed to be populated, depending on how early during processing the
1395         * exception occurred.
1396         * </li>
1397         * <li>
1398         * 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
1399         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1400         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1401         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1402         * </li>
1403         * <li>
1404         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1405         * </li>
1406         * </ul>
1407         * <p>
1408         * Hooks should return <code>void</code>.
1409         * </p>
1410         */
1411        STORAGE_PRESTORAGE_RESOURCE_UPDATED(void.class,
1412                "org.hl7.fhir.instance.model.api.IBaseResource",
1413                "org.hl7.fhir.instance.model.api.IBaseResource",
1414                "ca.uhn.fhir.rest.api.server.RequestDetails",
1415                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1416                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1417        ),
1418
1419        /**
1420         * <b>Storage Hook:</b>
1421         * Invoked before a resource will be created, immediately before the resource
1422         * is persisted to the database.
1423         * <p>
1424         * Hooks will have access to the contents of the resource being created
1425         * and may choose to make modifications to it. These changes will be
1426         * reflected in permanent storage.
1427         * </p>
1428         * Hooks may accept the following parameters:
1429         * <ul>
1430         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li>
1431         * <li>
1432         * 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
1433         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1434         * pulled out of the servlet request. Note that the bean
1435         * properties are not all guaranteed to be populated, depending on how early during processing the
1436         * exception occurred.
1437         * </li>
1438         * <li>
1439         * 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
1440         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1441         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1442         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1443         * </li>
1444         * <li>
1445         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1446         * </li>
1447         * </ul>
1448         * <p>
1449         * Hooks should return <code>void</code>.
1450         * </p>
1451         */
1452        STORAGE_PRESTORAGE_RESOURCE_DELETED(void.class,
1453                "org.hl7.fhir.instance.model.api.IBaseResource",
1454                "ca.uhn.fhir.rest.api.server.RequestDetails",
1455                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1456                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1457        ),
1458
1459
1460        /**
1461         * <b>Storage Hook:</b>
1462         * Invoked before a resource will be created, immediately before the transaction
1463         * is committed (after all validation and other business rules have successfully
1464         * completed, and any other database activity is complete.
1465         * <p>
1466         * Hooks will have access to the contents of the resource being created
1467         * but should generally not make any
1468         * changes as storage has already occurred. Changes will not be reflected
1469         * in storage, but may be reflected in the HTTP response.
1470         * </p>
1471         * Hooks may accept the following parameters:
1472         * <ul>
1473         * <li>org.hl7.fhir.instance.model.api.IBaseResource</li>
1474         * <li>
1475         * 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
1476         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1477         * pulled out of the servlet request. Note that the bean
1478         * properties are not all guaranteed to be populated, depending on how early during processing the
1479         * exception occurred.
1480         * </li>
1481         * <li>
1482         * 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
1483         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1484         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1485         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1486         * </li>
1487         * <li>
1488         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1489         * </li>
1490         * <li>
1491         * Boolean - Whether this pointcut invocation was deferred or not(since 5.4.0)
1492         * </li>
1493         * <li>
1494         * ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum - The timing at which the invocation of the interceptor took place. Options are ACTIVE and DEFERRED.
1495         * </li>
1496         * </ul>
1497         * <p>
1498         * Hooks should return <code>void</code>.
1499         * </p>
1500         */
1501        STORAGE_PRECOMMIT_RESOURCE_CREATED(void.class,
1502                "org.hl7.fhir.instance.model.api.IBaseResource",
1503                "ca.uhn.fhir.rest.api.server.RequestDetails",
1504                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1505                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
1506                "ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum"
1507        ),
1508
1509        /**
1510         * <b>Storage Hook:</b>
1511         * Invoked before a resource will be updated, immediately before the transaction
1512         * is committed (after all validation and other business rules have successfully
1513         * completed, and any other database activity is complete.
1514         * <p>
1515         * Hooks will have access to the contents of the resource being updated
1516         * (both the previous and new contents) but should generally not make any
1517         * changes as storage has already occurred. Changes will not be reflected
1518         * in storage, but may be reflected in the HTTP response.
1519         * </p>
1520         * Hooks may accept the following parameters:
1521         * <ul>
1522         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The previous contents of the resource</li>
1523         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The proposed new contents of the resource</li>
1524         * <li>
1525         * 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
1526         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1527         * pulled out of the servlet request. Note that the bean
1528         * properties are not all guaranteed to be populated, depending on how early during processing the
1529         * exception occurred.
1530         * </li>
1531         * <li>
1532         * 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
1533         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1534         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1535         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1536         * </li>
1537         * <li>
1538         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1539         * </li>
1540         * <li>
1541         * ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum - The timing at which the invocation of the interceptor took place. Options are ACTIVE and DEFERRED.
1542         * </li>
1543         * </ul>
1544         * <p>
1545         * Hooks should return <code>void</code>.
1546         * </p>
1547         */
1548        STORAGE_PRECOMMIT_RESOURCE_UPDATED(void.class,
1549                "org.hl7.fhir.instance.model.api.IBaseResource",
1550                "org.hl7.fhir.instance.model.api.IBaseResource",
1551                "ca.uhn.fhir.rest.api.server.RequestDetails",
1552                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1553                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
1554                "ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum"
1555        ),
1556
1557
1558        /**
1559         * <b>Storage Hook:</b>
1560         * Invoked before a resource will be deleted
1561         * <p>
1562         * Hooks will have access to the contents of the resource being deleted
1563         * but should not make any changes as storage has already occurred
1564         * </p>
1565         * Hooks may accept the following parameters:
1566         * <ul>
1567         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li>
1568         * <li>
1569         * 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
1570         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1571         * pulled out of the servlet request. Note that the bean
1572         * properties are not all guaranteed to be populated, depending on how early during processing the
1573         * exception occurred.
1574         * </li>
1575         * <li>
1576         * 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
1577         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1578         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1579         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1580         * </li>
1581         * <li>
1582         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1583         * </li>
1584         * <li>
1585         * ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum - The timing at which the invocation of the interceptor took place. Options are ACTIVE and DEFERRED.
1586         * </li>
1587         * </ul>
1588         * <p>
1589         * Hooks should return <code>void</code>.
1590         * </p>
1591         */
1592        STORAGE_PRECOMMIT_RESOURCE_DELETED(void.class,
1593                "org.hl7.fhir.instance.model.api.IBaseResource",
1594                "ca.uhn.fhir.rest.api.server.RequestDetails",
1595                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1596                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails",
1597                "ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum"
1598        ),
1599
1600        /**
1601         * <b>Storage Hook:</b>
1602         * Invoked after all entries in a transaction bundle have been executed
1603         * <p>
1604         * Hooks will have access to the original bundle, as well as all the deferred interceptor broadcasts related to the
1605         * processing of the transaction bundle
1606         * </p>
1607         * Hooks may accept the following parameters:
1608         * <ul>
1609         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li>
1610         * <li>
1611         * 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
1612         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1613         * pulled out of the servlet request. Note that the bean
1614         * properties are not all guaranteed to be populated, depending on how early during processing the
1615         * exception occurred.
1616         * </li>
1617         * <li>
1618         * 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
1619         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1620         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1621         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1622         * </li>
1623         * <li>
1624         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1625         * </li>
1626         * <li>
1627         * ca.uhn.fhir.rest.api.server.storage.DeferredInterceptorBroadcasts- A collection of pointcut invocations and their parameters which were deferred.
1628         * </li>
1629         * </ul>
1630         * <p>
1631         * Hooks should return <code>void</code>.
1632         * </p>
1633         */
1634        STORAGE_TRANSACTION_PROCESSED(void.class,
1635                "org.hl7.fhir.instance.model.api.IBaseBundle",
1636                "ca.uhn.fhir.rest.api.server.storage.DeferredInterceptorBroadcasts",
1637                "ca.uhn.fhir.rest.api.server.RequestDetails",
1638                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1639                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1640        ),
1641
1642
1643        /**
1644         * <b>Storage Hook:</b>
1645         * Invoked during a FHIR transaction, immediately before processing all write operations (i.e. immediately
1646         * before a database transaction will be opened)
1647         * <p>
1648         * Hooks may accept the following parameters:
1649         * </p>
1650         * <ul>
1651         * <li>
1652         * ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails - Contains details about the transaction that is about to start
1653         * </li>
1654         * <li>
1655         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1656         * </li>
1657         * </ul>
1658         * <p>
1659         * Hooks should return <code>void</code>.
1660         * </p>
1661         */
1662        STORAGE_TRANSACTION_WRITE_OPERATIONS_PRE(void.class,
1663                "ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails",
1664                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1665        ),
1666
1667        /**
1668         * <b>Storage Hook:</b>
1669         * Invoked during a FHIR transaction, immediately after processing all write operations (i.e. immediately
1670         * after the transaction has been committed or rolled back). This hook will always be called if
1671         * {@link #STORAGE_TRANSACTION_WRITE_OPERATIONS_PRE} has been called, regardless of whether the operation
1672         * succeeded or failed.
1673         * <p>
1674         * Hooks may accept the following parameters:
1675         * </p>
1676         * <ul>
1677         * <li>
1678         * ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails - Contains details about the transaction that is about to start
1679         * </li>
1680         * <li>
1681         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1682         * </li>
1683         * </ul>
1684         * <p>
1685         * Hooks should return <code>void</code>.
1686         * </p>
1687         */
1688        STORAGE_TRANSACTION_WRITE_OPERATIONS_POST(void.class,
1689                "ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails",
1690                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1691        ),
1692
1693        /**
1694         * <b>Storage Hook:</b>
1695         * 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}.
1696         * <p>
1697         * Hooks will have access to the list of resources that have references to the resource being deleted.
1698         * </p>
1699         * Hooks may accept the following parameters:
1700         * <ul>
1701         * <li>ca.uhn.fhir.jpa.api.model.DeleteConflictList - The list of delete conflicts</li>
1702         * <li>
1703         * 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
1704         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1705         * pulled out of the servlet request. Note that the bean
1706         * properties are not all guaranteed to be populated, depending on how early during processing the
1707         * exception occurred.
1708         * </li>
1709         * <li>
1710         * 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
1711         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1712         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1713         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1714         * </li>
1715         * <li>
1716         * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0)
1717         * </li>
1718         * </ul>
1719         * <p>
1720         * Hooks should return <code>ca.uhn.fhir.jpa.delete.DeleteConflictOutcome</code>.
1721         * If the interceptor returns a non-null result, the DeleteConflictOutcome can be
1722         * used to indicate a number of times to retry.
1723         * </p>
1724         */
1725        STORAGE_PRESTORAGE_DELETE_CONFLICTS(
1726                // Return type
1727                "ca.uhn.fhir.jpa.delete.DeleteConflictOutcome",
1728                // Params
1729                "ca.uhn.fhir.jpa.api.model.DeleteConflictList",
1730                "ca.uhn.fhir.rest.api.server.RequestDetails",
1731                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1732                "ca.uhn.fhir.rest.api.server.storage.TransactionDetails"
1733        ),
1734
1735        /**
1736         * <b>Storage Hook:</b>
1737         * Invoked before a resource is about to be expunged via the <code>$expunge</code> operation.
1738         * <p>
1739         * Hooks will be passed a reference to a counter containing the current number of records that have been deleted.
1740         * If the hook deletes any records, the hook is expected to increment this counter by the number of records deleted.
1741         * </p>
1742         * <p>
1743         * Hooks may accept the following parameters:
1744         * </p>
1745         * <ul>
1746         * <li>java.util.concurrent.atomic.AtomicInteger - The counter holding the number of records deleted.</li>
1747         * <li>org.hl7.fhir.instance.model.api.IIdType - The ID of the resource that is about to be deleted</li>
1748         * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource that is about to be deleted</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 should return void.
1765         * </p>
1766         */
1767        STORAGE_PRESTORAGE_EXPUNGE_RESOURCE(
1768                // Return type
1769                void.class,
1770                // Params
1771                "java.util.concurrent.atomic.AtomicInteger",
1772                "org.hl7.fhir.instance.model.api.IIdType",
1773                "org.hl7.fhir.instance.model.api.IBaseResource",
1774                "ca.uhn.fhir.rest.api.server.RequestDetails",
1775                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1776        ),
1777
1778        /**
1779         * <b>Storage Hook:</b>
1780         * Invoked before an <code>$expunge</code> operation on all data (expungeEverything) is called.
1781         * <p>
1782         * Hooks will be passed a reference to a counter containing the current number of records that have been deleted.
1783         * If the hook deletes any records, the hook is expected to increment this counter by the number of records deleted.
1784         * </p>
1785         * Hooks may accept the following parameters:
1786         * <ul>
1787         * <li>java.util.concurrent.atomic.AtomicInteger - The counter holding the number of records deleted.</li>
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 should return void.
1804         * </p>
1805         */
1806        STORAGE_PRESTORAGE_EXPUNGE_EVERYTHING(
1807                // Return type
1808                void.class,
1809                // Params
1810                "java.util.concurrent.atomic.AtomicInteger",
1811                "ca.uhn.fhir.rest.api.server.RequestDetails",
1812                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1813        ),
1814
1815        /**
1816         * <b>Storage Hook:</b>
1817         * Invoked before FHIR <b>create</b> operation to request the identification of the partition ID to be associated
1818         * with the resource being created. This hook will only be called if partitioning is enabled in the JPA
1819         * server.
1820         * <p>
1821         * Hooks may accept the following parameters:
1822         * </p>
1823         * <ul>
1824         * <li>
1825         * org.hl7.fhir.instance.model.api.IBaseResource - The resource that will be created and needs a tenant ID assigned.
1826         * </li>
1827         * <li>
1828         * 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
1829         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1830         * pulled out of the servlet request. Note that the bean
1831         * properties are not all guaranteed to be populated, depending on how early during processing the
1832         * exception occurred.
1833         * </li>
1834         * <li>
1835         * 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
1836         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1837         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1838         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1839         * </li>
1840         * </ul>
1841         * <p>
1842         * Hooks must return an instance of <code>ca.uhn.fhir.interceptor.model.RequestPartitionId</code>.
1843         * </p>
1844         */
1845        STORAGE_PARTITION_IDENTIFY_CREATE(
1846                // Return type
1847                "ca.uhn.fhir.interceptor.model.RequestPartitionId",
1848                // Params
1849                "org.hl7.fhir.instance.model.api.IBaseResource",
1850                "ca.uhn.fhir.rest.api.server.RequestDetails",
1851                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1852        ),
1853
1854        /**
1855         * <b>Storage Hook:</b>
1856         * Invoked before FHIR read/access operation (e.g. <b>read/vread</b>, <b>search</b>, <b>history</b>, etc.) operation to request the
1857         * identification of the partition ID to be associated with the resource(s) being searched for, read, etc.
1858         * <p>
1859         * This hook will only be called if
1860         * partitioning is enabled in the JPA server.
1861         * </p>
1862         * <p>
1863         * Hooks may accept the following parameters:
1864         * </p>
1865         * <ul>
1866         * <li>
1867         * 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
1868         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1869         * pulled out of the servlet request. Note that the bean
1870         * properties are not all guaranteed to be populated, depending on how early during processing the
1871         * exception occurred.
1872         * </li>
1873         * <li>
1874         * 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
1875         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1876         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1877         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1878         * </li>
1879         * <li>ca.uhn.fhir.interceptor.model.ReadPartitionIdRequestDetails - Contains details about what is being read</li>
1880         * </ul>
1881         * <p>
1882         * Hooks must return an instance of <code>ca.uhn.fhir.interceptor.model.RequestPartitionId</code>.
1883         * </p>
1884         */
1885        STORAGE_PARTITION_IDENTIFY_READ(
1886                // Return type
1887                "ca.uhn.fhir.interceptor.model.RequestPartitionId",
1888                // Params
1889                "ca.uhn.fhir.rest.api.server.RequestDetails",
1890                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1891                "ca.uhn.fhir.interceptor.model.ReadPartitionIdRequestDetails"
1892        ),
1893
1894        /**
1895         * <b>Storage Hook:</b>
1896         * Invoked before any partition aware FHIR operation, when the selected partition has been identified (ie. after the
1897         * {@link #STORAGE_PARTITION_IDENTIFY_CREATE} or {@link #STORAGE_PARTITION_IDENTIFY_READ} hook was called. This allows
1898         * a separate hook to register, and potentially make decisions about whether the request should be allowed to proceed.
1899         * <p>
1900         * This hook will only be called if
1901         * partitioning is enabled in the JPA server.
1902         * </p>
1903         * <p>
1904         * Hooks may accept the following parameters:
1905         * </p>
1906         * <ul>
1907         * <li>
1908         * ca.uhn.fhir.interceptor.model.RequestPartitionId - The partition ID that was selected
1909         * </li>
1910         * <li>
1911         * 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
1912         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1913         * pulled out of the servlet request. Note that the bean
1914         * properties are not all guaranteed to be populated, depending on how early during processing the
1915         * exception occurred.
1916         * </li>
1917         * <li>
1918         * 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
1919         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1920         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1921         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1922         * </li>
1923         * <li>
1924         * ca.uhn.fhir.context.RuntimeResourceDefinition - the resource type being accessed
1925         * </li>
1926         * </ul>
1927         * <p>
1928         * Hooks must return void.
1929         * </p>
1930         */
1931        STORAGE_PARTITION_SELECTED(
1932                // Return type
1933                void.class,
1934                // Params
1935                "ca.uhn.fhir.interceptor.model.RequestPartitionId",
1936                "ca.uhn.fhir.rest.api.server.RequestDetails",
1937                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
1938                "ca.uhn.fhir.context.RuntimeResourceDefinition"
1939        ),
1940
1941        /**
1942         * <b>Storage Hook:</b>
1943         * Invoked when a transaction has been rolled back as a result of a {@link ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException},
1944         * meaning that a database constraint has been violated. This pointcut allows an interceptor to specify a resolution strategy
1945         * other than simply returning the error to the client. This interceptor will be fired after the database transaction rollback
1946         * has been completed.
1947         * <p>
1948         * Hooks may accept the following parameters:
1949         * </p>
1950         * <ul>
1951         * <li>
1952         * 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
1953         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1954         * pulled out of the servlet request. Note that the bean
1955         * properties are not all guaranteed to be populated, depending on how early during processing the
1956         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
1957         * known, such as while processing searches</b>
1958         * </li>
1959         * <li>
1960         * 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
1961         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
1962         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
1963         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
1964         * </li>
1965         * </ul>
1966         * <p>
1967         * Hooks should return <code>ca.uhn.fhir.jpa.api.model.ResourceVersionConflictResolutionStrategy</code>. Hooks should not
1968         * throw any exception.
1969         * </p>
1970         */
1971        STORAGE_VERSION_CONFLICT(
1972                "ca.uhn.fhir.jpa.api.model.ResourceVersionConflictResolutionStrategy",
1973                "ca.uhn.fhir.rest.api.server.RequestDetails",
1974                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
1975        ),
1976
1977        /**
1978         * <b>Validation Hook:</b>
1979         * This hook is called after validation has completed, regardless of whether the validation was successful or failed.
1980         * Typically this is used to modify validation results.
1981         * <p>
1982         * <b>Note on validation Pointcuts:</b> The HAPI FHIR interceptor framework is a part of the client and server frameworks and
1983         * not a part of the core FhirContext. Therefore this Pointcut is invoked by the
1984         * </p>
1985         * <p>
1986         * Hooks may accept the following parameters:
1987         * <ul>
1988         * <li>
1989         * org.hl7.fhir.instance.model.api.IBaseResource - The resource being validated, if a parsed version is available (null otherwise)
1990         * </li>
1991         * <li>
1992         * java.lang.String - The resource being validated, if a raw version is available (null otherwise)
1993         * </li>
1994         * <li>
1995         * ca.uhn.fhir.validation.ValidationResult - The outcome of the validation. Hooks methods should not modify this object, but they can return a new one.
1996         * </li>
1997         * </ul>
1998         * </p>
1999         * 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.
2000         */
2001        VALIDATION_COMPLETED(ValidationResult.class,
2002                "org.hl7.fhir.instance.model.api.IBaseResource",
2003                "java.lang.String",
2004                "ca.uhn.fhir.validation.ValidationResult"
2005        ),
2006
2007
2008        /**
2009         * <b>MDM(EMPI) Hook:</b>
2010         * Invoked whenever a persisted resource (a resource that has just been stored in the
2011         * database via a create/update/patch/etc.) has been matched against related resources and MDM links have been updated.
2012         * <p>
2013         * Hooks may accept the following parameters:
2014         * <ul>
2015         * <li>ca.uhn.fhir.rest.server.messaging.ResourceOperationMessage - This parameter should not be modified as processing is complete when this hook is invoked.</li>
2016         * <li>ca.uhn.fhir.rest.server.TransactionLogMessages - This parameter is for informational messages provided by the MDM module during MDM processing.</li>
2017         * <li>ca.uhn.fhir.mdm.api.MdmLinkChangeEvent - Contains information about the change event, including target and golden resource IDs and the operation type.</li>
2018         * </ul>
2019         * </p>
2020         * <p>
2021         * Hooks should return <code>void</code>.
2022         * </p>
2023         */
2024        MDM_AFTER_PERSISTED_RESOURCE_CHECKED(void.class,
2025                "ca.uhn.fhir.rest.server.messaging.ResourceOperationMessage",
2026                "ca.uhn.fhir.rest.server.TransactionLogMessages",
2027                "ca.uhn.fhir.mdm.api.MdmLinkEvent"),
2028
2029        /**
2030         * <b>Performance Tracing Hook:</b>
2031         * This hook is invoked when any informational messages generated by the
2032         * SearchCoordinator are created. It is typically used to provide logging
2033         * or capture details related to a specific request.
2034         * <p>
2035         * Note that this is a performance tracing hook. Use with caution in production
2036         * systems, since calling it may (or may not) carry a cost.
2037         * </p>
2038         * Hooks may accept the following parameters:
2039         * <ul>
2040         * <li>
2041         * 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
2042         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2043         * pulled out of the servlet request. Note that the bean
2044         * properties are not all guaranteed to be populated, depending on how early during processing the
2045         * exception occurred.
2046         * </li>
2047         * <li>
2048         * 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
2049         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2050         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2051         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2052         * </li>
2053         * <li>
2054         * ca.uhn.fhir.jpa.model.search.StorageProcessingMessage - Contains the message
2055         * </li>
2056         * </ul>
2057         * <p>
2058         * Hooks should return <code>void</code>.
2059         * </p>
2060         */
2061        JPA_PERFTRACE_INFO(void.class,
2062                "ca.uhn.fhir.rest.api.server.RequestDetails",
2063                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2064                "ca.uhn.fhir.jpa.model.search.StorageProcessingMessage"
2065        ),
2066
2067        /**
2068         * <b>Performance Tracing Hook:</b>
2069         * This hook is invoked when any warning messages generated by the
2070         * SearchCoordinator are created. It is typically used to provide logging
2071         * or capture details related to a specific request.
2072         * <p>
2073         * Note that this is a performance tracing hook. Use with caution in production
2074         * systems, since calling it may (or may not) carry a cost.
2075         * </p>
2076         * Hooks may accept the following parameters:
2077         * <ul>
2078         * <li>
2079         * 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
2080         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2081         * pulled out of the servlet request. Note that the bean
2082         * properties are not all guaranteed to be populated, depending on how early during processing the
2083         * exception occurred.
2084         * </li>
2085         * <li>
2086         * 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
2087         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2088         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2089         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2090         * </li>
2091         * <li>
2092         * ca.uhn.fhir.jpa.model.search.StorageProcessingMessage - Contains the message
2093         * </li>
2094         * </ul>
2095         * <p>
2096         * Hooks should return <code>void</code>.
2097         * </p>
2098         */
2099        JPA_PERFTRACE_WARNING(void.class,
2100                "ca.uhn.fhir.rest.api.server.RequestDetails",
2101                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2102                "ca.uhn.fhir.jpa.model.search.StorageProcessingMessage"
2103        ),
2104
2105        /**
2106         * <b>Performance Tracing Hook:</b>
2107         * This hook is invoked when a search has returned the very first result
2108         * from the database. The timing on this call can be a good indicator of how
2109         * performant a query is in general.
2110         * <p>
2111         * Note that this is a performance tracing hook. Use with caution in production
2112         * systems, since calling it may (or may not) carry a cost.
2113         * </p>
2114         * Hooks may accept the following parameters:
2115         * <ul>
2116         * <li>
2117         * 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
2118         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2119         * pulled out of the servlet request. Note that the bean
2120         * properties are not all guaranteed to be populated, depending on how early during processing the
2121         * exception occurred.
2122         * </li>
2123         * <li>
2124         * 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
2125         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2126         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2127         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2128         * </li>
2129         * <li>
2130         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2131         * performed. Hooks should not modify this object.
2132         * </li>
2133         * </ul>
2134         * <p>
2135         * Hooks should return <code>void</code>.
2136         * </p>
2137         */
2138        JPA_PERFTRACE_SEARCH_FIRST_RESULT_LOADED(void.class,
2139                "ca.uhn.fhir.rest.api.server.RequestDetails",
2140                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2141                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
2142        ),
2143
2144        /**
2145         * <b>Performance Tracing Hook:</b>
2146         * This hook is invoked when an individual search query SQL SELECT statement
2147         * has completed and no more results are available from that query. Note that this
2148         * doesn't necessarily mean that no more matching results exist in the database,
2149         * since HAPI FHIR JPA batch loads results in to the query cache in chunks in order
2150         * to provide predicable results without overloading memory or the database.
2151         * <p>
2152         * Note that this is a performance tracing hook. Use with caution in production
2153         * systems, since calling it may (or may not) carry a cost.
2154         * </p>
2155         * Hooks may accept the following parameters:
2156         * <ul>
2157         * <li>
2158         * 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
2159         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2160         * pulled out of the servlet request. Note that the bean
2161         * properties are not all guaranteed to be populated, depending on how early during processing the
2162         * exception occurred.
2163         * </li>
2164         * <li>
2165         * 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
2166         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2167         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2168         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2169         * </li>
2170         * <li>
2171         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2172         * performed. Hooks should not modify this object.
2173         * </li>
2174         * </ul>
2175         * <p>
2176         * Hooks should return <code>void</code>.
2177         * </p>
2178         */
2179        JPA_PERFTRACE_SEARCH_SELECT_COMPLETE(void.class,
2180                "ca.uhn.fhir.rest.api.server.RequestDetails",
2181                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2182                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
2183        ),
2184
2185
2186        /**
2187         * <b>Performance Tracing Hook:</b>
2188         * This hook is invoked when a search has failed for any reason. When this pointcut
2189         * is invoked, the search has completed unsuccessfully and will not be continued.
2190         * <p>
2191         * Note that this is a performance tracing hook. Use with caution in production
2192         * systems, since calling it may (or may not) carry a cost.
2193         * </p>
2194         * Hooks may accept the following parameters:
2195         * <ul>
2196         * <li>
2197         * 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
2198         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2199         * pulled out of the servlet request. Note that the bean
2200         * properties are not all guaranteed to be populated, depending on how early during processing the
2201         * exception occurred.
2202         * </li>
2203         * <li>
2204         * 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
2205         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2206         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2207         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2208         * </li>
2209         * <li>
2210         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2211         * performed. Hooks should not modify this object.
2212         * </li>
2213         * </ul>
2214         * <p>
2215         * Hooks should return <code>void</code>.
2216         * </p>
2217         */
2218        JPA_PERFTRACE_SEARCH_FAILED(void.class,
2219                "ca.uhn.fhir.rest.api.server.RequestDetails",
2220                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2221                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
2222        ),
2223
2224        /**
2225         * <b>Performance Tracing Hook:</b>
2226         * This hook is invoked when a search has completed. When this pointcut
2227         * is invoked, a pass in the Search Coordinator has completed successfully, but
2228         * not all possible resources have been loaded yet so a future paging request
2229         * may trigger a new task that will load further resources.
2230         * <p>
2231         * Note that this is a performance tracing hook. Use with caution in production
2232         * systems, since calling it may (or may not) carry a cost.
2233         * </p>
2234         * Hooks may accept the following parameters:
2235         * <ul>
2236         * <li>
2237         * 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
2238         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2239         * pulled out of the servlet request. Note that the bean
2240         * properties are not all guaranteed to be populated, depending on how early during processing the
2241         * exception occurred.
2242         * </li>
2243         * <li>
2244         * 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
2245         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2246         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2247         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2248         * </li>
2249         * <li>
2250         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2251         * performed. Hooks should not modify this object.
2252         * </li>
2253         * </ul>
2254         * <p>
2255         * Hooks should return <code>void</code>.
2256         * </p>
2257         */
2258        JPA_PERFTRACE_SEARCH_PASS_COMPLETE(void.class,
2259                "ca.uhn.fhir.rest.api.server.RequestDetails",
2260                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2261                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
2262        ),
2263
2264        /**
2265         * <b>Performance Tracing Hook:</b>
2266         * This hook is invoked when a query involving an external index (e.g. Elasticsearch) has completed. When this pointcut
2267         * is invoked, an initial list of resource IDs has been generated which will be used as part of a subsequent database query.
2268         * <p>
2269         * Note that this is a performance tracing hook. Use with caution in production
2270         * systems, since calling it may (or may not) carry a cost.
2271         * </p>
2272         * Hooks may accept the following parameters:
2273         * <ul>
2274         * <li>
2275         * 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
2276         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2277         * pulled out of the servlet request. Note that the bean
2278         * properties are not all guaranteed to be populated, depending on how early during processing the
2279         * exception occurred.
2280         * </li>
2281         * <li>
2282         * 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
2283         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2284         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2285         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2286         * </li>
2287         * <li>
2288         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2289         * performed. Hooks should not modify this object.
2290         * </li>
2291         * </ul>
2292         * <p>
2293         * Hooks should return <code>void</code>.
2294         * </p>
2295         */
2296        JPA_PERFTRACE_INDEXSEARCH_QUERY_COMPLETE(void.class,
2297                "ca.uhn.fhir.rest.api.server.RequestDetails",
2298                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2299                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
2300        ),
2301
2302        /**
2303         * <b>Performance Tracing Hook:</b>
2304         * Invoked when the storage engine is about to reuse the results of
2305         * a previously cached search.
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         * ca.uhn.fhir.jpa.searchparam.SearchParameterMap - Contains the details of the search being checked
2316         * </li>
2317         * <li>
2318         * 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
2319         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2320         * pulled out of the servlet request. Note that the bean
2321         * properties are not all guaranteed to be populated, depending on how early during processing the
2322         * exception occurred. <b>Note that this parameter may be null in contexts where the request is not
2323         * known, such as while processing searches</b>
2324         * </li>
2325         * <li>
2326         * 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
2327         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2328         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2329         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2330         * </li>
2331         * </ul>
2332         * <p>
2333         * Hooks should return <code>void</code>.
2334         * </p>
2335         */
2336        JPA_PERFTRACE_SEARCH_REUSING_CACHED(boolean.class,
2337                "ca.uhn.fhir.jpa.searchparam.SearchParameterMap",
2338                "ca.uhn.fhir.rest.api.server.RequestDetails",
2339                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails"
2340        ),
2341
2342        /**
2343         * <b>Performance Tracing Hook:</b>
2344         * This hook is invoked when a search has failed for any reason. When this pointcut
2345         * is invoked, a pass in the Search Coordinator has completed successfully, and all
2346         * possible results have been fetched and loaded into the query cache.
2347         * <p>
2348         * Note that this is a performance tracing hook. Use with caution in production
2349         * systems, since calling it may (or may not) carry a cost.
2350         * </p>
2351         * Hooks may accept the following parameters:
2352         * <ul>
2353         * <li>
2354         * 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
2355         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2356         * pulled out of the servlet request. Note that the bean
2357         * properties are not all guaranteed to be populated, depending on how early during processing the
2358         * exception occurred.
2359         * </li>
2360         * <li>
2361         * 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
2362         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2363         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2364         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2365         * </li>
2366         * <li>
2367         * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being
2368         * performed. Hooks should not modify this object.
2369         * </li>
2370         * </ul>
2371         * <p>
2372         * Hooks should return <code>void</code>.
2373         * </p>
2374         */
2375        JPA_PERFTRACE_SEARCH_COMPLETE(void.class,
2376                "ca.uhn.fhir.rest.api.server.RequestDetails",
2377                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2378                "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails"
2379        ),
2380
2381
2382        /**
2383         * <b>Performance Tracing Hook:</b>
2384         * <p>
2385         * This hook is invoked when a search has found an individual ID.
2386         * </p>
2387         * <p>
2388         * THIS IS AN EXPERIMENTAL HOOK AND MAY BE REMOVED OR CHANGED WITHOUT WARNING.
2389         * </p>
2390         * <p>
2391         * Note that this is a performance tracing hook. Use with caution in production
2392         * systems, since calling it may (or may not) carry a cost.
2393         * </p>
2394         * <p>
2395         * Hooks may accept the following parameters:
2396         * </p>
2397         * <ul>
2398         * <li>
2399         * java.lang.Integer - The query ID
2400         * </li>
2401         * <li>
2402         * java.lang.Object - The ID
2403         * </li>
2404         * </ul>
2405         * <p>
2406         * Hooks should return <code>void</code>.
2407         * </p>
2408         */
2409        JPA_PERFTRACE_SEARCH_FOUND_ID(void.class,
2410                "java.lang.Integer",
2411                "java.lang.Object"
2412        ),
2413
2414
2415        /**
2416         * <b>Performance Tracing Hook:</b>
2417         * This hook is invoked when a query has executed, and includes the raw SQL
2418         * statements that were executed against the database.
2419         * <p>
2420         * Note that this is a performance tracing hook. Use with caution in production
2421         * systems, since calling it may (or may not) carry a cost.
2422         * </p>
2423         * <p>
2424         * Hooks may accept the following parameters:
2425         * </p>
2426         * <ul>
2427         * <li>
2428         * 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
2429         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2430         * pulled out of the servlet request. Note that the bean
2431         * properties are not all guaranteed to be populated, depending on how early during processing the
2432         * exception occurred.
2433         * </li>
2434         * <li>
2435         * 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
2436         * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been
2437         * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will
2438         * only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
2439         * </li>
2440         * <li>
2441         * ca.uhn.fhir.jpa.util.SqlQueryList - Contains details about the raw SQL queries.
2442         * </li>
2443         * </ul>
2444         * <p>
2445         * Hooks should return <code>void</code>.
2446         * </p>
2447         */
2448        JPA_PERFTRACE_RAW_SQL(void.class,
2449                "ca.uhn.fhir.rest.api.server.RequestDetails",
2450                "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
2451                "ca.uhn.fhir.jpa.util.SqlQueryList"
2452        ),
2453
2454        /**
2455         * This pointcut is used only for unit tests. Do not use in production code as it may be changed or
2456         * removed at any time.
2457         */
2458        TEST_RB(
2459                boolean.class,
2460                new ExceptionHandlingSpec().addLogAndSwallow(IllegalStateException.class),
2461                String.class.getName(),
2462                String.class.getName()),
2463
2464        /**
2465         * This pointcut is used only for unit tests. Do not use in production code as it may be changed or
2466         * removed at any time.
2467         */
2468        TEST_RO(BaseServerResponseException.class, String.class.getName(), String.class.getName());
2469
2470        private final List<String> myParameterTypes;
2471        private final Class<?> myReturnType;
2472        private final ExceptionHandlingSpec myExceptionHandlingSpec;
2473
2474        Pointcut(@Nonnull String theReturnType, String... theParameterTypes) {
2475                this(toReturnTypeClass(theReturnType), new ExceptionHandlingSpec(), theParameterTypes);
2476        }
2477
2478        Pointcut(@Nonnull Class<?> theReturnType, @Nonnull ExceptionHandlingSpec theExceptionHandlingSpec, String... theParameterTypes) {
2479                myReturnType = theReturnType;
2480                myExceptionHandlingSpec = theExceptionHandlingSpec;
2481                myParameterTypes = Collections.unmodifiableList(Arrays.asList(theParameterTypes));
2482        }
2483
2484        Pointcut(@Nonnull Class<?> theReturnType, String... theParameterTypes) {
2485                this(theReturnType, new ExceptionHandlingSpec(), theParameterTypes);
2486        }
2487
2488        @Override
2489        public boolean isShouldLogAndSwallowException(@Nonnull Throwable theException) {
2490                for (Class<? extends Throwable> next : myExceptionHandlingSpec.myTypesToLogAndSwallow) {
2491                        if (next.isAssignableFrom(theException.getClass())) {
2492                                return true;
2493                        }
2494                }
2495                return false;
2496        }
2497
2498        @Override
2499        @Nonnull
2500        public Class<?> getReturnType() {
2501                return myReturnType;
2502        }
2503
2504        @Override
2505        @Nonnull
2506        public List<String> getParameterTypes() {
2507                return myParameterTypes;
2508        }
2509
2510        private static class UnknownType {
2511        }
2512
2513        private static class ExceptionHandlingSpec {
2514
2515                private final Set<Class<? extends Throwable>> myTypesToLogAndSwallow = new HashSet<>();
2516
2517                ExceptionHandlingSpec addLogAndSwallow(@Nonnull Class<? extends Throwable> theType) {
2518                        myTypesToLogAndSwallow.add(theType);
2519                        return this;
2520                }
2521
2522        }
2523
2524        private static Class<?> toReturnTypeClass(String theReturnType) {
2525                try {
2526                        return Class.forName(theReturnType);
2527                } catch (ClassNotFoundException theE) {
2528                        return UnknownType.class;
2529                }
2530        }
2531
2532}