Update transaction service visibility
This commit is contained in:
parent
62be623cf5
commit
899caa1913
|
@ -30,6 +30,7 @@ import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
|||
import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException;
|
||||
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -44,10 +45,10 @@ public class HapiTransactionService {
|
|||
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(HapiTransactionService.class);
|
||||
@Autowired
|
||||
private IInterceptorBroadcaster myInterceptorBroadcaster;
|
||||
protected IInterceptorBroadcaster myInterceptorBroadcaster;
|
||||
@Autowired
|
||||
private PlatformTransactionManager myTransactionManager;
|
||||
private TransactionTemplate myTxTemplate;
|
||||
protected PlatformTransactionManager myTransactionManager;
|
||||
protected TransactionTemplate myTxTemplate;
|
||||
|
||||
@VisibleForTesting
|
||||
public void setInterceptorBroadcaster(IInterceptorBroadcaster theInterceptorBroadcaster) {
|
||||
|
@ -73,15 +74,7 @@ public class HapiTransactionService {
|
|||
for (int i = 0; ; i++) {
|
||||
try {
|
||||
|
||||
try {
|
||||
return myTxTemplate.execute(theCallback);
|
||||
} catch (MyException e) {
|
||||
if (e.getCause() instanceof RuntimeException) {
|
||||
throw (RuntimeException) e.getCause();
|
||||
} else {
|
||||
throw new InternalErrorException(e);
|
||||
}
|
||||
}
|
||||
return doExecuteCallback(theCallback);
|
||||
|
||||
} catch (ResourceVersionConflictException | DataIntegrityViolationException e) {
|
||||
ourLog.debug("Version conflict detected", e);
|
||||
|
@ -129,6 +122,19 @@ public class HapiTransactionService {
|
|||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected <T> T doExecuteCallback(TransactionCallback<T> theCallback) {
|
||||
try {
|
||||
return myTxTemplate.execute(theCallback);
|
||||
} catch (MyException e) {
|
||||
if (e.getCause() instanceof RuntimeException) {
|
||||
throw (RuntimeException) e.getCause();
|
||||
} else {
|
||||
throw new InternalErrorException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is just an unchecked exception so that we can catch checked exceptions inside TransactionTemplate
|
||||
* and rethrow them outside of it
|
||||
|
|
|
@ -1,5 +1,25 @@
|
|||
package ca.uhn.fhir.jpa.term.icd10cm;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* HAPI FHIR JPA Server
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2021 Smile CDR, Inc.
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion;
|
||||
import ca.uhn.fhir.jpa.entity.TermConcept;
|
||||
import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink;
|
||||
|
|
Loading…
Reference in New Issue