Add dao registry to cds config service (#5292)
* add daoRegistry to CdsConfigService * add daoRegistry to CdsConfigService
This commit is contained in:
parent
5a88b505d0
commit
da58e9f250
|
@ -20,9 +20,11 @@
|
|||
package ca.uhn.hapi.fhir.cdshooks.api;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public interface ICdsConfigService {
|
||||
@Nonnull
|
||||
|
@ -30,4 +32,9 @@ public interface ICdsConfigService {
|
|||
|
||||
@Nonnull
|
||||
ObjectMapper getObjectMapper();
|
||||
|
||||
@Nullable
|
||||
default DaoRegistry getDaoRegistry() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class CdsHooksConfig {
|
|||
@Bean
|
||||
public ICdsConfigService cdsConfigService(
|
||||
FhirContext theFhirContext, @Qualifier(CDS_HOOKS_OBJECT_MAPPER_FACTORY) ObjectMapper theObjectMapper) {
|
||||
return new CdsConfigServiceImpl(theFhirContext, theObjectMapper);
|
||||
return new CdsConfigServiceImpl(theFhirContext, theObjectMapper, myDaoRegistry);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -20,18 +20,25 @@
|
|||
package ca.uhn.hapi.fhir.cdshooks.svc;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.ICdsConfigService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class CdsConfigServiceImpl implements ICdsConfigService {
|
||||
private final FhirContext myFhirContext;
|
||||
private final ObjectMapper myObjectMapper;
|
||||
private final DaoRegistry myDaoRegistry;
|
||||
|
||||
public CdsConfigServiceImpl(@Nonnull FhirContext theFhirContext, @Nonnull ObjectMapper theObjectMapper) {
|
||||
public CdsConfigServiceImpl(
|
||||
@Nonnull FhirContext theFhirContext,
|
||||
@Nonnull ObjectMapper theObjectMapper,
|
||||
@Nullable DaoRegistry theDaoRegistry) {
|
||||
myFhirContext = theFhirContext;
|
||||
myObjectMapper = theObjectMapper;
|
||||
myDaoRegistry = theDaoRegistry;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -45,4 +52,10 @@ public class CdsConfigServiceImpl implements ICdsConfigService {
|
|||
public ObjectMapper getObjectMapper() {
|
||||
return myObjectMapper;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public DaoRegistry getDaoRegistry() {
|
||||
return myDaoRegistry;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue