6
6
import ca .uhn .fhir .jpa .config .HibernatePropertiesProvider ;
7
7
import ca .uhn .fhir .jpa .model .config .PartitionSettings ;
8
8
import ca .uhn .fhir .jpa .model .config .PartitionSettings .CrossPartitionReferenceMode ;
9
+ import ca .uhn .fhir .jpa .model .config .SubscriptionSettings ;
9
10
import ca .uhn .fhir .jpa .model .entity .StorageSettings ;
10
11
import ca .uhn .fhir .jpa .starter .AppProperties ;
11
12
import ca .uhn .fhir .jpa .starter .util .JpaHibernatePropertiesProvider ;
@@ -87,6 +88,40 @@ public FhirServerConfigCommon(AppProperties appProperties) {
87
88
}
88
89
}
89
90
91
+ @ Bean
92
+ public SubscriptionSettings subscriptionSettings (AppProperties appProperties ) {
93
+ SubscriptionSettings subscriptionSettings = new SubscriptionSettings ();
94
+ if (appProperties .getSubscription () != null ) {
95
+ if (appProperties .getSubscription ().getEmail () != null )
96
+ subscriptionSettings .setEmailFromAddress (
97
+ appProperties .getSubscription ().getEmail ().getFrom ());
98
+
99
+ // Subscriptions are enabled by channel type
100
+ if (appProperties .getSubscription ().getResthook_enabled ()) {
101
+ ourLog .info ("Enabling REST-hook subscriptions" );
102
+ subscriptionSettings .addSupportedSubscriptionType (
103
+ org .hl7 .fhir .dstu2 .model .Subscription .SubscriptionChannelType .RESTHOOK );
104
+ }
105
+ if (appProperties .getSubscription ().getEmail () != null ) {
106
+ ourLog .info ("Enabling email subscriptions" );
107
+ subscriptionSettings .addSupportedSubscriptionType (
108
+ org .hl7 .fhir .dstu2 .model .Subscription .SubscriptionChannelType .EMAIL );
109
+ }
110
+ if (appProperties .getSubscription ().getWebsocket_enabled ()) {
111
+ ourLog .info ("Enabling websocket subscriptions" );
112
+ subscriptionSettings .addSupportedSubscriptionType (
113
+ org .hl7 .fhir .dstu2 .model .Subscription .SubscriptionChannelType .WEBSOCKET );
114
+ }
115
+
116
+ }
117
+ if (appProperties .getMdm_enabled ()) {
118
+ // MDM requires the subscription of type message
119
+ ourLog .info ("Enabling message subscriptions" );
120
+ subscriptionSettings .addSupportedSubscriptionType (
121
+ org .hl7 .fhir .dstu2 .model .Subscription .SubscriptionChannelType .MESSAGE );
122
+ }
123
+ return subscriptionSettings ;
124
+ }
90
125
/**
91
126
* Configure FHIR properties around the JPA server via this bean
92
127
*/
@@ -114,10 +149,7 @@ public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
114
149
jpaStorageSettings .setDeleteExpungeEnabled (appProperties .getDelete_expunge_enabled ());
115
150
jpaStorageSettings .setExpungeEnabled (appProperties .getExpunge_enabled ());
116
151
jpaStorageSettings .setLanguageSearchParameterEnabled (appProperties .getLanguage_search_parameter_enabled ());
117
- if (appProperties .getSubscription () != null
118
- && appProperties .getSubscription ().getEmail () != null )
119
- jpaStorageSettings .setEmailFromAddress (
120
- appProperties .getSubscription ().getEmail ().getFrom ());
152
+
121
153
122
154
Integer maxFetchSize = appProperties .getMax_page_size ();
123
155
jpaStorageSettings .setFetchSizeDefaultMaximum (maxFetchSize );
@@ -131,24 +163,7 @@ public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
131
163
Long retainCachedSearchesMinutes = appProperties .getRetain_cached_searches_mins ();
132
164
jpaStorageSettings .setExpireSearchResultsAfterMillis (retainCachedSearchesMinutes * 60 * 1000 );
133
165
134
- if (appProperties .getSubscription () != null ) {
135
- // Subscriptions are enabled by channel type
136
- if (appProperties .getSubscription ().getResthook_enabled ()) {
137
- ourLog .info ("Enabling REST-hook subscriptions" );
138
- jpaStorageSettings .addSupportedSubscriptionType (
139
- org .hl7 .fhir .dstu2 .model .Subscription .SubscriptionChannelType .RESTHOOK );
140
- }
141
- if (appProperties .getSubscription ().getEmail () != null ) {
142
- ourLog .info ("Enabling email subscriptions" );
143
- jpaStorageSettings .addSupportedSubscriptionType (
144
- org .hl7 .fhir .dstu2 .model .Subscription .SubscriptionChannelType .EMAIL );
145
- }
146
- if (appProperties .getSubscription ().getWebsocket_enabled ()) {
147
- ourLog .info ("Enabling websocket subscriptions" );
148
- jpaStorageSettings .addSupportedSubscriptionType (
149
- org .hl7 .fhir .dstu2 .model .Subscription .SubscriptionChannelType .WEBSOCKET );
150
- }
151
- }
166
+
152
167
153
168
jpaStorageSettings .setFilterParameterEnabled (appProperties .getFilter_search_enabled ());
154
169
jpaStorageSettings .setAdvancedHSearchIndexing (appProperties .getAdvanced_lucene_indexing ());
@@ -204,13 +219,6 @@ public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
204
219
jpaStorageSettings .setBundleBatchPoolSize (appProperties .getBundle_batch_pool_size ());
205
220
jpaStorageSettings .setBundleBatchPoolSize (appProperties .getBundle_batch_pool_max_size ());
206
221
207
- if (appProperties .getMdm_enabled ()) {
208
- // MDM requires the subscription of type message
209
- ourLog .info ("Enabling message subscriptions" );
210
- jpaStorageSettings .addSupportedSubscriptionType (
211
- org .hl7 .fhir .dstu2 .model .Subscription .SubscriptionChannelType .MESSAGE );
212
- }
213
-
214
222
storageSettings (appProperties , jpaStorageSettings );
215
223
return jpaStorageSettings ;
216
224
}
@@ -251,10 +259,6 @@ protected StorageSettings storageSettings(AppProperties appProperties, JpaStorag
251
259
jpaStorageSettings .setAllowExternalReferences (appProperties .getAllow_external_references ());
252
260
jpaStorageSettings .setDefaultSearchParamsCanBeOverridden (
253
261
appProperties .getAllow_override_default_search_params ());
254
- if (appProperties .getSubscription () != null
255
- && appProperties .getSubscription ().getEmail () != null )
256
- jpaStorageSettings .setEmailFromAddress (
257
- appProperties .getSubscription ().getEmail ().getFrom ());
258
262
259
263
jpaStorageSettings .setNormalizedQuantitySearchLevel (appProperties .getNormalized_quantity_search_level ());
260
264
0 commit comments