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