Add dao registry to cds config service (#5292)

* add daoRegistry to CdsConfigService

* add daoRegistry to CdsConfigService
This commit is contained in:
VK-SMILECDR 2023-09-11 12:05:50 -04:00 committed by GitHub
parent 5a88b505d0
commit da58e9f250
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 2 deletions

View File

@ -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;
}
} }

View File

@ -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

View File

@ -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;
}
} }