@@ -1,5 +1,6 @@
|
||||
package ca.uhn.fhir.jpa.starter;
|
||||
|
||||
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings.ClientIdStrategyEnum;
|
||||
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings.IdStrategyEnum;
|
||||
@@ -88,8 +89,7 @@ public class AppProperties {
|
||||
|
||||
private Boolean lastn_enabled = false;
|
||||
private boolean store_resource_in_lucene_index_enabled = false;
|
||||
private NormalizedQuantitySearchLevel normalized_quantity_search_level =
|
||||
NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED;
|
||||
private NormalizedQuantitySearchLevel normalized_quantity_search_level = NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED;
|
||||
|
||||
private Boolean use_apache_address_strategy = false;
|
||||
private Boolean use_apache_address_strategy_https = false;
|
||||
@@ -118,6 +118,7 @@ public class AppProperties {
|
||||
return custom_provider_classes;
|
||||
}
|
||||
|
||||
|
||||
public Boolean getOpenapi_enabled() {
|
||||
return openapi_enabled;
|
||||
}
|
||||
@@ -182,6 +183,7 @@ public class AppProperties {
|
||||
this.ips_enabled = ips_enabled;
|
||||
}
|
||||
|
||||
|
||||
public Boolean getMdm_enabled() {
|
||||
return mdm_enabled;
|
||||
}
|
||||
@@ -192,13 +194,13 @@ public class AppProperties {
|
||||
|
||||
public String getMdm_rules_json_location() {
|
||||
return mdm_rules_json_location;
|
||||
}
|
||||
}
|
||||
|
||||
public void setMdm_rules_json_location(String mdm_rules_json_location) {
|
||||
public void setMdm_rules_json_location(String mdm_rules_json_location) {
|
||||
this.mdm_rules_json_location = mdm_rules_json_location;
|
||||
}
|
||||
}
|
||||
|
||||
public Cors getCors() {
|
||||
public Cors getCors() {
|
||||
return cors;
|
||||
}
|
||||
|
||||
@@ -266,7 +268,8 @@ public class AppProperties {
|
||||
return client_id_strategy;
|
||||
}
|
||||
|
||||
public void setClient_id_strategy(ClientIdStrategyEnum client_id_strategy) {
|
||||
public void setClient_id_strategy(
|
||||
ClientIdStrategyEnum client_id_strategy) {
|
||||
this.client_id_strategy = client_id_strategy;
|
||||
}
|
||||
|
||||
@@ -322,7 +325,8 @@ public class AppProperties {
|
||||
return allow_override_default_search_params;
|
||||
}
|
||||
|
||||
public void setAllow_override_default_search_params(Boolean allow_override_default_search_params) {
|
||||
public void setAllow_override_default_search_params(
|
||||
Boolean allow_override_default_search_params) {
|
||||
this.allow_override_default_search_params = allow_override_default_search_params;
|
||||
}
|
||||
|
||||
@@ -338,7 +342,8 @@ public class AppProperties {
|
||||
return auto_create_placeholder_reference_targets;
|
||||
}
|
||||
|
||||
public void setAuto_create_placeholder_reference_targets(Boolean auto_create_placeholder_reference_targets) {
|
||||
public void setAuto_create_placeholder_reference_targets(
|
||||
Boolean auto_create_placeholder_reference_targets) {
|
||||
this.auto_create_placeholder_reference_targets = auto_create_placeholder_reference_targets;
|
||||
}
|
||||
|
||||
@@ -398,7 +403,8 @@ public class AppProperties {
|
||||
return enforce_referential_integrity_on_delete;
|
||||
}
|
||||
|
||||
public void setEnforce_referential_integrity_on_delete(Boolean enforce_referential_integrity_on_delete) {
|
||||
public void setEnforce_referential_integrity_on_delete(
|
||||
Boolean enforce_referential_integrity_on_delete) {
|
||||
this.enforce_referential_integrity_on_delete = enforce_referential_integrity_on_delete;
|
||||
}
|
||||
|
||||
@@ -406,7 +412,8 @@ public class AppProperties {
|
||||
return enforce_referential_integrity_on_write;
|
||||
}
|
||||
|
||||
public void setEnforce_referential_integrity_on_write(Boolean enforce_referential_integrity_on_write) {
|
||||
public void setEnforce_referential_integrity_on_write(
|
||||
Boolean enforce_referential_integrity_on_write) {
|
||||
this.enforce_referential_integrity_on_write = enforce_referential_integrity_on_write;
|
||||
}
|
||||
|
||||
@@ -542,11 +549,13 @@ public class AppProperties {
|
||||
this.tester = tester;
|
||||
}
|
||||
|
||||
public Boolean getNarrative_enabled() {
|
||||
public Boolean getNarrative_enabled()
|
||||
{
|
||||
return narrative_enabled;
|
||||
}
|
||||
|
||||
public void setNarrative_enabled(Boolean narrative_enabled) {
|
||||
public void setNarrative_enabled(Boolean narrative_enabled)
|
||||
{
|
||||
this.narrative_enabled = narrative_enabled;
|
||||
}
|
||||
|
||||
@@ -614,6 +623,7 @@ public class AppProperties {
|
||||
return logical_urls;
|
||||
}
|
||||
|
||||
|
||||
public Boolean getIg_runtime_upload_enabled() {
|
||||
return ig_runtime_upload_enabled;
|
||||
}
|
||||
@@ -666,8 +676,7 @@ public class AppProperties {
|
||||
return userRequestRetryVersionConflictsInterceptorEnabled;
|
||||
}
|
||||
|
||||
public void setUserRequestRetryVersionConflictsInterceptorEnabled(
|
||||
Boolean userRequestRetryVersionConflictsInterceptorEnabled) {
|
||||
public void setUserRequestRetryVersionConflictsInterceptorEnabled(Boolean userRequestRetryVersionConflictsInterceptorEnabled) {
|
||||
this.userRequestRetryVersionConflictsInterceptorEnabled = userRequestRetryVersionConflictsInterceptorEnabled;
|
||||
}
|
||||
|
||||
@@ -696,8 +705,7 @@ public class AppProperties {
|
||||
|
||||
private String name = "fhirtest.access";
|
||||
private String error_format = "ERROR - ${requestVerb} ${requestUrl}";
|
||||
private String format =
|
||||
"Path[${servletPath}] Source[${requestHeader.x-forwarded-for}] Operation[${operationType} ${operationName} ${idOrResourceName}] UA[${requestHeader.user-agent}] Params[${requestParameters}] ResponseEncoding[${responseEncodingNoDefault}] Operation[${operationType} ${operationName} ${idOrResourceName}] UA[${requestHeader.user-agent}] Params[${requestParameters}] ResponseEncoding[${responseEncodingNoDefault}]";
|
||||
private String format = "Path[${servletPath}] Source[${requestHeader.x-forwarded-for}] Operation[${operationType} ${operationName} ${idOrResourceName}] UA[${requestHeader.user-agent}] Params[${requestParameters}] ResponseEncoding[${responseEncodingNoDefault}] Operation[${operationType} ${operationName} ${idOrResourceName}] UA[${requestHeader.user-agent}] Params[${requestParameters}] ResponseEncoding[${responseEncodingNoDefault}]";
|
||||
private Boolean log_exceptions = true;
|
||||
|
||||
public String getName() {
|
||||
@@ -733,6 +741,7 @@ public class AppProperties {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class Tester {
|
||||
|
||||
private String name;
|
||||
@@ -773,6 +782,7 @@ public class AppProperties {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class Validation {
|
||||
|
||||
private Boolean requests_enabled = false;
|
||||
@@ -836,7 +846,6 @@ public class AppProperties {
|
||||
public void setPartitioning_include_in_search_hashes(Boolean partitioning_include_in_search_hashes) {
|
||||
this.partitioning_include_in_search_hashes = partitioning_include_in_search_hashes;
|
||||
}
|
||||
|
||||
public Boolean getAllow_references_across_partitions() {
|
||||
return allow_references_across_partitions;
|
||||
}
|
||||
@@ -849,8 +858,7 @@ public class AppProperties {
|
||||
return conditional_create_duplicate_identifiers_enabled;
|
||||
}
|
||||
|
||||
public void setConditional_create_duplicate_identifiers_enabled(
|
||||
Boolean conditional_create_duplicate_identifiers_enabled) {
|
||||
public void setConditional_create_duplicate_identifiers_enabled(Boolean conditional_create_duplicate_identifiers_enabled) {
|
||||
this.conditional_create_duplicate_identifiers_enabled = conditional_create_duplicate_identifiers_enabled;
|
||||
}
|
||||
|
||||
@@ -889,6 +897,7 @@ public class AppProperties {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
|
||||
public static class Email {
|
||||
public String getFrom() {
|
||||
return from;
|
||||
@@ -982,11 +991,11 @@ public class AppProperties {
|
||||
this.enable_index_of_type = enable_index_of_type;
|
||||
}
|
||||
|
||||
public Boolean getResource_dbhistory_enabled() {
|
||||
public Boolean getResource_dbhistory_enabled() {
|
||||
return resource_dbhistory_enabled;
|
||||
}
|
||||
|
||||
public void setResource_dbhistory_enabled(Boolean resource_dbhistory_enabled) {
|
||||
this.resource_dbhistory_enabled = resource_dbhistory_enabled;
|
||||
}
|
||||
}
|
||||
|
||||
public void setResource_dbhistory_enabled(Boolean resource_dbhistory_enabled) {
|
||||
this.resource_dbhistory_enabled = resource_dbhistory_enabled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ public class Application extends SpringBootServletInitializer {
|
||||
// UI is now accessible at http://localhost:8080/
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
AutowireCapableBeanFactory beanFactory;
|
||||
|
||||
@@ -63,4 +64,5 @@ public class Application extends SpringBootServletInitializer {
|
||||
|
||||
return servletRegistrationBean;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
package ca.uhn.fhir.jpa.starter.cdshooks;
|
||||
|
||||
import ca.uhn.fhir.jpa.starter.AppProperties;
|
||||
import ca.uhn.fhir.rest.api.server.cdshooks.CdsServiceRequestJson;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.ICdsServiceRegistry;
|
||||
import ca.uhn.fhir.rest.api.server.cdshooks.CdsServiceRequestJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServiceResponseJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServicesJson;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonParser;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -23,6 +19,10 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.stream.Collectors;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.http.HttpServlet;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import static ca.uhn.hapi.fhir.cdshooks.config.CdsHooksConfig.CDS_HOOKS_OBJECT_MAPPER_FACTORY;
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@ package ca.uhn.fhir.jpa.starter.cdshooks;
|
||||
|
||||
import ca.uhn.fhir.jpa.starter.AppProperties;
|
||||
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Arrays;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
public class ErrorHandling {
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,17 +1,21 @@
|
||||
package ca.uhn.fhir.jpa.starter.cdshooks;
|
||||
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.jpa.starter.cr.CrCommonConfig;
|
||||
import ca.uhn.fhir.jpa.starter.cr.CrConfigCondition;
|
||||
import ca.uhn.fhir.jpa.starter.cr.CrProperties;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.ICdsHooksDaoAuthorizationSvc;
|
||||
import ca.uhn.hapi.fhir.cdshooks.config.CdsHooksConfig;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.CdsHooksContextBooter;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrServiceRegistry;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrSettings;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrServiceRegistry;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.cr.ICdsCrServiceRegistry;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.cr.discovery.CdsCrDiscoveryServiceRegistry;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.cr.discovery.ICdsCrDiscoveryServiceRegistry;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.prefetch.CdsPrefetchDaoSvc;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.prefetch.CdsPrefetchFhirClientSvc;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.prefetch.CdsPrefetchSvc;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.prefetch.CdsResolutionStrategySvc;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
@@ -25,18 +29,18 @@ import org.springframework.context.annotation.Import;
|
||||
@Import({CdsHooksConfig.class, CrCommonConfig.class})
|
||||
public class StarterCdsHooksConfig {
|
||||
|
||||
// @Bean
|
||||
// CdsPrefetchSvc cdsPrefetchSvc(
|
||||
// CdsResolutionStrategySvc theCdsResolutionStrategySvc,
|
||||
// CdsPrefetchDaoSvc theResourcePrefetchDao,
|
||||
// CdsPrefetchFhirClientSvc theResourcePrefetchFhirClient,
|
||||
// ICdsHooksDaoAuthorizationSvc theCdsHooksDaoAuthorizationSvc) {
|
||||
// return new ModuleConfigurationPrefetchSvc(
|
||||
// theCdsResolutionStrategySvc,
|
||||
// theResourcePrefetchDao,
|
||||
// theResourcePrefetchFhirClient,
|
||||
// theCdsHooksDaoAuthorizationSvc);
|
||||
// }
|
||||
// @Bean
|
||||
// CdsPrefetchSvc cdsPrefetchSvc(
|
||||
// CdsResolutionStrategySvc theCdsResolutionStrategySvc,
|
||||
// CdsPrefetchDaoSvc theResourcePrefetchDao,
|
||||
// CdsPrefetchFhirClientSvc theResourcePrefetchFhirClient,
|
||||
// ICdsHooksDaoAuthorizationSvc theCdsHooksDaoAuthorizationSvc) {
|
||||
// return new ModuleConfigurationPrefetchSvc(
|
||||
// theCdsResolutionStrategySvc,
|
||||
// theResourcePrefetchDao,
|
||||
// theResourcePrefetchFhirClient,
|
||||
// theCdsHooksDaoAuthorizationSvc);
|
||||
// }
|
||||
|
||||
@Bean
|
||||
public ICdsCrDiscoveryServiceRegistry cdsCrDiscoveryServiceRegistry() {
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
package ca.uhn.fhir.jpa.starter.cdshooks;
|
||||
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.api.server.cdshooks.CdsServiceRequestJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.api.ICdsConfigService;
|
||||
import ca.uhn.fhir.rest.api.server.cdshooks.CdsServiceRequestJson;
|
||||
import ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrServiceR4;
|
||||
import org.hl7.fhir.r4.model.BooleanType;
|
||||
import org.hl7.fhir.r4.model.Parameters;
|
||||
import org.opencds.cqf.fhir.api.Repository;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrConstants.APPLY_PARAMETER_DATA;
|
||||
import static ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrConstants.APPLY_PARAMETER_DATA_ENDPOINT;
|
||||
import static org.opencds.cqf.fhir.utility.r4.Parameters.part;
|
||||
|
||||
public class UpdatedCdsCrServiceR4 extends CdsCrServiceR4 {
|
||||
public UpdatedCdsCrServiceR4(
|
||||
RequestDetails theRequestDetails, Repository theRepository, ICdsConfigService theCdsConfigService) {
|
||||
public UpdatedCdsCrServiceR4(RequestDetails theRequestDetails, Repository theRepository, ICdsConfigService theCdsConfigService) {
|
||||
super(theRequestDetails, theRepository, theCdsConfigService);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package ca.uhn.fhir.jpa.starter.common;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.interceptor.api.IInterceptorService;
|
||||
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
|
||||
import ca.uhn.fhir.jpa.binary.api.IBinaryStorageSvc;
|
||||
import ca.uhn.fhir.jpa.binstore.DatabaseBinaryContentStorageSvcImpl;
|
||||
import ca.uhn.fhir.jpa.config.HibernatePropertiesProvider;
|
||||
import ca.uhn.fhir.jpa.interceptor.PatientIdPartitionInterceptor;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings.CrossPartitionReferenceMode;
|
||||
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
|
||||
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
|
||||
import ca.uhn.fhir.jpa.searchparam.extractor.ISearchParamExtractor;
|
||||
import ca.uhn.fhir.jpa.starter.AppProperties;
|
||||
import ca.uhn.fhir.jpa.starter.util.JpaHibernatePropertiesProvider;
|
||||
import ca.uhn.fhir.jpa.subscription.match.deliver.email.EmailSenderImpl;
|
||||
@@ -114,6 +118,7 @@ public class FhirServerConfigCommon {
|
||||
subscriptionSettings.addSupportedSubscriptionType(
|
||||
org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET);
|
||||
}
|
||||
|
||||
}
|
||||
if (appProperties.getMdm_enabled()) {
|
||||
// MDM requires the subscription of type message
|
||||
@@ -136,7 +141,8 @@ public class FhirServerConfigCommon {
|
||||
: StorageSettings.IndexEnabledEnum.DISABLED);
|
||||
jpaStorageSettings.setAutoCreatePlaceholderReferenceTargets(
|
||||
appProperties.getAuto_create_placeholder_reference_targets());
|
||||
jpaStorageSettings.setMassIngestionMode(appProperties.getMass_ingestion_mode_enabled());
|
||||
jpaStorageSettings.setMassIngestionMode(
|
||||
appProperties.getMass_ingestion_mode_enabled());
|
||||
jpaStorageSettings.setAutoVersionReferenceAtPaths(appProperties.getAuto_version_reference_at_paths());
|
||||
jpaStorageSettings.setEnforceReferentialIntegrityOnWrite(
|
||||
appProperties.getEnforce_referential_integrity_on_write());
|
||||
@@ -149,8 +155,7 @@ public class FhirServerConfigCommon {
|
||||
jpaStorageSettings.setDeleteExpungeEnabled(appProperties.getDelete_expunge_enabled());
|
||||
jpaStorageSettings.setExpungeEnabled(appProperties.getExpunge_enabled());
|
||||
jpaStorageSettings.setLanguageSearchParameterEnabled(appProperties.getLanguage_search_parameter_enabled());
|
||||
jpaStorageSettings.setValidateResourceStatusForPackageUpload(
|
||||
appProperties.getValidate_resource_status_for_package_upload());
|
||||
jpaStorageSettings.setValidateResourceStatusForPackageUpload(appProperties.getValidate_resource_status_for_package_upload());
|
||||
jpaStorageSettings.setIndexOnUpliftedRefchains(appProperties.getUpliftedRefchains_enabled());
|
||||
|
||||
if (!appProperties.getSearch_prefetch_thresholds().isEmpty()) {
|
||||
@@ -169,6 +174,8 @@ public class FhirServerConfigCommon {
|
||||
Long retainCachedSearchesMinutes = appProperties.getRetain_cached_searches_mins();
|
||||
jpaStorageSettings.setExpireSearchResultsAfterMillis(retainCachedSearchesMinutes * 60 * 1000);
|
||||
|
||||
|
||||
|
||||
jpaStorageSettings.setFilterParameterEnabled(appProperties.getFilter_search_enabled());
|
||||
jpaStorageSettings.setHibernateSearchIndexSearchParams(appProperties.getAdvanced_lucene_indexing());
|
||||
jpaStorageSettings.setTreatBaseUrlsAsLocal(new HashSet<>(appProperties.getLocal_base_urls()));
|
||||
@@ -216,7 +223,7 @@ public class FhirServerConfigCommon {
|
||||
ourLog.info("Server configured to use '" + appProperties.getServer_id_strategy() + "' Server ID Strategy");
|
||||
}
|
||||
|
||||
// to Disable the Resource History
|
||||
//to Disable the Resource History
|
||||
jpaStorageSettings.setResourceDbHistoryEnabled(appProperties.getResource_dbhistory_enabled());
|
||||
|
||||
// Parallel Batch GET execution settings
|
||||
@@ -232,6 +239,7 @@ public class FhirServerConfigCommon {
|
||||
return new YamlPropertySourceLoader();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public PartitionSettings partitionSettings(AppProperties appProperties) {
|
||||
PartitionSettings retVal = new PartitionSettings();
|
||||
@@ -239,8 +247,7 @@ public class FhirServerConfigCommon {
|
||||
// Partitioning
|
||||
if (appProperties.getPartitioning() != null) {
|
||||
retVal.setPartitioningEnabled(true);
|
||||
boolean databasePartitionModeEnabled =
|
||||
defaultIfNull(appProperties.getPartitioning().getDatabase_partition_mode_enabled(), Boolean.FALSE);
|
||||
boolean databasePartitionModeEnabled = defaultIfNull(appProperties.getPartitioning().getDatabase_partition_mode_enabled(), Boolean.FALSE);
|
||||
Integer defaultPartitionId = appProperties.getPartitioning().getDefault_partition_id();
|
||||
if (databasePartitionModeEnabled) {
|
||||
retVal.setDatabasePartitionMode(true);
|
||||
@@ -258,6 +265,7 @@ public class FhirServerConfigCommon {
|
||||
appProperties.getPartitioning().getConditional_create_duplicate_identifiers_enabled());
|
||||
}
|
||||
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -266,6 +274,7 @@ public class FhirServerConfigCommon {
|
||||
return new PartitionModeConfigurer();
|
||||
}
|
||||
|
||||
|
||||
@Primary
|
||||
@Bean
|
||||
public HibernatePropertiesProvider jpaStarterDialectProvider(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ca.uhn.fhir.jpa.starter.common;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.interceptor.api.IInterceptorService;
|
||||
import ca.uhn.fhir.jpa.interceptor.PatientIdPartitionInterceptor;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.partition.PartitionManagementProvider;
|
||||
@@ -19,29 +20,24 @@ public class PartitionModeConfigurer {
|
||||
|
||||
@Autowired
|
||||
private AppProperties myAppProperties;
|
||||
|
||||
@Autowired
|
||||
private FhirContext myFhirContext;
|
||||
|
||||
@Autowired
|
||||
private ISearchParamExtractor mySearchParamExtractor;
|
||||
|
||||
@Autowired
|
||||
private PartitionSettings myPartitionSettings;
|
||||
|
||||
@Autowired
|
||||
private RestfulServer myRestfulServer;
|
||||
|
||||
@Autowired
|
||||
private PartitionManagementProvider myPartitionManagementProvider;
|
||||
|
||||
|
||||
@PostConstruct
|
||||
public void start() {
|
||||
if (myAppProperties.getPartitioning() != null) {
|
||||
if (myAppProperties.getPartitioning().getPatient_id_partitioning_mode() == Boolean.TRUE) {
|
||||
ourLog.info("Partitioning mode enabled in: Patient ID partitioning mode");
|
||||
PatientIdPartitionInterceptor patientIdInterceptor =
|
||||
new PatientIdPartitionInterceptor(myFhirContext, mySearchParamExtractor, myPartitionSettings);
|
||||
PatientIdPartitionInterceptor patientIdInterceptor = new PatientIdPartitionInterceptor(myFhirContext, mySearchParamExtractor, myPartitionSettings);
|
||||
myRestfulServer.registerInterceptor(patientIdInterceptor);
|
||||
myPartitionSettings.setUnnamedPartitionMode(true);
|
||||
} else if (myAppProperties.getPartitioning().getRequest_tenant_partitioning_mode() == Boolean.TRUE) {
|
||||
@@ -53,4 +49,5 @@ public class PartitionModeConfigurer {
|
||||
myRestfulServer.registerProviders(myPartitionManagementProvider);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -92,12 +92,12 @@ import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import static ca.uhn.fhir.jpa.starter.common.validation.IRepositoryValidationInterceptorFactory.ENABLE_REPOSITORY_VALIDATING_INTERCEPTOR;
|
||||
|
||||
@@ -149,10 +149,9 @@ public class StarterJpaConfig {
|
||||
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
|
||||
DataSource myDataSource,
|
||||
ConfigurableListableBeanFactory myConfigurableListableBeanFactory,
|
||||
FhirContext theFhirContext,
|
||||
JpaStorageSettings theStorageSettings) {
|
||||
LocalContainerEntityManagerFactoryBean retVal = HapiEntityManagerFactoryUtil.newEntityManagerFactory(
|
||||
myConfigurableListableBeanFactory, theFhirContext, theStorageSettings);
|
||||
FhirContext theFhirContext, JpaStorageSettings theStorageSettings) {
|
||||
LocalContainerEntityManagerFactoryBean retVal =
|
||||
HapiEntityManagerFactoryUtil.newEntityManagerFactory(myConfigurableListableBeanFactory, theFhirContext, theStorageSettings);
|
||||
retVal.setPersistenceUnitName("HAPI_PU");
|
||||
|
||||
try {
|
||||
@@ -288,8 +287,7 @@ public class StarterJpaConfig {
|
||||
IPackageInstallerSvc packageInstallerSvc,
|
||||
ThreadSafeResourceDeleterSvc theThreadSafeResourceDeleterSvc,
|
||||
ApplicationContext appContext,
|
||||
Optional<IpsOperationProvider> theIpsOperationProvider,
|
||||
Optional<IImplementationGuideOperationProvider> implementationGuideOperationProvider) {
|
||||
Optional<IpsOperationProvider> theIpsOperationProvider, Optional<IImplementationGuideOperationProvider> implementationGuideOperationProvider) {
|
||||
RestfulServer fhirServer = new RestfulServer(fhirSystemDao.getContext());
|
||||
|
||||
List<String> supportedResourceTypes = appProperties.getSupported_resource_types();
|
||||
@@ -466,7 +464,7 @@ public class StarterJpaConfig {
|
||||
fhirServer.registerProvider(theIpsOperationProvider.get());
|
||||
}
|
||||
|
||||
if (appProperties.getUserRequestRetryVersionConflictsInterceptorEnabled()) {
|
||||
if (appProperties.getUserRequestRetryVersionConflictsInterceptorEnabled() ) {
|
||||
fhirServer.registerInterceptor(new UserRequestRetryVersionConflictsInterceptor());
|
||||
}
|
||||
|
||||
|
||||
@@ -46,9 +46,8 @@ public class RepositoryValidationInterceptorFactoryDstu3 implements IRepositoryV
|
||||
|
||||
public RepositoryValidatingInterceptor buildUsingStoredStructureDefinitions() {
|
||||
|
||||
IBundleProvider results = structureDefinitionResourceProvider.search(new SearchParameterMap()
|
||||
.setLoadSynchronous(true)
|
||||
.add(StructureDefinition.SP_KIND, new TokenParam("resource")));
|
||||
IBundleProvider results = structureDefinitionResourceProvider.search(
|
||||
new SearchParameterMap().setLoadSynchronous(true).add(StructureDefinition.SP_KIND, new TokenParam("resource")));
|
||||
Map<String, List<StructureDefinition>> structureDefinitions = results.getResources(0, results.size()).stream()
|
||||
.map(StructureDefinition.class::cast)
|
||||
.collect(Collectors.groupingBy(StructureDefinition::getType));
|
||||
|
||||
@@ -47,9 +47,8 @@ public class RepositoryValidationInterceptorFactoryR4 implements IRepositoryVali
|
||||
@Override
|
||||
public RepositoryValidatingInterceptor buildUsingStoredStructureDefinitions() {
|
||||
|
||||
IBundleProvider results = structureDefinitionResourceProvider.search(new SearchParameterMap()
|
||||
.setLoadSynchronous(true)
|
||||
.add(StructureDefinition.SP_KIND, new TokenParam("resource")));
|
||||
IBundleProvider results = structureDefinitionResourceProvider.search(
|
||||
new SearchParameterMap().setLoadSynchronous(true).add(StructureDefinition.SP_KIND, new TokenParam("resource")));
|
||||
Map<String, List<StructureDefinition>> structureDefintions = results.getResources(0, results.size()).stream()
|
||||
.map(StructureDefinition.class::cast)
|
||||
.collect(Collectors.groupingBy(StructureDefinition::getType));
|
||||
|
||||
@@ -47,9 +47,8 @@ public class RepositoryValidationInterceptorFactoryR4B implements IRepositoryVal
|
||||
@Override
|
||||
public RepositoryValidatingInterceptor buildUsingStoredStructureDefinitions() {
|
||||
|
||||
IBundleProvider results = structureDefinitionResourceProvider.search(new SearchParameterMap()
|
||||
.setLoadSynchronous(true)
|
||||
.add(StructureDefinition.SP_KIND, new TokenParam("resource")));
|
||||
IBundleProvider results = structureDefinitionResourceProvider.search(
|
||||
new SearchParameterMap().setLoadSynchronous(true).add(StructureDefinition.SP_KIND, new TokenParam("resource")));
|
||||
Map<String, List<StructureDefinition>> structureDefintions = results.getResources(0, results.size()).stream()
|
||||
.map(StructureDefinition.class::cast)
|
||||
.collect(Collectors.groupingBy(StructureDefinition::getType));
|
||||
|
||||
@@ -46,9 +46,8 @@ public class RepositoryValidationInterceptorFactoryR5 implements IRepositoryVali
|
||||
|
||||
public RepositoryValidatingInterceptor buildUsingStoredStructureDefinitions() {
|
||||
|
||||
IBundleProvider results = structureDefinitionResourceProvider.search(new SearchParameterMap()
|
||||
.setLoadSynchronous(true)
|
||||
.add(StructureDefinition.SP_KIND, new TokenParam("resource")));
|
||||
IBundleProvider results = structureDefinitionResourceProvider.search(
|
||||
new SearchParameterMap().setLoadSynchronous(true).add(StructureDefinition.SP_KIND, new TokenParam("resource")));
|
||||
Map<String, List<StructureDefinition>> structureDefintions = results.getResources(0, results.size()).stream()
|
||||
.map(StructureDefinition.class::cast)
|
||||
.collect(Collectors.groupingBy(StructureDefinition::getType));
|
||||
|
||||
@@ -9,17 +9,10 @@ import java.io.IOException;
|
||||
public interface IImplementationGuideOperationProvider {
|
||||
static PackageInstallationSpec toPackageInstallationSpec(byte[] npmPackageAsByteArray) throws IOException {
|
||||
NpmPackage npmPackage = NpmPackage.fromPackage(new ByteArrayInputStream(npmPackageAsByteArray));
|
||||
return new PackageInstallationSpec()
|
||||
.setName(npmPackage.name())
|
||||
.setPackageContents(npmPackageAsByteArray)
|
||||
.setVersion(npmPackage.version())
|
||||
.setInstallMode(PackageInstallationSpec.InstallModeEnum.STORE_AND_INSTALL)
|
||||
.setFetchDependencies(false);
|
||||
return new PackageInstallationSpec().setName(npmPackage.name()).setPackageContents(npmPackageAsByteArray).setVersion(npmPackage.version()).setInstallMode(PackageInstallationSpec.InstallModeEnum.STORE_AND_INSTALL).setFetchDependencies(false);
|
||||
}
|
||||
|
||||
// The following declaration is the one that counts but cannot be used across different versions as stating
|
||||
// Base64BinaryType would bind to a separate version
|
||||
// The following declaration is the one that counts but cannot be used across different versions as stating Base64BinaryType would bind to a separate version
|
||||
// Parameters install(@OperationParam(name = "npmContent",min = 1, max = 1) Base64BinaryType implementationGuide);
|
||||
// Parameters uninstall(@OperationParam(name = "name", min = 1, max = 1) String name, @OperationParam(name =
|
||||
// "version", min = 1, max = 1) String version) ;
|
||||
// Parameters uninstall(@OperationParam(name = "name", min = 1, max = 1) String name, @OperationParam(name = "version", min = 1, max = 1) String version) ;
|
||||
}
|
||||
|
||||
@@ -23,12 +23,10 @@ public class ImplementationGuideR4OperationProvider implements IImplementationGu
|
||||
}
|
||||
|
||||
@Operation(name = "$install", typeName = "ImplementationGuide")
|
||||
public Parameters install(
|
||||
@OperationParam(name = "npmContent", min = 1, max = 1) Base64BinaryType implementationGuide) {
|
||||
public Parameters install(@OperationParam(name = "npmContent", min = 1, max = 1) Base64BinaryType implementationGuide) {
|
||||
try {
|
||||
|
||||
packageInstallerSvc.install(
|
||||
IImplementationGuideOperationProvider.toPackageInstallationSpec(implementationGuide.getValue()));
|
||||
packageInstallerSvc.install(IImplementationGuideOperationProvider.toPackageInstallationSpec(implementationGuide.getValue()));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -36,12 +34,10 @@ public class ImplementationGuideR4OperationProvider implements IImplementationGu
|
||||
}
|
||||
|
||||
@Operation(name = "$uninstall", typeName = "ImplementationGuide")
|
||||
public Parameters uninstall(
|
||||
@OperationParam(name = "name", min = 1, max = 1) String name,
|
||||
@OperationParam(name = "version", min = 1, max = 1) String version) {
|
||||
public Parameters uninstall(@OperationParam(name = "name", min = 1, max = 1) String name, @OperationParam(name = "version", min = 1, max = 1) String version) {
|
||||
|
||||
packageInstallerSvc.uninstall(
|
||||
new PackageInstallationSpec().setName(name).setVersion(version));
|
||||
packageInstallerSvc.uninstall(new PackageInstallationSpec().setName(name).setVersion(version));
|
||||
return new Parameters();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,25 +23,21 @@ public class ImplementationGuideR5OperationProvider implements IImplementationGu
|
||||
}
|
||||
|
||||
@Operation(name = "$install", typeName = "ImplementationGuide")
|
||||
public Parameters install(
|
||||
@OperationParam(name = "npmContent", min = 1, max = 1) Base64BinaryType implementationGuide) {
|
||||
public Parameters install(@OperationParam(name = "npmContent", min = 1, max = 1) Base64BinaryType implementationGuide) {
|
||||
try {
|
||||
|
||||
packageInstallerSvc.install(
|
||||
IImplementationGuideOperationProvider.toPackageInstallationSpec(implementationGuide.getValue()));
|
||||
packageInstallerSvc.install(IImplementationGuideOperationProvider.toPackageInstallationSpec(implementationGuide.getValue()));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return new Parameters();
|
||||
}
|
||||
|
||||
@Operation(name = "$uninstall", typeName = "ImplementationGuide")
|
||||
public Parameters uninstall(
|
||||
@OperationParam(name = "name", min = 1, max = 1) String name,
|
||||
@OperationParam(name = "version", min = 1, max = 1) String version) {
|
||||
|
||||
packageInstallerSvc.uninstall(
|
||||
new PackageInstallationSpec().setName(name).setVersion(version));
|
||||
@Operation(name = "$uninstall", typeName = "ImplementationGuide")
|
||||
public Parameters uninstall(@OperationParam(name = "name", min = 1, max = 1) String name, @OperationParam(name = "version", min = 1, max = 1) String version) {
|
||||
|
||||
packageInstallerSvc.uninstall(new PackageInstallationSpec().setName(name).setVersion(version));
|
||||
return new Parameters();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,20 +17,21 @@ public class CustomContentFilesConfigurer implements WebMvcConfigurer {
|
||||
public static final String CUSTOM_CONTENT = "/content";
|
||||
private String customContentPath;
|
||||
|
||||
|
||||
public CustomContentFilesConfigurer(AppProperties appProperties) {
|
||||
customContentPath = appProperties.getCustom_content_path();
|
||||
if (customContentPath.endsWith("/"))
|
||||
customContentPath = customContentPath.substring(0, customContentPath.lastIndexOf('/'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(@NotNull ResourceHandlerRegistry theRegistry) {
|
||||
if (!theRegistry.hasMappingForPattern(CUSTOM_CONTENT + "/**")) {
|
||||
|
||||
try {
|
||||
theRegistry
|
||||
.addResourceHandler(CUSTOM_CONTENT + "/**")
|
||||
.addResourceLocations(new FileUrlResource(customContentPath));
|
||||
theRegistry.addResourceHandler(CUSTOM_CONTENT + "/**").addResourceLocations(new FileUrlResource(customContentPath));
|
||||
} catch (MalformedURLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -22,10 +22,7 @@ public class JobController {
|
||||
}
|
||||
|
||||
@RequestMapping(value = JobController.JOBS, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public List<JobInstance> getAllJobs(
|
||||
@RequestParam(name = "pageStart") @Min(0) int pageStart,
|
||||
@RequestParam(name = "batchSize") int batchSize,
|
||||
@RequestParam(name = "jobStatus", required = false) StatusEnum jobStatus) {
|
||||
public List<JobInstance> getAllJobs(@RequestParam(name = "pageStart") @Min(0) int pageStart, @RequestParam(name = "batchSize") int batchSize, @RequestParam(name = "jobStatus", required = false) StatusEnum jobStatus) {
|
||||
JobInstanceFetchRequest jobInstanceFetchRequest = new JobInstanceFetchRequest();
|
||||
jobInstanceFetchRequest.setPageStart(pageStart);
|
||||
jobInstanceFetchRequest.setBatchSize(batchSize);
|
||||
@@ -35,10 +32,7 @@ public class JobController {
|
||||
return theJobCoordinator.fetchAllJobInstances(jobInstanceFetchRequest).getContent();
|
||||
}
|
||||
|
||||
@RequestMapping(
|
||||
value = JobController.JOBS,
|
||||
method = RequestMethod.DELETE,
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = JobController.JOBS, method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public JobOperationResultJson cancelInstance(@RequestParam(name = "instanceId") String instanceId) {
|
||||
return theJobCoordinator.cancelInstance(instanceId);
|
||||
}
|
||||
|
||||
@@ -20,19 +20,21 @@ public class WebAppFilesConfigurer implements WebMvcConfigurer {
|
||||
public static final String WEB_CONTENT = "web";
|
||||
private String appContentPath;
|
||||
|
||||
|
||||
public WebAppFilesConfigurer(AppProperties appProperties) {
|
||||
appContentPath = appProperties.getApp_content_path();
|
||||
if (appContentPath.endsWith("/")) appContentPath = appContentPath.substring(0, appContentPath.lastIndexOf('/'));
|
||||
if (appContentPath.endsWith("/"))
|
||||
appContentPath = appContentPath.substring(0, appContentPath.lastIndexOf('/'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(@NotNull ResourceHandlerRegistry theRegistry) {
|
||||
if (!theRegistry.hasMappingForPattern(WEB_CONTENT + "/**")) {
|
||||
{
|
||||
try {
|
||||
theRegistry
|
||||
.addResourceHandler(WEB_CONTENT + "/**")
|
||||
.addResourceLocations(new FileUrlResource(appContentPath));
|
||||
theRegistry.addResourceHandler(WEB_CONTENT + "/**").addResourceLocations(new FileUrlResource(appContentPath));
|
||||
} catch (MalformedURLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -45,10 +47,10 @@ public class WebAppFilesConfigurer implements WebMvcConfigurer {
|
||||
String path = URI.create(appContentPath).getPath();
|
||||
String lastSegment = path.substring(path.lastIndexOf('/') + 1);
|
||||
|
||||
registry.addViewController(WEB_CONTENT + "/" + lastSegment)
|
||||
.setViewName("redirect:" + lastSegment + "/index.html");
|
||||
registry.addViewController(WEB_CONTENT + "/" + lastSegment).setViewName("redirect:" + lastSegment + "/index.html");
|
||||
registry.addViewController(WEB_CONTENT + "/" + lastSegment + "/").setViewName("redirect:index.html");
|
||||
|
||||
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user