Merge pull request #89 from hapifhir/rel_5_0_0

Start 5.0.0 release branch
This commit is contained in:
James Agnew
2020-05-14 08:40:42 -04:00
committed by GitHub
8 changed files with 119 additions and 118 deletions

View File

@@ -29,7 +29,7 @@ before_script:
- sudo chown -R travis:travis "$HOME/.m2/repository"; - sudo chown -R travis:travis "$HOME/.m2/repository";
script: script:
- mvn -U install - mvn -B install

View File

@@ -11,7 +11,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>4.2.0</version> <version>5.0.0</version>
</parent> </parent>
<artifactId>hapi-fhir-jpaserver-starter</artifactId> <artifactId>hapi-fhir-jpaserver-starter</artifactId>

View File

@@ -1,28 +1,40 @@
package ca.uhn.fhir.jpa.starter; package ca.uhn.fhir.jpa.starter;
import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.jpa.subscription.channel.config.SubscriptionChannelConfig;
import ca.uhn.fhir.jpa.subscription.match.config.SubscriptionProcessorConfig;
import ca.uhn.fhir.jpa.subscription.match.config.WebsocketDispatcherConfig;
import ca.uhn.fhir.jpa.subscription.submit.config.SubscriptionSubmitterConfig;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
public class ApplicationContext extends AnnotationConfigWebApplicationContext { public class ApplicationContext extends AnnotationConfigWebApplicationContext {
public ApplicationContext() { public ApplicationContext() {
FhirVersionEnum fhirVersion = HapiProperties.getFhirVersion(); FhirVersionEnum fhirVersion = HapiProperties.getFhirVersion();
if (fhirVersion == FhirVersionEnum.DSTU2) { if (fhirVersion == FhirVersionEnum.DSTU2) {
register(FhirServerConfigDstu2.class, FhirServerConfigCommon.class); register(FhirServerConfigDstu2.class, FhirServerConfigCommon.class);
} else if (fhirVersion == FhirVersionEnum.DSTU3) { } else if (fhirVersion == FhirVersionEnum.DSTU3) {
register(FhirServerConfigDstu3.class, FhirServerConfigCommon.class); register(FhirServerConfigDstu3.class, FhirServerConfigCommon.class);
} else if (fhirVersion == FhirVersionEnum.R4) { } else if (fhirVersion == FhirVersionEnum.R4) {
register(FhirServerConfigR4.class, FhirServerConfigCommon.class); register(FhirServerConfigR4.class, FhirServerConfigCommon.class);
} else if (fhirVersion == FhirVersionEnum.R5) { } else if (fhirVersion == FhirVersionEnum.R5) {
register(FhirServerConfigR5.class, FhirServerConfigCommon.class); register(FhirServerConfigR5.class, FhirServerConfigCommon.class);
} else { } else {
throw new IllegalStateException(); throw new IllegalStateException();
}
if (HapiProperties.getSubscriptionWebsocketEnabled()) {
register(ca.uhn.fhir.jpa.config.WebsocketDispatcherConfig.class);
}
} }
if (HapiProperties.getSubscriptionWebsocketEnabled()) {
register(WebsocketDispatcherConfig.class);
}
if (HapiProperties.getSubscriptionEmailEnabled()
|| HapiProperties.getSubscriptionRestHookEnabled()
|| HapiProperties.getSubscriptionWebsocketEnabled()) {
register(SubscriptionSubmitterConfig.class);
register(SubscriptionProcessorConfig.class);
register(SubscriptionChannelConfig.class);
}
}
} }

View File

@@ -1,14 +1,16 @@
package ca.uhn.fhir.jpa.starter; package ca.uhn.fhir.jpa.starter;
import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.binstore.DatabaseBlobBinaryStorageSvcImpl; import ca.uhn.fhir.jpa.binstore.DatabaseBlobBinaryStorageSvcImpl;
import ca.uhn.fhir.jpa.binstore.IBinaryStorageSvc; import ca.uhn.fhir.jpa.binstore.IBinaryStorageSvc;
import ca.uhn.fhir.jpa.dao.DaoConfig; import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.ModelConfig;
import ca.uhn.fhir.jpa.subscription.module.channel.SubscriptionDeliveryHandlerFactory; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionDeliveryHandlerFactory;
import ca.uhn.fhir.jpa.subscription.module.subscriber.email.IEmailSender; import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender;
import ca.uhn.fhir.jpa.subscription.module.subscriber.email.JavaMailEmailSender; import ca.uhn.fhir.jpa.subscription.match.deliver.email.JavaMailEmailSender;
import org.apache.commons.dbcp2.BasicDataSource; import org.apache.commons.dbcp2.BasicDataSource;
import org.hl7.fhir.dstu2.model.Subscription; import org.hl7.fhir.dstu2.model.Subscription;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@@ -50,9 +52,8 @@ public class FhirServerConfigCommon {
private Boolean emailStartTlsEnable = HapiProperties.getEmailStartTlsEnable(); private Boolean emailStartTlsEnable = HapiProperties.getEmailStartTlsEnable();
private Boolean emailStartTlsRequired = HapiProperties.getEmailStartTlsRequired(); private Boolean emailStartTlsRequired = HapiProperties.getEmailStartTlsRequired();
private Boolean emailQuitWait = HapiProperties.getEmailQuitWait(); private Boolean emailQuitWait = HapiProperties.getEmailQuitWait();
@Autowired @Autowired
private SubscriptionDeliveryHandlerFactory mySubscriptionDeliveryHandlerFactory; private ApplicationContext myAppCtx;
public FhirServerConfigCommon() { public FhirServerConfigCommon() {
ourLog.info("Server configured to " + (this.allowContainsSearches ? "allow" : "deny") + " contains searches"); ourLog.info("Server configured to " + (this.allowContainsSearches ? "allow" : "deny") + " contains searches");
@@ -116,15 +117,15 @@ public class FhirServerConfigCommon {
// Subscriptions are enabled by channel type // Subscriptions are enabled by channel type
if (HapiProperties.getSubscriptionRestHookEnabled()) { if (HapiProperties.getSubscriptionRestHookEnabled()) {
ourLog.info("Enabling REST-hook subscriptions"); ourLog.info("Enabling REST-hook subscriptions");
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); retVal.addSupportedSubscriptionType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK);
} }
if (HapiProperties.getSubscriptionEmailEnabled()) { if (HapiProperties.getSubscriptionEmailEnabled()) {
ourLog.info("Enabling email subscriptions"); ourLog.info("Enabling email subscriptions");
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL); retVal.addSupportedSubscriptionType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.EMAIL);
} }
if (HapiProperties.getSubscriptionWebsocketEnabled()) { if (HapiProperties.getSubscriptionWebsocketEnabled()) {
ourLog.info("Enabling websocket subscriptions"); ourLog.info("Enabling websocket subscriptions");
retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET); retVal.addSupportedSubscriptionType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET);
} }
retVal.setFilterParameterEnabled(HapiProperties.getFilterSearchEnabled()); retVal.setFilterParameterEnabled(HapiProperties.getFilterSearchEnabled());
@@ -132,6 +133,12 @@ public class FhirServerConfigCommon {
return retVal; return retVal;
} }
@Bean
public PartitionSettings partitionSettings() {
return new PartitionSettings();
}
@Bean @Bean
public ModelConfig modelConfig() { public ModelConfig modelConfig() {
ModelConfig modelConfig = new ModelConfig(); ModelConfig modelConfig = new ModelConfig();
@@ -197,8 +204,9 @@ public class FhirServerConfigCommon {
// retVal.setStartTlsRequired(this.emailStartTlsRequired); // retVal.setStartTlsRequired(this.emailStartTlsRequired);
// retVal.setQuitWait(this.emailQuitWait); // retVal.setQuitWait(this.emailQuitWait);
Validate.notNull(mySubscriptionDeliveryHandlerFactory, "No subscription delivery handler"); SubscriptionDeliveryHandlerFactory subscriptionDeliveryHandlerFactory = myAppCtx.getBean(SubscriptionDeliveryHandlerFactory.class);
mySubscriptionDeliveryHandlerFactory.setEmailSender(retVal); Validate.notNull(subscriptionDeliveryHandlerFactory, "No subscription delivery handler");
subscriptionDeliveryHandlerFactory.setEmailSender(retVal);
return retVal; return retVal;

View File

@@ -485,5 +485,9 @@ public class HapiProperties {
public static boolean getBulkExportEnabled() { public static boolean getBulkExportEnabled() {
return HapiProperties.getBooleanProperty(BULK_EXPORT_ENABLED, true); return HapiProperties.getBooleanProperty(BULK_EXPORT_ENABLED, true);
} }
public static boolean isFhirPathFilterInterceptorEnabled() {
return HapiProperties.getBooleanProperty("fhirpath_interceptor.enabled", false);
}
} }

View File

@@ -4,11 +4,12 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.interceptor.api.IInterceptorService; import ca.uhn.fhir.interceptor.api.IInterceptorService;
import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.api.rp.ResourceProviderFactory;
import ca.uhn.fhir.jpa.binstore.BinaryStorageInterceptor; import ca.uhn.fhir.jpa.binstore.BinaryStorageInterceptor;
import ca.uhn.fhir.jpa.bulk.BulkDataExportProvider; import ca.uhn.fhir.jpa.bulk.BulkDataExportProvider;
import ca.uhn.fhir.jpa.dao.DaoConfig;
import ca.uhn.fhir.jpa.dao.DaoRegistry;
import ca.uhn.fhir.jpa.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor; import ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor;
import ca.uhn.fhir.jpa.provider.GraphQLProvider; import ca.uhn.fhir.jpa.provider.GraphQLProvider;
import ca.uhn.fhir.jpa.provider.JpaConformanceProviderDstu2; import ca.uhn.fhir.jpa.provider.JpaConformanceProviderDstu2;
@@ -22,25 +23,23 @@ import ca.uhn.fhir.jpa.provider.r4.JpaSystemProviderR4;
import ca.uhn.fhir.jpa.provider.r5.JpaConformanceProviderR5; import ca.uhn.fhir.jpa.provider.r5.JpaConformanceProviderR5;
import ca.uhn.fhir.jpa.provider.r5.JpaSystemProviderR5; import ca.uhn.fhir.jpa.provider.r5.JpaSystemProviderR5;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.subscription.SubscriptionInterceptorLoader; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
import ca.uhn.fhir.jpa.subscription.module.interceptor.SubscriptionDebugLogInterceptor; import ca.uhn.fhir.jpa.subscription.util.SubscriptionDebugLogInterceptor;
import ca.uhn.fhir.jpa.util.ResourceProviderFactory;
import ca.uhn.fhir.model.dstu2.composite.MetaDt; import ca.uhn.fhir.model.dstu2.composite.MetaDt;
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
import ca.uhn.fhir.rest.server.HardcodedServerAddressStrategy; import ca.uhn.fhir.rest.server.HardcodedServerAddressStrategy;
import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.interceptor.CorsInterceptor; import ca.uhn.fhir.rest.server.interceptor.CorsInterceptor;
import ca.uhn.fhir.rest.server.interceptor.FhirPathFilterInterceptor;
import ca.uhn.fhir.rest.server.interceptor.LoggingInterceptor; import ca.uhn.fhir.rest.server.interceptor.LoggingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor; import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor;
import ca.uhn.fhir.rest.server.interceptor.ResponseValidatingInterceptor; import ca.uhn.fhir.rest.server.interceptor.ResponseValidatingInterceptor;
import ca.uhn.fhir.validation.IValidatorModule; import ca.uhn.fhir.validation.IValidatorModule;
import ca.uhn.fhir.validation.ResultSeverityEnum; import ca.uhn.fhir.validation.ResultSeverityEnum;
import java.util.HashSet;
import java.util.TreeSet;
import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.r4.model.Bundle.BundleType;
import org.hl7.fhir.dstu3.model.Meta; import org.hl7.fhir.dstu3.model.Meta;
import org.hl7.fhir.r4.model.Bundle.BundleType;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfiguration;
@@ -48,7 +47,9 @@ import org.springframework.web.cors.CorsConfiguration;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.TreeSet;
public class JpaRestfulServer extends RestfulServer { public class JpaRestfulServer extends RestfulServer {
@@ -64,12 +65,12 @@ public class JpaRestfulServer extends RestfulServer {
* specified in the properties file. * specified in the properties file.
*/ */
ApplicationContext appCtx = (ApplicationContext) getServletContext() ApplicationContext appCtx = (ApplicationContext) getServletContext()
.getAttribute("org.springframework.web.context.WebApplicationContext.ROOT"); .getAttribute("org.springframework.web.context.WebApplicationContext.ROOT");
// Customize supported resource types // Customize supported resource types
Set<String> supportedResourceTypes = HapiProperties.getSupportedResourceTypes(); Set<String> supportedResourceTypes = HapiProperties.getSupportedResourceTypes();
if (!supportedResourceTypes.isEmpty() && !supportedResourceTypes.contains("SearchParameter")) { if (!supportedResourceTypes.isEmpty() && !supportedResourceTypes.contains("SearchParameter")) {
supportedResourceTypes.add("SearchParameter"); supportedResourceTypes.add("SearchParameter");
} }
if (!supportedResourceTypes.isEmpty()) { if (!supportedResourceTypes.isEmpty()) {
@@ -112,36 +113,32 @@ public class JpaRestfulServer extends RestfulServer {
* You can also create your own subclass of the conformance provider if you need to * You can also create your own subclass of the conformance provider if you need to
* provide further customization of your server's CapabilityStatement * provide further customization of your server's CapabilityStatement
*/ */
DaoConfig daoConfig = appCtx.getBean(DaoConfig.class);
ISearchParamRegistry searchParamRegistry = appCtx.getBean(ISearchParamRegistry.class);
if (fhirVersion == FhirVersionEnum.DSTU2) { if (fhirVersion == FhirVersionEnum.DSTU2) {
IFhirSystemDao<ca.uhn.fhir.model.dstu2.resource.Bundle, MetaDt> systemDao = appCtx IFhirSystemDao<ca.uhn.fhir.model.dstu2.resource.Bundle, MetaDt> systemDao = appCtx.getBean("mySystemDaoDstu2", IFhirSystemDao.class);
.getBean("mySystemDaoDstu2", IFhirSystemDao.class); JpaConformanceProviderDstu2 confProvider = new JpaConformanceProviderDstu2(this, systemDao, daoConfig);
JpaConformanceProviderDstu2 confProvider = new JpaConformanceProviderDstu2(this, systemDao,
appCtx.getBean(DaoConfig.class));
confProvider.setImplementationDescription("HAPI FHIR DSTU2 Server"); confProvider.setImplementationDescription("HAPI FHIR DSTU2 Server");
setServerConformanceProvider(confProvider); setServerConformanceProvider(confProvider);
} else if (fhirVersion == FhirVersionEnum.DSTU3) {
IFhirSystemDao<Bundle, Meta> systemDao = appCtx
.getBean("mySystemDaoDstu3", IFhirSystemDao.class);
JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(this, systemDao,
appCtx.getBean(DaoConfig.class));
confProvider.setImplementationDescription("HAPI FHIR DSTU3 Server");
setServerConformanceProvider(confProvider);
} else if (fhirVersion == FhirVersionEnum.R4) {
IFhirSystemDao<org.hl7.fhir.r4.model.Bundle, org.hl7.fhir.r4.model.Meta> systemDao = appCtx
.getBean("mySystemDaoR4", IFhirSystemDao.class);
JpaConformanceProviderR4 confProvider = new JpaConformanceProviderR4(this, systemDao,
appCtx.getBean(DaoConfig.class));
confProvider.setImplementationDescription("HAPI FHIR R4 Server");
setServerConformanceProvider(confProvider);
} else if (fhirVersion == FhirVersionEnum.R5) {
IFhirSystemDao<org.hl7.fhir.r5.model.Bundle, org.hl7.fhir.r5.model.Meta> systemDao = appCtx
.getBean("mySystemDaoR5", IFhirSystemDao.class);
JpaConformanceProviderR5 confProvider = new JpaConformanceProviderR5(this, systemDao,
appCtx.getBean(DaoConfig.class));
confProvider.setImplementationDescription("HAPI FHIR R5 Server");
setServerConformanceProvider(confProvider);
} else { } else {
throw new IllegalStateException(); if (fhirVersion == FhirVersionEnum.DSTU3) {
IFhirSystemDao<Bundle, Meta> systemDao = appCtx.getBean("mySystemDaoDstu3", IFhirSystemDao.class);
JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(this, systemDao, daoConfig, searchParamRegistry);
confProvider.setImplementationDescription("HAPI FHIR DSTU3 Server");
setServerConformanceProvider(confProvider);
} else if (fhirVersion == FhirVersionEnum.R4) {
IFhirSystemDao<org.hl7.fhir.r4.model.Bundle, org.hl7.fhir.r4.model.Meta> systemDao = appCtx.getBean("mySystemDaoR4", IFhirSystemDao.class);
JpaConformanceProviderR4 confProvider = new JpaConformanceProviderR4(this, systemDao, daoConfig, searchParamRegistry);
confProvider.setImplementationDescription("HAPI FHIR R4 Server");
setServerConformanceProvider(confProvider);
} else if (fhirVersion == FhirVersionEnum.R5) {
IFhirSystemDao<org.hl7.fhir.r5.model.Bundle, org.hl7.fhir.r5.model.Meta> systemDao = appCtx.getBean("mySystemDaoR5", IFhirSystemDao.class);
JpaConformanceProviderR5 confProvider = new JpaConformanceProviderR5(this, systemDao, daoConfig, searchParamRegistry);
confProvider.setImplementationDescription("HAPI FHIR R5 Server");
setServerConformanceProvider(confProvider);
} else {
throw new IllegalStateException();
}
} }
/* /*
@@ -179,9 +176,12 @@ public class JpaRestfulServer extends RestfulServer {
* browser. * browser.
*/ */
ResponseHighlighterInterceptor responseHighlighterInterceptor = new ResponseHighlighterInterceptor(); ResponseHighlighterInterceptor responseHighlighterInterceptor = new ResponseHighlighterInterceptor();
;
this.registerInterceptor(responseHighlighterInterceptor); this.registerInterceptor(responseHighlighterInterceptor);
if (HapiProperties.isFhirPathFilterInterceptorEnabled()) {
registerInterceptor(new FhirPathFilterInterceptor());
}
/* /*
* Add some logging for each request * Add some logging for each request
*/ */
@@ -218,7 +218,7 @@ public class JpaRestfulServer extends RestfulServer {
// manual triggering of a subscription delivery, enable this provider // manual triggering of a subscription delivery, enable this provider
if (false) { // <-- DISABLED RIGHT NOW if (false) { // <-- DISABLED RIGHT NOW
SubscriptionTriggeringProvider retriggeringProvider = appCtx SubscriptionTriggeringProvider retriggeringProvider = appCtx
.getBean(SubscriptionTriggeringProvider.class); .getBean(SubscriptionTriggeringProvider.class);
registerProvider(retriggeringProvider); registerProvider(retriggeringProvider);
} }
@@ -244,7 +244,7 @@ public class JpaRestfulServer extends RestfulServer {
config.addExposedHeader("Location"); config.addExposedHeader("Location");
config.addExposedHeader("Content-Location"); config.addExposedHeader("Content-Location");
config.setAllowedMethods( config.setAllowedMethods(
Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH", "HEAD")); Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH", "HEAD"));
config.setAllowCredentials(HapiProperties.getCorsAllowedCredentials()); config.setAllowCredentials(HapiProperties.getCorsAllowedCredentials());
// Create the interceptor and register it // Create the interceptor and register it
@@ -255,14 +255,8 @@ public class JpaRestfulServer extends RestfulServer {
// If subscriptions are enabled, we want to register the interceptor that // If subscriptions are enabled, we want to register the interceptor that
// will activate them and match results against them // will activate them and match results against them
if (HapiProperties.getSubscriptionWebsocketEnabled() || if (HapiProperties.getSubscriptionWebsocketEnabled() ||
HapiProperties.getSubscriptionEmailEnabled() || HapiProperties.getSubscriptionEmailEnabled() ||
HapiProperties.getSubscriptionRestHookEnabled()) { HapiProperties.getSubscriptionRestHookEnabled()) {
// Loads subscription interceptors (SubscriptionActivatingInterceptor, SubscriptionMatcherInterceptor)
// with activation of scheduled subscription
SubscriptionInterceptorLoader subscriptionInterceptorLoader = appCtx
.getBean(SubscriptionInterceptorLoader.class);
subscriptionInterceptorLoader.registerInterceptors();
// Subscription debug logging // Subscription debug logging
IInterceptorService interceptorService = appCtx.getBean(IInterceptorService.class); IInterceptorService interceptorService = appCtx.getBean(IInterceptorService.class);
interceptorService.registerInterceptor(new SubscriptionDebugLogInterceptor()); interceptorService.registerInterceptor(new SubscriptionDebugLogInterceptor());
@@ -272,40 +266,19 @@ public class JpaRestfulServer extends RestfulServer {
DaoRegistry daoRegistry = appCtx.getBean(DaoRegistry.class); DaoRegistry daoRegistry = appCtx.getBean(DaoRegistry.class);
IInterceptorBroadcaster interceptorBroadcaster = appCtx.getBean(IInterceptorBroadcaster.class); IInterceptorBroadcaster interceptorBroadcaster = appCtx.getBean(IInterceptorBroadcaster.class);
if (HapiProperties.getAllowCascadingDeletes()) { if (HapiProperties.getAllowCascadingDeletes()) {
CascadingDeleteInterceptor cascadingDeleteInterceptor = new CascadingDeleteInterceptor( CascadingDeleteInterceptor cascadingDeleteInterceptor = new CascadingDeleteInterceptor(ctx, daoRegistry, interceptorBroadcaster);
daoRegistry, interceptorBroadcaster);
getInterceptorService().registerInterceptor(cascadingDeleteInterceptor); getInterceptorService().registerInterceptor(cascadingDeleteInterceptor);
} }
// Binary Storage // Binary Storage
if (HapiProperties.isBinaryStorageEnabled()) { if (HapiProperties.isBinaryStorageEnabled()) {
BinaryStorageInterceptor binaryStorageInterceptor = appCtx BinaryStorageInterceptor binaryStorageInterceptor = appCtx
.getBean(BinaryStorageInterceptor.class); .getBean(BinaryStorageInterceptor.class);
getInterceptorService().registerInterceptor(binaryStorageInterceptor); getInterceptorService().registerInterceptor(binaryStorageInterceptor);
} }
// Validation // Validation
IValidatorModule validatorModule; IValidatorModule validatorModule = appCtx.getBean(IValidatorModule.class);
switch (fhirVersion) {
case DSTU2:
validatorModule = appCtx.getBean("myInstanceValidatorDstu2", IValidatorModule.class);
break;
case DSTU3:
validatorModule = appCtx.getBean("myInstanceValidatorDstu3", IValidatorModule.class);
break;
case R4:
validatorModule = appCtx.getBean("myInstanceValidatorR4", IValidatorModule.class);
break;
case R5:
validatorModule = appCtx.getBean("myInstanceValidatorR5", IValidatorModule.class);
break;
// These versions are not supported by HAPI FHIR JPA
case DSTU2_HL7ORG:
case DSTU2_1:
default:
validatorModule = null;
break;
}
if (validatorModule != null) { if (validatorModule != null) {
if (HapiProperties.getValidateRequestsEnabled()) { if (HapiProperties.getValidateRequestsEnabled()) {
RequestValidatingInterceptor interceptor = new RequestValidatingInterceptor(); RequestValidatingInterceptor interceptor = new RequestValidatingInterceptor();
@@ -335,16 +308,16 @@ public class JpaRestfulServer extends RestfulServer {
BundleType type = BundleType.valueOf(o); BundleType type = BundleType.valueOf(o);
allowedBundleTypes.add(type.toCode()); allowedBundleTypes.add(type.toCode());
}); });
DaoConfig config = appCtx.getBean(DaoConfig.class); DaoConfig config = (DaoConfig) daoConfig;
config.setBundleTypesAllowedForStorage( config.setBundleTypesAllowedForStorage(
Collections.unmodifiableSet(new TreeSet<>(allowedBundleTypes))); Collections.unmodifiableSet(new TreeSet<>(allowedBundleTypes)));
} }
// Bulk Export // Bulk Export
if (HapiProperties.getBulkExportEnabled()) { if (HapiProperties.getBulkExportEnabled()) {
registerProvider(appCtx.getBean(BulkDataExportProvider.class)); registerProvider(appCtx.getBean(BulkDataExportProvider.class));
}
} }
}
} }

View File

@@ -61,6 +61,8 @@ validation.responses.enabled=false
################################################### ###################################################
filter_search.enabled=true filter_search.enabled=true
graphql.enabled=true graphql.enabled=true
# See FhirPathFilterInterceptor
fhirpath_interceptor.enabled=false
################################################### ###################################################
# Supported Resources # Supported Resources

View File

@@ -14,7 +14,12 @@ import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient; import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r5.model.*; import org.hl7.fhir.r5.model.Bundle;
import org.hl7.fhir.r5.model.Enumerations;
import org.hl7.fhir.r5.model.Observation;
import org.hl7.fhir.r5.model.Patient;
import org.hl7.fhir.r5.model.Subscription;
import org.hl7.fhir.r5.model.SubscriptionTopic;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
@@ -62,7 +67,7 @@ public class ExampleServerR5IT {
/* /*
* Create topic * Create topic
*/ */
Topic topic = new Topic(); SubscriptionTopic topic = new SubscriptionTopic();
topic.getResourceTrigger().getQueryCriteria().setCurrent("Observation?status=final"); topic.getResourceTrigger().getQueryCriteria().setCurrent("Observation?status=final");
/* /*
@@ -71,14 +76,11 @@ public class ExampleServerR5IT {
Subscription subscription = new Subscription(); Subscription subscription = new Subscription();
subscription.getTopic().setResource(topic); subscription.getTopic().setResource(topic);
subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)"); subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
subscription.setStatus(Subscription.SubscriptionStatus.REQUESTED); subscription.setStatus(Enumerations.SubscriptionState.REQUESTED);
subscription.getChannelType()
Subscription.SubscriptionChannelComponent channel = new Subscription.SubscriptionChannelComponent();
channel.getType().addCoding()
.setSystem("http://terminology.hl7.org/CodeSystem/subscription-channel-type") .setSystem("http://terminology.hl7.org/CodeSystem/subscription-channel-type")
.setCode("websocket"); .setCode("websocket");
channel.getPayload().setContentType("application/json"); subscription.setContentType("application/json");
subscription.setChannel(channel);
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute(); MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
IIdType mySubscriptionId = methodOutcome.getId(); IIdType mySubscriptionId = methodOutcome.getId();