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
*/
@@ -112,10 +147,7 @@ public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
112
147
jpaStorageSettings .setDeleteExpungeEnabled (appProperties .getDelete_expunge_enabled ());
113
148
jpaStorageSettings .setExpungeEnabled (appProperties .getExpunge_enabled ());
114
149
jpaStorageSettings .setLanguageSearchParameterEnabled (appProperties .getLanguage_search_parameter_enabled ());
115
- if (appProperties .getSubscription () != null
116
- && appProperties .getSubscription ().getEmail () != null )
117
- jpaStorageSettings .setEmailFromAddress (
118
- appProperties .getSubscription ().getEmail ().getFrom ());
150
+
119
151
120
152
Integer maxFetchSize = appProperties .getMax_page_size ();
121
153
jpaStorageSettings .setFetchSizeDefaultMaximum (maxFetchSize );
@@ -129,24 +161,7 @@ public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
129
161
Long retainCachedSearchesMinutes = appProperties .getRetain_cached_searches_mins ();
130
162
jpaStorageSettings .setExpireSearchResultsAfterMillis (retainCachedSearchesMinutes * 60 * 1000 );
131
163
132
- if (appProperties .getSubscription () != null ) {
133
- // Subscriptions are enabled by channel type
134
- if (appProperties .getSubscription ().getResthook_enabled ()) {
135
- ourLog .info ("Enabling REST-hook subscriptions" );
136
- jpaStorageSettings .addSupportedSubscriptionType (
137
- org .hl7 .fhir .dstu2 .model .Subscription .SubscriptionChannelType .RESTHOOK );
138
- }
139
- if (appProperties .getSubscription ().getEmail () != null ) {
140
- ourLog .info ("Enabling email subscriptions" );
141
- jpaStorageSettings .addSupportedSubscriptionType (
142
- org .hl7 .fhir .dstu2 .model .Subscription .SubscriptionChannelType .EMAIL );
143
- }
144
- if (appProperties .getSubscription ().getWebsocket_enabled ()) {
145
- ourLog .info ("Enabling websocket subscriptions" );
146
- jpaStorageSettings .addSupportedSubscriptionType (
147
- org .hl7 .fhir .dstu2 .model .Subscription .SubscriptionChannelType .WEBSOCKET );
148
- }
149
- }
164
+
150
165
151
166
jpaStorageSettings .setFilterParameterEnabled (appProperties .getFilter_search_enabled ());
152
167
jpaStorageSettings .setAdvancedHSearchIndexing (appProperties .getAdvanced_lucene_indexing ());
@@ -202,13 +217,6 @@ public JpaStorageSettings jpaStorageSettings(AppProperties appProperties) {
202
217
jpaStorageSettings .setBundleBatchPoolSize (appProperties .getBundle_batch_pool_size ());
203
218
jpaStorageSettings .setBundleBatchPoolSize (appProperties .getBundle_batch_pool_max_size ());
204
219
205
- if (appProperties .getMdm_enabled ()) {
206
- // MDM requires the subscription of type message
207
- ourLog .info ("Enabling message subscriptions" );
208
- jpaStorageSettings .addSupportedSubscriptionType (
209
- org .hl7 .fhir .dstu2 .model .Subscription .SubscriptionChannelType .MESSAGE );
210
- }
211
-
212
220
storageSettings (appProperties , jpaStorageSettings );
213
221
return jpaStorageSettings ;
214
222
}
@@ -249,10 +257,6 @@ protected StorageSettings storageSettings(AppProperties appProperties, JpaStorag
249
257
jpaStorageSettings .setAllowExternalReferences (appProperties .getAllow_external_references ());
250
258
jpaStorageSettings .setDefaultSearchParamsCanBeOverridden (
251
259
appProperties .getAllow_override_default_search_params ());
252
- if (appProperties .getSubscription () != null
253
- && appProperties .getSubscription ().getEmail () != null )
254
- jpaStorageSettings .setEmailFromAddress (
255
- appProperties .getSubscription ().getEmail ().getFrom ());
256
260
257
261
jpaStorageSettings .setNormalizedQuantitySearchLevel (appProperties .getNormalized_quantity_search_level ());
258
262
0 commit comments