pre-review cleanup

This commit is contained in:
Ken Stevens
2020-05-27 17:54:07 -04:00
parent 0c9b9f7f77
commit e9fa2f2b8a
10 changed files with 80 additions and 83 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

@@ -1,6 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<!-- <!--
@@ -12,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>5.1.0-SNAPSHOT</version> <version>5.0.0</version>
</parent> </parent>
<artifactId>hapi-fhir-jpaserver-starter</artifactId> <artifactId>hapi-fhir-jpaserver-starter</artifactId>

View File

@@ -1,7 +1,12 @@
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.empi.config.EmpiConsumerConfig;
import ca.uhn.fhir.jpa.empi.config.EmpiSubmitterConfig;
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.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 {
@@ -24,6 +29,20 @@ public class ApplicationContext extends AnnotationConfigWebApplicationContext {
register(WebsocketDispatcherConfig.class); register(WebsocketDispatcherConfig.class);
} }
if (HapiProperties.getSubscriptionEmailEnabled()
|| HapiProperties.getSubscriptionRestHookEnabled()
|| HapiProperties.getSubscriptionWebsocketEnabled()) {
register(SubscriptionSubmitterConfig.class);
register(SubscriptionProcessorConfig.class);
register(SubscriptionChannelConfig.class);
}
if (HapiProperties.getEmpiEnabled()) {
register(EmpiSubmitterConfig.class);
register(EmpiConsumerConfig.class);
register(EmpiConfig.class);
}
} }
} }

View File

@@ -2,23 +2,19 @@ package ca.uhn.fhir.jpa.starter;
import ca.uhn.fhir.empi.api.IEmpiSettings; import ca.uhn.fhir.empi.api.IEmpiSettings;
import ca.uhn.fhir.empi.rules.config.EmpiSettings; import ca.uhn.fhir.empi.rules.config.EmpiSettings;
import ca.uhn.fhir.jpa.empi.config.EmpiConsumerConfig;
import ca.uhn.fhir.jpa.empi.config.EmpiSubmitterConfig;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import java.io.IOException; import java.io.IOException;
@Configuration @Configuration
@Import({EmpiSubmitterConfig.class, EmpiConsumerConfig.class})
public class EmpiConfig { public class EmpiConfig {
@Bean @Bean
IEmpiSettings empiProperties() throws IOException { IEmpiSettings empiSettings() throws IOException {
DefaultResourceLoader resourceLoader = new DefaultResourceLoader(); DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
Resource resource = resourceLoader.getResource("empi-rules.json"); Resource resource = resourceLoader.getResource("empi-rules.json");
String json = IOUtils.toString(resource.getInputStream(), Charsets.UTF_8); String json = IOUtils.toString(resource.getInputStream(), Charsets.UTF_8);

View File

@@ -5,18 +5,14 @@ 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.model.config.PartitionSettings; 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.channel.config.SubscriptionChannelConfig;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionDeliveryHandlerFactory; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionDeliveryHandlerFactory;
import ca.uhn.fhir.jpa.subscription.match.config.SubscriptionProcessorConfig;
import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender; import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender;
import ca.uhn.fhir.jpa.subscription.match.deliver.email.JavaMailEmailSender; import ca.uhn.fhir.jpa.subscription.match.deliver.email.JavaMailEmailSender;
import ca.uhn.fhir.jpa.subscription.submit.config.SubscriptionSubmitterConfig;
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.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;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.thymeleaf.util.Validate; import org.thymeleaf.util.Validate;
@@ -29,11 +25,6 @@ import java.sql.Driver;
*/ */
@Configuration @Configuration
@EnableTransactionManagement @EnableTransactionManagement
@Import({EmpiConfig.class,
SubscriptionSubmitterConfig.class,
SubscriptionProcessorConfig.class,
SubscriptionChannelConfig.class
})
public class FhirServerConfigCommon { public class FhirServerConfigCommon {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirServerConfigCommon.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirServerConfigCommon.class);
@@ -60,9 +51,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");
@@ -142,6 +132,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();
@@ -206,8 +202,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;
@@ -215,9 +212,4 @@ public class FhirServerConfigCommon {
return null; return null;
} }
@Bean
public PartitionSettings partitionSettings() {
return new PartitionSettings();
}
} }

View File

@@ -506,5 +506,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

@@ -2,9 +2,6 @@ package ca.uhn.fhir.jpa.starter;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.empi.provider.EmpiProviderDstu3;
import ca.uhn.fhir.empi.provider.EmpiProviderR4;
import ca.uhn.fhir.empi.rules.config.EmpiSettings;
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.config.DaoConfig;
@@ -28,13 +25,13 @@ 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.searchparam.registry.ISearchParamRegistry; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
import ca.uhn.fhir.jpa.subscription.submit.interceptor.SubscriptionSubmitInterceptorLoader;
import ca.uhn.fhir.jpa.subscription.util.SubscriptionDebugLogInterceptor; import ca.uhn.fhir.jpa.subscription.util.SubscriptionDebugLogInterceptor;
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;
@@ -118,37 +115,33 @@ 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) { } else {
IFhirSystemDao<Bundle, Meta> systemDao = appCtx if (fhirVersion == FhirVersionEnum.DSTU3) {
.getBean("mySystemDaoDstu3", IFhirSystemDao.class); IFhirSystemDao<Bundle, Meta> systemDao = appCtx.getBean("mySystemDaoDstu3", IFhirSystemDao.class);
JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(this, systemDao, JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(this, systemDao, daoConfig, searchParamRegistry);
appCtx.getBean(DaoConfig.class), appCtx.getBean(ISearchParamRegistry.class));
confProvider.setImplementationDescription("HAPI FHIR DSTU3 Server"); confProvider.setImplementationDescription("HAPI FHIR DSTU3 Server");
setServerConformanceProvider(confProvider); setServerConformanceProvider(confProvider);
} else if (fhirVersion == FhirVersionEnum.R4) { } else if (fhirVersion == FhirVersionEnum.R4) {
IFhirSystemDao<org.hl7.fhir.r4.model.Bundle, org.hl7.fhir.r4.model.Meta> systemDao = appCtx IFhirSystemDao<org.hl7.fhir.r4.model.Bundle, org.hl7.fhir.r4.model.Meta> systemDao = appCtx.getBean("mySystemDaoR4", IFhirSystemDao.class);
.getBean("mySystemDaoR4", IFhirSystemDao.class); JpaConformanceProviderR4 confProvider = new JpaConformanceProviderR4(this, systemDao, daoConfig, searchParamRegistry);
JpaConformanceProviderR4 confProvider = new JpaConformanceProviderR4(this, systemDao,
appCtx.getBean(DaoConfig.class), appCtx.getBean(ISearchParamRegistry.class));
confProvider.setImplementationDescription("HAPI FHIR R4 Server"); confProvider.setImplementationDescription("HAPI FHIR R4 Server");
setServerConformanceProvider(confProvider); setServerConformanceProvider(confProvider);
} else if (fhirVersion == FhirVersionEnum.R5) { } else if (fhirVersion == FhirVersionEnum.R5) {
IFhirSystemDao<org.hl7.fhir.r5.model.Bundle, org.hl7.fhir.r5.model.Meta> systemDao = appCtx IFhirSystemDao<org.hl7.fhir.r5.model.Bundle, org.hl7.fhir.r5.model.Meta> systemDao = appCtx.getBean("mySystemDaoR5", IFhirSystemDao.class);
.getBean("mySystemDaoR5", IFhirSystemDao.class); JpaConformanceProviderR5 confProvider = new JpaConformanceProviderR5(this, systemDao, daoConfig, searchParamRegistry);
JpaConformanceProviderR5 confProvider = new JpaConformanceProviderR5(this, systemDao,
appCtx.getBean(DaoConfig.class), appCtx.getBean(ISearchParamRegistry.class));
confProvider.setImplementationDescription("HAPI FHIR R5 Server"); confProvider.setImplementationDescription("HAPI FHIR R5 Server");
setServerConformanceProvider(confProvider); setServerConformanceProvider(confProvider);
} else { } else {
throw new IllegalStateException(); throw new IllegalStateException();
} }
}
/* /*
* ETag Support * ETag Support
@@ -185,9 +178,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
*/ */
@@ -263,13 +259,6 @@ public class JpaRestfulServer extends RestfulServer {
if (HapiProperties.getSubscriptionWebsocketEnabled() || if (HapiProperties.getSubscriptionWebsocketEnabled() ||
HapiProperties.getSubscriptionEmailEnabled() || HapiProperties.getSubscriptionEmailEnabled() ||
HapiProperties.getSubscriptionRestHookEnabled()) { HapiProperties.getSubscriptionRestHookEnabled()) {
// Loads subscription interceptors (SubscriptionActivatingInterceptor, SubscriptionMatcherInterceptor)
// with activation of scheduled subscription
SubscriptionSubmitInterceptorLoader subscriptionInterceptorLoader = appCtx
.getBean(SubscriptionSubmitInterceptorLoader.class);
subscriptionInterceptorLoader.start();
// 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());
@@ -279,8 +268,7 @@ 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(getFhirContext(), CascadingDeleteInterceptor cascadingDeleteInterceptor = new CascadingDeleteInterceptor(ctx, daoRegistry, interceptorBroadcaster);
daoRegistry, interceptorBroadcaster);
getInterceptorService().registerInterceptor(cascadingDeleteInterceptor); getInterceptorService().registerInterceptor(cascadingDeleteInterceptor);
} }
@@ -322,7 +310,7 @@ 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)));
} }

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

@@ -67,7 +67,6 @@ public class ExampleServerR4IT {
Patient pt2 = ourClient.read().resource(Patient.class).withId(id).execute(); Patient pt2 = ourClient.read().resource(Patient.class).withId(id).execute();
assertEquals(methodName, pt2.getName().get(0).getFamily()); assertEquals(methodName, pt2.getName().get(0).getFamily());
// Test EMPI // Test EMPI
// Wait until the EMPI message has been processed // Wait until the EMPI message has been processed

View File

@@ -15,7 +15,6 @@ 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.Bundle; import org.hl7.fhir.r5.model.Bundle;
import org.hl7.fhir.r5.model.Coding;
import org.hl7.fhir.r5.model.Enumerations; import org.hl7.fhir.r5.model.Enumerations;
import org.hl7.fhir.r5.model.Observation; import org.hl7.fhir.r5.model.Observation;
import org.hl7.fhir.r5.model.Patient; import org.hl7.fhir.r5.model.Patient;
@@ -78,11 +77,10 @@ public class ExampleServerR5IT {
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(Enumerations.SubscriptionState.REQUESTED); subscription.setStatus(Enumerations.SubscriptionState.REQUESTED);
subscription.getChannelType()
.setSystem("http://terminology.hl7.org/CodeSystem/subscription-channel-type")
.setCode("websocket");
subscription.setContentType("application/json"); subscription.setContentType("application/json");
Coding channelType = new Coding().setSystem("http://terminology.hl7.org/CodeSystem/subscription-channel-type")
.setCode("websocket");;
subscription.setChannelType(channelType);
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute(); MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
IIdType mySubscriptionId = methodOutcome.getId(); IIdType mySubscriptionId = methodOutcome.getId();