Skip to content

Commit

Permalink
Bump HAPI to release 6.6.0 (#539)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: Kevin Dougan SmileCDR <[email protected]>
Co-authored-by: Ken Stevens <[email protected]>
Co-authored-by: Mark Iantorno <[email protected]>
  • Loading branch information
5 people authored May 29, 2023
1 parent eb65ec6 commit 53a958a
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 92 deletions.
14 changes: 12 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.4.4</version>
<version>6.6.0</version>
</parent>

<artifactId>hapi-fhir-jpaserver-starter</artifactId>
Expand Down Expand Up @@ -62,7 +62,17 @@
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
</dependency>

<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>2.3.3</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-ri</artifactId>
<version>2.3.5</version>
<type>pom</type>
</dependency>
<!-- Needed for Email subscriptions -->
<dependency>
<groupId>org.simplejavamail</groupId>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -17,7 +17,7 @@
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;
Expand Down Expand Up @@ -81,84 +81,85 @@ public FhirServerConfigCommon(AppProperties appProperties) {
* Configure FHIR properties around the the JPA server via this bean
*/
@Bean
public DaoConfig daoConfig(AppProperties appProperties) {
DaoConfig daoConfig = new DaoConfig();

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());
public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
JpaStorageSettings jpaStorageSettings = new JpaStorageSettings();

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
Expand Down Expand Up @@ -191,20 +192,19 @@ public HibernatePropertiesProvider jpaStarterDialectProvider(LocalContainerEntit
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
Expand All @@ -220,25 +220,23 @@ public IBinaryStorageSvc binaryStorageSvc(AppProperties appProperties) {
}

@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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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;
Expand All @@ -10,6 +11,7 @@
@Conditional(OnR4BCondition.class)
@Import({
JpaR4BConfig.class,
SubscriptionTopicConfig.class,
StarterJpaConfig.class,
ElasticsearchConfig.class
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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;
Expand All @@ -11,6 +12,7 @@
@Import({
StarterJpaConfig.class,
JpaR5Config.class,
SubscriptionTopicConfig.class,
ElasticsearchConfig.class
})
public class FhirServerConfigR5 {
Expand Down
Loading

0 comments on commit 53a958a

Please sign in to comment.