Reduce postconstruct use (#4445)

This commit is contained in:
Ken Stevens 2023-01-21 00:37:58 -05:00 committed by GitHub
parent bf53a08b83
commit 5dda16d467
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
113 changed files with 314 additions and 269 deletions

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -0,0 +1,33 @@
package ca.uhn.fhir;
/*-
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2023 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%
*/
/**
* Spring bean initialization constants.
*/
public interface IHapiBootOrder {
int ADD_JOB_DEFINITIONS = 100;
int REGISTER_INTERCEPTORS = 200;
int SUBSCRIPTION_MATCHING_CHANNEL_HANDLER = 300;
int AFTER_SUBSCRIPTION_INITIALIZED = 310;
}

View File

@ -456,8 +456,7 @@ public abstract class BaseInterceptorService<POINTCUT extends IPointcut> impleme
theInvokers.put((POINTCUT) nextPointcut, nextAddedHook);
}
// Make sure we're always sorted according to the order declared in
// @Order
// Make sure we're always sorted according to the order declared in @Order
for (IPointcut nextPointcut : theInvokers.keys()) {
List<BaseInvoker> nextInvokerList = theInvokers.get((POINTCUT) nextPointcut);
nextInvokerList.sort(Comparator.naturalOrder());

View File

@ -4,14 +4,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-bom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<packaging>pom</packaging>
<name>HAPI FHIR BOM</name>
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -11,7 +11,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -87,6 +87,11 @@
<artifactId>jboss-jaxrs-api_2.1_spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring_version}</version>
</dependency>
<!-- Unit test dependencies -->
<dependency>
<groupId>com.fasterxml.woodstox</groupId>

View File

@ -46,8 +46,9 @@ import org.hl7.fhir.dstu2.hapi.rest.server.ServerConformanceProvider;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.CapabilityStatement;
import org.slf4j.LoggerFactory;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import javax.annotation.PostConstruct;
import javax.ws.rs.GET;
import javax.ws.rs.OPTIONS;
import javax.ws.rs.Path;
@ -132,11 +133,11 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
}
/**
* This method will set the conformance during the postconstruct phase. The method {@link AbstractJaxRsConformanceProvider#getProviders()} is used to get all the resource providers include in the
* This method will set the conformance during the Context Refreshed phase. The method {@link AbstractJaxRsConformanceProvider#getProviders()} is used to get all the resource providers include in the
* conformance
*/
@PostConstruct
protected synchronized void setUpPostConstruct() {
@EventListener(ContextRefreshedEvent.class)
protected synchronized void buildCapabilityStatement() {
if (myInitialized) {
return;
}
@ -211,7 +212,7 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
@GET
@Path("/metadata")
public Response conformance() throws IOException {
setUpPostConstruct();
buildCapabilityStatement();
Builder request = getRequest(RequestTypeEnum.OPTIONS, RestOperationTypeEnum.METADATA);
JaxRsRequest requestDetails = request.build();

View File

@ -16,7 +16,8 @@ import java.net.URI;
import java.util.Arrays;
import java.util.concurrent.ConcurrentHashMap;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ -99,7 +100,7 @@ public class AbstractJaxRsConformanceProviderDstu2Hl7OrgTest {
when(uriInfo.getRequestUri()).thenReturn(new URI(BASEURI + "/foo"));
result.setUriInfo(uriInfo);
result.setHeaders(headers);
result.setUpPostConstruct();
result.buildCapabilityStatement();
return result;
}

View File

@ -5,12 +5,12 @@ import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderDstu2_1;
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProviderDstu2_1;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.server.IResourceProvider;
import javax.ws.rs.core.MultivaluedMap;
import org.jboss.resteasy.specimpl.ResteasyHttpHeaders;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import java.net.URI;
@ -101,7 +101,7 @@ public class AbstractJaxRsConformanceProviderDstu2_1Test {
when(uriInfo.getRequestUri()).thenReturn(new URI(BASEURI + "/foo"));
result.setUriInfo(uriInfo);
result.setHeaders(headers);
result.setUpPostConstruct();
result.buildCapabilityStatement();
return result;
}

View File

@ -1,6 +1,7 @@
package ca.uhn.fhir.jaxrs.server;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderDstu3;
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsMockPatientRestProviderDstu3;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.server.IResourceProvider;
@ -15,12 +16,11 @@ import java.net.URI;
import java.util.Arrays;
import java.util.concurrent.ConcurrentHashMap;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import ca.uhn.fhir.jaxrs.server.test.TestJaxRsDummyPatientProviderDstu3;
public class AbstractJaxRsConformanceProviderDstu3Test {
private static final String BASEURI = "http://basiuri";
@ -100,7 +100,7 @@ public class AbstractJaxRsConformanceProviderDstu3Test {
when(uriInfo.getRequestUri()).thenReturn(new URI(BASEURI + "/foo"));
result.setUriInfo(uriInfo);
result.setHeaders(headers);
result.setUpPostConstruct();
result.buildCapabilityStatement();
return result;
}

View File

@ -16,7 +16,8 @@ import java.net.URI;
import java.util.Arrays;
import java.util.concurrent.ConcurrentHashMap;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ -99,7 +100,7 @@ public class AbstractJaxRsConformanceProviderR4Test {
when(uriInfo.getRequestUri()).thenReturn(new URI(BASEURI + "/foo"));
result.setUriInfo(uriInfo);
result.setHeaders(headers);
result.setUpPostConstruct();
result.buildCapabilityStatement();
return result;
}

View File

@ -15,7 +15,8 @@ import java.net.URI;
import java.util.Arrays;
import java.util.concurrent.ConcurrentHashMap;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ -98,7 +99,7 @@ public class AbstractJaxRsConformanceProviderTest {
when(uriInfo.getRequestUri()).thenReturn(new URI(BASEURI + "/foo"));
result.setUriInfo(uriInfo);
result.setHeaders(headers);
result.setUpPostConstruct();
result.buildCapabilityStatement();
return result;
}

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -296,8 +296,8 @@ public class JpaConfig {
}
@Bean
public MemoryCacheService memoryCacheService() {
return new MemoryCacheService();
public MemoryCacheService memoryCacheService(DaoConfig theDaoConfig) {
return new MemoryCacheService(theDaoConfig);
}
@Bean

View File

@ -24,6 +24,7 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.support.DefaultProfileValidationSupport;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.dao.JpaPersistedResourceValidationSupport;
import ca.uhn.fhir.jpa.validation.JpaValidationSupportChain;
import ca.uhn.fhir.jpa.validation.ValidatorPolicyAdvisor;
@ -56,10 +57,10 @@ public class ValidationSupportConfig {
}
@Bean(name = "myInstanceValidator")
public IInstanceValidatorModule instanceValidator(FhirContext theFhirContext, CachingValidationSupport theCachingValidationSupport, ValidationSupportChain theValidationSupportChain) {
public IInstanceValidatorModule instanceValidator(FhirContext theFhirContext, CachingValidationSupport theCachingValidationSupport, ValidationSupportChain theValidationSupportChain, IValidationSupport theValidationSupport, DaoRegistry theDaoRegistry) {
if (theFhirContext.getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) {
FhirInstanceValidator val = new FhirInstanceValidator(theCachingValidationSupport);
val.setValidatorResourceFetcher(jpaValidatorResourceFetcher());
val.setValidatorResourceFetcher(jpaValidatorResourceFetcher(theFhirContext, theValidationSupport, theDaoRegistry));
val.setValidatorPolicyAdvisor(jpaValidatorPolicyAdvisor());
val.setBestPracticeWarningLevel(BestPracticeWarningLevel.Warning);
val.setValidationSupport(theCachingValidationSupport);
@ -74,8 +75,8 @@ public class ValidationSupportConfig {
@Bean
@Lazy
public ValidatorResourceFetcher jpaValidatorResourceFetcher() {
return new ValidatorResourceFetcher();
public ValidatorResourceFetcher jpaValidatorResourceFetcher(FhirContext theFhirContext, IValidationSupport theValidationSupport, DaoRegistry theDaoRegistry) {
return new ValidatorResourceFetcher(theFhirContext, theValidationSupport, theDaoRegistry);
}
@Bean

View File

@ -30,7 +30,6 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Nullable;
import javax.annotation.PostConstruct;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContextType;
@ -95,11 +94,6 @@ public abstract class BaseHapiFhirSystemDao<T extends IBaseBundle, MT> extends B
myTransactionProcessor = theTransactionProcessor;
}
@PostConstruct
public void start() {
myTransactionProcessor.setDao(this);
}
@Override
@Transactional(propagation = Propagation.NEVER)
public ExpungeOutcome expunge(ExpungeOptions theExpungeOptions, RequestDetails theRequestDetails) {

View File

@ -28,19 +28,12 @@ import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.Meta;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import javax.annotation.PostConstruct;
import javax.persistence.TypedQuery;
import java.util.Collection;
import java.util.List;
public class FhirSystemDaoDstu3 extends BaseHapiFhirSystemDao<Bundle, Meta> {
@Override
@PostConstruct
public void start() {
super.start();
}
@Override
public Meta metaGetOperation(RequestDetails theRequestDetails) {
String sql = "SELECT d FROM TagDefinition d WHERE d.myId IN (SELECT DISTINCT t.myTagId FROM ResourceTag t)";

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -8,10 +8,8 @@ import ca.uhn.fhir.mdm.api.IMdmSettings;
import ca.uhn.fhir.mdm.log.Logs;
import com.google.common.annotations.VisibleForTesting;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
/*-
@ -38,17 +36,22 @@ import javax.annotation.PreDestroy;
public class MdmQueueConsumerLoader {
private static final Logger ourLog = Logs.getMdmTroubleshootingLog();
@Autowired
private MdmMessageHandler myMdmMessageHandler;
@Autowired
private IChannelFactory myChannelFactory;
@Autowired
private IMdmSettings myMdmSettings;
private final IChannelFactory myChannelFactory;
private final IMdmSettings myMdmSettings;
private final MdmMessageHandler myMdmMessageHandler;
protected IChannelReceiver myMdmChannel;
@PostConstruct
public void startListeningToMdmChannel() {
public MdmQueueConsumerLoader(IChannelFactory theChannelFactory, IMdmSettings theMdmSettings, MdmMessageHandler theMdmMessageHandler) {
myChannelFactory = theChannelFactory;
myMdmSettings = theMdmSettings;
myMdmMessageHandler = theMdmMessageHandler;
startListeningToMdmChannel();
}
private void startListeningToMdmChannel() {
if (myMdmChannel == null) {
ChannelConsumerSettings config = new ChannelConsumerSettings();

View File

@ -27,7 +27,6 @@ import ca.uhn.fhir.jpa.mdm.broker.MdmMessageHandler;
import ca.uhn.fhir.jpa.mdm.broker.MdmMessageKeySvc;
import ca.uhn.fhir.jpa.mdm.broker.MdmQueueConsumerLoader;
import ca.uhn.fhir.jpa.mdm.dao.MdmLinkDaoSvc;
import ca.uhn.fhir.mdm.dao.MdmLinkFactory;
import ca.uhn.fhir.jpa.mdm.svc.GoldenResourceMergerSvcImpl;
import ca.uhn.fhir.jpa.mdm.svc.GoldenResourceSearchSvcImpl;
import ca.uhn.fhir.jpa.mdm.svc.IMdmModelConverterSvc;
@ -52,6 +51,7 @@ import ca.uhn.fhir.jpa.mdm.svc.candidate.MdmCandidateSearchSvc;
import ca.uhn.fhir.jpa.mdm.svc.candidate.MdmGoldenResourceFindingSvc;
import ca.uhn.fhir.jpa.mdm.util.MdmPartitionHelper;
import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc;
import ca.uhn.fhir.jpa.subscription.channel.api.IChannelFactory;
import ca.uhn.fhir.mdm.api.IGoldenResourceMergerSvc;
import ca.uhn.fhir.mdm.api.IMdmControllerSvc;
import ca.uhn.fhir.mdm.api.IMdmLinkCreateSvc;
@ -63,6 +63,7 @@ import ca.uhn.fhir.mdm.api.IMdmSettings;
import ca.uhn.fhir.mdm.api.IMdmSurvivorshipService;
import ca.uhn.fhir.mdm.batch2.MdmBatch2Config;
import ca.uhn.fhir.mdm.dao.IMdmLinkImplFactory;
import ca.uhn.fhir.mdm.dao.MdmLinkFactory;
import ca.uhn.fhir.mdm.interceptor.IMdmStorageInterceptor;
import ca.uhn.fhir.mdm.interceptor.MdmStorageInterceptor;
import ca.uhn.fhir.mdm.log.Logs;
@ -93,8 +94,8 @@ public class MdmConsumerConfig {
IMdmSurvivorshipService mdmSurvivorshipService() { return new MdmSurvivorshipSvcImpl(); }
@Bean
MdmQueueConsumerLoader mdmQueueConsumerLoader() {
return new MdmQueueConsumerLoader();
MdmQueueConsumerLoader mdmQueueConsumerLoader(IChannelFactory theChannelFactory, IMdmSettings theMdmSettings, MdmMessageHandler theMdmMessageHandler) {
return new MdmQueueConsumerLoader(theChannelFactory, theMdmSettings, theMdmMessageHandler);
}
@Bean

View File

@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.mdm.config;
* #L%
*/
import ca.uhn.fhir.IHapiBootOrder;
import ca.uhn.fhir.mdm.api.IMdmSettings;
import ca.uhn.fhir.mdm.provider.MdmProviderLoader;
import org.slf4j.Logger;
@ -44,7 +45,7 @@ public class MdmLoader {
@EventListener(classes = {ContextRefreshedEvent.class})
// This @Order is here to ensure that MatchingQueueSubscriberLoader has initialized before we initialize this.
// Otherwise the MDM subscriptions won't get loaded into the SubscriptionRegistry
@Order
@Order(IHapiBootOrder.AFTER_SUBSCRIPTION_INITIALIZED)
public void updateSubscriptions() {
if (!myMdmSettings.isEnabled()) {
return;

View File

@ -23,11 +23,11 @@ package ca.uhn.fhir.jpa.mdm.svc.candidate;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.mdm.svc.MdmSearchParamSvc;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.mdm.api.IMdmSettings;
import ca.uhn.fhir.mdm.svc.MdmSearchParamSvc;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -86,7 +86,7 @@ public class CandidateSearcher {
}
public static String idOrType(IAnyResource theResource, String theResourceType) {
if (theResource.getIdElement() == null) {
if (theResource.getIdElement() == null || theResource.getIdElement().isEmpty()) {
return theResourceType;
}
return theResource.getIdElement().toUnqualifiedVersionless().toString();

View File

@ -1,8 +1,6 @@
package ca.uhn.fhir.jpa.mdm.provider;
import ca.uhn.fhir.batch2.api.IJobCoordinator;
import ca.uhn.fhir.jpa.mdm.BaseMdmR4Test;
import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc;
import ca.uhn.fhir.jpa.test.Batch2JobHelper;
import ca.uhn.fhir.mdm.api.IMdmControllerSvc;
import ca.uhn.fhir.mdm.api.IMdmSubmitSvc;
@ -42,10 +40,6 @@ public abstract class BaseProviderR4Test extends BaseMdmR4Test {
@Autowired
MessageHelper myMessageHelper;
@Autowired
private IJobCoordinator myJobCoordinator;
@Autowired
private IRequestPartitionHelperSvc myRequestPartitionHelperSvc;
private String defaultScript;
protected void setMdmRuleJson(String theString) throws IOException {
@ -54,13 +48,12 @@ public abstract class BaseProviderR4Test extends BaseMdmR4Test {
String json = IOUtils.toString(resource.getInputStream(), Charsets.UTF_8);
myMdmSettings.setEnabled(true);
myMdmSettings.setScriptText(json);
myMdmResourceMatcherSvc.init();
myMdmResourceMatcherSvc.setMdmSettings(myMdmSettings);
}
@BeforeEach
public void before() throws Exception {
myMdmProvider = new MdmProviderDstu3Plus(myFhirContext, myMdmControllerSvc, myMdmHelper, myMdmSubmitSvc, myMdmSettings);
// FhirContext theFhirContext, IJobCoordinator theJobCoordinator, IRequestPartitionHelperSvc theRequestPartitionHelperSvc
defaultScript = myMdmSettings.getScriptText();
}
@ -69,7 +62,7 @@ public abstract class BaseProviderR4Test extends BaseMdmR4Test {
public void after() throws IOException {
super.after();
myMdmSettings.setScriptText(defaultScript);
myMdmResourceMatcherSvc.init();// This bugger creates new objects from the beans and then ignores them.
myMdmResourceMatcherSvc.setMdmSettings(myMdmSettings);
}
protected void clearMdmLinks() {

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.cache;
* #L%
*/
import ca.uhn.fhir.IHapiBootOrder;
import ca.uhn.fhir.interceptor.api.Hook;
import ca.uhn.fhir.interceptor.api.IInterceptorService;
import ca.uhn.fhir.interceptor.api.Pointcut;
@ -46,7 +47,7 @@ public class ResourceChangeListenerRegistryInterceptor {
@EventListener(classes = {ContextRefreshedEvent.class})
@Order
@Order(IHapiBootOrder.REGISTER_INTERCEPTORS)
public void start() {
myInterceptorBroadcaster.registerInterceptor(this);
}

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -1,5 +1,6 @@
package ca.uhn.fhir.jpa.subscription.match.matcher.subscriber;
import ca.uhn.fhir.IHapiBootOrder;
import ca.uhn.fhir.jpa.subscription.channel.api.IChannelReceiver;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory;
import org.slf4j.Logger;
@ -7,6 +8,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import javax.annotation.PreDestroy;
@ -44,8 +46,9 @@ public class MatchingQueueSubscriberLoader {
@Autowired
private SubscriptionActivatingSubscriber mySubscriptionActivatingSubscriber;
@EventListener(classes = {ContextRefreshedEvent.class})
public void handleContextRefreshEvent() {
@EventListener(ContextRefreshedEvent.class)
@Order(IHapiBootOrder.SUBSCRIPTION_MATCHING_CHANNEL_HANDLER)
public void subscribeToMatchingChannel() {
if (myMatchingChannel == null) {
myMatchingChannel = mySubscriptionChannelFactory.newMatchingReceivingChannel(SUBSCRIPTION_MATCHING_CHANNEL_NAME, null);
}

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -178,11 +178,9 @@ public class GiantTransactionPerfTest {
myHapiTransactionService.setTransactionManager(myTransactionManager);
myHapiTransactionService.setInterceptorBroadcaster(myInterceptorSvc);
myHapiTransactionService.setRequestPartitionSvcForUnitTest(myRequestPartitionHelperSvc);
myHapiTransactionService.start();
myTransactionProcessor = new TransactionProcessor();
myTransactionProcessor.setContext(ourFhirContext);
myTransactionProcessor.setDao(mySystemDao);
myTransactionProcessor.setTxManager(myTransactionManager);
myTransactionProcessor.setEntityManagerForUnitTest(myEntityManager);
myTransactionProcessor.setVersionAdapter(new TransactionProcessorVersionAdapterR4());
@ -194,12 +192,10 @@ public class GiantTransactionPerfTest {
myTransactionProcessor.setIdHelperServiceForUnitTest(myIdHelperService);
myTransactionProcessor.setFhirContextForUnitTest(ourFhirContext);
myTransactionProcessor.setApplicationContextForUnitTest(myAppCtx);
myTransactionProcessor.start();
mySystemDao = new FhirSystemDaoR4();
mySystemDao.setTransactionProcessorForUnitTest(myTransactionProcessor);
mySystemDao.setDaoConfigForUnitTest(myDaoConfig);
mySystemDao.start();
when(myAppCtx.getBean(eq(IInstanceValidatorModule.class))).thenReturn(myInstanceValidatorSvc);
when(myAppCtx.getBean(eq(IFhirSystemDao.class))).thenReturn(mySystemDao);

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -39,8 +39,7 @@ class MemoryCacheServiceTest {
public void setUp() {
DaoConfig daoConfig = new DaoConfig();
daoConfig.setMassIngestionMode(false);
mySvc = new MemoryCacheService();
mySvc.myDaoConfig = daoConfig;
mySvc = new MemoryCacheService(daoConfig);
}
@Test
@ -50,7 +49,6 @@ class MemoryCacheServiceTest {
String code = "t";
MemoryCacheService.TagDefinitionCacheKey cacheKey = new MemoryCacheService.TagDefinitionCacheKey(type, system, code);
mySvc.start();
TagDefinition retVal = mySvc.getIfPresent(MemoryCacheService.CacheEnum.TAG_DEFINITION, cacheKey);
assertThat(retVal, nullValue());

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -33,10 +33,8 @@ import ca.uhn.fhir.mdm.rules.json.MdmFieldMatchJson;
import ca.uhn.fhir.mdm.rules.json.MdmRulesJson;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;
@ -51,19 +49,22 @@ public class MdmResourceMatcherSvc {
private static final Logger ourLog = Logs.getMdmTroubleshootingLog();
private final FhirContext myFhirContext;
private final IMdmSettings myMdmSettings;
private MdmRulesJson myMdmRulesJson;
private final List<MdmResourceFieldMatcher> myFieldMatchers = new ArrayList<>();
@Autowired
public MdmResourceMatcherSvc(FhirContext theFhirContext, IMdmSettings theMdmRules) {
public MdmResourceMatcherSvc(FhirContext theFhirContext, IMdmSettings theMdmSettings) {
myFhirContext = theFhirContext;
myMdmSettings = theMdmRules;
setMdmSettings(theMdmSettings);
}
@PostConstruct
public void init() {
myMdmRulesJson = myMdmSettings.getMdmRules();
public void setMdmSettings(IMdmSettings theMdmSettings) {
myMdmRulesJson = theMdmSettings.getMdmRules();
addFieldMatchers();
}
private void addFieldMatchers() {
if (myMdmRulesJson == null) {
throw new ConfigurationException(Msg.code(1521) + "Failed to load MDM Rules. If MDM is enabled, then MDM rules must be available in context.");
}
@ -71,7 +72,6 @@ public class MdmResourceMatcherSvc {
for (MdmFieldMatchJson matchFieldJson : myMdmRulesJson.getMatchFields()) {
myFieldMatchers.add(new MdmResourceFieldMatcher( myFhirContext, matchFieldJson, myMdmRulesJson));
}
}
/**

View File

@ -35,9 +35,7 @@ public abstract class BaseR4Test {
}
protected MdmResourceMatcherSvc buildMatcher(MdmRulesJson theMdmRulesJson) {
MdmResourceMatcherSvc retval = new MdmResourceMatcherSvc(ourFhirContext, new MdmSettings(new MdmRuleValidator(ourFhirContext, mySearchParamRetriever)).setMdmRules(theMdmRulesJson));
retval.init();
return retval;
return new MdmResourceMatcherSvc(ourFhirContext, new MdmSettings(new MdmRuleValidator(ourFhirContext, mySearchParamRetriever)).setMdmRules(theMdmRulesJson));
}
protected void assertMatch(MdmMatchResultEnum theExpectedMatchEnum, MdmMatchOutcome theMatchResult) {

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -20,7 +20,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-caching-api</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>hapi-fhir</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>hapi-fhir</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
</parent>
<artifactId>hapi-fhir-spring-boot-sample-client-apache</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
</parent>
<artifactId>hapi-fhir-spring-boot-sample-client-okhttp</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
</parent>
<artifactId>hapi-fhir-spring-boot-sample-server-jersey</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
</parent>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -20,14 +20,17 @@ package ca.uhn.fhir.batch2.config;
* #L%
*/
import ca.uhn.fhir.IHapiBootOrder;
import ca.uhn.fhir.batch2.coordinator.JobDefinitionRegistry;
import ca.uhn.fhir.batch2.model.JobDefinition;
import ca.uhn.fhir.jpa.batch.log.Logs;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import javax.annotation.PostConstruct;
import java.util.Map;
public class Batch2JobRegisterer {
@ -37,7 +40,12 @@ public class Batch2JobRegisterer {
private ApplicationContext myApplicationContext;
@PostConstruct
// The timing of this call is sensitive. It needs to be called after all the job definition beans have been created
// but before any jobs are run. E.g. ValidationDataInitializerSvcImpl can start a REINDEX job, so we use an EventListener
// so we know all the JobDefinition beans have been created, but we use @Order(IHapiBootOrder.ADD_JOB_DEFINITIONS) to ensure it is called
// before any other EventListeners that might start a job.
@EventListener(classes = ContextRefreshedEvent.class)
@Order(IHapiBootOrder.ADD_JOB_DEFINITIONS)
public void start() {
Map<String, JobDefinition> batchJobs = myApplicationContext.getBeansOfType(JobDefinition.class);
JobDefinitionRegistry jobRegistry = myApplicationContext.getBean(JobDefinitionRegistry.class);

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -24,6 +24,7 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.cr.common.CodeCacheResourceChangeListener;
import ca.uhn.fhir.cr.common.CqlExceptionHandlingInterceptor;
import ca.uhn.fhir.cr.common.CqlForkJoinWorkerThreadFactory;
import ca.uhn.fhir.cr.common.ElmCacheResourceChangeListener;
import ca.uhn.fhir.cr.common.HapiFhirDal;
@ -36,12 +37,12 @@ import ca.uhn.fhir.cr.common.ILibraryLoaderFactory;
import ca.uhn.fhir.cr.common.ILibraryManagerFactory;
import ca.uhn.fhir.cr.common.ILibrarySourceProviderFactory;
import ca.uhn.fhir.cr.common.ITerminologyProviderFactory;
import ca.uhn.fhir.cr.common.CqlExceptionHandlingInterceptor;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoValueSet;
import ca.uhn.fhir.jpa.cache.IResourceChangeListenerRegistry;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory;
import org.cqframework.cql.cql2elm.CqlTranslatorOptions;
import org.cqframework.cql.cql2elm.LibraryManager;
import org.cqframework.cql.cql2elm.LibrarySourceProvider;
@ -99,8 +100,8 @@ public abstract class BaseClinicalReasoningConfig {
}
@Bean
CrProviderLoader cqlProviderLoader() {
return new CrProviderLoader();
CrProviderLoader cqlProviderLoader(FhirContext theFhirContext, ResourceProviderFactory theResourceProviderFactory, CrProviderFactory theCqlProviderFactory) {
return new CrProviderLoader(theFhirContext, theResourceProviderFactory, theCqlProviderFactory);
}
@Bean

View File

@ -26,26 +26,27 @@ import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
/**
* This class loads and registers CQL provider factory for clinical reasoning into hapi-fhir central provider factory
**/
@Service
public class CrProviderLoader {
private static final Logger myLogger = LoggerFactory.getLogger(CrProviderLoader.class);
@Autowired
private FhirContext myFhirContext;
@Autowired
private ResourceProviderFactory myResourceProviderFactory;
@Autowired
private CrProviderFactory myCqlProviderFactory;
private final FhirContext myFhirContext;
private final ResourceProviderFactory myResourceProviderFactory;
private final CrProviderFactory myCqlProviderFactory;
@PostConstruct
public void loadProvider() {
public CrProviderLoader(FhirContext theFhirContext, ResourceProviderFactory theResourceProviderFactory, CrProviderFactory theCqlProviderFactory) {
myFhirContext = theFhirContext;
myResourceProviderFactory = theResourceProviderFactory;
myCqlProviderFactory = theCqlProviderFactory;
loadProvider();
}
private void loadProvider() {
switch (myFhirContext.getVersion().getVersion()) {
case DSTU3:
case R4:

View File

@ -19,7 +19,6 @@ class CrProviderLoaderDstu3Test extends BaseCrDstu3Test {
@Test
public void testContextLoads() {
myCrProviderLoader.loadProvider();
myResourceProviderFactory.createProviders();
ourLog.info("The CqlProviderLoader loaded and was able to create Providers.");
}

View File

@ -22,7 +22,6 @@ public class CqlProviderLoaderR4Test extends BaseCrR4Test {
@Test
public void contextLoads() {
myCqlProviderLoader.loadProvider();
myResourceProviderFactory.createProviders();
ourLog.info("The CqlProviderLoader loaded and was able to create Providers.");
}

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -50,7 +50,7 @@ public class MdmSubmitterInterceptorLoader {
private SubscriptionSubmitInterceptorLoader mySubscriptionSubmitInterceptorLoader;
@PostConstruct
public void start() {
public void loadInterceptors() {
if (!myMdmSettings.isEnabled()) {
return;
}

View File

@ -23,14 +23,14 @@ package ca.uhn.fhir.mdm.batch2;
import ca.uhn.fhir.batch2.coordinator.JobDefinitionRegistry;
import ca.uhn.fhir.batch2.model.JobDefinition;
import ca.uhn.fhir.mdm.batch2.clear.MdmClearAppCtx;
import ca.uhn.fhir.mdm.batch2.clear.MdmClearJobParameters;
import ca.uhn.fhir.mdm.batch2.submit.MdmSubmitAppCtx;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import ca.uhn.fhir.mdm.batch2.submit.MdmSubmitJobParameters;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import javax.annotation.PostConstruct;
import static ca.uhn.fhir.mdm.batch2.clear.MdmClearAppCtx.MDM_CLEAR_JOB_BEAN_NAME;
import static ca.uhn.fhir.mdm.batch2.submit.MdmSubmitAppCtx.MDM_SUBMIT_JOB_BEAN_NAME;
@ -40,17 +40,10 @@ import static ca.uhn.fhir.mdm.batch2.submit.MdmSubmitAppCtx.MDM_SUBMIT_JOB_BEAN_
MdmSubmitAppCtx.class
})
public class MdmBatch2Config {
@Autowired
JobDefinitionRegistry myJobDefinitionRegistry;
@Autowired
ApplicationContext myApplicationContext;
@PostConstruct
public void start() {
JobDefinition clearJobDefinition = myApplicationContext.getBean(MDM_CLEAR_JOB_BEAN_NAME, JobDefinition.class);
myJobDefinitionRegistry.addJobDefinitionIfNotRegistered(clearJobDefinition);
JobDefinition submitJobDefinition = myApplicationContext.getBean(MDM_SUBMIT_JOB_BEAN_NAME, JobDefinition.class);
myJobDefinitionRegistry.addJobDefinitionIfNotRegistered(submitJobDefinition);
@Bean
MdmJobDefinitionLoader mdmJobDefinitionLoader(JobDefinitionRegistry theJobDefinitionRegistry,
@Qualifier(MDM_CLEAR_JOB_BEAN_NAME) JobDefinition<MdmClearJobParameters> theClearJobDefinition,
@Qualifier(MDM_SUBMIT_JOB_BEAN_NAME) JobDefinition<MdmSubmitJobParameters> theSubmitJobDefinition) {
return new MdmJobDefinitionLoader(theJobDefinitionRegistry, theClearJobDefinition, theSubmitJobDefinition);
}
}

View File

@ -0,0 +1,36 @@
package ca.uhn.fhir.mdm.batch2;
/*-
* #%L
* hapi-fhir-storage-mdm
* %%
* Copyright (C) 2014 - 2023 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.batch2.coordinator.JobDefinitionRegistry;
import ca.uhn.fhir.batch2.model.JobDefinition;
import ca.uhn.fhir.mdm.batch2.clear.MdmClearJobParameters;
import ca.uhn.fhir.mdm.batch2.submit.MdmSubmitJobParameters;
public class MdmJobDefinitionLoader {
public MdmJobDefinitionLoader(JobDefinitionRegistry theJobDefinitionRegistry,
JobDefinition<MdmClearJobParameters> theClearJobDefinition,
JobDefinition<MdmSubmitJobParameters> theSubmitJobDefinition) {
theJobDefinitionRegistry.addJobDefinitionIfNotRegistered(theClearJobDefinition);
theJobDefinitionRegistry.addJobDefinitionIfNotRegistered(theSubmitJobDefinition);
}
}

View File

@ -33,7 +33,6 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class MdmClearAppCtx {
public static final String JOB_MDM_CLEAR = "MDM_CLEAR";
public static final String MDM_CLEAR_JOB_BEAN_NAME = "mdmClearJobDefinition";
@ -83,4 +82,5 @@ public class MdmClearAppCtx {
public LoadGoldenIdsStep loadGoldenIdsStep(IGoldenResourceSearchSvc theGoldenResourceSearchSvc) {
return new LoadGoldenIdsStep(theGoldenResourceSearchSvc);
}
}

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -40,7 +40,6 @@ import org.slf4j.LoggerFactory;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.PostConstruct;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@ -67,10 +66,11 @@ public class FilesystemBinaryStorageSvcImpl extends BaseBinaryStorageSvcImpl {
myJsonSerializer = new ObjectMapper();
myJsonSerializer.setSerializationInclusion(JsonInclude.Include.NON_NULL);
myJsonSerializer.enable(SerializationFeature.INDENT_OUTPUT);
createBasePathDirectory();
}
@PostConstruct
public void start() {
private void createBasePathDirectory() {
ourLog.info("Starting binary storage service with base path: {}", myBasePath);
mkdir(myBasePath);

View File

@ -108,8 +108,20 @@ import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;
import javax.annotation.Nonnull;
import javax.annotation.PostConstruct;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.TreeSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@ -129,7 +141,6 @@ public abstract class BaseTransactionProcessor {
public static final Pattern UNQUALIFIED_MATCH_URL_START = Pattern.compile("^[a-zA-Z0-9_]+=");
public static final Pattern INVALID_PLACEHOLDER_PATTERN = Pattern.compile("[a-zA-Z]+:.*");
private static final Logger ourLog = LoggerFactory.getLogger(BaseTransactionProcessor.class);
private BaseStorageDao myDao;
@Autowired
private PlatformTransactionManager myTxManager;
@Autowired
@ -173,11 +184,6 @@ public abstract class BaseTransactionProcessor {
myVersionAdapter = theVersionAdapter;
}
@PostConstruct
public void start() {
ourLog.trace("Starting transaction processor");
}
private TaskExecutor getTaskExecutor() {
if (myExecutor == null) {
myExecutor = myThreadPoolFactory.newThreadPool(myDaoConfig.getBundleBatchPoolSize(), myDaoConfig.getBundleBatchMaxPoolSize(), "bundle-batch-");
@ -311,10 +317,6 @@ public abstract class BaseTransactionProcessor {
return theRes.getMeta().getLastUpdated();
}
public void setDao(BaseStorageDao theDao) {
myDao = theDao;
}
private IBaseBundle processTransactionAsSubRequest(RequestDetails theRequestDetails, IBaseBundle theRequest, String theActionName, boolean theNestedMode) {
BaseStorageDao.markRequestAsProcessingSubRequest(theRequestDetails);
try {

View File

@ -56,7 +56,6 @@ import org.springframework.transaction.support.TransactionTemplate;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.PostConstruct;
import java.util.concurrent.Callable;
/**
@ -74,18 +73,13 @@ public class HapiTransactionService implements IHapiTransactionService {
protected PlatformTransactionManager myTransactionManager;
@Autowired
protected IRequestPartitionHelperSvc myRequestPartitionHelperSvc;
private boolean myCustomIsolationSupported;
private volatile Boolean myCustomIsolationSupported;
@VisibleForTesting
public void setInterceptorBroadcaster(IInterceptorBroadcaster theInterceptorBroadcaster) {
myInterceptorBroadcaster = theInterceptorBroadcaster;
}
@PostConstruct
public void start() {
myCustomIsolationSupported = isCustomIsolationSupported();
}
@Override
public IExecutionBuilder withRequest(@Nullable RequestDetails theRequestDetails) {
return new ExecutionBuilder(theRequestDetails);
@ -162,11 +156,15 @@ public class HapiTransactionService implements IHapiTransactionService {
}
public boolean isCustomIsolationSupported() {
if (myTransactionManager instanceof JpaTransactionManager) {
JpaDialect jpaDialect = ((JpaTransactionManager) myTransactionManager).getJpaDialect();
return (jpaDialect instanceof HibernateJpaDialect);
if (myCustomIsolationSupported == null) {
if (myTransactionManager instanceof JpaTransactionManager) {
JpaDialect jpaDialect = ((JpaTransactionManager) myTransactionManager).getJpaDialect();
myCustomIsolationSupported = (jpaDialect instanceof HibernateJpaDialect);
} else {
myCustomIsolationSupported = false;
}
}
return false;
return myCustomIsolationSupported;
}
@VisibleForTesting
@ -281,7 +279,7 @@ public class HapiTransactionService implements IHapiTransactionService {
txTemplate.setPropagationBehavior(theExecutionBuilder.myPropagation.value());
}
if (myCustomIsolationSupported && theExecutionBuilder.myIsolation != null && theExecutionBuilder.myIsolation != Isolation.DEFAULT) {
if (isCustomIsolationSupported() && theExecutionBuilder.myIsolation != null && theExecutionBuilder.myIsolation != Isolation.DEFAULT) {
txTemplate.setIsolationLevel(theExecutionBuilder.myIsolation.value());
}

View File

@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.searchparam.submit.interceptor;
* #L%
*/
import ca.uhn.fhir.IHapiBootOrder;
import ca.uhn.fhir.interceptor.api.IInterceptorService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -37,7 +38,7 @@ public class SearchParamSubmitInterceptorLoader {
private IInterceptorService myInterceptorRegistry;
@EventListener(classes = {ContextRefreshedEvent.class})
@Order
@Order(IHapiBootOrder.REGISTER_INTERCEPTORS)
public void start() {
ourLog.info("Registering SearchParamValidatingInterceptor interceptor");
myInterceptorRegistry.registerInterceptor(mySearchParamValidatingInterceptor);

View File

@ -25,15 +25,12 @@ import ca.uhn.fhir.jpa.api.model.TranslationQuery;
import ca.uhn.fhir.jpa.model.entity.TagTypeEnum;
import ca.uhn.fhir.sl.cache.Cache;
import ca.uhn.fhir.sl.cache.CacheFactory;
import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import javax.annotation.Nonnull;
import javax.annotation.PostConstruct;
import java.util.Collection;
import java.util.EnumMap;
import java.util.Map;
@ -52,16 +49,16 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
// TODO: JA2 extract an interface for this class and use it everywhere
public class MemoryCacheService {
@Autowired
DaoConfig myDaoConfig;
private final DaoConfig myDaoConfig;
private final EnumMap<CacheEnum, Cache<?, ?>> myCaches = new EnumMap<>(CacheEnum.class);
private EnumMap<CacheEnum, Cache<?, ?>> myCaches;
public MemoryCacheService(DaoConfig theDaoConfig) {
myDaoConfig = theDaoConfig;
@PostConstruct
public void start() {
myCaches = new EnumMap<>(CacheEnum.class);
populateCaches();
}
private void populateCaches() {
for (CacheEnum next : CacheEnum.values()) {
long timeoutSeconds;
@ -94,7 +91,6 @@ public class MemoryCacheService {
myCaches.put(next, nextCache);
}
}
@ -188,11 +184,6 @@ public class MemoryCacheService {
return getCache(theCache).estimatedSize();
}
@VisibleForTesting
public void setDaoConfigForUnitTest(DaoConfig theDaoConfig) {
myDaoConfig = theDaoConfig;
}
public enum CacheEnum {
TAG_DEFINITION(TagDefinitionCacheKey.class),

View File

@ -20,9 +20,9 @@ package ca.uhn.fhir.jpa.validation;
* #L%
*/
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.rest.api.server.RequestDetails;
@ -40,9 +40,7 @@ import org.hl7.fhir.r5.utils.validation.IResourceValidator;
import org.hl7.fhir.r5.utils.validation.IValidatorResourceFetcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.PostConstruct;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
@ -52,16 +50,15 @@ public class ValidatorResourceFetcher implements IValidatorResourceFetcher {
private static final Logger ourLog = LoggerFactory.getLogger(ValidatorResourceFetcher.class);
@Autowired
private DaoRegistry myDaoRegistry;
@Autowired
private FhirContext myFhirContext;
@Autowired
private IValidationSupport myValidationSupport;
private VersionSpecificWorkerContextWrapper myVersionSpecificContextWrapper;
private final FhirContext myFhirContext;
private final IValidationSupport myValidationSupport;
private final DaoRegistry myDaoRegistry;
private final VersionSpecificWorkerContextWrapper myVersionSpecificContextWrapper;
@PostConstruct
public void start() {
public ValidatorResourceFetcher(FhirContext theFhirContext, IValidationSupport theValidationSupport, DaoRegistry theDaoRegistry) {
myFhirContext = theFhirContext;
myValidationSupport = theValidationSupport;
myDaoRegistry = theDaoRegistry;
myVersionSpecificContextWrapper = VersionSpecificWorkerContextWrapper.newVersionSpecificWorkerContextWrapper(myValidationSupport);
}

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.3.11-SNAPSHOT</version>
<version>6.3.12-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -2,12 +2,14 @@ package ca.uhn.fhir.to;
import ca.uhn.fhir.to.mvc.AnnotationMethodHandlerAdapterConfigurer;
import ca.uhn.fhir.to.util.WebUtil;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
import org.thymeleaf.spring5.SpringTemplateEngine;
import org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver;
import org.thymeleaf.spring5.view.ThymeleafViewResolver;
@ -49,8 +51,8 @@ public class FhirTesterMvcConfig extends WebMvcConfigurerAdapter {
}
@Bean
public AnnotationMethodHandlerAdapterConfigurer annotationMethodHandlerAdapterConfigurer() {
return new AnnotationMethodHandlerAdapterConfigurer();
public AnnotationMethodHandlerAdapterConfigurer annotationMethodHandlerAdapterConfigurer(@Qualifier("requestMappingHandlerAdapter") RequestMappingHandlerAdapter theAdapter) {
return new AnnotationMethodHandlerAdapterConfigurer(theAdapter);
}
@Bean

Some files were not shown because too many files have changed in this diff Show More