Fix an issue with the spring boot build
This commit is contained in:
parent
e0cb0a8188
commit
9c27e8e6dd
|
@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.dao;
|
|||
* 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.
|
||||
|
@ -22,14 +22,12 @@ package ca.uhn.fhir.jpa.dao;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.rest.param.HasAndListParam;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -39,12 +37,22 @@ public class DaoRegistry implements ApplicationContextAware {
|
|||
@Autowired
|
||||
private FhirContext myCtx;
|
||||
private volatile Map<String, IFhirResourceDao<?>> myResourceNameToResourceDao;
|
||||
private volatile IFhirSystemDao<?, ?> mySystemDao;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext theApplicationContext) throws BeansException {
|
||||
myAppCtx = theApplicationContext;
|
||||
}
|
||||
|
||||
public IFhirSystemDao<?, ?> getSystemDao() {
|
||||
IFhirSystemDao<?, ?> retVal = mySystemDao;
|
||||
if (retVal == null) {
|
||||
retVal = myAppCtx.getBean(IFhirSystemDao.class);
|
||||
mySystemDao = retVal;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public IFhirResourceDao<?> getResourceDao(String theResourceName) {
|
||||
IFhirResourceDao<?> retVal = getResourceNameToResourceDao().get(theResourceName);
|
||||
Validate.notNull(retVal, "No DAO exists for resource type %s - Have: %s", theResourceName, myResourceNameToResourceDao);
|
||||
|
|
|
@ -20,30 +20,17 @@ package ca.uhn.fhir.jpa.search;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.dao.DaoRegistry;
|
||||
import ca.uhn.fhir.jpa.dao.IFhirSystemDao;
|
||||
import ca.uhn.fhir.jpa.dao.data.ISearchResultDao;
|
||||
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
||||
import ca.uhn.fhir.rest.server.BasePagingProvider;
|
||||
import ca.uhn.fhir.rest.server.IPagingProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class DatabaseBackedPagingProvider extends BasePagingProvider implements IPagingProvider {
|
||||
|
||||
@Autowired
|
||||
private FhirContext myContext;
|
||||
@Autowired
|
||||
private IFhirSystemDao<?, ?> myDao;
|
||||
@Autowired
|
||||
private EntityManager myEntityManager;
|
||||
@Autowired
|
||||
private PlatformTransactionManager myPlatformTransactionManager;
|
||||
@Autowired
|
||||
private ISearchResultDao mySearchResultDao;
|
||||
private DaoRegistry myDaoRegistry;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -63,7 +50,8 @@ public class DatabaseBackedPagingProvider extends BasePagingProvider implements
|
|||
|
||||
@Override
|
||||
public synchronized IBundleProvider retrieveResultList(String theId) {
|
||||
PersistedJpaBundleProvider provider = new PersistedJpaBundleProvider(theId, myDao);
|
||||
IFhirSystemDao<?, ?> systemDao = myDaoRegistry.getSystemDao();
|
||||
PersistedJpaBundleProvider provider = new PersistedJpaBundleProvider(theId, systemDao);
|
||||
if (!provider.ensureSearchEntityLoaded()) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue