Move SearchBuilderFactory into EmpiSearchParamSvc to avoid module loading issues
This commit is contained in:
parent
1454364d4e
commit
e9adebc412
|
@ -39,9 +39,6 @@ public class EmpiBatchSvcImpl implements IEmpiBatchService {
|
|||
@Autowired
|
||||
private IEmpiChannelSubmitterSvc myEmpiQueueSubmitterSvc;
|
||||
|
||||
@Autowired
|
||||
private SearchBuilderFactory mySearchBuilderFactory;
|
||||
|
||||
private static final int BUFFER_SIZE = 100;
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +56,7 @@ public class EmpiBatchSvcImpl implements IEmpiBatchService {
|
|||
resolveTargetTypeOrThrowException(theTargetType);
|
||||
SearchParameterMap spMap = myEmpiSearchParamSvc.getSearchParameterMapFromCriteria(theTargetType, theCriteria);
|
||||
spMap.setLoadSynchronousUpTo(BUFFER_SIZE);
|
||||
ISearchBuilder searchBuilder = mySearchBuilderFactory.newSearchBuilder(myDaoRegistry.getResourceDao(theTargetType), theTargetType, Patient.class);
|
||||
ISearchBuilder searchBuilder = myEmpiSearchParamSvc.generateSearchBuilderForType(theTargetType);
|
||||
return submitAllMatchingResourcesToEmpiChannel(spMap, searchBuilder);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,11 @@ package ca.uhn.fhir.jpa.empi.svc;
|
|||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.context.RuntimeSearchParam;
|
||||
import ca.uhn.fhir.jpa.api.IDaoRegistry;
|
||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
|
||||
import ca.uhn.fhir.jpa.dao.ISearchBuilder;
|
||||
import ca.uhn.fhir.jpa.dao.SearchBuilderFactory;
|
||||
import ca.uhn.fhir.jpa.searchparam.MatchUrlService;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||
import ca.uhn.fhir.jpa.searchparam.extractor.SearchParamExtractorService;
|
||||
|
@ -30,6 +35,7 @@ import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
|
|||
import ca.uhn.fhir.rest.server.util.ISearchParamRetriever;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.r4.model.Patient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -45,6 +51,10 @@ public class EmpiSearchParamSvc implements ISearchParamRetriever {
|
|||
private ISearchParamRegistry mySearchParamRegistry;
|
||||
@Autowired
|
||||
private SearchParamExtractorService mySearchParamExtractorService;
|
||||
@Autowired
|
||||
private SearchBuilderFactory mySearchBuilderFactory;
|
||||
@Autowired
|
||||
private DaoRegistry myDaoRegistry;
|
||||
|
||||
public SearchParameterMap mapFromCriteria(String theResourceType, String theResourceCriteria) {
|
||||
RuntimeResourceDefinition resourceDef = myFhirContext.getResourceDefinition(theResourceType);
|
||||
|
@ -80,4 +90,9 @@ public class EmpiSearchParamSvc implements ISearchParamRetriever {
|
|||
}
|
||||
return spMap;
|
||||
}
|
||||
|
||||
public ISearchBuilder generateSearchBuilderForType(String theTargetType) {
|
||||
IFhirResourceDao resourceDao = myDaoRegistry.getResourceDao(theTargetType);
|
||||
return mySearchBuilderFactory.newSearchBuilder(resourceDao, theTargetType, resourceDao.getResourceType());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue