Revert "Apply spotless"

This reverts commit 8b77aa0c53.
This commit is contained in:
dotasek
2025-02-12 12:31:34 -05:00
parent 8b77aa0c53
commit 80ef9ac2d0
20 changed files with 772 additions and 804 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -49,6 +49,7 @@ public class Application extends SpringBootServletInitializer {
// UI is now accessible at http://localhost:8080/ // UI is now accessible at http://localhost:8080/
} }
@Autowired @Autowired
AutowireCapableBeanFactory beanFactory; AutowireCapableBeanFactory beanFactory;
@@ -63,4 +64,5 @@ public class Application extends SpringBootServletInitializer {
return servletRegistrationBean; return servletRegistrationBean;
} }
} }

View File

@@ -1,19 +1,15 @@
package ca.uhn.fhir.jpa.starter.cdshooks; package ca.uhn.fhir.jpa.starter.cdshooks;
import ca.uhn.fhir.jpa.starter.AppProperties; 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.RestfulServer;
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException; import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
import ca.uhn.hapi.fhir.cdshooks.api.ICdsServiceRegistry; 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.CdsServiceResponseJson;
import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServicesJson; import ca.uhn.hapi.fhir.cdshooks.api.json.CdsServicesJson;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonParser; 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.apache.http.entity.ContentType;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -23,6 +19,10 @@ import org.springframework.beans.factory.annotation.Qualifier;
import java.io.IOException; import java.io.IOException;
import java.util.stream.Collectors; 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; import static ca.uhn.hapi.fhir.cdshooks.config.CdsHooksConfig.CDS_HOOKS_OBJECT_MAPPER_FACTORY;

View File

@@ -2,12 +2,12 @@ package ca.uhn.fhir.jpa.starter.cdshooks;
import ca.uhn.fhir.jpa.starter.AppProperties; import ca.uhn.fhir.jpa.starter.AppProperties;
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException; import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.Arrays; import java.util.Arrays;
import jakarta.servlet.http.HttpServletResponse;
public class ErrorHandling { public class ErrorHandling {

File diff suppressed because one or more lines are too long

View File

@@ -1,17 +1,21 @@
package ca.uhn.fhir.jpa.starter.cdshooks; 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.CrCommonConfig;
import ca.uhn.fhir.jpa.starter.cr.CrConfigCondition; import ca.uhn.fhir.jpa.starter.cr.CrConfigCondition;
import ca.uhn.fhir.jpa.starter.cr.CrProperties; import ca.uhn.fhir.jpa.starter.cr.CrProperties;
import ca.uhn.hapi.fhir.cdshooks.api.ICdsHooksDaoAuthorizationSvc; import ca.uhn.hapi.fhir.cdshooks.api.ICdsHooksDaoAuthorizationSvc;
import ca.uhn.hapi.fhir.cdshooks.config.CdsHooksConfig; import ca.uhn.hapi.fhir.cdshooks.config.CdsHooksConfig;
import ca.uhn.hapi.fhir.cdshooks.svc.CdsHooksContextBooter; 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.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.ICdsCrServiceRegistry;
import ca.uhn.hapi.fhir.cdshooks.svc.cr.discovery.CdsCrDiscoveryServiceRegistry; 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.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.hl7.fhir.instance.model.api.IBaseResource;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory; import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.boot.web.servlet.ServletRegistrationBean;
@@ -25,18 +29,18 @@ import org.springframework.context.annotation.Import;
@Import({CdsHooksConfig.class, CrCommonConfig.class}) @Import({CdsHooksConfig.class, CrCommonConfig.class})
public class StarterCdsHooksConfig { public class StarterCdsHooksConfig {
// @Bean // @Bean
// CdsPrefetchSvc cdsPrefetchSvc( // CdsPrefetchSvc cdsPrefetchSvc(
// CdsResolutionStrategySvc theCdsResolutionStrategySvc, // CdsResolutionStrategySvc theCdsResolutionStrategySvc,
// CdsPrefetchDaoSvc theResourcePrefetchDao, // CdsPrefetchDaoSvc theResourcePrefetchDao,
// CdsPrefetchFhirClientSvc theResourcePrefetchFhirClient, // CdsPrefetchFhirClientSvc theResourcePrefetchFhirClient,
// ICdsHooksDaoAuthorizationSvc theCdsHooksDaoAuthorizationSvc) { // ICdsHooksDaoAuthorizationSvc theCdsHooksDaoAuthorizationSvc) {
// return new ModuleConfigurationPrefetchSvc( // return new ModuleConfigurationPrefetchSvc(
// theCdsResolutionStrategySvc, // theCdsResolutionStrategySvc,
// theResourcePrefetchDao, // theResourcePrefetchDao,
// theResourcePrefetchFhirClient, // theResourcePrefetchFhirClient,
// theCdsHooksDaoAuthorizationSvc); // theCdsHooksDaoAuthorizationSvc);
// } // }
@Bean @Bean
public ICdsCrDiscoveryServiceRegistry cdsCrDiscoveryServiceRegistry() { public ICdsCrDiscoveryServiceRegistry cdsCrDiscoveryServiceRegistry() {

View File

@@ -1,19 +1,21 @@
package ca.uhn.fhir.jpa.starter.cdshooks; package ca.uhn.fhir.jpa.starter.cdshooks;
import ca.uhn.fhir.rest.api.server.RequestDetails; 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.hapi.fhir.cdshooks.api.ICdsConfigService;
import ca.uhn.fhir.rest.api.server.cdshooks.CdsServiceRequestJson;
import ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrServiceR4; import ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrServiceR4;
import org.hl7.fhir.r4.model.BooleanType; import org.hl7.fhir.r4.model.BooleanType;
import org.hl7.fhir.r4.model.Parameters; import org.hl7.fhir.r4.model.Parameters;
import org.opencds.cqf.fhir.api.Repository; 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;
import static ca.uhn.hapi.fhir.cdshooks.svc.cr.CdsCrConstants.APPLY_PARAMETER_DATA_ENDPOINT;
import static org.opencds.cqf.fhir.utility.r4.Parameters.part; import static org.opencds.cqf.fhir.utility.r4.Parameters.part;
public class UpdatedCdsCrServiceR4 extends CdsCrServiceR4 { public class UpdatedCdsCrServiceR4 extends CdsCrServiceR4 {
public UpdatedCdsCrServiceR4( public UpdatedCdsCrServiceR4(RequestDetails theRequestDetails, Repository theRepository, ICdsConfigService theCdsConfigService) {
RequestDetails theRequestDetails, Repository theRepository, ICdsConfigService theCdsConfigService) {
super(theRequestDetails, theRepository, theCdsConfigService); super(theRequestDetails, theRepository, theCdsConfigService);
} }

View File

@@ -1,13 +1,17 @@
package ca.uhn.fhir.jpa.starter.common; 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.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.binary.api.IBinaryStorageSvc; import ca.uhn.fhir.jpa.binary.api.IBinaryStorageSvc;
import ca.uhn.fhir.jpa.binstore.DatabaseBinaryContentStorageSvcImpl; import ca.uhn.fhir.jpa.binstore.DatabaseBinaryContentStorageSvcImpl;
import ca.uhn.fhir.jpa.config.HibernatePropertiesProvider; 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;
import ca.uhn.fhir.jpa.model.config.PartitionSettings.CrossPartitionReferenceMode; import ca.uhn.fhir.jpa.model.config.PartitionSettings.CrossPartitionReferenceMode;
import ca.uhn.fhir.jpa.model.config.SubscriptionSettings; import ca.uhn.fhir.jpa.model.config.SubscriptionSettings;
import ca.uhn.fhir.jpa.model.entity.StorageSettings; 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.AppProperties;
import ca.uhn.fhir.jpa.starter.util.JpaHibernatePropertiesProvider; import ca.uhn.fhir.jpa.starter.util.JpaHibernatePropertiesProvider;
import ca.uhn.fhir.jpa.subscription.match.deliver.email.EmailSenderImpl; import ca.uhn.fhir.jpa.subscription.match.deliver.email.EmailSenderImpl;
@@ -96,30 +100,31 @@ public class FhirServerConfigCommon {
if (appProperties.getSubscription() != null) { if (appProperties.getSubscription() != null) {
if (appProperties.getSubscription().getEmail() != null) if (appProperties.getSubscription().getEmail() != null)
subscriptionSettings.setEmailFromAddress( subscriptionSettings.setEmailFromAddress(
appProperties.getSubscription().getEmail().getFrom()); appProperties.getSubscription().getEmail().getFrom());
// Subscriptions are enabled by channel type // Subscriptions are enabled by channel type
if (appProperties.getSubscription().getResthook_enabled()) { if (appProperties.getSubscription().getResthook_enabled()) {
ourLog.info("Enabling REST-hook subscriptions"); ourLog.info("Enabling REST-hook subscriptions");
subscriptionSettings.addSupportedSubscriptionType( subscriptionSettings.addSupportedSubscriptionType(
org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK); org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK);
} }
if (appProperties.getSubscription().getEmail() != null) { if (appProperties.getSubscription().getEmail() != null) {
ourLog.info("Enabling email subscriptions"); ourLog.info("Enabling email subscriptions");
subscriptionSettings.addSupportedSubscriptionType( subscriptionSettings.addSupportedSubscriptionType(
org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.EMAIL); org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.EMAIL);
} }
if (appProperties.getSubscription().getWebsocket_enabled()) { if (appProperties.getSubscription().getWebsocket_enabled()) {
ourLog.info("Enabling websocket subscriptions"); ourLog.info("Enabling websocket subscriptions");
subscriptionSettings.addSupportedSubscriptionType( subscriptionSettings.addSupportedSubscriptionType(
org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET); org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET);
} }
} }
if (appProperties.getMdm_enabled()) { if (appProperties.getMdm_enabled()) {
// MDM requires the subscription of type message // MDM requires the subscription of type message
ourLog.info("Enabling message subscriptions"); ourLog.info("Enabling message subscriptions");
subscriptionSettings.addSupportedSubscriptionType( subscriptionSettings.addSupportedSubscriptionType(
org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.MESSAGE); org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.MESSAGE);
} }
return subscriptionSettings; return subscriptionSettings;
} }
@@ -136,7 +141,8 @@ public class FhirServerConfigCommon {
: StorageSettings.IndexEnabledEnum.DISABLED); : StorageSettings.IndexEnabledEnum.DISABLED);
jpaStorageSettings.setAutoCreatePlaceholderReferenceTargets( jpaStorageSettings.setAutoCreatePlaceholderReferenceTargets(
appProperties.getAuto_create_placeholder_reference_targets()); 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.setAutoVersionReferenceAtPaths(appProperties.getAuto_version_reference_at_paths());
jpaStorageSettings.setEnforceReferentialIntegrityOnWrite( jpaStorageSettings.setEnforceReferentialIntegrityOnWrite(
appProperties.getEnforce_referential_integrity_on_write()); appProperties.getEnforce_referential_integrity_on_write());
@@ -149,8 +155,7 @@ public class FhirServerConfigCommon {
jpaStorageSettings.setDeleteExpungeEnabled(appProperties.getDelete_expunge_enabled()); jpaStorageSettings.setDeleteExpungeEnabled(appProperties.getDelete_expunge_enabled());
jpaStorageSettings.setExpungeEnabled(appProperties.getExpunge_enabled()); jpaStorageSettings.setExpungeEnabled(appProperties.getExpunge_enabled());
jpaStorageSettings.setLanguageSearchParameterEnabled(appProperties.getLanguage_search_parameter_enabled()); jpaStorageSettings.setLanguageSearchParameterEnabled(appProperties.getLanguage_search_parameter_enabled());
jpaStorageSettings.setValidateResourceStatusForPackageUpload( jpaStorageSettings.setValidateResourceStatusForPackageUpload(appProperties.getValidate_resource_status_for_package_upload());
appProperties.getValidate_resource_status_for_package_upload());
jpaStorageSettings.setIndexOnUpliftedRefchains(appProperties.getUpliftedRefchains_enabled()); jpaStorageSettings.setIndexOnUpliftedRefchains(appProperties.getUpliftedRefchains_enabled());
if (!appProperties.getSearch_prefetch_thresholds().isEmpty()) { if (!appProperties.getSearch_prefetch_thresholds().isEmpty()) {
@@ -169,6 +174,8 @@ public class FhirServerConfigCommon {
Long retainCachedSearchesMinutes = appProperties.getRetain_cached_searches_mins(); Long retainCachedSearchesMinutes = appProperties.getRetain_cached_searches_mins();
jpaStorageSettings.setExpireSearchResultsAfterMillis(retainCachedSearchesMinutes * 60 * 1000); jpaStorageSettings.setExpireSearchResultsAfterMillis(retainCachedSearchesMinutes * 60 * 1000);
jpaStorageSettings.setFilterParameterEnabled(appProperties.getFilter_search_enabled()); jpaStorageSettings.setFilterParameterEnabled(appProperties.getFilter_search_enabled());
jpaStorageSettings.setHibernateSearchIndexSearchParams(appProperties.getAdvanced_lucene_indexing()); jpaStorageSettings.setHibernateSearchIndexSearchParams(appProperties.getAdvanced_lucene_indexing());
jpaStorageSettings.setTreatBaseUrlsAsLocal(new HashSet<>(appProperties.getLocal_base_urls())); 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"); 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()); jpaStorageSettings.setResourceDbHistoryEnabled(appProperties.getResource_dbhistory_enabled());
// Parallel Batch GET execution settings // Parallel Batch GET execution settings
@@ -232,6 +239,7 @@ public class FhirServerConfigCommon {
return new YamlPropertySourceLoader(); return new YamlPropertySourceLoader();
} }
@Bean @Bean
public PartitionSettings partitionSettings(AppProperties appProperties) { public PartitionSettings partitionSettings(AppProperties appProperties) {
PartitionSettings retVal = new PartitionSettings(); PartitionSettings retVal = new PartitionSettings();
@@ -239,8 +247,7 @@ public class FhirServerConfigCommon {
// Partitioning // Partitioning
if (appProperties.getPartitioning() != null) { if (appProperties.getPartitioning() != null) {
retVal.setPartitioningEnabled(true); retVal.setPartitioningEnabled(true);
boolean databasePartitionModeEnabled = boolean databasePartitionModeEnabled = defaultIfNull(appProperties.getPartitioning().getDatabase_partition_mode_enabled(), Boolean.FALSE);
defaultIfNull(appProperties.getPartitioning().getDatabase_partition_mode_enabled(), Boolean.FALSE);
Integer defaultPartitionId = appProperties.getPartitioning().getDefault_partition_id(); Integer defaultPartitionId = appProperties.getPartitioning().getDefault_partition_id();
if (databasePartitionModeEnabled) { if (databasePartitionModeEnabled) {
retVal.setDatabasePartitionMode(true); retVal.setDatabasePartitionMode(true);
@@ -255,9 +262,10 @@ public class FhirServerConfigCommon {
retVal.setAllowReferencesAcrossPartitions(CrossPartitionReferenceMode.NOT_ALLOWED); retVal.setAllowReferencesAcrossPartitions(CrossPartitionReferenceMode.NOT_ALLOWED);
} }
retVal.setConditionalCreateDuplicateIdentifiersEnabled( retVal.setConditionalCreateDuplicateIdentifiersEnabled(
appProperties.getPartitioning().getConditional_create_duplicate_identifiers_enabled()); appProperties.getPartitioning().getConditional_create_duplicate_identifiers_enabled());
} }
return retVal; return retVal;
} }
@@ -266,6 +274,7 @@ public class FhirServerConfigCommon {
return new PartitionModeConfigurer(); return new PartitionModeConfigurer();
} }
@Primary @Primary
@Bean @Bean
public HibernatePropertiesProvider jpaStarterDialectProvider( public HibernatePropertiesProvider jpaStarterDialectProvider(

View File

@@ -1,6 +1,7 @@
package ca.uhn.fhir.jpa.starter.common; package ca.uhn.fhir.jpa.starter.common;
import ca.uhn.fhir.context.FhirContext; 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.interceptor.PatientIdPartitionInterceptor;
import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.partition.PartitionManagementProvider; import ca.uhn.fhir.jpa.partition.PartitionManagementProvider;
@@ -19,29 +20,24 @@ public class PartitionModeConfigurer {
@Autowired @Autowired
private AppProperties myAppProperties; private AppProperties myAppProperties;
@Autowired @Autowired
private FhirContext myFhirContext; private FhirContext myFhirContext;
@Autowired @Autowired
private ISearchParamExtractor mySearchParamExtractor; private ISearchParamExtractor mySearchParamExtractor;
@Autowired @Autowired
private PartitionSettings myPartitionSettings; private PartitionSettings myPartitionSettings;
@Autowired @Autowired
private RestfulServer myRestfulServer; private RestfulServer myRestfulServer;
@Autowired @Autowired
private PartitionManagementProvider myPartitionManagementProvider; private PartitionManagementProvider myPartitionManagementProvider;
@PostConstruct @PostConstruct
public void start() { public void start() {
if (myAppProperties.getPartitioning() != null) { if (myAppProperties.getPartitioning() != null) {
if (myAppProperties.getPartitioning().getPatient_id_partitioning_mode() == Boolean.TRUE) { if (myAppProperties.getPartitioning().getPatient_id_partitioning_mode() == Boolean.TRUE) {
ourLog.info("Partitioning mode enabled in: Patient ID partitioning mode"); ourLog.info("Partitioning mode enabled in: Patient ID partitioning mode");
PatientIdPartitionInterceptor patientIdInterceptor = PatientIdPartitionInterceptor patientIdInterceptor = new PatientIdPartitionInterceptor(myFhirContext, mySearchParamExtractor, myPartitionSettings);
new PatientIdPartitionInterceptor(myFhirContext, mySearchParamExtractor, myPartitionSettings);
myRestfulServer.registerInterceptor(patientIdInterceptor); myRestfulServer.registerInterceptor(patientIdInterceptor);
myPartitionSettings.setUnnamedPartitionMode(true); myPartitionSettings.setUnnamedPartitionMode(true);
} else if (myAppProperties.getPartitioning().getRequest_tenant_partitioning_mode() == Boolean.TRUE) { } else if (myAppProperties.getPartitioning().getRequest_tenant_partitioning_mode() == Boolean.TRUE) {
@@ -53,4 +49,5 @@ public class PartitionModeConfigurer {
myRestfulServer.registerProviders(myPartitionManagementProvider); myRestfulServer.registerProviders(myPartitionManagementProvider);
} }
} }
} }

View File

@@ -92,12 +92,12 @@ import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfiguration;
import javax.sql.DataSource;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import javax.sql.DataSource;
import static ca.uhn.fhir.jpa.starter.common.validation.IRepositoryValidationInterceptorFactory.ENABLE_REPOSITORY_VALIDATING_INTERCEPTOR; import static ca.uhn.fhir.jpa.starter.common.validation.IRepositoryValidationInterceptorFactory.ENABLE_REPOSITORY_VALIDATING_INTERCEPTOR;
@@ -147,12 +147,11 @@ public class StarterJpaConfig {
@Primary @Primary
@Bean @Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory( public LocalContainerEntityManagerFactoryBean entityManagerFactory(
DataSource myDataSource, DataSource myDataSource,
ConfigurableListableBeanFactory myConfigurableListableBeanFactory, ConfigurableListableBeanFactory myConfigurableListableBeanFactory,
FhirContext theFhirContext, FhirContext theFhirContext, JpaStorageSettings theStorageSettings) {
JpaStorageSettings theStorageSettings) { LocalContainerEntityManagerFactoryBean retVal =
LocalContainerEntityManagerFactoryBean retVal = HapiEntityManagerFactoryUtil.newEntityManagerFactory( HapiEntityManagerFactoryUtil.newEntityManagerFactory(myConfigurableListableBeanFactory, theFhirContext, theStorageSettings);
myConfigurableListableBeanFactory, theFhirContext, theStorageSettings);
retVal.setPersistenceUnitName("HAPI_PU"); retVal.setPersistenceUnitName("HAPI_PU");
try { try {
@@ -204,9 +203,9 @@ public class StarterJpaConfig {
@Primary @Primary
@Conditional(OnImplementationGuidesPresent.class) @Conditional(OnImplementationGuidesPresent.class)
public IPackageInstallerSvc packageInstaller( public IPackageInstallerSvc packageInstaller(
AppProperties appProperties, AppProperties appProperties,
IPackageInstallerSvc packageInstallerSvc, IPackageInstallerSvc packageInstallerSvc,
Batch2JobRegisterer batch2JobRegisterer) { Batch2JobRegisterer batch2JobRegisterer) {
batch2JobRegisterer.start(); batch2JobRegisterer.start();
@@ -288,8 +287,7 @@ public class StarterJpaConfig {
IPackageInstallerSvc packageInstallerSvc, IPackageInstallerSvc packageInstallerSvc,
ThreadSafeResourceDeleterSvc theThreadSafeResourceDeleterSvc, ThreadSafeResourceDeleterSvc theThreadSafeResourceDeleterSvc,
ApplicationContext appContext, ApplicationContext appContext,
Optional<IpsOperationProvider> theIpsOperationProvider, Optional<IpsOperationProvider> theIpsOperationProvider, Optional<IImplementationGuideOperationProvider> implementationGuideOperationProvider) {
Optional<IImplementationGuideOperationProvider> implementationGuideOperationProvider) {
RestfulServer fhirServer = new RestfulServer(fhirSystemDao.getContext()); RestfulServer fhirServer = new RestfulServer(fhirSystemDao.getContext());
List<String> supportedResourceTypes = appProperties.getSupported_resource_types(); List<String> supportedResourceTypes = appProperties.getSupported_resource_types();
@@ -466,7 +464,7 @@ public class StarterJpaConfig {
fhirServer.registerProvider(theIpsOperationProvider.get()); fhirServer.registerProvider(theIpsOperationProvider.get());
} }
if (appProperties.getUserRequestRetryVersionConflictsInterceptorEnabled()) { if (appProperties.getUserRequestRetryVersionConflictsInterceptorEnabled() ) {
fhirServer.registerInterceptor(new UserRequestRetryVersionConflictsInterceptor()); fhirServer.registerInterceptor(new UserRequestRetryVersionConflictsInterceptor());
} }
@@ -522,7 +520,7 @@ public class StarterJpaConfig {
*/ */
@SuppressWarnings({"unchecked", "rawtypes"}) @SuppressWarnings({"unchecked", "rawtypes"})
private void registerCustomProviders( private void registerCustomProviders(
RestfulServer fhirServer, ApplicationContext theAppContext, List<String> customProviderClasses) { RestfulServer fhirServer, ApplicationContext theAppContext, List<String> customProviderClasses) {
if (customProviderClasses == null) { if (customProviderClasses == null) {
return; return;

View File

@@ -46,9 +46,8 @@ public class RepositoryValidationInterceptorFactoryDstu3 implements IRepositoryV
public RepositoryValidatingInterceptor buildUsingStoredStructureDefinitions() { public RepositoryValidatingInterceptor buildUsingStoredStructureDefinitions() {
IBundleProvider results = structureDefinitionResourceProvider.search(new SearchParameterMap() IBundleProvider results = structureDefinitionResourceProvider.search(
.setLoadSynchronous(true) new SearchParameterMap().setLoadSynchronous(true).add(StructureDefinition.SP_KIND, new TokenParam("resource")));
.add(StructureDefinition.SP_KIND, new TokenParam("resource")));
Map<String, List<StructureDefinition>> structureDefinitions = results.getResources(0, results.size()).stream() Map<String, List<StructureDefinition>> structureDefinitions = results.getResources(0, results.size()).stream()
.map(StructureDefinition.class::cast) .map(StructureDefinition.class::cast)
.collect(Collectors.groupingBy(StructureDefinition::getType)); .collect(Collectors.groupingBy(StructureDefinition::getType));

View File

@@ -47,9 +47,8 @@ public class RepositoryValidationInterceptorFactoryR4 implements IRepositoryVali
@Override @Override
public RepositoryValidatingInterceptor buildUsingStoredStructureDefinitions() { public RepositoryValidatingInterceptor buildUsingStoredStructureDefinitions() {
IBundleProvider results = structureDefinitionResourceProvider.search(new SearchParameterMap() IBundleProvider results = structureDefinitionResourceProvider.search(
.setLoadSynchronous(true) new SearchParameterMap().setLoadSynchronous(true).add(StructureDefinition.SP_KIND, new TokenParam("resource")));
.add(StructureDefinition.SP_KIND, new TokenParam("resource")));
Map<String, List<StructureDefinition>> structureDefintions = results.getResources(0, results.size()).stream() Map<String, List<StructureDefinition>> structureDefintions = results.getResources(0, results.size()).stream()
.map(StructureDefinition.class::cast) .map(StructureDefinition.class::cast)
.collect(Collectors.groupingBy(StructureDefinition::getType)); .collect(Collectors.groupingBy(StructureDefinition::getType));

View File

@@ -47,9 +47,8 @@ public class RepositoryValidationInterceptorFactoryR4B implements IRepositoryVal
@Override @Override
public RepositoryValidatingInterceptor buildUsingStoredStructureDefinitions() { public RepositoryValidatingInterceptor buildUsingStoredStructureDefinitions() {
IBundleProvider results = structureDefinitionResourceProvider.search(new SearchParameterMap() IBundleProvider results = structureDefinitionResourceProvider.search(
.setLoadSynchronous(true) new SearchParameterMap().setLoadSynchronous(true).add(StructureDefinition.SP_KIND, new TokenParam("resource")));
.add(StructureDefinition.SP_KIND, new TokenParam("resource")));
Map<String, List<StructureDefinition>> structureDefintions = results.getResources(0, results.size()).stream() Map<String, List<StructureDefinition>> structureDefintions = results.getResources(0, results.size()).stream()
.map(StructureDefinition.class::cast) .map(StructureDefinition.class::cast)
.collect(Collectors.groupingBy(StructureDefinition::getType)); .collect(Collectors.groupingBy(StructureDefinition::getType));

View File

@@ -46,9 +46,8 @@ public class RepositoryValidationInterceptorFactoryR5 implements IRepositoryVali
public RepositoryValidatingInterceptor buildUsingStoredStructureDefinitions() { public RepositoryValidatingInterceptor buildUsingStoredStructureDefinitions() {
IBundleProvider results = structureDefinitionResourceProvider.search(new SearchParameterMap() IBundleProvider results = structureDefinitionResourceProvider.search(
.setLoadSynchronous(true) new SearchParameterMap().setLoadSynchronous(true).add(StructureDefinition.SP_KIND, new TokenParam("resource")));
.add(StructureDefinition.SP_KIND, new TokenParam("resource")));
Map<String, List<StructureDefinition>> structureDefintions = results.getResources(0, results.size()).stream() Map<String, List<StructureDefinition>> structureDefintions = results.getResources(0, results.size()).stream()
.map(StructureDefinition.class::cast) .map(StructureDefinition.class::cast)
.collect(Collectors.groupingBy(StructureDefinition::getType)); .collect(Collectors.groupingBy(StructureDefinition::getType));

View File

@@ -9,17 +9,10 @@ import java.io.IOException;
public interface IImplementationGuideOperationProvider { public interface IImplementationGuideOperationProvider {
static PackageInstallationSpec toPackageInstallationSpec(byte[] npmPackageAsByteArray) throws IOException { static PackageInstallationSpec toPackageInstallationSpec(byte[] npmPackageAsByteArray) throws IOException {
NpmPackage npmPackage = NpmPackage.fromPackage(new ByteArrayInputStream(npmPackageAsByteArray)); NpmPackage npmPackage = NpmPackage.fromPackage(new ByteArrayInputStream(npmPackageAsByteArray));
return new PackageInstallationSpec() return new PackageInstallationSpec().setName(npmPackage.name()).setPackageContents(npmPackageAsByteArray).setVersion(npmPackage.version()).setInstallMode(PackageInstallationSpec.InstallModeEnum.STORE_AND_INSTALL).setFetchDependencies(false);
.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 // The following declaration is the one that counts but cannot be used across different versions as stating Base64BinaryType would bind to a separate version
// Base64BinaryType would bind to a separate version
// Parameters install(@OperationParam(name = "npmContent",min = 1, max = 1) Base64BinaryType implementationGuide); // Parameters install(@OperationParam(name = "npmContent",min = 1, max = 1) Base64BinaryType implementationGuide);
// Parameters uninstall(@OperationParam(name = "name", min = 1, max = 1) String name, @OperationParam(name = // Parameters uninstall(@OperationParam(name = "name", min = 1, max = 1) String name, @OperationParam(name = "version", min = 1, max = 1) String version) ;
// "version", min = 1, max = 1) String version) ;
} }

View File

@@ -23,12 +23,10 @@ public class ImplementationGuideR4OperationProvider implements IImplementationGu
} }
@Operation(name = "$install", typeName = "ImplementationGuide") @Operation(name = "$install", typeName = "ImplementationGuide")
public Parameters install( public Parameters install(@OperationParam(name = "npmContent", min = 1, max = 1) Base64BinaryType implementationGuide) {
@OperationParam(name = "npmContent", min = 1, max = 1) Base64BinaryType implementationGuide) {
try { try {
packageInstallerSvc.install( packageInstallerSvc.install(IImplementationGuideOperationProvider.toPackageInstallationSpec(implementationGuide.getValue()));
IImplementationGuideOperationProvider.toPackageInstallationSpec(implementationGuide.getValue()));
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -36,12 +34,10 @@ public class ImplementationGuideR4OperationProvider implements IImplementationGu
} }
@Operation(name = "$uninstall", typeName = "ImplementationGuide") @Operation(name = "$uninstall", typeName = "ImplementationGuide")
public Parameters uninstall( public Parameters uninstall(@OperationParam(name = "name", min = 1, max = 1) String name, @OperationParam(name = "version", min = 1, max = 1) String version) {
@OperationParam(name = "name", min = 1, max = 1) String name,
@OperationParam(name = "version", min = 1, max = 1) String version) {
packageInstallerSvc.uninstall( packageInstallerSvc.uninstall(new PackageInstallationSpec().setName(name).setVersion(version));
new PackageInstallationSpec().setName(name).setVersion(version));
return new Parameters(); return new Parameters();
} }
} }

View File

@@ -23,25 +23,21 @@ public class ImplementationGuideR5OperationProvider implements IImplementationGu
} }
@Operation(name = "$install", typeName = "ImplementationGuide") @Operation(name = "$install", typeName = "ImplementationGuide")
public Parameters install( public Parameters install(@OperationParam(name = "npmContent", min = 1, max = 1) Base64BinaryType implementationGuide) {
@OperationParam(name = "npmContent", min = 1, max = 1) Base64BinaryType implementationGuide) {
try { try {
packageInstallerSvc.install( packageInstallerSvc.install(IImplementationGuideOperationProvider.toPackageInstallationSpec(implementationGuide.getValue()));
IImplementationGuideOperationProvider.toPackageInstallationSpec(implementationGuide.getValue()));
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
return new Parameters(); 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( @Operation(name = "$uninstall", typeName = "ImplementationGuide")
new PackageInstallationSpec().setName(name).setVersion(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));
return new Parameters(); return new Parameters();
} }
} }

View File

@@ -17,20 +17,21 @@ public class CustomContentFilesConfigurer implements WebMvcConfigurer {
public static final String CUSTOM_CONTENT = "/content"; public static final String CUSTOM_CONTENT = "/content";
private String customContentPath; private String customContentPath;
public CustomContentFilesConfigurer(AppProperties appProperties) { public CustomContentFilesConfigurer(AppProperties appProperties) {
customContentPath = appProperties.getCustom_content_path(); customContentPath = appProperties.getCustom_content_path();
if (customContentPath.endsWith("/")) if (customContentPath.endsWith("/"))
customContentPath = customContentPath.substring(0, customContentPath.lastIndexOf('/')); customContentPath = customContentPath.substring(0, customContentPath.lastIndexOf('/'));
} }
@Override @Override
public void addResourceHandlers(@NotNull ResourceHandlerRegistry theRegistry) { public void addResourceHandlers(@NotNull ResourceHandlerRegistry theRegistry) {
if (!theRegistry.hasMappingForPattern(CUSTOM_CONTENT + "/**")) { if (!theRegistry.hasMappingForPattern(CUSTOM_CONTENT + "/**")) {
try { try {
theRegistry theRegistry.addResourceHandler(CUSTOM_CONTENT + "/**").addResourceLocations(new FileUrlResource(customContentPath));
.addResourceHandler(CUSTOM_CONTENT + "/**")
.addResourceLocations(new FileUrlResource(customContentPath));
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }

View File

@@ -22,10 +22,7 @@ public class JobController {
} }
@RequestMapping(value = JobController.JOBS, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = JobController.JOBS, method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public List<JobInstance> getAllJobs( public List<JobInstance> getAllJobs(@RequestParam(name = "pageStart") @Min(0) int pageStart, @RequestParam(name = "batchSize") int batchSize, @RequestParam(name = "jobStatus", required = false) StatusEnum jobStatus) {
@RequestParam(name = "pageStart") @Min(0) int pageStart,
@RequestParam(name = "batchSize") int batchSize,
@RequestParam(name = "jobStatus", required = false) StatusEnum jobStatus) {
JobInstanceFetchRequest jobInstanceFetchRequest = new JobInstanceFetchRequest(); JobInstanceFetchRequest jobInstanceFetchRequest = new JobInstanceFetchRequest();
jobInstanceFetchRequest.setPageStart(pageStart); jobInstanceFetchRequest.setPageStart(pageStart);
jobInstanceFetchRequest.setBatchSize(batchSize); jobInstanceFetchRequest.setBatchSize(batchSize);
@@ -35,10 +32,7 @@ public class JobController {
return theJobCoordinator.fetchAllJobInstances(jobInstanceFetchRequest).getContent(); return theJobCoordinator.fetchAllJobInstances(jobInstanceFetchRequest).getContent();
} }
@RequestMapping( @RequestMapping(value = JobController.JOBS, method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
value = JobController.JOBS,
method = RequestMethod.DELETE,
produces = MediaType.APPLICATION_JSON_VALUE)
public JobOperationResultJson cancelInstance(@RequestParam(name = "instanceId") String instanceId) { public JobOperationResultJson cancelInstance(@RequestParam(name = "instanceId") String instanceId) {
return theJobCoordinator.cancelInstance(instanceId); return theJobCoordinator.cancelInstance(instanceId);
} }

View File

@@ -20,19 +20,21 @@ public class WebAppFilesConfigurer implements WebMvcConfigurer {
public static final String WEB_CONTENT = "web"; public static final String WEB_CONTENT = "web";
private String appContentPath; private String appContentPath;
public WebAppFilesConfigurer(AppProperties appProperties) { public WebAppFilesConfigurer(AppProperties appProperties) {
appContentPath = appProperties.getApp_content_path(); appContentPath = appProperties.getApp_content_path();
if (appContentPath.endsWith("/")) appContentPath = appContentPath.substring(0, appContentPath.lastIndexOf('/')); if (appContentPath.endsWith("/"))
appContentPath = appContentPath.substring(0, appContentPath.lastIndexOf('/'));
} }
@Override @Override
public void addResourceHandlers(@NotNull ResourceHandlerRegistry theRegistry) { public void addResourceHandlers(@NotNull ResourceHandlerRegistry theRegistry) {
if (!theRegistry.hasMappingForPattern(WEB_CONTENT + "/**")) { if (!theRegistry.hasMappingForPattern(WEB_CONTENT + "/**")) {
{ {
try { try {
theRegistry theRegistry.addResourceHandler(WEB_CONTENT + "/**").addResourceLocations(new FileUrlResource(appContentPath));
.addResourceHandler(WEB_CONTENT + "/**")
.addResourceLocations(new FileUrlResource(appContentPath));
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -45,10 +47,10 @@ public class WebAppFilesConfigurer implements WebMvcConfigurer {
String path = URI.create(appContentPath).getPath(); String path = URI.create(appContentPath).getPath();
String lastSegment = path.substring(path.lastIndexOf('/') + 1); String lastSegment = path.substring(path.lastIndexOf('/') + 1);
registry.addViewController(WEB_CONTENT + "/" + lastSegment) registry.addViewController(WEB_CONTENT + "/" + lastSegment).setViewName("redirect:" + lastSegment + "/index.html");
.setViewName("redirect:" + lastSegment + "/index.html");
registry.addViewController(WEB_CONTENT + "/" + lastSegment + "/").setViewName("redirect:index.html"); registry.addViewController(WEB_CONTENT + "/" + lastSegment + "/").setViewName("redirect:index.html");
registry.setOrder(Ordered.HIGHEST_PRECEDENCE); registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
} }
} }