Package ca.uhn.fhir.jpa.dao.tx
Class HapiTransactionService
java.lang.Object
ca.uhn.fhir.jpa.dao.tx.HapiTransactionService
- All Implemented Interfaces:
IHapiTransactionService
- Direct Known Subclasses:
NonTransactionalHapiTransactionService
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService
IHapiTransactionService.IExecutionBuilder
-
Field Summary
Modifier and TypeFieldDescriptionstatic final org.springframework.transaction.annotation.Propagation
Default value forsetTransactionPropagationWhenChangingPartitions(Propagation)
protected ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster
protected PartitionSettings
protected IRequestPartitionHelperSvc
protected org.springframework.transaction.PlatformTransactionManager
static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuildExecutionBuilder
(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) protected <T> T
doExecute
(HapiTransactionService.ExecutionBuilder theExecutionBuilder, org.springframework.transaction.support.TransactionCallback<T> theCallback) protected <T> T
doExecuteCallback
(HapiTransactionService.ExecutionBuilder theExecutionBuilder, org.springframework.transaction.support.TransactionCallback<T> theCallback) void
execute
(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails, org.springframework.transaction.annotation.Propagation thePropagation, org.springframework.transaction.annotation.Isolation theIsolation, Runnable theCallback) Deprecated.<T> T
execute
(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails, org.springframework.transaction.support.TransactionCallback<T> theCallback) Deprecated.UsewithRequest(RequestDetails)
with fluent call instead<T> T
execute
(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails, org.springframework.transaction.support.TransactionCallback<T> theCallback, Runnable theOnRollback) Deprecated.UsewithRequest(RequestDetails)
with fluent call instead<T> T
execute
(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails, org.springframework.transaction.support.TransactionCallback<T> theCallback, Runnable theOnRollback, org.springframework.transaction.annotation.Propagation thePropagation, org.springframework.transaction.annotation.Isolation theIsolation) Deprecated.<T> T
execute
(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails, org.springframework.transaction.support.TransactionCallback<T> theCallback, Runnable theOnRollback, org.springframework.transaction.annotation.Propagation thePropagation, org.springframework.transaction.annotation.Isolation theIsolation, RequestPartitionId theRequestPartitionId) Deprecated.UsewithRequest(RequestDetails)
with fluent call insteadstatic <T> T
executeWithDefaultPartitionInContext
(ca.uhn.fhir.util.ICallable<T> theCallback) static RequestPartitionId
org.springframework.transaction.PlatformTransactionManager
static <T> T
invokeCallableAndHandleAnyException
(Callable<T> theTask) InvokesCallable.call()
and rethrows any exceptions thrown by that method.boolean
isCompatiblePartition
(RequestPartitionId theRequestPartitionId, RequestPartitionId theOtherRequestPartitionId) Are two RequestPartitionId values compatible within the same transaction?boolean
protected boolean
static void
Throws anIllegalArgumentException
if a transaction is activestatic void
Throws anIllegalArgumentException
if no transaction is activevoid
setInterceptorBroadcaster
(ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster) void
setPartitionSettingsForUnitTest
(PartitionSettings thePartitionSettings) void
setRequestPartitionSvcForUnitTest
(IRequestPartitionHelperSvc theRequestPartitionHelperSvc) void
setSleepUtil
(ca.uhn.fhir.util.SleepUtil theSleepUtil) void
setTransactionManager
(org.springframework.transaction.PlatformTransactionManager theTransactionManager) void
setTransactionPropagationWhenChangingPartitions
(org.springframework.transaction.annotation.Propagation theTransactionPropagationWhenChangingPartitions) withRequest
(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) Fluent builder for creating a transactional callback<T> T
withRequest
(ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails, org.springframework.transaction.annotation.Propagation thePropagation, org.springframework.transaction.annotation.Isolation theIsolation, ca.uhn.fhir.util.ICallable<T> theCallback) Deprecated.UsewithRequest(RequestDetails)
with fluent call insteadFluent builder for internal system requests with no external requestdetails associatedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService
withSystemRequestOnDefaultPartition, withSystemRequestOnPartition
-
Field Details
-
XACT_USERDATA_KEY_RESOLVED_TAG_DEFINITIONS
-
XACT_USERDATA_KEY_EXISTING_SEARCH_PARAMS
-
DEFAULT_TRANSACTION_PROPAGATION_WHEN_CHANGING_PARTITIONS
public static final org.springframework.transaction.annotation.Propagation DEFAULT_TRANSACTION_PROPAGATION_WHEN_CHANGING_PARTITIONSDefault value forsetTransactionPropagationWhenChangingPartitions(Propagation)
- Since:
- 7.6.0
-
myInterceptorBroadcaster
-
myTransactionManager
@Autowired protected org.springframework.transaction.PlatformTransactionManager myTransactionManager -
myRequestPartitionHelperSvc
-
myPartitionSettings
-
-
Constructor Details
-
HapiTransactionService
public HapiTransactionService()
-
-
Method Details
-
setInterceptorBroadcaster
public void setInterceptorBroadcaster(ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster theInterceptorBroadcaster) -
setSleepUtil
-
withRequest
public IHapiTransactionService.IExecutionBuilder withRequest(@Nullable ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) Description copied from interface:IHapiTransactionService
Fluent builder for creating a transactional callbackMethod chain must end with a call to
IHapiTransactionService.IExecutionBuilder.execute(Runnable)
or one of the other overloads oftask(...)
- Specified by:
withRequest
in interfaceIHapiTransactionService
-
withSystemRequest
Description copied from interface:IHapiTransactionService
Fluent builder for internal system requests with no external requestdetails associated- Specified by:
withSystemRequest
in interfaceIHapiTransactionService
-
buildExecutionBuilder
protected IHapiTransactionService.IExecutionBuilder buildExecutionBuilder(@Nullable ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails) -
execute
@Deprecated public <T> T execute(@Nullable ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, @Nullable ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails, @Nonnull org.springframework.transaction.support.TransactionCallback<T> theCallback) Deprecated.UsewithRequest(RequestDetails)
with fluent call instead -
execute
@Deprecated public void execute(@Nullable ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, @Nullable ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails, @Nonnull org.springframework.transaction.annotation.Propagation thePropagation, @Nonnull org.springframework.transaction.annotation.Isolation theIsolation, @Nonnull Runnable theCallback) Deprecated.UsewithRequest(RequestDetails)
with fluent call instead -
withRequest
@Deprecated public <T> T withRequest(@Nullable ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, @Nullable ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails, @Nonnull org.springframework.transaction.annotation.Propagation thePropagation, @Nonnull org.springframework.transaction.annotation.Isolation theIsolation, @Nonnull ca.uhn.fhir.util.ICallable<T> theCallback) Deprecated.UsewithRequest(RequestDetails)
with fluent call instead- Specified by:
withRequest
in interfaceIHapiTransactionService
-
execute
@Deprecated public <T> T execute(@Nullable ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, @Nullable ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails, @Nonnull org.springframework.transaction.support.TransactionCallback<T> theCallback, @Nullable Runnable theOnRollback) Deprecated.UsewithRequest(RequestDetails)
with fluent call instead -
execute
@Deprecated public <T> T execute(@Nullable ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, @Nullable ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails, @Nonnull org.springframework.transaction.support.TransactionCallback<T> theCallback, @Nullable Runnable theOnRollback, @Nullable org.springframework.transaction.annotation.Propagation thePropagation, @Nullable org.springframework.transaction.annotation.Isolation theIsolation) Deprecated. -
execute
@Deprecated public <T> T execute(@Nullable ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, @Nullable ca.uhn.fhir.rest.api.server.storage.TransactionDetails theTransactionDetails, @Nonnull org.springframework.transaction.support.TransactionCallback<T> theCallback, @Nullable Runnable theOnRollback, @Nonnull org.springframework.transaction.annotation.Propagation thePropagation, @Nonnull org.springframework.transaction.annotation.Isolation theIsolation, RequestPartitionId theRequestPartitionId) Deprecated.UsewithRequest(RequestDetails)
with fluent call instead -
isCustomIsolationSupported
-
setRequestPartitionSvcForUnitTest
public void setRequestPartitionSvcForUnitTest(IRequestPartitionHelperSvc theRequestPartitionHelperSvc) -
getTransactionManager
-
setTransactionManager
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager theTransactionManager) -
setPartitionSettingsForUnitTest
-
doExecute
@Nullable protected <T> T doExecute(HapiTransactionService.ExecutionBuilder theExecutionBuilder, org.springframework.transaction.support.TransactionCallback<T> theCallback) -
isRequiresNewTransactionWhenChangingPartitions
-
isCompatiblePartition
public boolean isCompatiblePartition(RequestPartitionId theRequestPartitionId, RequestPartitionId theOtherRequestPartitionId) Description copied from interface:IHapiTransactionService
Are two RequestPartitionId values compatible within the same transaction?This is an experimental API, subject to change in a future release.
- Specified by:
isCompatiblePartition
in interfaceIHapiTransactionService
-
setTransactionPropagationWhenChangingPartitions
public void setTransactionPropagationWhenChangingPartitions(org.springframework.transaction.annotation.Propagation theTransactionPropagationWhenChangingPartitions) -
doExecuteCallback
@Nullable protected <T> T doExecuteCallback(HapiTransactionService.ExecutionBuilder theExecutionBuilder, org.springframework.transaction.support.TransactionCallback<T> theCallback) -
invokeCallableAndHandleAnyException
InvokesCallable.call()
and rethrows any exceptions thrown by that method. If the exception extendsBaseServerResponseException
it is rethrown unmodified. Otherwise, it's wrapped in aInternalErrorException
. -
executeWithDefaultPartitionInContext
public static <T> T executeWithDefaultPartitionInContext(@Nonnull ca.uhn.fhir.util.ICallable<T> theCallback) -
getRequestPartitionAssociatedWithThread
-
noTransactionAllowed
Throws anIllegalArgumentException
if a transaction is active -
requireTransaction
Throws anIllegalArgumentException
if no transaction is active
-
withRequest(RequestDetails)
with fluent call instead