Allow all client_id_strategy options and add server_id_strategy (#653)
This commit is contained in:
@@ -3,6 +3,7 @@ package ca.uhn.fhir.jpa.starter;
|
|||||||
|
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||||
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings.ClientIdStrategyEnum;
|
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings.ClientIdStrategyEnum;
|
||||||
|
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings.IdStrategyEnum;
|
||||||
import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel;
|
import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel;
|
||||||
import ca.uhn.fhir.jpa.packages.PackageInstallationSpec;
|
import ca.uhn.fhir.jpa.packages.PackageInstallationSpec;
|
||||||
import ca.uhn.fhir.rest.api.EncodingEnum;
|
import ca.uhn.fhir.rest.api.EncodingEnum;
|
||||||
@@ -65,6 +66,7 @@ public class AppProperties {
|
|||||||
private EncodingEnum default_encoding = EncodingEnum.JSON;
|
private EncodingEnum default_encoding = EncodingEnum.JSON;
|
||||||
private FhirVersionEnum fhir_version = FhirVersionEnum.R4;
|
private FhirVersionEnum fhir_version = FhirVersionEnum.R4;
|
||||||
private ClientIdStrategyEnum client_id_strategy = ClientIdStrategyEnum.ALPHANUMERIC;
|
private ClientIdStrategyEnum client_id_strategy = ClientIdStrategyEnum.ALPHANUMERIC;
|
||||||
|
private IdStrategyEnum server_id_strategy = null;
|
||||||
private List<String> supported_resource_types = new ArrayList<>();
|
private List<String> supported_resource_types = new ArrayList<>();
|
||||||
private List<Bundle.BundleType> allowed_bundle_types = null;
|
private List<Bundle.BundleType> allowed_bundle_types = null;
|
||||||
private Boolean narrative_enabled = true;
|
private Boolean narrative_enabled = true;
|
||||||
@@ -263,6 +265,14 @@ public Cors getCors() {
|
|||||||
this.client_id_strategy = client_id_strategy;
|
this.client_id_strategy = client_id_strategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IdStrategyEnum getServer_id_strategy() {
|
||||||
|
return server_id_strategy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setServer_id_strategy(IdStrategyEnum server_id_strategy) {
|
||||||
|
this.server_id_strategy = server_id_strategy;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getAdvanced_lucene_indexing() {
|
public boolean getAdvanced_lucene_indexing() {
|
||||||
return this.advanced_lucene_indexing;
|
return this.advanced_lucene_indexing;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,10 +174,27 @@ public class FhirServerConfigCommon {
|
|||||||
jpaStorageSettings.setDeferIndexingForCodesystemsOfSize(
|
jpaStorageSettings.setDeferIndexingForCodesystemsOfSize(
|
||||||
appProperties.getDefer_indexing_for_codesystems_of_size());
|
appProperties.getDefer_indexing_for_codesystems_of_size());
|
||||||
|
|
||||||
if (appProperties.getClient_id_strategy() == JpaStorageSettings.ClientIdStrategyEnum.ANY) {
|
|
||||||
jpaStorageSettings.setResourceServerIdStrategy(JpaStorageSettings.IdStrategyEnum.UUID);
|
|
||||||
jpaStorageSettings.setResourceClientIdStrategy(appProperties.getClient_id_strategy());
|
jpaStorageSettings.setResourceClientIdStrategy(appProperties.getClient_id_strategy());
|
||||||
|
ourLog.info("Server configured to use '" + appProperties.getClient_id_strategy() + "' Client ID Strategy");
|
||||||
|
|
||||||
|
// Set and/or recommend default Server ID Strategy of UUID when using the ANY Client ID Strategy
|
||||||
|
if (appProperties.getClient_id_strategy() == JpaStorageSettings.ClientIdStrategyEnum.ANY) {
|
||||||
|
if (appProperties.getServer_id_strategy() == null) {
|
||||||
|
ourLog.info("Defaulting server to use '" + JpaStorageSettings.IdStrategyEnum.UUID
|
||||||
|
+ "' Server ID Strategy when using the '" + JpaStorageSettings.ClientIdStrategyEnum.ANY
|
||||||
|
+ "' Client ID Strategy");
|
||||||
|
appProperties.setServer_id_strategy(JpaStorageSettings.IdStrategyEnum.UUID);
|
||||||
|
} else if (appProperties.getServer_id_strategy() != JpaStorageSettings.IdStrategyEnum.UUID) {
|
||||||
|
ourLog.warn("WARNING: '" + JpaStorageSettings.IdStrategyEnum.UUID
|
||||||
|
+ "' Server ID Strategy is highly recommended when using the '"
|
||||||
|
+ JpaStorageSettings.ClientIdStrategyEnum.ANY + "' Client ID Strategy");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (appProperties.getServer_id_strategy() != null) {
|
||||||
|
jpaStorageSettings.setResourceServerIdStrategy(appProperties.getServer_id_strategy());
|
||||||
|
ourLog.info("Server configured to use '" + appProperties.getServer_id_strategy() + "' Server ID Strategy");
|
||||||
|
}
|
||||||
|
|
||||||
// Parallel Batch GET execution settings
|
// Parallel Batch GET execution settings
|
||||||
jpaStorageSettings.setBundleBatchPoolSize(appProperties.getBundle_batch_pool_size());
|
jpaStorageSettings.setBundleBatchPoolSize(appProperties.getBundle_batch_pool_size());
|
||||||
jpaStorageSettings.setBundleBatchPoolSize(appProperties.getBundle_batch_pool_max_size());
|
jpaStorageSettings.setBundleBatchPoolSize(appProperties.getBundle_batch_pool_max_size());
|
||||||
|
|||||||
@@ -139,6 +139,7 @@ hapi:
|
|||||||
# etag_support_enabled: true
|
# etag_support_enabled: true
|
||||||
# expunge_enabled: true
|
# expunge_enabled: true
|
||||||
# client_id_strategy: ALPHANUMERIC
|
# client_id_strategy: ALPHANUMERIC
|
||||||
|
# server_id_strategy: SEQUENTIAL_NUMERIC
|
||||||
# fhirpath_interceptor_enabled: false
|
# fhirpath_interceptor_enabled: false
|
||||||
# filter_search_enabled: true
|
# filter_search_enabled: true
|
||||||
# graphql_enabled: true
|
# graphql_enabled: true
|
||||||
|
|||||||
Reference in New Issue
Block a user