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