
001/* 002 * #%L 003 * HAPI FHIR JPA Server 004 * %% 005 * Copyright (C) 2014 - 2025 Smile CDR, Inc. 006 * %% 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 * #L% 019 */ 020package ca.uhn.fhir.jpa.config; 021 022import ca.uhn.fhir.batch2.api.IJobCoordinator; 023import ca.uhn.fhir.batch2.api.IJobPersistence; 024import ca.uhn.fhir.batch2.jobs.export.BulkDataExportProvider; 025import ca.uhn.fhir.batch2.jobs.expunge.DeleteExpungeJobSubmitterImpl; 026import ca.uhn.fhir.batch2.util.Batch2TaskHelper; 027import ca.uhn.fhir.context.FhirContext; 028import ca.uhn.fhir.context.FhirVersionEnum; 029import ca.uhn.fhir.context.support.IValidationSupport; 030import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; 031import ca.uhn.fhir.interceptor.api.IInterceptorService; 032import ca.uhn.fhir.interceptor.executor.InterceptorService; 033import ca.uhn.fhir.interceptor.model.RequestPartitionId; 034import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; 035import ca.uhn.fhir.jpa.api.dao.DaoRegistry; 036import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoConceptMap; 037import ca.uhn.fhir.jpa.api.model.ExpungeOptions; 038import ca.uhn.fhir.jpa.api.svc.IIdHelperService; 039import ca.uhn.fhir.jpa.api.svc.ISearchUrlJobMaintenanceSvc; 040import ca.uhn.fhir.jpa.binary.interceptor.BinaryStorageInterceptor; 041import ca.uhn.fhir.jpa.binary.provider.BinaryAccessProvider; 042import ca.uhn.fhir.jpa.bulk.export.api.IBulkDataExportJobSchedulingHelper; 043import ca.uhn.fhir.jpa.bulk.export.svc.BulkDataExportJobSchedulingHelperImpl; 044import ca.uhn.fhir.jpa.bulk.export.svc.BulkExportHelperService; 045import ca.uhn.fhir.jpa.bulk.imprt.api.IBulkDataImportSvc; 046import ca.uhn.fhir.jpa.bulk.imprt.svc.BulkDataImportSvcImpl; 047import ca.uhn.fhir.jpa.cache.IResourceIdentifierCacheSvc; 048import ca.uhn.fhir.jpa.cache.IResourceTypeCacheSvc; 049import ca.uhn.fhir.jpa.cache.IResourceVersionSvc; 050import ca.uhn.fhir.jpa.cache.ISearchParamIdentityCacheSvc; 051import ca.uhn.fhir.jpa.cache.ResourceIdentifierCacheSvcImpl; 052import ca.uhn.fhir.jpa.cache.ResourceTypeCacheSvcImpl; 053import ca.uhn.fhir.jpa.cache.ResourceVersionSvcDaoImpl; 054import ca.uhn.fhir.jpa.dao.CacheTagDefinitionDao; 055import ca.uhn.fhir.jpa.dao.DaoSearchParamProvider; 056import ca.uhn.fhir.jpa.dao.HistoryBuilder; 057import ca.uhn.fhir.jpa.dao.HistoryBuilderFactory; 058import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc; 059import ca.uhn.fhir.jpa.dao.IJpaStorageResourceParser; 060import ca.uhn.fhir.jpa.dao.ISearchBuilder; 061import ca.uhn.fhir.jpa.dao.JpaBulkDataExportHistoryHelper; 062import ca.uhn.fhir.jpa.dao.JpaDaoResourceLinkResolver; 063import ca.uhn.fhir.jpa.dao.JpaStorageResourceParser; 064import ca.uhn.fhir.jpa.dao.MatchResourceUrlService; 065import ca.uhn.fhir.jpa.dao.ResourceHistoryCalculator; 066import ca.uhn.fhir.jpa.dao.SearchBuilderFactory; 067import ca.uhn.fhir.jpa.dao.TransactionProcessor; 068import ca.uhn.fhir.jpa.dao.data.IResourceIdentifierPatientUniqueEntityDao; 069import ca.uhn.fhir.jpa.dao.data.IResourceIdentifierSystemEntityDao; 070import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamIdentityDao; 071import ca.uhn.fhir.jpa.dao.data.IResourceLinkDao; 072import ca.uhn.fhir.jpa.dao.data.IResourceModifiedDao; 073import ca.uhn.fhir.jpa.dao.data.IResourceSearchUrlDao; 074import ca.uhn.fhir.jpa.dao.data.IResourceTypeDao; 075import ca.uhn.fhir.jpa.dao.data.ITagDefinitionDao; 076import ca.uhn.fhir.jpa.dao.expunge.ExpungeEverythingService; 077import ca.uhn.fhir.jpa.dao.expunge.ExpungeOperation; 078import ca.uhn.fhir.jpa.dao.expunge.ExpungeService; 079import ca.uhn.fhir.jpa.dao.expunge.IExpungeEverythingService; 080import ca.uhn.fhir.jpa.dao.expunge.IResourceExpungeService; 081import ca.uhn.fhir.jpa.dao.expunge.JpaResourceExpungeService; 082import ca.uhn.fhir.jpa.dao.expunge.ResourceTableFKProvider; 083import ca.uhn.fhir.jpa.dao.index.DaoSearchParamSynchronizer; 084import ca.uhn.fhir.jpa.dao.index.IdHelperService; 085import ca.uhn.fhir.jpa.dao.index.SearchParamWithInlineReferencesExtractor; 086import ca.uhn.fhir.jpa.dao.tx.HapiTransactionService; 087import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService; 088import ca.uhn.fhir.jpa.dao.validation.SearchParameterDaoValidator; 089import ca.uhn.fhir.jpa.delete.DeleteConflictFinderService; 090import ca.uhn.fhir.jpa.delete.DeleteConflictService; 091import ca.uhn.fhir.jpa.delete.ThreadSafeResourceDeleterSvc; 092import ca.uhn.fhir.jpa.entity.Search; 093import ca.uhn.fhir.jpa.entity.TermValueSet; 094import ca.uhn.fhir.jpa.esr.ExternallyStoredResourceServiceRegistry; 095import ca.uhn.fhir.jpa.graphql.DaoRegistryGraphQLStorageServices; 096import ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor; 097import ca.uhn.fhir.jpa.interceptor.JpaConsentContextServices; 098import ca.uhn.fhir.jpa.interceptor.OverridePathBasedReferentialIntegrityForDeletesInterceptor; 099import ca.uhn.fhir.jpa.interceptor.validation.RepositoryValidatingRuleBuilder; 100import ca.uhn.fhir.jpa.model.config.PartitionSettings; 101import ca.uhn.fhir.jpa.model.dao.JpaPid; 102import ca.uhn.fhir.jpa.model.sched.ISchedulerService; 103import ca.uhn.fhir.jpa.packages.IHapiPackageCacheManager; 104import ca.uhn.fhir.jpa.packages.IPackageInstallerSvc; 105import ca.uhn.fhir.jpa.packages.JpaPackageCache; 106import ca.uhn.fhir.jpa.packages.NpmJpaValidationSupport; 107import ca.uhn.fhir.jpa.packages.PackageInstallerSvcImpl; 108import ca.uhn.fhir.jpa.packages.util.PackageUtils; 109import ca.uhn.fhir.jpa.partition.IPartitionLookupSvc; 110import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc; 111import ca.uhn.fhir.jpa.partition.PartitionLookupSvcImpl; 112import ca.uhn.fhir.jpa.partition.PartitionManagementProvider; 113import ca.uhn.fhir.jpa.partition.RequestPartitionHelperSvc; 114import ca.uhn.fhir.jpa.provider.ConceptMapAddAndRemoveMappingProvider; 115import ca.uhn.fhir.jpa.provider.DiffProvider; 116import ca.uhn.fhir.jpa.provider.IReplaceReferencesSvc; 117import ca.uhn.fhir.jpa.provider.InstanceReindexProvider; 118import ca.uhn.fhir.jpa.provider.ProcessMessageProvider; 119import ca.uhn.fhir.jpa.provider.ReplaceReferencesSvcImpl; 120import ca.uhn.fhir.jpa.provider.SubscriptionTriggeringProvider; 121import ca.uhn.fhir.jpa.provider.TerminologyUploaderProvider; 122import ca.uhn.fhir.jpa.provider.ValueSetOperationProvider; 123import ca.uhn.fhir.jpa.provider.ValueSetOperationProviderDstu2; 124import ca.uhn.fhir.jpa.sched.AutowiringSpringBeanJobFactory; 125import ca.uhn.fhir.jpa.sched.HapiSchedulerServiceImpl; 126import ca.uhn.fhir.jpa.search.ISynchronousSearchSvc; 127import ca.uhn.fhir.jpa.search.PersistedJpaBundleProvider; 128import ca.uhn.fhir.jpa.search.PersistedJpaBundleProviderFactory; 129import ca.uhn.fhir.jpa.search.PersistedJpaIdSearchBundleProvider; 130import ca.uhn.fhir.jpa.search.PersistedJpaSearchFirstPageBundleProvider; 131import ca.uhn.fhir.jpa.search.ResourceSearchUrlSvc; 132import ca.uhn.fhir.jpa.search.SearchStrategyFactory; 133import ca.uhn.fhir.jpa.search.SearchUrlJobMaintenanceSvcImpl; 134import ca.uhn.fhir.jpa.search.SynchronousSearchSvcImpl; 135import ca.uhn.fhir.jpa.search.builder.QueryStack; 136import ca.uhn.fhir.jpa.search.builder.predicate.ComboNonUniqueSearchParameterPredicateBuilder; 137import ca.uhn.fhir.jpa.search.builder.predicate.ComboUniqueSearchParameterPredicateBuilder; 138import ca.uhn.fhir.jpa.search.builder.predicate.CoordsPredicateBuilder; 139import ca.uhn.fhir.jpa.search.builder.predicate.DatePredicateBuilder; 140import ca.uhn.fhir.jpa.search.builder.predicate.NumberPredicateBuilder; 141import ca.uhn.fhir.jpa.search.builder.predicate.QuantityNormalizedPredicateBuilder; 142import ca.uhn.fhir.jpa.search.builder.predicate.QuantityPredicateBuilder; 143import ca.uhn.fhir.jpa.search.builder.predicate.ResourceHistoryPredicateBuilder; 144import ca.uhn.fhir.jpa.search.builder.predicate.ResourceHistoryProvenancePredicateBuilder; 145import ca.uhn.fhir.jpa.search.builder.predicate.ResourceIdPredicateBuilder; 146import ca.uhn.fhir.jpa.search.builder.predicate.ResourceLinkPredicateBuilder; 147import ca.uhn.fhir.jpa.search.builder.predicate.ResourceTablePredicateBuilder; 148import ca.uhn.fhir.jpa.search.builder.predicate.SearchParamPresentPredicateBuilder; 149import ca.uhn.fhir.jpa.search.builder.predicate.StringPredicateBuilder; 150import ca.uhn.fhir.jpa.search.builder.predicate.TagPredicateBuilder; 151import ca.uhn.fhir.jpa.search.builder.predicate.TokenPredicateBuilder; 152import ca.uhn.fhir.jpa.search.builder.predicate.UriPredicateBuilder; 153import ca.uhn.fhir.jpa.search.builder.sql.GeneratedSql; 154import ca.uhn.fhir.jpa.search.builder.sql.SearchQueryBuilder; 155import ca.uhn.fhir.jpa.search.builder.sql.SearchQueryExecutor; 156import ca.uhn.fhir.jpa.search.builder.sql.SqlObjectFactory; 157import ca.uhn.fhir.jpa.search.builder.tasks.SearchTask; 158import ca.uhn.fhir.jpa.search.cache.DatabaseSearchCacheSvcImpl; 159import ca.uhn.fhir.jpa.search.cache.DatabaseSearchResultCacheSvcImpl; 160import ca.uhn.fhir.jpa.search.cache.ISearchCacheSvc; 161import ca.uhn.fhir.jpa.search.cache.ISearchResultCacheSvc; 162import ca.uhn.fhir.jpa.search.elastic.IndexNamePrefixLayoutStrategy; 163import ca.uhn.fhir.jpa.search.reindex.IInstanceReindexService; 164import ca.uhn.fhir.jpa.search.reindex.IResourceReindexingSvc; 165import ca.uhn.fhir.jpa.search.reindex.InstanceReindexServiceImpl; 166import ca.uhn.fhir.jpa.search.reindex.ResourceReindexer; 167import ca.uhn.fhir.jpa.search.reindex.ResourceReindexingSvcImpl; 168import ca.uhn.fhir.jpa.search.warm.CacheWarmingSvcImpl; 169import ca.uhn.fhir.jpa.search.warm.ICacheWarmingSvc; 170import ca.uhn.fhir.jpa.searchparam.MatchUrlService; 171import ca.uhn.fhir.jpa.searchparam.config.SearchParamConfig; 172import ca.uhn.fhir.jpa.searchparam.extractor.IResourceLinkResolver; 173import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamProvider; 174import ca.uhn.fhir.jpa.sp.ISearchParamPresenceSvc; 175import ca.uhn.fhir.jpa.sp.SearchParamIdentityCacheSvcImpl; 176import ca.uhn.fhir.jpa.sp.SearchParamPresenceSvcImpl; 177import ca.uhn.fhir.jpa.subscription.ResourceModifiedMessagePersistenceSvcImpl; 178import ca.uhn.fhir.jpa.term.TermCodeSystemStorageSvcImpl; 179import ca.uhn.fhir.jpa.term.TermConceptMappingSvcImpl; 180import ca.uhn.fhir.jpa.term.TermReadSvcImpl; 181import ca.uhn.fhir.jpa.term.TermReindexingSvcImpl; 182import ca.uhn.fhir.jpa.term.ValueSetConceptAccumulator; 183import ca.uhn.fhir.jpa.term.ValueSetConceptAccumulatorFactory; 184import ca.uhn.fhir.jpa.term.api.ITermCodeSystemStorageSvc; 185import ca.uhn.fhir.jpa.term.api.ITermConceptMappingSvc; 186import ca.uhn.fhir.jpa.term.api.ITermReadSvc; 187import ca.uhn.fhir.jpa.term.api.ITermReindexingSvc; 188import ca.uhn.fhir.jpa.term.config.TermCodeSystemConfig; 189import ca.uhn.fhir.jpa.util.JpaHapiTransactionService; 190import ca.uhn.fhir.jpa.util.MemoryCacheService; 191import ca.uhn.fhir.jpa.util.PartitionedIdModeVerificationSvc; 192import ca.uhn.fhir.jpa.util.PersistenceContextProvider; 193import ca.uhn.fhir.jpa.validation.JpaValidationSupportChain; 194import ca.uhn.fhir.jpa.validation.ResourceLoaderImpl; 195import ca.uhn.fhir.jpa.validation.ValidationSettings; 196import ca.uhn.fhir.model.api.IPrimitiveDatatype; 197import ca.uhn.fhir.replacereferences.PreviousResourceVersionRestorer; 198import ca.uhn.fhir.replacereferences.ReplaceReferencesPatchBundleSvc; 199import ca.uhn.fhir.replacereferences.ReplaceReferencesProvenanceSvc; 200import ca.uhn.fhir.replacereferences.UndoReplaceReferencesSvc; 201import ca.uhn.fhir.rest.api.SearchIncludeDeletedEnum; 202import ca.uhn.fhir.rest.api.server.RequestDetails; 203import ca.uhn.fhir.rest.api.server.bulk.IBulkDataExportHistoryHelper; 204import ca.uhn.fhir.rest.api.server.storage.IDeleteExpungeJobSubmitter; 205import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId; 206import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationInterceptor; 207import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc; 208import ca.uhn.fhir.rest.server.interceptor.consent.IConsentContextServices; 209import ca.uhn.fhir.rest.server.interceptor.partition.RequestTenantPartitionInterceptor; 210import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; 211import ca.uhn.fhir.subscription.api.IResourceModifiedMessagePersistenceSvc; 212import ca.uhn.fhir.util.IMetaTagSorter; 213import ca.uhn.fhir.util.MetaTagSorterAlphabetical; 214import ca.uhn.hapi.converters.canonical.VersionCanonicalizer; 215import jakarta.annotation.Nonnull; 216import jakarta.annotation.Nullable; 217import jakarta.persistence.EntityManager; 218import org.hl7.fhir.common.hapi.validation.support.UnknownCodeSystemWarningValidationSupport; 219import org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain; 220import org.hl7.fhir.common.hapi.validation.validator.WorkerContextValidationSupportAdapter; 221import org.hl7.fhir.utilities.graphql.IGraphQLStorageServices; 222import org.springframework.beans.factory.annotation.Autowired; 223import org.springframework.context.annotation.Bean; 224import org.springframework.context.annotation.Configuration; 225import org.springframework.context.annotation.Import; 226import org.springframework.context.annotation.Lazy; 227import org.springframework.context.annotation.Primary; 228import org.springframework.context.annotation.Scope; 229import org.springframework.core.task.AsyncTaskExecutor; 230import org.springframework.data.envers.repository.support.EnversRevisionRepositoryFactoryBean; 231import org.springframework.data.jpa.repository.config.EnableJpaRepositories; 232import org.springframework.scheduling.TaskScheduler; 233import org.springframework.scheduling.concurrent.ConcurrentTaskScheduler; 234import org.springframework.scheduling.concurrent.ScheduledExecutorFactoryBean; 235import org.springframework.transaction.PlatformTransactionManager; 236 237import java.util.Date; 238import java.util.List; 239 240@Configuration 241// repositoryFactoryBeanClass: EnversRevisionRepositoryFactoryBean is needed primarily for unit testing 242@EnableJpaRepositories( 243 basePackages = "ca.uhn.fhir.jpa.dao.data", 244 repositoryFactoryBeanClass = EnversRevisionRepositoryFactoryBean.class) 245@Import({ 246 BeanPostProcessorConfig.class, 247 TermCodeSystemConfig.class, 248 SearchParamConfig.class, 249 ValidationSupportConfig.class, 250 Batch2SupportConfig.class, 251 JpaBulkExportConfig.class, 252 SearchConfig.class, 253 PackageLoaderConfig.class, 254 EnversAuditConfig.class, 255 MdmJpaConfig.class 256}) 257public class JpaConfig { 258 public static final String JPA_VALIDATION_SUPPORT_CHAIN = "myJpaValidationSupportChain"; 259 public static final String JPA_VALIDATION_SUPPORT = "myJpaValidationSupport"; 260 public static final String TASK_EXECUTOR_NAME = "hapiJpaTaskExecutor"; 261 public static final String GRAPHQL_PROVIDER_NAME = "myGraphQLProvider"; 262 public static final String PERSISTED_JPA_BUNDLE_PROVIDER = "PersistedJpaBundleProvider"; 263 public static final String PERSISTED_JPA_BUNDLE_PROVIDER_BY_SEARCH = "PersistedJpaBundleProvider_BySearch"; 264 public static final String PERSISTED_JPA_ID_SEARCH_BUNDLE_PROVIDER = "PersistedJpaIdSearchBundleProvider"; 265 public static final String PERSISTED_JPA_SEARCH_FIRST_PAGE_BUNDLE_PROVIDER = 266 "PersistedJpaSearchFirstPageBundleProvider"; 267 public static final String HISTORY_BUILDER = "HistoryBuilder"; 268 public static final String HISTORY_BUILDER_WITH_IDS = "HistoryBuilderWithIds"; 269 public static final String DEFAULT_PROFILE_VALIDATION_SUPPORT = "myDefaultProfileValidationSupport"; 270 private static final String HAPI_DEFAULT_SCHEDULER_GROUP = "HAPI"; 271 272 @Autowired 273 public JpaStorageSettings myStorageSettings; 274 275 @Autowired 276 private PartitionSettings myPartitionSettings; 277 278 @Autowired 279 private FhirContext myFhirContext; 280 281 @Bean 282 public ValidationSupportChain.CacheConfiguration validationSupportChainCacheConfiguration() { 283 return ValidationSupportChain.CacheConfiguration.defaultValues(); 284 } 285 286 /** 287 * Note, there is a circular dependency between {@link WorkerContextValidationSupportAdapter} 288 * and {@link JpaValidationSupportChain}. The WorkerContextValidationSupportAdapter wraps 289 * an instance of {@link IValidationSupport} (which is what JpaValidationSupportChain is) 290 * but we also need to pass in the WorkerContextValidationSupportAdapter instance to the 291 * snapshot generator which is created within the {@literal @PostConstruct} method within 292 * JpaValidationSupportChain. 293 * <p> 294 * In order to allow the circular dependency to be created (since Spring doesn't like 295 * these), JpaValidationSupportChain calls {@link WorkerContextValidationSupportAdapter#setValidationSupport(IValidationSupport)} 296 * to pass itself in. 297 * </p> 298 * <p> 299 * This is obviously not ideal, but is the best we can do since the corelib 300 * tools all use {@link org.hl7.fhir.r5.context.IWorkerContext} interface as their 301 * input. See {@link WorkerContextValidationSupportAdapter} for more info. 302 * </p> 303 */ 304 @Bean 305 public WorkerContextValidationSupportAdapter workerContextValidationSupportAdapter() { 306 return new WorkerContextValidationSupportAdapter(); 307 } 308 309 @Bean(name = JpaConfig.JPA_VALIDATION_SUPPORT_CHAIN) 310 @Primary 311 public IValidationSupport jpaValidationSupportChain() { 312 return new JpaValidationSupportChain( 313 myFhirContext, validationSupportChainCacheConfiguration(), workerContextValidationSupportAdapter()); 314 } 315 316 @Bean("myDaoRegistry") 317 public DaoRegistry daoRegistry() { 318 return new DaoRegistry(); 319 } 320 321 @Lazy 322 @Bean 323 public CascadingDeleteInterceptor cascadingDeleteInterceptor( 324 FhirContext theFhirContext, 325 DaoRegistry theDaoRegistry, 326 IInterceptorBroadcaster theInterceptorBroadcaster, 327 ThreadSafeResourceDeleterSvc threadSafeResourceDeleterSvc) { 328 return new CascadingDeleteInterceptor( 329 theFhirContext, theDaoRegistry, theInterceptorBroadcaster, threadSafeResourceDeleterSvc); 330 } 331 332 @Bean 333 public ExternallyStoredResourceServiceRegistry ExternallyStoredResourceServiceRegistry() { 334 return new ExternallyStoredResourceServiceRegistry(); 335 } 336 337 @Lazy 338 @Bean 339 public ThreadSafeResourceDeleterSvc safeDeleter( 340 DaoRegistry theDaoRegistry, 341 IInterceptorBroadcaster theInterceptorBroadcaster, 342 HapiTransactionService hapiTransactionService) { 343 return new ThreadSafeResourceDeleterSvc(theDaoRegistry, theInterceptorBroadcaster, hapiTransactionService); 344 } 345 346 @Lazy 347 @Bean 348 public ResponseTerminologyTranslationInterceptor responseTerminologyTranslationInterceptor( 349 IValidationSupport theValidationSupport, 350 ResponseTerminologyTranslationSvc theResponseTerminologyTranslationSvc) { 351 return new ResponseTerminologyTranslationInterceptor( 352 theValidationSupport, theResponseTerminologyTranslationSvc); 353 } 354 355 @Bean 356 public ResponseTerminologyTranslationSvc responseTerminologyTranslationSvc( 357 IValidationSupport theValidationSupport) { 358 return new ResponseTerminologyTranslationSvc(theValidationSupport); 359 } 360 361 @Bean 362 @Lazy 363 public IGraphQLStorageServices graphqlStorageServices() { 364 return new DaoRegistryGraphQLStorageServices(); 365 } 366 367 @Bean 368 public ScheduledExecutorFactoryBean scheduledExecutorService() { 369 ScheduledExecutorFactoryBean b = new ScheduledExecutorFactoryBean(); 370 b.setPoolSize(5); 371 b.afterPropertiesSet(); 372 return b; 373 } 374 375 @Bean(name = "mySubscriptionTriggeringProvider") 376 @Lazy 377 public SubscriptionTriggeringProvider subscriptionTriggeringProvider() { 378 return new SubscriptionTriggeringProvider(); 379 } 380 381 @Bean 382 @Lazy 383 public ValueSetOperationProvider valueSetOperationProvider(FhirContext theFhirContext) { 384 if (theFhirContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU2)) { 385 return new ValueSetOperationProviderDstu2(); 386 } 387 return new ValueSetOperationProvider(); 388 } 389 390 @Bean 391 public IJpaStorageResourceParser jpaStorageResourceParser() { 392 return new JpaStorageResourceParser(); 393 } 394 395 @Bean 396 public TransactionProcessor transactionProcessor() { 397 return new TransactionProcessor(); 398 } 399 400 @Bean(name = "myAttachmentBinaryAccessProvider") 401 @Lazy 402 public BinaryAccessProvider binaryAccessProvider() { 403 return new BinaryAccessProvider(); 404 } 405 406 @Bean(name = "myBinaryStorageInterceptor") 407 @Lazy 408 public BinaryStorageInterceptor<? extends IPrimitiveDatatype<byte[]>> binaryStorageInterceptor( 409 JpaStorageSettings theStorageSettings, FhirContext theCtx) { 410 BinaryStorageInterceptor<? extends IPrimitiveDatatype<byte[]>> interceptor = 411 new BinaryStorageInterceptor<>(theCtx); 412 interceptor.setAllowAutoInflateBinaries(theStorageSettings.isAllowAutoInflateBinaries()); 413 interceptor.setAutoInflateBinariesMaximumSize(theStorageSettings.getAutoInflateBinariesMaximumBytes()); 414 return interceptor; 415 } 416 417 @Bean 418 public MemoryCacheService memoryCacheService(JpaStorageSettings theStorageSettings) { 419 return new MemoryCacheService(theStorageSettings); 420 } 421 422 @Bean 423 @Primary 424 public IResourceLinkResolver daoResourceLinkResolver() { 425 return new JpaDaoResourceLinkResolver(); 426 } 427 428 @Bean(name = PackageUtils.LOADER_WITH_CACHE) 429 public IHapiPackageCacheManager packageCacheManager() { 430 return new JpaPackageCache(); 431 } 432 433 @Bean 434 public NpmJpaValidationSupport npmJpaValidationSupport() { 435 return new NpmJpaValidationSupport(); 436 } 437 438 @Bean 439 public ValidationSettings validationSettings() { 440 return new ValidationSettings(); 441 } 442 443 @Bean 444 public ISearchCacheSvc searchCacheSvc() { 445 return new DatabaseSearchCacheSvcImpl(); 446 } 447 448 @Bean 449 public ISearchResultCacheSvc searchResultCacheSvc() { 450 return new DatabaseSearchResultCacheSvcImpl(); 451 } 452 453 @Bean 454 public ITermConceptMappingSvc termConceptMappingSvc() { 455 return new TermConceptMappingSvcImpl(); 456 } 457 458 @Bean 459 public TaskScheduler taskScheduler() { 460 ConcurrentTaskScheduler retVal = new ConcurrentTaskScheduler( 461 scheduledExecutorService().getObject(), 462 scheduledExecutorService().getObject()); 463 return retVal; 464 } 465 466 @Bean(name = TASK_EXECUTOR_NAME) 467 public AsyncTaskExecutor taskExecutor() { 468 ConcurrentTaskScheduler retVal = new ConcurrentTaskScheduler( 469 scheduledExecutorService().getObject(), 470 scheduledExecutorService().getObject()); 471 return retVal; 472 } 473 474 @Bean 475 public IResourceReindexingSvc resourceReindexingSvc() { 476 return new ResourceReindexingSvcImpl(); 477 } 478 479 @Bean 480 @Lazy 481 public IInstanceReindexService instanceReindexService() { 482 return new InstanceReindexServiceImpl(); 483 } 484 485 @Bean 486 @Lazy 487 public InstanceReindexProvider instanceReindexProvider(IInstanceReindexService theInstanceReindexService) { 488 return new InstanceReindexProvider(theInstanceReindexService); 489 } 490 491 @Bean 492 public ResourceReindexer resourceReindexer(FhirContext theFhirContext) { 493 return new ResourceReindexer(theFhirContext); 494 } 495 496 @Bean 497 public HapiFhirHibernateJpaDialect hibernateJpaDialect(FhirContext theFhirContext) { 498 return new HapiFhirHibernateJpaDialect(theFhirContext.getLocalizer()); 499 } 500 501 @Bean 502 @Lazy 503 public OverridePathBasedReferentialIntegrityForDeletesInterceptor 504 overridePathBasedReferentialIntegrityForDeletesInterceptor() { 505 return new OverridePathBasedReferentialIntegrityForDeletesInterceptor(); 506 } 507 508 @Bean 509 public IRequestPartitionHelperSvc requestPartitionHelperService() { 510 return new RequestPartitionHelperSvc(); 511 } 512 513 @Bean 514 public HapiTransactionService hapiTransactionService() { 515 return new JpaHapiTransactionService(); 516 } 517 518 @Bean 519 public IInterceptorService jpaInterceptorService() { 520 return new InterceptorService(); 521 } 522 523 @Bean 524 public IPackageInstallerSvc npmInstallerSvc() { 525 return new PackageInstallerSvcImpl(); 526 } 527 528 @Bean 529 public IConsentContextServices consentContextServices() { 530 return new JpaConsentContextServices(); 531 } 532 533 @Bean 534 @Lazy 535 public DiffProvider diffProvider() { 536 return new DiffProvider(); 537 } 538 539 @Bean 540 public IResourceIdentifierCacheSvc resourceIdentifierCacheSvc( 541 IHapiTransactionService theTransactionService, 542 MemoryCacheService theMemoryCache, 543 IResourceIdentifierSystemEntityDao theResourceIdentifierSystemEntityDao, 544 IResourceIdentifierPatientUniqueEntityDao theResourceIdentifierPatientUniqueEntityDao, 545 EntityManager theEntityManager) { 546 return new ResourceIdentifierCacheSvcImpl( 547 theTransactionService, 548 theMemoryCache, 549 theResourceIdentifierSystemEntityDao, 550 theResourceIdentifierPatientUniqueEntityDao, 551 theEntityManager); 552 } 553 554 @Bean 555 @Lazy 556 public ConceptMapAddAndRemoveMappingProvider conceptMapAddAndRemoveMappingProvider( 557 IFhirResourceDaoConceptMap<?> theConceptMapDao) { 558 return new ConceptMapAddAndRemoveMappingProvider(theConceptMapDao); 559 } 560 561 @Bean 562 @Lazy 563 public IPartitionLookupSvc partitionConfigSvc() { 564 return new PartitionLookupSvcImpl(); 565 } 566 567 @Bean 568 @Lazy 569 public PartitionManagementProvider partitionManagementProvider() { 570 return new PartitionManagementProvider(); 571 } 572 573 @Bean 574 @Lazy 575 public RequestTenantPartitionInterceptor requestTenantPartitionInterceptor() { 576 return new RequestTenantPartitionInterceptor(); 577 } 578 579 @Bean 580 @Lazy 581 public TerminologyUploaderProvider terminologyUploaderProvider() { 582 return new TerminologyUploaderProvider(); 583 } 584 585 @Bean 586 @Lazy 587 public ProcessMessageProvider processMessageProvider() { 588 return new ProcessMessageProvider(); 589 } 590 591 @Bean 592 public ISchedulerService schedulerService() { 593 return new HapiSchedulerServiceImpl().setDefaultGroup(HAPI_DEFAULT_SCHEDULER_GROUP); 594 } 595 596 @Bean 597 public AutowiringSpringBeanJobFactory schedulerJobFactory() { 598 return new AutowiringSpringBeanJobFactory(); 599 } 600 601 @Bean 602 public IBulkDataExportJobSchedulingHelper bulkDataExportJobSchedulingHelper( 603 DaoRegistry theDaoRegistry, 604 PlatformTransactionManager theTxManager, 605 JpaStorageSettings theStorageSettings, 606 BulkExportHelperService theBulkExportHelperSvc, 607 IJobPersistence theJpaJobPersistence) { 608 return new BulkDataExportJobSchedulingHelperImpl( 609 theDaoRegistry, theTxManager, theStorageSettings, theBulkExportHelperSvc, theJpaJobPersistence, null); 610 } 611 612 @Bean 613 @Lazy 614 public BulkDataExportProvider bulkDataExportProvider() { 615 return new BulkDataExportProvider(); 616 } 617 618 @Bean 619 @Lazy 620 public IDeleteExpungeJobSubmitter deleteExpungeJobSubmitter() { 621 return new DeleteExpungeJobSubmitterImpl(); 622 } 623 624 @Bean 625 @Lazy 626 public IBulkDataImportSvc bulkDataImportSvc() { 627 return new BulkDataImportSvcImpl(); 628 } 629 630 @Bean 631 public PersistedJpaBundleProviderFactory persistedJpaBundleProviderFactory() { 632 return new PersistedJpaBundleProviderFactory(); 633 } 634 635 @Bean 636 public SearchBuilderFactory<JpaPid> searchBuilderFactory() { 637 return new SearchBuilderFactory<>(); 638 } 639 640 @Bean 641 public SqlObjectFactory sqlBuilderFactory() { 642 return new SqlObjectFactory(); 643 } 644 645 @Bean 646 public HibernatePropertiesProvider HibernatePropertiesProvider() { 647 return new HibernatePropertiesProvider(); 648 } 649 650 @Bean 651 public HistoryBuilderFactory historyBuilderFactory() { 652 return new HistoryBuilderFactory(); 653 } 654 655 @Bean 656 public IResourceVersionSvc resourceVersionSvc() { 657 return new ResourceVersionSvcDaoImpl(); 658 } 659 660 @Bean 661 public ISearchParamIdentityCacheSvc searchParamIdentityCacheSvc( 662 @Autowired IResourceIndexedSearchParamIdentityDao theResourceIndexedSearchParamIdentityDao, 663 @Autowired PlatformTransactionManager theTxManager, 664 @Autowired MemoryCacheService theMemoryCacheService) { 665 return new SearchParamIdentityCacheSvcImpl( 666 myStorageSettings, theResourceIndexedSearchParamIdentityDao, theTxManager, theMemoryCacheService); 667 } 668 669 @Bean 670 public IResourceTypeCacheSvc resourceTypeCacheSvc( 671 @Autowired IHapiTransactionService theHapiTransactionService, 672 @Autowired IResourceTypeDao theResourceTypeDao, 673 @Autowired MemoryCacheService theMemoryCacheService) { 674 return new ResourceTypeCacheSvcImpl(theHapiTransactionService, theResourceTypeDao, theMemoryCacheService); 675 } 676 677 /* **************************************************************** * 678 * Prototype Beans Below * 679 * **************************************************************** */ 680 681 @Bean(name = PERSISTED_JPA_BUNDLE_PROVIDER) 682 @Scope("prototype") 683 public PersistedJpaBundleProvider newPersistedJpaBundleProvider(RequestDetails theRequest, String theUuid) { 684 return new PersistedJpaBundleProvider(theRequest, theUuid); 685 } 686 687 @Bean(name = PERSISTED_JPA_BUNDLE_PROVIDER_BY_SEARCH) 688 @Scope("prototype") 689 public PersistedJpaBundleProvider newPersistedJpaBundleProviderBySearch( 690 RequestDetails theRequest, Search theSearch) { 691 return new PersistedJpaBundleProvider(theRequest, theSearch); 692 } 693 694 @Bean(name = PERSISTED_JPA_SEARCH_FIRST_PAGE_BUNDLE_PROVIDER) 695 @Scope("prototype") 696 public PersistedJpaSearchFirstPageBundleProvider newPersistedJpaSearchFirstPageBundleProvider( 697 RequestDetails theRequest, 698 SearchTask theSearchTask, 699 ISearchBuilder<?> theSearchBuilder, 700 RequestPartitionId theRequestPartitionId) { 701 return new PersistedJpaSearchFirstPageBundleProvider( 702 theSearchTask, theSearchBuilder, theRequest, theRequestPartitionId); 703 } 704 705 @Bean(name = PERSISTED_JPA_ID_SEARCH_BUNDLE_PROVIDER) 706 @Scope("prototype") 707 public PersistedJpaIdSearchBundleProvider newPersistedJpaIdSearchBundleProvider( 708 String theResourceType, 709 List<String> theResourceIds, 710 RequestPartitionId thePartitionId, 711 @Nullable Date theRangeStartInclusive, 712 @Nonnull Date theRangeEndInclusive) { 713 return new PersistedJpaIdSearchBundleProvider( 714 theResourceType, theResourceIds, thePartitionId, theRangeStartInclusive, theRangeEndInclusive); 715 } 716 717 @Bean(name = RepositoryValidatingRuleBuilder.REPOSITORY_VALIDATING_RULE_BUILDER) 718 @Scope("prototype") 719 public RepositoryValidatingRuleBuilder repositoryValidatingRuleBuilder(IValidationSupport theValidationSupport) { 720 return new RepositoryValidatingRuleBuilder(theValidationSupport); 721 } 722 723 @Bean 724 @Scope("prototype") 725 public ComboUniqueSearchParameterPredicateBuilder newComboUniqueSearchParameterPredicateBuilder( 726 SearchQueryBuilder theSearchSqlBuilder) { 727 return new ComboUniqueSearchParameterPredicateBuilder(theSearchSqlBuilder); 728 } 729 730 @Bean 731 @Scope("prototype") 732 public ComboNonUniqueSearchParameterPredicateBuilder newComboNonUniqueSearchParameterPredicateBuilder( 733 SearchQueryBuilder theSearchSqlBuilder) { 734 return new ComboNonUniqueSearchParameterPredicateBuilder(theSearchSqlBuilder); 735 } 736 737 @Bean 738 @Scope("prototype") 739 public CoordsPredicateBuilder newCoordsPredicateBuilder(SearchQueryBuilder theSearchBuilder) { 740 return new CoordsPredicateBuilder(theSearchBuilder); 741 } 742 743 @Bean 744 @Scope("prototype") 745 public DatePredicateBuilder newDatePredicateBuilder(SearchQueryBuilder theSearchBuilder) { 746 return new DatePredicateBuilder(theSearchBuilder); 747 } 748 749 @Bean 750 @Scope("prototype") 751 public NumberPredicateBuilder newNumberPredicateBuilder(SearchQueryBuilder theSearchBuilder) { 752 return new NumberPredicateBuilder(theSearchBuilder); 753 } 754 755 @Bean 756 @Scope("prototype") 757 public QuantityPredicateBuilder newQuantityPredicateBuilder(SearchQueryBuilder theSearchBuilder) { 758 return new QuantityPredicateBuilder(theSearchBuilder); 759 } 760 761 @Bean 762 @Scope("prototype") 763 public QuantityNormalizedPredicateBuilder newQuantityNormalizedPredicateBuilder( 764 SearchQueryBuilder theSearchBuilder) { 765 return new QuantityNormalizedPredicateBuilder(theSearchBuilder); 766 } 767 768 @Bean 769 @Scope("prototype") 770 public ResourceLinkPredicateBuilder newResourceLinkPredicateBuilder( 771 QueryStack theQueryStack, SearchQueryBuilder theSearchBuilder, boolean theReversed) { 772 return new ResourceLinkPredicateBuilder(theQueryStack, theSearchBuilder, theReversed); 773 } 774 775 @Bean 776 @Scope("prototype") 777 public ResourceTablePredicateBuilder newResourceTablePredicateBuilder( 778 SearchQueryBuilder theSearchBuilder, SearchIncludeDeletedEnum theSearchIncludeDeleted) { 779 return new ResourceTablePredicateBuilder(theSearchBuilder, theSearchIncludeDeleted); 780 } 781 782 @Bean 783 @Scope("prototype") 784 public TagPredicateBuilder newTagPredicateBuilder(SearchQueryBuilder theSearchBuilder) { 785 return new TagPredicateBuilder(theSearchBuilder); 786 } 787 788 @Bean 789 @Scope("prototype") 790 public ResourceIdPredicateBuilder newResourceIdPredicateBuilder(SearchQueryBuilder theSearchBuilder) { 791 return new ResourceIdPredicateBuilder(theSearchBuilder); 792 } 793 794 @Bean 795 @Scope("prototype") 796 public SearchParamPresentPredicateBuilder newSearchParamPresentPredicateBuilder( 797 SearchQueryBuilder theSearchBuilder) { 798 return new SearchParamPresentPredicateBuilder(theSearchBuilder); 799 } 800 801 @Bean 802 @Scope("prototype") 803 public StringPredicateBuilder newStringPredicateBuilder(SearchQueryBuilder theSearchBuilder) { 804 return new StringPredicateBuilder(theSearchBuilder); 805 } 806 807 @Bean 808 @Scope("prototype") 809 public TokenPredicateBuilder newTokenPredicateBuilder(SearchQueryBuilder theSearchBuilder) { 810 return new TokenPredicateBuilder(theSearchBuilder); 811 } 812 813 @Bean 814 @Scope("prototype") 815 public ResourceHistoryPredicateBuilder newResourceHistoryPredicateBuilder(SearchQueryBuilder theSearchBuilder) { 816 return new ResourceHistoryPredicateBuilder(theSearchBuilder); 817 } 818 819 @Bean 820 @Scope("prototype") 821 public ResourceHistoryProvenancePredicateBuilder newResourceHistoryProvenancePredicateBuilder( 822 SearchQueryBuilder theSearchBuilder) { 823 return new ResourceHistoryProvenancePredicateBuilder(theSearchBuilder); 824 } 825 826 @Bean 827 @Scope("prototype") 828 public UriPredicateBuilder newUriPredicateBuilder(SearchQueryBuilder theSearchBuilder) { 829 return new UriPredicateBuilder(theSearchBuilder); 830 } 831 832 @Bean 833 @Scope("prototype") 834 public SearchQueryExecutor newSearchQueryExecutor(GeneratedSql theGeneratedSql, Integer theMaxResultsToFetch) { 835 return new SearchQueryExecutor(theGeneratedSql, theMaxResultsToFetch); 836 } 837 838 @Bean(name = HISTORY_BUILDER) 839 @Scope("prototype") 840 public HistoryBuilder newHistoryBuilder( 841 @Nullable String theResourceType, 842 @Nullable JpaPid theResourceId, 843 @Nullable Date theRangeStartInclusive, 844 @Nullable Date theRangeEndInclusive) { 845 return new HistoryBuilder(theResourceType, theResourceId, theRangeStartInclusive, theRangeEndInclusive); 846 } 847 848 @Bean(name = HISTORY_BUILDER_WITH_IDS) 849 @Scope("prototype") 850 public HistoryBuilder newHistoryBuilderWithIds( 851 @Nonnull String theResourceType, 852 @Nonnull List<String> theResourceIds, 853 @Nullable Date theRangeStartInclusive, 854 @Nonnull Date theRangeEndInclusive) { 855 return new HistoryBuilder(theResourceType, theResourceIds, theRangeStartInclusive, theRangeEndInclusive); 856 } 857 858 @Bean 859 @Primary 860 public ISearchParamProvider searchParamProvider() { 861 return new DaoSearchParamProvider(); 862 } 863 864 @Bean 865 public IIdHelperService idHelperService() { 866 return new IdHelperService(); 867 } 868 869 @Bean 870 public SearchStrategyFactory searchStrategyFactory(@Autowired(required = false) IFulltextSearchSvc theFulltextSvc) { 871 return new SearchStrategyFactory(myStorageSettings, theFulltextSvc); 872 } 873 874 @Bean 875 public DeleteConflictService deleteConflictService() { 876 return new DeleteConflictService(); 877 } 878 879 @Bean 880 public DeleteConflictFinderService deleteConflictFinderService() { 881 return new DeleteConflictFinderService(); 882 } 883 884 @Bean 885 public ExpungeService expungeService() { 886 return new ExpungeService(); 887 } 888 889 @Bean 890 @Scope("prototype") 891 public ExpungeOperation expungeOperation( 892 String theResourceName, 893 IResourcePersistentId theResourceId, 894 ExpungeOptions theExpungeOptions, 895 RequestDetails theRequestDetails) { 896 return new ExpungeOperation(theResourceName, theResourceId, theExpungeOptions, theRequestDetails); 897 } 898 899 @Bean 900 public IExpungeEverythingService expungeEverythingService() { 901 return new ExpungeEverythingService(); 902 } 903 904 @Bean 905 public IResourceExpungeService resourceExpungeService() { 906 return new JpaResourceExpungeService(); 907 } 908 909 @Bean 910 public ISearchParamPresenceSvc searchParamPresenceService() { 911 return new SearchParamPresenceSvcImpl(); 912 } 913 914 @Bean 915 public SearchParamWithInlineReferencesExtractor searchParamWithInlineReferencesExtractor() { 916 return new SearchParamWithInlineReferencesExtractor(); 917 } 918 919 @Bean 920 public MatchResourceUrlService matchResourceUrlService() { 921 return new MatchResourceUrlService(); 922 } 923 924 @Bean 925 public DaoSearchParamSynchronizer daoSearchParamSynchronizer() { 926 return new DaoSearchParamSynchronizer(); 927 } 928 929 @Bean 930 public ResourceTableFKProvider resourceTableFKProvider() { 931 return new ResourceTableFKProvider(); 932 } 933 934 @Bean 935 public ICacheWarmingSvc cacheWarmingSvc() { 936 return new CacheWarmingSvcImpl(); 937 } 938 939 @Bean 940 public IndexNamePrefixLayoutStrategy indexLayoutStrategy() { 941 return new IndexNamePrefixLayoutStrategy(); 942 } 943 944 @Bean 945 public ResourceLoaderImpl jpaResourceLoader() { 946 return new ResourceLoaderImpl(); 947 } 948 949 @Bean 950 public UnknownCodeSystemWarningValidationSupport unknownCodeSystemWarningValidationSupport( 951 FhirContext theFhirContext) { 952 return new UnknownCodeSystemWarningValidationSupport(theFhirContext); 953 } 954 955 @Bean 956 public ISynchronousSearchSvc synchronousSearchSvc() { 957 return new SynchronousSearchSvcImpl(); 958 } 959 960 @Bean 961 public VersionCanonicalizer versionCanonicalizer(FhirContext theFhirContext) { 962 return new VersionCanonicalizer(theFhirContext); 963 } 964 965 @Bean 966 public SearchParameterDaoValidator searchParameterDaoValidator( 967 FhirContext theFhirContext, 968 JpaStorageSettings theStorageSettings, 969 ISearchParamRegistry theSearchParamRegistry) { 970 return new SearchParameterDaoValidator(theFhirContext, theStorageSettings, theSearchParamRegistry); 971 } 972 973 @Bean 974 public ITermReadSvc terminologyService() { 975 return new TermReadSvcImpl(); 976 } 977 978 @Bean 979 public ValueSetConceptAccumulatorFactory valueSetConceptAccumulatorFactory() { 980 return new ValueSetConceptAccumulatorFactory(); 981 } 982 983 @Bean 984 @Scope("prototype") 985 public ValueSetConceptAccumulator valueSetConceptAccumulator(TermValueSet theTermValueSet) { 986 return valueSetConceptAccumulatorFactory().create(theTermValueSet); 987 } 988 989 @Bean 990 public ITermCodeSystemStorageSvc termCodeSystemStorageSvc() { 991 return new TermCodeSystemStorageSvcImpl(); 992 } 993 994 @Bean 995 public ITermReindexingSvc termReindexingSvc() { 996 return new TermReindexingSvcImpl(); 997 } 998 999 @Bean 1000 @Scope("prototype") 1001 public PersistenceContextProvider persistenceContextProvider() { 1002 return new PersistenceContextProvider(); 1003 } 1004 1005 @Bean 1006 public ResourceSearchUrlSvc resourceSearchUrlSvc( 1007 PersistenceContextProvider thePersistenceContextProvider, 1008 IResourceSearchUrlDao theResourceSearchUrlDao, 1009 MatchUrlService theMatchUrlService, 1010 FhirContext theFhirContext, 1011 PartitionSettings thePartitionSettings) { 1012 return new ResourceSearchUrlSvc( 1013 thePersistenceContextProvider.getEntityManager(), 1014 theResourceSearchUrlDao, 1015 theMatchUrlService, 1016 theFhirContext, 1017 thePartitionSettings); 1018 } 1019 1020 @Bean 1021 public ISearchUrlJobMaintenanceSvc searchUrlJobMaintenanceSvc(ResourceSearchUrlSvc theResourceSearchUrlSvc) { 1022 return new SearchUrlJobMaintenanceSvcImpl(theResourceSearchUrlSvc); 1023 } 1024 1025 @Bean 1026 public IResourceModifiedMessagePersistenceSvc subscriptionMessagePersistence( 1027 FhirContext theFhirContext, 1028 IResourceModifiedDao theIResourceModifiedDao, 1029 DaoRegistry theDaoRegistry, 1030 HapiTransactionService theHapiTransactionService) { 1031 return new ResourceModifiedMessagePersistenceSvcImpl( 1032 theFhirContext, theIResourceModifiedDao, theDaoRegistry, theHapiTransactionService); 1033 } 1034 1035 @Bean 1036 public IMetaTagSorter metaTagSorter() { 1037 return new MetaTagSorterAlphabetical(); 1038 } 1039 1040 @Bean 1041 public ResourceHistoryCalculator resourceHistoryCalculator( 1042 FhirContext theFhirContext, HibernatePropertiesProvider theHibernatePropertiesProvider) { 1043 return new ResourceHistoryCalculator(theFhirContext, theHibernatePropertiesProvider.isOracleDialect()); 1044 } 1045 1046 @Bean 1047 public CacheTagDefinitionDao tagDefinitionDao( 1048 ITagDefinitionDao tagDefinitionDao, MemoryCacheService memoryCacheService) { 1049 return new CacheTagDefinitionDao(tagDefinitionDao, memoryCacheService); 1050 } 1051 1052 @Bean 1053 public Batch2TaskHelper batch2TaskHelper() { 1054 return new Batch2TaskHelper(); 1055 } 1056 1057 @Bean 1058 public IReplaceReferencesSvc replaceReferencesSvc( 1059 DaoRegistry theDaoRegistry, 1060 HapiTransactionService theHapiTransactionService, 1061 IResourceLinkDao theResourceLinkDao, 1062 IJobCoordinator theJobCoordinator, 1063 ReplaceReferencesPatchBundleSvc theReplaceReferencesPatchBundle, 1064 Batch2TaskHelper theBatch2TaskHelper, 1065 JpaStorageSettings theStorageSettings, 1066 ReplaceReferencesProvenanceSvc theProvenanceSvc) { 1067 return new ReplaceReferencesSvcImpl( 1068 theDaoRegistry, 1069 theHapiTransactionService, 1070 theResourceLinkDao, 1071 theJobCoordinator, 1072 theReplaceReferencesPatchBundle, 1073 theBatch2TaskHelper, 1074 theStorageSettings, 1075 theProvenanceSvc); 1076 } 1077 1078 @Primary 1079 @Bean 1080 public ReplaceReferencesProvenanceSvc replaceReferencesProvenanceSvc(DaoRegistry theDaoRegistry) { 1081 return new ReplaceReferencesProvenanceSvc(theDaoRegistry); 1082 } 1083 1084 @Bean 1085 public ReplaceReferencesPatchBundleSvc replaceReferencesPatchBundleSvc(DaoRegistry theDaoRegistry) { 1086 return new ReplaceReferencesPatchBundleSvc(theDaoRegistry); 1087 } 1088 1089 @Bean 1090 public PreviousResourceVersionRestorer resourceVersionRestorer( 1091 DaoRegistry theDaoRegistry, HapiTransactionService theHapiTransactionService) { 1092 return new PreviousResourceVersionRestorer(theDaoRegistry, theHapiTransactionService); 1093 } 1094 1095 @Bean 1096 public UndoReplaceReferencesSvc getUndoReplaceReferencesSvc( 1097 DaoRegistry theDaoRegistry, 1098 ReplaceReferencesProvenanceSvc theProvenanceSvc, 1099 PreviousResourceVersionRestorer theResourceVersionRestorer) { 1100 return new UndoReplaceReferencesSvc(theDaoRegistry, theProvenanceSvc, theResourceVersionRestorer); 1101 } 1102 1103 @Bean 1104 public PartitionedIdModeVerificationSvc partitionedIdModeVerificationSvc( 1105 PartitionSettings thePartitionSettings, 1106 HibernatePropertiesProvider theHibernatePropertiesProvider, 1107 PlatformTransactionManager theTxManager) { 1108 return new PartitionedIdModeVerificationSvc(thePartitionSettings, theHibernatePropertiesProvider, theTxManager); 1109 } 1110 1111 @Bean 1112 public IBulkDataExportHistoryHelper bulkDataExportHistoryHelper() { 1113 return new JpaBulkDataExportHistoryHelper(); 1114 } 1115}