001package ca.uhn.fhir.interceptor.api; 002 003/*- 004 * #%L 005 * HAPI FHIR - Core Library 006 * %% 007 * Copyright (C) 2014 - 2019 University Health Network 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023import ca.uhn.fhir.model.base.resource.BaseOperationOutcome; 024import ca.uhn.fhir.rest.annotation.Read; 025import ca.uhn.fhir.rest.annotation.Search; 026import ca.uhn.fhir.rest.server.exceptions.AuthenticationException; 027import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException; 028 029import javax.annotation.Nonnull; 030import java.util.*; 031 032/** 033 * Value for {@link Hook#value()} 034 * <p> 035 * Hook pointcuts are divided into several broad categories: 036 * <ul> 037 * <li>INTERCEPTOR_xxx: Hooks on the interceptor infrastructure itself</li> 038 * <li>CLIENT_xxx: Hooks on the HAPI FHIR Client framework</li> 039 * <li>SERVER_xxx: Hooks on the HAPI FHIR Server framework</li> 040 * <li>SUBSCRIPTION_xxx: Hooks on the HAPI FHIR Subscription framework</li> 041 * <li>STORAGE_xxx: Hooks on the storage engine</li> 042 * <li>JPA_PERFTRACE_xxx: Performance tracing hooks on the JPA server</li> 043 * </ul> 044 * </p> 045 */ 046public enum Pointcut { 047 048 /** 049 * <b>Registry Hook: </b> 050 * This pointcut will be called once when a given interceptor is registered 051 */ 052 INTERCEPTOR_REGISTERED(void.class), 053 054 /** 055 * <b>Client Hook:</b> 056 * This hook is called before an HTTP client request is sent 057 * <p> 058 * Hooks may accept the following parameters: 059 * <ul> 060 * <li> 061 * ca.uhn.fhir.rest.client.api.IHttpRequest - The details of the request 062 * </li> 063 * </ul> 064 * </p> 065 * Hook methods must return <code>void</code>. 066 */ 067 CLIENT_REQUEST(void.class, 068 "ca.uhn.fhir.rest.client.api.IHttpRequest" 069 ), 070 071 /** 072 * <b>Client Hook:</b> 073 * This hook is called after an HTTP client request has completed, prior to returning 074 * the results to the calling code. Hook methods may modify the response. 075 * <p> 076 * Hooks may accept the following parameters: 077 * <ul> 078 * <li> 079 * ca.uhn.fhir.rest.client.api.IHttpRequest - The details of the request 080 * ca.uhn.fhir.rest.client.api.IHttpRequest - The details of the response 081 * </li> 082 * </ul> 083 * </p> 084 * Hook methods must return <code>void</code>. 085 */ 086 CLIENT_RESPONSE(void.class, 087 "ca.uhn.fhir.rest.client.api.IHttpRequest", 088 "ca.uhn.fhir.rest.client.api.IHttpResponse" 089 ), 090 091 /** 092 * <b>Server Hook: </b> 093 * This hook is called before any other processing takes place for each incoming request. It may be used to provide 094 * alternate handling for some requests, or to screen requests before they are handled, etc. 095 * <p> 096 * Note that any exceptions thrown by this method will not be trapped by HAPI (they will be passed up to the server) 097 * </p> 098 * <p> 099 * Hooks may accept the following parameters: 100 * <ul> 101 * <li> 102 * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment 103 * </li> 104 * <li> 105 * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment 106 * </li> 107 * </ul> 108 * </p> 109 * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally. 110 * This is generally the right thing to do. If your interceptor is providing a response rather than 111 * letting HAPI handle the response normally, you must return <code>false</code>. In this case, 112 * no further processing will occur and no further interceptors will be called. 113 */ 114 SERVER_INCOMING_REQUEST_PRE_PROCESSED(boolean.class, 115 "javax.servlet.http.HttpServletRequest", 116 "javax.servlet.http.HttpServletResponse" 117 ), 118 119 /** 120 * <b>Server Hook: </b> 121 * This hook is invoked upon any exception being thrown within the server's request processing code. This includes 122 * any exceptions thrown within resource provider methods (e.g. {@link Search} and {@link Read} methods) as well as 123 * any runtime exceptions thrown by the server itself. This also includes any {@link AuthenticationException}s 124 * thrown. 125 * <p> 126 * Hooks may accept the following parameters: 127 * <ul> 128 * <li> 129 * 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 130 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 131 * pulled out of the servlet request. Note that the bean 132 * properties are not all guaranteed to be populated, depending on how early during processing the 133 * exception occurred. 134 * </li> 135 * <li> 136 * 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 137 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 138 * pulled out of the servlet request. Note that the bean 139 * properties are not all guaranteed to be populated, depending on how early during processing the 140 * exception occurred. This parameter is identical to the RequestDetails parameter above but will 141 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 142 * </li> 143 * <li> 144 * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment 145 * </li> 146 * <li> 147 * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment 148 * </li> 149 * <li> 150 * ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException - The exception that was thrown 151 * </li> 152 * </ul> 153 * </p> 154 * <p> 155 * Implementations of this method may choose to ignore/log/count/etc exceptions, and return <code>true</code> or 156 * <code>void</code>. In 157 * this case, processing will continue, and the server will automatically generate an {@link BaseOperationOutcome 158 * OperationOutcome}. Implementations may also choose to provide their own response to the client. In this case, they 159 * should return <code>false</code>, to indicate that they have handled the request and processing should stop. 160 * </p> 161 */ 162 SERVER_HANDLE_EXCEPTION(boolean.class, 163 "ca.uhn.fhir.rest.api.server.RequestDetails", 164 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 165 "javax.servlet.http.HttpServletRequest", 166 "javax.servlet.http.HttpServletResponse", 167 "ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException" 168 ), 169 170 /** 171 * <b>Server Hook:</b> 172 * This method is called just before the actual implementing server method is invoked. 173 * <p> 174 * Hooks may accept the following parameters: 175 * <ul> 176 * <li> 177 * 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 178 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 179 * pulled out of the servlet request. Note that the bean 180 * properties are not all guaranteed to be populated, depending on how early during processing the 181 * exception occurred. 182 * </li> 183 * <li> 184 * 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 185 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 186 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 187 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 188 * </li> 189 * <li> 190 * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment 191 * </li> 192 * <li> 193 * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment 194 * </li> 195 * </ul> 196 * <p> 197 * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally. 198 * This is generally the right thing to do. 199 * If your interceptor is providing an HTTP response rather than letting HAPI handle the response normally, you 200 * must return <code>false</code>. In this case, no further processing will occur and no further interceptors 201 * will be called. 202 * </p> 203 * <p> 204 * Hook methods may also throw {@link AuthenticationException} if they would like. This exception may be thrown 205 * to indicate that the interceptor has detected an unauthorized access 206 * attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client. 207 */ 208 SERVER_INCOMING_REQUEST_POST_PROCESSED(boolean.class, 209 "ca.uhn.fhir.rest.api.server.RequestDetails", 210 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 211 "javax.servlet.http.HttpServletRequest", 212 "javax.servlet.http.HttpServletResponse" 213 ), 214 215 216 /** 217 * <b>Server Hook:</b> 218 * This hook is invoked before an incoming request is processed. Note that this method is called 219 * after the server has begin preparing the response to the incoming client request. 220 * As such, it is not able to supply a response to the incoming request in the way that 221 * SERVER_INCOMING_REQUEST_PRE_HANDLED and 222 * {@link #SERVER_INCOMING_REQUEST_POST_PROCESSED} 223 * are. 224 * <p> 225 * Hooks may accept the following parameters: 226 * <ul> 227 * <li> 228 * 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 229 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 230 * pulled out of the servlet request. Note that the bean 231 * properties are not all guaranteed to be populated, depending on how early during processing the 232 * exception occurred. 233 * </li> 234 * <li> 235 * 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 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. This parameter is identical to the RequestDetails parameter above but will 238 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 239 * </li> 240 * <li> 241 * ca.uhn.fhir.rest.api.RestOperationTypeEnum - The type of operation that the FHIR server has determined that the client is trying to invoke 242 * </li> 243 * <li> 244 * 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. 245 * </li> 246 * </ul> 247 * </p> 248 * <p> 249 * Hook methods must return <code>void</code> 250 * </p> 251 * <p> 252 * Hook methods method may throw a subclass of {@link BaseServerResponseException}, and processing 253 * will be aborted with an appropriate error returned to the client. 254 * </p> 255 */ 256 SERVER_INCOMING_REQUEST_PRE_HANDLED(void.class, 257 "ca.uhn.fhir.rest.api.server.RequestDetails", 258 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 259 "ca.uhn.fhir.rest.api.RestOperationTypeEnum", 260 "ca.uhn.fhir.rest.server.interceptor.IServerInterceptor$ActionRequestDetails" 261 ), 262 263 /** 264 * <b>Server Hook:</b> 265 * This method is called upon any exception being thrown within the server's request processing code. This includes 266 * any exceptions thrown within resource provider methods (e.g. {@link Search} and {@link Read} methods) as well as 267 * any runtime exceptions thrown by the server itself. This hook method is invoked for each interceptor (until one of them 268 * returns a non-<code>null</code> response or the end of the list is reached), after which 269 * {@link #SERVER_HANDLE_EXCEPTION} is 270 * called for each interceptor. 271 * <p> 272 * This may be used to add an OperationOutcome to a response, or to convert between exception types for any reason. 273 * </p> 274 * <p> 275 * Implementations of this method may choose to ignore/log/count/etc exceptions, and return <code>null</code>. In 276 * this case, processing will continue, and the server will automatically generate an {@link BaseOperationOutcome 277 * OperationOutcome}. Implementations may also choose to provide their own response to the client. In this case, they 278 * should return a non-<code>null</code>, to indicate that they have handled the request and processing should stop. 279 * </p> 280 * <p> 281 * Hooks may accept the following parameters: 282 * <ul> 283 * <li> 284 * 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 285 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 286 * pulled out of the servlet request. Note that the bean 287 * properties are not all guaranteed to be populated, depending on how early during processing the 288 * exception occurred. 289 * </li> 290 * <li> 291 * 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 292 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 293 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 294 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 295 * </li> 296 * <li> 297 * java.lang.Throwable - The exception that was thrown. This will often be an instance of 298 * {@link BaseServerResponseException} but will not necessarily be one (e.g. it could be a 299 * {@link NullPointerException} in the case of a bug being triggered. 300 * </li> 301 * <li> 302 * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment 303 * </li> 304 * <li> 305 * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment 306 * </li> 307 * </ul> 308 * <p> 309 * Hook methods may return a new exception to use for processing, or <code>null</code> if this interceptor is not trying to 310 * modify the exception. For example, if this interceptor has nothing to do with exception processing, it 311 * should always return <code>null</code>. If this interceptor adds an OperationOutcome to the exception, it 312 * should return an exception. 313 * </p> 314 */ 315 SERVER_PRE_PROCESS_OUTGOING_EXCEPTION(BaseServerResponseException.class, 316 "ca.uhn.fhir.rest.api.server.RequestDetails", 317 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 318 "java.lang.Throwable", 319 "javax.servlet.http.HttpServletRequest", 320 "javax.servlet.http.HttpServletResponse" 321 ), 322 323 /** 324 * <b>Server Hook:</b> 325 * This method is called after the server implementation method has been called, but before any attempt 326 * to stream the response back to the client. Interceptors may examine or modify the response before it 327 * is returned, or even prevent the response. 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. 335 * </li> 336 * <li> 337 * 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 338 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 339 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 340 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 341 * </li> 342 * <li> 343 * org.hl7.fhir.instance.model.api.IBaseResource - The resource that will be returned. This parameter may be <code>null</code> for some responses. 344 * </li> 345 * <li> 346 * 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. 347 * </li> 348 * <li> 349 * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment 350 * </li> 351 * <li> 352 * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment 353 * </li> 354 * </ul> 355 * </p> 356 * <p> 357 * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally. 358 * This is generally the right thing to do. If your interceptor is providing a response rather than 359 * letting HAPI handle the response normally, you must return <code>false</code>. In this case, 360 * no further processing will occur and no further interceptors will be called. 361 * </p> 362 * <p> 363 * Hook methods may also throw {@link AuthenticationException} to indicate that the interceptor 364 * has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401 365 * will be returned to the client. 366 */ 367 SERVER_OUTGOING_RESPONSE(boolean.class, 368 "ca.uhn.fhir.rest.api.server.RequestDetails", 369 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 370 "org.hl7.fhir.instance.model.api.IBaseResource", 371 "ca.uhn.fhir.rest.api.server.ResponseDetails", 372 "javax.servlet.http.HttpServletRequest", 373 "javax.servlet.http.HttpServletResponse" 374 ), 375 376 377 378 /** 379 * <b>Server Hook:</b> 380 * This method is called after the server implementation method has been called, but before any attempt 381 * to stream the response back to the client, specifically for GraphQL requests (as these do not fit 382 * cleanly into the model provided by {@link #SERVER_OUTGOING_RESPONSE}). 383 * <p> 384 * Hooks may accept the following parameters: 385 * <ul> 386 * <li> 387 * 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 388 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 389 * pulled out of the servlet request. 390 * </li> 391 * <li> 392 * 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 393 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 394 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 395 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 396 * </li> 397 * <li> 398 * java.lang.String - The GraphQL query 399 * </li> 400 * <li> 401 * java.lang.String - The GraphQL response 402 * </li> 403 * <li> 404 * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment 405 * </li> 406 * <li> 407 * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment 408 * </li> 409 * </ul> 410 * </p> 411 * <p> 412 * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally. 413 * This is generally the right thing to do. If your interceptor is providing a response rather than 414 * letting HAPI handle the response normally, you must return <code>false</code>. In this case, 415 * no further processing will occur and no further interceptors will be called. 416 * </p> 417 * <p> 418 * Hook methods may also throw {@link AuthenticationException} to indicate that the interceptor 419 * has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401 420 * will be returned to the client. 421 */ 422 SERVER_OUTGOING_GRAPHQL_RESPONSE(boolean.class, 423 "ca.uhn.fhir.rest.api.server.RequestDetails", 424 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 425 "java.lang.String", 426 "java.lang.String", 427 "javax.servlet.http.HttpServletRequest", 428 "javax.servlet.http.HttpServletResponse" 429 ), 430 431 432 /** 433 * <b>Server Hook:</b> 434 * This method is called when an OperationOutcome is being returned in response to a failure. 435 * Hook methods may use this hook to modify the OperationOutcome being returned. 436 * <p> 437 * Hooks may accept the following parameters: 438 * <ul> 439 * <li> 440 * ca.uhn.fhir.rest.api.server.RequestDetails - A bean containing details about the request that is about to be processed, including details such as the 441 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 442 * pulled out of the servlet request. Note that the bean 443 * properties are not all guaranteed to be populated, depending on how early during processing the 444 * exception occurred. 445 * </li> 446 * <li> 447 * 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 448 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 449 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 450 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 451 * </li> 452 * <li> 453 * org.hl7.fhir.instance.model.api.IBaseOperationOutcome - The OperationOutcome resource that will be 454 * returned. 455 * </ul> 456 * <p> 457 * Hook methods must return <code>void</code> 458 * </p> 459 */ 460 SERVER_OUTGOING_FAILURE_OPERATIONOUTCOME( 461 void.class, 462 "ca.uhn.fhir.rest.api.server.RequestDetails", 463 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 464 "org.hl7.fhir.instance.model.api.IBaseOperationOutcome" 465 ), 466 467 468 /** 469 * <b>Server Hook:</b> 470 * This method is called after all processing is completed for a request, but only if the 471 * request completes normally (i.e. no exception is thrown). 472 * <p> 473 * Hooks may accept the following parameters: 474 * <ul> 475 * <li> 476 * 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 477 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 478 * pulled out of the servlet request. 479 * </li> 480 * <li> 481 * 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 482 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 483 * pulled out of the request. This will be null if the server is not deployed to a RestfulServer environment. 484 * </li> 485 * </ul> 486 * </p> 487 * <p> 488 * This method must return <code>void</code> 489 * </p> 490 * <p> 491 * This method should not throw any exceptions. Any exception that is thrown by this 492 * method will be logged, but otherwise not acted upon (i.e. even if a hook method 493 * throws an exception, processing will continue and other interceptors will be 494 * called). Therefore it is considered a bug to throw an exception from hook methods using this 495 * pointcut. 496 * </p> 497 */ 498 SERVER_PROCESSING_COMPLETED_NORMALLY( 499 void.class, 500 new ExceptionHandlingSpec() 501 .addLogAndSwallow(Throwable.class), 502 "ca.uhn.fhir.rest.api.server.RequestDetails", 503 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 504 ), 505 506 /** 507 * <b>Server Hook:</b> 508 * This method is called after all processing is completed for a request, regardless of whether 509 * the request completed successfully or not. It is called after {@link #SERVER_PROCESSING_COMPLETED_NORMALLY} 510 * in the case of successful operations. 511 * <p> 512 * Hooks may accept the following parameters: 513 * <ul> 514 * <li> 515 * 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 516 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 517 * pulled out of the servlet request. 518 * </li> 519 * <li> 520 * 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 521 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 522 * pulled out of the request. This will be null if the server is not deployed to a RestfulServer environment. 523 * </li> 524 * </ul> 525 * </p> 526 * <p> 527 * This method must return <code>void</code> 528 * </p> 529 * <p> 530 * This method should not throw any exceptions. Any exception that is thrown by this 531 * method will be logged, but otherwise not acted upon (i.e. even if a hook method 532 * throws an exception, processing will continue and other interceptors will be 533 * called). Therefore it is considered a bug to throw an exception from hook methods using this 534 * pointcut. 535 * </p> 536 */ 537 SERVER_PROCESSING_COMPLETED( 538 void.class, 539 new ExceptionHandlingSpec() 540 .addLogAndSwallow(Throwable.class), 541 "ca.uhn.fhir.rest.api.server.RequestDetails", 542 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 543 ), 544 545 /** 546 * Invoked whenever a persisted resource has been modified and is being submitted to the 547 * subscription processing pipeline. This method is called before the resource is placed 548 * on any queues for processing and executes synchronously during the resource modification 549 * operation itself, so it should return quickly. 550 * <p> 551 * Hooks may accept the following parameters: 552 * <ul> 553 * <li>ca.uhn.fhir.jpa.subscription.module.ResourceModifiedMessage - Hooks may modify this parameter. This will affect the checking process.</li> 554 * </ul> 555 * </p> 556 * <p> 557 * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns 558 * <code>void</code> or <code>true</code>, processing will continue normally. If the method 559 * returns <code>false</code>, subscription processing will not proceed for the given resource; 560 * </p> 561 */ 562 SUBSCRIPTION_RESOURCE_MODIFIED(boolean.class, "ca.uhn.fhir.jpa.subscription.module.ResourceModifiedMessage"), 563 564 565 /** 566 * Invoked any time that a resource is matched by an individual subscription, and 567 * is about to be queued for delivery. 568 * <p> 569 * Hooks may make changes to the delivery payload, or make changes to the 570 * canonical subscription such as adding headers, modifying the channel 571 * endpoint, etc. 572 * </p> 573 * Hooks may accept the following parameters: 574 * <ul> 575 * <li>ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription</li> 576 * <li>ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryMessage</li> 577 * <li>ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult</li> 578 * </ul> 579 * <p> 580 * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns 581 * <code>void</code> or <code>true</code>, processing will continue normally. If the method 582 * returns <code>false</code>, delivery will be aborted. 583 * </p> 584 */ 585 SUBSCRIPTION_RESOURCE_MATCHED(boolean.class, "ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryMessage", "ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult"), 586 587 /** 588 * Invoked whenever a persisted resource was checked against all active subscriptions, and did not 589 * match any. 590 * <p> 591 * Hooks may accept the following parameters: 592 * <ul> 593 * <li>ca.uhn.fhir.jpa.subscription.module.ResourceModifiedMessage - Hooks should not modify this parameter as changes will not have any effect.</li> 594 * </ul> 595 * </p> 596 * <p> 597 * Hooks should return <code>void</code>. 598 * </p> 599 */ 600 SUBSCRIPTION_RESOURCE_DID_NOT_MATCH_ANY_SUBSCRIPTIONS(void.class, "ca.uhn.fhir.jpa.subscription.module.ResourceModifiedMessage"), 601 602 /** 603 * Invoked immediately before the delivery of a subscription, and right before any channel-specific 604 * hooks are invoked (e.g. {@link #SUBSCRIPTION_BEFORE_REST_HOOK_DELIVERY}. 605 * <p> 606 * Hooks may make changes to the delivery payload, or make changes to the 607 * canonical subscription such as adding headers, modifying the channel 608 * endpoint, etc. 609 * </p> 610 * Hooks may accept the following parameters: 611 * <ul> 612 * <li>ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription</li> 613 * <li>ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryMessage</li> 614 * </ul> 615 * <p> 616 * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns 617 * <code>void</code> or <code>true</code>, processing will continue normally. If the method 618 * returns <code>false</code>, processing will be aborted. 619 * </p> 620 */ 621 SUBSCRIPTION_BEFORE_DELIVERY(boolean.class, "ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryMessage"), 622 623 /** 624 * Invoked immediately after the delivery of a subscription, and right before any channel-specific 625 * hooks are invoked (e.g. {@link #SUBSCRIPTION_AFTER_REST_HOOK_DELIVERY}. 626 * <p> 627 * Hooks may accept the following parameters: 628 * </p> 629 * <ul> 630 * <li>ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription</li> 631 * <li>ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryMessage</li> 632 * </ul> 633 * <p> 634 * Hooks should return <code>void</code>. 635 * </p> 636 */ 637 SUBSCRIPTION_AFTER_DELIVERY(void.class, "ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryMessage"), 638 639 640 /** 641 * Invoked immediately after the attempted delivery of a subscription, if the delivery 642 * failed. 643 * <p> 644 * Hooks may accept the following parameters: 645 * </p> 646 * <ul> 647 * <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> 648 * <li>ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryMessage - the message that triggered the exception</li> 649 * <li>java.lang.Exception</li> 650 * </ul> 651 * <p> 652 * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns 653 * <code>void</code> or <code>true</code>, processing will continue normally, meaning that 654 * an exception will be thrown by the delivery mechanism. This typically means that the 655 * message will be returned to the processing queue. If the method 656 * returns <code>false</code>, processing will be aborted and no further action will be 657 * taken for the delivery. 658 * </p> 659 */ 660 SUBSCRIPTION_AFTER_DELIVERY_FAILED(boolean.class, "ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryMessage", "java.lang.Exception"), 661 662 /** 663 * Invoked immediately after the delivery of a REST HOOK subscription. 664 * <p> 665 * When this hook is called, all processing is complete so this hook should not 666 * make any changes to the parameters. 667 * </p> 668 * Hooks may accept the following parameters: 669 * <ul> 670 * <li>ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription</li> 671 * <li>ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryMessage</li> 672 * </ul> 673 * <p> 674 * Hooks should return <code>void</code>. 675 * </p> 676 */ 677 SUBSCRIPTION_AFTER_REST_HOOK_DELIVERY(void.class, "ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryMessage"), 678 679 /** 680 * Invoked immediately before the delivery of a REST HOOK subscription. 681 * <p> 682 * Hooks may make changes to the delivery payload, or make changes to the 683 * canonical subscription such as adding headers, modifying the channel 684 * endpoint, etc. 685 * </p> 686 * Hooks may accept the following parameters: 687 * <ul> 688 * <li>ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription</li> 689 * <li>ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryMessage</li> 690 * </ul> 691 * <p> 692 * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns 693 * <code>void</code> or <code>true</code>, processing will continue normally. If the method 694 * returns <code>false</code>, processing will be aborted. 695 * </p> 696 */ 697 SUBSCRIPTION_BEFORE_REST_HOOK_DELIVERY(boolean.class, "ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.module.subscriber.ResourceDeliveryMessage"), 698 699 /** 700 * Invoked whenever a persisted resource (a resource that has just been stored in the 701 * database via a create/update/patch/etc.) is about to be checked for whether any subscriptions 702 * were triggered as a result of the operation. 703 * <p> 704 * Hooks may accept the following parameters: 705 * <ul> 706 * <li>ca.uhn.fhir.jpa.subscription.module.ResourceModifiedMessage - Hooks may modify this parameter. This will affect the checking process.</li> 707 * </ul> 708 * </p> 709 * <p> 710 * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns 711 * <code>void</code> or <code>true</code>, processing will continue normally. If the method 712 * returns <code>false</code>, processing will be aborted. 713 * </p> 714 */ 715 SUBSCRIPTION_BEFORE_PERSISTED_RESOURCE_CHECKED(boolean.class, "ca.uhn.fhir.jpa.subscription.module.ResourceModifiedMessage"), 716 717 718 /** 719 * Invoked whenever a persisted resource (a resource that has just been stored in the 720 * database via a create/update/patch/etc.) has been checked for whether any subscriptions 721 * were triggered as a result of the operation. 722 * <p> 723 * Hooks may accept the following parameters: 724 * <ul> 725 * <li>ca.uhn.fhir.jpa.subscription.module.ResourceModifiedMessage - This parameter should not be modified as processing is complete when this hook is invoked.</li> 726 * </ul> 727 * </p> 728 * <p> 729 * Hooks should return <code>void</code>. 730 * </p> 731 */ 732 SUBSCRIPTION_AFTER_PERSISTED_RESOURCE_CHECKED(void.class, "ca.uhn.fhir.jpa.subscription.module.ResourceModifiedMessage"), 733 734 735 /** 736 * Invoked immediately after an active subscription is "registered". In HAPI FHIR, when 737 * a subscription 738 * <p> 739 * Hooks may make changes to the canonicalized subscription and this will have an effect 740 * on processing across this server. Note however that timing issues may occur, since the 741 * subscription is already technically live by the time this hook is called. 742 * </p> 743 * Hooks may accept the following parameters: 744 * <ul> 745 * <li>ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription</li> 746 * </ul> 747 * <p> 748 * Hooks should return <code>void</code>. 749 * </p> 750 */ 751 SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_REGISTERED(void.class, "ca.uhn.fhir.jpa.subscription.module.CanonicalSubscription"), 752 753 754 /** 755 * Invoked when a resource is being deleted in a cascaded delete. This means that 756 * some other resource is being deleted, but per use request or other 757 * policy, the given resource (the one supplied as a parameter to this hook) 758 * is also being deleted. 759 * <p> 760 * Hooks may accept the following parameters: 761 * </p> 762 * <ul> 763 * <li> 764 * 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 765 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 766 * pulled out of the servlet request. Note that the bean 767 * properties are not all guaranteed to be populated, depending on how early during processing the 768 * exception occurred. <b>Note that this parameter may be null in contexts where the request is not 769 * known, such as while processing searches</b> 770 * </li> 771 * <li> 772 * 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 773 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 774 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 775 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 776 * </li> 777 * <li> 778 * ca.uhn.fhir.jpa.util.DeleteConflictList - Contains the details about the delete conflicts that are 779 * being resolved via deletion. The source resource is the resource that will be deleted, and 780 * is a cascade because the target resource is already being deleted. 781 * </li> 782 * <li> 783 * org.hl7.fhir.instance.model.api.IBaseResource - The actual resource that is about to be deleted via a cascading delete 784 * </li> 785 * </ul> 786 * <p> 787 * Hooks should return <code>void</code>. They may choose to throw an exception however, in 788 * which case the delete should be rolled back. 789 * </p> 790 */ 791 STORAGE_CASCADE_DELETE( 792 void.class, 793 "ca.uhn.fhir.rest.api.server.RequestDetails", 794 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 795 "ca.uhn.fhir.jpa.delete.DeleteConflictList", 796 "org.hl7.fhir.instance.model.api.IBaseResource" 797 ), 798 799 /** 800 * Invoked when one or more resources may be returned to the user, whether as a part of a READ, 801 * a SEARCH, or even as the response to a CREATE/UPDATE, etc. 802 * <p> 803 * This hook is invoked when a resource has been loaded by the storage engine and 804 * is being returned to the HTTP stack for response. This is not a guarantee that the 805 * client will ultimately see it, since filters/headers/etc may affect what 806 * is returned but if a resource is loaded it is likely to be used. 807 * Note also that caching may affect whether this pointcut is invoked. 808 * </p> 809 * <p> 810 * Hooks will have access to the contents of the resource being returned 811 * and may choose to make modifications. These changes will be reflected in 812 * returned resource but have no effect on storage. 813 * </p> 814 * Hooks may accept the following parameters: 815 * <ul> 816 * <li> 817 * ca.uhn.fhir.rest.api.server.IPreResourceAccessDetails - Contains details about the 818 * specific resources being returned. 819 * </li> 820 * <li> 821 * 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 822 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 823 * pulled out of the servlet request. Note that the bean 824 * properties are not all guaranteed to be populated, depending on how early during processing the 825 * exception occurred. <b>Note that this parameter may be null in contexts where the request is not 826 * known, such as while processing searches</b> 827 * </li> 828 * <li> 829 * 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 830 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 831 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 832 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 833 * </li> 834 * </ul> 835 * <p> 836 * Hooks should return <code>void</code>. 837 * </p> 838 */ 839 STORAGE_PREACCESS_RESOURCES(void.class, 840 "ca.uhn.fhir.rest.api.server.IPreResourceAccessDetails", 841 "ca.uhn.fhir.rest.api.server.RequestDetails", 842 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 843 ), 844 845 /** 846 * Invoked when the storage engine is about to check for the existence of a pre-cached search 847 * whose results match the given search parameters. 848 * <p> 849 * Hooks may accept the following parameters: 850 * </p> 851 * <ul> 852 * <li> 853 * ca.uhn.fhir.jpa.searchparam.SearchParameterMap - Contains the details of the search being checked 854 * </li> 855 * <li> 856 * 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 857 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 858 * pulled out of the servlet request. Note that the bean 859 * properties are not all guaranteed to be populated, depending on how early during processing the 860 * exception occurred. <b>Note that this parameter may be null in contexts where the request is not 861 * known, such as while processing searches</b> 862 * </li> 863 * <li> 864 * 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 865 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 866 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 867 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 868 * </li> 869 * </ul> 870 * <p> 871 * Hooks may return <code>boolean</code>. If the hook method returns 872 * <code>false</code>, the server will not attempt to check for a cached 873 * search no matter what. 874 * </p> 875 */ 876 STORAGE_PRECHECK_FOR_CACHED_SEARCH(boolean.class, 877 "ca.uhn.fhir.jpa.searchparam.SearchParameterMap", 878 "ca.uhn.fhir.rest.api.server.RequestDetails", 879 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 880 ), 881 882 /** 883 * Invoked when a search is starting, prior to creating a record for the search. 884 * <p> 885 * Hooks may accept the following parameters: 886 * </p> 887 * <ul> 888 * <li> 889 * ca.uhn.fhir.rest.server.util.ICachedSearchDetails - Contains the details of the search that 890 * is being created and initialized 891 * </li> 892 * <li> 893 * 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 894 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 895 * pulled out of the servlet request. Note that the bean 896 * properties are not all guaranteed to be populated, depending on how early during processing the 897 * exception occurred. <b>Note that this parameter may be null in contexts where the request is not 898 * known, such as while processing searches</b> 899 * </li> 900 * <li> 901 * 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 902 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 903 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 904 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 905 * </li> 906 * </ul> 907 * <p> 908 * Hooks should return <code>void</code>. 909 * </p> 910 */ 911 STORAGE_PRESEARCH_REGISTERED(void.class, 912 "ca.uhn.fhir.rest.server.util.ICachedSearchDetails", 913 "ca.uhn.fhir.rest.api.server.RequestDetails", 914 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 915 ), 916 917 /** 918 * Invoked when one or more resources may be returned to the user, whether as a part of a READ, 919 * a SEARCH, or even as the response to a CREATE/UPDATE, etc. 920 * <p> 921 * This hook is invoked when a resource has been loaded by the storage engine and 922 * is being returned to the HTTP stack for response. 923 * This is not a guarantee that the 924 * client will ultimately see it, since filters/headers/etc may affect what 925 * is returned but if a resource is loaded it is likely to be used. 926 * Note also that caching may affect whether this pointcut is invoked. 927 * </p> 928 * <p> 929 * Hooks will have access to the contents of the resource being returned 930 * and may choose to make modifications. These changes will be reflected in 931 * returned resource but have no effect on storage. 932 * </p> 933 * Hooks may accept the following parameters: 934 * <ul> 935 * <li> 936 * ca.uhn.fhir.rest.api.server.IPreResourceShowDetails - Contains the resources that 937 * will be shown to the user. This object may be manipulated in order to modify 938 * the actual resources being shown to the user (e.g. for masking) 939 * </li> 940 * <li> 941 * 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 942 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 943 * pulled out of the servlet request. Note that the bean 944 * properties are not all guaranteed to be populated, depending on how early during processing the 945 * exception occurred. <b>Note that this parameter may be null in contexts where the request is not 946 * known, such as while processing searches</b> 947 * </li> 948 * <li> 949 * 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 950 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 951 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 952 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 953 * </li> 954 * </ul> 955 * <p> 956 * Hooks should return <code>void</code>. 957 * </p> 958 */ 959 STORAGE_PRESHOW_RESOURCES(void.class, 960 "ca.uhn.fhir.rest.api.server.IPreResourceShowDetails", 961 "ca.uhn.fhir.rest.api.server.RequestDetails", 962 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 963 ), 964 965 /** 966 * Invoked before a resource will be created, immediately before the resource 967 * is persisted to the database. 968 * <p> 969 * Hooks will have access to the contents of the resource being created 970 * and may choose to make modifications to it. These changes will be 971 * reflected in permanent storage. 972 * </p> 973 * Hooks may accept the following parameters: 974 * <ul> 975 * <li>org.hl7.fhir.instance.model.api.IBaseResource</li> 976 * <li> 977 * 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 978 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 979 * pulled out of the servlet request. Note that the bean 980 * properties are not all guaranteed to be populated, depending on how early during processing the 981 * exception occurred. 982 * </li> 983 * <li> 984 * 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 985 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 986 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 987 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 988 * </li> 989 * </ul> 990 * <p> 991 * Hooks should return <code>void</code>. 992 * </p> 993 */ 994 STORAGE_PRESTORAGE_RESOURCE_CREATED(void.class, 995 "org.hl7.fhir.instance.model.api.IBaseResource", 996 "ca.uhn.fhir.rest.api.server.RequestDetails", 997 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 998 ), 999 1000 /** 1001 * Invoked before a resource will be updated, immediately before the resource 1002 * is persisted to the database. 1003 * <p> 1004 * Hooks will have access to the contents of the resource being updated 1005 * (both the previous and new contents) and may choose to make modifications 1006 * to the new contents of the resource. These changes will be reflected in 1007 * permanent storage. 1008 * </p> 1009 * Hooks may accept the following parameters: 1010 * <ul> 1011 * <li>org.hl7.fhir.instance.model.api.IBaseResource - The previous contents of the resource being updated</li> 1012 * <li>org.hl7.fhir.instance.model.api.IBaseResource - The new contents of the resource being updated</li> 1013 * <li> 1014 * 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 1015 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1016 * pulled out of the servlet request. Note that the bean 1017 * properties are not all guaranteed to be populated, depending on how early during processing the 1018 * exception occurred. 1019 * </li> 1020 * <li> 1021 * 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 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. This parameter is identical to the RequestDetails parameter above but will 1024 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1025 * </li> 1026 * </ul> 1027 * <p> 1028 * Hooks should return <code>void</code>. 1029 * </p> 1030 */ 1031 STORAGE_PRESTORAGE_RESOURCE_UPDATED(void.class, 1032 "org.hl7.fhir.instance.model.api.IBaseResource", 1033 "org.hl7.fhir.instance.model.api.IBaseResource", 1034 "ca.uhn.fhir.rest.api.server.RequestDetails", 1035 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1036 ), 1037 1038 /** 1039 * Invoked before a resource will be created, immediately before the resource 1040 * is persisted to the database. 1041 * <p> 1042 * Hooks will have access to the contents of the resource being created 1043 * and may choose to make modifications to it. These changes will be 1044 * reflected in permanent storage. 1045 * </p> 1046 * Hooks may accept the following parameters: 1047 * <ul> 1048 * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li> 1049 * <li> 1050 * 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 1051 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1052 * pulled out of the servlet request. Note that the bean 1053 * properties are not all guaranteed to be populated, depending on how early during processing the 1054 * exception occurred. 1055 * </li> 1056 * <li> 1057 * 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 1058 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1059 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1060 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1061 * </li> 1062 * </ul> 1063 * <p> 1064 * Hooks should return <code>void</code>. 1065 * </p> 1066 */ 1067 STORAGE_PRESTORAGE_RESOURCE_DELETED(void.class, 1068 "org.hl7.fhir.instance.model.api.IBaseResource", 1069 "ca.uhn.fhir.rest.api.server.RequestDetails", 1070 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1071 ), 1072 1073 1074 /** 1075 * Invoked before a resource will be created, immediately before the transaction 1076 * is committed (after all validation and other business rules have successfully 1077 * completed, and any other database activity is complete. 1078 * <p> 1079 * Hooks will have access to the contents of the resource being created 1080 * but should generally not make any 1081 * changes as storage has already occurred. Changes will not be reflected 1082 * in storage, but may be reflected in the HTTP response. 1083 * </p> 1084 * Hooks may accept the following parameters: 1085 * <ul> 1086 * <li>org.hl7.fhir.instance.model.api.IBaseResource</li> 1087 * <li> 1088 * 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 1089 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1090 * pulled out of the servlet request. Note that the bean 1091 * properties are not all guaranteed to be populated, depending on how early during processing the 1092 * exception occurred. 1093 * </li> 1094 * <li> 1095 * 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 1096 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1097 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1098 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1099 * </li> 1100 * </ul> 1101 * <p> 1102 * Hooks should return <code>void</code>. 1103 * </p> 1104 */ 1105 STORAGE_PRECOMMIT_RESOURCE_CREATED(void.class, 1106 "org.hl7.fhir.instance.model.api.IBaseResource", 1107 "ca.uhn.fhir.rest.api.server.RequestDetails", 1108 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1109 ), 1110 1111 /** 1112 * Invoked before a resource will be updated, immediately before the transaction 1113 * is committed (after all validation and other business rules have successfully 1114 * completed, and any other database activity is complete. 1115 * <p> 1116 * Hooks will have access to the contents of the resource being updated 1117 * (both the previous and new contents) but should generally not make any 1118 * changes as storage has already occurred. Changes will not be reflected 1119 * in storage, but may be reflected in the HTTP response. 1120 * </p> 1121 * Hooks may accept the following parameters: 1122 * <ul> 1123 * <li>org.hl7.fhir.instance.model.api.IBaseResource - The previous contents of the resource</li> 1124 * <li>org.hl7.fhir.instance.model.api.IBaseResource - The proposed new new contents of the resource</li> 1125 * <li> 1126 * 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 1127 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1128 * pulled out of the servlet request. Note that the bean 1129 * properties are not all guaranteed to be populated, depending on how early during processing the 1130 * exception occurred. 1131 * </li> 1132 * <li> 1133 * 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 1134 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1135 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1136 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1137 * </li> 1138 * </ul> 1139 * <p> 1140 * Hooks should return <code>void</code>. 1141 * </p> 1142 */ 1143 STORAGE_PRECOMMIT_RESOURCE_UPDATED(void.class, 1144 "org.hl7.fhir.instance.model.api.IBaseResource", 1145 "org.hl7.fhir.instance.model.api.IBaseResource", 1146 "ca.uhn.fhir.rest.api.server.RequestDetails", 1147 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1148 ), 1149 1150 1151 /** 1152 * Invoked before a resource will be created 1153 * <p> 1154 * Hooks will have access to the contents of the resource being deleted 1155 * but should not make any changes as storage has already occurred 1156 * </p> 1157 * Hooks may accept the following parameters: 1158 * <ul> 1159 * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li> 1160 * <li> 1161 * 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 1162 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1163 * pulled out of the servlet request. Note that the bean 1164 * properties are not all guaranteed to be populated, depending on how early during processing the 1165 * exception occurred. 1166 * </li> 1167 * <li> 1168 * 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 1169 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1170 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1171 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1172 * </li> 1173 * </ul> 1174 * <p> 1175 * Hooks should return <code>void</code>. 1176 * </p> 1177 */ 1178 STORAGE_PRECOMMIT_RESOURCE_DELETED(void.class, 1179 "org.hl7.fhir.instance.model.api.IBaseResource", 1180 "ca.uhn.fhir.rest.api.server.RequestDetails", 1181 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1182 ), 1183 1184 /** 1185 * Invoked when a resource delete operation is about to fail due to referential integrity conflicts. 1186 * <p> 1187 * Hooks will have access to the list of resources that have references to the resource being deleted. 1188 * </p> 1189 * Hooks may accept the following parameters: 1190 * <ul> 1191 * <li>ca.uhn.fhir.jpa.delete.DeleteConflictList - The list of delete conflicts</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. 1198 * </li> 1199 * <li> 1200 * 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 1201 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1202 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1203 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1204 * </li> 1205 * </ul> 1206 * <p> 1207 * Hooks should return <code>ca.uhn.fhir.jpa.delete.DeleteConflictOutcome</code>. 1208 * If the interceptor returns a non-null result, the DeleteConflictOutcome can be 1209 * used to indicate a number of times to retry. 1210 * </p> 1211 */ 1212 STORAGE_PRESTORAGE_DELETE_CONFLICTS( 1213 // Return type 1214 "ca.uhn.fhir.jpa.delete.DeleteConflictOutcome", 1215 // Params 1216 "ca.uhn.fhir.jpa.delete.DeleteConflictList", 1217 "ca.uhn.fhir.rest.api.server.RequestDetails", 1218 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1219 ), 1220 1221 /** 1222 * Invoked before a resource is about to be expunged via the <code>$expunge</code> operation. 1223 * <p> 1224 * Hooks will be passed a reference to a counter containing the current number of records that have been deleted. 1225 * If the hook deletes any records, the hook is expected to increment this counter by the number of records deleted. 1226 * </p> 1227 * <p> 1228 * Hooks may accept the following parameters: 1229 * </p> 1230 * <ul> 1231 * <li>java.util.concurrent.atomic.AtomicInteger - The counter holding the number of records deleted.</li> 1232 * <li>org.hl7.fhir.instance.model.api.IIdType - The ID of the resource that is about to be deleted</li> 1233 * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource that is about to be deleted</li> 1234 * <li> 1235 * 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 1236 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1237 * pulled out of the servlet request. Note that the bean 1238 * properties are not all guaranteed to be populated, depending on how early during processing the 1239 * exception occurred. 1240 * </li> 1241 * <li> 1242 * 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 1243 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1244 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1245 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1246 * </li> 1247 * </ul> 1248 * <p> 1249 * Hooks should return void. 1250 * </p> 1251 */ 1252 STORAGE_PRESTORAGE_EXPUNGE_RESOURCE( 1253 // Return type 1254 void.class, 1255 // Params 1256 "java.util.concurrent.atomic.AtomicInteger", 1257 "org.hl7.fhir.instance.model.api.IIdType", 1258 "org.hl7.fhir.instance.model.api.IBaseResource", 1259 "ca.uhn.fhir.rest.api.server.RequestDetails", 1260 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1261 ), 1262 1263 /** 1264 * Invoked before expungeEverything is called. 1265 * <p> 1266 * Hooks will be passed a reference to a counter containing the current number of records that have been deleted. 1267 * If the hook deletes any records, the hook is expected to increment this counter by the number of records deleted. 1268 * </p> 1269 * Hooks may accept the following parameters: 1270 * <ul> 1271 * <li>java.util.concurrent.atomic.AtomicInteger - The counter holding the number of records deleted.</li> 1272 * <li> 1273 * 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 1274 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1275 * pulled out of the servlet request. Note that the bean 1276 * properties are not all guaranteed to be populated, depending on how early during processing the 1277 * exception occurred. 1278 * </li> 1279 * <li> 1280 * 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 1281 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1282 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1283 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1284 * </li> 1285 * </ul> 1286 * <p> 1287 * Hooks should return void. 1288 * </p> 1289 */ 1290 STORAGE_PRESTORAGE_EXPUNGE_EVERYTHING( 1291 // Return type 1292 void.class, 1293 // Params 1294 "java.util.concurrent.atomic.AtomicInteger", 1295 "ca.uhn.fhir.rest.api.server.RequestDetails", 1296 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1297 ), 1298 1299 /** 1300 * Note that this is a performance tracing hook. Use with caution in production 1301 * systems, since calling it may (or may not) carry a cost. 1302 * <p> 1303 * This hook is invoked when any informational messages generated by the 1304 * SearchCoordinator are created. It is typically used to provide logging 1305 * or capture details related to a specific request. 1306 * </p> 1307 * Hooks may accept the following parameters: 1308 * <ul> 1309 * <li> 1310 * 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 1311 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1312 * pulled out of the servlet request. Note that the bean 1313 * properties are not all guaranteed to be populated, depending on how early during processing the 1314 * exception occurred. 1315 * </li> 1316 * <li> 1317 * 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 1318 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1319 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1320 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1321 * </li> 1322 * <li> 1323 * ca.uhn.fhir.jpa.model.search.StorageProcessingMessage - Contains the message 1324 * </li> 1325 * </ul> 1326 * <p> 1327 * Hooks should return <code>void</code>. 1328 * </p> 1329 */ 1330 JPA_PERFTRACE_INFO(void.class, 1331 "ca.uhn.fhir.rest.api.server.RequestDetails", 1332 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1333 "ca.uhn.fhir.jpa.model.search.StorageProcessingMessage" 1334 ), 1335 1336 /** 1337 * Note that this is a performance tracing hook. Use with caution in production 1338 * systems, since calling it may (or may not) carry a cost. 1339 * <p> 1340 * This hook is invoked when any warning messages generated by the 1341 * SearchCoordinator are created. It is typically used to provide logging 1342 * or capture details related to a specific request. 1343 * </p> 1344 * Hooks may accept the following parameters: 1345 * <ul> 1346 * <li> 1347 * 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 1348 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1349 * pulled out of the servlet request. Note that the bean 1350 * properties are not all guaranteed to be populated, depending on how early during processing the 1351 * exception occurred. 1352 * </li> 1353 * <li> 1354 * 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 1355 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1356 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1357 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1358 * </li> 1359 * <li> 1360 * ca.uhn.fhir.jpa.model.search.StorageProcessingMessage - Contains the message 1361 * </li> 1362 * </ul> 1363 * <p> 1364 * Hooks should return <code>void</code>. 1365 * </p> 1366 */ 1367 JPA_PERFTRACE_WARNING(void.class, 1368 "ca.uhn.fhir.rest.api.server.RequestDetails", 1369 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1370 "ca.uhn.fhir.jpa.model.search.StorageProcessingMessage" 1371 ), 1372 1373 /** 1374 * Note that this is a performance tracing hook. Use with caution in production 1375 * systems, since calling it may (or may not) carry a cost. 1376 * <p> 1377 * This hook is invoked when a search has returned the very first result 1378 * from the database. The timing on this call can be a good indicator of how 1379 * performant a query is in general. 1380 * </p> 1381 * Hooks may accept the following parameters: 1382 * <ul> 1383 * <li> 1384 * 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 1385 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1386 * pulled out of the servlet request. Note that the bean 1387 * properties are not all guaranteed to be populated, depending on how early during processing the 1388 * exception occurred. 1389 * </li> 1390 * <li> 1391 * 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 1392 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1393 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1394 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1395 * </li> 1396 * <li> 1397 * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being 1398 * performed. Hooks should not modify this object. 1399 * </li> 1400 * </ul> 1401 * <p> 1402 * Hooks should return <code>void</code>. 1403 * </p> 1404 */ 1405 JPA_PERFTRACE_SEARCH_FIRST_RESULT_LOADED(void.class, 1406 "ca.uhn.fhir.rest.api.server.RequestDetails", 1407 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1408 "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails" 1409 ), 1410 1411 /** 1412 * Note that this is a performance tracing hook. Use with caution in production 1413 * systems, since calling it may (or may not) carry a cost. 1414 * <p> 1415 * This hook is invoked when an individual search query SQL SELECT statement 1416 * has completed and no more results are available from that query. Note that this 1417 * doesn't necessarily mean that no more matching results exist in the database, 1418 * since HAPI FHIR JPA batch loads results in to the query cache in chunks in order 1419 * to provide predicable results without overloading memory or the database. 1420 * </p> 1421 * Hooks may accept the following parameters: 1422 * <ul> 1423 * <li> 1424 * 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 1425 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1426 * pulled out of the servlet request. Note that the bean 1427 * properties are not all guaranteed to be populated, depending on how early during processing the 1428 * exception occurred. 1429 * </li> 1430 * <li> 1431 * 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 1432 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1433 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1434 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1435 * </li> 1436 * <li> 1437 * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being 1438 * performed. Hooks should not modify this object. 1439 * </li> 1440 * </ul> 1441 * <p> 1442 * Hooks should return <code>void</code>. 1443 * </p> 1444 */ 1445 JPA_PERFTRACE_SEARCH_SELECT_COMPLETE(void.class, 1446 "ca.uhn.fhir.rest.api.server.RequestDetails", 1447 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1448 "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails" 1449 ), 1450 1451 1452 /** 1453 * Note that this is a performance tracing hook. Use with caution in production 1454 * systems, since calling it may (or may not) carry a cost. 1455 * <p> 1456 * This hook is invoked when a search has failed for any reason. When this pointcut 1457 * is invoked, the search has completed unsuccessfully and will not be continued. 1458 * </p> 1459 * Hooks may accept the following parameters: 1460 * <ul> 1461 * <li> 1462 * 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 1463 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1464 * pulled out of the servlet request. Note that the bean 1465 * properties are not all guaranteed to be populated, depending on how early during processing the 1466 * exception occurred. 1467 * </li> 1468 * <li> 1469 * 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 1470 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1471 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1472 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1473 * </li> 1474 * <li> 1475 * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being 1476 * performed. Hooks should not modify this object. 1477 * </li> 1478 * </ul> 1479 * <p> 1480 * Hooks should return <code>void</code>. 1481 * </p> 1482 */ 1483 JPA_PERFTRACE_SEARCH_FAILED(void.class, 1484 "ca.uhn.fhir.rest.api.server.RequestDetails", 1485 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1486 "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails" 1487 ), 1488 1489 /** 1490 * Note that this is a performance tracing hook. Use with caution in production 1491 * systems, since calling it may (or may not) carry a cost. 1492 * <p> 1493 * This hook is invoked when a search has failed for any reason. When this pointcut 1494 * is invoked, a pass in the Search Coordinator has completed successfully, but 1495 * not all possible resources have been loaded yet so a future paging request 1496 * may trigger a new task that will load further resources. 1497 * </p> 1498 * Hooks may accept the following parameters: 1499 * <ul> 1500 * <li> 1501 * 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 1502 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1503 * pulled out of the servlet request. Note that the bean 1504 * properties are not all guaranteed to be populated, depending on how early during processing the 1505 * exception occurred. 1506 * </li> 1507 * <li> 1508 * 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 1509 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1510 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1511 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1512 * </li> 1513 * <li> 1514 * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being 1515 * performed. Hooks should not modify this object. 1516 * </li> 1517 * </ul> 1518 * <p> 1519 * Hooks should return <code>void</code>. 1520 * </p> 1521 */ 1522 JPA_PERFTRACE_SEARCH_PASS_COMPLETE(void.class, 1523 "ca.uhn.fhir.rest.api.server.RequestDetails", 1524 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1525 "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails" 1526 ), 1527 1528 /** 1529 * Invoked when the storage engine is about to reuse the results of 1530 * a previously cached search. 1531 * <p> 1532 * Hooks may accept the following parameters: 1533 * </p> 1534 * <ul> 1535 * <li> 1536 * ca.uhn.fhir.jpa.searchparam.SearchParameterMap - Contains the details of the search being checked 1537 * </li> 1538 * <li> 1539 * 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 1540 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1541 * pulled out of the servlet request. Note that the bean 1542 * properties are not all guaranteed to be populated, depending on how early during processing the 1543 * exception occurred. <b>Note that this parameter may be null in contexts where the request is not 1544 * known, such as while processing searches</b> 1545 * </li> 1546 * <li> 1547 * 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 1548 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1549 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1550 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1551 * </li> 1552 * </ul> 1553 * <p> 1554 * Hooks should return <code>void</code>. 1555 * </p> 1556 */ 1557 JPA_PERFTRACE_SEARCH_REUSING_CACHED(boolean.class, 1558 "ca.uhn.fhir.jpa.searchparam.SearchParameterMap", 1559 "ca.uhn.fhir.rest.api.server.RequestDetails", 1560 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1561 ), 1562 1563 /** 1564 * Note that this is a performance tracing hook. Use with caution in production 1565 * systems, since calling it may (or may not) carry a cost. 1566 * <p> 1567 * This hook is invoked when a search has failed for any reason. When this pointcut 1568 * is invoked, a pass in the Search Coordinator has completed successfully, and all 1569 * possible results have been fetched and loaded into the query cache. 1570 * </p> 1571 * Hooks may accept the following parameters: 1572 * <ul> 1573 * <li> 1574 * 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 1575 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1576 * pulled out of the servlet request. Note that the bean 1577 * properties are not all guaranteed to be populated, depending on how early during processing the 1578 * exception occurred. 1579 * </li> 1580 * <li> 1581 * 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 1582 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1583 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1584 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1585 * </li> 1586 * <li> 1587 * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being 1588 * performed. Hooks should not modify this object. 1589 * </li> 1590 * </ul> 1591 * <p> 1592 * Hooks should return <code>void</code>. 1593 * </p> 1594 */ 1595 JPA_PERFTRACE_SEARCH_COMPLETE(void.class, 1596 "ca.uhn.fhir.rest.api.server.RequestDetails", 1597 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1598 "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails" 1599 ), 1600 1601 1602 /** 1603 * Note that this is a performance tracing hook. Use with caution in production 1604 * systems, since calling it may (or may not) carry a cost. 1605 * <p> 1606 * This hook is invoked when a query has executed, and includes the raw SQL 1607 * statements that were executed against the database. 1608 * </p> 1609 * Hooks may accept the following parameters: 1610 * <ul> 1611 * <li> 1612 * 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 1613 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1614 * pulled out of the servlet request. Note that the bean 1615 * properties are not all guaranteed to be populated, depending on how early during processing the 1616 * exception occurred. 1617 * </li> 1618 * <li> 1619 * 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 1620 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1621 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1622 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1623 * </li> 1624 * <li> 1625 * ca.uhn.fhir.jpa.util.SqlQueryList - Contains details about the raw SQL queries. 1626 * </li> 1627 * </ul> 1628 * <p> 1629 * Hooks should return <code>void</code>. 1630 * </p> 1631 */ 1632 JPA_PERFTRACE_RAW_SQL(void.class, 1633 "ca.uhn.fhir.rest.api.server.RequestDetails", 1634 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1635 "ca.uhn.fhir.jpa.util.SqlQueryList" 1636 ), 1637 1638 /** 1639 * This pointcut is used only for unit tests. Do not use in production code as it may be changed or 1640 * removed at any time. 1641 */ 1642 TEST_RB( 1643 boolean.class, 1644 new ExceptionHandlingSpec().addLogAndSwallow(IllegalStateException.class), 1645 String.class.getName(), 1646 String.class.getName()), 1647 1648 /** 1649 * This pointcut is used only for unit tests. Do not use in production code as it may be changed or 1650 * removed at any time. 1651 */ 1652 TEST_RO(BaseServerResponseException.class, String.class.getName(), String.class.getName()) 1653 1654 ; 1655 1656 private final List<String> myParameterTypes; 1657 private final Class<?> myReturnType; 1658 private final ExceptionHandlingSpec myExceptionHandlingSpec; 1659 1660 Pointcut(@Nonnull String theReturnType, String... theParameterTypes) { 1661 this(toReturnTypeClass(theReturnType), new ExceptionHandlingSpec(), theParameterTypes); 1662 } 1663 1664 Pointcut(@Nonnull Class<?> theReturnType, @Nonnull ExceptionHandlingSpec theExceptionHandlingSpec, String... theParameterTypes) { 1665 myReturnType = theReturnType; 1666 myExceptionHandlingSpec = theExceptionHandlingSpec; 1667 myParameterTypes = Collections.unmodifiableList(Arrays.asList(theParameterTypes)); 1668 } 1669 1670 Pointcut(@Nonnull Class<?> theReturnType, String... theParameterTypes) { 1671 this(theReturnType, new ExceptionHandlingSpec(), theParameterTypes); 1672 } 1673 1674 public boolean isShouldLogAndSwallowException(@Nonnull Throwable theException) { 1675 for (Class<? extends Throwable> next : myExceptionHandlingSpec.myTypesToLogAndSwallow) { 1676 if (next.isAssignableFrom(theException.getClass())) { 1677 return true; 1678 } 1679 } 1680 return false; 1681 } 1682 1683 @Nonnull 1684 public Class<?> getReturnType() { 1685 return myReturnType; 1686 } 1687 1688 @Nonnull 1689 public List<String> getParameterTypes() { 1690 return myParameterTypes; 1691 } 1692 1693 private class UnknownType { 1694 } 1695 1696 private static class ExceptionHandlingSpec { 1697 1698 private final Set<Class<? extends Throwable>> myTypesToLogAndSwallow = new HashSet<>(); 1699 1700 ExceptionHandlingSpec addLogAndSwallow(@Nonnull Class<? extends Throwable> theType) { 1701 myTypesToLogAndSwallow.add(theType); 1702 return this; 1703 } 1704 1705 } 1706 1707 private static Class<?> toReturnTypeClass(String theReturnType) { 1708 try { 1709 return Class.forName(theReturnType); 1710 } catch (ClassNotFoundException theE) { 1711 return UnknownType.class; 1712 } 1713 } 1714 1715}