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