001package ca.uhn.fhir.interceptor.api; 002 003/*- 004 * #%L 005 * HAPI FHIR - Core Library 006 * %% 007 * Copyright (C) 2014 - 2023 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 * </ul> 348 * </p> 349 * <p> 350 * Hook methods must return <code>void</code> 351 * </p> 352 * <p> 353 * Hook methods method may throw a subclass of {@link BaseServerResponseException}, and processing 354 * will be aborted with an appropriate error returned to the client. 355 * </p> 356 */ 357 SERVER_INCOMING_REQUEST_PRE_HANDLED(void.class, 358 "ca.uhn.fhir.rest.api.server.RequestDetails", 359 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 360 "ca.uhn.fhir.rest.api.RestOperationTypeEnum" 361 ), 362 363 364 /** 365 * <b>Server Hook:</b> 366 * This method is called when a resource provider method is registered and being bound 367 * by the HAPI FHIR Plain Server / RestfulServer. 368 * <p> 369 * Hooks may accept the following parameters: 370 * <ul> 371 * <li> 372 * ca.uhn.fhir.rest.server.method.BaseMethodBinding - The method binding. 373 * </li> 374 * </ul> 375 * <p> 376 * Hook methods may modify the method binding, replace it, or return <code>null</code> to cancel the binding. 377 * </p> 378 */ 379 SERVER_PROVIDER_METHOD_BOUND("ca.uhn.fhir.rest.server.method.BaseMethodBinding", 380 "ca.uhn.fhir.rest.server.method.BaseMethodBinding"), 381 382 383 /** 384 * <b>Server Hook:</b> 385 * This method is called upon any exception being thrown within the server's request processing code. This includes 386 * any exceptions thrown within resource provider methods (e.g. {@link Search} and {@link Read} methods) as well as 387 * any runtime exceptions thrown by the server itself. This hook method is invoked for each interceptor (until one of them 388 * returns a non-<code>null</code> response or the end of the list is reached), after which 389 * {@link #SERVER_HANDLE_EXCEPTION} is 390 * called for each interceptor. 391 * <p> 392 * This may be used to add an OperationOutcome to a response, or to convert between exception types for any reason. 393 * </p> 394 * <p> 395 * Implementations of this method may choose to ignore/log/count/etc exceptions, and return <code>null</code>. In 396 * this case, processing will continue, and the server will automatically generate an {@link BaseOperationOutcome 397 * OperationOutcome}. Implementations may also choose to provide their own response to the client. In this case, they 398 * should return a non-<code>null</code>, to indicate that they have handled the request and processing should stop. 399 * </p> 400 * <p> 401 * Hooks may accept the following parameters: 402 * <ul> 403 * <li> 404 * 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 405 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 406 * pulled out of the servlet request. Note that the bean 407 * properties are not all guaranteed to be populated, depending on how early during processing the 408 * exception occurred. 409 * </li> 410 * <li> 411 * 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 412 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 413 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 414 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 415 * </li> 416 * <li> 417 * java.lang.Throwable - The exception that was thrown. This will often be an instance of 418 * {@link BaseServerResponseException} but will not necessarily be one (e.g. it could be a 419 * {@link NullPointerException} in the case of a bug being triggered. 420 * </li> 421 * <li> 422 * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment 423 * </li> 424 * <li> 425 * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment 426 * </li> 427 * </ul> 428 * <p> 429 * Hook methods may return a new exception to use for processing, or <code>null</code> if this interceptor is not trying to 430 * modify the exception. For example, if this interceptor has nothing to do with exception processing, it 431 * should always return <code>null</code>. If this interceptor adds an OperationOutcome to the exception, it 432 * should return an exception. 433 * </p> 434 */ 435 SERVER_PRE_PROCESS_OUTGOING_EXCEPTION(BaseServerResponseException.class, 436 "ca.uhn.fhir.rest.api.server.RequestDetails", 437 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 438 "java.lang.Throwable", 439 "javax.servlet.http.HttpServletRequest", 440 "javax.servlet.http.HttpServletResponse" 441 ), 442 443 /** 444 * <b>Server Hook:</b> 445 * This method is called after the server implementation method has been called, but before any attempt 446 * to stream the response back to the client. Interceptors may examine or modify the response before it 447 * is returned, or even prevent the response. 448 * <p> 449 * Hooks may accept the following parameters: 450 * <ul> 451 * <li> 452 * 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 453 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 454 * pulled out of the servlet request. 455 * </li> 456 * <li> 457 * 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 458 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 459 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 460 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 461 * </li> 462 * <li> 463 * org.hl7.fhir.instance.model.api.IBaseResource - The resource that will be returned. This parameter may be <code>null</code> for some responses. 464 * </li> 465 * <li> 466 * 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. 467 * </li> 468 * <li> 469 * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment 470 * </li> 471 * <li> 472 * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment 473 * </li> 474 * </ul> 475 * </p> 476 * <p> 477 * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally. 478 * This is generally the right thing to do. If your interceptor is providing a response rather than 479 * letting HAPI handle the response normally, you must return <code>false</code>. In this case, 480 * no further processing will occur and no further interceptors will be called. 481 * </p> 482 * <p> 483 * Hook methods may also throw {@link AuthenticationException} to indicate that the interceptor 484 * has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401 485 * will be returned to the client. 486 */ 487 SERVER_OUTGOING_RESPONSE(boolean.class, 488 "ca.uhn.fhir.rest.api.server.RequestDetails", 489 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 490 "org.hl7.fhir.instance.model.api.IBaseResource", 491 "ca.uhn.fhir.rest.api.server.ResponseDetails", 492 "javax.servlet.http.HttpServletRequest", 493 "javax.servlet.http.HttpServletResponse" 494 ), 495 496 497 /** 498 * <b>Server Hook:</b> 499 * This method is called when a stream writer is generated that will be used to stream a non-binary response to 500 * a client. Hooks may return a wrapped writer which adds additional functionality as needed. 501 * 502 * <p> 503 * Hooks may accept the following parameters: 504 * <ul> 505 * <li> 506 * java.io.Writer - The response writing Writer. Typically a hook will wrap this writer and layer additional functionality 507 * into the wrapping writer. 508 * </li> 509 * <li> 510 * 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 511 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 512 * pulled out of the servlet request. 513 * </li> 514 * <li> 515 * 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 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. This parameter is identical to the RequestDetails parameter above but will 518 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 519 * </li> 520 * </ul> 521 * </p> 522 * <p> 523 * Hook methods should return a {@link Writer} instance that will be used to stream the response. Hook methods 524 * should not throw any exception. 525 * </p> 526 * 527 * @since 5.0.0 528 */ 529 SERVER_OUTGOING_WRITER_CREATED(Writer.class, 530 "java.io.Writer", 531 "ca.uhn.fhir.rest.api.server.RequestDetails", 532 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 533 ), 534 535 536 /** 537 * <b>Server Hook:</b> 538 * This method is called after the server implementation method has been called, but before any attempt 539 * to stream the response back to the client, specifically for GraphQL requests (as these do not fit 540 * cleanly into the model provided by {@link #SERVER_OUTGOING_RESPONSE}). 541 * <p> 542 * Hooks may accept the following parameters: 543 * <ul> 544 * <li> 545 * 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 546 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 547 * pulled out of the servlet request. 548 * </li> 549 * <li> 550 * 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 551 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 552 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 553 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 554 * </li> 555 * <li> 556 * java.lang.String - The GraphQL query 557 * </li> 558 * <li> 559 * java.lang.String - The GraphQL response 560 * </li> 561 * <li> 562 * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment 563 * </li> 564 * <li> 565 * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment 566 * </li> 567 * </ul> 568 * </p> 569 * <p> 570 * Hook methods may return <code>true</code> or <code>void</code> if processing should continue normally. 571 * This is generally the right thing to do. If your interceptor is providing a response rather than 572 * letting HAPI handle the response normally, you must return <code>false</code>. In this case, 573 * no further processing will occur and no further interceptors will be called. 574 * </p> 575 * <p> 576 * Hook methods may also throw {@link AuthenticationException} to indicate that the interceptor 577 * has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401 578 * will be returned to the client. 579 */ 580 SERVER_OUTGOING_GRAPHQL_RESPONSE(boolean.class, 581 "ca.uhn.fhir.rest.api.server.RequestDetails", 582 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 583 "java.lang.String", 584 "java.lang.String", 585 "javax.servlet.http.HttpServletRequest", 586 "javax.servlet.http.HttpServletResponse" 587 ), 588 589 590 /** 591 * <b>Server Hook:</b> 592 * This method is called when an OperationOutcome is being returned in response to a failure. 593 * Hook methods may use this hook to modify the OperationOutcome being returned. 594 * <p> 595 * Hooks may accept the following parameters: 596 * <ul> 597 * <li> 598 * 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 599 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 600 * pulled out of the servlet request. Note that the bean 601 * properties are not all guaranteed to be populated, depending on how early during processing the 602 * exception occurred. 603 * </li> 604 * <li> 605 * 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 606 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 607 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 608 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 609 * </li> 610 * <li> 611 * org.hl7.fhir.instance.model.api.IBaseOperationOutcome - The OperationOutcome resource that will be 612 * returned. 613 * </ul> 614 * <p> 615 * Hook methods must return <code>void</code> 616 * </p> 617 */ 618 SERVER_OUTGOING_FAILURE_OPERATIONOUTCOME( 619 void.class, 620 "ca.uhn.fhir.rest.api.server.RequestDetails", 621 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 622 "org.hl7.fhir.instance.model.api.IBaseOperationOutcome" 623 ), 624 625 626 /** 627 * <b>Server Hook:</b> 628 * This method is called after all processing is completed for a request, but only if the 629 * request completes normally (i.e. no exception is thrown). 630 * <p> 631 * Hooks may accept the following parameters: 632 * <ul> 633 * <li> 634 * 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 635 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 636 * pulled out of the servlet request. 637 * </li> 638 * <li> 639 * 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 640 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 641 * pulled out of the request. This will be null if the server is not deployed to a RestfulServer environment. 642 * </li> 643 * </ul> 644 * </p> 645 * <p> 646 * This method must return <code>void</code> 647 * </p> 648 * <p> 649 * This method should not throw any exceptions. Any exception that is thrown by this 650 * method will be logged, but otherwise not acted upon (i.e. even if a hook method 651 * throws an exception, processing will continue and other interceptors will be 652 * called). Therefore it is considered a bug to throw an exception from hook methods using this 653 * pointcut. 654 * </p> 655 */ 656 SERVER_PROCESSING_COMPLETED_NORMALLY( 657 void.class, 658 new ExceptionHandlingSpec() 659 .addLogAndSwallow(Throwable.class), 660 "ca.uhn.fhir.rest.api.server.RequestDetails", 661 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 662 ), 663 664 /** 665 * <b>Server Hook:</b> 666 * This method is called after all processing is completed for a request, regardless of whether 667 * the request completed successfully or not. It is called after {@link #SERVER_PROCESSING_COMPLETED_NORMALLY} 668 * in the case of successful operations. 669 * <p> 670 * Hooks may accept the following parameters: 671 * <ul> 672 * <li> 673 * 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 674 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 675 * pulled out of the servlet request. 676 * </li> 677 * <li> 678 * 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 679 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 680 * pulled out of the request. This will be null if the server is not deployed to a RestfulServer environment. 681 * </li> 682 * </ul> 683 * </p> 684 * <p> 685 * This method must return <code>void</code> 686 * </p> 687 * <p> 688 * This method should not throw any exceptions. Any exception that is thrown by this 689 * method will be logged, but otherwise not acted upon (i.e. even if a hook method 690 * throws an exception, processing will continue and other interceptors will be 691 * called). Therefore it is considered a bug to throw an exception from hook methods using this 692 * pointcut. 693 * </p> 694 */ 695 SERVER_PROCESSING_COMPLETED( 696 void.class, 697 new ExceptionHandlingSpec() 698 .addLogAndSwallow(Throwable.class), 699 "ca.uhn.fhir.rest.api.server.RequestDetails", 700 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 701 ), 702 703 /** 704 * <b>Subscription Hook:</b> 705 * Invoked whenever a persisted resource has been modified and is being submitted to the 706 * subscription processing pipeline. This method is called before the resource is placed 707 * on any queues for processing and executes synchronously during the resource modification 708 * operation itself, so it should return quickly. 709 * <p> 710 * Hooks may accept the following parameters: 711 * <ul> 712 * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - Hooks may modify this parameter. This will affect the checking process.</li> 713 * </ul> 714 * </p> 715 * <p> 716 * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns 717 * <code>void</code> or <code>true</code>, processing will continue normally. If the method 718 * returns <code>false</code>, subscription processing will not proceed for the given resource; 719 * </p> 720 */ 721 SUBSCRIPTION_RESOURCE_MODIFIED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"), 722 723 724 /** 725 * <b>Subscription Hook:</b> 726 * Invoked any time that a resource is matched by an individual subscription, and 727 * is about to be queued for delivery. 728 * <p> 729 * Hooks may make changes to the delivery payload, or make changes to the 730 * canonical subscription such as adding headers, modifying the channel 731 * endpoint, etc. 732 * </p> 733 * Hooks may accept the following parameters: 734 * <ul> 735 * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li> 736 * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li> 737 * <li>ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult</li> 738 * </ul> 739 * <p> 740 * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns 741 * <code>void</code> or <code>true</code>, processing will continue normally. If the method 742 * returns <code>false</code>, delivery will be aborted. 743 * </p> 744 */ 745 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"), 746 747 /** 748 * <b>Subscription Hook:</b> 749 * Invoked whenever a persisted resource was checked against all active subscriptions, and did not 750 * match any. 751 * <p> 752 * Hooks may accept the following parameters: 753 * <ul> 754 * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - Hooks should not modify this parameter as changes will not have any effect.</li> 755 * </ul> 756 * </p> 757 * <p> 758 * Hooks should return <code>void</code>. 759 * </p> 760 */ 761 SUBSCRIPTION_RESOURCE_DID_NOT_MATCH_ANY_SUBSCRIPTIONS(void.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"), 762 763 /** 764 * <b>Subscription Hook:</b> 765 * Invoked immediately before the delivery of a subscription, and right before any channel-specific 766 * hooks are invoked (e.g. {@link #SUBSCRIPTION_BEFORE_REST_HOOK_DELIVERY}. 767 * <p> 768 * Hooks may make changes to the delivery payload, or make changes to the 769 * canonical subscription such as adding headers, modifying the channel 770 * endpoint, etc. 771 * </p> 772 * Hooks may accept the following parameters: 773 * <ul> 774 * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li> 775 * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li> 776 * </ul> 777 * <p> 778 * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns 779 * <code>void</code> or <code>true</code>, processing will continue normally. If the method 780 * returns <code>false</code>, processing will be aborted. 781 * </p> 782 */ 783 SUBSCRIPTION_BEFORE_DELIVERY(boolean.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"), 784 785 /** 786 * <b>Subscription Hook:</b> 787 * Invoked immediately after the delivery of a subscription, and right before any channel-specific 788 * hooks are invoked (e.g. {@link #SUBSCRIPTION_AFTER_REST_HOOK_DELIVERY}. 789 * <p> 790 * Hooks may accept the following parameters: 791 * </p> 792 * <ul> 793 * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li> 794 * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li> 795 * </ul> 796 * <p> 797 * Hooks should return <code>void</code>. 798 * </p> 799 */ 800 SUBSCRIPTION_AFTER_DELIVERY(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"), 801 802 803 /** 804 * <b>Subscription Hook:</b> 805 * Invoked immediately after the attempted delivery of a subscription, if the delivery 806 * failed. 807 * <p> 808 * Hooks may accept the following parameters: 809 * </p> 810 * <ul> 811 * <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> 812 * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage - the message that triggered the exception</li> 813 * <li>java.lang.Exception</li> 814 * </ul> 815 * <p> 816 * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns 817 * <code>void</code> or <code>true</code>, processing will continue normally, meaning that 818 * an exception will be thrown by the delivery mechanism. This typically means that the 819 * message will be returned to the processing queue. If the method 820 * returns <code>false</code>, processing will be aborted and no further action will be 821 * taken for the delivery. 822 * </p> 823 */ 824 SUBSCRIPTION_AFTER_DELIVERY_FAILED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage", "java.lang.Exception"), 825 826 /** 827 * <b>Subscription Hook:</b> 828 * Invoked immediately after the delivery of a REST HOOK subscription. 829 * <p> 830 * When this hook is called, all processing is complete so this hook should not 831 * make any changes to the parameters. 832 * </p> 833 * Hooks may accept the following parameters: 834 * <ul> 835 * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li> 836 * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li> 837 * </ul> 838 * <p> 839 * Hooks should return <code>void</code>. 840 * </p> 841 */ 842 SUBSCRIPTION_AFTER_REST_HOOK_DELIVERY(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"), 843 844 /** 845 * <b>Subscription Hook:</b> 846 * Invoked immediately before the delivery of a REST HOOK subscription. 847 * <p> 848 * Hooks may make changes to the delivery payload, or make changes to the 849 * canonical subscription such as adding headers, modifying the channel 850 * endpoint, etc. 851 * </p> 852 * Hooks may accept the following parameters: 853 * <ul> 854 * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li> 855 * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li> 856 * </ul> 857 * <p> 858 * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns 859 * <code>void</code> or <code>true</code>, processing will continue normally. If the method 860 * returns <code>false</code>, processing will be aborted. 861 * </p> 862 */ 863 SUBSCRIPTION_BEFORE_REST_HOOK_DELIVERY(boolean.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"), 864 865 /** 866 * <b>Subscription Hook:</b> 867 * Invoked immediately after the delivery of MESSAGE subscription. 868 * <p> 869 * When this hook is called, all processing is complete so this hook should not 870 * make any changes to the parameters. 871 * </p> 872 * Hooks may accept the following parameters: 873 * <ul> 874 * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li> 875 * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li> 876 * </ul> 877 * <p> 878 * Hooks should return <code>void</code>. 879 * </p> 880 */ 881 SUBSCRIPTION_AFTER_MESSAGE_DELIVERY(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage"), 882 883 /** 884 * <b>Subscription Hook:</b> 885 * Invoked immediately before the delivery of a MESSAGE subscription. 886 * <p> 887 * Hooks may make changes to the delivery payload, or make changes to the 888 * canonical subscription such as adding headers, modifying the channel 889 * endpoint, etc. 890 * Furthermore, you may modify the outgoing message wrapper, for example adding headers via ResourceModifiedJsonMessage field. 891 * 892 * </p> 893 * Hooks may accept the following parameters: 894 * <ul> 895 * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li> 896 * <li>ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage</li> 897 * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage</li> 898 * 899 * </ul> 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_MESSAGE_DELIVERY(boolean.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription", "ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage", "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage"), 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.) is about to be 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 - Hooks may modify this parameter. This will affect the checking process.</li> 918 * </ul> 919 * </p> 920 * <p> 921 * Hooks may return <code>void</code> or may return a <code>boolean</code>. If the method returns 922 * <code>void</code> or <code>true</code>, processing will continue normally. If the method 923 * returns <code>false</code>, processing will be aborted. 924 * </p> 925 */ 926 SUBSCRIPTION_BEFORE_PERSISTED_RESOURCE_CHECKED(boolean.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"), 927 928 929 /** 930 * <b>Subscription Hook:</b> 931 * Invoked whenever a persisted resource (a resource that has just been stored in the 932 * database via a create/update/patch/etc.) has been checked for whether any subscriptions 933 * were triggered as a result of the operation. 934 * <p> 935 * Hooks may accept the following parameters: 936 * <ul> 937 * <li>ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage - This parameter should not be modified as processing is complete when this hook is invoked.</li> 938 * </ul> 939 * </p> 940 * <p> 941 * Hooks should return <code>void</code>. 942 * </p> 943 */ 944 SUBSCRIPTION_AFTER_PERSISTED_RESOURCE_CHECKED(void.class, "ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage"), 945 946 947 /** 948 * <b>Subscription Hook:</b> 949 * Invoked immediately after an active subscription is "registered". In HAPI FHIR, when 950 * a subscription 951 * <p> 952 * Hooks may make changes to the canonicalized subscription and this will have an effect 953 * on processing across this server. Note however that timing issues may occur, since the 954 * subscription is already technically live by the time this hook is called. 955 * </p> 956 * Hooks may accept the following parameters: 957 * <ul> 958 * <li>ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription</li> 959 * </ul> 960 * <p> 961 * Hooks should return <code>void</code>. 962 * </p> 963 */ 964 SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_REGISTERED(void.class, "ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription"), 965 966 /** 967 * <b>Subscription Hook:</b> 968 * Invoked immediately after an active subscription is "registered". In HAPI FHIR, when 969 * a subscription 970 * <p> 971 * Hooks may make changes to the canonicalized subscription and this will have an effect 972 * on processing across this server. Note however that timing issues may occur, since the 973 * subscription is already technically live by the time this hook is called. 974 * </p> 975 * No parameters are currently supported. 976 * <p> 977 * Hooks should return <code>void</code>. 978 * </p> 979 */ 980 SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_UNREGISTERED(void.class), 981 982 /** 983 * <b>Storage Hook:</b> 984 * Invoked when a resource is being deleted in a cascaded delete. This means that 985 * some other resource is being deleted, but per use request or other 986 * policy, the given resource (the one supplied as a parameter to this hook) 987 * is also being deleted. 988 * <p> 989 * Hooks may accept the following parameters: 990 * </p> 991 * <ul> 992 * <li> 993 * 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 994 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 995 * pulled out of the servlet request. Note that the bean 996 * properties are not all guaranteed to be populated, depending on how early during processing the 997 * exception occurred. <b>Note that this parameter may be null in contexts where the request is not 998 * known, such as while processing searches</b> 999 * </li> 1000 * <li> 1001 * 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 1002 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1003 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1004 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1005 * </li> 1006 * <li> 1007 * ca.uhn.fhir.jpa.util.DeleteConflictList - Contains the details about the delete conflicts that are 1008 * being resolved via deletion. The source resource is the resource that will be deleted, and 1009 * is a cascade because the target resource is already being deleted. 1010 * </li> 1011 * <li> 1012 * org.hl7.fhir.instance.model.api.IBaseResource - The actual resource that is about to be deleted via a cascading delete 1013 * </li> 1014 * </ul> 1015 * <p> 1016 * Hooks should return <code>void</code>. They may choose to throw an exception however, in 1017 * which case the delete should be rolled back. 1018 * </p> 1019 */ 1020 STORAGE_CASCADE_DELETE( 1021 void.class, 1022 "ca.uhn.fhir.rest.api.server.RequestDetails", 1023 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1024 "ca.uhn.fhir.jpa.api.model.DeleteConflictList", 1025 "org.hl7.fhir.instance.model.api.IBaseResource" 1026 ), 1027 1028 1029 /** 1030 * <b>Storage Hook:</b> 1031 * Invoked when a Bulk Export job is being kicked off. Hook methods may modify 1032 * the request, or raise an exception to prevent it from being initiated. 1033 * <p> 1034 * Hooks may accept the following parameters: 1035 * </p> 1036 * <ul> 1037 * <li> 1038 * ca.uhn.fhir.jpa.bulk.export.api.BulkDataExportOptions - The details of the job being kicked off 1039 * </li> 1040 * <li> 1041 * 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 1042 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1043 * pulled out of the servlet request. Note that the bean 1044 * properties are not all guaranteed to be populated, depending on how early during processing the 1045 * exception occurred. <b>Note that this parameter may be null in contexts where the request is not 1046 * known, such as while processing searches</b> 1047 * </li> 1048 * <li> 1049 * 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 1050 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1051 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1052 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1053 * </li> 1054 * </ul> 1055 * <p> 1056 * Hooks should return <code>void</code>, and can throw exceptions. 1057 * </p> 1058 */ 1059 STORAGE_INITIATE_BULK_EXPORT( 1060 void.class, 1061 "ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions", 1062 "ca.uhn.fhir.rest.api.server.RequestDetails", 1063 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1064 ), 1065 /** 1066 * <b>Storage Hook:</b> 1067 * Invoked when a set of resources are about to be deleted and expunged via url like http://localhost/Patient?active=false&_expunge=true 1068 * <p> 1069 * Hooks may accept the following parameters: 1070 * </p> 1071 * <ul> 1072 * <li> 1073 * 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 1074 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1075 * pulled out of the servlet request. Note that the bean 1076 * properties are not all guaranteed to be populated, depending on how early during processing the 1077 * exception occurred. <b>Note that this parameter may be null in contexts where the request is not 1078 * known, such as while processing searches</b> 1079 * </li> 1080 * <li> 1081 * 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 1082 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1083 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1084 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1085 * </li> 1086 * <li> 1087 * java.lang.String - Contains the url used to delete and expunge the resources 1088 * </li> 1089 * </ul> 1090 * <p> 1091 * Hooks should return <code>void</code>. They may choose to throw an exception however, in 1092 * which case the delete expunge will not occur. 1093 * </p> 1094 */ 1095 1096 STORAGE_PRE_DELETE_EXPUNGE( 1097 void.class, 1098 "ca.uhn.fhir.rest.api.server.RequestDetails", 1099 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1100 "java.lang.String" 1101 ), 1102 1103 /** 1104 * <b>Storage Hook:</b> 1105 * Invoked when a batch of resource pids are about to be deleted and expunged via url like http://localhost/Patient?active=false&_expunge=true 1106 * <p> 1107 * Hooks may accept the following parameters: 1108 * </p> 1109 * <ul> 1110 * <li> 1111 * java.lang.String - the name of the resource type being deleted 1112 * </li> 1113 * <li> 1114 * java.util.List - the list of Long pids of the resources about to be deleted 1115 * </li> 1116 * <li> 1117 * java.util.concurrent.atomic.AtomicLong - holds a running tally of all entities deleted so far. 1118 * If the pointcut callback deletes any entities, then this parameter should be incremented by the total number 1119 * of additional entities deleted. 1120 * </li> 1121 * <li> 1122 * 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 1123 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1124 * pulled out of the servlet request. Note that the bean 1125 * properties are not all guaranteed to be populated, depending on how early during processing the 1126 * exception occurred. <b>Note that this parameter may be null in contexts where the request is not 1127 * known, such as while processing searches</b> 1128 * </li> 1129 * <li> 1130 * 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 1131 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1132 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1133 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1134 * </li> 1135 * <li> 1136 * java.lang.String - Contains the url used to delete and expunge the resources 1137 * </li> 1138 * </ul> 1139 * <p> 1140 * Hooks should return <code>void</code>. They may choose to throw an exception however, in 1141 * which case the delete expunge will not occur. 1142 * </p> 1143 */ 1144 1145 STORAGE_PRE_DELETE_EXPUNGE_PID_LIST( 1146 void.class, 1147 "java.lang.String", 1148 "java.util.List", 1149 "java.util.concurrent.atomic.AtomicLong", 1150 "ca.uhn.fhir.rest.api.server.RequestDetails", 1151 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1152 ), 1153 1154 /** 1155 * <b>Storage Hook:</b> 1156 * Invoked when one or more resources may be returned to the user, whether as a part of a READ, 1157 * a SEARCH, or even as the response to a CREATE/UPDATE, etc. 1158 * <p> 1159 * This hook is invoked when a resource has been loaded by the storage engine and 1160 * is being returned to the HTTP stack for response. This is not a guarantee that the 1161 * client will ultimately see it, since filters/headers/etc may affect what 1162 * is returned but if a resource is loaded it is likely to be used. 1163 * Note also that caching may affect whether this pointcut is invoked. 1164 * </p> 1165 * <p> 1166 * Hooks will have access to the contents of the resource being returned 1167 * and may choose to make modifications. These changes will be reflected in 1168 * returned resource but have no effect on storage. 1169 * </p> 1170 * Hooks may accept the following parameters: 1171 * <ul> 1172 * <li> 1173 * ca.uhn.fhir.rest.api.server.IPreResourceAccessDetails - Contains details about the 1174 * specific resources being returned. 1175 * </li> 1176 * <li> 1177 * 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 1178 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1179 * pulled out of the servlet request. Note that the bean 1180 * properties are not all guaranteed to be populated, depending on how early during processing the 1181 * exception occurred. <b>Note that this parameter may be null in contexts where the request is not 1182 * known, such as while processing searches</b> 1183 * </li> 1184 * <li> 1185 * 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 1186 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1187 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1188 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1189 * </li> 1190 * </ul> 1191 * <p> 1192 * Hooks should return <code>void</code>. 1193 * </p> 1194 */ 1195 STORAGE_PREACCESS_RESOURCES(void.class, 1196 "ca.uhn.fhir.rest.api.server.IPreResourceAccessDetails", 1197 "ca.uhn.fhir.rest.api.server.RequestDetails", 1198 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1199 ), 1200 1201 /** 1202 * <b>Storage Hook:</b> 1203 * Invoked when the storage engine is about to check for the existence of a pre-cached search 1204 * whose results match the given search parameters. 1205 * <p> 1206 * Hooks may accept the following parameters: 1207 * </p> 1208 * <ul> 1209 * <li> 1210 * ca.uhn.fhir.jpa.searchparam.SearchParameterMap - Contains the details of the search being checked 1211 * </li> 1212 * <li> 1213 * 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 1214 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1215 * pulled out of the servlet request. Note that the bean 1216 * properties are not all guaranteed to be populated, depending on how early during processing the 1217 * exception occurred. <b>Note that this parameter may be null in contexts where the request is not 1218 * known, such as while processing searches</b> 1219 * </li> 1220 * <li> 1221 * 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 1222 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1223 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1224 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1225 * </li> 1226 * </ul> 1227 * <p> 1228 * Hooks may return <code>boolean</code>. If the hook method returns 1229 * <code>false</code>, the server will not attempt to check for a cached 1230 * search no matter what. 1231 * </p> 1232 */ 1233 STORAGE_PRECHECK_FOR_CACHED_SEARCH(boolean.class, 1234 "ca.uhn.fhir.jpa.searchparam.SearchParameterMap", 1235 "ca.uhn.fhir.rest.api.server.RequestDetails", 1236 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1237 ), 1238 1239 /** 1240 * <b>Storage Hook:</b> 1241 * Invoked when a search is starting, prior to creating a record for the search. 1242 * <p> 1243 * Hooks may accept the following parameters: 1244 * </p> 1245 * <ul> 1246 * <li> 1247 * ca.uhn.fhir.rest.server.util.ICachedSearchDetails - Contains the details of the search that 1248 * is being created and initialized 1249 * </li> 1250 * <li> 1251 * 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 1252 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1253 * pulled out of the servlet request. Note that the bean 1254 * properties are not all guaranteed to be populated, depending on how early during processing the 1255 * exception occurred. <b>Note that this parameter may be null in contexts where the request is not 1256 * known, such as while processing searches</b> 1257 * </li> 1258 * <li> 1259 * 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 1260 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1261 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1262 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1263 * </li> 1264 * <li> 1265 * ca.uhn.fhir.jpa.searchparam.SearchParameterMap - Contains the details of the search being checked. This can be modified. 1266 * </li> 1267 * </ul> 1268 * <p> 1269 * Hooks should return <code>void</code>. 1270 * </p> 1271 */ 1272 STORAGE_PRESEARCH_REGISTERED(void.class, 1273 "ca.uhn.fhir.rest.server.util.ICachedSearchDetails", 1274 "ca.uhn.fhir.rest.api.server.RequestDetails", 1275 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1276 "ca.uhn.fhir.jpa.searchparam.SearchParameterMap" 1277 ), 1278 1279 /** 1280 * <b>Storage Hook:</b> 1281 * Invoked when one or more resources may be returned to the user, whether as a part of a READ, 1282 * a SEARCH, or even as the response to a CREATE/UPDATE, etc. 1283 * <p> 1284 * This hook is invoked when a resource has been loaded by the storage engine and 1285 * is being returned to the HTTP stack for response. 1286 * This is not a guarantee that the 1287 * client will ultimately see it, since filters/headers/etc may affect what 1288 * is returned but if a resource is loaded it is likely to be used. 1289 * Note also that caching may affect whether this pointcut is invoked. 1290 * </p> 1291 * <p> 1292 * Hooks will have access to the contents of the resource being returned 1293 * and may choose to make modifications. These changes will be reflected in 1294 * returned resource but have no effect on storage. 1295 * </p> 1296 * Hooks may accept the following parameters: 1297 * <ul> 1298 * <li> 1299 * ca.uhn.fhir.rest.api.server.IPreResourceShowDetails - Contains the resources that 1300 * will be shown to the user. This object may be manipulated in order to modify 1301 * the actual resources being shown to the user (e.g. for masking) 1302 * </li> 1303 * <li> 1304 * 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 1305 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1306 * pulled out of the servlet request. Note that the bean 1307 * properties are not all guaranteed to be populated, depending on how early during processing the 1308 * exception occurred. <b>Note that this parameter may be null in contexts where the request is not 1309 * known, such as while processing searches</b> 1310 * </li> 1311 * <li> 1312 * 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 1313 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1314 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1315 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1316 * </li> 1317 * </ul> 1318 * <p> 1319 * Hooks should return <code>void</code>. 1320 * </p> 1321 */ 1322 STORAGE_PRESHOW_RESOURCES(void.class, 1323 "ca.uhn.fhir.rest.api.server.IPreResourceShowDetails", 1324 "ca.uhn.fhir.rest.api.server.RequestDetails", 1325 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1326 ), 1327 1328 /** 1329 * <b>Storage Hook:</b> 1330 * Invoked before a resource will be created, immediately before the resource 1331 * is persisted to the database. 1332 * <p> 1333 * Hooks will have access to the contents of the resource being created 1334 * and may choose to make modifications to it. These changes will be 1335 * reflected in permanent storage. 1336 * </p> 1337 * Hooks may accept the following parameters: 1338 * <ul> 1339 * <li>org.hl7.fhir.instance.model.api.IBaseResource</li> 1340 * <li> 1341 * 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 1342 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1343 * pulled out of the servlet request. Note that the bean 1344 * properties are not all guaranteed to be populated, depending on how early during processing the 1345 * exception occurred. 1346 * </li> 1347 * <li> 1348 * 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 1349 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1350 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1351 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1352 * </li> 1353 * <li> 1354 * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0) 1355 * </li> 1356 * </ul> 1357 * <p> 1358 * Hooks should return <code>void</code>. 1359 * </p> 1360 */ 1361 STORAGE_PRESTORAGE_RESOURCE_CREATED(void.class, 1362 "org.hl7.fhir.instance.model.api.IBaseResource", 1363 "ca.uhn.fhir.rest.api.server.RequestDetails", 1364 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1365 "ca.uhn.fhir.rest.api.server.storage.TransactionDetails", 1366 "ca.uhn.fhir.interceptor.model.RequestPartitionId" 1367 ), 1368 1369 /** 1370 * <b>Storage Hook:</b> 1371 * Invoked before client-assigned id is created. 1372 * <p> 1373 * Hooks will have access to the contents of the resource being created 1374 * so that client-assigned ids can be allowed/denied. These changes will 1375 * be reflected in permanent storage. 1376 * </p> 1377 * Hooks may accept the following parameters: 1378 * <ul> 1379 * <li>org.hl7.fhir.instance.model.api.IBaseResource</li> 1380 * <li> 1381 * 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 1382 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1383 * pulled out of the servlet request. Note that the bean 1384 * properties are not all guaranteed to be populated, depending on how early during processing the 1385 * exception occurred. 1386 * </li> 1387 * </ul> 1388 * <p> 1389 * Hooks should return <code>void</code>. 1390 * </p> 1391 */ 1392 STORAGE_PRESTORAGE_CLIENT_ASSIGNED_ID(void.class, 1393 "org.hl7.fhir.instance.model.api.IBaseResource", 1394 "ca.uhn.fhir.rest.api.server.RequestDetails" 1395 ), 1396 1397 /** 1398 * <b>Storage Hook:</b> 1399 * Invoked before a resource will be updated, immediately before the resource 1400 * is persisted to the database. 1401 * <p> 1402 * Hooks will have access to the contents of the resource being updated 1403 * (both the previous and new contents) and may choose to make modifications 1404 * to the new contents of the resource. These changes will be reflected in 1405 * permanent storage. 1406 * </p> 1407 * Hooks may accept the following parameters: 1408 * <ul> 1409 * <li>org.hl7.fhir.instance.model.api.IBaseResource - The previous contents of the resource being updated</li> 1410 * <li>org.hl7.fhir.instance.model.api.IBaseResource - The new contents of the resource being updated</li> 1411 * <li> 1412 * 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 1413 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1414 * pulled out of the servlet request. Note that the bean 1415 * properties are not all guaranteed to be populated, depending on how early during processing the 1416 * exception occurred. 1417 * </li> 1418 * <li> 1419 * 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 1420 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1421 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1422 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1423 * </li> 1424 * <li> 1425 * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0) 1426 * </li> 1427 * </ul> 1428 * <p> 1429 * Hooks should return <code>void</code>. 1430 * </p> 1431 */ 1432 STORAGE_PRESTORAGE_RESOURCE_UPDATED(void.class, 1433 "org.hl7.fhir.instance.model.api.IBaseResource", 1434 "org.hl7.fhir.instance.model.api.IBaseResource", 1435 "ca.uhn.fhir.rest.api.server.RequestDetails", 1436 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1437 "ca.uhn.fhir.rest.api.server.storage.TransactionDetails" 1438 ), 1439 1440 /** 1441 * <b>Storage Hook:</b> 1442 * Invoked before a resource will be created, immediately before the resource 1443 * is persisted to the database. 1444 * <p> 1445 * Hooks will have access to the contents of the resource being created 1446 * and may choose to make modifications to it. These changes will be 1447 * reflected in permanent storage. 1448 * </p> 1449 * Hooks may accept the following parameters: 1450 * <ul> 1451 * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li> 1452 * <li> 1453 * 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 1454 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1455 * pulled out of the servlet request. Note that the bean 1456 * properties are not all guaranteed to be populated, depending on how early during processing the 1457 * exception occurred. 1458 * </li> 1459 * <li> 1460 * 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 1461 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1462 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1463 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1464 * </li> 1465 * <li> 1466 * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0) 1467 * </li> 1468 * </ul> 1469 * <p> 1470 * Hooks should return <code>void</code>. 1471 * </p> 1472 */ 1473 STORAGE_PRESTORAGE_RESOURCE_DELETED(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 ), 1479 1480 1481 /** 1482 * <b>Storage Hook:</b> 1483 * Invoked before a resource will be created, 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 created 1488 * 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</li> 1495 * <li> 1496 * 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 1497 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1498 * pulled out of the servlet request. Note that the bean 1499 * properties are not all guaranteed to be populated, depending on how early during processing the 1500 * exception occurred. 1501 * </li> 1502 * <li> 1503 * 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 1504 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1505 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1506 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1507 * </li> 1508 * <li> 1509 * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0) 1510 * </li> 1511 * <li> 1512 * Boolean - Whether this pointcut invocation was deferred or not(since 5.4.0) 1513 * </li> 1514 * <li> 1515 * ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum - The timing at which the invocation of the interceptor took place. Options are ACTIVE and DEFERRED. 1516 * </li> 1517 * </ul> 1518 * <p> 1519 * Hooks should return <code>void</code>. 1520 * </p> 1521 */ 1522 STORAGE_PRECOMMIT_RESOURCE_CREATED(void.class, 1523 "org.hl7.fhir.instance.model.api.IBaseResource", 1524 "ca.uhn.fhir.rest.api.server.RequestDetails", 1525 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1526 "ca.uhn.fhir.rest.api.server.storage.TransactionDetails", 1527 "ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum" 1528 ), 1529 1530 /** 1531 * <b>Storage Hook:</b> 1532 * Invoked before a resource will be updated, immediately before the transaction 1533 * is committed (after all validation and other business rules have successfully 1534 * completed, and any other database activity is complete. 1535 * <p> 1536 * Hooks will have access to the contents of the resource being updated 1537 * (both the previous and new contents) but should generally not make any 1538 * changes as storage has already occurred. Changes will not be reflected 1539 * in storage, but may be reflected in the HTTP response. 1540 * </p> 1541 * Hooks may accept the following parameters: 1542 * <ul> 1543 * <li>org.hl7.fhir.instance.model.api.IBaseResource - The previous contents of the resource</li> 1544 * <li>org.hl7.fhir.instance.model.api.IBaseResource - The proposed new contents of the resource</li> 1545 * <li> 1546 * 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 1547 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1548 * pulled out of the servlet request. Note that the bean 1549 * properties are not all guaranteed to be populated, depending on how early during processing the 1550 * exception occurred. 1551 * </li> 1552 * <li> 1553 * 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 1554 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1555 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1556 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1557 * </li> 1558 * <li> 1559 * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0) 1560 * </li> 1561 * <li> 1562 * ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum - The timing at which the invocation of the interceptor took place. Options are ACTIVE and DEFERRED. 1563 * </li> 1564 * </ul> 1565 * <p> 1566 * Hooks should return <code>void</code>. 1567 * </p> 1568 */ 1569 STORAGE_PRECOMMIT_RESOURCE_UPDATED(void.class, 1570 "org.hl7.fhir.instance.model.api.IBaseResource", 1571 "org.hl7.fhir.instance.model.api.IBaseResource", 1572 "ca.uhn.fhir.rest.api.server.RequestDetails", 1573 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1574 "ca.uhn.fhir.rest.api.server.storage.TransactionDetails", 1575 "ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum" 1576 ), 1577 1578 1579 /** 1580 * <b>Storage Hook:</b> 1581 * Invoked before a resource will be deleted 1582 * <p> 1583 * Hooks will have access to the contents of the resource being deleted 1584 * but should not make any changes as storage has already occurred 1585 * </p> 1586 * Hooks may accept the following parameters: 1587 * <ul> 1588 * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li> 1589 * <li> 1590 * 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 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. Note that the bean 1593 * properties are not all guaranteed to be populated, depending on how early during processing the 1594 * exception occurred. 1595 * </li> 1596 * <li> 1597 * 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 1598 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1599 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1600 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1601 * </li> 1602 * <li> 1603 * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0) 1604 * </li> 1605 * <li> 1606 * ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum - The timing at which the invocation of the interceptor took place. Options are ACTIVE and DEFERRED. 1607 * </li> 1608 * </ul> 1609 * <p> 1610 * Hooks should return <code>void</code>. 1611 * </p> 1612 */ 1613 STORAGE_PRECOMMIT_RESOURCE_DELETED(void.class, 1614 "org.hl7.fhir.instance.model.api.IBaseResource", 1615 "ca.uhn.fhir.rest.api.server.RequestDetails", 1616 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1617 "ca.uhn.fhir.rest.api.server.storage.TransactionDetails", 1618 "ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum" 1619 ), 1620 1621 /** 1622 * <b>Storage Hook:</b> 1623 * Invoked when a FHIR transaction bundle is about to begin processing. Hooks may choose to 1624 * modify the bundle, and may affect processing by doing so. 1625 * <p> 1626 * Hooks will have access to the original bundle, as well as all the deferred interceptor broadcasts related to the 1627 * processing of the transaction bundle 1628 * </p> 1629 * Hooks may accept the following parameters: 1630 * <ul> 1631 * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li> 1632 * <li> 1633 * 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 1634 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1635 * pulled out of the servlet request. 1636 * </li> 1637 * <li> 1638 * 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 1639 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1640 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1641 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1642 * </li> 1643 * </ul> 1644 * <p> 1645 * Hooks should return <code>void</code>. 1646 * </p> 1647 * 1648 * @see #STORAGE_TRANSACTION_PROCESSED 1649 * @since 6.2.0 1650 */ 1651 STORAGE_TRANSACTION_PROCESSING(void.class, 1652 "org.hl7.fhir.instance.model.api.IBaseBundle", 1653 "ca.uhn.fhir.rest.api.server.RequestDetails", 1654 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1655 ), 1656 1657 /** 1658 * <b>Storage Hook:</b> 1659 * Invoked after all entries in a transaction bundle have been executed 1660 * <p> 1661 * Hooks will have access to the original bundle, as well as all the deferred interceptor broadcasts related to the 1662 * processing of the transaction bundle 1663 * </p> 1664 * Hooks may accept the following parameters: 1665 * <ul> 1666 * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource being deleted</li> 1667 * <li> 1668 * 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 1669 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1670 * pulled out of the servlet request. 1671 * </li> 1672 * <li> 1673 * 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 1674 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1675 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1676 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1677 * </li> 1678 * <li> 1679 * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0) 1680 * </li> 1681 * <li> 1682 * ca.uhn.fhir.rest.api.server.storage.DeferredInterceptorBroadcasts- A collection of pointcut invocations and their parameters which were deferred. 1683 * </li> 1684 * </ul> 1685 * <p> 1686 * Hooks should return <code>void</code>. 1687 * </p> 1688 * 1689 * @see #STORAGE_TRANSACTION_PROCESSING 1690 */ 1691 STORAGE_TRANSACTION_PROCESSED(void.class, 1692 "org.hl7.fhir.instance.model.api.IBaseBundle", 1693 "ca.uhn.fhir.rest.api.server.storage.DeferredInterceptorBroadcasts", 1694 "ca.uhn.fhir.rest.api.server.RequestDetails", 1695 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1696 "ca.uhn.fhir.rest.api.server.storage.TransactionDetails" 1697 ), 1698 1699 1700 /** 1701 * <b>Storage Hook:</b> 1702 * Invoked during a FHIR transaction, immediately before processing all write operations (i.e. immediately 1703 * before a database transaction will be opened) 1704 * <p> 1705 * Hooks may accept the following parameters: 1706 * </p> 1707 * <ul> 1708 * <li> 1709 * ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails - Contains details about the transaction that is about to start 1710 * </li> 1711 * <li> 1712 * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0) 1713 * </li> 1714 * </ul> 1715 * <p> 1716 * Hooks should return <code>void</code>. 1717 * </p> 1718 */ 1719 STORAGE_TRANSACTION_WRITE_OPERATIONS_PRE(void.class, 1720 "ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails", 1721 "ca.uhn.fhir.rest.api.server.storage.TransactionDetails" 1722 ), 1723 1724 /** 1725 * <b>Storage Hook:</b> 1726 * Invoked during a FHIR transaction, immediately after processing all write operations (i.e. immediately 1727 * after the transaction has been committed or rolled back). This hook will always be called if 1728 * {@link #STORAGE_TRANSACTION_WRITE_OPERATIONS_PRE} has been called, regardless of whether the operation 1729 * succeeded or failed. 1730 * <p> 1731 * Hooks may accept the following parameters: 1732 * </p> 1733 * <ul> 1734 * <li> 1735 * ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails - Contains details about the transaction that is about to start 1736 * </li> 1737 * <li> 1738 * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0) 1739 * </li> 1740 * </ul> 1741 * <p> 1742 * Hooks should return <code>void</code>. 1743 * </p> 1744 */ 1745 STORAGE_TRANSACTION_WRITE_OPERATIONS_POST(void.class, 1746 "ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails", 1747 "ca.uhn.fhir.rest.api.server.storage.TransactionDetails" 1748 ), 1749 1750 /** 1751 * <b>Storage Hook:</b> 1752 * 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}. 1753 * <p> 1754 * Hooks will have access to the list of resources that have references to the resource being deleted. 1755 * </p> 1756 * Hooks may accept the following parameters: 1757 * <ul> 1758 * <li>ca.uhn.fhir.jpa.api.model.DeleteConflictList - The list of delete conflicts</li> 1759 * <li> 1760 * 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 1761 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1762 * pulled out of the servlet request. Note that the bean 1763 * properties are not all guaranteed to be populated, depending on how early during processing the 1764 * exception occurred. 1765 * </li> 1766 * <li> 1767 * 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 1768 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1769 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1770 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1771 * </li> 1772 * <li> 1773 * ca.uhn.fhir.rest.api.server.storage.TransactionDetails - The outer transaction details object (since 5.0.0) 1774 * </li> 1775 * </ul> 1776 * <p> 1777 * Hooks should return <code>ca.uhn.fhir.jpa.delete.DeleteConflictOutcome</code>. 1778 * If the interceptor returns a non-null result, the DeleteConflictOutcome can be 1779 * used to indicate a number of times to retry. 1780 * </p> 1781 */ 1782 STORAGE_PRESTORAGE_DELETE_CONFLICTS( 1783 // Return type 1784 "ca.uhn.fhir.jpa.delete.DeleteConflictOutcome", 1785 // Params 1786 "ca.uhn.fhir.jpa.api.model.DeleteConflictList", 1787 "ca.uhn.fhir.rest.api.server.RequestDetails", 1788 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1789 "ca.uhn.fhir.rest.api.server.storage.TransactionDetails" 1790 ), 1791 1792 /** 1793 * <b>Storage Hook:</b> 1794 * Invoked before a resource is about to be expunged via the <code>$expunge</code> operation. 1795 * <p> 1796 * Hooks will be passed a reference to a counter containing the current number of records that have been deleted. 1797 * If the hook deletes any records, the hook is expected to increment this counter by the number of records deleted. 1798 * </p> 1799 * <p> 1800 * Hooks may accept the following parameters: 1801 * </p> 1802 * <ul> 1803 * <li>java.util.concurrent.atomic.AtomicInteger - The counter holding the number of records deleted.</li> 1804 * <li>org.hl7.fhir.instance.model.api.IIdType - The ID of the resource that is about to be deleted</li> 1805 * <li>org.hl7.fhir.instance.model.api.IBaseResource - The resource that is about to be deleted</li> 1806 * <li> 1807 * 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 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. Note that the bean 1810 * properties are not all guaranteed to be populated, depending on how early during processing the 1811 * exception occurred. 1812 * </li> 1813 * <li> 1814 * 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 1815 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1816 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1817 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1818 * </li> 1819 * </ul> 1820 * <p> 1821 * Hooks should return void. 1822 * </p> 1823 */ 1824 STORAGE_PRESTORAGE_EXPUNGE_RESOURCE( 1825 // Return type 1826 void.class, 1827 // Params 1828 "java.util.concurrent.atomic.AtomicInteger", 1829 "org.hl7.fhir.instance.model.api.IIdType", 1830 "org.hl7.fhir.instance.model.api.IBaseResource", 1831 "ca.uhn.fhir.rest.api.server.RequestDetails", 1832 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1833 ), 1834 1835 /** 1836 * <b>Storage Hook:</b> 1837 * Invoked before an <code>$expunge</code> operation on all data (expungeEverything) is called. 1838 * <p> 1839 * Hooks will be passed a reference to a counter containing the current number of records that have been deleted. 1840 * If the hook deletes any records, the hook is expected to increment this counter by the number of records deleted. 1841 * </p> 1842 * Hooks may accept the following parameters: 1843 * <ul> 1844 * <li>java.util.concurrent.atomic.AtomicInteger - The counter holding the number of records deleted.</li> 1845 * <li> 1846 * 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 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. Note that the bean 1849 * properties are not all guaranteed to be populated, depending on how early during processing the 1850 * exception occurred. 1851 * </li> 1852 * <li> 1853 * 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 1854 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1855 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1856 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1857 * </li> 1858 * </ul> 1859 * <p> 1860 * Hooks should return void. 1861 * </p> 1862 */ 1863 STORAGE_PRESTORAGE_EXPUNGE_EVERYTHING( 1864 // Return type 1865 void.class, 1866 // Params 1867 "java.util.concurrent.atomic.AtomicInteger", 1868 "ca.uhn.fhir.rest.api.server.RequestDetails", 1869 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1870 ), 1871 1872 /** 1873 * <b>Storage Hook:</b> 1874 * Invoked before FHIR <b>create</b> operation to request the identification of the partition ID to be associated 1875 * with the resource being created. This hook will only be called if partitioning is enabled in the JPA 1876 * server. 1877 * <p> 1878 * Hooks may accept the following parameters: 1879 * </p> 1880 * <ul> 1881 * <li> 1882 * org.hl7.fhir.instance.model.api.IBaseResource - The resource that will be created and needs a tenant ID assigned. 1883 * </li> 1884 * <li> 1885 * 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 1886 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1887 * pulled out of the servlet request. Note that the bean 1888 * properties are not all guaranteed to be populated, depending on how early during processing the 1889 * exception occurred. 1890 * </li> 1891 * <li> 1892 * 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 1893 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1894 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1895 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1896 * </li> 1897 * </ul> 1898 * <p> 1899 * Hooks must return an instance of <code>ca.uhn.fhir.interceptor.model.RequestPartitionId</code>. 1900 * </p> 1901 * 1902 * @see #STORAGE_PARTITION_IDENTIFY_ANY For an alternative that is not read/write specific 1903 */ 1904 STORAGE_PARTITION_IDENTIFY_CREATE( 1905 // Return type 1906 "ca.uhn.fhir.interceptor.model.RequestPartitionId", 1907 // Params 1908 "org.hl7.fhir.instance.model.api.IBaseResource", 1909 "ca.uhn.fhir.rest.api.server.RequestDetails", 1910 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1911 ), 1912 1913 /** 1914 * <b>Storage Hook:</b> 1915 * Invoked before FHIR read/access operation (e.g. <b>read/vread</b>, <b>search</b>, <b>history</b>, etc.) operation to request the 1916 * identification of the partition ID to be associated with the resource(s) being searched for, read, etc. 1917 * <p> 1918 * This hook will only be called if 1919 * partitioning is enabled in the JPA server. 1920 * </p> 1921 * <p> 1922 * Hooks may accept the following parameters: 1923 * </p> 1924 * <ul> 1925 * <li> 1926 * 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 1927 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1928 * pulled out of the servlet request. Note that the bean 1929 * properties are not all guaranteed to be populated, depending on how early during processing the 1930 * exception occurred. 1931 * </li> 1932 * <li> 1933 * 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 1934 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1935 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1936 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1937 * </li> 1938 * <li>ca.uhn.fhir.interceptor.model.ReadPartitionIdRequestDetails - Contains details about what is being read</li> 1939 * </ul> 1940 * <p> 1941 * Hooks must return an instance of <code>ca.uhn.fhir.interceptor.model.RequestPartitionId</code>. 1942 * </p> 1943 * 1944 * @see #STORAGE_PARTITION_IDENTIFY_ANY For an alternative that is not read/write specific 1945 */ 1946 STORAGE_PARTITION_IDENTIFY_READ( 1947 // Return type 1948 "ca.uhn.fhir.interceptor.model.RequestPartitionId", 1949 // Params 1950 "ca.uhn.fhir.rest.api.server.RequestDetails", 1951 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 1952 "ca.uhn.fhir.interceptor.model.ReadPartitionIdRequestDetails" 1953 ), 1954 1955 /** 1956 * <b>Storage Hook:</b> 1957 * Invoked before FHIR operations to request the identification of the partition ID to be associated with the 1958 * request being made. 1959 * <p> 1960 * This hook is an alternative to {@link #STORAGE_PARTITION_IDENTIFY_READ} and {@link #STORAGE_PARTITION_IDENTIFY_CREATE} 1961 * and can be used in cases where a partition interceptor does not need knowledge of the specific resources being 1962 * accessed/read/written in order to determine the appropriate partition. 1963 * </p> 1964 * <p> 1965 * This hook will only be called if 1966 * partitioning is enabled in the JPA server. 1967 * </p> 1968 * <p> 1969 * Hooks may accept the following parameters: 1970 * </p> 1971 * <ul> 1972 * <li> 1973 * 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 1974 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1975 * pulled out of the servlet request. Note that the bean 1976 * properties are not all guaranteed to be populated, depending on how early during processing the 1977 * exception occurred. 1978 * </li> 1979 * <li> 1980 * 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 1981 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 1982 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 1983 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 1984 * </li> 1985 * </ul> 1986 * <p> 1987 * Hooks must return an instance of <code>ca.uhn.fhir.interceptor.model.RequestPartitionId</code>. 1988 * </p> 1989 * 1990 * @see #STORAGE_PARTITION_IDENTIFY_READ 1991 * @see #STORAGE_PARTITION_IDENTIFY_CREATE 1992 */ 1993 STORAGE_PARTITION_IDENTIFY_ANY( 1994 // Return type 1995 "ca.uhn.fhir.interceptor.model.RequestPartitionId", 1996 // Params 1997 "ca.uhn.fhir.rest.api.server.RequestDetails", 1998 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 1999 ), 2000 2001 /** 2002 * <b>Storage Hook:</b> 2003 * Invoked when a partition has been created, typically meaning the <code>$partition-management-create-partition</code> 2004 * operation has been invoked. 2005 * <p> 2006 * This hook will only be called if 2007 * partitioning is enabled in the JPA server. 2008 * </p> 2009 * <p> 2010 * Hooks may accept the following parameters: 2011 * </p> 2012 * <ul> 2013 * <li> 2014 * ca.uhn.fhir.interceptor.model.RequestPartitionId - The partition ID that was selected 2015 * </li> 2016 * <li> 2017 * 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 2018 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2019 * pulled out of the servlet request. Note that the bean 2020 * properties are not all guaranteed to be populated, depending on how early during processing the 2021 * exception occurred. 2022 * </li> 2023 * <li> 2024 * 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 2025 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2026 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 2027 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 2028 * </li> 2029 * </ul> 2030 * <p> 2031 * Hooks must return void. 2032 * </p> 2033 */ 2034 STORAGE_PARTITION_CREATED( 2035 // Return type 2036 void.class, 2037 // Params 2038 "ca.uhn.fhir.interceptor.model.RequestPartitionId", 2039 "ca.uhn.fhir.rest.api.server.RequestDetails", 2040 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 2041 ), 2042 2043 2044 /** 2045 * <b>Storage Hook:</b> 2046 * Invoked before any partition aware FHIR operation, when the selected partition has been identified (ie. after the 2047 * {@link #STORAGE_PARTITION_IDENTIFY_CREATE} or {@link #STORAGE_PARTITION_IDENTIFY_READ} hook was called. This allows 2048 * a separate hook to register, and potentially make decisions about whether the request should be allowed to proceed. 2049 * <p> 2050 * This hook will only be called if 2051 * partitioning is enabled in the JPA server. 2052 * </p> 2053 * <p> 2054 * Hooks may accept the following parameters: 2055 * </p> 2056 * <ul> 2057 * <li> 2058 * ca.uhn.fhir.interceptor.model.RequestPartitionId - The partition ID that was selected 2059 * </li> 2060 * <li> 2061 * 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 2062 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2063 * pulled out of the servlet request. Note that the bean 2064 * properties are not all guaranteed to be populated, depending on how early during processing the 2065 * exception occurred. 2066 * </li> 2067 * <li> 2068 * 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 2069 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2070 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 2071 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 2072 * </li> 2073 * <li> 2074 * ca.uhn.fhir.context.RuntimeResourceDefinition - the resource type being accessed 2075 * </li> 2076 * </ul> 2077 * <p> 2078 * Hooks must return void. 2079 * </p> 2080 */ 2081 STORAGE_PARTITION_SELECTED( 2082 // Return type 2083 void.class, 2084 // Params 2085 "ca.uhn.fhir.interceptor.model.RequestPartitionId", 2086 "ca.uhn.fhir.rest.api.server.RequestDetails", 2087 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 2088 "ca.uhn.fhir.context.RuntimeResourceDefinition" 2089 ), 2090 2091 /** 2092 * <b>Storage Hook:</b> 2093 * Invoked when a transaction has been rolled back as a result of a {@link ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException}, 2094 * meaning that a database constraint has been violated. This pointcut allows an interceptor to specify a resolution strategy 2095 * other than simply returning the error to the client. This interceptor will be fired after the database transaction rollback 2096 * has been completed. 2097 * <p> 2098 * Hooks may accept the following parameters: 2099 * </p> 2100 * <ul> 2101 * <li> 2102 * 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 2103 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2104 * pulled out of the servlet request. Note that the bean 2105 * properties are not all guaranteed to be populated, depending on how early during processing the 2106 * exception occurred. <b>Note that this parameter may be null in contexts where the request is not 2107 * known, such as while processing searches</b> 2108 * </li> 2109 * <li> 2110 * 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 2111 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2112 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 2113 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 2114 * </li> 2115 * </ul> 2116 * <p> 2117 * Hooks should return <code>ca.uhn.fhir.jpa.api.model.ResourceVersionConflictResolutionStrategy</code>. Hooks should not 2118 * throw any exception. 2119 * </p> 2120 */ 2121 STORAGE_VERSION_CONFLICT( 2122 "ca.uhn.fhir.jpa.api.model.ResourceVersionConflictResolutionStrategy", 2123 "ca.uhn.fhir.rest.api.server.RequestDetails", 2124 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 2125 ), 2126 2127 /** 2128 * <b>Validation Hook:</b> 2129 * This hook is called after validation has completed, regardless of whether the validation was successful or failed. 2130 * Typically this is used to modify validation results. 2131 * <p> 2132 * <b>Note on validation Pointcuts:</b> The HAPI FHIR interceptor framework is a part of the client and server frameworks and 2133 * not a part of the core FhirContext. Therefore this Pointcut is invoked by the 2134 * </p> 2135 * <p> 2136 * Hooks may accept the following parameters: 2137 * <ul> 2138 * <li> 2139 * org.hl7.fhir.instance.model.api.IBaseResource - The resource being validated, if a parsed version is available (null otherwise) 2140 * </li> 2141 * <li> 2142 * java.lang.String - The resource being validated, if a raw version is available (null otherwise) 2143 * </li> 2144 * <li> 2145 * ca.uhn.fhir.validation.ValidationResult - The outcome of the validation. Hooks methods should not modify this object, but they can return a new one. 2146 * </li> 2147 * </ul> 2148 * </p> 2149 * 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. 2150 */ 2151 VALIDATION_COMPLETED(ValidationResult.class, 2152 "org.hl7.fhir.instance.model.api.IBaseResource", 2153 "java.lang.String", 2154 "ca.uhn.fhir.validation.ValidationResult" 2155 ), 2156 2157 /** 2158 * <b>MDM(EMPI) Hook:</b> 2159 * Invoked when a persisted resource (a resource that has just been stored in the 2160 * database via a create/update/patch/etc.) enters the MDM module. The purpose of the pointcut is to permit a pseudo 2161 * modification of the resource elements to influence the MDM linking process. Any modifications to the resource are not persisted. 2162 * <p> 2163 * Hooks may accept the following parameters: 2164 * <ul> 2165 * <li>org.hl7.fhir.instance.model.api.IBaseResource - </li> 2166 * </ul> 2167 * </p> 2168 * <p> 2169 * Hooks should return <code>void</code>. 2170 * </p> 2171 */ 2172 MDM_BEFORE_PERSISTED_RESOURCE_CHECKED(void.class, 2173 "org.hl7.fhir.instance.model.api.IBaseResource"), 2174 2175 /** 2176 * <b>MDM(EMPI) Hook:</b> 2177 * Invoked whenever a persisted resource (a resource that has just been stored in the 2178 * database via a create/update/patch/etc.) has been matched against related resources and MDM links have been updated. 2179 * <p> 2180 * Hooks may accept the following parameters: 2181 * <ul> 2182 * <li>ca.uhn.fhir.rest.server.messaging.ResourceOperationMessage - This parameter should not be modified as processing is complete when this hook is invoked.</li> 2183 * <li>ca.uhn.fhir.rest.server.TransactionLogMessages - This parameter is for informational messages provided by the MDM module during MDM processing.</li> 2184 * <li>ca.uhn.fhir.mdm.api.MdmLinkChangeEvent - Contains information about the change event, including target and golden resource IDs and the operation type.</li> 2185 * </ul> 2186 * </p> 2187 * <p> 2188 * Hooks should return <code>void</code>. 2189 * </p> 2190 */ 2191 MDM_AFTER_PERSISTED_RESOURCE_CHECKED(void.class, 2192 "ca.uhn.fhir.rest.server.messaging.ResourceOperationMessage", 2193 "ca.uhn.fhir.rest.server.TransactionLogMessages", 2194 "ca.uhn.fhir.mdm.api.MdmLinkEvent"), 2195 2196 /** 2197 * <b>Performance Tracing Hook:</b> 2198 * This hook is invoked when any informational messages generated by the 2199 * SearchCoordinator are created. It is typically used to provide logging 2200 * or capture details related to a specific request. 2201 * <p> 2202 * Note that this is a performance tracing hook. Use with caution in production 2203 * systems, since calling it may (or may not) carry a cost. 2204 * </p> 2205 * Hooks may accept the following parameters: 2206 * <ul> 2207 * <li> 2208 * 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 2209 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2210 * pulled out of the servlet request. Note that the bean 2211 * properties are not all guaranteed to be populated, depending on how early during processing the 2212 * exception occurred. 2213 * </li> 2214 * <li> 2215 * 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 2216 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2217 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 2218 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 2219 * </li> 2220 * <li> 2221 * ca.uhn.fhir.jpa.model.search.StorageProcessingMessage - Contains the message 2222 * </li> 2223 * </ul> 2224 * <p> 2225 * Hooks should return <code>void</code>. 2226 * </p> 2227 */ 2228 JPA_PERFTRACE_INFO(void.class, 2229 "ca.uhn.fhir.rest.api.server.RequestDetails", 2230 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 2231 "ca.uhn.fhir.jpa.model.search.StorageProcessingMessage" 2232 ), 2233 2234 /** 2235 * <b>Performance Tracing Hook:</b> 2236 * This hook is invoked when any warning messages generated by the 2237 * SearchCoordinator are created. It is typically used to provide logging 2238 * or capture details related to a specific request. 2239 * <p> 2240 * Note that this is a performance tracing hook. Use with caution in production 2241 * systems, since calling it may (or may not) carry a cost. 2242 * </p> 2243 * Hooks may accept the following parameters: 2244 * <ul> 2245 * <li> 2246 * 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 2247 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2248 * pulled out of the servlet request. Note that the bean 2249 * properties are not all guaranteed to be populated, depending on how early during processing the 2250 * exception occurred. 2251 * </li> 2252 * <li> 2253 * 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 2254 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2255 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 2256 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 2257 * </li> 2258 * <li> 2259 * ca.uhn.fhir.jpa.model.search.StorageProcessingMessage - Contains the message 2260 * </li> 2261 * </ul> 2262 * <p> 2263 * Hooks should return <code>void</code>. 2264 * </p> 2265 */ 2266 JPA_PERFTRACE_WARNING(void.class, 2267 "ca.uhn.fhir.rest.api.server.RequestDetails", 2268 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 2269 "ca.uhn.fhir.jpa.model.search.StorageProcessingMessage" 2270 ), 2271 2272 /** 2273 * <b>Performance Tracing Hook:</b> 2274 * This hook is invoked when a search has returned the very first result 2275 * from the database. The timing on this call can be a good indicator of how 2276 * performant a query is in general. 2277 * <p> 2278 * Note that this is a performance tracing hook. Use with caution in production 2279 * systems, since calling it may (or may not) carry a cost. 2280 * </p> 2281 * Hooks may accept the following parameters: 2282 * <ul> 2283 * <li> 2284 * 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 2285 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2286 * pulled out of the servlet request. Note that the bean 2287 * properties are not all guaranteed to be populated, depending on how early during processing the 2288 * exception occurred. 2289 * </li> 2290 * <li> 2291 * 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 2292 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2293 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 2294 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 2295 * </li> 2296 * <li> 2297 * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being 2298 * performed. Hooks should not modify this object. 2299 * </li> 2300 * </ul> 2301 * <p> 2302 * Hooks should return <code>void</code>. 2303 * </p> 2304 */ 2305 JPA_PERFTRACE_SEARCH_FIRST_RESULT_LOADED(void.class, 2306 "ca.uhn.fhir.rest.api.server.RequestDetails", 2307 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 2308 "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails" 2309 ), 2310 2311 /** 2312 * <b>Performance Tracing Hook:</b> 2313 * This hook is invoked when an individual search query SQL SELECT statement 2314 * has completed and no more results are available from that query. Note that this 2315 * doesn't necessarily mean that no more matching results exist in the database, 2316 * since HAPI FHIR JPA batch loads results in to the query cache in chunks in order 2317 * to provide predicable results without overloading memory or the database. 2318 * <p> 2319 * Note that this is a performance tracing hook. Use with caution in production 2320 * systems, since calling it may (or may not) carry a cost. 2321 * </p> 2322 * Hooks may accept the following parameters: 2323 * <ul> 2324 * <li> 2325 * 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 2326 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2327 * pulled out of the servlet request. Note that the bean 2328 * properties are not all guaranteed to be populated, depending on how early during processing the 2329 * exception occurred. 2330 * </li> 2331 * <li> 2332 * 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 2333 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2334 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 2335 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 2336 * </li> 2337 * <li> 2338 * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being 2339 * performed. Hooks should not modify this object. 2340 * </li> 2341 * </ul> 2342 * <p> 2343 * Hooks should return <code>void</code>. 2344 * </p> 2345 */ 2346 JPA_PERFTRACE_SEARCH_SELECT_COMPLETE(void.class, 2347 "ca.uhn.fhir.rest.api.server.RequestDetails", 2348 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 2349 "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails" 2350 ), 2351 2352 2353 /** 2354 * <b>Performance Tracing Hook:</b> 2355 * This hook is invoked when a search has failed for any reason. When this pointcut 2356 * is invoked, the search has completed unsuccessfully and will not be continued. 2357 * <p> 2358 * Note that this is a performance tracing hook. Use with caution in production 2359 * systems, since calling it may (or may not) carry a cost. 2360 * </p> 2361 * Hooks may accept the following parameters: 2362 * <ul> 2363 * <li> 2364 * 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 2365 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2366 * pulled out of the servlet request. Note that the bean 2367 * properties are not all guaranteed to be populated, depending on how early during processing the 2368 * exception occurred. 2369 * </li> 2370 * <li> 2371 * 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 2372 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2373 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 2374 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 2375 * </li> 2376 * <li> 2377 * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being 2378 * performed. Hooks should not modify this object. 2379 * </li> 2380 * </ul> 2381 * <p> 2382 * Hooks should return <code>void</code>. 2383 * </p> 2384 */ 2385 JPA_PERFTRACE_SEARCH_FAILED(void.class, 2386 "ca.uhn.fhir.rest.api.server.RequestDetails", 2387 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 2388 "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails" 2389 ), 2390 2391 /** 2392 * <b>Performance Tracing Hook:</b> 2393 * This hook is invoked when a search has completed. When this pointcut 2394 * is invoked, a pass in the Search Coordinator has completed successfully, but 2395 * not all possible resources have been loaded yet so a future paging request 2396 * may trigger a new task that will load further resources. 2397 * <p> 2398 * Note that this is a performance tracing hook. Use with caution in production 2399 * systems, since calling it may (or may not) carry a cost. 2400 * </p> 2401 * Hooks may accept the following parameters: 2402 * <ul> 2403 * <li> 2404 * 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 2405 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2406 * pulled out of the servlet request. Note that the bean 2407 * properties are not all guaranteed to be populated, depending on how early during processing the 2408 * exception occurred. 2409 * </li> 2410 * <li> 2411 * 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 2412 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2413 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 2414 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 2415 * </li> 2416 * <li> 2417 * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being 2418 * performed. Hooks should not modify this object. 2419 * </li> 2420 * </ul> 2421 * <p> 2422 * Hooks should return <code>void</code>. 2423 * </p> 2424 */ 2425 JPA_PERFTRACE_SEARCH_PASS_COMPLETE(void.class, 2426 "ca.uhn.fhir.rest.api.server.RequestDetails", 2427 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 2428 "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails" 2429 ), 2430 2431 /** 2432 * <b>Performance Tracing Hook:</b> 2433 * This hook is invoked when a query involving an external index (e.g. Elasticsearch) has completed. When this pointcut 2434 * is invoked, an initial list of resource IDs has been generated which will be used as part of a subsequent database query. 2435 * <p> 2436 * Note that this is a performance tracing hook. Use with caution in production 2437 * systems, since calling it may (or may not) carry a cost. 2438 * </p> 2439 * Hooks may accept the following parameters: 2440 * <ul> 2441 * <li> 2442 * 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 2443 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2444 * pulled out of the servlet request. Note that the bean 2445 * properties are not all guaranteed to be populated, depending on how early during processing the 2446 * exception occurred. 2447 * </li> 2448 * <li> 2449 * 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 2450 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2451 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 2452 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 2453 * </li> 2454 * <li> 2455 * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being 2456 * performed. Hooks should not modify this object. 2457 * </li> 2458 * </ul> 2459 * <p> 2460 * Hooks should return <code>void</code>. 2461 * </p> 2462 */ 2463 JPA_PERFTRACE_INDEXSEARCH_QUERY_COMPLETE(void.class, 2464 "ca.uhn.fhir.rest.api.server.RequestDetails", 2465 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 2466 "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails" 2467 ), 2468 2469 /** 2470 * <b>Performance Tracing Hook:</b> 2471 * Invoked when the storage engine is about to reuse the results of 2472 * a previously cached search. 2473 * <p> 2474 * Note that this is a performance tracing hook. Use with caution in production 2475 * systems, since calling it may (or may not) carry a cost. 2476 * </p> 2477 * <p> 2478 * Hooks may accept the following parameters: 2479 * </p> 2480 * <ul> 2481 * <li> 2482 * ca.uhn.fhir.jpa.searchparam.SearchParameterMap - Contains the details of the search being checked 2483 * </li> 2484 * <li> 2485 * 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 2486 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2487 * pulled out of the servlet request. Note that the bean 2488 * properties are not all guaranteed to be populated, depending on how early during processing the 2489 * exception occurred. <b>Note that this parameter may be null in contexts where the request is not 2490 * known, such as while processing searches</b> 2491 * </li> 2492 * <li> 2493 * 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 2494 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2495 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 2496 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 2497 * </li> 2498 * </ul> 2499 * <p> 2500 * Hooks should return <code>void</code>. 2501 * </p> 2502 */ 2503 JPA_PERFTRACE_SEARCH_REUSING_CACHED(boolean.class, 2504 "ca.uhn.fhir.jpa.searchparam.SearchParameterMap", 2505 "ca.uhn.fhir.rest.api.server.RequestDetails", 2506 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails" 2507 ), 2508 2509 /** 2510 * <b>Performance Tracing Hook:</b> 2511 * This hook is invoked when a search has failed for any reason. When this pointcut 2512 * is invoked, a pass in the Search Coordinator has completed successfully, and all 2513 * possible results have been fetched and loaded into the query cache. 2514 * <p> 2515 * Note that this is a performance tracing hook. Use with caution in production 2516 * systems, since calling it may (or may not) carry a cost. 2517 * </p> 2518 * Hooks may accept the following parameters: 2519 * <ul> 2520 * <li> 2521 * 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 2522 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2523 * pulled out of the servlet request. Note that the bean 2524 * properties are not all guaranteed to be populated, depending on how early during processing the 2525 * exception occurred. 2526 * </li> 2527 * <li> 2528 * 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 2529 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2530 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 2531 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 2532 * </li> 2533 * <li> 2534 * ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails - Contains details about the search being 2535 * performed. Hooks should not modify this object. 2536 * </li> 2537 * </ul> 2538 * <p> 2539 * Hooks should return <code>void</code>. 2540 * </p> 2541 */ 2542 JPA_PERFTRACE_SEARCH_COMPLETE(void.class, 2543 "ca.uhn.fhir.rest.api.server.RequestDetails", 2544 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 2545 "ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails" 2546 ), 2547 2548 2549 /** 2550 * <b>Performance Tracing Hook:</b> 2551 * <p> 2552 * This hook is invoked when a search has found an individual ID. 2553 * </p> 2554 * <p> 2555 * THIS IS AN EXPERIMENTAL HOOK AND MAY BE REMOVED OR CHANGED WITHOUT WARNING. 2556 * </p> 2557 * <p> 2558 * Note that this is a performance tracing hook. Use with caution in production 2559 * systems, since calling it may (or may not) carry a cost. 2560 * </p> 2561 * <p> 2562 * Hooks may accept the following parameters: 2563 * </p> 2564 * <ul> 2565 * <li> 2566 * java.lang.Integer - The query ID 2567 * </li> 2568 * <li> 2569 * java.lang.Object - The ID 2570 * </li> 2571 * </ul> 2572 * <p> 2573 * Hooks should return <code>void</code>. 2574 * </p> 2575 */ 2576 JPA_PERFTRACE_SEARCH_FOUND_ID(void.class, 2577 "java.lang.Integer", 2578 "java.lang.Object" 2579 ), 2580 2581 2582 /** 2583 * <b>Performance Tracing Hook:</b> 2584 * This hook is invoked when a query has executed, and includes the raw SQL 2585 * statements that were executed against the database. 2586 * <p> 2587 * Note that this is a performance tracing hook. Use with caution in production 2588 * systems, since calling it may (or may not) carry a cost. 2589 * </p> 2590 * <p> 2591 * Hooks may accept the following parameters: 2592 * </p> 2593 * <ul> 2594 * <li> 2595 * 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 2596 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2597 * pulled out of the servlet request. Note that the bean 2598 * properties are not all guaranteed to be populated, depending on how early during processing the 2599 * exception occurred. 2600 * </li> 2601 * <li> 2602 * 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 2603 * resource type and logical ID (if any) and other FHIR-specific aspects of the request which have been 2604 * pulled out of the servlet request. This parameter is identical to the RequestDetails parameter above but will 2605 * only be populated when operating in a RestfulServer implementation. It is provided as a convenience. 2606 * </li> 2607 * <li> 2608 * ca.uhn.fhir.jpa.util.SqlQueryList - Contains details about the raw SQL queries. 2609 * </li> 2610 * </ul> 2611 * <p> 2612 * Hooks should return <code>void</code>. 2613 * </p> 2614 */ 2615 JPA_PERFTRACE_RAW_SQL(void.class, 2616 "ca.uhn.fhir.rest.api.server.RequestDetails", 2617 "ca.uhn.fhir.rest.server.servlet.ServletRequestDetails", 2618 "ca.uhn.fhir.jpa.util.SqlQueryList" 2619 ), 2620 2621 /** 2622 * This pointcut is used only for unit tests. Do not use in production code as it may be changed or 2623 * removed at any time. 2624 */ 2625 TEST_RB( 2626 boolean.class, 2627 new ExceptionHandlingSpec().addLogAndSwallow(IllegalStateException.class), 2628 String.class.getName(), 2629 String.class.getName()), 2630 2631 /** 2632 * This pointcut is used only for unit tests. Do not use in production code as it may be changed or 2633 * removed at any time. 2634 */ 2635 TEST_RO(BaseServerResponseException.class, String.class.getName(), String.class.getName()); 2636 2637 private final List<String> myParameterTypes; 2638 private final Class<?> myReturnType; 2639 private final ExceptionHandlingSpec myExceptionHandlingSpec; 2640 2641 Pointcut(@Nonnull String theReturnType, String... theParameterTypes) { 2642 this(toReturnTypeClass(theReturnType), new ExceptionHandlingSpec(), theParameterTypes); 2643 } 2644 2645 Pointcut(@Nonnull Class<?> theReturnType, @Nonnull ExceptionHandlingSpec theExceptionHandlingSpec, String... theParameterTypes) { 2646 myReturnType = theReturnType; 2647 myExceptionHandlingSpec = theExceptionHandlingSpec; 2648 myParameterTypes = Collections.unmodifiableList(Arrays.asList(theParameterTypes)); 2649 } 2650 2651 Pointcut(@Nonnull Class<?> theReturnType, String... theParameterTypes) { 2652 this(theReturnType, new ExceptionHandlingSpec(), theParameterTypes); 2653 } 2654 2655 @Override 2656 public boolean isShouldLogAndSwallowException(@Nonnull Throwable theException) { 2657 for (Class<? extends Throwable> next : myExceptionHandlingSpec.myTypesToLogAndSwallow) { 2658 if (next.isAssignableFrom(theException.getClass())) { 2659 return true; 2660 } 2661 } 2662 return false; 2663 } 2664 2665 @Override 2666 @Nonnull 2667 public Class<?> getReturnType() { 2668 return myReturnType; 2669 } 2670 2671 @Override 2672 @Nonnull 2673 public List<String> getParameterTypes() { 2674 return myParameterTypes; 2675 } 2676 2677 private static class UnknownType { 2678 } 2679 2680 private static class ExceptionHandlingSpec { 2681 2682 private final Set<Class<? extends Throwable>> myTypesToLogAndSwallow = new HashSet<>(); 2683 2684 ExceptionHandlingSpec addLogAndSwallow(@Nonnull Class<? extends Throwable> theType) { 2685 myTypesToLogAndSwallow.add(theType); 2686 return this; 2687 } 2688 2689 } 2690 2691 private static Class<?> toReturnTypeClass(String theReturnType) { 2692 try { 2693 return Class.forName(theReturnType); 2694 } catch (ClassNotFoundException theE) { 2695 return UnknownType.class; 2696 } 2697 } 2698 2699}