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;
|
package ca.uhn.hapi.fhir.cdshooks.api;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
|
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public interface ICdsConfigService {
|
public interface ICdsConfigService {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
@ -30,4 +32,9 @@ public interface ICdsConfigService {
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
ObjectMapper getObjectMapper();
|
ObjectMapper getObjectMapper();
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
default DaoRegistry getDaoRegistry() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class CdsHooksConfig {
|
||||||
@Bean
|
@Bean
|
||||||
public ICdsConfigService cdsConfigService(
|
public ICdsConfigService cdsConfigService(
|
||||||
FhirContext theFhirContext, @Qualifier(CDS_HOOKS_OBJECT_MAPPER_FACTORY) ObjectMapper theObjectMapper) {
|
FhirContext theFhirContext, @Qualifier(CDS_HOOKS_OBJECT_MAPPER_FACTORY) ObjectMapper theObjectMapper) {
|
||||||
return new CdsConfigServiceImpl(theFhirContext, theObjectMapper);
|
return new CdsConfigServiceImpl(theFhirContext, theObjectMapper, myDaoRegistry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
@ -20,18 +20,25 @@
|
||||||
package ca.uhn.hapi.fhir.cdshooks.svc;
|
package ca.uhn.hapi.fhir.cdshooks.svc;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
|
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||||
import ca.uhn.hapi.fhir.cdshooks.api.ICdsConfigService;
|
import ca.uhn.hapi.fhir.cdshooks.api.ICdsConfigService;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class CdsConfigServiceImpl implements ICdsConfigService {
|
public class CdsConfigServiceImpl implements ICdsConfigService {
|
||||||
private final FhirContext myFhirContext;
|
private final FhirContext myFhirContext;
|
||||||
private final ObjectMapper myObjectMapper;
|
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;
|
myFhirContext = theFhirContext;
|
||||||
myObjectMapper = theObjectMapper;
|
myObjectMapper = theObjectMapper;
|
||||||
|
myDaoRegistry = theDaoRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
@ -45,4 +52,10 @@ public class CdsConfigServiceImpl implements ICdsConfigService {
|
||||||
public ObjectMapper getObjectMapper() {
|
public ObjectMapper getObjectMapper() {
|
||||||
return myObjectMapper;
|
return myObjectMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public DaoRegistry getDaoRegistry() {
|
||||||
|
return myDaoRegistry;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue