Bump HAPI to release 6.6.0 (#539)
* Start tracking 6.5 * Use JpaStorageSettings and StorageSettings * Bump parent pom version + add deps for jaxb * Bump HAPI * Fix Subscription/Topic resource creation * fix subscription topic beans * Change to rel_6_6 hapi-fhir SNAPSHOT * Fix emailSender config * Split method calls by line. * Merge pull request #524 from hapifhir/do-20230509-smoke-test-ci Create smoke-tests.yml * Bump core to release 6.6.0 --------- Co-authored-by: Michael Buckley <michaelabuckley@gmail.com> Co-authored-by: Kevin Dougan SmileCDR <72025369+KevinDougan-SmileCDR@users.noreply.github.com> Co-authored-by: Ken Stevens <ken@smilecdr.com> Co-authored-by: Mark Iantorno <markiantorno@gmail.com>
This commit is contained in:
@@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.starter;
|
||||
|
||||
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig.ClientIdStrategyEnum;
|
||||
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings.ClientIdStrategyEnum;
|
||||
import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel;
|
||||
import ca.uhn.fhir.rest.api.EncodingEnum;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package ca.uhn.fhir.jpa.starter.common;
|
||||
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
|
||||
import ca.uhn.fhir.jpa.binary.api.IBinaryStorageSvc;
|
||||
import ca.uhn.fhir.jpa.binstore.DatabaseBlobBinaryStorageSvcImpl;
|
||||
import ca.uhn.fhir.jpa.config.HibernatePropertiesProvider;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings.CrossPartitionReferenceMode;
|
||||
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
|
||||
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
|
||||
import ca.uhn.fhir.jpa.starter.AppProperties;
|
||||
import ca.uhn.fhir.jpa.starter.util.JpaHibernatePropertiesProvider;
|
||||
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionDeliveryHandlerFactory;
|
||||
@@ -17,7 +17,7 @@ import ca.uhn.fhir.rest.server.mail.MailConfig;
|
||||
import ca.uhn.fhir.rest.server.mail.MailSvc;
|
||||
import com.google.common.base.Strings;
|
||||
import org.hl7.fhir.r4.model.Bundle.BundleType;
|
||||
import org.hl7.fhir.dstu2.model.Subscription;
|
||||
|
||||
import org.springframework.boot.env.YamlPropertySourceLoader;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -81,84 +81,85 @@ public class FhirServerConfigCommon {
|
||||
* Configure FHIR properties around the the JPA server via this bean
|
||||
*/
|
||||
@Bean
|
||||
public DaoConfig daoConfig(AppProperties appProperties) {
|
||||
DaoConfig daoConfig = new DaoConfig();
|
||||
public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
|
||||
JpaStorageSettings jpaStorageSettings = new JpaStorageSettings();
|
||||
|
||||
daoConfig.setIndexMissingFields(appProperties.getEnable_index_missing_fields() ? DaoConfig.IndexEnabledEnum.ENABLED : DaoConfig.IndexEnabledEnum.DISABLED);
|
||||
daoConfig.setAutoCreatePlaceholderReferenceTargets(appProperties.getAuto_create_placeholder_reference_targets());
|
||||
daoConfig.setEnforceReferentialIntegrityOnWrite(appProperties.getEnforce_referential_integrity_on_write());
|
||||
daoConfig.setEnforceReferentialIntegrityOnDelete(appProperties.getEnforce_referential_integrity_on_delete());
|
||||
daoConfig.setAllowContainsSearches(appProperties.getAllow_contains_searches());
|
||||
daoConfig.setAllowMultipleDelete(appProperties.getAllow_multiple_delete());
|
||||
daoConfig.setAllowExternalReferences(appProperties.getAllow_external_references());
|
||||
daoConfig.setSchedulingDisabled(!appProperties.getDao_scheduling_enabled());
|
||||
daoConfig.setDeleteExpungeEnabled(appProperties.getDelete_expunge_enabled());
|
||||
daoConfig.setExpungeEnabled(appProperties.getExpunge_enabled());
|
||||
jpaStorageSettings.setIndexMissingFields(appProperties.getEnable_index_missing_fields() ? JpaStorageSettings.IndexEnabledEnum.ENABLED : JpaStorageSettings.IndexEnabledEnum.DISABLED);
|
||||
jpaStorageSettings.setAutoCreatePlaceholderReferenceTargets(appProperties.getAuto_create_placeholder_reference_targets());
|
||||
jpaStorageSettings.setEnforceReferentialIntegrityOnWrite(appProperties.getEnforce_referential_integrity_on_write());
|
||||
jpaStorageSettings.setEnforceReferentialIntegrityOnDelete(appProperties.getEnforce_referential_integrity_on_delete());
|
||||
jpaStorageSettings.setAllowContainsSearches(appProperties.getAllow_contains_searches());
|
||||
jpaStorageSettings.setAllowMultipleDelete(appProperties.getAllow_multiple_delete());
|
||||
jpaStorageSettings.setAllowExternalReferences(appProperties.getAllow_external_references());
|
||||
jpaStorageSettings.setSchedulingDisabled(!appProperties.getDao_scheduling_enabled());
|
||||
jpaStorageSettings.setDeleteExpungeEnabled(appProperties.getDelete_expunge_enabled());
|
||||
jpaStorageSettings.setExpungeEnabled(appProperties.getExpunge_enabled());
|
||||
if(appProperties.getSubscription() != null && appProperties.getSubscription().getEmail() != null)
|
||||
daoConfig.setEmailFromAddress(appProperties.getSubscription().getEmail().getFrom());
|
||||
jpaStorageSettings.setEmailFromAddress(appProperties.getSubscription().getEmail().getFrom());
|
||||
|
||||
Integer maxFetchSize = appProperties.getMax_page_size();
|
||||
daoConfig.setFetchSizeDefaultMaximum(maxFetchSize);
|
||||
jpaStorageSettings.setFetchSizeDefaultMaximum(maxFetchSize);
|
||||
ourLog.info("Server configured to have a maximum fetch size of " + (maxFetchSize == Integer.MAX_VALUE ? "'unlimited'" : maxFetchSize));
|
||||
|
||||
Long reuseCachedSearchResultsMillis = appProperties.getReuse_cached_search_results_millis();
|
||||
daoConfig.setReuseCachedSearchResultsForMillis(reuseCachedSearchResultsMillis);
|
||||
jpaStorageSettings.setReuseCachedSearchResultsForMillis(reuseCachedSearchResultsMillis);
|
||||
ourLog.info("Server configured to cache search results for {} milliseconds", reuseCachedSearchResultsMillis);
|
||||
|
||||
|
||||
Long retainCachedSearchesMinutes = appProperties.getRetain_cached_searches_mins();
|
||||
daoConfig.setExpireSearchResultsAfterMillis(retainCachedSearchesMinutes * 60 * 1000);
|
||||
jpaStorageSettings.setExpireSearchResultsAfterMillis(retainCachedSearchesMinutes * 60 * 1000);
|
||||
|
||||
if(appProperties.getSubscription() != null) {
|
||||
// Subscriptions are enabled by channel type
|
||||
if (appProperties.getSubscription().getResthook_enabled()) {
|
||||
ourLog.info("Enabling REST-hook subscriptions");
|
||||
daoConfig.addSupportedSubscriptionType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK);
|
||||
jpaStorageSettings.addSupportedSubscriptionType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK);
|
||||
}
|
||||
if (appProperties.getSubscription().getEmail() != null) {
|
||||
ourLog.info("Enabling email subscriptions");
|
||||
daoConfig.addSupportedSubscriptionType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.EMAIL);
|
||||
jpaStorageSettings.addSupportedSubscriptionType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.EMAIL);
|
||||
}
|
||||
if (appProperties.getSubscription().getWebsocket_enabled()) {
|
||||
ourLog.info("Enabling websocket subscriptions");
|
||||
daoConfig.addSupportedSubscriptionType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET);
|
||||
jpaStorageSettings.addSupportedSubscriptionType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET);
|
||||
}
|
||||
}
|
||||
|
||||
daoConfig.setFilterParameterEnabled(appProperties.getFilter_search_enabled());
|
||||
daoConfig.setAdvancedHSearchIndexing(appProperties.getAdvanced_lucene_indexing());
|
||||
daoConfig.setTreatBaseUrlsAsLocal(new HashSet<>(appProperties.getLocal_base_urls()));
|
||||
jpaStorageSettings.setFilterParameterEnabled(appProperties.getFilter_search_enabled());
|
||||
jpaStorageSettings.setAdvancedHSearchIndexing(appProperties.getAdvanced_lucene_indexing());
|
||||
jpaStorageSettings.setTreatBaseUrlsAsLocal(new HashSet<>(appProperties.getLocal_base_urls()));
|
||||
|
||||
if (appProperties.getLastn_enabled()) {
|
||||
daoConfig.setLastNEnabled(true);
|
||||
jpaStorageSettings.setLastNEnabled(true);
|
||||
}
|
||||
|
||||
if(appProperties.getInline_resource_storage_below_size() != 0){
|
||||
daoConfig.setInlineResourceTextBelowSize(appProperties.getInline_resource_storage_below_size());
|
||||
jpaStorageSettings.setInlineResourceTextBelowSize(appProperties.getInline_resource_storage_below_size());
|
||||
}
|
||||
|
||||
daoConfig.setStoreResourceInHSearchIndex(appProperties.getStore_resource_in_lucene_index_enabled());
|
||||
daoConfig.getModelConfig().setNormalizedQuantitySearchLevel(appProperties.getNormalized_quantity_search_level());
|
||||
daoConfig.getModelConfig().setIndexOnContainedResources(appProperties.getEnable_index_contained_resource());
|
||||
jpaStorageSettings.setStoreResourceInHSearchIndex(appProperties.getStore_resource_in_lucene_index_enabled());
|
||||
jpaStorageSettings.setNormalizedQuantitySearchLevel(appProperties.getNormalized_quantity_search_level());
|
||||
jpaStorageSettings.setIndexOnContainedResources(appProperties.getEnable_index_contained_resource());
|
||||
|
||||
|
||||
|
||||
if (appProperties.getAllowed_bundle_types() != null) {
|
||||
daoConfig.setBundleTypesAllowedForStorage(appProperties.getAllowed_bundle_types().stream().map(BundleType::toCode).collect(Collectors.toSet()));
|
||||
jpaStorageSettings.setBundleTypesAllowedForStorage(appProperties.getAllowed_bundle_types().stream().map(BundleType::toCode).collect(Collectors.toSet()));
|
||||
}
|
||||
|
||||
daoConfig.setDeferIndexingForCodesystemsOfSize(appProperties.getDefer_indexing_for_codesystems_of_size());
|
||||
jpaStorageSettings.setDeferIndexingForCodesystemsOfSize(appProperties.getDefer_indexing_for_codesystems_of_size());
|
||||
|
||||
|
||||
if (appProperties.getClient_id_strategy() == DaoConfig.ClientIdStrategyEnum.ANY) {
|
||||
daoConfig.setResourceServerIdStrategy(DaoConfig.IdStrategyEnum.UUID);
|
||||
daoConfig.setResourceClientIdStrategy(appProperties.getClient_id_strategy());
|
||||
if (appProperties.getClient_id_strategy() == JpaStorageSettings.ClientIdStrategyEnum.ANY) {
|
||||
jpaStorageSettings.setResourceServerIdStrategy(JpaStorageSettings.IdStrategyEnum.UUID);
|
||||
jpaStorageSettings.setResourceClientIdStrategy(appProperties.getClient_id_strategy());
|
||||
}
|
||||
//Parallel Batch GET execution settings
|
||||
daoConfig.setBundleBatchPoolSize(appProperties.getBundle_batch_pool_size());
|
||||
daoConfig.setBundleBatchMaxPoolSize(appProperties.getBundle_batch_pool_max_size());
|
||||
jpaStorageSettings.setBundleBatchPoolSize(appProperties.getBundle_batch_pool_size());
|
||||
jpaStorageSettings.setBundleBatchPoolSize(appProperties.getBundle_batch_pool_max_size());
|
||||
|
||||
return daoConfig;
|
||||
storageSettings(appProperties, jpaStorageSettings);
|
||||
return jpaStorageSettings;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -191,20 +192,19 @@ public class FhirServerConfigCommon {
|
||||
return new JpaHibernatePropertiesProvider(myEntityManagerFactory);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ModelConfig modelConfig(AppProperties appProperties, DaoConfig daoConfig) {
|
||||
ModelConfig modelConfig = daoConfig.getModelConfig();
|
||||
modelConfig.setAllowContainsSearches(appProperties.getAllow_contains_searches());
|
||||
modelConfig.setAllowExternalReferences(appProperties.getAllow_external_references());
|
||||
modelConfig.setDefaultSearchParamsCanBeOverridden(appProperties.getAllow_override_default_search_params());
|
||||
|
||||
protected StorageSettings storageSettings(AppProperties appProperties, JpaStorageSettings jpaStorageSettings) {
|
||||
jpaStorageSettings.setAllowContainsSearches(appProperties.getAllow_contains_searches());
|
||||
jpaStorageSettings.setAllowExternalReferences(appProperties.getAllow_external_references());
|
||||
jpaStorageSettings.setDefaultSearchParamsCanBeOverridden(appProperties.getAllow_override_default_search_params());
|
||||
if(appProperties.getSubscription() != null && appProperties.getSubscription().getEmail() != null)
|
||||
modelConfig.setEmailFromAddress(appProperties.getSubscription().getEmail().getFrom());
|
||||
jpaStorageSettings.setEmailFromAddress(appProperties.getSubscription().getEmail().getFrom());
|
||||
|
||||
modelConfig.setNormalizedQuantitySearchLevel(appProperties.getNormalized_quantity_search_level());
|
||||
jpaStorageSettings.setNormalizedQuantitySearchLevel(appProperties.getNormalized_quantity_search_level());
|
||||
|
||||
modelConfig.setIndexOnContainedResources(appProperties.getEnable_index_contained_resource());
|
||||
modelConfig.setIndexIdentifierOfType(appProperties.getEnable_index_of_type());
|
||||
return modelConfig;
|
||||
jpaStorageSettings.setIndexOnContainedResources(appProperties.getEnable_index_contained_resource());
|
||||
jpaStorageSettings.setIndexIdentifierOfType(appProperties.getEnable_index_of_type());
|
||||
return jpaStorageSettings;
|
||||
}
|
||||
|
||||
@Lazy
|
||||
@@ -220,25 +220,23 @@ public class FhirServerConfigCommon {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public IEmailSender emailSender(AppProperties appProperties, Optional<SubscriptionDeliveryHandlerFactory> subscriptionDeliveryHandlerFactory) {
|
||||
if (appProperties.getSubscription() != null && appProperties.getSubscription().getEmail() != null) {
|
||||
MailConfig mailConfig = new MailConfig();
|
||||
public IEmailSender emailSender(AppProperties appProperties) {
|
||||
if (appProperties.getSubscription() != null && appProperties.getSubscription().getEmail() != null) {
|
||||
MailConfig mailConfig = new MailConfig();
|
||||
|
||||
AppProperties.Subscription.Email email = appProperties.getSubscription().getEmail();
|
||||
mailConfig.setSmtpHostname(email.getHost());
|
||||
mailConfig.setSmtpPort(email.getPort());
|
||||
mailConfig.setSmtpUsername(email.getUsername());
|
||||
mailConfig.setSmtpPassword(email.getPassword());
|
||||
mailConfig.setSmtpUseStartTLS(email.getStartTlsEnable());
|
||||
AppProperties.Subscription.Email email = appProperties.getSubscription().getEmail();
|
||||
mailConfig.setSmtpHostname(email.getHost());
|
||||
mailConfig.setSmtpPort(email.getPort());
|
||||
mailConfig.setSmtpUsername(email.getUsername());
|
||||
mailConfig.setSmtpPassword(email.getPassword());
|
||||
mailConfig.setSmtpUseStartTLS(email.getStartTlsEnable());
|
||||
|
||||
IMailSvc mailSvc = new MailSvc(mailConfig);
|
||||
IEmailSender emailSender = new EmailSenderImpl(mailSvc);
|
||||
IMailSvc mailSvc = new MailSvc(mailConfig);
|
||||
IEmailSender emailSender = new EmailSenderImpl(mailSvc);
|
||||
|
||||
subscriptionDeliveryHandlerFactory.ifPresent(theSubscriptionDeliveryHandlerFactory -> theSubscriptionDeliveryHandlerFactory.setEmailSender(emailSender));
|
||||
return emailSender;
|
||||
}
|
||||
|
||||
return emailSender;
|
||||
}
|
||||
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package ca.uhn.fhir.jpa.starter.common;
|
||||
|
||||
import ca.uhn.fhir.jpa.config.r4b.JpaR4BConfig;
|
||||
import ca.uhn.fhir.jpa.starter.annotations.OnR4BCondition;
|
||||
import ca.uhn.fhir.jpa.topic.SubscriptionTopicConfig;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
@@ -10,6 +11,7 @@ import org.springframework.context.annotation.Import;
|
||||
@Conditional(OnR4BCondition.class)
|
||||
@Import({
|
||||
JpaR4BConfig.class,
|
||||
SubscriptionTopicConfig.class,
|
||||
StarterJpaConfig.class,
|
||||
ElasticsearchConfig.class
|
||||
})
|
||||
|
||||
@@ -2,6 +2,7 @@ package ca.uhn.fhir.jpa.starter.common;
|
||||
|
||||
import ca.uhn.fhir.jpa.config.r5.JpaR5Config;
|
||||
import ca.uhn.fhir.jpa.starter.annotations.OnR5Condition;
|
||||
import ca.uhn.fhir.jpa.topic.SubscriptionTopicConfig;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
@@ -11,6 +12,7 @@ import org.springframework.context.annotation.Import;
|
||||
@Import({
|
||||
StarterJpaConfig.class,
|
||||
JpaR5Config.class,
|
||||
SubscriptionTopicConfig.class,
|
||||
ElasticsearchConfig.class
|
||||
})
|
||||
public class FhirServerConfigR5 {
|
||||
|
||||
@@ -11,7 +11,7 @@ import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.context.support.IValidationSupport;
|
||||
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
|
||||
import ca.uhn.fhir.jpa.api.IDaoRegistry;
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
|
||||
import ca.uhn.fhir.jpa.api.config.ThreadPoolFactoryConfig;
|
||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
|
||||
@@ -241,7 +241,7 @@ public class StarterJpaConfig {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RestfulServer restfulServer(IFhirSystemDao<?, ?> fhirSystemDao, AppProperties appProperties, DaoRegistry daoRegistry, Optional<MdmProviderLoader> mdmProviderProvider, IJpaSystemProvider jpaSystemProvider, ResourceProviderFactory resourceProviderFactory, DaoConfig daoConfig, ISearchParamRegistry searchParamRegistry, IValidationSupport theValidationSupport, DatabaseBackedPagingProvider databaseBackedPagingProvider, LoggingInterceptor loggingInterceptor, Optional<TerminologyUploaderProvider> terminologyUploaderProvider, Optional<SubscriptionTriggeringProvider> subscriptionTriggeringProvider, Optional<CorsInterceptor> corsInterceptor, IInterceptorBroadcaster interceptorBroadcaster, Optional<BinaryAccessProvider> binaryAccessProvider, BinaryStorageInterceptor binaryStorageInterceptor, IValidatorModule validatorModule, Optional<GraphQLProvider> graphQLProvider, BulkDataExportProvider bulkDataExportProvider, BulkDataImportProvider bulkDataImportProvider, ValueSetOperationProvider theValueSetOperationProvider, ReindexProvider reindexProvider, PartitionManagementProvider partitionManagementProvider, Optional<RepositoryValidatingInterceptor> repositoryValidatingInterceptor, IPackageInstallerSvc packageInstallerSvc, ThreadSafeResourceDeleterSvc theThreadSafeResourceDeleterSvc, ApplicationContext appContext, Optional<IpsOperationProvider> theIpsOperationProvider) {
|
||||
public RestfulServer restfulServer(IFhirSystemDao<?, ?> fhirSystemDao, AppProperties appProperties, DaoRegistry daoRegistry, Optional<MdmProviderLoader> mdmProviderProvider, IJpaSystemProvider jpaSystemProvider, ResourceProviderFactory resourceProviderFactory, JpaStorageSettings jpaStorageSettings, ISearchParamRegistry searchParamRegistry, IValidationSupport theValidationSupport, DatabaseBackedPagingProvider databaseBackedPagingProvider, LoggingInterceptor loggingInterceptor, Optional<TerminologyUploaderProvider> terminologyUploaderProvider, Optional<SubscriptionTriggeringProvider> subscriptionTriggeringProvider, Optional<CorsInterceptor> corsInterceptor, IInterceptorBroadcaster interceptorBroadcaster, Optional<BinaryAccessProvider> binaryAccessProvider, BinaryStorageInterceptor binaryStorageInterceptor, IValidatorModule validatorModule, Optional<GraphQLProvider> graphQLProvider, BulkDataExportProvider bulkDataExportProvider, BulkDataImportProvider bulkDataImportProvider, ValueSetOperationProvider theValueSetOperationProvider, ReindexProvider reindexProvider, PartitionManagementProvider partitionManagementProvider, Optional<RepositoryValidatingInterceptor> repositoryValidatingInterceptor, IPackageInstallerSvc packageInstallerSvc, ThreadSafeResourceDeleterSvc theThreadSafeResourceDeleterSvc, ApplicationContext appContext, Optional<IpsOperationProvider> theIpsOperationProvider) {
|
||||
RestfulServer fhirServer = new RestfulServer(fhirSystemDao.getContext());
|
||||
|
||||
List<String> supportedResourceTypes = appProperties.getSupported_resource_types();
|
||||
@@ -263,7 +263,7 @@ public class StarterJpaConfig {
|
||||
|
||||
fhirServer.registerProviders(resourceProviderFactory.createProviders());
|
||||
fhirServer.registerProvider(jpaSystemProvider);
|
||||
fhirServer.setServerConformanceProvider(calculateConformanceProvider(fhirSystemDao, fhirServer, daoConfig, searchParamRegistry, theValidationSupport));
|
||||
fhirServer.setServerConformanceProvider(calculateConformanceProvider(fhirSystemDao, fhirServer, jpaStorageSettings, searchParamRegistry, theValidationSupport));
|
||||
|
||||
/*
|
||||
* ETag Support
|
||||
@@ -339,7 +339,7 @@ public class StarterJpaConfig {
|
||||
|
||||
corsInterceptor.ifPresent(fhirServer::registerInterceptor);
|
||||
|
||||
if (daoConfig.getSupportedSubscriptionTypes().size() > 0) {
|
||||
if (jpaStorageSettings.getSupportedSubscriptionTypes().size() > 0) {
|
||||
// Subscription debug logging
|
||||
fhirServer.registerInterceptor(new SubscriptionDebugLogInterceptor());
|
||||
}
|
||||
@@ -458,30 +458,30 @@ public class StarterJpaConfig {
|
||||
}
|
||||
}
|
||||
|
||||
public static IServerConformanceProvider<?> calculateConformanceProvider(IFhirSystemDao fhirSystemDao, RestfulServer fhirServer, DaoConfig daoConfig, ISearchParamRegistry searchParamRegistry, IValidationSupport theValidationSupport) {
|
||||
public static IServerConformanceProvider<?> calculateConformanceProvider(IFhirSystemDao fhirSystemDao, RestfulServer fhirServer, JpaStorageSettings jpaStorageSettings, ISearchParamRegistry searchParamRegistry, IValidationSupport theValidationSupport) {
|
||||
FhirVersionEnum fhirVersion = fhirSystemDao.getContext().getVersion().getVersion();
|
||||
if (fhirVersion == FhirVersionEnum.DSTU2) {
|
||||
JpaConformanceProviderDstu2 confProvider = new JpaConformanceProviderDstu2(fhirServer, fhirSystemDao, daoConfig);
|
||||
JpaConformanceProviderDstu2 confProvider = new JpaConformanceProviderDstu2(fhirServer, fhirSystemDao, jpaStorageSettings);
|
||||
confProvider.setImplementationDescription("HAPI FHIR DSTU2 Server");
|
||||
return confProvider;
|
||||
} else if (fhirVersion == FhirVersionEnum.DSTU3) {
|
||||
|
||||
JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(fhirServer, fhirSystemDao, daoConfig, searchParamRegistry);
|
||||
JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(fhirServer, fhirSystemDao, jpaStorageSettings, searchParamRegistry);
|
||||
confProvider.setImplementationDescription("HAPI FHIR DSTU3 Server");
|
||||
return confProvider;
|
||||
} else if (fhirVersion == FhirVersionEnum.R4) {
|
||||
|
||||
JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(fhirServer, fhirSystemDao, daoConfig, searchParamRegistry, theValidationSupport);
|
||||
JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(fhirServer, fhirSystemDao, jpaStorageSettings, searchParamRegistry, theValidationSupport);
|
||||
confProvider.setImplementationDescription("HAPI FHIR R4 Server");
|
||||
return confProvider;
|
||||
} else if (fhirVersion == FhirVersionEnum.R4B) {
|
||||
|
||||
JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(fhirServer, fhirSystemDao, daoConfig, searchParamRegistry, theValidationSupport);
|
||||
JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(fhirServer, fhirSystemDao, jpaStorageSettings, searchParamRegistry, theValidationSupport);
|
||||
confProvider.setImplementationDescription("HAPI FHIR R4B Server");
|
||||
return confProvider;
|
||||
} else if (fhirVersion == FhirVersionEnum.R5) {
|
||||
|
||||
JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(fhirServer, fhirSystemDao, daoConfig, searchParamRegistry, theValidationSupport);
|
||||
JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(fhirServer, fhirSystemDao, jpaStorageSettings, searchParamRegistry, theValidationSupport);
|
||||
confProvider.setImplementationDescription("HAPI FHIR R5 Server");
|
||||
return confProvider;
|
||||
} else {
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
"spring.datasource.url=jdbc:h2:mem:dbr5",
|
||||
"hapi.fhir.fhir_version=r5",
|
||||
"hapi.fhir.subscription.websocket_enabled=true",
|
||||
"hapi.fhir.subscription.websocket_enabled=true",
|
||||
"hapi.fhir.subscription.websocket_enabled=true"
|
||||
})
|
||||
public class ExampleServerR5IT {
|
||||
|
||||
@@ -45,7 +45,10 @@ public class ExampleServerR5IT {
|
||||
private IGenericClient ourClient;
|
||||
private FhirContext ourCtx;
|
||||
|
||||
@LocalServerPort
|
||||
public static final String SUBSCRIPTION_TOPIC_TEST_URL = "http://example.com/topic/test";
|
||||
|
||||
|
||||
@LocalServerPort
|
||||
private int port;
|
||||
|
||||
|
||||
@@ -64,32 +67,62 @@ public class ExampleServerR5IT {
|
||||
|
||||
@Test
|
||||
public void testWebsocketSubscription() throws Exception {
|
||||
|
||||
String endpoint = "ws://localhost:" + port + "/websocket";
|
||||
/*
|
||||
* Create topic (will be contained in subscription)
|
||||
* Create topic
|
||||
*/
|
||||
SubscriptionTopic topic = new SubscriptionTopic();
|
||||
topic.setId("#1");
|
||||
topic.getResourceTriggerFirstRep().getQueryCriteria().setCurrent("Observation?status=final");
|
||||
|
||||
/*
|
||||
topic.setUrl(SUBSCRIPTION_TOPIC_TEST_URL);
|
||||
topic.setStatus(Enumerations.PublicationStatus.ACTIVE);
|
||||
SubscriptionTopic.SubscriptionTopicResourceTriggerComponent trigger = topic.addResourceTrigger();
|
||||
trigger.setResource("Observation");
|
||||
trigger.addSupportedInteraction(SubscriptionTopic.InteractionTrigger.CREATE);
|
||||
trigger.addSupportedInteraction(SubscriptionTopic.InteractionTrigger.UPDATE);
|
||||
|
||||
ourClient.create().resource(topic).execute();
|
||||
|
||||
waitForSize(1, () -> ourClient
|
||||
.search()
|
||||
.forResource(SubscriptionTopic.class)
|
||||
.where(Subscription.STATUS.exactly().code("active"))
|
||||
.cacheControl(
|
||||
new CacheControlDirective()
|
||||
.setNoCache(true))
|
||||
.returnBundle(Bundle.class)
|
||||
.execute()
|
||||
.getEntry()
|
||||
.size());
|
||||
|
||||
/*
|
||||
* Create subscription
|
||||
*/
|
||||
Subscription subscription = new Subscription();
|
||||
subscription.getContained().add(topic);
|
||||
subscription.setTopic("#1");
|
||||
|
||||
subscription.setTopic(SUBSCRIPTION_TOPIC_TEST_URL);
|
||||
subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
|
||||
subscription.setStatus(Enumerations.SubscriptionStatusCodes.REQUESTED);
|
||||
subscription.getChannelType()
|
||||
.setSystem("http://terminology.hl7.org/CodeSystem/subscription-channel-type")
|
||||
.setCode("websocket");
|
||||
subscription.setContentType("application/json");
|
||||
subscription.setContentType("application/fhir+json");
|
||||
subscription.setEndpoint(endpoint);
|
||||
|
||||
MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
|
||||
IIdType mySubscriptionId = methodOutcome.getId();
|
||||
|
||||
// Wait for the subscription to be activated
|
||||
waitForSize(1, () -> ourClient.search().forResource(Subscription.class).where(Subscription.STATUS.exactly().code("active")).cacheControl(new CacheControlDirective().setNoCache(true)).returnBundle(Bundle.class).execute().getEntry().size());
|
||||
waitForSize(1, () -> ourClient
|
||||
.search()
|
||||
.forResource(Subscription.class)
|
||||
.where(Subscription.STATUS.exactly().code("active"))
|
||||
.cacheControl(
|
||||
new CacheControlDirective()
|
||||
.setNoCache(true))
|
||||
.returnBundle(Bundle.class)
|
||||
.execute()
|
||||
.getEntry()
|
||||
.size());
|
||||
|
||||
/*
|
||||
* Attach websocket
|
||||
@@ -99,8 +132,9 @@ public class ExampleServerR5IT {
|
||||
SocketImplementation mySocketImplementation = new SocketImplementation(mySubscriptionId.getIdPart(), EncodingEnum.JSON);
|
||||
|
||||
myWebSocketClient.start();
|
||||
URI echoUri = new URI("ws://localhost:" + port + "/websocket");
|
||||
ClientUpgradeRequest request = new ClientUpgradeRequest();
|
||||
|
||||
URI echoUri = new URI(endpoint);
|
||||
ClientUpgradeRequest request = new ClientUpgradeRequest();
|
||||
ourLog.info("Connecting to : {}", echoUri);
|
||||
Future<Session> connection = myWebSocketClient.connect(mySocketImplementation, echoUri, request);
|
||||
Session session = connection.get(2, TimeUnit.SECONDS);
|
||||
|
||||
Reference in New Issue
Block a user