From eea6193df959608c226841444c8f3949af20f6d4 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Wed, 15 Feb 2023 08:43:01 -0500 Subject: [PATCH] JPA config refactoring (#4545) * Interceptor rework * Work on config refactor * Fixes * Docs tweaks * Address review comments * Test tweak * Test fixes * Try to fix tests * Test tweaks --- hapi-deployable-pom/pom.xml | 2 +- hapi-fhir-android/pom.xml | 2 +- hapi-fhir-base/pom.xml | 2 +- .../api/IBaseInterceptorService.java | 48 +- .../executor/BaseInterceptorService.java | 225 +- .../executor/InterceptorService.java | 4 +- .../uhn/fhir/system/HapiSystemProperties.java | 2 +- .../executor/InterceptorServiceTest.java | 194 +- hapi-fhir-bom/pom.xml | 4 +- hapi-fhir-checkstyle/pom.xml | 2 +- hapi-fhir-cli/hapi-fhir-cli-api/pom.xml | 2 +- .../ca/uhn/fhir/cli/RunServerCommand.java | 4 +- .../ca/uhn/fhir/cli/BulkImportCommandIT.java | 2 +- hapi-fhir-cli/hapi-fhir-cli-app/pom.xml | 2 +- hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml | 2 +- .../ca/uhn/fhir/jpa/demo/CommonConfig.java | 14 +- .../ca/uhn/fhir/jpa/demo/ContextHolder.java | 4 +- .../uhn/fhir/jpa/demo/FhirServerConfig.java | 8 +- .../ca/uhn/fhir/jpa/demo/JpaServerDemo.java | 18 +- hapi-fhir-cli/pom.xml | 2 +- hapi-fhir-client-okhttp/pom.xml | 2 +- hapi-fhir-client/pom.xml | 2 +- hapi-fhir-converter/pom.xml | 2 +- hapi-fhir-dist/pom.xml | 2 +- hapi-fhir-docs/pom.xml | 2 +- .../6_6_0/4545-interceptor-testing-speed.yaml | 5 + .../6_6_0/4545-jpa-settings-refactor.yaml | 6 + .../4545-remove-threadlocal-interceptors.yaml | 6 + .../fhir/docs/server_jpa/configuration.md | 26 +- .../uhn/hapi/fhir/docs/server_jpa/elastic.md | 4 +- .../ca/uhn/hapi/fhir/docs/server_jpa/lastn.md | 4 +- .../hapi/fhir/docs/server_jpa/performance.md | 2 +- .../uhn/hapi/fhir/docs/server_jpa/schema.md | 8 +- .../hapi/fhir/docs/server_jpa/upgrading.md | 4 +- .../fhir/docs/server_jpa_mdm/mdm_expansion.md | 4 +- .../docs/server_jpa_mdm/mdm_operations.md | 2 +- .../server_jpa_partitioning/partitioning.md | 2 +- .../fhir/docs/server_plain/rest_operations.md | 2 +- hapi-fhir-jacoco/pom.xml | 2 +- hapi-fhir-jaxrsserver-base/pom.xml | 2 +- .../client/JaxRsRestfulClientFactoryTest.java | 4 +- hapi-fhir-jpa/pom.xml | 2 +- hapi-fhir-jpaserver-base/pom.xml | 2 +- .../DatabaseBlobBinaryStorageSvcImpl.java | 13 +- ...BulkDataExportJobSchedulingHelperImpl.java | 17 +- .../export/svc/JpaBulkExportProcessor.java | 6 +- .../bulk/imprt/svc/BulkDataImportSvcImpl.java | 8 +- .../fhir/jpa/config/Batch2SupportConfig.java | 6 +- .../ca/uhn/fhir/jpa/config/JpaConfig.java | 31 +- .../ca/uhn/fhir/jpa/config/SearchConfig.java | 18 +- .../ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java | 60 +- .../fhir/jpa/dao/BaseHapiFhirResourceDao.java | 42 +- .../fhir/jpa/dao/BaseHapiFhirSystemDao.java | 16 +- .../fhir/jpa/dao/FulltextSearchSvcImpl.java | 57 +- .../jpa/dao/JpaResourceDaoObservation.java | 2 +- .../fhir/jpa/dao/JpaResourceDaoValueSet.java | 6 +- .../jpa/dao/JpaStorageResourceParser.java | 11 +- .../dao/ObservationLastNIndexPersistSvc.java | 4 +- .../fhir/jpa/dao/TransactionProcessor.java | 6 +- .../expunge/JpaResourceExpungeService.java | 6 +- .../fhir/jpa/dao/index/IdHelperService.java | 29 +- ...rchParamWithInlineReferencesExtractor.java | 20 +- .../search/ExtendedHSearchClauseBuilder.java | 10 +- .../search/ExtendedHSearchIndexExtractor.java | 77 +- .../fhir/jpa/dao/search/LastNOperation.java | 10 +- .../uhn/fhir/jpa/dao/search/package-info.java | 2 +- .../jpa/delete/DeleteConflictService.java | 8 +- .../batch2/DeleteExpungeSqlBuilder.java | 10 +- .../tasks/HapiFhirJpaMigrationTasks.java | 4 +- .../JpaCapabilityStatementProvider.java | 24 +- .../provider/JpaConformanceProviderDstu2.java | 20 +- .../provider/ValueSetOperationProvider.java | 32 +- .../dstu3/JpaConformanceProviderDstu3.java | 22 +- .../search/PersistedJpaBundleProvider.java | 12 +- .../jpa/search/SearchCoordinatorSvcImpl.java | 16 +- .../jpa/search/SearchStrategyFactory.java | 12 +- .../search/StaleSearchDeletingSvcImpl.java | 6 +- .../jpa/search/SynchronousSearchSvcImpl.java | 12 +- .../autocomplete/TokenAutocompleteSearch.java | 10 +- .../ValueSetAutocompleteOptions.java | 6 +- .../ValueSetAutocompleteSearch.java | 10 +- .../fhir/jpa/search/builder/QueryStack.java | 42 +- .../jpa/search/builder/SearchBuilder.java | 37 +- .../predicate/BasePredicateBuilder.java | 6 +- .../predicate/DatePredicateBuilder.java | 20 +- .../ICanMakeMissingParamPredicate.java | 4 +- .../ResourceLinkPredicateBuilder.java | 6 +- .../predicate/StringPredicateBuilder.java | 12 +- .../predicate/TokenPredicateBuilder.java | 26 +- .../builder/sql/SearchQueryBuilder.java | 30 +- .../builder/tasks/SearchContinuationTask.java | 6 +- .../jpa/search/builder/tasks/SearchTask.java | 26 +- .../cache/DatabaseSearchCacheSvcImpl.java | 12 +- .../IndexNamePrefixLayoutStrategy.java | 29 +- .../reindex/ResourceReindexingSvcImpl.java | 12 +- .../jpa/search/warm/CacheWarmingSvcImpl.java | 6 +- .../jpa/sp/SearchParamPresenceSvcImpl.java | 10 +- .../term/TermCodeSystemStorageSvcImpl.java | 12 +- .../jpa/term/TermDeferredStorageSvcImpl.java | 4 +- .../ca/uhn/fhir/jpa/term/TermReadSvcImpl.java | 14 +- ...DataExportJobSchedulingHelperImplTest.java | 84 +- .../svc/JpaBulkExportProcessorTest.java | 12 +- .../pom.xml | 2 +- ...ExportWithIndexedSearchParametersTest.java | 14 +- .../config/ElasticsearchWithPrefixConfig.java | 11 +- .../fhir/jpa/dao/r4/BaseR4SearchLastN.java | 14 +- .../FhirResourceDaoR4SearchLastNAsyncIT.java | 18 +- .../r4/FhirResourceDaoR4SearchLastNIT.java | 8 +- ...LastNUsingExtendedHSearchIndexAsyncIT.java | 8 +- ...earchLastNUsingExtendedHSearchIndexIT.java | 10 +- ...esourceDaoR4SearchWithElasticSearchIT.java | 102 +- ...sourceDaoR4TerminologyElasticsearchIT.java | 5 +- .../fhir/jpa/dao/r4/HSearchSandboxTest.java | 20 +- ...bservationIndexedSearchParamLastNR4IT.java | 8 +- .../r4/ResourceProviderR4ElasticTest.java | 17 +- .../TokenAutocompleteElasticsearchIT.java | 18 +- .../ValueSetAutocompleteOptionsTest.java | 10 +- .../ValueSetAutocompleteSearchTest.java | 6 +- .../ValueSetExpansionR4ElasticsearchIT.java | 18 +- hapi-fhir-jpaserver-ips/pom.xml | 2 +- .../jpa/ips/generator/IpsGenerationTest.java | 6 +- hapi-fhir-jpaserver-mdm/pom.xml | 2 +- .../jpa/mdm/svc/MdmControllerSvcImpl.java | 4 +- .../jpa/mdm/interceptor/MdmExpungeTest.java | 10 +- .../MdmSearchExpandingInterceptorIT.java | 42 +- .../fhir/jpa/mdm/provider/BaseLinkR4Test.java | 13 +- .../provider/MdmProviderClearLinkR4Test.java | 1 + hapi-fhir-jpaserver-model/pom.xml | 2 +- .../dialect/HapiSequenceStyleGenerator.java | 17 +- .../BaseResourceIndexedSearchParam.java | 12 +- .../ResourceIndexedSearchParamString.java | 14 +- ...{ModelConfig.java => StorageSettings.java} | 336 +- .../search/ExtendedHSearchIndexData.java | 10 +- .../jpa/model/search/HSearchIndexWriter.java | 14 +- .../ResourceIndexedSearchParamStringTest.java | 20 +- hapi-fhir-jpaserver-searchparam/pom.xml | 2 +- .../extractor/BaseSearchParamExtractor.java | 62 +- .../extractor/LogicalReferenceHelper.java | 4 +- .../ResourceIndexedSearchParams.java | 57 +- .../extractor/SearchParamExtractorDstu2.java | 6 +- .../extractor/SearchParamExtractorDstu3.java | 6 +- .../extractor/SearchParamExtractorR4.java | 6 +- .../extractor/SearchParamExtractorR4B.java | 6 +- .../extractor/SearchParamExtractorR5.java | 6 +- .../SearchParamExtractorService.java | 22 +- .../matcher/InMemoryResourceMatcher.java | 32 +- .../registry/SearchParamRegistryImpl.java | 12 +- .../fhir/jpa/searchparam/IndexStressTest.java | 4 +- .../ResourceIndexedSearchParamsTest.java | 12 +- .../SearchParamExtractorDstu3Test.java | 20 +- .../SearchParamExtractorMegaTest.java | 10 +- ...oryResourceMatcherConfigurationR5Test.java | 6 +- .../InMemoryResourceMatcherR5Test.java | 6 +- .../registry/SearchParamRegistryImplTest.java | 11 +- hapi-fhir-jpaserver-subscription/pom.xml | 2 +- .../config/SubscriptionProcessorConfig.java | 1 - .../config/WebsocketDispatcherConfig.java | 6 +- ...SubscriptionDeliveringEmailSubscriber.java | 6 +- ...mpositeInMemoryDaoSubscriptionMatcher.java | 7 +- .../MatchingQueueSubscriberLoader.java | 12 +- .../SubscriptionActivatingSubscriber.java | 10 +- .../SubscriptionMatcherInterceptor.java | 12 +- .../SubscriptionSubmitInterceptorLoader.java | 6 +- .../SubscriptionValidatingInterceptor.java | 11 +- .../SubscriptionTriggeringSvcImpl.java | 6 +- .../matching/DaoSubscriptionMatcherTest.java | 10 +- .../SubscriptionActivatingSubscriberTest.java | 6 +- .../module/BaseSubscriptionTest.java | 6 +- .../SubscriptionChannelRegistryTest.java | 4 +- .../module/config/TestSubscriptionConfig.java | 6 +- .../InMemorySubscriptionMatcherR3Test.java | 8 +- ...kingQueueSubscribableChannelDstu3Test.java | 119 +- .../SubscriptionMatchingSubscriberTest.java | 6 +- .../WebsocketConnectionValidatorTest.java | 15 +- .../SubscriptionMatcherInterceptorTest.java | 8 +- ...bscriptionSubmitInterceptorLoaderTest.java | 17 +- ...SubscriptionValidatingInterceptorTest.java | 31 +- hapi-fhir-jpaserver-test-dstu2/pom.xml | 2 +- .../fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java | 13 +- ...ceDaoDstu2SearchCustomSearchParamTest.java | 14 +- .../FhirResourceDaoDstu2SearchFtTest.java | 2 +- .../FhirResourceDaoDstu2SearchNoFtTest.java | 2 +- .../dao/dstu2/FhirResourceDaoDstu2Test.java | 24 +- .../FhirResourceDaoDstu2ValidateTest.java | 6 +- .../jpa/dao/dstu2/FhirSystemDaoDstu2Test.java | 2 +- .../BaseResourceProviderDstu2Test.java | 2 +- .../provider/ResourceProviderDstu2Test.java | 18 +- .../ResourceProviderExpungeDstu2Test.java | 10 +- .../jpa/provider/SubscriptionsDstu2Test.java | 4 +- .../jpa/provider/SystemProviderDstu2Test.java | 3 +- ...temProviderTransactionSearchDstu2Test.java | 8 +- .../ca/uhn/fhir/jpa/search/BaseSearchSvc.java | 6 +- .../search/SearchCoordinatorSvcImplTest.java | 17 +- .../search/SynchronousSearchSvcImplTest.java | 3 +- .../resthook/RestHookTestDstu2Test.java | 6 +- ...RegisteredToStorageSettingsDstu2Test.java} | 10 +- .../WebsocketWithCriteriaDstu2Test.java | 2 +- .../WebsocketWithSubscriptionIdDstu2Test.java | 2 +- hapi-fhir-jpaserver-test-dstu3/pom.xml | 2 +- ...ResourceDaoDstu3ExternalReferenceTest.java | 14 +- ...esourceDaoDstu3PhoneticSearchNoFtTest.java | 8 +- ...ourceDaoDstu3ReferentialIntegrityTest.java | 10 +- ...ceDaoDstu3SearchCustomSearchParamTest.java | 8 +- ...hirResourceDaoDstu3SearchDistanceTest.java | 3 +- .../FhirResourceDaoDstu3SearchFtTest.java | 2 +- .../FhirResourceDaoDstu3SearchNoFtTest.java | 8 +- .../dstu3/FhirResourceDaoDstu3SourceTest.java | 8 +- .../FhirResourceDaoDstu3TerminologyTest.java | 12 +- .../dao/dstu3/FhirResourceDaoDstu3Test.java | 40 +- .../dstu3/FhirResourceDaoDstu3UpdateTest.java | 10 +- .../jpa/dao/dstu3/FhirSystemDaoDstu3Test.java | 42 +- .../FhirSystemDaoTransactionDstu3Test.java | 6 +- .../fhir/jpa/dao/expunge/ExpungeHookTest.java | 16 +- .../jpa/packages/IgInstallerDstu3Test.java | 25 +- .../dstu3/BaseResourceProviderDstu3Test.java | 2 +- .../dstu3/CompositionDocumentDstu3Test.java | 8 +- .../dstu3/PatientEverythingDstu3Test.java | 12 +- ...rceProviderCustomSearchParamDstu3Test.java | 8 +- .../ResourceProviderDstu3DistanceTest.java | 2 +- .../dstu3/ResourceProviderDstu3Test.java | 30 +- .../ResourceProviderDstu3ValueSetTest.java | 12 +- ...rceProviderDstu3ValueSetVersionedTest.java | 20 +- .../ResourceProviderExpungeDstu3Test.java | 10 +- .../dstu3/SubscriptionsDstu3Test.java | 4 +- ...temProviderTransactionSearchDstu3Test.java | 8 +- .../PagingMultinodeProviderDstu3Test.java | 8 +- .../email/EmailSubscriptionDstu3Test.java | 8 +- .../resthook/RestHookTestDstu3Test.java | 6 +- ...RegisteredToStorageSettingsDstu3Test.java} | 10 +- .../SubscriptionTriggeringDstu3Test.java | 13 +- .../WebsocketWithCriteriaDstu3Test.java | 2 +- .../WebsocketWithSubscriptionIdDstu3Test.java | 2 +- ...minologyLoaderSvcIntegrationDstu3Test.java | 6 +- .../jpa/term/TerminologySvcImplDstu3Test.java | 6 +- hapi-fhir-jpaserver-test-r4/pom.xml | 2 +- .../fhir/jpa/batch2/Batch2CoordinatorIT.java | 16 +- .../jpa/batch2/Batch2JobMaintenanceIT.java | 8 +- .../DatabaseBlobBinaryStorageSvcImplTest.java | 6 +- .../jpa/bulk/BulkDataExportProviderTest.java | 16 +- .../uhn/fhir/jpa/bulk/BulkDataExportTest.java | 71 +- .../fhir/jpa/bulk/BulkExportUseCaseTest.java | 51 +- .../bulk/BulkExportUseCaseTestAnyMode.java | 6 +- .../jpa/bulk/imprt2/BulkImportR4Test.java | 8 +- .../jpa/dao/BaseHapiFhirResourceDaoTest.java | 36 +- .../JpaResourceDaoSearchParameterTest.java | 6 +- .../jpa/dao/TransactionProcessorTest.java | 16 +- .../jpa/dao/expunge/DeleteExpungeDaoTest.java | 30 +- .../jpa/dao/index/IdHelperServiceTest.java | 8 +- .../jpa/dao/r4/BaseComboParamsR4Test.java | 23 +- .../jpa/dao/r4/BasePartitioningR4Test.java | 16 +- .../fhir/jpa/dao/r4/ChainingR4SearchTest.java | 106 +- .../jpa/dao/r4/ConsentEventsDaoR4Test.java | 12 +- ...irResourceDaoCreatePlaceholdersR4Test.java | 109 +- .../r4/FhirResourceDaoR4CacheWarmingTest.java | 18 +- .../FhirResourceDaoR4ComboUniqueParamIT.java | 17 +- .../FhirResourceDaoR4ConcurrentWriteTest.java | 6 +- .../r4/FhirResourceDaoR4ContainedTest.java | 4 +- .../dao/r4/FhirResourceDaoR4CreateTest.java | 77 +- .../dao/r4/FhirResourceDaoR4DeleteTest.java | 6 +- ...hirResourceDaoR4ExternalReferenceTest.java | 14 +- .../dao/r4/FhirResourceDaoR4FilterTest.java | 10 +- .../FhirResourceDaoR4HistoryRewriteTest.java | 4 +- ...irResourceDaoR4InlineResourceModeTest.java | 6 +- .../r4/FhirResourceDaoR4InterceptorTest.java | 8 +- ...rResourceDaoR4InvalidSubscriptionTest.java | 4 +- .../r4/FhirResourceDaoR4QueryCountTest.java | 210 +- ...ResourceDaoR4ReferentialIntegrityTest.java | 16 +- ...ourceDaoR4SearchCustomSearchParamTest.java | 31 +- .../FhirResourceDaoR4SearchDistanceTest.java | 2 +- .../dao/r4/FhirResourceDaoR4SearchFtTest.java | 6 +- .../FhirResourceDaoR4SearchIncludeTest.java | 9 +- .../FhirResourceDaoR4SearchMissingTest.java | 24 +- .../r4/FhirResourceDaoR4SearchNoFtTest.java | 57 +- .../FhirResourceDaoR4SearchNoHashesTest.java | 3446 ----------------- .../FhirResourceDaoR4SearchOptimizedTest.java | 50 +- ...FhirResourceDaoR4SearchPageExpiryTest.java | 24 +- .../r4/FhirResourceDaoR4SearchSqlTest.java | 14 +- ...rceDaoR4SearchWithHSearchDisabledTest.java | 7 +- .../jpa/dao/r4/FhirResourceDaoR4SortTest.java | 10 +- .../dao/r4/FhirResourceDaoR4SourceTest.java | 8 +- ...rResourceDaoR4StandardQueriesNoFTTest.java | 2 +- .../jpa/dao/r4/FhirResourceDaoR4TagsTest.java | 18 +- .../r4/FhirResourceDaoR4TerminologyTest.java | 12 +- .../jpa/dao/r4/FhirResourceDaoR4Test.java | 75 +- .../dao/r4/FhirResourceDaoR4UpdateTest.java | 20 +- .../dao/r4/FhirResourceDaoR4ValidateTest.java | 22 +- .../dao/r4/FhirResourceDaoR4ValueSetTest.java | 12 +- ...irResourceDaoR4VersionedReferenceTest.java | 55 +- .../fhir/jpa/dao/r4/FhirSystemDaoR4Test.java | 59 +- .../uhn/fhir/jpa/dao/r4/JpaHistoryR4Test.java | 8 +- .../jpa/dao/r4/PartitioningSqlR4Test.java | 20 +- .../dao/r4/SearchParamExtractorR4Test.java | 60 +- .../dao/r4/SearchWithInterceptorR4Test.java | 2 +- .../uhn/fhir/jpa/dao/r4/SyntheaPerfTest.java | 14 +- .../jpa/dao/r4/TransactionDeleteR4Test.java | 2 +- .../fhir/jpa/dao/r4/TransactionHookTest.java | 2 +- .../delete/DeleteConflictServiceR4Test.java | 4 +- .../fhir/jpa/delete/job/ReindexJobTest.java | 6 +- ...DaoRegistryGraphQLStorageServicesTest.java | 6 +- ...adingDeleteInterceptorMultiThreadTest.java | 31 +- .../PartitioningInterceptorR4Test.java | 8 +- ...TerminologyTranslationInterceptorTest.java | 16 +- ...RepositoryValidatingInterceptorR4Test.java | 4 +- .../ca/uhn/fhir/jpa/packages/NpmR4Test.java | 48 +- ...ageInstallerSvcImplRewriteHistoryTest.java | 4 +- ...rtitionedSubscriptionTriggeringR4Test.java | 18 +- .../r4/AuthorizationInterceptorJpaR4Test.java | 6 +- .../r4/BinaryAccessProviderR4Test.java | 6 +- .../r4/BinaryStorageInterceptorR4Test.java | 6 +- .../r4/CompositionDocumentR4Test.java | 8 +- ...sentInterceptorResourceProviderR4Test.java | 16 +- .../jpa/provider/r4/EmptyIndexesR4Test.java | 6 +- .../fhir/jpa/provider/r4/ExpungeR4Test.java | 32 +- .../provider/r4/HookInterceptorR4Test.java | 6 +- .../r4/MultitenantBatchOperationR4Test.java | 22 +- .../provider/r4/MultitenantServerR4Test.java | 2 +- .../provider/r4/PatientEverythingR4Test.java | 20 +- .../r4/PatientMemberMatchOperationR4Test.java | 12 +- ...sourceProviderCustomSearchParamR4Test.java | 13 +- .../r4/ResourceProviderExpungeR4Test.java | 16 +- .../r4/ResourceProviderHasParamR4Test.java | 22 +- .../r4/ResourceProviderInterceptorR4Test.java | 8 +- ...roviderMeaningfulOutcomeMessageR4Test.java | 6 +- .../r4/ResourceProviderR4BundleTest.java | 14 +- .../r4/ResourceProviderR4CacheTest.java | 8 +- .../r4/ResourceProviderR4DistanceTest.java | 2 +- ...ResourceProviderR4SearchContainedTest.java | 31 +- .../provider/r4/ResourceProviderR4Test.java | 161 +- ...rceProviderR4ValueSetNoVerCSNoVerTest.java | 24 +- ...ourceProviderR4ValueSetVerCSNoVerTest.java | 20 +- ...esourceProviderR4ValueSetVerCSVerTest.java | 20 +- .../ResourceProviderSearchModifierR4Test.java | 28 +- .../r4/ResourceProviderSummaryModeR4Test.java | 18 +- ...rCapabilityStatementProviderJpaR4Test.java | 6 +- .../r4/StaleSearchDeletingSvcR4Test.java | 4 +- .../jpa/provider/r4/SubscriptionsR4Test.java | 4 +- .../jpa/provider/r4/SystemProviderR4Test.java | 22 +- ...SystemProviderTransactionSearchR4Test.java | 8 +- .../uhn/fhir/jpa/reindex/ReindexStepTest.java | 14 +- .../r4/PagingMultinodeProviderR4Test.java | 8 +- .../ResourceReindexingSvcImplTest.java | 9 +- .../stresstest/GiantTransactionPerfTest.java | 32 +- .../fhir/jpa/stresstest/StressTestR4Test.java | 24 +- .../subscription/BaseSubscriptionsR4Test.java | 6 +- ...SubscriptionValidatingInterceptorTest.java | 22 +- .../InMemorySubscriptionMatcherR4Test.java | 14 +- ...tivatesPreExistingSubscriptionsR4Test.java | 4 +- .../resthook/RestHookTestR4Test.java | 16 +- ...torRegisteredToStorageSettingsR4Test.java} | 10 +- .../RestHookWithEventDefinitionR4Test.java | 6 +- .../WebsocketWithCriteriaR4Test.java | 2 +- .../WebsocketWithSubscriptionIdR4Test.java | 2 +- .../ca/uhn/fhir/jpa/term/BaseTermR4Test.java | 10 +- .../jpa/term/TerminologySvcDeltaR4Test.java | 6 +- .../jpa/term/TerminologySvcImplR4Test.java | 16 +- .../jpa/term/ValueSetExpansionR4Test.java | 71 +- hapi-fhir-jpaserver-test-r4b/pom.xml | 2 +- .../uhn/fhir/jpa/dao/r4b/BaseJpaR4BTest.java | 25 +- .../r4b/BaseResourceProviderR4BTest.java | 2 +- .../provider/r4b/ResourceProviderR4BTest.java | 20 +- hapi-fhir-jpaserver-test-r5/pom.xml | 2 +- .../ca/uhn/fhir/jpa/dao/r5/BaseJpaR5Test.java | 23 +- .../dao/r5/FhirResourceDaoR5ValueSetTest.java | 17 +- .../dao/r5/SearchParamExtractorR5Test.java | 4 +- .../r5/StorageInterceptorEventsR5Test.java | 6 +- .../r5/AuthorizationInterceptorJpaR5Test.java | 6 +- .../r5/BaseResourceProviderR5Test.java | 2 +- .../provider/r5/ResourceProviderR5Test.java | 20 +- .../r5/ResourceProviderR5ValueSetTest.java | 38 +- ...sourceProviderR5ValueSetVersionedTest.java | 20 +- .../subscription/BaseSubscriptionsR5Test.java | 6 +- .../resthook/RestHookTestR5Test.java | 2 +- hapi-fhir-jpaserver-test-utilities/pom.xml | 2 +- .../provider/BaseResourceProviderR4Test.java | 3 +- .../r4/BaseResourceProviderR4Test.java | 2 +- .../QuantitySearchParameterTestCases.java | 15 +- .../uhn/fhir/jpa/test/BaseJpaDstu3Test.java | 19 +- .../ca/uhn/fhir/jpa/test/BaseJpaR4Test.java | 25 +- .../ca/uhn/fhir/jpa/test/BaseJpaTest.java | 24 +- .../BaseValueSetHSearchExpansionR4Test.java | 570 ++- .../ca/uhn/fhir/jpa/test/Batch2JobHelper.java | 4 +- .../jpa/test/PatientReindexTestHelper.java | 10 +- .../fhir/jpa/test/config/TestJPAConfig.java | 13 +- .../jpa/test/util/SubscriptionTestUtil.java | 12 +- .../jpa/util/WebsocketSubscriptionClient.java | 13 +- ...gTest.java => JpaStorageSettingsTest.java} | 17 +- .../jpa/dao/expunge/PartitionRunnerTest.java | 4 +- ...esourceDaoR4StandardQueriesLuceneTest.java | 10 +- .../ExtendedHSearchIndexExtractorTest.java | 14 +- .../jpa/delete/DeleteConflictServiceTest.java | 6 +- .../BaseSearchQueryBuilderDialectTest.java | 4 +- ...SearchQueryBuilderDialectPostgresTest.java | 15 +- .../builder/sql/SearchQueryBuilderTest.java | 34 +- .../fhir/jpa/util/MemoryCacheServiceTest.java | 8 +- hapi-fhir-jpaserver-uhnfhirtest/pom.xml | 2 +- .../ca/uhn/fhirtest/TestRestfulServer.java | 12 +- .../uhn/fhirtest/config/TestDstu2Config.java | 19 +- .../uhn/fhirtest/config/TestDstu3Config.java | 18 +- .../ca/uhn/fhirtest/config/TestR4BConfig.java | 17 +- .../ca/uhn/fhirtest/config/TestR4Config.java | 18 +- .../ca/uhn/fhirtest/config/TestR5Config.java | 17 +- hapi-fhir-server-mdm/pom.xml | 2 +- .../MdmSearchExpandingInterceptor.java | 6 +- hapi-fhir-server-openapi/pom.xml | 2 +- hapi-fhir-server/pom.xml | 2 +- .../rest/server/IRestfulServerDefaults.java | 2 +- .../hapi-fhir-caching-api/pom.xml | 2 +- .../hapi-fhir-caching-caffeine/pom.xml | 4 +- .../hapi-fhir-caching-guava/pom.xml | 2 +- .../hapi-fhir-caching-testing/pom.xml | 2 +- hapi-fhir-serviceloaders/pom.xml | 2 +- .../pom.xml | 2 +- .../autoconfigure/FhirAutoConfiguration.java | 18 +- .../FhirAutoConfigurationTest.java | 6 - .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../hapi-fhir-spring-boot-samples/pom.xml | 2 +- .../hapi-fhir-spring-boot-starter/pom.xml | 2 +- hapi-fhir-spring-boot/pom.xml | 2 +- hapi-fhir-sql-migrate/pom.xml | 2 +- hapi-fhir-storage-batch2-jobs/pom.xml | 2 +- .../jobs/export/ExpandResourcesStep.java | 6 +- .../jobs/export/FetchResourceIdsStep.java | 7 +- .../DeleteExpungeJobSubmitterImpl.java | 12 +- .../jobs/imprt/BulkDataImportProvider.java | 2 +- .../batch2/jobs/reindex/ReindexProvider.java | 2 +- .../jobs/export/ExpandResourcesStepTest.java | 4 +- .../jobs/export/FetchResourceIdsStepTest.java | 8 +- .../imprt/BulkDataImportProviderTest.java | 2 +- .../jobs/reindex/ReindexProviderTest.java | 2 +- hapi-fhir-storage-batch2/pom.xml | 2 +- .../fhir/batch2/config/BaseBatch2Config.java | 6 +- .../coordinator/JobCoordinatorImpl.java | 4 +- .../JobMaintenanceServiceImpl.java | 10 +- .../coordinator/JobCoordinatorImplTest.java | 2 +- .../JobMaintenanceServiceImplTest.java | 10 +- hapi-fhir-storage-cr/pom.xml | 2 +- .../java/ca/uhn/fhir/cr/TestCrConfig.java | 18 +- hapi-fhir-storage-mdm/pom.xml | 2 +- .../MdmSubmitterInterceptorLoader.java | 6 +- hapi-fhir-storage-test-utilities/pom.xml | 2 +- hapi-fhir-storage/pom.xml | 2 +- ...DaoConfig.java => JpaStorageSettings.java} | 761 +--- .../java/ca/uhn/fhir/jpa/api/dao/IDao.java | 7 - .../fhir/jpa/api/svc/IIdHelperService.java | 5 +- .../batch/models/Batch2JobStartResponse.java | 12 +- .../provider/BulkDataExportProvider.java | 12 +- .../ca/uhn/fhir/jpa/dao/BaseStorageDao.java | 34 +- .../fhir/jpa/dao/BaseStorageResourceDao.java | 8 +- .../jpa/dao/BaseTransactionProcessor.java | 32 +- .../fhir/jpa/dao/MatchResourceUrlService.java | 10 +- .../fhir/jpa/dao/SearchBuilderFactory.java | 6 +- .../jpa/dao/expunge/ExpungeOperation.java | 6 +- .../dao/index/DaoResourceLinkResolver.java | 10 +- .../SearchParameterDaoValidator.java | 12 +- .../fhir/jpa/provider/BaseJpaProvider.java | 8 +- .../uhn/fhir/jpa/util/MemoryCacheService.java | 12 +- hapi-fhir-structures-dstu2.1/pom.xml | 2 +- hapi-fhir-structures-dstu2/pom.xml | 2 +- hapi-fhir-structures-dstu3/pom.xml | 2 +- hapi-fhir-structures-hl7org-dstu2/pom.xml | 2 +- hapi-fhir-structures-r4/pom.xml | 2 +- hapi-fhir-structures-r4b/pom.xml | 2 +- hapi-fhir-structures-r5/pom.xml | 2 +- hapi-fhir-test-utilities/pom.xml | 2 +- .../fhir/system/HapiTestSystemProperties.java | 2 +- hapi-fhir-testpage-overlay/pom.xml | 2 +- .../uhn/fhir/jpa/test/FhirServerConfig.java | 6 +- .../fhir-jpabase-spring-test-config.xml | 47 - .../pom.xml | 2 +- hapi-fhir-validation-resources-dstu2/pom.xml | 2 +- hapi-fhir-validation-resources-dstu3/pom.xml | 2 +- hapi-fhir-validation-resources-r4/pom.xml | 2 +- hapi-fhir-validation-resources-r5/pom.xml | 2 +- hapi-fhir-validation/pom.xml | 2 +- hapi-tinder-plugin/pom.xml | 2 +- .../resources/vm/jpa_spring_beans_java.vm | 2 +- hapi-tinder-test/pom.xml | 2 +- pom.xml | 4 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- 483 files changed, 3782 insertions(+), 8223 deletions(-) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_6_0/4545-interceptor-testing-speed.yaml create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_6_0/4545-jpa-settings-refactor.yaml create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_6_0/4545-remove-threadlocal-interceptors.yaml rename hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/{ModelConfig.java => StorageSettings.java} (78%) rename hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/{RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test.java => RestHookTestWithInterceptorRegisteredToStorageSettingsDstu2Test.java} (96%) rename hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/{RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test.java => RestHookTestWithInterceptorRegisteredToStorageSettingsDstu3Test.java} (96%) delete mode 100644 hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java rename hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/{RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.java => RestHookTestWithInterceptorRegisteredToStorageSettingsR4Test.java} (96%) rename hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/{DaoConfigTest.java => JpaStorageSettingsTest.java} (60%) rename hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/config/{DaoConfig.java => JpaStorageSettings.java} (76%) delete mode 100644 hapi-fhir-testpage-overlay/src/test/resources/fhir-jpabase-spring-test-config.xml diff --git a/hapi-deployable-pom/pom.xml b/hapi-deployable-pom/pom.xml index a00b20652ff..23caed22e13 100644 --- a/hapi-deployable-pom/pom.xml +++ b/hapi-deployable-pom/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml index d43eda01ad0..fbdd23757c7 100644 --- a/hapi-fhir-android/pom.xml +++ b/hapi-fhir-android/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml index 35ce8e458fc..bc4d947753c 100644 --- a/hapi-fhir-base/pom.xml +++ b/hapi-fhir-base/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/IBaseInterceptorService.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/IBaseInterceptorService.java index 107aacaf035..c2c681ceb93 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/IBaseInterceptorService.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/IBaseInterceptorService.java @@ -27,51 +27,6 @@ import java.util.function.Predicate; public interface IBaseInterceptorService extends IBaseInterceptorBroadcaster { - /** - * Register an interceptor that will be used in a {@link ThreadLocal} context. - * This means that events will only be broadcast to the given interceptor if - * they were fired from the current thread. - *

- * Note that it is almost always desirable to call this method with a - * try-finally statement that removes the interceptor afterwards, since - * this can lead to memory leakage, poor performance due to ever-increasing - * numbers of interceptors, etc. - *

- *

- * Note that most methods such as {@link #getAllRegisteredInterceptors()} and - * {@link #unregisterAllInterceptors()} do not affect thread local interceptors - * as they are kept in a separate list. - *

- *

- * ThreadLocal interceptors are now disabled by default as of HAPI FHIR 6.2.0 and must be manually - * enabled by calling {@link ca.uhn.fhir.interceptor.executor.BaseInterceptorService#setThreadlocalInvokersEnabled(boolean)}. - * They are now deprecated. Registering a threadlocal interceptor without enabling this feature will - * result in a {@link IllegalArgumentException}. - *

- * - * @param theInterceptor The interceptor - * @return Returns true if at least one valid hook method was found on this interceptor - * @deprecated Threadlocal interceptors have been deprecated as of HAPI FHIR 6.2.0 and will be removed in a future release due to lack of use. If you feel that this is a bad decision, please speak up on the HAPI FHIR mailing list. - */ - @Deprecated - boolean registerThreadLocalInterceptor(Object theInterceptor); - - /** - * Unregisters a ThreadLocal interceptor - *

- * ThreadLocal interceptors are now disabled by default as of HAPI FHIR 6.2.0 and must be manually - * enabled by calling {@link ca.uhn.fhir.interceptor.executor.BaseInterceptorService#setThreadlocalInvokersEnabled(boolean)}. - * They are now deprecated. Registering a threadlocal interceptor without enabling this feature will - * result in a {@link IllegalArgumentException}. - *

- * - * @param theInterceptor The interceptor - * @see #registerThreadLocalInterceptor(Object) - * @deprecated Threadlocal interceptors have been deprecated as of HAPI FHIR 6.2.0 and will be removed in a future release due to lack of use. If you feel that this is a bad decision, please speak up on the HAPI FHIR mailing list. - */ - @Deprecated - void unregisterThreadLocalInterceptor(Object theInterceptor); - /** * Register an interceptor. This method has no effect if the given interceptor is already registered. * @@ -94,8 +49,7 @@ public interface IBaseInterceptorService extends IBa List getAllRegisteredInterceptors(); /** - * Unregisters all registered interceptors. Note that this method does not unregister - * any {@link #registerThreadLocalInterceptor(Object) thread local interceptors}. + * Unregisters all registered interceptors. */ void unregisterAllInterceptors(); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/BaseInterceptorService.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/BaseInterceptorService.java index 86260defb4a..865fa2cb368 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/BaseInterceptorService.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/BaseInterceptorService.java @@ -32,7 +32,6 @@ import ca.uhn.fhir.util.ReflectionUtil; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ListMultimap; -import com.google.common.collect.Multimaps; import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -51,32 +50,33 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; +import java.util.EnumSet; import java.util.HashMap; import java.util.IdentityHashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Predicate; import java.util.stream.Collectors; -// TODO: JA maybe add an enummap for pointcuts registered? -public abstract class BaseInterceptorService implements IBaseInterceptorService, IBaseInterceptorBroadcaster { +public abstract class BaseInterceptorService & IPointcut> implements IBaseInterceptorService, IBaseInterceptorBroadcaster { private static final Logger ourLog = LoggerFactory.getLogger(BaseInterceptorService.class); private final List myInterceptors = new ArrayList<>(); private final ListMultimap myGlobalInvokers = ArrayListMultimap.create(); private final ListMultimap myAnonymousInvokers = ArrayListMultimap.create(); private final Object myRegistryMutex = new Object(); - private final ThreadLocal> myThreadlocalInvokers = new ThreadLocal<>(); + private final Class myPointcutType; + private volatile EnumSet myRegisteredPointcuts; private String myName; - private boolean myThreadlocalInvokersEnabled = false; private boolean myWarnOnInterceptorWithNoHooks = true; /** * Constructor which uses a default name of "default" */ - public BaseInterceptorService() { - this("default"); + public BaseInterceptorService(Class thePointcutType) { + this(thePointcutType, "default"); } /** @@ -84,9 +84,11 @@ public abstract class BaseInterceptorService impleme * * @param theName The name for this registry (useful for troubleshooting) */ - public BaseInterceptorService(String theName) { + public BaseInterceptorService(Class thePointcutType, String theName) { super(); myName = theName; + myPointcutType = thePointcutType; + rebuildRegisteredPointcutSet(); } /** @@ -96,23 +98,6 @@ public abstract class BaseInterceptorService impleme myWarnOnInterceptorWithNoHooks = theWarnOnInterceptorWithNoHooks; } - /** - * Are threadlocal interceptors enabled on this registry (defaults to false) - */ - public boolean isThreadlocalInvokersEnabled() { - return myThreadlocalInvokersEnabled; - } - - /** - * Are threadlocal interceptors enabled on this registry (defaults to false) - * - * @deprecated ThreadLocal interceptors are deprecated as of HAPI FHIR 6.2.0 and will be removed in a future release. - */ - @Deprecated - public void setThreadlocalInvokersEnabled(boolean theThreadlocalInvokersEnabled) { - myThreadlocalInvokersEnabled = theThreadlocalInvokersEnabled; - } - @VisibleForTesting List getGlobalInterceptorsForUnitTest() { return myInterceptors; @@ -131,14 +116,15 @@ public abstract class BaseInterceptorService impleme if (!isInterceptorAlreadyRegistered(theInterceptor)) { myInterceptors.add(theInterceptor); } + + rebuildRegisteredPointcutSet(); } } @Override public List getAllRegisteredInterceptors() { synchronized (myRegistryMutex) { - List retVal = new ArrayList<>(); - retVal.addAll(myInterceptors); + List retVal = new ArrayList<>(myInterceptors); return Collections.unmodifiableList(retVal); } } @@ -156,14 +142,17 @@ public abstract class BaseInterceptorService impleme @Override public void unregisterInterceptors(@Nullable Collection theInterceptors) { if (theInterceptors != null) { - new ArrayList<>(theInterceptors).forEach(t -> unregisterInterceptor(t)); + // We construct a new list before iterating because the service's internal + // interceptor lists get passed into this method, and we get concurrent + // modification errors if we modify them at the same time as we iterate them + new ArrayList<>(theInterceptors).forEach(this::unregisterInterceptor); } } @Override public void registerInterceptors(@Nullable Collection theInterceptors) { if (theInterceptors != null) { - theInterceptors.forEach(t -> registerInterceptor(t)); + theInterceptors.forEach(this::registerInterceptor); } } @@ -187,37 +176,11 @@ public abstract class BaseInterceptorService impleme unregisterInterceptor(nextInvoker.getValue().getInterceptor()); } } + + rebuildRegisteredPointcutSet(); } } - @Override - public boolean registerThreadLocalInterceptor(Object theInterceptor) { - Validate.isTrue (myThreadlocalInvokersEnabled, "Thread local interceptors are not enabled on this server"); - ListMultimap invokers = getThreadLocalInvokerMultimap(); - scanInterceptorAndAddToInvokerMultimap(theInterceptor, invokers); - return !invokers.isEmpty(); - - } - - @Override - public void unregisterThreadLocalInterceptor(Object theInterceptor) { - Validate.isTrue (myThreadlocalInvokersEnabled, "Thread local interceptors are not enabled on this server"); - ListMultimap invokers = getThreadLocalInvokerMultimap(); - invokers.entries().removeIf(t -> t.getValue().getInterceptor() == theInterceptor); - if (invokers.isEmpty()) { - myThreadlocalInvokers.remove(); - } - } - - private ListMultimap getThreadLocalInvokerMultimap() { - ListMultimap invokers = myThreadlocalInvokers.get(); - if (invokers == null) { - invokers = Multimaps.synchronizedListMultimap(ArrayListMultimap.create()); - myThreadlocalInvokers.set(invokers); - } - return invokers; - } - @Override public boolean registerInterceptor(Object theInterceptor) { synchronized (myRegistryMutex) { @@ -238,10 +201,19 @@ public abstract class BaseInterceptorService impleme myInterceptors.add(theInterceptor); sortByOrderAnnotation(myInterceptors); + rebuildRegisteredPointcutSet(); + return true; } } + private void rebuildRegisteredPointcutSet() { + EnumSet registeredPointcuts = EnumSet.noneOf(myPointcutType); + registeredPointcuts.addAll(myAnonymousInvokers.keySet()); + registeredPointcuts.addAll(myGlobalInvokers.keySet()); + myRegisteredPointcuts = registeredPointcuts; + } + private boolean isInterceptorAlreadyRegistered(Object theInterceptor) { for (Object next : myInterceptors) { if (next == theInterceptor) { @@ -257,6 +229,7 @@ public abstract class BaseInterceptorService impleme boolean removed = myInterceptors.removeIf(t -> t == theInterceptor); removed |= myGlobalInvokers.entries().removeIf(t -> t.getValue().getInterceptor() == theInterceptor); removed |= myAnonymousInvokers.entries().removeIf(t -> t.getValue().getInterceptor() == theInterceptor); + rebuildRegisteredPointcutSet(); return removed; } } @@ -286,14 +259,7 @@ public abstract class BaseInterceptorService impleme @Override public boolean hasHooks(POINTCUT thePointcut) { - return myGlobalInvokers.containsKey(thePointcut) - || myAnonymousInvokers.containsKey(thePointcut) - || hasThreadLocalHooks(thePointcut); - } - - private boolean hasThreadLocalHooks(POINTCUT thePointcut) { - ListMultimap hooks = myThreadlocalInvokersEnabled ? myThreadlocalInvokers.get() : null; - return hooks != null && hooks.containsKey(thePointcut); + return myRegisteredPointcuts.contains(thePointcut); } @Override @@ -352,12 +318,6 @@ public abstract class BaseInterceptorService impleme List globalInvokers = myGlobalInvokers.get(thePointcut); List anonymousInvokers = myAnonymousInvokers.get(thePointcut); List threadLocalInvokers = null; - if (myThreadlocalInvokersEnabled) { - ListMultimap pointcutToInvokers = myThreadlocalInvokers.get(); - if (pointcutToInvokers != null) { - threadLocalInvokers = pointcutToInvokers.get(thePointcut); - } - } invokers = union(globalInvokers, anonymousInvokers, threadLocalInvokers); } @@ -368,7 +328,7 @@ public abstract class BaseInterceptorService impleme * First argument must be the global invoker list!! */ @SafeVarargs - private final List union(List... theInvokersLists) { + private List union(List... theInvokersLists) { List haveOne = null; boolean haveMultiple = false; for (List nextInvokerList : theInvokersLists) { @@ -404,8 +364,8 @@ public abstract class BaseInterceptorService impleme retVal = Arrays .stream(theInvokersLists) - .filter(t -> t != null) - .flatMap(t -> t.stream()) + .filter(Objects::nonNull) + .flatMap(Collection::stream) .sorted() .collect(Collectors.toList()); @@ -417,7 +377,7 @@ public abstract class BaseInterceptorService impleme /** * Only call this when assertions are enabled, it's expensive */ - boolean haveAppropriateParams(POINTCUT thePointcut, HookParams theParams) { + final boolean haveAppropriateParams(POINTCUT thePointcut, HookParams theParams) { if (theParams.getParamsForType().values().size() != thePointcut.getParameterTypes().size()) { throw new IllegalArgumentException(Msg.code(1909) + String.format("Wrong number of params for pointcut %s - Wanted %s but found %s", thePointcut.name(), toErrorString(thePointcut.getParameterTypes()), theParams.getParamsForType().values().stream().map(t -> t != null ? t.getClass().getSimpleName() : "null").sorted().collect(Collectors.toList()))); } @@ -449,16 +409,16 @@ public abstract class BaseInterceptorService impleme // Register the interceptor and its various hooks for (HookInvoker nextAddedHook : addedInvokers) { - IPointcut nextPointcut = nextAddedHook.getPointcut(); + POINTCUT nextPointcut = nextAddedHook.getPointcut(); if (nextPointcut.equals(Pointcut.INTERCEPTOR_REGISTERED)) { continue; } - theInvokers.put((POINTCUT) nextPointcut, nextAddedHook); + theInvokers.put(nextPointcut, nextAddedHook); } // Make sure we're always sorted according to the order declared in @Order - for (IPointcut nextPointcut : theInvokers.keys()) { - List nextInvokerList = theInvokers.get((POINTCUT) nextPointcut); + for (POINTCUT nextPointcut : theInvokers.keys()) { + List nextInvokerList = theInvokers.get(nextPointcut); nextInvokerList.sort(Comparator.naturalOrder()); } @@ -489,60 +449,12 @@ public abstract class BaseInterceptorService impleme protected abstract Optional scanForHook(Method nextMethod); - protected static Optional findAnnotation(AnnotatedElement theObject, Class theHookClass) { - T annotation; - if (theObject instanceof Method) { - annotation = MethodUtils.getAnnotation((Method) theObject, theHookClass, true, true); - } else { - annotation = theObject.getAnnotation(theHookClass); - } - return Optional.ofNullable(annotation); - } - - private static int determineOrder(Class theInterceptorClass) { - int typeOrder = Interceptor.DEFAULT_ORDER; - Optional typeOrderAnnotation = findAnnotation(theInterceptorClass, Interceptor.class); - if (typeOrderAnnotation.isPresent()) { - typeOrder = typeOrderAnnotation.get().order(); - } - return typeOrder; - } - - private static String toErrorString(List theParameterTypes) { - return theParameterTypes - .stream() - .sorted() - .collect(Collectors.joining(",")); - } - - protected abstract static class BaseInvoker implements Comparable { - - private final int myOrder; - private final Object myInterceptor; - - BaseInvoker(Object theInterceptor, int theOrder) { - myInterceptor = theInterceptor; - myOrder = theOrder; - } - - public Object getInterceptor() { - return myInterceptor; - } - - abstract Object invoke(HookParams theParams); - - @Override - public int compareTo(BaseInvoker theInvoker) { - return myOrder - theInvoker.myOrder; - } - } - - private static class HookInvoker extends BaseInvoker { + private class HookInvoker extends BaseInvoker { private final Method myMethod; private final Class[] myParameterTypes; private final int[] myParameterIndexes; - private final IPointcut myPointcut; + private final POINTCUT myPointcut; /** * Constructor @@ -579,7 +491,7 @@ public abstract class BaseInterceptorService impleme .toString(); } - public IPointcut getPointcut() { + public POINTCUT getPointcut() { return myPointcut; } @@ -624,17 +536,17 @@ public abstract class BaseInterceptorService impleme } - protected static class HookDescriptor { + protected class HookDescriptor { - private final IPointcut myPointcut; + private final POINTCUT myPointcut; private final int myOrder; - public HookDescriptor(IPointcut thePointcut, int theOrder) { + public HookDescriptor(POINTCUT thePointcut, int theOrder) { myPointcut = thePointcut; myOrder = theOrder; } - IPointcut getPointcut() { + POINTCUT getPointcut() { return myPointcut; } @@ -644,4 +556,49 @@ public abstract class BaseInterceptorService impleme } + protected abstract static class BaseInvoker implements Comparable { + + private final int myOrder; + private final Object myInterceptor; + + BaseInvoker(Object theInterceptor, int theOrder) { + myInterceptor = theInterceptor; + myOrder = theOrder; + } + + public Object getInterceptor() { + return myInterceptor; + } + + abstract Object invoke(HookParams theParams); + + @Override + public int compareTo(BaseInvoker theInvoker) { + return myOrder - theInvoker.myOrder; + } + } + + protected static Optional findAnnotation(AnnotatedElement theObject, Class theHookClass) { + T annotation; + if (theObject instanceof Method) { + annotation = MethodUtils.getAnnotation((Method) theObject, theHookClass, true, true); + } else { + annotation = theObject.getAnnotation(theHookClass); + } + return Optional.ofNullable(annotation); + } + + private static int determineOrder(Class theInterceptorClass) { + return findAnnotation(theInterceptorClass, Interceptor.class) + .map(Interceptor::order) + .orElse(Interceptor.DEFAULT_ORDER); + } + + private static String toErrorString(List theParameterTypes) { + return theParameterTypes + .stream() + .sorted() + .collect(Collectors.joining(",")); + } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/InterceptorService.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/InterceptorService.java index 2806cb2e879..e73fd98c59a 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/InterceptorService.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/InterceptorService.java @@ -48,7 +48,7 @@ public class InterceptorService extends BaseInterceptorService impleme * @param theName The name for this registry (useful for troubleshooting) */ public InterceptorService(String theName) { - super(theName); + super(Pointcut.class, theName); } @Override @@ -72,7 +72,7 @@ public class InterceptorService extends BaseInterceptorService impleme } - private class AnonymousLambdaInvoker extends BaseInvoker { + private static class AnonymousLambdaInvoker extends BaseInvoker { private final IAnonymousInterceptor myHook; private final Pointcut myPointcut; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/system/HapiSystemProperties.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/system/HapiSystemProperties.java index f6f964c5ab6..a9ed2e1ebde 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/system/HapiSystemProperties.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/system/HapiSystemProperties.java @@ -142,7 +142,7 @@ public final class HapiSystemProperties { } /** - * This property sets {@link DaoConfig#setStatusBasedReindexingDisabled(Boolean)} to true when the system starts up. + * This property sets {@link JpaStorageSettings#setStatusBasedReindexingDisabled(Boolean)} to true when the system starts up. */ public static void enableStatusBasedReindex() { System.clearProperty(DISABLE_STATUS_BASED_REINDEX); diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/interceptor/executor/InterceptorServiceTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/interceptor/executor/InterceptorServiceTest.java index b12d4a71011..d087b1d697f 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/interceptor/executor/InterceptorServiceTest.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/interceptor/executor/InterceptorServiceTest.java @@ -3,18 +3,16 @@ package ca.uhn.fhir.interceptor.executor; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.api.Hook; import ca.uhn.fhir.interceptor.api.HookParams; +import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor; +import ca.uhn.fhir.interceptor.api.IPointcut; import ca.uhn.fhir.interceptor.api.Interceptor; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.rest.server.exceptions.AuthenticationException; import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; -import ca.uhn.fhir.util.StopWatch; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; @@ -24,16 +22,14 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.contains; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -//import org.junit.jupiter.api.Disabled; - public class InterceptorServiceTest { - private static final Logger ourLog = LoggerFactory.getLogger(InterceptorServiceTest.class); - private List myInvocations = new ArrayList<>(); + private final List myInvocations = new ArrayList<>(); @Test public void testInterceptorWithAnnotationDefinedOnInterface() { @@ -203,8 +199,11 @@ public class InterceptorServiceTest { // Registered in opposite order to verify that the order on the annotation is used MyTestInterceptorTwo interceptor1 = new MyTestInterceptorTwo(); MyTestInterceptorOne interceptor0 = new MyTestInterceptorOne(); + assertFalse(svc.hasHooks(Pointcut.TEST_RB)); svc.registerInterceptor(interceptor1); + assertTrue(svc.hasHooks(Pointcut.TEST_RB)); svc.registerInterceptor(interceptor0); + assertTrue(svc.hasHooks(Pointcut.TEST_RB)); // Register the manual interceptor (has Order right in the middle) MyTestInterceptorManual myInterceptorManual = new MyTestInterceptorManual(); @@ -236,6 +235,12 @@ public class InterceptorServiceTest { assertTrue(globalInterceptors.get(0) instanceof MyTestInterceptorOne, globalInterceptors.get(0).getClass().toString()); assertTrue(globalInterceptors.get(1) instanceof MyTestInterceptorTwo, globalInterceptors.get(1).getClass().toString()); + // Unregister the two others + assertTrue(svc.hasHooks(Pointcut.TEST_RB)); + svc.unregisterInterceptor(interceptor1); + assertTrue(svc.hasHooks(Pointcut.TEST_RB)); + svc.unregisterInterceptor(interceptor0); + assertFalse(svc.hasHooks(Pointcut.TEST_RB)); } @Test @@ -248,8 +253,10 @@ public class InterceptorServiceTest { svc.registerInterceptor(interceptor1); svc.registerInterceptor(interceptor0); - boolean outcome = svc.callHooks(Pointcut.TEST_RB, new HookParams("A", "B")); - assertTrue(outcome); + if (svc.hasHooks(Pointcut.TEST_RB)) { + boolean outcome = svc.callHooks(Pointcut.TEST_RB, new HookParams("A", "B")); + assertTrue(outcome); + } assertThat(myInvocations, contains("MyTestInterceptorOne.testRb", "MyTestInterceptorTwo.testRb")); assertSame("A", interceptor0.myLastString0); @@ -257,6 +264,26 @@ public class InterceptorServiceTest { assertSame("B", interceptor1.myLastString1); } + @Test + public void testInvokeAnonymousInterceptorMethods() { + InterceptorService svc = new InterceptorService(); + + MyTestAnonymousInterceptorOne interceptor0 = new MyTestAnonymousInterceptorOne(); + MyTestAnonymousInterceptorTwo interceptor1 = new MyTestAnonymousInterceptorTwo(); + svc.registerAnonymousInterceptor(Pointcut.TEST_RB, interceptor0); + svc.registerAnonymousInterceptor(Pointcut.TEST_RB, interceptor1); + + if (svc.hasHooks(Pointcut.TEST_RB)) { + boolean outcome = svc.callHooks(Pointcut.TEST_RB, new HookParams("A", "B")); + assertTrue(outcome); + } + + assertThat(myInvocations, contains("MyTestAnonymousInterceptorOne.testRb", "MyTestAnonymousInterceptorTwo.testRb")); + assertSame("A", interceptor0.myLastString0); + assertSame("A", interceptor1.myLastString0); + assertSame("B", interceptor1.myLastString1); + } + @Test public void testInvokeUsingSupplierArg() { InterceptorService svc = new InterceptorService(); @@ -320,8 +347,8 @@ public class InterceptorServiceTest { .add(String.class, null) .add(String.class, null); svc.callHooks(Pointcut.TEST_RB, params); - assertEquals(null, interceptor.myValue0); - assertEquals(null, interceptor.myValue1); + assertNull(interceptor.myValue0); + assertNull(interceptor.myValue1); svc.unregisterAllInterceptors(); // First null @@ -331,7 +358,7 @@ public class InterceptorServiceTest { .add(String.class, null) .add(String.class, "A"); svc.callHooks(Pointcut.TEST_RB, params); - assertEquals(null, interceptor.myValue0); + assertNull(interceptor.myValue0); assertEquals("A", interceptor.myValue1); svc.unregisterAllInterceptors(); @@ -343,7 +370,7 @@ public class InterceptorServiceTest { .add(String.class, null); svc.callHooks(Pointcut.TEST_RB, params); assertEquals("A", interceptor.myValue0); - assertEquals(null, interceptor.myValue1); + assertNull(interceptor.myValue1); svc.unregisterAllInterceptors(); } @@ -399,9 +426,9 @@ public class InterceptorServiceTest { assertEquals("AAA", e.getMessage()); } - assertEquals(true, interceptor0.myHit); - assertEquals(true, interceptor1.myHit); - assertEquals(true, interceptor2.myHit); + assertTrue(interceptor0.myHit); + assertTrue(interceptor1.myHit); + assertTrue(interceptor2.myHit); } @@ -465,7 +492,7 @@ public class InterceptorServiceTest { } } - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) @Test public void testValidateParamTypesWrongParam() { InterceptorService svc = new InterceptorService(); @@ -485,110 +512,6 @@ public class InterceptorServiceTest { } } - @Test - public void testThreadLocalHookInterceptor() { - InterceptorService svc = new InterceptorService(); - svc.setThreadlocalInvokersEnabled(true); - - HookParams params = new HookParams().add("A").add("B"); - - @Interceptor(order = 100) - class LocalInterceptor { - - private int myCount = 0; - - @Hook(Pointcut.TEST_RB) - public boolean testRb(String theString0, String theString1) { - myCount++; - return true; - } - - } - LocalInterceptor interceptor = new LocalInterceptor(); - svc.registerThreadLocalInterceptor(interceptor); - try { - - svc.callHooks(Pointcut.TEST_RB, params); - svc.callHooks(Pointcut.TEST_RB, params); - svc.callHooks(Pointcut.TEST_RB, params); - svc.callHooks(Pointcut.TEST_RB, params); - svc.callHooks(Pointcut.TEST_RB, params); - assertEquals(5, interceptor.myCount); - - } finally { - svc.unregisterThreadLocalInterceptor(interceptor); - } - - // Call some more - The interceptor is removed so the count shouldn't change - svc.callHooks(Pointcut.TEST_RB, params); - svc.callHooks(Pointcut.TEST_RB, params); - svc.callHooks(Pointcut.TEST_RB, params); - svc.callHooks(Pointcut.TEST_RB, params); - svc.callHooks(Pointcut.TEST_RB, params); - assertEquals(5, interceptor.myCount); - - } - - /** - *
-	 * JA 20190321 On my MBP 2018
-	 *    ThreadLocalEnabled=true - Performed 500000 loops in 8383.0ms - 0.017ms / loop
-	 *    ThreadLocalEnabled=false - Performed 500000 loops in 3743.0ms - 0.007ms / loop
-	 *    ThreadLocalEnabled=true - Performed 500000 loops in 6163.0ms - 0.012ms / loop
-	 *    ThreadLocalEnabled=false - Performed 500000 loops in 3487.0ms - 0.007ms / loop
-	 *    ThreadLocalEnabled=true - Performed 1000000 loops in 00:00:12.458 - 0.012ms / loop
-	 *    ThreadLocalEnabled=false - Performed 1000000 loops in 7046.0ms - 0.007ms / loop
-	 * 
- */ - @Test - @Disabled("Performance test - Not needed normally") - public void testThreadLocalHookInterceptorMicroBenchmark() { - threadLocalMicroBenchmark(true, 500000); - threadLocalMicroBenchmark(false, 500000); - threadLocalMicroBenchmark(true, 500000); - threadLocalMicroBenchmark(false, 500000); - threadLocalMicroBenchmark(true, 500000); - threadLocalMicroBenchmark(false, 500000); - } - - private void threadLocalMicroBenchmark(boolean theThreadlocalInvokersEnabled, int theCount) { - InterceptorService svc = new InterceptorService(); - svc.setThreadlocalInvokersEnabled(theThreadlocalInvokersEnabled); - - HookParams params = new HookParams().add("A").add("B"); - - @Interceptor(order = 100) - class LocalInterceptor { - - private int myCount = 0; - - @Hook(Pointcut.TEST_RB) - public void testRb(String theString0, String theString1) { - myCount++; - } - - } - - LocalInterceptor interceptor = new LocalInterceptor(); - StopWatch sw = new StopWatch(); - for (int i = 0; i < theCount; i++) { - - svc.registerThreadLocalInterceptor(interceptor); - try { - svc.callHooks(Pointcut.TEST_RB, params); - svc.callHooks(Pointcut.TEST_RB, params); - svc.callHooks(Pointcut.TEST_RB, params); - svc.callHooks(Pointcut.TEST_RB, params); - svc.callHooks(Pointcut.TEST_RB, params); - } finally { - svc.unregisterThreadLocalInterceptor(interceptor); - } - - } - - ourLog.info("ThreadLocalEnabled={} - Performed {} loops in {} - {} / loop - Outcomne: {}", theThreadlocalInvokersEnabled, theCount, sw.toString(), sw.formatMillisPerOperation(theCount), interceptor.myCount); - } - @BeforeEach public void before() { myInvocations.clear(); @@ -634,6 +557,27 @@ public class InterceptorServiceTest { } } + public class MyTestAnonymousInterceptorOne implements IAnonymousInterceptor { + private String myLastString0; + @Override + public void invoke(IPointcut thePointcut, HookParams theArgs) { + myLastString0 = theArgs.get(String.class, 0); + myInvocations.add("MyTestAnonymousInterceptorOne.testRb"); + } + } + + public class MyTestAnonymousInterceptorTwo implements IAnonymousInterceptor { + private String myLastString0; + private String myLastString1; + + @Override + public void invoke(IPointcut thePointcut, HookParams theArgs) { + myLastString0 = theArgs.get(String.class, 0); + myLastString1 = theArgs.get(String.class, 1); + myInvocations.add("MyTestAnonymousInterceptorTwo.testRb"); + } + } + @Interceptor(order = 200) public class MyTestInterceptorManual { @Hook(Pointcut.TEST_RB) @@ -662,12 +606,6 @@ public class InterceptorServiceTest { private static class CanonicalSubscription { } - /** - * Just a make-believe version of this class for the unit test - */ - private static class ResourceDeliveryMessage { - } - @Interceptor() public static class InterceptorThatFailsOnRegister { diff --git a/hapi-fhir-bom/pom.xml b/hapi-fhir-bom/pom.xml index 4daea1f46df..6aa8dbd53ea 100644 --- a/hapi-fhir-bom/pom.xml +++ b/hapi-fhir-bom/pom.xml @@ -4,14 +4,14 @@ 4.0.0 ca.uhn.hapi.fhir hapi-fhir-bom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT pom HAPI FHIR BOM ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-checkstyle/pom.xml b/hapi-fhir-checkstyle/pom.xml index 650c5d189ef..a1745005096 100644 --- a/hapi-fhir-checkstyle/pom.xml +++ b/hapi-fhir-checkstyle/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml index 75f95260bdb..3088a7fc8e3 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/RunServerCommand.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/RunServerCommand.java index 20282a4dc61..6e68e2f72ad 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/RunServerCommand.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/RunServerCommand.java @@ -21,7 +21,7 @@ package ca.uhn.fhir.cli; */ import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.demo.ContextHolder; import ca.uhn.fhir.jpa.demo.FhirServerConfig; import ca.uhn.fhir.jpa.demo.FhirServerConfigDstu3; @@ -77,7 +77,7 @@ public class RunServerCommand extends BaseCommand { addOptionalOption(options, "u", "url", "Url", "If this option is set, specifies the JDBC URL to use for the database connection"); - Long defaultReuseSearchResults = DaoConfig.DEFAULT_REUSE_CACHED_SEARCH_RESULTS_FOR_MILLIS; + Long defaultReuseSearchResults = JpaStorageSettings.DEFAULT_REUSE_CACHED_SEARCH_RESULTS_FOR_MILLIS; String defaultReuseSearchResultsStr = defaultReuseSearchResults == null ? "off" : String.valueOf(defaultReuseSearchResults); options.addOption(null, OPTION_REUSE_SEARCH_RESULTS_MILLIS, true, "The time in milliseconds within which the same results will be returned for multiple identical searches, or \"off\" (default is " + defaultReuseSearchResultsStr + ")"); return options; diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/BulkImportCommandIT.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/BulkImportCommandIT.java index c64103ed887..02d3e24325b 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/BulkImportCommandIT.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/BulkImportCommandIT.java @@ -89,7 +89,7 @@ public class BulkImportCommandIT { private Batch2JobStartResponse createJobStartResponse(String theId) { Batch2JobStartResponse response = new Batch2JobStartResponse(); - response.setJobId(theId); + response.setInstanceId(theId); return response; } diff --git a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml index 0b8af109fb8..580a7014e27 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir-cli - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml index 2258a503b11..b3190b3606a 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../../hapi-deployable-pom diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/CommonConfig.java b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/CommonConfig.java index 18a357f7384..3df0687a4c6 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/CommonConfig.java +++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/CommonConfig.java @@ -20,10 +20,9 @@ package ca.uhn.fhir.jpa.demo; * #L% */ -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import org.apache.commons.dbcp2.BasicDataSource; import org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings; import org.springframework.context.annotation.Bean; @@ -39,20 +38,15 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank; public class CommonConfig { /** - * Configure FHIR properties around the the JPA server via this bean + * Configure FHIR properties around the JPA server via this bean */ @Bean - public DaoConfig daoConfig() { - DaoConfig retVal = new DaoConfig(); + public JpaStorageSettings storageSettings() { + JpaStorageSettings retVal = new JpaStorageSettings(); retVal.setAllowMultipleDelete(true); return retVal; } - @Bean - public ModelConfig modelConfig() { - return daoConfig().getModelConfig(); - } - /** * The following bean configures the database connection. The 'url' property value of "jdbc:h2:file:target./jpaserver_h2_files" indicates that the server should save resources in a * directory called "jpaserver_h2_files". diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/ContextHolder.java b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/ContextHolder.java index 170ae4eac77..5c86ee20f91 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/ContextHolder.java +++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/ContextHolder.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.demo; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import org.apache.commons.cli.ParseException; import org.apache.commons.lang3.Validate; @@ -36,7 +36,7 @@ public class ContextHolder { private static String ourDatabaseUrl; static { - ourReuseSearchResultsMillis = DaoConfig.DEFAULT_REUSE_CACHED_SEARCH_RESULTS_FOR_MILLIS; + ourReuseSearchResultsMillis = JpaStorageSettings.DEFAULT_REUSE_CACHED_SEARCH_RESULTS_FOR_MILLIS; } public static FhirContext getCtx() { diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfig.java b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfig.java index 5d2104f953e..c4e5e8221c6 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfig.java +++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/FhirServerConfig.java @@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.demo; */ import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.config.HapiJpaConfig; import ca.uhn.fhir.jpa.config.JpaDstu2Config; import ca.uhn.fhir.jpa.config.util.HapiEntityManagerFactoryUtil; @@ -56,11 +56,11 @@ public class FhirServerConfig { private Properties myJpaProperties; /** - * Configure FHIR properties around the the JPA server via this bean + * Configure FHIR properties around the JPA server via this bean */ @Bean - public DaoConfig daoConfig() { - DaoConfig retVal = new DaoConfig(); + public JpaStorageSettings storageSettings() { + JpaStorageSettings retVal = new JpaStorageSettings(); retVal.setAllowMultipleDelete(true); return retVal; } diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java index 4bad956b646..b28e4291840 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java +++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java @@ -25,7 +25,7 @@ import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.binary.provider.BinaryAccessProvider; @@ -120,14 +120,14 @@ public class JpaServerDemo extends RestfulServer { if (fhirVersion == FhirVersionEnum.DSTU2) { IFhirSystemDao systemDao = myAppCtx.getBean("mySystemDaoDstu2", IFhirSystemDao.class); JpaConformanceProviderDstu2 confProvider = new JpaConformanceProviderDstu2(this, systemDao, - myAppCtx.getBean(DaoConfig.class)); + myAppCtx.getBean(JpaStorageSettings.class)); confProvider.setImplementationDescription("Example Server"); setServerConformanceProvider(confProvider); } else if (fhirVersion == FhirVersionEnum.DSTU3) { IFhirSystemDao systemDao = myAppCtx .getBean("mySystemDaoDstu3", IFhirSystemDao.class); JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(this, systemDao, - myAppCtx.getBean(DaoConfig.class), myAppCtx.getBean(ISearchParamRegistry.class)); + myAppCtx.getBean(JpaStorageSettings.class), myAppCtx.getBean(ISearchParamRegistry.class)); confProvider.setImplementationDescription("Example Server"); setServerConformanceProvider(confProvider); } else if (fhirVersion == FhirVersionEnum.R4) { @@ -135,7 +135,7 @@ public class JpaServerDemo extends RestfulServer { .getBean("mySystemDaoR4", IFhirSystemDao.class); IValidationSupport validationSupport = myAppCtx.getBean(IValidationSupport.class); JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(this, systemDao, - myAppCtx.getBean(DaoConfig.class), myAppCtx.getBean(ISearchParamRegistry.class), validationSupport); + myAppCtx.getBean(JpaStorageSettings.class), myAppCtx.getBean(ISearchParamRegistry.class), validationSupport); confProvider.setImplementationDescription("Example Server"); setServerConformanceProvider(confProvider); } else { @@ -168,11 +168,11 @@ public class JpaServerDemo extends RestfulServer { CorsInterceptor corsInterceptor = new CorsInterceptor(); registerInterceptor(corsInterceptor); - DaoConfig daoConfig = myAppCtx.getBean(DaoConfig.class); - daoConfig.setAllowExternalReferences(ContextHolder.isAllowExternalRefs()); - daoConfig.setEnforceReferentialIntegrityOnDelete(!ContextHolder.isDisableReferentialIntegrity()); - daoConfig.setEnforceReferentialIntegrityOnWrite(!ContextHolder.isDisableReferentialIntegrity()); - daoConfig.setReuseCachedSearchResultsForMillis(ContextHolder.getReuseCachedSearchResultsForMillis()); + JpaStorageSettings storageSettings = myAppCtx.getBean(JpaStorageSettings.class); + storageSettings.setAllowExternalReferences(ContextHolder.isAllowExternalRefs()); + storageSettings.setEnforceReferentialIntegrityOnDelete(!ContextHolder.isDisableReferentialIntegrity()); + storageSettings.setEnforceReferentialIntegrityOnWrite(!ContextHolder.isDisableReferentialIntegrity()); + storageSettings.setReuseCachedSearchResultsForMillis(ContextHolder.getReuseCachedSearchResultsForMillis()); DaoRegistry daoRegistry = myAppCtx.getBean(DaoRegistry.class); IInterceptorBroadcaster interceptorBroadcaster = myAppCtx.getBean(IInterceptorBroadcaster.class); diff --git a/hapi-fhir-cli/pom.xml b/hapi-fhir-cli/pom.xml index f2ae32894c7..ae1b4991371 100644 --- a/hapi-fhir-cli/pom.xml +++ b/hapi-fhir-cli/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-client-okhttp/pom.xml b/hapi-fhir-client-okhttp/pom.xml index 8f04f09b804..c1d8c6f95e6 100644 --- a/hapi-fhir-client-okhttp/pom.xml +++ b/hapi-fhir-client-okhttp/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-client/pom.xml b/hapi-fhir-client/pom.xml index 9c05c625c08..364a0b3a561 100644 --- a/hapi-fhir-client/pom.xml +++ b/hapi-fhir-client/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-converter/pom.xml b/hapi-fhir-converter/pom.xml index 4232ab3f6d1..168918b5995 100644 --- a/hapi-fhir-converter/pom.xml +++ b/hapi-fhir-converter/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-dist/pom.xml b/hapi-fhir-dist/pom.xml index 5e98dfffc1b..0fd18cb2c49 100644 --- a/hapi-fhir-dist/pom.xml +++ b/hapi-fhir-dist/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-docs/pom.xml b/hapi-fhir-docs/pom.xml index 16ec8bd1933..665b615d89c 100644 --- a/hapi-fhir-docs/pom.xml +++ b/hapi-fhir-docs/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_6_0/4545-interceptor-testing-speed.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_6_0/4545-interceptor-testing-speed.yaml new file mode 100644 index 00000000000..72672951836 --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_6_0/4545-interceptor-testing-speed.yaml @@ -0,0 +1,5 @@ +--- +type: perf +issue: 4545 +title: "The InterceptorService now maintains an EnumSet of all registered interceptor Pointcuts, + which should improve performance when testing for the existence of specific pointcuts." diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_6_0/4545-jpa-settings-refactor.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_6_0/4545-jpa-settings-refactor.yaml new file mode 100644 index 00000000000..9f84a5501bf --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_6_0/4545-jpa-settings-refactor.yaml @@ -0,0 +1,6 @@ +--- +type: change +issue: 4545 +title: "The settings beans for the JPA server have been renamed to better reflect their purpose. Specifically + the `ModelConfig` bean has been renamed to `StorageSettings` and the `DaoConfig` bean has been + renamed to `JpaStorageSettings`." diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_6_0/4545-remove-threadlocal-interceptors.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_6_0/4545-remove-threadlocal-interceptors.yaml new file mode 100644 index 00000000000..8b70fc864b8 --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_6_0/4545-remove-threadlocal-interceptors.yaml @@ -0,0 +1,6 @@ +--- +type: remove +issue: 4545 +title: "The InterceptorService no longer supports ThreadLocal interceptor registrations. This + feature was deprecated in 6.2.0 due to lack of use and has never been enabled by default. Please + let us know on the mailing list if this affects you." diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/configuration.md b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/configuration.md index 1a171488773..1fbe78644a3 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/configuration.md +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/configuration.md @@ -20,12 +20,12 @@ Clients may sometimes post resources to your server that contain absolute resour By default, the server will reject this reference, as only local references are permitted by the server. This can be changed however. -If you want the server to recognize that this URL is actually a local reference (i.e. because the server will be deployed to the base URL `http://example.com/fhir/`) you can configure the server to recognize this URL via the following DaoConfig setting: +If you want the server to recognize that this URL is actually a local reference (i.e. because the server will be deployed to the base URL `http://example.com/fhir/`) you can configure the server to recognize this URL via the following JpaStorageSettings setting: ```java @Bean -public DaoConfig daoConfig() { - DaoConfig retVal = new DaoConfig(); +public JpaStorageSettings storageSettings() { + JpaStorageSettings retVal = new JpaStorageSettings(); // ... other config ... retVal.getTreatBaseUrlsAsLocal().add("http://example.com/fhir/"); return retVal; @@ -36,8 +36,8 @@ On the other hand, if you want the server to be configurable to allow remote ref ```java @Bean -public DaoConfig daoConfig() { - DaoConfig retVal = new DaoConfig(); +public JpaStorageSettings storageSettings() { + JpaStorageSettings retVal = new JpaStorageSettings(); // Allow external references retVal.setAllowExternalReferences(true); @@ -59,19 +59,19 @@ etc. For example, you might refer to the ValueSet `http://hl7.org/fhir/ValueSet/ resources. In this case, you are not necessarily telling the server that this is a real address that it should resolve, but rather that this is an identifier for a ValueSet where `ValueSet.url` has the given URI/URL. -HAPI can be configured to treat certain URI/URL patterns as logical by using the DaoConfig#setTreatReferencesAsLogical +HAPI can be configured to treat certain URI/URL patterns as logical by using the JpaStorageSettings#setTreatReferencesAsLogical property ( -see [JavaDoc](/hapi-fhir/apidocs/hapi-fhir-storage/ca/uhn/fhir/jpa/api/config/DaoConfig.html#setTreatReferencesAsLogical(java.util.Set))) +see [JavaDoc](/hapi-fhir/apidocs/hapi-fhir-jpaserver-model/ca/uhn/fhir/jpa/model/entity/StorageSettings.html#setTreatReferencesAsLogical(java.util.Set))) . For example: ```java // Treat specific URL as logical -myDaoConfig.getTreatReferencesAsLogical().add("http://mysystem.com/ValueSet/cats-and-dogs"); +myStorageSettings.getTreatReferencesAsLogical().add("http://mysystem.com/ValueSet/cats-and-dogs"); // Treat all references with given prefix as logical -myDaoConfig.getTreatReferencesAsLogical().add("http://mysystem.com/mysystem-vs-*"); +myStorageSettings.getTreatReferencesAsLogical().add("http://mysystem.com/mysystem-vs-*"); ``` ## Referential Integrity @@ -88,8 +88,8 @@ Referential integrity can be configured on two levels: `write` and `delete`. #### JPA Server ```java @Bean -public DaoConfig daoConfig() { - DaoConfig retVal = new DaoConfig(); +public JpaStorageSettings storageSettings() { + JpaStorageSettings retVal = new JpaStorageSettings(); // ... other config ... retVal.setEnforceReferentialIntegrityOnWrite(true); retVal.setEnforceReferentialIntegrityOnDelete(true); @@ -116,7 +116,7 @@ Under many normal scenarios this is a n acceptable performance tradeoff, but in You can change the global cache using the following setting: ```java -myDaoConfig.setReuseCachedSearchResultsForMillis(null); +myStorageSettings.setReuseCachedSearchResultsForMillis(null); ``` ### Disable Cache at the Request Level @@ -168,5 +168,5 @@ X-Retry-On-Version-Conflict: retry; max-retries=100 Delete with expunge submits a job to delete and expunge the requested resources. This is done in batches. If the DELETE ?_expunge=true syntax is used to trigger the delete expunge, then the batch size will be determined by the value -of [Expunge Batch Size](/apidocs/hapi-fhir-storage/ca/uhn/fhir/jpa/api/config/DaoConfig.html#getExpungeBatchSize()) +of [Expunge Batch Size](/apidocs/hapi-fhir-storage/ca/uhn/fhir/jpa/api/config/JpaStorageSettings.html#getExpungeBatchSize()) property. diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/elastic.md b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/elastic.md index 9c8211067d5..a7d534a08bd 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/elastic.md +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/elastic.md @@ -7,7 +7,7 @@ This is required to support the `_content`, or `_text` search parameters. Additional indexing is implemented for simple search parameters of type token, string, and reference. These implement the basic search, as well as several modifiers: -This **experimental** feature is enabled via the `setAdvancedHSearchIndexing()` property of DaoConfig. +This **experimental** feature is enabled via the `setAdvancedHSearchIndexing()` property of JpaStorageSettings. ## Search Parameter Support @@ -103,7 +103,7 @@ search index. This allows some queries to return results without using the rela Note: This does not support the $meta-add or $meta-delete operations. Full reindexing is required when this option is enabled after resources have been indexed. -This **experimental** feature is enabled via the `setStoreResourceInHSearchIndex()` option of DaoConfig. +This **experimental** feature is enabled via the `setStoreResourceInHSearchIndex()` option of JpaStorageSettings. # Synchronous Writes diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/lastn.md b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/lastn.md index 676da230bb1..39edd06f156 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/lastn.md +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/lastn.md @@ -24,9 +24,9 @@ The grouping of Observation resources by `Observation.code` means that the `$las # Deployment and Configuration -The `$lastn` operation is disabled by default. The operation can be enabled by setting the DaoConfig#setLastNEnabled +The `$lastn` operation is disabled by default. The operation can be enabled by setting the JpaStorageSettings#setLastNEnabled property ( -see [JavaDoc](/hapi-fhir/apidocs/hapi-fhir-storage/ca/uhn/fhir/jpa/api/config/DaoConfig.html#setLastNEnabled(boolean))) +see [JavaDoc](/hapi-fhir/apidocs/hapi-fhir-storage/ca/uhn/fhir/jpa/api/config/JpaStorageSettings.html#setLastNEnabled(boolean))) . In addition, the Elasticsearch client service, `ElasticsearchSvcImpl` will need to be instantiated with parameters diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/performance.md b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/performance.md index 7ce77784275..e02fdd6b4a5 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/performance.md +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/performance.md @@ -6,7 +6,7 @@ This page contains information for performance optimization. If you are planning The FHIR history operation allows clients to see a change history for a resource, across all resources of a given type, or even across all resources on a server. This operation includes a total count (in `Bundle.total`) that can be very expensive to calculate on large databases with many resources. -As a result, a setting on the `DaoConfig` object has been added called **History Count Mode**. This setting has 3 possible options: +As a result, a setting on the `JpaStorageSettings` object has been added called **History Count Mode**. This setting has 3 possible options: * COUNT_CACHED. This is the new default: A loading cache will be used for history counts without any dates specified, meaning that counts are stored in RAM for up to one minute, and the loading cache blocks all but one client thread per JVM from actually performing the count. This effectively throttles access to the database. History operation invocations that include a `_since` or `_to` parameter will never have a count included in the results. diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/schema.md b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/schema.md index 1d8d026f6f2..46310f9c51f 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/schema.md +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/schema.md @@ -255,11 +255,11 @@ an **HFJ_FORCED_ID** row exists corresponding to the equivalent **HFJ_RESOURCE** visible or usable by FHIR clients and it becomes purely an internal ID to the JPA server. If the server has been configured with -a [Resource Server ID Strategy](/apidocs/hapi-fhir-storage/undefined/ca/uhn/fhir/jpa/api/config/DaoConfig.html#setResourceServerIdStrategy(ca.uhn.fhir.jpa.api.config.DaoConfig.IdStrategyEnum)) -of [UUID](/apidocs/hapi-fhir-storage/undefined/ca/uhn/fhir/jpa/api/config/DaoConfig.IdStrategyEnum.html#UUID), or the +a [Resource Server ID Strategy](/apidocs/hapi-fhir-storage/undefined/ca/uhn/fhir/jpa/api/config/JpaStorageSettings.html#setResourceServerIdStrategy(ca.uhn.fhir.jpa.api.config.JpaStorageSettings.IdStrategyEnum)) +of [UUID](/apidocs/hapi-fhir-storage/undefined/ca/uhn/fhir/jpa/api/config/JpaStorageSettings.IdStrategyEnum.html#UUID), or the server has been configured with -a [Resource Client ID Strategy](/apidocs/hapi-fhir-storage/undefined/ca/uhn/fhir/jpa/api/config/DaoConfig.html#setResourceClientIdStrategy(ca.uhn.fhir.jpa.api.config.DaoConfig.ClientIdStrategyEnum)) -of [ANY](/apidocs/hapi-fhir-storage/undefined/ca/uhn/fhir/jpa/api/config/DaoConfig.ClientIdStrategyEnum.html#ANY) +a [Resource Client ID Strategy](/apidocs/hapi-fhir-storage/undefined/ca/uhn/fhir/jpa/api/config/JpaStorageSettings.html#setResourceClientIdStrategy(ca.uhn.fhir.jpa.api.config.JpaStorageSettings.ClientIdStrategyEnum)) +of [ANY](/apidocs/hapi-fhir-storage/undefined/ca/uhn/fhir/jpa/api/config/JpaStorageSettings.ClientIdStrategyEnum.html#ANY) the server will create a Forced ID for all resources (not only resources having textual IDs). ## Columns diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/upgrading.md b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/upgrading.md index 94e0eaa29cd..b7afafd1358 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/upgrading.md +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa/upgrading.md @@ -41,7 +41,7 @@ As a result, in HAPI FHIR JPA 3.6.0, an efficient way of upgrading existing data In order to perform a migration using this functionality, the following steps should be followed: * Stop your running HAPI FHIR JPA instance (and remember to make a backup of your database before proceeding with any changes!) -* Modify your `DaoConfig` to specify that hash-based searches should not be used, using the following setting: `myDaoConfig.setDisableHashBasedSearches(true);` +* Modify your `JpaStorageSettings` to specify that hash-based searches should not be used, using the following setting: `myStorageSettings.setDisableHashBasedSearches(true);` * Make sure that you have your JPA settings configured to not automatically create database indexes and columns using the following setting in your JPA Properties: `extraProperties.put("hibernate.hbm2ddl.auto", "none");` * Run the database migrator command, including the entry `-x no-migrate-350-hashes` on the command line. For example: @@ -60,7 +60,7 @@ SELECT * FROM HFJ_RES_REINDEX_JOB * When this query no longer returns any rows, the reindexing process is complete. * At this time, HAPI FHIR should be stopped once again in order to convert it to using the hash based indexes. -* Modify your `DaoConfig` to specify that hash-based searches are used, using the following setting (this is the default setting, so it could also simply be omitted): `myDaoConfig.setDisableHashBasedSearches(false);` +* Modify your `JpaStorageSettings` to specify that hash-based searches are used, using the following setting (this is the default setting, so it could also simply be omitted): `myStorageSettings.setDisableHashBasedSearches(false);` * Execute the migrator tool again, this time omitting the flag option, e.g. ```bash diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_mdm/mdm_expansion.md b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_mdm/mdm_expansion.md index 0c3ef9bcf10..744295cb426 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_mdm/mdm_expansion.md +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_mdm/mdm_expansion.md @@ -33,8 +33,8 @@ One important caveat is that chaining is currently not supported when using this ## Enabling MDM Expansion On top of needing to instantiate an MDM module, you must enable this feature in -the [DaoConfig](/hapi-fhir/apidocs/hapi-fhir-storage/ca/uhn/fhir/jpa/api/config/DaoConfig.html) bean, using -the [Allow MDM Expansion](/hapi-fhir/apidocs/hapi-fhir-storage/ca/uhn/fhir/jpa/api/config/DaoConfig.html#setAllowMdmExpansion(boolean)) +the [StorageSettings](/hapi-fhir/apidocs/hapi-fhir-jpaserver-model/ca/uhn/fhir/jpa/model/entity/StorageSettings.html) bean, using +the [Allow MDM Expansion](/hapi-fhir/apidocs/hapi-fhir-jpaserver-model/ca/uhn/fhir/jpa/model/entity/StorageSettings.html#setAllowMdmExpansion(boolean)) property.
diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_mdm/mdm_operations.md b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_mdm/mdm_operations.md index bdb00797343..fcf01f46d09 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_mdm/mdm_operations.md +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_mdm/mdm_operations.md @@ -708,7 +708,7 @@ This operation takes two optional Parameters. 0..1 The number of links that should be deleted at a time. If omitted, then the batch size will be determined by the value -of [Reindex Batch Size](/apidocs/hapi-fhir-storage/ca/uhn/fhir/jpa/api/config/DaoConfig.html#getReindexBatchSize()) +of [Reindex Batch Size](/apidocs/hapi-fhir-storage/ca/uhn/fhir/jpa/api/config/StorageConfig.html#getReindexBatchSize()) property. diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_partitioning/partitioning.md b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_partitioning/partitioning.md index f98ac24787f..1cfed016426 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_partitioning/partitioning.md +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_jpa_partitioning/partitioning.md @@ -57,7 +57,7 @@ This fact can have security implications: in use in another partition. * In a server using the default configuration of - SEQUENTIAL_NUMERIC [Server ID Strategy](/hapi-fhir/apidocs/hapi-fhir-storage/ca/uhn/fhir/jpa/api/config/DaoConfig.html#setResourceServerIdStrategy(ca.uhn.fhir.jpa.api.config.DaoConfig.IdStrategyEnum)) + SEQUENTIAL_NUMERIC [Server ID Strategy](/hapi-fhir/apidocs/hapi-fhir-storage/ca/uhn/fhir/jpa/api/config/JpaStorageSettings.html#setResourceServerIdStrategy(ca.uhn.fhir.jpa.api.config.JpaStorageSettings.IdStrategyEnum)) a client may be able to infer the IDs of resources in other partitions based on the ID they were assigned. These considerations can be addressed by using UUID Server ID Strategy, and disallowing client-assigned IDs. diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_plain/rest_operations.md b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_plain/rest_operations.md index 82eb247eaa7..f8708013cec 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_plain/rest_operations.md +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/docs/server_plain/rest_operations.md @@ -137,7 +137,7 @@ If you wish to update a historical version of a resource without creating a new Update operation. While this operation is not supported by the FHIR specification, it's an enhancement added to specifically to HAPI-FHIR. -In order to use this new functionality, you must set the `setUpdateWithHistoryRewriteEnabled` setting in the `DaoConfig` +In order to use this new functionality, you must set the `setUpdateWithHistoryRewriteEnabled` setting in the `StorageSettings` to true. The following API request shows an example of executing a PUT at the following endpoint. diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml index 2017029a9ee..a93bccae47c 100644 --- a/hapi-fhir-jacoco/pom.xml +++ b/hapi-fhir-jacoco/pom.xml @@ -11,7 +11,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jaxrsserver-base/pom.xml b/hapi-fhir-jaxrsserver-base/pom.xml index b8a665c6f44..f4f804e5825 100644 --- a/hapi-fhir-jaxrsserver-base/pom.xml +++ b/hapi-fhir-jaxrsserver-base/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactoryTest.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactoryTest.java index a21689df0c5..7a6a8df614a 100644 --- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactoryTest.java +++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactoryTest.java @@ -12,6 +12,7 @@ import org.junit.jupiter.params.provider.MethodSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.net.ssl.SSLException; import javax.net.ssl.SSLHandshakeException; import javax.ws.rs.client.Client; import javax.ws.rs.core.Response; @@ -23,6 +24,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.IsNot.not; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; /** @@ -99,7 +101,7 @@ public class JaxRsRestfulClientFactoryTest extends BaseFhirVersionParameterizedT .get(Response.class); fail(); } catch (Exception e) { - assertEquals(SSLHandshakeException.class, e.getCause().getClass()); + assertTrue(e.getCause() instanceof SSLException); } } } diff --git a/hapi-fhir-jpa/pom.xml b/hapi-fhir-jpa/pom.xml index 0ed85f51b97..b069e2407be 100644 --- a/hapi-fhir-jpa/pom.xml +++ b/hapi-fhir-jpa/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml 4.0.0 diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml index 22bf0c9d560..75213a47599 100644 --- a/hapi-fhir-jpaserver-base/pom.xml +++ b/hapi-fhir-jpaserver-base/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/binstore/DatabaseBlobBinaryStorageSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/binstore/DatabaseBlobBinaryStorageSvcImpl.java index f8d059de1bc..230ddce4c82 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/binstore/DatabaseBlobBinaryStorageSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/binstore/DatabaseBlobBinaryStorageSvcImpl.java @@ -21,9 +21,8 @@ package ca.uhn.fhir.jpa.binstore; */ import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; -import ca.uhn.fhir.jpa.binary.svc.BaseBinaryStorageSvcImpl; import ca.uhn.fhir.jpa.binary.api.StoredDetails; +import ca.uhn.fhir.jpa.binary.svc.BaseBinaryStorageSvcImpl; import ca.uhn.fhir.jpa.dao.data.IBinaryStorageEntityDao; import ca.uhn.fhir.jpa.model.entity.BinaryStorageEntity; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; @@ -35,14 +34,12 @@ import org.hibernate.LobHelper; import org.hibernate.Session; import org.hl7.fhir.instance.model.api.IIdType; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContextType; - -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -58,10 +55,6 @@ public class DatabaseBlobBinaryStorageSvcImpl extends BaseBinaryStorageSvcImpl { private EntityManager myEntityManager; @Autowired private IBinaryStorageEntityDao myBinaryStorageEntityDao; - @Autowired - private PlatformTransactionManager myPlatformTransactionManager; - @Autowired - private DaoConfig myDaoConfig; @Override @Transactional(propagation = Propagation.REQUIRED) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/export/svc/BulkDataExportJobSchedulingHelperImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/export/svc/BulkDataExportJobSchedulingHelperImpl.java index 23856538f4d..a4f6dbbd53a 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/export/svc/BulkDataExportJobSchedulingHelperImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/export/svc/BulkDataExportJobSchedulingHelperImpl.java @@ -21,12 +21,9 @@ package ca.uhn.fhir.jpa.bulk.export.svc; */ import ca.uhn.fhir.batch2.api.IJobPersistence; -import ca.uhn.fhir.batch2.jobs.export.BulkExportAppCtx; -import ca.uhn.fhir.batch2.jobs.export.models.BulkExportBinaryFileId; import ca.uhn.fhir.batch2.model.JobInstance; import ca.uhn.fhir.batch2.model.StatusEnum; -import ca.uhn.fhir.batch2.model.WorkChunk; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.model.BulkExportJobResults; @@ -38,7 +35,6 @@ import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition; import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.util.Batch2JobDefinitionConstants; import ca.uhn.fhir.util.JsonUtil; -import com.google.common.annotations.VisibleForTesting; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; import org.hl7.fhir.instance.model.api.IBaseBinary; @@ -58,7 +54,6 @@ import javax.annotation.PostConstruct; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Date; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Optional; @@ -71,14 +66,12 @@ public class BulkDataExportJobSchedulingHelperImpl implements IBulkDataExportJob private final DaoRegistry myDaoRegistry; private final PlatformTransactionManager myTxManager; + private final JpaStorageSettings myDaoConfig; + private final BulkExportHelperService myBulkExportHelperSvc; + private final IJobPersistence myJpaJobPersistence; private TransactionTemplate myTxTemplate; - private final DaoConfig myDaoConfig; - private final BulkExportHelperService myBulkExportHelperSvc; - - private final IJobPersistence myJpaJobPersistence; - - public BulkDataExportJobSchedulingHelperImpl(DaoRegistry theDaoRegistry, PlatformTransactionManager theTxManager, DaoConfig theDaoConfig, BulkExportHelperService theBulkExportHelperSvc, IJobPersistence theJpaJobPersistence, TransactionTemplate theTxTemplate) { + public BulkDataExportJobSchedulingHelperImpl(DaoRegistry theDaoRegistry, PlatformTransactionManager theTxManager, JpaStorageSettings theDaoConfig, BulkExportHelperService theBulkExportHelperSvc, IJobPersistence theJpaJobPersistence, TransactionTemplate theTxTemplate) { myDaoRegistry = theDaoRegistry; myTxManager = theTxManager; myDaoConfig = theDaoConfig; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/export/svc/JpaBulkExportProcessor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/export/svc/JpaBulkExportProcessor.java index de1aa0c08de..8487b0cef05 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/export/svc/JpaBulkExportProcessor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/export/svc/JpaBulkExportProcessor.java @@ -26,7 +26,7 @@ import ca.uhn.fhir.context.RuntimeSearchParam; import ca.uhn.fhir.fhirpath.IFhirPath; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.model.PersistentIdToForcedIdMap; @@ -95,7 +95,7 @@ public class JpaBulkExportProcessor implements IBulkExportProcessor { private BulkExportHelperService myBulkExportHelperSvc; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Autowired private DaoRegistry myDaoRegistry; @@ -140,7 +140,7 @@ public class JpaBulkExportProcessor implements IBulkExportProcessor { private LinkedHashSet getPidsForPatientStyleExport(ExportPIDIteratorParameters theParams, String resourceType, String jobId, RuntimeResourceDefinition def) { LinkedHashSet pids = new LinkedHashSet<>(); // Patient - if (myDaoConfig.getIndexMissingFields() == DaoConfig.IndexEnabledEnum.DISABLED) { + if (myStorageSettings.getIndexMissingFields() == JpaStorageSettings.IndexEnabledEnum.DISABLED) { String errorMessage = "You attempted to start a Patient Bulk Export, but the system has `Index Missing Fields` disabled. It must be enabled for Patient Bulk Export"; ourLog.error(errorMessage); throw new IllegalStateException(Msg.code(797) + errorMessage); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/imprt/svc/BulkDataImportSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/imprt/svc/BulkDataImportSvcImpl.java index 8c4467b295f..49e8e2f80ca 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/imprt/svc/BulkDataImportSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/imprt/svc/BulkDataImportSvcImpl.java @@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.bulk.imprt.svc; import ca.uhn.fhir.batch2.api.IJobCoordinator; import ca.uhn.fhir.batch2.importpull.models.Batch2BulkImportPullJobParameters; import ca.uhn.fhir.batch2.model.JobInstanceStartRequest; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.util.Logs; import ca.uhn.fhir.jpa.bulk.imprt.api.IBulkDataImportSvc; import ca.uhn.fhir.jpa.bulk.imprt.model.ActivateJobResult; @@ -79,7 +79,7 @@ public class BulkDataImportSvcImpl implements IBulkDataImportSvc, IHasScheduledJ private IJobCoordinator myJobCoordinator; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @PostConstruct public void start() { @@ -163,7 +163,7 @@ public class BulkDataImportSvcImpl implements IBulkDataImportSvc, IHasScheduledJ @Transactional(propagation = Propagation.NEVER) @Override public ActivateJobResult activateNextReadyJob() { - if (!myDaoConfig.isEnableTaskBulkImportJobExecution()) { + if (!myStorageSettings.isEnableTaskBulkImportJobExecution()) { Logs.getBatchTroubleshootingLog().trace("Bulk import job execution is not enabled on this server. No action taken."); return new ActivateJobResult(false, null); } @@ -295,7 +295,7 @@ public class BulkDataImportSvcImpl implements IBulkDataImportSvc, IHasScheduledJ ourLog.info("Submitting bulk import with bijob id {} to job scheduler", biJobId); - return myJobCoordinator.startInstance(request).getJobId(); + return myJobCoordinator.startInstance(request).getInstanceId(); } private void addFilesToJob(@Nonnull List theInitialFiles, BulkImportJobEntity job, int nextSequence) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/Batch2SupportConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/Batch2SupportConfig.java index 791751bf5e5..002b2e8cba1 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/Batch2SupportConfig.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/Batch2SupportConfig.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.config; * #L% */ -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.svc.IBatch2DaoSvc; import ca.uhn.fhir.jpa.api.svc.IDeleteExpungeSvc; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; @@ -48,7 +48,7 @@ public class Batch2SupportConfig { } @Bean - DeleteExpungeSqlBuilder deleteExpungeSqlBuilder(ResourceTableFKProvider theResourceTableFKProvider, DaoConfig theDaoConfig, IIdHelperService theIdHelper, IResourceLinkDao theResourceLinkDao) { - return new DeleteExpungeSqlBuilder(theResourceTableFKProvider, theDaoConfig, theIdHelper, theResourceLinkDao); + DeleteExpungeSqlBuilder deleteExpungeSqlBuilder(ResourceTableFKProvider theResourceTableFKProvider, JpaStorageSettings theStorageSettings, IIdHelperService theIdHelper, IResourceLinkDao theResourceLinkDao) { + return new DeleteExpungeSqlBuilder(theResourceTableFKProvider, theStorageSettings, theIdHelper, theResourceLinkDao); } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/JpaConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/JpaConfig.java index 8583f80b789..43de4a6a32a 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/JpaConfig.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/JpaConfig.java @@ -8,7 +8,7 @@ import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.IInterceptorService; import ca.uhn.fhir.interceptor.executor.InterceptorService; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; @@ -214,7 +214,7 @@ public class JpaConfig { private static final String HAPI_DEFAULT_SCHEDULER_GROUP = "HAPI"; @Autowired - public DaoConfig myDaoConfig; + public JpaStorageSettings myStorageSettings; @Bean("myDaoRegistry") public DaoRegistry daoRegistry() { @@ -291,16 +291,16 @@ public class JpaConfig { @Bean(name = "myBinaryStorageInterceptor") @Lazy - public BinaryStorageInterceptor> binaryStorageInterceptor(DaoConfig theDaoConfig, FhirContext theCtx) { + public BinaryStorageInterceptor> binaryStorageInterceptor(JpaStorageSettings theStorageSettings, FhirContext theCtx) { BinaryStorageInterceptor> interceptor = new BinaryStorageInterceptor<>(theCtx); - interceptor.setAllowAutoInflateBinaries(theDaoConfig.isAllowAutoInflateBinaries()); - interceptor.setAutoInflateBinariesMaximumSize(theDaoConfig.getAutoInflateBinariesMaximumBytes()); + interceptor.setAllowAutoInflateBinaries(theStorageSettings.isAllowAutoInflateBinaries()); + interceptor.setAutoInflateBinariesMaximumSize(theStorageSettings.getAutoInflateBinariesMaximumBytes()); return interceptor; } @Bean - public MemoryCacheService memoryCacheService(DaoConfig theDaoConfig) { - return new MemoryCacheService(theDaoConfig); + public MemoryCacheService memoryCacheService(JpaStorageSettings theStorageSettings) { + return new MemoryCacheService(theStorageSettings); } @Bean @@ -454,8 +454,8 @@ public class JpaConfig { } @Bean - public IBulkDataExportJobSchedulingHelper bulkDataExportJobSchedulingHelper(DaoRegistry theDaoRegistry, PlatformTransactionManager theTxManager, DaoConfig theDaoConfig, BulkExportHelperService theBulkExportHelperSvc, IJobPersistence theJpaJobPersistence) { - return new BulkDataExportJobSchedulingHelperImpl(theDaoRegistry, theTxManager, theDaoConfig, theBulkExportHelperSvc, theJpaJobPersistence, null); + public IBulkDataExportJobSchedulingHelper bulkDataExportJobSchedulingHelper(DaoRegistry theDaoRegistry, PlatformTransactionManager theTxManager, JpaStorageSettings theStorageSettings, BulkExportHelperService theBulkExportHelperSvc, IJobPersistence theJpaJobPersistence) { + return new BulkDataExportJobSchedulingHelperImpl(theDaoRegistry, theTxManager, theStorageSettings, theBulkExportHelperSvc, theJpaJobPersistence, null); } @Bean @@ -662,7 +662,7 @@ public class JpaConfig { @Bean public SearchStrategyFactory searchStrategyFactory(@Autowired(required = false) IFulltextSearchSvc theFulltextSvc) { - return new SearchStrategyFactory(myDaoConfig, theFulltextSvc); + return new SearchStrategyFactory(myStorageSettings, theFulltextSvc); } @Bean @@ -759,8 +759,8 @@ public class JpaConfig { } @Bean - public SearchParameterDaoValidator searchParameterDaoValidator(FhirContext theFhirContext, DaoConfig theDaoConfig, ISearchParamRegistry theSearchParamRegistry) { - return new SearchParameterDaoValidator(theFhirContext, theDaoConfig, theSearchParamRegistry); + public SearchParameterDaoValidator searchParameterDaoValidator(FhirContext theFhirContext, JpaStorageSettings theStorageSettings, ISearchParamRegistry theSearchParamRegistry) { + return new SearchParameterDaoValidator(theFhirContext, theStorageSettings, theSearchParamRegistry); } @Bean @@ -774,7 +774,6 @@ public class JpaConfig { } - @Bean public ITermReindexingSvc termReindexingSvc() { return new TermReindexingSvcImpl(); @@ -786,10 +785,12 @@ public class JpaConfig { } @Bean - public IMdmLinkDao mdmLinkDao(){ + public IMdmLinkDao mdmLinkDao() { return new MdmLinkDaoJpaImpl(); } @Bean - IMdmLinkImplFactory mdmLinkImplFactory() {return new JpaMdmLinkImplFactory();} + IMdmLinkImplFactory mdmLinkImplFactory() { + return new JpaMdmLinkImplFactory(); + } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/SearchConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/SearchConfig.java index fab1c0d61ca..5007c55f44f 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/SearchConfig.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/SearchConfig.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.config; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IDao; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; @@ -33,7 +33,6 @@ import ca.uhn.fhir.jpa.dao.data.IResourceSearchViewDao; import ca.uhn.fhir.jpa.dao.data.IResourceTagDao; import ca.uhn.fhir.jpa.dao.tx.HapiTransactionService; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc; import ca.uhn.fhir.jpa.search.ExceptionService; import ca.uhn.fhir.jpa.search.ISynchronousSearchSvc; @@ -63,7 +62,7 @@ public class SearchConfig { public static final String CONTINUE_TASK = "continueTask"; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Autowired private HapiFhirLocalContainerEntityManagerFactoryBean myEntityManagerFactory; @Autowired @@ -71,8 +70,6 @@ public class SearchConfig { @Autowired private HibernatePropertiesProvider myDialectProvider; @Autowired - private ModelConfig myModelConfig; - @Autowired private ISearchParamRegistry mySearchParamRegistry; @Autowired private PartitionSettings myPartitionSettings; @@ -115,7 +112,7 @@ public class SearchConfig { public ISearchCoordinatorSvc searchCoordinatorSvc() { return new SearchCoordinatorSvcImpl( myContext, - myDaoConfig, + myStorageSettings, myInterceptorBroadcaster, myHapiTransactionService, mySearchCacheSvc, @@ -139,14 +136,13 @@ public class SearchConfig { @Bean(name = ISearchBuilder.SEARCH_BUILDER_BEAN_NAME) @Scope("prototype") - public ISearchBuilder newSearchBuilder(IDao theDao, String theResourceName, Class theResourceType, DaoConfig theDaoConfig) { + public ISearchBuilder newSearchBuilder(IDao theDao, String theResourceName, Class theResourceType) { return new SearchBuilder(theDao, theResourceName, - myDaoConfig, + myStorageSettings, myEntityManagerFactory, mySqlBuilderFactory, myDialectProvider, - myModelConfig, mySearchParamRegistry, myPartitionSettings, myInterceptorBroadcaster, @@ -168,7 +164,7 @@ public class SearchConfig { myInterceptorBroadcaster, mySearchBuilderFactory, mySearchResultCacheSvc, - myDaoConfig, + myStorageSettings, mySearchCacheSvc, myPagingProvider ); @@ -184,7 +180,7 @@ public class SearchConfig { myInterceptorBroadcaster, mySearchBuilderFactory, mySearchResultCacheSvc, - myDaoConfig, + myStorageSettings, mySearchCacheSvc, myPagingProvider, exceptionService() // singleton diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java index f3a8fc224c8..7ec50a52a27 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java @@ -12,7 +12,7 @@ import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IDao; import ca.uhn.fhir.jpa.api.dao.IJpaDao; @@ -223,8 +223,6 @@ public abstract class BaseHapiFhirDao extends BaseStora @Autowired ExpungeService myExpungeService; @Autowired - private DaoConfig myConfig; - @Autowired private ISearchParamPresenceSvc mySearchParamPresenceSvc; @Autowired private SearchParamWithInlineReferencesExtractor mySearchParamWithInlineReferencesExtractor; @@ -358,8 +356,8 @@ public abstract class BaseHapiFhirDao extends BaseStora } @Override - public DaoConfig getConfig() { - return myConfig; + public JpaStorageSettings getStorageSettings() { + return myStorageSettings; } @Override @@ -386,7 +384,7 @@ public abstract class BaseHapiFhirDao extends BaseStora TagDefinition retVal = myMemoryCacheService.getIfPresent(MemoryCacheService.CacheEnum.TAG_DEFINITION, key); if (retVal == null) { - HashMap resolvedTagDefinitions = theTransactionDetails.getOrCreateUserData(HapiTransactionService.XACT_USERDATA_KEY_RESOLVED_TAG_DEFINITIONS, () -> new HashMap<>()); + HashMap resolvedTagDefinitions = theTransactionDetails.getOrCreateUserData(HapiTransactionService.XACT_USERDATA_KEY_RESOLVED_TAG_DEFINITIONS, HashMap::new); retVal = resolvedTagDefinitions.get(key); if (retVal == null) { @@ -526,11 +524,11 @@ public abstract class BaseHapiFhirDao extends BaseStora } public boolean isLogicalReference(IIdType theId) { - return LogicalReferenceHelper.isLogicalReference(myConfig.getModelConfig(), theId); + return LogicalReferenceHelper.isLogicalReference(myStorageSettings, theId); } /** - * Returns true if the resource has changed (either the contents or the tags) + * Returns {@literal true} if the resource has changed (either the contents or the tags) */ protected EncodedResource populateResourceIntoEntity(TransactionDetails theTransactionDetails, RequestDetails theRequest, IBaseResource theResource, ResourceTable theEntity, boolean thePerformIndexing) { if (theEntity.getResourceType() == null) { @@ -546,7 +544,7 @@ public abstract class BaseHapiFhirDao extends BaseStora if (thePerformIndexing) { - encoding = myConfig.getResourceEncoding(); + encoding = myStorageSettings.getResourceEncoding(); String resourceType = theEntity.getResourceType(); @@ -560,7 +558,7 @@ public abstract class BaseHapiFhirDao extends BaseStora HashFunction sha256 = Hashing.sha256(); HashCode hashCode; String encodedResource = encodeResource(theResource, encoding, excludeElements, myContext); - if (getConfig().getInlineResourceTextBelowSize() > 0 && encodedResource.length() < getConfig().getInlineResourceTextBelowSize()) { + if (getStorageSettings().getInlineResourceTextBelowSize() > 0 && encodedResource.length() < getStorageSettings().getInlineResourceTextBelowSize()) { resourceText = encodedResource; resourceBinary = null; encoding = ResourceEncodingEnum.JSON; @@ -592,8 +590,8 @@ public abstract class BaseHapiFhirDao extends BaseStora } - boolean skipUpdatingTags = myConfig.isMassIngestionMode() && theEntity.isHasTags(); - skipUpdatingTags |= myConfig.getTagStorageMode() == DaoConfig.TagStorageModeEnum.INLINE; + boolean skipUpdatingTags = myStorageSettings.isMassIngestionMode() && theEntity.isHasTags(); + skipUpdatingTags |= myStorageSettings.getTagStorageMode() == JpaStorageSettings.TagStorageModeEnum.INLINE; if (!skipUpdatingTags) { changed |= updateTags(theTransactionDetails, theRequest, theResource, theEntity); @@ -615,7 +613,7 @@ public abstract class BaseHapiFhirDao extends BaseStora if (thePerformIndexing && !changed) { if (theEntity.getId() == null) { changed = true; - } else if (myConfig.isMassIngestionMode()) { + } else if (myStorageSettings.isMassIngestionMode()) { // Don't check existing - We'll rely on the SHA256 hash only @@ -709,7 +707,7 @@ public abstract class BaseHapiFhirDao extends BaseStora } theExcludeElements.add("id"); - boolean inlineTagMode = getConfig().getTagStorageMode() == DaoConfig.TagStorageModeEnum.INLINE; + boolean inlineTagMode = getStorageSettings().getTagStorageMode() == JpaStorageSettings.TagStorageModeEnum.INLINE; if (hasExtensions || inlineTagMode) { if (!inlineTagMode) { theExcludeElements.add(theResourceType + ".meta.profile"); @@ -1029,7 +1027,7 @@ public abstract class BaseHapiFhirDao extends BaseStora } - if (thePerformIndexing && changed != null && !changed.isChanged() && !theForceUpdate && myConfig.isSuppressUpdatesWithNoChange() && (entity.getVersion() > 1 || theUpdateVersion)) { + if (thePerformIndexing && changed != null && !changed.isChanged() && !theForceUpdate && myStorageSettings.isSuppressUpdatesWithNoChange() && (entity.getVersion() > 1 || theUpdateVersion)) { ourLog.debug("Resource {} has not changed", entity.getIdDt().toUnqualified().getValue()); if (theResource != null) { myJpaStorageResourceParser.updateResourceMetadata(entity, theResource); @@ -1152,7 +1150,7 @@ public abstract class BaseHapiFhirDao extends BaseStora ResourceTable entity = (ResourceTable) theEntity; IBaseResource oldResource; - if (getConfig().isMassIngestionMode()) { + if (getStorageSettings().isMassIngestionMode()) { oldResource = null; } else { oldResource = myJpaStorageResourceParser.toResource(entity, false); @@ -1183,7 +1181,7 @@ public abstract class BaseHapiFhirDao extends BaseStora historyEntity.setDeleted(null); // Check if resource is the same - ResourceEncodingEnum encoding = myConfig.getResourceEncoding(); + ResourceEncodingEnum encoding = myStorageSettings.getResourceEncoding(); List excludeElements = new ArrayList<>(8); getExcludedElements(historyEntity.getResourceType(), excludeElements, theResource.getMeta()); String encodedResourceString = encodeResource(theResource, encoding, excludeElements, myContext); @@ -1192,13 +1190,13 @@ public abstract class BaseHapiFhirDao extends BaseStora historyEntity.setUpdated(theTransactionDetails.getTransactionDate()); - if (!changed && myConfig.isSuppressUpdatesWithNoChange() && (historyEntity.getVersion() > 1)) { + if (!changed && myStorageSettings.isSuppressUpdatesWithNoChange() && (historyEntity.getVersion() > 1)) { ourLog.debug("Resource {} has not changed", historyEntity.getIdDt().toUnqualified().getValue()); myJpaStorageResourceParser.updateResourceMetadata(historyEntity, theResource); return historyEntity; } - if (getConfig().getInlineResourceTextBelowSize() > 0 && encodedResourceString.length() < getConfig().getInlineResourceTextBelowSize()) { + if (getStorageSettings().getInlineResourceTextBelowSize() > 0 && encodedResourceString.length() < getStorageSettings().getInlineResourceTextBelowSize()) { populateEncodedResource(encodedResource, encodedResourceString, null, ResourceEncodingEnum.JSON); } else { populateEncodedResource(encodedResource, null, resourceBinary, encoding); @@ -1260,7 +1258,7 @@ public abstract class BaseHapiFhirDao extends BaseStora } private void createHistoryEntry(RequestDetails theRequest, IBaseResource theResource, ResourceTable theEntity, EncodedResource theChanged) { - boolean versionedTags = getConfig().getTagStorageMode() == DaoConfig.TagStorageModeEnum.VERSIONED; + boolean versionedTags = getStorageSettings().getTagStorageMode() == JpaStorageSettings.TagStorageModeEnum.VERSIONED; final ResourceHistoryTable historyEntry = theEntity.toHistory(versionedTags); historyEntry.setEncoding(theChanged.getEncoding()); historyEntry.setResource(theChanged.getResourceBinary()); @@ -1293,8 +1291,8 @@ public abstract class BaseHapiFhirDao extends BaseStora String requestId = getRequestId(theRequest, source); source = cleanProvenanceSourceUri(source); - boolean haveSource = isNotBlank(source) && myConfig.getStoreMetaSourceInformation().isStoreSourceUri(); - boolean haveRequestId = isNotBlank(requestId) && myConfig.getStoreMetaSourceInformation().isStoreRequestId(); + boolean haveSource = isNotBlank(source) && myStorageSettings.getStoreMetaSourceInformation().isStoreSourceUri(); + boolean haveRequestId = isNotBlank(requestId) && myStorageSettings.getStoreMetaSourceInformation().isStoreRequestId(); if (haveSource || haveRequestId) { ResourceHistoryProvenanceEntity provenance = new ResourceHistoryProvenanceEntity(); provenance.setResourceHistoryTable(historyEntry); @@ -1311,7 +1309,7 @@ public abstract class BaseHapiFhirDao extends BaseStora } private String getRequestId(RequestDetails theRequest, String theSource) { - if (myConfig.isPreserveRequestIdInResourceBody()) { + if (myStorageSettings.isPreserveRequestIdInResourceBody()) { return StringUtils.substringAfter(theSource, "#"); } return theRequest != null ? theRequest.getRequestId() : null; @@ -1466,7 +1464,7 @@ public abstract class BaseHapiFhirDao extends BaseStora continue; } - if (getConfig().isEnforceReferenceTargetTypes()) { + if (getStorageSettings().isEnforceReferenceTargetTypes()) { for (IBase nextChild : values) { IBaseReference nextRef = (IBaseReference) nextChild; IIdType referencedId = nextRef.getReferenceElement(); @@ -1487,9 +1485,9 @@ public abstract class BaseHapiFhirDao extends BaseStora } protected void validateMetaCount(int theMetaCount) { - if (myConfig.getResourceMetaCountHardLimit() != null) { - if (theMetaCount > myConfig.getResourceMetaCountHardLimit()) { - throw new UnprocessableEntityException(Msg.code(932) + "Resource contains " + theMetaCount + " meta entries (tag/profile/security label), maximum is " + myConfig.getResourceMetaCountHardLimit()); + if (myStorageSettings.getResourceMetaCountHardLimit() != null) { + if (theMetaCount > myStorageSettings.getResourceMetaCountHardLimit()) { + throw new UnprocessableEntityException(Msg.code(932) + "Resource contains " + theMetaCount + " meta entries (tag/profile/security label), maximum is " + myStorageSettings.getResourceMetaCountHardLimit()); } } } @@ -1529,7 +1527,7 @@ public abstract class BaseHapiFhirDao extends BaseStora throw new UnprocessableEntityException(Msg.code(933) + "Resource contains the 'subsetted' tag, and must not be stored as it may contain a subset of available data"); } - if (getConfig().isEnforceReferenceTargetTypes()) { + if (getStorageSettings().isEnforceReferenceTargetTypes()) { String resName = getContext().getResourceType(theResource); validateChildReferenceTargetTypes(theResource, resName); } @@ -1544,8 +1542,8 @@ public abstract class BaseHapiFhirDao extends BaseStora } @VisibleForTesting - public void setDaoConfigForUnitTest(DaoConfig theDaoConfig) { - myConfig = theDaoConfig; + public void setStorageSettingsForUnitTest(JpaStorageSettings theStorageSettings) { + myStorageSettings = theStorageSettings; } public void populateFullTextFields(final FhirContext theContext, final IBaseResource theResource, ResourceTable theEntity, ResourceIndexedSearchParams theNewParams) { @@ -1555,7 +1553,7 @@ public abstract class BaseHapiFhirDao extends BaseStora } else { theEntity.setNarrativeText(parseNarrativeTextIntoWords(theResource)); theEntity.setContentText(parseContentTextIntoWords(theContext, theResource)); - if (myDaoConfig.isAdvancedHSearchIndexing()) { + if (myStorageSettings.isAdvancedHSearchIndexing()) { ExtendedHSearchIndexData hSearchIndexData = myFulltextSearchSvc.extractLuceneIndexData(theResource, theNewParams); theEntity.setLuceneIndexData(hSearchIndexData); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java index 2c1d92e7d35..3d6377dc85e 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java @@ -32,7 +32,7 @@ import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.ReadPartitionIdRequestDetails; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; @@ -268,7 +268,7 @@ public abstract class BaseHapiFhirResourceDao extends B } } - if (getConfig().getResourceServerIdStrategy() == DaoConfig.IdStrategyEnum.UUID) { + if (getStorageSettings().getResourceServerIdStrategy() == JpaStorageSettings.IdStrategyEnum.UUID) { theResource.setId(UUID.randomUUID().toString()); theResource.setUserData(JpaConstants.RESOURCE_ID_SERVER_ASSIGNED, Boolean.TRUE); } @@ -376,11 +376,11 @@ public abstract class BaseHapiFhirResourceDao extends B boolean createForPureNumericIds = true; createForcedIdIfNeeded(entity, resourceIdBeforeStorage, createForPureNumericIds); } else { - boolean createForPureNumericIds = getConfig().getResourceClientIdStrategy() != DaoConfig.ClientIdStrategyEnum.ALPHANUMERIC; + boolean createForPureNumericIds = getStorageSettings().getResourceClientIdStrategy() != JpaStorageSettings.ClientIdStrategyEnum.ALPHANUMERIC; createForcedIdIfNeeded(entity, resourceIdBeforeStorage, createForPureNumericIds); } } else { - switch (getConfig().getResourceClientIdStrategy()) { + switch (getStorageSettings().getResourceClientIdStrategy()) { case NOT_ALLOWED: case ALPHANUMERIC: break; @@ -475,15 +475,15 @@ public abstract class BaseHapiFhirResourceDao extends B } void validateResourceIdCreation(T theResource, RequestDetails theRequest) { - DaoConfig.ClientIdStrategyEnum strategy = getConfig().getResourceClientIdStrategy(); + JpaStorageSettings.ClientIdStrategyEnum strategy = getStorageSettings().getResourceClientIdStrategy(); - if (strategy == DaoConfig.ClientIdStrategyEnum.NOT_ALLOWED) { + if (strategy == JpaStorageSettings.ClientIdStrategyEnum.NOT_ALLOWED) { if (!isSystemRequest(theRequest)) { throw new ResourceNotFoundException(Msg.code(959) + getMessageSanitized("failedToCreateWithClientAssignedIdNotAllowed", theResource.getIdElement().getIdPart())); } } - if (strategy == DaoConfig.ClientIdStrategyEnum.ALPHANUMERIC) { + if (strategy == JpaStorageSettings.ClientIdStrategyEnum.ALPHANUMERIC) { if (theResource.getIdElement().isIdPartValidLong()) { throw new InvalidRequestException(Msg.code(960) + getMessageSanitized("failedToCreateWithClientAssignedNumericId", theResource.getIdElement().getIdPart())); } @@ -648,7 +648,7 @@ public abstract class BaseHapiFhirResourceDao extends B Set resourceIds = myMatchResourceUrlService.search(paramMap, myResourceType, theRequest, null); if (resourceIds.size() > 1) { - if (!getConfig().isAllowMultipleDelete()) { + if (!getStorageSettings().isAllowMultipleDelete()) { throw new PreconditionFailedException(Msg.code(962) + getContext().getLocalizer().getMessageSanitized(BaseStorageDao.class, "transactionOperationWithMultipleMatchFailure", "DELETE", theUrl, resourceIds.size())); } } @@ -720,7 +720,7 @@ public abstract class BaseHapiFhirResourceDao extends B } private void validateDeleteEnabled() { - if (!getConfig().isDeleteEnabled()) { + if (!getStorageSettings().isDeleteEnabled()) { String msg = getContext().getLocalizer().getMessage(BaseStorageDao.class, "deleteBlockedBecauseDisabled"); throw new PreconditionFailedException(Msg.code(966) + msg); } @@ -834,7 +834,7 @@ public abstract class BaseHapiFhirResourceDao extends B } private void validateExpungeEnabled() { - if (!getConfig().isExpungeEnabled()) { + if (!getStorageSettings().isExpungeEnabled()) { throw new MethodNotAllowedException(Msg.code(968) + "$expunge is not enabled on this server"); } } @@ -953,7 +953,7 @@ public abstract class BaseHapiFhirResourceDao extends B return; } - if (getConfig().isMarkResourcesForReindexingUponSearchParameterChange()) { + if (getStorageSettings().isMarkResourcesForReindexingUponSearchParameterChange()) { ReindexJobParameters params = new ReindexJobParameters(); @@ -1041,7 +1041,7 @@ public abstract class BaseHapiFhirResourceDao extends B } ResourceTable latestVersion = readEntityLatestVersion(theResourceId, theRequest, transactionDetails); - boolean nonVersionedTags = myDaoConfig.getTagStorageMode() != DaoConfig.TagStorageModeEnum.VERSIONED; + boolean nonVersionedTags = myStorageSettings.getTagStorageMode() != JpaStorageSettings.TagStorageModeEnum.VERSIONED; if (latestVersion.getVersion() != entity.getVersion() || nonVersionedTags) { doMetaDelete(theMetaDel, entity, theRequest, transactionDetails); } else { @@ -1092,7 +1092,7 @@ public abstract class BaseHapiFhirResourceDao extends B @PostConstruct @Override public void start() { - assert getConfig() != null; + assert getStorageSettings() != null; RuntimeResourceDefinition def = getContext().getResourceDefinition(myResourceType); myResourceName = def.getName(); @@ -1425,7 +1425,7 @@ public abstract class BaseHapiFhirResourceDao extends B if (theParams.getSearchContainedMode() == SearchContainedModeEnum.BOTH) { throw new MethodNotAllowedException(Msg.code(983) + "Contained mode 'both' is not currently supported"); } - if (theParams.getSearchContainedMode() != SearchContainedModeEnum.FALSE && !myModelConfig.isIndexOnContainedResources()) { + if (theParams.getSearchContainedMode() != SearchContainedModeEnum.FALSE && !myStorageSettings.isIndexOnContainedResources()) { throw new MethodNotAllowedException(Msg.code(984) + "Searching with _contained mode enabled is not enabled on this server"); } @@ -1480,10 +1480,10 @@ public abstract class BaseHapiFhirResourceDao extends B if (theRequest != null) { if (theRequest.isSubRequest()) { - Integer max = getConfig().getMaximumSearchResultCountInTransaction(); + Integer max = getStorageSettings().getMaximumSearchResultCountInTransaction(); if (max != null) { Validate.inclusiveBetween(1, Integer.MAX_VALUE, max, "Maximum search result count in transaction ust be a positive integer"); - theParams.setLoadSynchronousUpTo(getConfig().getMaximumSearchResultCountInTransaction()); + theParams.setLoadSynchronousUpTo(getStorageSettings().getMaximumSearchResultCountInTransaction()); } } @@ -1517,9 +1517,9 @@ public abstract class BaseHapiFhirResourceDao extends B return myTransactionService.execute(theRequest, transactionDetails, tx -> { if (theParams.getLoadSynchronousUpTo() != null) { - theParams.setLoadSynchronousUpTo(Math.min(getConfig().getInternalSynchronousSearchSize(), theParams.getLoadSynchronousUpTo())); + theParams.setLoadSynchronousUpTo(Math.min(getStorageSettings().getInternalSynchronousSearchSize(), theParams.getLoadSynchronousUpTo())); } else { - theParams.setLoadSynchronousUpTo(getConfig().getInternalSynchronousSearchSize()); + theParams.setLoadSynchronousUpTo(getStorageSettings().getInternalSynchronousSearchSize()); } ISearchBuilder builder = mySearchBuilderFactory.newSearchBuilder(this, getResourceName(), getResourceType()); @@ -1628,7 +1628,7 @@ public abstract class BaseHapiFhirResourceDao extends B Runnable onRollback = () -> theResource.getIdElement().setValue(id); // Execute the update in a retryable transaction - if (myDaoConfig.isUpdateWithHistoryRewriteEnabled() && theRequest != null && theRequest.isRewriteHistory()) { + if (myStorageSettings.isUpdateWithHistoryRewriteEnabled() && theRequest != null && theRequest.isRewriteHistory()) { return myTransactionService.execute(theRequest, theTransactionDetails, tx -> doUpdateWithHistoryRewrite(theResource, theRequest, theTransactionDetails), onRollback); } else { return myTransactionService.execute(theRequest, theTransactionDetails, tx -> doUpdate(theResource, theMatchUrl, thePerformIndexing, theForceUpdateVersion, theRequest, theTransactionDetails), onRollback); @@ -1770,7 +1770,7 @@ public abstract class BaseHapiFhirResourceDao extends B // Validate that there are no resources pointing to the candidate that // would prevent deletion DeleteConflictList deleteConflicts = new DeleteConflictList(); - if (getConfig().isEnforceReferentialIntegrityOnDelete()) { + if (getStorageSettings().isEnforceReferentialIntegrityOnDelete()) { myDeleteConflictService.validateOkToDelete(deleteConflicts, entity, true, theRequest, new TransactionDetails()); } DeleteConflictUtil.validateDeleteConflictsEmptyOrThrowException(getContext(), deleteConflicts); @@ -1839,7 +1839,7 @@ public abstract class BaseHapiFhirResourceDao extends B private void validateGivenIdIsAppropriateToRetrieveResource(IIdType theId, BaseHasResource entity) { if (entity.getForcedId() != null) { - if (getConfig().getResourceClientIdStrategy() != DaoConfig.ClientIdStrategyEnum.ANY) { + if (getStorageSettings().getResourceClientIdStrategy() != JpaStorageSettings.ClientIdStrategyEnum.ANY) { if (theId.isIdPartValidLong()) { // This means that the resource with the given numeric ID exists, but it has a "forced ID", meaning that // as far as the outside world is concerned, the given ID doesn't exist (it's just an internal pointer diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java index dc72f6013d6..cfb79a273d2 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirSystemDao.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.dao; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.api.model.ExpungeOutcome; @@ -102,11 +102,11 @@ public abstract class BaseHapiFhirSystemDao extends B } private void validateExpungeEnabled(ExpungeOptions theExpungeOptions) { - if (!getConfig().isExpungeEnabled()) { + if (!getStorageSettings().isExpungeEnabled()) { throw new MethodNotAllowedException(Msg.code(2080) + "$expunge is not enabled on this server"); } - if (theExpungeOptions.isExpungeEverything() && !getConfig().isAllowMultipleDelete()) { + if (theExpungeOptions.isExpungeEverything() && !getStorageSettings().isAllowMultipleDelete()) { throw new MethodNotAllowedException(Msg.code(2081) + "Multiple delete is not enabled on this server"); } } @@ -214,7 +214,7 @@ public abstract class BaseHapiFhirSystemDao extends B } entityIds = loadedResourceTableEntries.stream().map(t->t.getId()).collect(Collectors.toList()); - if (myDaoConfig.getIndexMissingFields() == DaoConfig.IndexEnabledEnum.ENABLED) { + if (myStorageSettings.getIndexMissingFields() == JpaStorageSettings.IndexEnabledEnum.ENABLED) { preFetchIndexes(entityIds, "searchParamPresence", "mySearchParamPresents", null); } @@ -280,8 +280,8 @@ public abstract class BaseHapiFhirSystemDao extends B } @Override - protected DaoConfig getConfig() { - return myDaoConfig; + protected JpaStorageSettings getStorageSettings() { + return myStorageSettings; } @Override @@ -290,8 +290,8 @@ public abstract class BaseHapiFhirSystemDao extends B } @VisibleForTesting - public void setDaoConfigForUnitTest(DaoConfig theDaoConfig) { - myDaoConfig = theDaoConfig; + public void setStorageSettingsForUnitTest(JpaStorageSettings theStorageSettings) { + myStorageSettings = theStorageSettings; } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java index ae16e15e3c7..489eb8b68f9 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.dao; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.dao.search.ExtendedHSearchClauseBuilder; import ca.uhn.fhir.jpa.dao.search.ExtendedHSearchIndexExtractor; @@ -31,7 +31,6 @@ import ca.uhn.fhir.jpa.dao.search.ExtendedHSearchSearchBuilder; import ca.uhn.fhir.jpa.dao.search.IHSearchSortHelper; import ca.uhn.fhir.jpa.dao.search.LastNOperation; import ca.uhn.fhir.jpa.model.dao.JpaPid; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.model.search.ExtendedHSearchIndexData; import ca.uhn.fhir.jpa.search.autocomplete.ValueSetAutocompleteOptions; @@ -84,7 +83,11 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank; public class FulltextSearchSvcImpl implements IFulltextSearchSvc { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FulltextSearchSvcImpl.class); private static final int DEFAULT_MAX_NON_PAGED_SIZE = 500; - + final private ExtendedHSearchSearchBuilder myAdvancedIndexQueryBuilder = new ExtendedHSearchSearchBuilder(); + @Autowired + ISearchParamExtractor mySearchParamExtractor; + @Autowired + IIdHelperService myIdHelperService; @PersistenceContext(type = PersistenceContextType.TRANSACTION) private EntityManager myEntityManager; @Autowired @@ -94,20 +97,9 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { @Autowired private ISearchParamRegistry mySearchParamRegistry; @Autowired - private DaoConfig myDaoConfig; - @Autowired - ISearchParamExtractor mySearchParamExtractor; - @Autowired - IIdHelperService myIdHelperService; - - @Autowired - ModelConfig myModelConfig; - + private JpaStorageSettings myStorageSettings; @Autowired private IHSearchSortHelper myExtendedFulltextSortHelper; - - final private ExtendedHSearchSearchBuilder myAdvancedIndexQueryBuilder = new ExtendedHSearchSearchBuilder(); - @Autowired(required = false) private IHSearchEventListener myHSearchEventListener; @@ -120,12 +112,13 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { super(); } + @Override public ExtendedHSearchIndexData extractLuceneIndexData(IBaseResource theResource, ResourceIndexedSearchParams theNewParams) { String resourceType = myFhirContext.getResourceType(theResource); ResourceSearchParams activeSearchParams = mySearchParamRegistry.getActiveSearchParams(resourceType); ExtendedHSearchIndexExtractor extractor = new ExtendedHSearchIndexExtractor( - myDaoConfig, myFhirContext, activeSearchParams, mySearchParamExtractor, myModelConfig); - return extractor.extract(theResource,theNewParams); + myStorageSettings, myFhirContext, activeSearchParams, mySearchParamExtractor); + return extractor.extract(theResource, theNewParams); } @Override @@ -134,7 +127,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { // keep this in sync with the guts of doSearch boolean requiresHibernateSearchAccess = myParams.containsKey(Constants.PARAM_CONTENT) || myParams.containsKey(Constants.PARAM_TEXT) || myParams.isLastN(); - requiresHibernateSearchAccess |= myDaoConfig.isAdvancedHSearchIndexing() && myAdvancedIndexQueryBuilder.isSupportsSomeOf(myParams); + requiresHibernateSearchAccess |= myStorageSettings.isAdvancedHSearchIndexing() && myAdvancedIndexQueryBuilder.isSupportsSomeOf(myParams); return requiresHibernateSearchAccess; } @@ -186,10 +179,10 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { private SearchQueryOptionsStep getSearchQueryOptionsStep( - String theResourceType, SearchParameterMap theParams, IResourcePersistentId theReferencingPid) { + String theResourceType, SearchParameterMap theParams, IResourcePersistentId theReferencingPid) { dispatchEvent(IHSearchEventListener.HSearchEventType.SEARCH); - var query= getSearchSession().search(ResourceTable.class) + var query = getSearchSession().search(ResourceTable.class) // The document id is the PK which is pid. We use this instead of _myId to avoid fetching the doc body. .select( // adapt the String docRef.id() to the Long that it really is. @@ -203,7 +196,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { if (theParams.getSort() != null) { query.sort( - f -> myExtendedFulltextSortHelper.getSortClauses(f, theParams.getSort(), theResourceType) ); + f -> myExtendedFulltextSortHelper.getSortClauses(f, theParams.getSort(), theResourceType)); // indicate parameter was processed theParams.setSort(null); @@ -216,7 +209,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { private PredicateFinalStep buildWhereClause(SearchPredicateFactory f, String theResourceType, SearchParameterMap theParams, IResourcePersistentId theReferencingPid) { return f.bool(b -> { - ExtendedHSearchClauseBuilder builder = new ExtendedHSearchClauseBuilder(myFhirContext, myModelConfig, b, f); + ExtendedHSearchClauseBuilder builder = new ExtendedHSearchClauseBuilder(myFhirContext, myStorageSettings, b, f); /* * Handle _content parameter (resource body content) @@ -249,7 +242,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { /* * Handle other supported parameters */ - if (myDaoConfig.isAdvancedHSearchIndexing() && theParams.getEverythingMode() == null) { + if (myStorageSettings.isAdvancedHSearchIndexing() && theParams.getEverythingMode() == null) { myAdvancedIndexQueryBuilder.addAndConsumeAdvancedQueryClauses(builder, theResourceType, theParams, mySearchParamRegistry); } //DROP EARLY HERE IF BOOL IS EMPTY? @@ -332,7 +325,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { validateHibernateSearchIsEnabled(); ensureElastic(); - ValueSetAutocompleteSearch autocomplete = new ValueSetAutocompleteSearch(myFhirContext, myModelConfig, getSearchSession()); + ValueSetAutocompleteSearch autocomplete = new ValueSetAutocompleteSearch(myFhirContext, myStorageSettings, getSearchSession()); dispatchEvent(IHSearchEventListener.HSearchEventType.SEARCH); return autocomplete.search(theOptions); @@ -340,13 +333,13 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { /** * Throws an error if configured with Lucene. - * + *

* Some features only work with Elasticsearch. * Lastn and the autocomplete search use nested aggregations which are Elasticsearch-only */ private void ensureElastic() { try { - getSearchSession().scope( ResourceTable.class ) + getSearchSession().scope(ResourceTable.class) .aggregation() .extension(ElasticsearchExtension.get()); } catch (SearchException e) { @@ -360,7 +353,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { public List lastN(SearchParameterMap theParams, Integer theMaximumResults) { ensureElastic(); dispatchEvent(IHSearchEventListener.HSearchEventType.SEARCH); - List pidList = new LastNOperation(getSearchSession(), myFhirContext, myModelConfig, mySearchParamRegistry) + List pidList = new LastNOperation(getSearchSession(), myFhirContext, myStorageSettings, mySearchParamRegistry) .executeLastN(theParams, theMaximumResults); return convertLongsToResourcePersistentIds(pidList); } @@ -384,7 +377,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { // order resource projections as per thePids ArrayList pidList = new ArrayList<>(thePids); List orderedAsPidsResourceDataList = rawResourceDataList.stream() - .sorted( Ordering.explicit(pidList).onResultOf(ExtendedHSearchResourceProjection::getPid) ).collect( Collectors.toList() ); + .sorted(Ordering.explicit(pidList).onResultOf(ExtendedHSearchResourceProjection::getPid)).collect(Collectors.toList()); return resourceProjectionsToResources(orderedAsPidsResourceDataList); } @@ -400,7 +393,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { private CompositeProjectionOptionsStep buildResourceSelectClause( - SearchProjectionFactory f) { + SearchProjectionFactory f) { return f.composite( ExtendedHSearchResourceProjection::new, f.field("myId", Long.class), @@ -433,12 +426,12 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc { dispatchEvent(IHSearchEventListener.HSearchEventType.SEARCH); var query = getSearchSession().search(ResourceTable.class) - .select(this::buildResourceSelectClause) - .where(f -> buildWhereClause(f, theResourceType, theParams, null)); + .select(this::buildResourceSelectClause) + .where(f -> buildWhereClause(f, theResourceType, theParams, null)); if (theParams.getSort() != null) { query.sort( - f -> myExtendedFulltextSortHelper.getSortClauses(f, theParams.getSort(), theResourceType) ); + f -> myExtendedFulltextSortHelper.getSortClauses(f, theParams.getSort(), theResourceType)); } List extendedLuceneResourceProjections = query.fetchHits(offset, limit); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoObservation.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoObservation.java index fc601168c52..147f87a3ed9 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoObservation.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoObservation.java @@ -99,7 +99,7 @@ public class JpaResourceDaoObservation extends BaseHapi ResourceTable retVal = super.updateEntity(theRequest, theResource, theEntity, theDeletedTimestampOrNull, thePerformIndexing, theUpdateVersion, theTransactionDetails, theForceUpdate, theCreateNewHistoryEntry); - if (getConfig().isLastNEnabled()) { + if (getStorageSettings().isLastNEnabled()) { if (!retVal.isUnchangedInCurrentOperation()) { if (retVal.getDeleted() == null) { // Update indexes here for LastN operation. diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoValueSet.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoValueSet.java index 63f0afc4ff5..fd4663f8f16 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoValueSet.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoValueSet.java @@ -95,7 +95,7 @@ public class JpaResourceDaoValueSet extends BaseHapiFhi if (isAutocompleteExtension) { // this is a funky extension for NIH. Do our own thing and return. - ValueSetAutocompleteOptions options = ValueSetAutocompleteOptions.validateAndParseOptions(myDaoConfig, theContext, theFilter, theCount, theId, theUrl, theValueSet); + ValueSetAutocompleteOptions options = ValueSetAutocompleteOptions.validateAndParseOptions(myStorageSettings, theContext, theFilter, theCount, theId, theUrl, theValueSet); if (myFulltextSearch == null || myFulltextSearch.isDisabled()) { throw new InvalidRequestException(Msg.code(2083) + " Autocomplete is not supported on this server, as the fulltext search service is not configured."); } else { @@ -119,7 +119,7 @@ public class JpaResourceDaoValueSet extends BaseHapiFhi throw new InvalidRequestException(Msg.code(1134) + "$expand must EITHER be invoked at the instance level, or have a url specified, or have a ValueSet specified. Can not combine these options."); } - ValueSetExpansionOptions options = createValueSetExpansionOptions(myDaoConfig, theOffset, theCount, theIncludeHierarchy, theFilter, theDisplayLanguage); + ValueSetExpansionOptions options = createValueSetExpansionOptions(myStorageSettings, theOffset, theCount, theIncludeHierarchy, theFilter, theDisplayLanguage); IValidationSupport.ValueSetExpansionOutcome outcome; if (haveId) { @@ -235,7 +235,7 @@ public class JpaResourceDaoValueSet extends BaseHapiFhi boolean theUpdateVersion, TransactionDetails theTransactionDetails, boolean theForceUpdate, boolean theCreateNewHistoryEntry) { ResourceTable retVal = super.updateEntity(theRequestDetails, theResource, theEntity, theDeletedTimestampOrNull, thePerformIndexing, theUpdateVersion, theTransactionDetails, theForceUpdate, theCreateNewHistoryEntry); - if (getConfig().isPreExpandValueSets() && !retVal.isUnchangedInCurrentOperation()) { + if (getStorageSettings().isPreExpandValueSets() && !retVal.isUnchangedInCurrentOperation()) { if (retVal.getDeleted() == null) { ValueSet valueSet = myVersionCanonicalizer.valueSetToCanonical(theResource); myTerminologySvc.storeTermValueSet(retVal, valueSet); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaStorageResourceParser.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaStorageResourceParser.java index 45e53ec091a..bc823c92a07 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaStorageResourceParser.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaStorageResourceParser.java @@ -24,7 +24,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IDao; import ca.uhn.fhir.jpa.dao.data.IResourceHistoryTableDao; import ca.uhn.fhir.jpa.entity.PartitionEntity; @@ -59,7 +59,6 @@ import org.hl7.fhir.instance.model.api.IBaseCoding; import org.hl7.fhir.instance.model.api.IBaseMetaType; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; -import org.hl7.fhir.r4.model.Bundle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -82,7 +81,7 @@ public class JpaStorageResourceParser implements IJpaStorageResourceParser { @Autowired private FhirContext myContext; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Autowired private IResourceHistoryTableDao myResourceHistoryTableDao; @Autowired @@ -115,7 +114,7 @@ public class JpaStorageResourceParser implements IJpaStorageResourceParser { resourceBytes = history.getResource(); resourceText = history.getResourceTextVc(); resourceEncoding = history.getEncoding(); - switch (myDaoConfig.getTagStorageMode()) { + switch (myStorageSettings.getTagStorageMode()) { case VERSIONED: default: if (history.isHasTags()) { @@ -158,7 +157,7 @@ public class JpaStorageResourceParser implements IJpaStorageResourceParser { resourceBytes = history.getResource(); resourceEncoding = history.getEncoding(); resourceText = history.getResourceTextVc(); - switch (myDaoConfig.getTagStorageMode()) { + switch (myStorageSettings.getTagStorageMode()) { case VERSIONED: case NON_VERSIONED: if (resource.isHasTags()) { @@ -183,7 +182,7 @@ public class JpaStorageResourceParser implements IJpaStorageResourceParser { version = view.getVersion(); provenanceRequestId = view.getProvenanceRequestId(); provenanceSourceUri = view.getProvenanceSourceUri(); - switch (myDaoConfig.getTagStorageMode()) { + switch (myStorageSettings.getTagStorageMode()) { case VERSIONED: case NON_VERSIONED: if (theTagList != null) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/ObservationLastNIndexPersistSvc.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/ObservationLastNIndexPersistSvc.java index 487014d2a5e..7d777ca4043 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/ObservationLastNIndexPersistSvc.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/ObservationLastNIndexPersistSvc.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.dao; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeSearchParam; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken; import ca.uhn.fhir.jpa.model.util.CodeSystemHash; @@ -52,7 +52,7 @@ public class ObservationLastNIndexPersistSvc { private IElasticsearchSvc myElasticsearchSvc; @Autowired - private DaoConfig myConfig; + private JpaStorageSettings myConfig; @Autowired private FhirContext myContext; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java index b10f07b36aa..d3a6420c2e6 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java @@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.dao; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; @@ -92,7 +92,7 @@ public class TransactionProcessor extends BaseTransactionProcessor { @Autowired private PartitionSettings myPartitionSettings; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Autowired private FhirContext myFhirContext; @Autowired @@ -169,7 +169,7 @@ public class TransactionProcessor extends BaseTransactionProcessor { for (JpaPid next : outcome) { foundIds.add(next.getAssociatedResourceId().toUnqualifiedVersionless().getValue()); theTransactionDetails.addResolvedResourceId(next.getAssociatedResourceId(), next); - if (myDaoConfig.getResourceClientIdStrategy() != DaoConfig.ClientIdStrategyEnum.ANY || !next.getAssociatedResourceId().isIdPartValidLong()) { + if (myStorageSettings.getResourceClientIdStrategy() != JpaStorageSettings.ClientIdStrategyEnum.ANY || !next.getAssociatedResourceId().isIdPartValidLong()) { idsToPreFetch.add(next.getId()); } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/JpaResourceExpungeService.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/JpaResourceExpungeService.java index 5ccae981bc5..bb514e896e0 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/JpaResourceExpungeService.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/JpaResourceExpungeService.java @@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.dao.expunge; import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.dao.IJpaStorageResourceParser; @@ -120,7 +120,7 @@ public class JpaResourceExpungeService implements IResourceExpungeService { @Autowired protected IResourceTableDao myResourceTableDao; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Autowired private FhirContext myFhirCtx; @Autowired @@ -214,7 +213,7 @@ public class IdHelperService implements IIdHelperService { } else { // is a forced id // we must resolve! - if (myDaoConfig.isDeleteEnabled()) { + if (myStorageSettings.isDeleteEnabled()) { retVal = resolveResourceIdentity(theRequestPartitionId, theResourceType, id, theExcludeDeleted).getPersistentId(); retVals.put(id, retVal); } else { @@ -267,14 +266,14 @@ public class IdHelperService implements IIdHelperService { /** * Returns true if the given resource ID should be stored in a forced ID. Under default config - * (meaning client ID strategy is {@link ca.uhn.fhir.jpa.api.config.DaoConfig.ClientIdStrategyEnum#ALPHANUMERIC}) + * (meaning client ID strategy is {@link JpaStorageSettings.ClientIdStrategyEnum#ALPHANUMERIC}) * this will return true if the ID has any non-digit characters. *

- * In {@link ca.uhn.fhir.jpa.api.config.DaoConfig.ClientIdStrategyEnum#ANY} mode it will always return true. + * In {@link JpaStorageSettings.ClientIdStrategyEnum#ANY} mode it will always return true. */ @Override public boolean idRequiresForcedId(String theId) { - return myDaoConfig.getResourceClientIdStrategy() == DaoConfig.ClientIdStrategyEnum.ANY || !isValidPid(theId); + return myStorageSettings.getResourceClientIdStrategy() == JpaStorageSettings.ClientIdStrategyEnum.ANY || !isValidPid(theId); } @Nonnull @@ -319,7 +318,7 @@ public class IdHelperService implements IIdHelperService { if (!theIds.isEmpty()) { Set idsToCheck = new HashSet<>(theIds.size()); for (IIdType nextId : theIds) { - if (myDaoConfig.getResourceClientIdStrategy() != DaoConfig.ClientIdStrategyEnum.ANY) { + if (myStorageSettings.getResourceClientIdStrategy() != JpaStorageSettings.ClientIdStrategyEnum.ANY) { if (nextId.isIdPartValidLong()) { if (!theOnlyForcedIds) { JpaPid jpaPid = JpaPid.fromId(nextId.getIdPartAsLong()); @@ -445,7 +444,7 @@ public class IdHelperService implements IIdHelperService { private ListMultimap organizeIdsByResourceType(Collection theIds) { ListMultimap typeToIds = MultimapBuilder.hashKeys().arrayListValues().build(); for (IIdType nextId : theIds) { - if (myDaoConfig.getResourceClientIdStrategy() == DaoConfig.ClientIdStrategyEnum.ANY || !isValidPid(nextId)) { + if (myStorageSettings.getResourceClientIdStrategy() == JpaStorageSettings.ClientIdStrategyEnum.ANY || !isValidPid(nextId)) { if (nextId.hasResourceType()) { typeToIds.put(nextId.getResourceType(), nextId.getIdPart()); } else { @@ -468,7 +467,7 @@ public class IdHelperService implements IIdHelperService { Map>> retVal = new HashMap<>(); RequestPartitionId requestPartitionId = replaceDefault(theRequestPartitionId); - if (myDaoConfig.getResourceClientIdStrategy() != DaoConfig.ClientIdStrategyEnum.ANY) { + if (myStorageSettings.getResourceClientIdStrategy() != JpaStorageSettings.ClientIdStrategyEnum.ANY) { List pids = theId .stream() .filter(t -> isValidPid(t)) @@ -485,7 +484,7 @@ public class IdHelperService implements IIdHelperService { String nextResourceType = nextEntry.getKey(); Collection nextIds = nextEntry.getValue(); - if (!myDaoConfig.isDeleteEnabled()) { + if (!myStorageSettings.isDeleteEnabled()) { for (Iterator forcedIdIterator = nextIds.iterator(); forcedIdIterator.hasNext(); ) { String nextForcedId = forcedIdIterator.next(); String nextKey = nextResourceType + "/" + nextForcedId; @@ -528,7 +527,7 @@ public class IdHelperService implements IIdHelperService { } retVal.get(forcedId).add(lookup); - if (!myDaoConfig.isDeleteEnabled()) { + if (!myStorageSettings.isDeleteEnabled()) { String key = resourceType + "/" + forcedId; myMemoryCacheService.putAfterCommit(MemoryCacheService.CacheEnum.RESOURCE_LOOKUP, key, lookup); } @@ -555,7 +554,7 @@ public class IdHelperService implements IIdHelperService { } private void resolvePids(@Nonnull RequestPartitionId theRequestPartitionId, List thePidsToResolve, Map>> theTargets) { - if (!myDaoConfig.isDeleteEnabled()) { + if (!myStorageSettings.isDeleteEnabled()) { for (Iterator forcedIdIterator = thePidsToResolve.iterator(); forcedIdIterator.hasNext(); ) { Long nextPid = forcedIdIterator.next(); String nextKey = Long.toString(nextPid); @@ -592,7 +591,7 @@ public class IdHelperService implements IIdHelperService { theTargets.put(id, new ArrayList<>()); } theTargets.get(id).add(t); - if (!myDaoConfig.isDeleteEnabled()) { + if (!myStorageSettings.isDeleteEnabled()) { String nextKey = t.getPersistentId().toString(); myMemoryCacheService.putAfterCommit(MemoryCacheService.CacheEnum.RESOURCE_LOOKUP, nextKey, t); } @@ -657,7 +656,7 @@ public class IdHelperService implements IIdHelperService { myMemoryCacheService.putAfterCommit(MemoryCacheService.CacheEnum.PID_TO_FORCED_ID, theJpaPid.getId(), Optional.empty()); } - if (!myDaoConfig.isDeleteEnabled()) { + if (!myStorageSettings.isDeleteEnabled()) { JpaResourceLookup lookup = new JpaResourceLookup(theResourceType, theJpaPid.getId(), theDeletedAt); String nextKey = theJpaPid.toString(); myMemoryCacheService.putAfterCommit(MemoryCacheService.CacheEnum.RESOURCE_LOOKUP, nextKey, lookup); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java index eef691e37e2..ae2f850a1a3 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java @@ -25,7 +25,7 @@ import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.context.RuntimeSearchParam; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; import ca.uhn.fhir.jpa.dao.BaseStorageDao; @@ -77,7 +77,7 @@ public class SearchParamWithInlineReferencesExtractor { @Autowired private MatchResourceUrlService myMatchResourceUrlService; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Autowired private FhirContext myContext; @Autowired @@ -120,8 +120,8 @@ public class SearchParamWithInlineReferencesExtractor { mySearchParamExtractorService.extractFromResource(theRequestPartitionId, theRequest, theParams, theExistingParams, theEntity, theResource, theTransactionDetails, theFailOnInvalidReference); ResourceSearchParams activeSearchParams = mySearchParamRegistry.getActiveSearchParams(theEntity.getResourceType()); - if (myDaoConfig.getIndexMissingFields() == DaoConfig.IndexEnabledEnum.ENABLED) { - theParams.findMissingSearchParams(myPartitionSettings, myDaoConfig.getModelConfig(), theEntity, activeSearchParams); + if (myStorageSettings.getIndexMissingFields() == JpaStorageSettings.IndexEnabledEnum.ENABLED) { + theParams.findMissingSearchParams(myPartitionSettings, myStorageSettings, theEntity, activeSearchParams); } /* @@ -181,8 +181,8 @@ public class SearchParamWithInlineReferencesExtractor { } @VisibleForTesting - public void setDaoConfig(DaoConfig theDaoConfig) { - myDaoConfig = theDaoConfig; + public void setStorageSettings(JpaStorageSettings theStorageSettings) { + myStorageSettings = theStorageSettings; } @VisibleForTesting @@ -203,11 +203,11 @@ public class SearchParamWithInlineReferencesExtractor { * Handle references within the resource that are match URLs, for example references like "Patient?identifier=foo". * These match URLs are resolved and replaced with the ID of the * matching resource. - * + *

* This method is *only* called from UPDATE path */ public void extractInlineReferences(ExtractInlineReferenceParams theParams) { - if (!myDaoConfig.isAllowInlineMatchUrlReferences()) { + if (!myStorageSettings.isAllowInlineMatchUrlReferences()) { return; } IBaseResource resource = theParams.getResource(); @@ -283,7 +283,7 @@ public class SearchParamWithInlineReferencesExtractor { /* * String Uniques */ - if (myDaoConfig.isUniqueIndexesEnabled()) { + if (myStorageSettings.isUniqueIndexesEnabled()) { for (ResourceIndexedComboStringUnique next : myDaoSearchParamSynchronizer.subtract(theExistingParams.myComboStringUniques, theParams.myComboStringUniques)) { ourLog.debug("Removing unique index: {}", next); myEntityManager.remove(next); @@ -291,7 +291,7 @@ public class SearchParamWithInlineReferencesExtractor { } boolean haveNewStringUniqueParams = false; for (ResourceIndexedComboStringUnique next : myDaoSearchParamSynchronizer.subtract(theParams.myComboStringUniques, theExistingParams.myComboStringUniques)) { - if (myDaoConfig.isUniqueIndexesCheckedBeforeSave()) { + if (myStorageSettings.isUniqueIndexesCheckedBeforeSave()) { ResourceIndexedComboStringUnique existing = myResourceIndexedCompositeStringUniqueDao.findByQueryString(next.getIndexString()); if (existing != null) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchClauseBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchClauseBuilder.java index 069288c8d99..8e76ca759b6 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchClauseBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchClauseBuilder.java @@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.dao.search; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeSearchParam; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; import ca.uhn.fhir.jpa.model.util.UcumServiceUtil; import ca.uhn.fhir.jpa.search.HapiHSearchAnalysisConfigurers; @@ -97,15 +97,15 @@ public class ExtendedHSearchClauseBuilder { final FhirContext myFhirContext; public final BooleanPredicateClausesStep myRootClause; - public final ModelConfig myModelConfig; + public final StorageSettings myStorageSettings; final PathContext myRootContext; final List ordinalSearchPrecisions = Arrays.asList(TemporalPrecisionEnum.YEAR, TemporalPrecisionEnum.MONTH, TemporalPrecisionEnum.DAY); - public ExtendedHSearchClauseBuilder(FhirContext myFhirContext, ModelConfig theModelConfig, + public ExtendedHSearchClauseBuilder(FhirContext myFhirContext, StorageSettings theStorageSettings, BooleanPredicateClausesStep theRootClause, SearchPredicateFactory thePredicateFactory) { this.myFhirContext = myFhirContext; - this.myModelConfig = theModelConfig; + this.myStorageSettings = theStorageSettings; this.myRootClause = theRootClause; myRootContext = PathContext.buildRootContext(theRootClause, thePredicateFactory); } @@ -534,7 +534,7 @@ public class ExtendedHSearchClauseBuilder { ParamPrefixEnum activePrefix = qtyParam.getPrefix() == null ? ParamPrefixEnum.EQUAL : qtyParam.getPrefix(); String quantityElement = joinPath(thePathContext.getContextPath(), INDEX_TYPE_QUANTITY); - if (myModelConfig.getNormalizedQuantitySearchLevel() == NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED) { + if (myStorageSettings.getNormalizedQuantitySearchLevel() == NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED) { QuantityParam canonicalQty = UcumServiceUtil.toCanonicalQuantityOrNull(qtyParam); if (canonicalQty != null) { String valueFieldPath = joinPath(quantityElement, QTY_VALUE_NORM); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchIndexExtractor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchIndexExtractor.java index 5dd62f851e9..517b0eaf998 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchIndexExtractor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchIndexExtractor.java @@ -22,8 +22,7 @@ package ca.uhn.fhir.jpa.dao.search; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeSearchParam; -import ca.uhn.fhir.jpa.api.config.DaoConfig; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantity; import ca.uhn.fhir.jpa.model.entity.ResourceLink; @@ -59,32 +58,30 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank; */ public class ExtendedHSearchIndexExtractor { - private final DaoConfig myDaoConfig; + private final JpaStorageSettings myJpaStorageSettings; private final FhirContext myContext; private final ResourceSearchParams myParams; private final ISearchParamExtractor mySearchParamExtractor; - private final ModelConfig myModelConfig; - public ExtendedHSearchIndexExtractor(DaoConfig theDaoConfig, FhirContext theContext, ResourceSearchParams theActiveParams, - ISearchParamExtractor theSearchParamExtractor, ModelConfig theModelConfig) { - myDaoConfig = theDaoConfig; + public ExtendedHSearchIndexExtractor(JpaStorageSettings theJpaStorageSettings, FhirContext theContext, ResourceSearchParams theActiveParams, + ISearchParamExtractor theSearchParamExtractor) { + myJpaStorageSettings = theJpaStorageSettings; myContext = theContext; myParams = theActiveParams; mySearchParamExtractor = theSearchParamExtractor; - myModelConfig = theModelConfig; } @Nonnull public ExtendedHSearchIndexData extract(IBaseResource theResource, ResourceIndexedSearchParams theNewParams) { - ExtendedHSearchIndexData retVal = new ExtendedHSearchIndexData(myContext, myModelConfig, theResource); + ExtendedHSearchIndexData retVal = new ExtendedHSearchIndexData(myContext, myJpaStorageSettings, theResource); - if(myDaoConfig.isStoreResourceInHSearchIndex()) { + if (myJpaStorageSettings.isStoreResourceInHSearchIndex()) { retVal.setRawResourceData(myContext.newJsonParser().encodeResourceToString(theResource)); } retVal.setForcedId(theResource.getIdElement().getIdPart()); - // todo add a flag ot DaoConfig to suppress this + // todo add a flag ot StorageSettings to suppress this extractAutocompleteTokens(theResource, retVal); theNewParams.myStringParams.stream() @@ -127,8 +124,8 @@ public class ExtendedHSearchIndexExtractor { if (theResource.getMeta().getLastUpdated() != null) { int ordinal = ResourceIndexedSearchParamDate.calculateOrdinalValue(theResource.getMeta().getLastUpdated()).intValue(); - retVal.addDateIndexData("_lastUpdated", theResource.getMeta().getLastUpdated(), ordinal, - theResource.getMeta().getLastUpdated(), ordinal); + retVal.addDateIndexData("_lastUpdated", theResource.getMeta().getLastUpdated(), ordinal, + theResource.getMeta().getLastUpdated(), ordinal); } @@ -158,9 +155,9 @@ public class ExtendedHSearchIndexExtractor { // Consider 2 cases for references // Case 1: Resource Type and Resource ID is known // Case 2: Resource is unknown and referred by canonical url reference - if(!Strings.isNullOrEmpty(nextLink.getTargetResourceId())) { + if (!Strings.isNullOrEmpty(nextLink.getTargetResourceId())) { qualifiedTargetResourceId = nextLink.getTargetResourceType() + "/" + nextLink.getTargetResourceId(); - } else if(!Strings.isNullOrEmpty(nextLink.getTargetResourceUrl())) { + } else if (!Strings.isNullOrEmpty(nextLink.getTargetResourceUrl())) { qualifiedTargetResourceId = nextLink.getTargetResourceUrl(); } retVal.addResourceLinkIndexData(nextParamName, qualifiedTargetResourceId); @@ -171,16 +168,6 @@ public class ExtendedHSearchIndexExtractor { return retVal; } - @Nonnull - public static DateSearchIndexData convertDate(ResourceIndexedSearchParamDate nextParam) { - return new DateSearchIndexData(nextParam.getValueLow(), nextParam.getValueLowDateOrdinal(), nextParam.getValueHigh(), nextParam.getValueHighDateOrdinal()); - } - - @Nonnull - public static QuantitySearchIndexData convertQuantity(ResourceIndexedSearchParamQuantity nextParam) { - return new QuantitySearchIndexData(nextParam.getUnits(), nextParam.getSystem(), nextParam.getValue().doubleValue()); - } - @Nonnull private CompositeSearchIndexData buildCompositeIndexData(ResourceIndexedSearchParamComposite theSearchParamComposite) { return new HSearchCompositeSearchIndexDataImpl(theSearchParamComposite); @@ -192,35 +179,35 @@ public class ExtendedHSearchIndexExtractor { private void extractAutocompleteTokens(IBaseResource theResource, ExtendedHSearchIndexData theRetVal) { // we need to re-index token params to match up display with codes. myParams.values().stream() - .filter(p->p.getParamType() == RestSearchParameterTypeEnum.TOKEN) + .filter(p -> p.getParamType() == RestSearchParameterTypeEnum.TOKEN) // TODO it would be nice to reuse TokenExtractor - .forEach(p-> mySearchParamExtractor.extractValues(p.getPath(), theResource) - .forEach(nextValue->indexTokenValue(theRetVal, p, nextValue) - )); + .forEach(p -> mySearchParamExtractor.extractValues(p.getPath(), theResource) + .forEach(nextValue -> indexTokenValue(theRetVal, p, nextValue) + )); } private void indexTokenValue(ExtendedHSearchIndexData theRetVal, RuntimeSearchParam p, IBase nextValue) { String nextType = mySearchParamExtractor.toRootTypeName(nextValue); String spName = p.getName(); switch (nextType) { - case "CodeableConcept": - addToken_CodeableConcept(theRetVal, spName, nextValue); - break; - case "Coding": - addToken_Coding(theRetVal, spName, (IBaseCoding) nextValue); - break; + case "CodeableConcept": + addToken_CodeableConcept(theRetVal, spName, nextValue); + break; + case "Coding": + addToken_Coding(theRetVal, spName, (IBaseCoding) nextValue); + break; // TODO share this with TokenExtractor and introduce a ITokenIndexer interface. - // Ignore unknown types for now. - // This is just for autocomplete, and we are focused on Observation.code, category, combo-code, etc. + // Ignore unknown types for now. + // This is just for autocomplete, and we are focused on Observation.code, category, combo-code, etc. // case "Identifier": // mySearchParamExtractor.addToken_Identifier(myResourceTypeName, params, searchParam, value); // break; // case "ContactPoint": // mySearchParamExtractor.addToken_ContactPoint(myResourceTypeName, params, searchParam, value); // break; - default: - break; - } + default: + break; + } } private void addToken_CodeableConcept(ExtendedHSearchIndexData theRetVal, String theSpName, IBase theValue) { @@ -234,4 +221,14 @@ public class ExtendedHSearchIndexExtractor { theRetVal.addTokenIndexData(theSpName, theNextValue); } + @Nonnull + public static DateSearchIndexData convertDate(ResourceIndexedSearchParamDate nextParam) { + return new DateSearchIndexData(nextParam.getValueLow(), nextParam.getValueLowDateOrdinal(), nextParam.getValueHigh(), nextParam.getValueHighDateOrdinal()); + } + + @Nonnull + public static QuantitySearchIndexData convertQuantity(ResourceIndexedSearchParamQuantity nextParam) { + return new QuantitySearchIndexData(nextParam.getUnits(), nextParam.getSystem(), nextParam.getValue().doubleValue()); + } + } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/LastNOperation.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/LastNOperation.java index 7e6cc7e9b1f..963ebe47e45 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/LastNOperation.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/LastNOperation.java @@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.dao.search; */ import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.util.LastNParameterHelper; @@ -39,15 +39,15 @@ public class LastNOperation { public static final String OBSERVATION_RES_TYPE = "Observation"; private final SearchSession mySession; private final FhirContext myFhirContext; - private final ModelConfig myModelConfig; + private final StorageSettings myStorageSettings; private final ISearchParamRegistry mySearchParamRegistry; private final ExtendedHSearchSearchBuilder myExtendedHSearchSearchBuilder = new ExtendedHSearchSearchBuilder(); - public LastNOperation(SearchSession theSession, FhirContext theFhirContext, ModelConfig theModelConfig, + public LastNOperation(SearchSession theSession, FhirContext theFhirContext, StorageSettings theStorageSettings, ISearchParamRegistry theSearchParamRegistry) { mySession = theSession; myFhirContext = theFhirContext; - myModelConfig = theModelConfig; + myStorageSettings = theStorageSettings; mySearchParamRegistry = theSearchParamRegistry; } @@ -61,7 +61,7 @@ public class LastNOperation { .where(f -> f.bool(b -> { // Must match observation type b.must(f.match().field("myResourceType").matching(OBSERVATION_RES_TYPE)); - ExtendedHSearchClauseBuilder builder = new ExtendedHSearchClauseBuilder(myFhirContext, myModelConfig, b, f); + ExtendedHSearchClauseBuilder builder = new ExtendedHSearchClauseBuilder(myFhirContext, myStorageSettings, b, f); myExtendedHSearchSearchBuilder.addAndConsumeAdvancedQueryClauses(builder, OBSERVATION_RES_TYPE, theParams.clone(), mySearchParamRegistry); })) .aggregation(observationsByCodeKey, f -> f.fromJson(lastNAggregation.toAggregation())) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/package-info.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/package-info.java index 26f258cfa8e..400287ef5fb 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/package-info.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/package-info.java @@ -31,7 +31,7 @@ * @see ca.uhn.fhir.jpa.dao.search.ExtendedHSearchSearchBuilder * @see ca.uhn.fhir.jpa.model.search.SearchParamTextPropertyBinder * - * Activated by {@link ca.uhn.fhir.jpa.api.config.DaoConfig#setAdvancedHSearchIndexing(boolean)}. + * Activated by {@link ca.uhn.fhir.jpa.api.config.JpaStorageSettings#setAdvancedHSearchIndexing(boolean)}. */ package ca.uhn.fhir.jpa.dao.search; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/DeleteConflictService.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/DeleteConflictService.java index c654b2eba1e..611eea13936 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/DeleteConflictService.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/DeleteConflictService.java @@ -25,7 +25,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.DeleteConflict; import ca.uhn.fhir.jpa.api.model.DeleteConflictList; import ca.uhn.fhir.jpa.dao.BaseStorageDao; @@ -61,7 +61,7 @@ public class DeleteConflictService { @Autowired DeleteConflictFinderService myDeleteConflictFinderService; @Autowired - DaoConfig myDaoConfig; + JpaStorageSettings myStorageSettings; @Autowired private FhirContext myFhirContext; @@ -75,7 +75,7 @@ public class DeleteConflictService { } private DeleteConflictOutcome handleConflicts(RequestDetails theRequest, DeleteConflictList theDeleteConflicts, ResourceTable theEntity, boolean theForValidate, List theResultList, TransactionDetails theTransactionDetails) { - if (!myDaoConfig.isEnforceReferentialIntegrityOnDelete() && !theForValidate) { + if (!myStorageSettings.isEnforceReferentialIntegrityOnDelete() && !theForValidate) { ourLog.debug("Deleting {} resource dependencies which can no longer be satisfied", theResultList.size()); myResourceLinkDao.deleteAll(theResultList); return null; @@ -128,7 +128,7 @@ public class DeleteConflictService { int shouldRetryCount = Math.min(outcome.getShouldRetryCount(), MAX_RETRY_ATTEMPTS); if (!(retryCount < shouldRetryCount)) break; newConflicts = new DeleteConflictList(newConflicts); - outcome = findAndHandleConflicts(theRequest, newConflicts, theEntity, theForValidate, myDaoConfig.getMaximumDeleteConflictQueryCount(), theTransactionDetails); + outcome = findAndHandleConflicts(theRequest, newConflicts, theEntity, theForValidate, myStorageSettings.getMaximumDeleteConflictQueryCount(), theTransactionDetails); ++retryCount; } theDeleteConflicts.addAll(newConflicts); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/batch2/DeleteExpungeSqlBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/batch2/DeleteExpungeSqlBuilder.java index aa9e9a00d68..955de2f3ce2 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/batch2/DeleteExpungeSqlBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/batch2/DeleteExpungeSqlBuilder.java @@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.delete.batch2; */ import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.dao.data.IResourceLinkDao; import ca.uhn.fhir.jpa.dao.expunge.ResourceForeignKey; @@ -44,13 +44,13 @@ public class DeleteExpungeSqlBuilder { public static final String THREAD_PREFIX = "delete-expunge"; private final ResourceTableFKProvider myResourceTableFKProvider; - private final DaoConfig myDaoConfig; + private final JpaStorageSettings myStorageSettings; private final IIdHelperService myIdHelper; private final IResourceLinkDao myResourceLinkDao; - public DeleteExpungeSqlBuilder(ResourceTableFKProvider theResourceTableFKProvider, DaoConfig theDaoConfig, IIdHelperService theIdHelper, IResourceLinkDao theResourceLinkDao) { + public DeleteExpungeSqlBuilder(ResourceTableFKProvider theResourceTableFKProvider, JpaStorageSettings theStorageSettings, IIdHelperService theIdHelper, IResourceLinkDao theResourceLinkDao) { myResourceTableFKProvider = theResourceTableFKProvider; - myDaoConfig = theDaoConfig; + myStorageSettings = theStorageSettings; myIdHelper = theIdHelper; myResourceLinkDao = theResourceLinkDao; } @@ -78,7 +78,7 @@ public class DeleteExpungeSqlBuilder { } public void validateOkToDeleteAndExpunge(List thePids) { - if (!myDaoConfig.isEnforceReferentialIntegrityOnDelete()) { + if (!myStorageSettings.isEnforceReferentialIntegrityOnDelete()) { ourLog.info("Referential integrity on delete disabled. Skipping referential integrity check."); return; } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java index 33b2d190fca..bf682ab110f 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java @@ -31,7 +31,7 @@ import ca.uhn.fhir.jpa.migrate.tasks.api.BaseMigrationTasks; import ca.uhn.fhir.jpa.migrate.tasks.api.Builder; import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParam; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantity; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString; @@ -1710,7 +1710,7 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks { spidxString .addTask(new CalculateHashesTask(VersionEnum.V3_5_0, "20180903.28") .setColumnName("HASH_NORM_PREFIX") - .addCalculator("HASH_NORM_PREFIX", t -> ResourceIndexedSearchParamString.calculateHashNormalized(new PartitionSettings(), RequestPartitionId.defaultPartition(), new ModelConfig(), t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_VALUE_NORMALIZED"))) + .addCalculator("HASH_NORM_PREFIX", t -> ResourceIndexedSearchParamString.calculateHashNormalized(new PartitionSettings(), RequestPartitionId.defaultPartition(), new StorageSettings(), t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_VALUE_NORMALIZED"))) .addCalculator("HASH_EXACT", t -> ResourceIndexedSearchParamString.calculateHashExact(new PartitionSettings(), (ca.uhn.fhir.jpa.model.entity.PartitionablePartitionId) null, t.getResourceType(), t.getParamName(), t.getString("SP_VALUE_EXACT"))) ); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaCapabilityStatementProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaCapabilityStatementProvider.java index 0d76ae25369..8d4129d4d1c 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaCapabilityStatementProvider.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaCapabilityStatementProvider.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.provider; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.support.IValidationSupport; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.server.RestfulServer; @@ -51,7 +51,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank; public class JpaCapabilityStatementProvider extends ServerCapabilityStatementProvider { private final FhirContext myContext; - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; private String myImplementationDescription; private boolean myIncludeResourceCounts; private IFhirSystemDao mySystemDao; @@ -59,17 +59,17 @@ public class JpaCapabilityStatementProvider extends ServerCapabilityStatementPro /** * Constructor */ - public JpaCapabilityStatementProvider(@Nonnull RestfulServer theRestfulServer, @Nonnull IFhirSystemDao theSystemDao, @Nonnull DaoConfig theDaoConfig, @Nonnull ISearchParamRegistry theSearchParamRegistry, IValidationSupport theValidationSupport) { + public JpaCapabilityStatementProvider(@Nonnull RestfulServer theRestfulServer, @Nonnull IFhirSystemDao theSystemDao, @Nonnull JpaStorageSettings theStorageSettings, @Nonnull ISearchParamRegistry theSearchParamRegistry, IValidationSupport theValidationSupport) { super(theRestfulServer, theSearchParamRegistry, theValidationSupport); Validate.notNull(theRestfulServer); Validate.notNull(theSystemDao); - Validate.notNull(theDaoConfig); + Validate.notNull(theStorageSettings); Validate.notNull(theSearchParamRegistry); myContext = theRestfulServer.getFhirContext(); mySystemDao = theSystemDao; - myDaoConfig = theDaoConfig; + myStorageSettings = theStorageSettings; setIncludeResourceCounts(true); } @@ -91,9 +91,9 @@ public class JpaCapabilityStatementProvider extends ServerCapabilityStatementPro protected void postProcessRest(FhirTerser theTerser, IBase theRest) { super.postProcessRest(theTerser, theRest); - if (myDaoConfig.getSupportedSubscriptionTypes().contains(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET)) { - if (isNotBlank(myDaoConfig.getWebsocketContextPath())) { - ExtensionUtil.setExtension(myContext, theRest, Constants.CAPABILITYSTATEMENT_WEBSOCKET_URL, "uri", myDaoConfig.getWebsocketContextPath()); + if (myStorageSettings.getSupportedSubscriptionTypes().contains(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET)) { + if (isNotBlank(myStorageSettings.getWebsocketContextPath())) { + ExtensionUtil.setExtension(myContext, theRest, Constants.CAPABILITYSTATEMENT_WEBSOCKET_URL, "uri", myStorageSettings.getWebsocketContextPath()); } } @@ -105,7 +105,7 @@ public class JpaCapabilityStatementProvider extends ServerCapabilityStatementPro theTerser.addElement(theResource, "versioning", ResourceVersionPolicy.VERSIONEDUPDATE.toCode()); - if (myDaoConfig.isAllowMultipleDelete()) { + if (myStorageSettings.isAllowMultipleDelete()) { theTerser.addElement(theResource, "conditionalDelete", ConditionalDeleteStatus.MULTIPLE.toCode()); } else { theTerser.addElement(theResource, "conditionalDelete", ConditionalDeleteStatus.SINGLE.toCode()); @@ -132,8 +132,8 @@ public class JpaCapabilityStatementProvider extends ServerCapabilityStatementPro myIncludeResourceCounts = theIncludeResourceCounts; } - public void setDaoConfig(DaoConfig myDaoConfig) { - this.myDaoConfig = myDaoConfig; + public void setStorageSettings(JpaStorageSettings theStorageSettings) { + this.myStorageSettings = theStorageSettings; } @CoverageIgnore @@ -148,6 +148,6 @@ public class JpaCapabilityStatementProvider extends ServerCapabilityStatementPro @Override protected boolean searchParamEnabled(String theSearchParam) { - return !Constants.PARAM_FILTER.equals(theSearchParam) || myDaoConfig.isFilterParameterEnabled(); + return !Constants.PARAM_FILTER.equals(theSearchParam) || myStorageSettings.isFilterParameterEnabled(); } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaConformanceProviderDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaConformanceProviderDstu2.java index c045458dbc0..3bcb29103a8 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaConformanceProviderDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaConformanceProviderDstu2.java @@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.provider; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.context.RuntimeSearchParam; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.util.ResourceCountCache; import ca.uhn.fhir.model.api.ExtensionDt; @@ -58,7 +58,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank; public class JpaConformanceProviderDstu2 extends ServerConformanceProvider { private volatile Conformance myCachedValue; - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; private String myImplementationDescription; private boolean myIncludeResourceCounts; private RestfulServer myRestfulServer; @@ -78,11 +78,11 @@ public class JpaConformanceProviderDstu2 extends ServerConformanceProvider { /** * Constructor */ - public JpaConformanceProviderDstu2(RestfulServer theRestfulServer, IFhirSystemDao theSystemDao, DaoConfig theDaoConfig) { + public JpaConformanceProviderDstu2(RestfulServer theRestfulServer, IFhirSystemDao theSystemDao, JpaStorageSettings theStorageSettings) { super(theRestfulServer); myRestfulServer = theRestfulServer; mySystemDao = theSystemDao; - myDaoConfig = theDaoConfig; + myStorageSettings = theStorageSettings; super.setCache(false); setIncludeResourceCounts(true); } @@ -105,7 +105,7 @@ public class JpaConformanceProviderDstu2 extends ServerConformanceProvider { for (RestResource nextResource : nextRest.getResource()) { ConditionalDeleteStatusEnum conditionalDelete = nextResource.getConditionalDeleteElement().getValueAsEnum(); - if (conditionalDelete == ConditionalDeleteStatusEnum.MULTIPLE_DELETES_SUPPORTED && myDaoConfig.isAllowMultipleDelete() == false) { + if (conditionalDelete == ConditionalDeleteStatusEnum.MULTIPLE_DELETES_SUPPORTED && myStorageSettings.isAllowMultipleDelete() == false) { nextResource.setConditionalDelete(ConditionalDeleteStatusEnum.SINGLE_DELETES_SUPPORTED); } @@ -131,11 +131,11 @@ public class JpaConformanceProviderDstu2 extends ServerConformanceProvider { } } - if (myDaoConfig.getSupportedSubscriptionTypes().contains(Subscription.SubscriptionChannelType.WEBSOCKET)) { - if (isNotBlank(myDaoConfig.getWebsocketContextPath())) { + if (myStorageSettings.getSupportedSubscriptionTypes().contains(Subscription.SubscriptionChannelType.WEBSOCKET)) { + if (isNotBlank(myStorageSettings.getWebsocketContextPath())) { ExtensionDt websocketExtension = new ExtensionDt(); websocketExtension.setUrl(Constants.CAPABILITYSTATEMENT_WEBSOCKET_URL); - websocketExtension.setValue(new UriDt(myDaoConfig.getWebsocketContextPath())); + websocketExtension.setValue(new UriDt(myStorageSettings.getWebsocketContextPath())); retVal.getRestFirstRep().addUndeclaredExtension(websocketExtension); } } @@ -151,8 +151,8 @@ public class JpaConformanceProviderDstu2 extends ServerConformanceProvider { return myIncludeResourceCounts; } - public void setDaoConfig(DaoConfig myDaoConfig) { - this.myDaoConfig = myDaoConfig; + public void setStorageSettings(JpaStorageSettings theStorageSettings) { + this.myStorageSettings = theStorageSettings; } @CoverageIgnore diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/ValueSetOperationProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/ValueSetOperationProvider.java index 3896b15d031..9aa357b3c9b 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/ValueSetOperationProvider.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/ValueSetOperationProvider.java @@ -26,7 +26,7 @@ import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.context.support.ValidationSupportContext; import ca.uhn.fhir.context.support.ValueSetExpansionOptions; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoValueSet; import ca.uhn.fhir.jpa.config.JpaConfig; @@ -39,6 +39,7 @@ import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.provider.ProviderConstants; import ca.uhn.fhir.util.ParametersUtil; +import com.google.common.annotations.VisibleForTesting; import org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain; import org.hl7.fhir.instance.model.api.IBaseCoding; import org.hl7.fhir.instance.model.api.IBaseParameters; @@ -61,8 +62,6 @@ public class ValueSetOperationProvider extends BaseJpaProvider { @Autowired protected IValidationSupport myValidationSupport; @Autowired - private DaoConfig myDaoConfig; - @Autowired private DaoRegistry myDaoRegistry; @Autowired private ITermReadSvc myTermReadSvc; @@ -70,24 +69,13 @@ public class ValueSetOperationProvider extends BaseJpaProvider { @Qualifier(JpaConfig.JPA_VALIDATION_SUPPORT_CHAIN) private ValidationSupportChain myValidationSupportChain; - public void setValidationSupport(IValidationSupport theValidationSupport) { - myValidationSupport = theValidationSupport; - } - - public void setDaoConfig(DaoConfig theDaoConfig) { - myDaoConfig = theDaoConfig; - } - - public void setDaoRegistry(DaoRegistry theDaoRegistry) { + @VisibleForTesting + public void setDaoRegistryForUnitTest(DaoRegistry theDaoRegistry) { myDaoRegistry = theDaoRegistry; } - public void setTermReadSvc(ITermReadSvc theTermReadSvc) { - myTermReadSvc = theTermReadSvc; - } - - public void setValidationSupportChain(ValidationSupportChain theValidationSupportChain) { - myValidationSupportChain = theValidationSupportChain; + public void setValidationSupport(IValidationSupport theValidationSupport) { + myValidationSupport = theValidationSupport; } @Operation(name = JpaConstants.OPERATION_EXPAND, idempotent = true, typeName = "ValueSet") @@ -200,8 +188,8 @@ public class ValueSetOperationProvider extends BaseJpaProvider { } - public static ValueSetExpansionOptions createValueSetExpansionOptions(DaoConfig theDaoConfig, IPrimitiveType theOffset, IPrimitiveType theCount, IPrimitiveType theIncludeHierarchy, IPrimitiveType theFilter, IPrimitiveType theDisplayLanguage) { - int offset = theDaoConfig.getPreExpandValueSetsDefaultOffset(); + public static ValueSetExpansionOptions createValueSetExpansionOptions(JpaStorageSettings theStorageSettings, IPrimitiveType theOffset, IPrimitiveType theCount, IPrimitiveType theIncludeHierarchy, IPrimitiveType theFilter, IPrimitiveType theDisplayLanguage) { + int offset = theStorageSettings.getPreExpandValueSetsDefaultOffset(); if (theOffset != null && theOffset.hasValue()) { if (theOffset.getValue() >= 0) { offset = theOffset.getValue(); @@ -210,7 +198,7 @@ public class ValueSetOperationProvider extends BaseJpaProvider { } } - int count = theDaoConfig.getPreExpandValueSetsDefaultCount(); + int count = theStorageSettings.getPreExpandValueSetsDefaultCount(); if (theCount != null && theCount.hasValue()) { if (theCount.getValue() >= 0) { count = theCount.getValue(); @@ -218,7 +206,7 @@ public class ValueSetOperationProvider extends BaseJpaProvider { throw new InvalidRequestException(Msg.code(1136) + "count parameter for $expand operation must be >= 0 when specified. count: " + theCount.getValue()); } } - int countMax = theDaoConfig.getPreExpandValueSetsMaxCount(); + int countMax = theStorageSettings.getPreExpandValueSetsMaxCount(); if (count > countMax) { ourLog.warn("count parameter for $expand operation of {} exceeds maximum value of {}; using maximum value.", count, countMax); count = countMax; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaConformanceProviderDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaConformanceProviderDstu3.java index 7e0a1e63d9f..d1518ca1d6a 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaConformanceProviderDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaConformanceProviderDstu3.java @@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.provider.dstu3; */ import ca.uhn.fhir.context.RuntimeSearchParam; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum; @@ -59,7 +59,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank; public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.server.ServerCapabilityStatementProvider { private volatile CapabilityStatement myCachedValue; - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; private ISearchParamRegistry mySearchParamRegistry; private String myImplementationDescription; private boolean myIncludeResourceCounts; @@ -81,11 +81,11 @@ public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.se /** * Constructor */ - public JpaConformanceProviderDstu3(RestfulServer theRestfulServer, IFhirSystemDao theSystemDao, DaoConfig theDaoConfig, ISearchParamRegistry theSearchParamRegistry) { + public JpaConformanceProviderDstu3(RestfulServer theRestfulServer, IFhirSystemDao theSystemDao, JpaStorageSettings theStorageSettings, ISearchParamRegistry theSearchParamRegistry) { super(theRestfulServer); myRestfulServer = theRestfulServer; mySystemDao = theSystemDao; - myDaoConfig = theDaoConfig; + myStorageSettings = theStorageSettings; myServerConfiguration = theRestfulServer.createConfiguration(); super.setCache(false); setSearchParamRegistry(theSearchParamRegistry); @@ -114,7 +114,7 @@ public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.se nextResource.setVersioning(ResourceVersionPolicy.VERSIONEDUPDATE); ConditionalDeleteStatus conditionalDelete = nextResource.getConditionalDelete(); - if (conditionalDelete == ConditionalDeleteStatus.MULTIPLE && myDaoConfig.isAllowMultipleDelete() == false) { + if (conditionalDelete == ConditionalDeleteStatus.MULTIPLE && myStorageSettings.isAllowMultipleDelete() == false) { nextResource.setConditionalDelete(ConditionalDeleteStatus.SINGLE); } @@ -172,11 +172,11 @@ public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.se massage(retVal); - if (myDaoConfig.getSupportedSubscriptionTypes().contains(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET)) { - if (isNotBlank(myDaoConfig.getWebsocketContextPath())) { + if (myStorageSettings.getSupportedSubscriptionTypes().contains(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET)) { + if (isNotBlank(myStorageSettings.getWebsocketContextPath())) { Extension websocketExtension = new Extension(); websocketExtension.setUrl(Constants.CAPABILITYSTATEMENT_WEBSOCKET_URL); - websocketExtension.setValue(new UriType(myDaoConfig.getWebsocketContextPath())); + websocketExtension.setValue(new UriType(myStorageSettings.getWebsocketContextPath())); retVal.getRestFirstRep().addExtension(websocketExtension); } } @@ -218,7 +218,7 @@ public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.se protected boolean searchParamEnabled(String theSearchParam) { // Borrowed from hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/provider/ServerCapabilityStatementProvider.java - return !Constants.PARAM_FILTER.equals(theSearchParam) || myDaoConfig.isFilterParameterEnabled(); + return !Constants.PARAM_FILTER.equals(theSearchParam) || myStorageSettings.isFilterParameterEnabled(); } @@ -275,8 +275,8 @@ public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.se // nothing } - public void setDaoConfig(DaoConfig myDaoConfig) { - this.myDaoConfig = myDaoConfig; + public void setStorageSettings(JpaStorageSettings theStorageSettings) { + this.myStorageSettings = theStorageSettings; } @CoverageIgnore diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java index 52ac51e2cad..dbc45228ccb 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java @@ -25,7 +25,7 @@ import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc; @@ -100,7 +100,7 @@ public class PersistedJpaBundleProvider implements IBundleProvider { @Autowired private RequestPartitionHelperSvc myRequestPartitionHelperSvc; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Autowired private MemoryCacheService myMemoryCacheService; @Autowired @@ -271,7 +271,7 @@ public class PersistedJpaBundleProvider implements IBundleProvider { boolean haveOffset = mySearchEntity.getLastUpdatedLow() != null || mySearchEntity.getLastUpdatedHigh() != null; - switch (myDaoConfig.getHistoryCountMode()) { + switch (myStorageSettings.getHistoryCountMode()) { case COUNT_ACCURATE: { int count = supplier.apply(key); mySearchEntity.setTotalCount(count); @@ -391,7 +391,7 @@ public class PersistedJpaBundleProvider implements IBundleProvider { List includedPidList = new ArrayList<>(); if (mySearchEntity.getSearchType() == SearchTypeEnum.SEARCH) { - Integer maxIncludes = myDaoConfig.getMaximumIncludesToLoadPerPage(); + Integer maxIncludes = myStorageSettings.getMaximumIncludesToLoadPerPage(); // Load _revincludes Set includedPids = theSearchBuilder.loadIncludes(myContext, myEntityManager, thePids, mySearchEntity.toRevIncludesList(), true, mySearchEntity.getLastUpdated(), myUuid, myRequest, maxIncludes); @@ -432,8 +432,8 @@ public class PersistedJpaBundleProvider implements IBundleProvider { } @VisibleForTesting - public void setDaoConfigForUnitTest(DaoConfig theDaoConfig) { - myDaoConfig = theDaoConfig; + public void setStorageSettingsForUnitTest(JpaStorageSettings theStorageSettings) { + myStorageSettings = theStorageSettings; } @VisibleForTesting diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java index a828159b31e..16916368829 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java @@ -26,7 +26,7 @@ import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IDao; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; @@ -99,7 +99,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SearchCoordinatorSvcImpl.class); private final FhirContext myContext; - private final DaoConfig myDaoConfig; + private final JpaStorageSettings myStorageSettings; private final IInterceptorBroadcaster myInterceptorBroadcaster; private final HapiTransactionService myTxService; private final ISearchCacheSvc mySearchCacheSvc; @@ -128,7 +128,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { */ public SearchCoordinatorSvcImpl( FhirContext theContext, - DaoConfig theDaoConfig, + JpaStorageSettings theStorageSettings, IInterceptorBroadcaster theInterceptorBroadcaster, HapiTransactionService theTxService, ISearchCacheSvc theSearchCacheSvc, @@ -145,7 +145,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { ) { super(); myContext = theContext; - myDaoConfig = theDaoConfig; + myStorageSettings = theStorageSettings; myInterceptorBroadcaster = theInterceptorBroadcaster; myTxService = theTxService; mySearchCacheSvc = theSearchCacheSvc; @@ -369,7 +369,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { if (cacheStatus != SearchCacheStatusEnum.NOT_TRIED) { if (theParams.getEverythingMode() == null) { - if (myDaoConfig.getReuseCachedSearchResultsForMillis() != null) { + if (myStorageSettings.getReuseCachedSearchResultsForMillis() != null) { PersistedJpaBundleProvider foundSearchProvider = findCachedQuery(theParams, theResourceType, theRequestDetails, queryString, theRequestPartitionId); if (foundSearchProvider != null) { foundSearchProvider.setCacheStatus(SearchCacheStatusEnum.HIT); @@ -525,7 +525,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { @Nullable private Search findSearchToUseOrNull(String theQueryString, String theResourceType, RequestPartitionId theRequestPartitionId) { // createdCutoff is in recent past - final Instant createdCutoff = Instant.now().minus(myDaoConfig.getReuseCachedSearchResultsForMillis(), ChronoUnit.MILLIS); + final Instant createdCutoff = Instant.now().minus(myStorageSettings.getReuseCachedSearchResultsForMillis(), ChronoUnit.MILLIS); Optional candidate = mySearchCacheSvc.findCandidatesForReuse(theResourceType, theQueryString, createdCutoff, theRequestPartitionId); return candidate.orElse(null); @@ -537,8 +537,8 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc { if (theCacheControlDirective != null && theCacheControlDirective.isNoStore()) { if (theCacheControlDirective.getMaxResults() != null) { loadSynchronousUpTo = theCacheControlDirective.getMaxResults(); - if (loadSynchronousUpTo > myDaoConfig.getCacheControlNoStoreMaxResultsUpperLimit()) { - throw new InvalidRequestException(Msg.code(1165) + Constants.HEADER_CACHE_CONTROL + " header " + Constants.CACHE_CONTROL_MAX_RESULTS + " value must not exceed " + myDaoConfig.getCacheControlNoStoreMaxResultsUpperLimit()); + if (loadSynchronousUpTo > myStorageSettings.getCacheControlNoStoreMaxResultsUpperLimit()) { + throw new InvalidRequestException(Msg.code(1165) + Constants.HEADER_CACHE_CONTROL + " header " + Constants.CACHE_CONTROL_MAX_RESULTS + " value must not exceed " + myStorageSettings.getCacheControlNoStoreMaxResultsUpperLimit()); } } else { loadSynchronousUpTo = 100; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchStrategyFactory.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchStrategyFactory.java index eeb42e94b13..6fe52be9056 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchStrategyFactory.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchStrategyFactory.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.search; * #L% */ -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.rest.api.server.IBundleProvider; @@ -37,7 +37,7 @@ import java.util.function.Supplier; * Figure out how we're going to run the query up front, and build a branchless strategy object. */ public class SearchStrategyFactory { - private final DaoConfig myDaoConfig; + private final JpaStorageSettings myStorageSettings; @Nullable private final IFulltextSearchSvc myFulltextSearchSvc; @@ -52,16 +52,16 @@ public class SearchStrategyFactory { // public class JPAHybridHSearchSavedSearch implements ISearchStrategy {}; // public class SavedSearchAdaptorStrategy implements ISearchStrategy {}; - public SearchStrategyFactory(DaoConfig theDaoConfig, @Nullable IFulltextSearchSvc theFulltextSearchSvc) { - myDaoConfig = theDaoConfig; + public SearchStrategyFactory(JpaStorageSettings theStorageSettings, @Nullable IFulltextSearchSvc theFulltextSearchSvc) { + myStorageSettings = theStorageSettings; myFulltextSearchSvc = theFulltextSearchSvc; } public boolean isSupportsHSearchDirect(String theResourceType, SearchParameterMap theParams, RequestDetails theRequestDetails) { return myFulltextSearchSvc != null && - myDaoConfig.isStoreResourceInHSearchIndex() && - myDaoConfig.isAdvancedHSearchIndexing() && + myStorageSettings.isStoreResourceInHSearchIndex() && + myStorageSettings.isAdvancedHSearchIndexing() && myFulltextSearchSvc.supportsAllOf(theParams) && theParams.getSummaryMode() == null && theParams.getSearchTotalMode() == null; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/StaleSearchDeletingSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/StaleSearchDeletingSvcImpl.java index 6daed999f1b..34aa8043b8b 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/StaleSearchDeletingSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/StaleSearchDeletingSvcImpl.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.search; * #L% */ -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.sched.HapiJob; import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs; import ca.uhn.fhir.jpa.model.sched.ISchedulerService; @@ -44,7 +44,7 @@ import static ca.uhn.fhir.jpa.search.cache.DatabaseSearchCacheSvcImpl.SEARCH_CLE public class StaleSearchDeletingSvcImpl implements IStaleSearchDeletingSvc, IHasScheduledJobs { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(StaleSearchDeletingSvcImpl.class); @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Autowired private ISearchCacheSvc mySearchCacheSvc; @@ -75,7 +75,7 @@ public class StaleSearchDeletingSvcImpl implements IStaleSearchDeletingSvc, IHas @Transactional(propagation = Propagation.NEVER) @Override public synchronized void schedulePollForStaleSearches() { - if (!myDaoConfig.isSchedulingDisabled() && myDaoConfig.isEnableTaskStaleSearchCleanup()) { + if (!myStorageSettings.isSchedulingDisabled() && myStorageSettings.isEnableTaskStaleSearchCleanup()) { pollForStaleSearchesAndDeleteThem(); } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SynchronousSearchSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SynchronousSearchSvcImpl.java index eb153db5baa..e0c77d25840 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SynchronousSearchSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SynchronousSearchSvcImpl.java @@ -26,7 +26,7 @@ import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.IResultIterator; @@ -68,7 +68,7 @@ public class SynchronousSearchSvcImpl implements ISynchronousSearchSvc { private FhirContext myContext; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Autowired private SearchBuilderFactory mySearchBuilderFactory; @@ -93,7 +93,7 @@ public class SynchronousSearchSvcImpl implements ISynchronousSearchSvc { searchRuntimeDetails.setLoadSynchronous(true); boolean theParamWantOnlyCount = isWantOnlyCount(theParams); - boolean theParamOrConfigWantCount = nonNull(theParams.getSearchTotalMode()) ? isWantCount(theParams) : isWantCount(myDaoConfig.getDefaultTotalMode()); + boolean theParamOrConfigWantCount = nonNull(theParams.getSearchTotalMode()) ? isWantCount(theParams) : isWantCount(myStorageSettings.getDefaultTotalMode()); boolean wantCount = theParamWantOnlyCount || theParamOrConfigWantCount; // Execute the query and make sure we return distinct results @@ -166,7 +166,7 @@ public class SynchronousSearchSvcImpl implements ISynchronousSearchSvc { */ // _includes - Integer maxIncludes = myDaoConfig.getMaximumIncludesToLoadPerPage(); + Integer maxIncludes = myStorageSettings.getMaximumIncludesToLoadPerPage(); final Set includedPids = theSb.loadIncludes(myContext, myEntityManager, pids, theParams.getRevIncludes(), true, theParams.getLastUpdated(), "(synchronous)", theRequestDetails, maxIncludes); if (maxIncludes != null) { maxIncludes -= includedPids.size(); @@ -245,8 +245,8 @@ public class SynchronousSearchSvcImpl implements ISynchronousSearchSvc { return theLoadSynchronousUpTo; } else if (theParams.getCount() != null) { return theParams.getCount(); - } else if (myDaoConfig.getFetchSizeDefaultMaximum() != null) { - return myDaoConfig.getFetchSizeDefaultMaximum(); + } else if (myStorageSettings.getFetchSizeDefaultMaximum() != null) { + return myStorageSettings.getFetchSizeDefaultMaximum(); } return null; } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/TokenAutocompleteSearch.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/TokenAutocompleteSearch.java index 7973ffdac18..7b9a8206055 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/TokenAutocompleteSearch.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/TokenAutocompleteSearch.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.search.autocomplete; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.dao.search.ExtendedHSearchClauseBuilder; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import com.google.gson.JsonObject; import org.hibernate.search.backend.elasticsearch.ElasticsearchExtension; @@ -48,12 +48,12 @@ class TokenAutocompleteSearch { private static final AggregationKey AGGREGATION_KEY = AggregationKey.of("autocomplete"); private final FhirContext myFhirContext; - private final ModelConfig myModelConfig; + private final StorageSettings myStorageSettings; private final SearchSession mySession; - public TokenAutocompleteSearch(FhirContext theFhirContext, ModelConfig theModelConfig, SearchSession theSession) { + public TokenAutocompleteSearch(FhirContext theFhirContext, StorageSettings theStorageSettings, SearchSession theSession) { myFhirContext = theFhirContext; - myModelConfig = theModelConfig; + myStorageSettings = theStorageSettings; mySession = theSession; } @@ -74,7 +74,7 @@ class TokenAutocompleteSearch { // compose the query json SearchQueryOptionsStep query = mySession.search(ResourceTable.class) .where(predFactory -> predFactory.bool(boolBuilder -> { - ExtendedHSearchClauseBuilder clauseBuilder = new ExtendedHSearchClauseBuilder(myFhirContext, myModelConfig, boolBuilder, predFactory); + ExtendedHSearchClauseBuilder clauseBuilder = new ExtendedHSearchClauseBuilder(myFhirContext, myStorageSettings, boolBuilder, predFactory); // we apply resource-level predicates here, at the top level if (isNotBlank(theResourceName)) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteOptions.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteOptions.java index fb83caee64c..c2cb1b5bbb1 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteOptions.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteOptions.java @@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.search.autocomplete; */ import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.rest.param.TokenParamModifier; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import org.hl7.fhir.instance.model.api.IBaseResource; @@ -68,7 +68,7 @@ public class ValueSetAutocompleteOptions { } public static ValueSetAutocompleteOptions validateAndParseOptions( - DaoConfig theDaoConfig, + JpaStorageSettings theStorageSettings, IPrimitiveType theContext, IPrimitiveType theFilter, IPrimitiveType theCount, @@ -82,7 +82,7 @@ public class ValueSetAutocompleteOptions { if (haveId || haveIdentifier || haveValueSet) { throw new InvalidRequestException(Msg.code(2020) + "$expand with contexDirection='existing' is only supported at the type leve. It is not supported at instance level, with a url specified, or with a ValueSet ."); } - if (!theDaoConfig.isAdvancedHSearchIndexing()) { + if (!theStorageSettings.isAdvancedHSearchIndexing()) { throw new InvalidRequestException(Msg.code(2022) + "$expand with contexDirection='existing' requires Extended Lucene Indexing."); } if (theContext == null || theContext.isEmpty()) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteSearch.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteSearch.java index 55ce0353d39..4abf32164e6 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteSearch.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteSearch.java @@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.search.autocomplete; */ import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.rest.param.TokenParam; import org.hibernate.search.mapper.orm.session.SearchSession; import org.hl7.fhir.instance.model.api.IBaseResource; @@ -35,14 +35,14 @@ import java.util.List; */ public class ValueSetAutocompleteSearch { private final FhirContext myFhirContext; - private final ModelConfig myModelConfig; + private final StorageSettings myStorageSettings; private final TokenAutocompleteSearch myAutocompleteSearch; static final int DEFAULT_SIZE = 30; - public ValueSetAutocompleteSearch(FhirContext theFhirContext, ModelConfig theModelConfig, SearchSession theSession) { + public ValueSetAutocompleteSearch(FhirContext theFhirContext, StorageSettings theStorageSettings, SearchSession theSession) { myFhirContext = theFhirContext; - myModelConfig = theModelConfig; - myAutocompleteSearch = new TokenAutocompleteSearch(myFhirContext, myModelConfig, theSession); + myStorageSettings = theStorageSettings; + myAutocompleteSearch = new TokenAutocompleteSearch(myFhirContext, myStorageSettings, theSession); } public IBaseResource search(ValueSetAutocompleteOptions theOptions) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java index dba5fd1e2a8..84bd37f653a 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java @@ -25,11 +25,10 @@ import ca.uhn.fhir.context.RuntimeSearchParam; import ca.uhn.fhir.exception.TokenParamFormatInvalidRequestException; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.BaseStorageDao; import ca.uhn.fhir.jpa.dao.predicate.SearchFilterParser; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; import ca.uhn.fhir.jpa.model.entity.TagTypeEnum; import ca.uhn.fhir.jpa.model.util.UcumServiceUtil; @@ -137,13 +136,12 @@ public class QueryStack { private static final Logger ourLog = LoggerFactory.getLogger(QueryStack.class); - private final ModelConfig myModelConfig; private final FhirContext myFhirContext; private final SearchQueryBuilder mySqlBuilder; private final SearchParameterMap mySearchParameters; private final ISearchParamRegistry mySearchParamRegistry; private final PartitionSettings myPartitionSettings; - private final DaoConfig myDaoConfig; + private final JpaStorageSettings myStorageSettings; private final EnumSet myReusePredicateBuilderTypes; private Map myJoinMap; // used for _offset queries with sort, should be removed once the fix is applied to the async path too. @@ -152,24 +150,22 @@ public class QueryStack { /** * Constructor */ - public QueryStack(SearchParameterMap theSearchParameters, DaoConfig theDaoConfig, ModelConfig theModelConfig, FhirContext theFhirContext, SearchQueryBuilder theSqlBuilder, ISearchParamRegistry theSearchParamRegistry, PartitionSettings thePartitionSettings) { - this(theSearchParameters, theDaoConfig, theModelConfig, theFhirContext, theSqlBuilder, theSearchParamRegistry, thePartitionSettings, EnumSet.of(PredicateBuilderTypeEnum.DATE)); + public QueryStack(SearchParameterMap theSearchParameters, JpaStorageSettings theStorageSettings, FhirContext theFhirContext, SearchQueryBuilder theSqlBuilder, ISearchParamRegistry theSearchParamRegistry, PartitionSettings thePartitionSettings) { + this(theSearchParameters, theStorageSettings, theFhirContext, theSqlBuilder, theSearchParamRegistry, thePartitionSettings, EnumSet.of(PredicateBuilderTypeEnum.DATE)); } /** * Constructor */ - private QueryStack(SearchParameterMap theSearchParameters, DaoConfig theDaoConfig, ModelConfig theModelConfig, FhirContext theFhirContext, SearchQueryBuilder theSqlBuilder, ISearchParamRegistry theSearchParamRegistry, PartitionSettings thePartitionSettings, EnumSet theReusePredicateBuilderTypes) { + private QueryStack(SearchParameterMap theSearchParameters, JpaStorageSettings theStorageSettings, FhirContext theFhirContext, SearchQueryBuilder theSqlBuilder, ISearchParamRegistry theSearchParamRegistry, PartitionSettings thePartitionSettings, EnumSet theReusePredicateBuilderTypes) { myPartitionSettings = thePartitionSettings; assert theSearchParameters != null; - assert theDaoConfig != null; - assert theModelConfig != null; + assert theStorageSettings != null; assert theFhirContext != null; assert theSqlBuilder != null; mySearchParameters = theSearchParameters; - myDaoConfig = theDaoConfig; - myModelConfig = theModelConfig; + myStorageSettings = theStorageSettings; myFhirContext = theFhirContext; mySqlBuilder = theSqlBuilder; mySearchParamRegistry = theSearchParamRegistry; @@ -398,7 +394,7 @@ public class QueryStack { // TODO - Change this when we have HFJ_SPIDX_MISSING table /** * How we search depends on if the - * {@link DaoConfig#getIndexMissingFields()} property + * {@link JpaStorageSettings#getIndexMissingFields()} property * is Enabled or Disabled. * * If it is, we will use the SP_MISSING values set into the various @@ -422,7 +418,7 @@ public class QueryStack { * that do not have a missing field (:missing=false) for much the same reason. */ SearchQueryBuilder sqlBuilder = theParams.getSqlBuilder(); - if (myDaoConfig.getIndexMissingFields() == DaoConfig.IndexEnabledEnum.DISABLED) { + if (myStorageSettings.getIndexMissingFields() == JpaStorageSettings.IndexEnabledEnum.DISABLED) { // new search return createMissingPredicateForUnindexedMissingFields(theParams, sqlBuilder); } else { @@ -884,7 +880,7 @@ public class QueryStack { .collect(Collectors.toList()); BaseQuantityPredicateBuilder join = null; - boolean normalizedSearchEnabled = myModelConfig.getNormalizedQuantitySearchLevel().equals(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + boolean normalizedSearchEnabled = myStorageSettings.getNormalizedQuantitySearchLevel().equals(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); if (normalizedSearchEnabled) { List normalizedQuantityParams = quantityParams .stream() @@ -1258,7 +1254,7 @@ public class QueryStack { .collect(Collectors.toSet())); // discrete -> contained -> discrete updateMapOfReferenceLinks(referenceLinks, Lists.newArrayList(mergePaths(nextChain.get(0).getPath(), nextChain.get(1).getPath())), leafNodes); - if (myModelConfig.isIndexOnContainedResourcesRecursively()) { + if (myStorageSettings.isIndexOnContainedResourcesRecursively()) { // discrete -> contained -> contained updateMapOfReferenceLinks(referenceLinks, Lists.newArrayList(), leafNodes @@ -1285,7 +1281,7 @@ public class QueryStack { .stream() .map(t -> t.withPathPrefix(nextChain.get(2).getResourceType(), nextChain.get(2).getSearchParameterName())) .collect(Collectors.toSet())); - if (myModelConfig.isIndexOnContainedResourcesRecursively()) { + if (myStorageSettings.isIndexOnContainedResourcesRecursively()) { // discrete -> contained -> contained -> discrete updateMapOfReferenceLinks(referenceLinks, Lists.newArrayList(mergePaths(nextChain.get(0).getPath(), nextChain.get(1).getPath(), nextChain.get(2).getPath())), leafNodes); // discrete -> discrete -> contained -> contained @@ -1390,7 +1386,7 @@ public class QueryStack { } private Condition createPredicateSource(@Nullable DbColumn theSourceJoinColumn, List theList) { - if (myDaoConfig.getStoreMetaSourceInformation() == DaoConfig.StoreMetaSourceInformationEnum.NONE) { + if (myStorageSettings.getStoreMetaSourceInformation() == JpaStorageSettings.StoreMetaSourceInformationEnum.NONE) { String msg = myFhirContext.getLocalizer().getMessage(QueryStack.class, "sourceParamDisabled"); throw new InvalidRequestException(Msg.code(1216) + msg); } @@ -1568,10 +1564,10 @@ public class QueryStack { if (id.isText()) { // Check whether the :text modifier is actually enabled here - boolean tokenTextIndexingEnabled = BaseSearchParamExtractor.tokenTextIndexingEnabledForSearchParam(myModelConfig, theSearchParam); + boolean tokenTextIndexingEnabled = BaseSearchParamExtractor.tokenTextIndexingEnabledForSearchParam(myStorageSettings, theSearchParam); if (!tokenTextIndexingEnabled) { String msg; - if (myModelConfig.isSuppressStringIndexingInTokens()) { + if (myStorageSettings.isSuppressStringIndexingInTokens()) { msg = myFhirContext.getLocalizer().getMessage(QueryStack.class, "textModifierDisabledForServer"); } else { msg = myFhirContext.getLocalizer().getMessage(QueryStack.class, "textModifierDisabledForSearchParam"); @@ -1680,7 +1676,7 @@ public class QueryStack { } public QueryStack newChildQueryFactoryWithFullBuilderReuse() { - return new QueryStack(mySearchParameters, myDaoConfig, myModelConfig, myFhirContext, mySqlBuilder, mySearchParamRegistry, myPartitionSettings, EnumSet.allOf(PredicateBuilderTypeEnum.class)); + return new QueryStack(mySearchParameters, myStorageSettings, myFhirContext, mySqlBuilder, mySearchParamRegistry, myPartitionSettings, EnumSet.allOf(PredicateBuilderTypeEnum.class)); } @Nullable @@ -1700,7 +1696,7 @@ public class QueryStack { case Constants.PARAM_TAG: case Constants.PARAM_PROFILE: case Constants.PARAM_SECURITY: - if (myDaoConfig.getTagStorageMode() == DaoConfig.TagStorageModeEnum.INLINE) { + if (myStorageSettings.getTagStorageMode() == JpaStorageSettings.TagStorageModeEnum.INLINE) { return createPredicateSearchParameter(theSourceJoinColumn, theResourceName, theParamName, theAndOrParams, theRequest, theRequestPartitionId); } else { return createPredicateTag(theSourceJoinColumn, theAndOrParams, theParamName, theRequestPartitionId); @@ -1812,7 +1808,7 @@ public class QueryStack { } if (filter != null) { - if (!myDaoConfig.isFilterParameterEnabled()) { + if (!myStorageSettings.isFilterParameterEnabled()) { throw new InvalidRequestException(Msg.code(1222) + Constants.PARAM_FILTER + " parameter is disabled on this server"); } @@ -1834,7 +1830,7 @@ public class QueryStack { } private boolean isEligibleForContainedResourceSearch(List nextAnd) { - return myModelConfig.isIndexOnContainedResources() && + return myStorageSettings.isIndexOnContainedResources() && nextAnd.stream() .filter(t -> t instanceof ReferenceParam) .map(t -> ((ReferenceParam) t).getChain()) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/SearchBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/SearchBuilder.java index 6dc277c5be0..7184310d9ab 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/SearchBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/SearchBuilder.java @@ -30,7 +30,7 @@ import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IDao; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; @@ -50,7 +50,6 @@ import ca.uhn.fhir.jpa.interceptor.JpaPreResourceAccessDetails; import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.model.entity.IBaseResourceEntity; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.ResourceTag; import ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails; import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage; @@ -70,7 +69,6 @@ import ca.uhn.fhir.jpa.util.QueryChunker; import ca.uhn.fhir.jpa.util.QueryParameterUtils; import ca.uhn.fhir.jpa.util.SqlQueryList; import ca.uhn.fhir.model.api.IQueryParameterType; -import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum; @@ -162,14 +160,13 @@ public class SearchBuilder implements ISearchBuilder { private final HapiFhirLocalContainerEntityManagerFactoryBean myEntityManagerFactory; private final SqlObjectFactory mySqlBuilderFactory; private final HibernatePropertiesProvider myDialectProvider; - private final ModelConfig myModelConfig; private final ISearchParamRegistry mySearchParamRegistry; private final PartitionSettings myPartitionSettings; private final DaoRegistry myDaoRegistry; private final IResourceSearchViewDao myResourceSearchViewDao; private final FhirContext myContext; private final IIdHelperService myIdHelperService; - private final DaoConfig myDaoConfig; + private final JpaStorageSettings myStorageSettings; private final IDao myCallingDao; @PersistenceContext(type = PersistenceContextType.TRANSACTION) protected EntityManager myEntityManager; @@ -195,11 +192,10 @@ public class SearchBuilder implements ISearchBuilder { public SearchBuilder( IDao theDao, String theResourceName, - DaoConfig theDaoConfig, + JpaStorageSettings theStorageSettings, HapiFhirLocalContainerEntityManagerFactoryBean theEntityManagerFactory, SqlObjectFactory theSqlBuilderFactory, HibernatePropertiesProvider theDialectProvider, - ModelConfig theModelConfig, ISearchParamRegistry theSearchParamRegistry, PartitionSettings thePartitionSettings, IInterceptorBroadcaster theInterceptorBroadcaster, @@ -213,12 +209,11 @@ public class SearchBuilder implements ISearchBuilder { myCallingDao = theDao; myResourceName = theResourceName; myResourceType = theResourceType; - myDaoConfig = theDaoConfig; + myStorageSettings = theStorageSettings; myEntityManagerFactory = theEntityManagerFactory; mySqlBuilderFactory = theSqlBuilderFactory; myDialectProvider = theDialectProvider; - myModelConfig = theModelConfig; mySearchParamRegistry = theSearchParamRegistry; myPartitionSettings = thePartitionSettings; myInterceptorBroadcaster = theInterceptorBroadcaster; @@ -281,7 +276,7 @@ public class SearchBuilder implements ISearchBuilder { * parameters all have no modifiers. */ private boolean isCompositeUniqueSpCandidate() { - return myDaoConfig.isUniqueIndexesEnabled() && + return myStorageSettings.isUniqueIndexesEnabled() && myParams.getEverythingMode() == null && myParams.isAllParametersHaveNoModifier(); } @@ -442,7 +437,7 @@ public class SearchBuilder implements ISearchBuilder { private List executeLastNAgainstIndex(Integer theMaximumResults) { // Can we use our hibernate search generated index on resource to support lastN?: - if (myDaoConfig.isAdvancedHSearchIndexing()) { + if (myStorageSettings.isAdvancedHSearchIndexing()) { if (myFulltextSearchSvc == null) { throw new InvalidRequestException(Msg.code(2027) + "LastN operation is not enabled on this service, can not process this request"); } @@ -529,8 +524,8 @@ public class SearchBuilder implements ISearchBuilder { private Optional createChunkedQuery(SearchParameterMap theParams, SortSpec sort, Integer theOffset, Integer theMaximumResults, boolean theCountOnlyFlag, RequestDetails theRequest, List thePidList) { String sqlBuilderResourceName = myParams.getEverythingMode() == null ? myResourceName : null; - SearchQueryBuilder sqlBuilder = new SearchQueryBuilder(myContext, myDaoConfig.getModelConfig(), myPartitionSettings, myRequestPartitionId, sqlBuilderResourceName, mySqlBuilderFactory, myDialectProvider, theCountOnlyFlag); - QueryStack queryStack3 = new QueryStack(theParams, myDaoConfig, myDaoConfig.getModelConfig(), myContext, sqlBuilder, mySearchParamRegistry, myPartitionSettings); + SearchQueryBuilder sqlBuilder = new SearchQueryBuilder(myContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, sqlBuilderResourceName, mySqlBuilderFactory, myDialectProvider, theCountOnlyFlag); + QueryStack queryStack3 = new QueryStack(theParams, myStorageSettings, myContext, sqlBuilder, mySearchParamRegistry, myPartitionSettings); if (theParams.keySet().size() > 1 || theParams.getSort() != null || theParams.keySet().contains(Constants.PARAM_HAS) || isPotentiallyContainedReferenceParameterExistsAtRoot(theParams)) { List activeComboParams = mySearchParamRegistry.getActiveComboSearchParams(myResourceName, theParams.keySet()); @@ -554,7 +549,7 @@ public class SearchBuilder implements ISearchBuilder { // is basically a reverse-include search. For type/Everything (as opposed to instance/Everything) // the one problem with this approach is that it doesn't catch Patients that have absolutely // nothing linked to them. So we do one additional query to make sure we catch those too. - SearchQueryBuilder fetchPidsSqlBuilder = new SearchQueryBuilder(myContext, myDaoConfig.getModelConfig(), myPartitionSettings, myRequestPartitionId, myResourceName, mySqlBuilderFactory, myDialectProvider, theCountOnlyFlag); + SearchQueryBuilder fetchPidsSqlBuilder = new SearchQueryBuilder(myContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, myResourceName, mySqlBuilderFactory, myDialectProvider, theCountOnlyFlag); GeneratedSql allTargetsSql = fetchPidsSqlBuilder.generate(theOffset, myMaxResultsToFetch); String sql = allTargetsSql.getSql(); Object[] args = allTargetsSql.getBindVariables().toArray(new Object[0]); @@ -696,7 +691,7 @@ public class SearchBuilder implements ISearchBuilder { } private boolean isPotentiallyContainedReferenceParameterExistsAtRoot(SearchParameterMap theParams) { - return myModelConfig.isIndexOnContainedResources() && theParams.values().stream() + return myStorageSettings.isIndexOnContainedResources() && theParams.values().stream() .flatMap(Collection::stream) .flatMap(Collection::stream) .anyMatch(t -> t instanceof ReferenceParam); @@ -843,7 +838,7 @@ public class SearchBuilder implements ISearchBuilder { Map resourcePidToVersion = null; for (JpaPid next : thePids) { - if (next.getVersion() != null && myModelConfig.isRespectVersionsForSearchIncludes()) { + if (next.getVersion() != null && myStorageSettings.isRespectVersionsForSearchIncludes()) { if (resourcePidToVersion == null) { resourcePidToVersion = new HashMap<>(); } @@ -999,8 +994,8 @@ public class SearchBuilder implements ISearchBuilder { */ private boolean isLoadingFromElasticSearchSupported(Collection thePids) { // is storage enabled? - return myDaoConfig.isStoreResourceInHSearchIndex() && - myDaoConfig.isAdvancedHSearchIndexing() && + return myStorageSettings.isStoreResourceInHSearchIndex() && + myStorageSettings.isAdvancedHSearchIndexing() && // we don't support history thePids.stream().noneMatch(p -> p.getVersion() != null) && // skip the complexity for metadata in dstu2 @@ -1010,7 +1005,7 @@ public class SearchBuilder implements ISearchBuilder { private List loadResourcesFromElasticSearch(Collection thePids) { // Do we use the fulltextsvc via hibernate-search to load resources or be backwards compatible with older ES only impl // to handle lastN? - if (myDaoConfig.isAdvancedHSearchIndexing() && myDaoConfig.isStoreResourceInHSearchIndex()) { + if (myStorageSettings.isAdvancedHSearchIndexing() && myStorageSettings.isStoreResourceInHSearchIndex()) { List pidList = thePids.stream().map(pid -> (pid).getId()).collect(Collectors.toList()); List resources = myFulltextSearchSvc.getResources(pidList); @@ -1041,7 +1036,7 @@ public class SearchBuilder implements ISearchBuilder { String findPidFieldName = theReverseMode ? MY_SOURCE_RESOURCE_PID : MY_TARGET_RESOURCE_PID; String findResourceTypeFieldName = theReverseMode ? MY_SOURCE_RESOURCE_TYPE : MY_TARGET_RESOURCE_TYPE; String findVersionFieldName = null; - if (!theReverseMode && myModelConfig.isRespectVersionsForSearchIncludes()) { + if (!theReverseMode && myStorageSettings.isRespectVersionsForSearchIncludes()) { findVersionFieldName = MY_TARGET_RESOURCE_VERSION; } @@ -1567,7 +1562,7 @@ public class SearchBuilder implements ISearchBuilder { } else if (myParams.getOffset() != null && myParams.getCount() != null) { myMaxResultsToFetch = myParams.getCount(); } else { - myMaxResultsToFetch = myDaoConfig.getFetchSizeDefaultMaximum(); + myMaxResultsToFetch = myStorageSettings.getFetchSizeDefaultMaximum(); } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BasePredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BasePredicateBuilder.java index a328fb7fb0e..6ecaf6b8836 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BasePredicateBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BasePredicateBuilder.java @@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.search.builder.predicate; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.search.builder.sql.SearchQueryBuilder; import ca.uhn.fhir.rest.param.ParamPrefixEnum; import com.healthmarketscience.sqlbuilder.BinaryCondition; @@ -55,8 +55,8 @@ public abstract class BasePredicateBuilder { return mySearchSqlBuilder.getResourceType(); } - ModelConfig getModelConfig() { - return mySearchSqlBuilder.getModelConfig(); + StorageSettings getStorageSettings() { + return mySearchSqlBuilder.getStorageSettings(); } @Nonnull diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/DatePredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/DatePredicateBuilder.java index 7ad2dd2a2b8..eb3d71240d0 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/DatePredicateBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/DatePredicateBuilder.java @@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.search.builder.predicate; */ import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.predicate.SearchFilterParser; import ca.uhn.fhir.jpa.search.builder.sql.SearchQueryBuilder; import ca.uhn.fhir.model.api.IQueryParameterType; @@ -49,7 +49,7 @@ public class DatePredicateBuilder extends BaseSearchParamPredicateBuilder { private final DbColumn myColumnValueLowDateOrdinal; private final DbColumn myColumnValueHighDateOrdinal; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; /** * Constructor @@ -64,8 +64,8 @@ public class DatePredicateBuilder extends BaseSearchParamPredicateBuilder { } @VisibleForTesting - public void setDaoConfigForUnitTest(DaoConfig theDaoConfig) { - myDaoConfig = theDaoConfig; + public void setStorageSettingsForUnitTest(JpaStorageSettings theStorageSettings) { + myStorageSettings = theStorageSettings; } public Condition createPredicateDateWithoutIdentityPredicate(IQueryParameterType theParam, @@ -109,10 +109,10 @@ public class DatePredicateBuilder extends BaseSearchParamPredicateBuilder { Comparable genericUpperBound; /* - * If all present search parameters are of DAY precision, and {@link ca.uhn.fhir.jpa.model.entity.ModelConfig#getUseOrdinalDatesForDayPrecisionSearches()} is true, + * If all present search parameters are of DAY precision, and {@link ca.uhn.fhir.jpa.model.entity.StorageSettings#getUseOrdinalDatesForDayPrecisionSearches()} is true, * then we attempt to use the ordinal field for date comparisons instead of the date field. */ - boolean isOrdinalComparison = isNullOrDatePrecision(lowerBound) && isNullOrDatePrecision(upperBound) && myDaoConfig.getModelConfig().getUseOrdinalDatesForDayPrecisionSearches(); + boolean isOrdinalComparison = isNullOrDatePrecision(lowerBound) && isNullOrDatePrecision(upperBound) && myStorageSettings.getUseOrdinalDatesForDayPrecisionSearches(); Condition lt; Condition gt; @@ -144,12 +144,12 @@ public class DatePredicateBuilder extends BaseSearchParamPredicateBuilder { // use lower bound first if (lowerBoundInstant != null) { lb = this.createPredicate(lowValueField, ParamPrefixEnum.LESSTHAN_OR_EQUALS, genericLowerBound); - if (myDaoConfig.isAccountForDateIndexNulls()) { + if (myStorageSettings.isAccountForDateIndexNulls()) { lb = ComboCondition.or(lb, this.createPredicate(highValueField, ParamPrefixEnum.LESSTHAN_OR_EQUALS, genericLowerBound)); } } else if (upperBoundInstant != null) { ub = this.createPredicate(lowValueField, ParamPrefixEnum.LESSTHAN_OR_EQUALS, genericUpperBound); - if (myDaoConfig.isAccountForDateIndexNulls()) { + if (myStorageSettings.isAccountForDateIndexNulls()) { ub = ComboCondition.or(ub, this.createPredicate(highValueField, ParamPrefixEnum.LESSTHAN_OR_EQUALS, genericUpperBound)); } } else { @@ -159,12 +159,12 @@ public class DatePredicateBuilder extends BaseSearchParamPredicateBuilder { // use upper bound first, e.g value between 6 and 10 if (upperBoundInstant != null) { ub = this.createPredicate(highValueField, ParamPrefixEnum.GREATERTHAN_OR_EQUALS, genericUpperBound); - if (myDaoConfig.isAccountForDateIndexNulls()) { + if (myStorageSettings.isAccountForDateIndexNulls()) { ub = ComboCondition.or(ub, this.createPredicate(lowValueField, ParamPrefixEnum.GREATERTHAN_OR_EQUALS, genericUpperBound)); } } else if (lowerBoundInstant != null) { lb = this.createPredicate(highValueField, ParamPrefixEnum.GREATERTHAN_OR_EQUALS, genericLowerBound); - if (myDaoConfig.isAccountForDateIndexNulls()) { + if (myStorageSettings.isAccountForDateIndexNulls()) { lb = ComboCondition.or(lb, this.createPredicate(lowValueField, ParamPrefixEnum.GREATERTHAN_OR_EQUALS, genericLowerBound)); } } else { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ICanMakeMissingParamPredicate.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ICanMakeMissingParamPredicate.java index ed481ca2c7b..4d847d17037 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ICanMakeMissingParamPredicate.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ICanMakeMissingParamPredicate.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.search.builder.predicate; * #L% */ -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.search.builder.models.MissingQueryParameterPredicateParams; import com.healthmarketscience.sqlbuilder.Condition; @@ -29,7 +29,7 @@ public interface ICanMakeMissingParamPredicate { * Creates the condition for searching for a missing field * for a given SearchParameter type. * - * Only use if {@link DaoConfig#getIndexMissingFields()} is disabled + * Only use if {@link JpaStorageSettings#getIndexMissingFields()} is disabled */ Condition createPredicateParamMissingValue(MissingQueryParameterPredicateParams theParams); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ResourceLinkPredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ResourceLinkPredicateBuilder.java index 94bde557a48..73f9c46af6b 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ResourceLinkPredicateBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ResourceLinkPredicateBuilder.java @@ -32,7 +32,7 @@ import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IDao; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; @@ -114,7 +114,7 @@ public class ResourceLinkPredicateBuilder private final boolean myReversed; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Autowired private IInterceptorBroadcaster myInterceptorBroadcaster; @Autowired @@ -195,7 +195,7 @@ public class ResourceLinkPredicateBuilder IIdType dt = new IdDt(ref.getBaseUrl(), ref.getResourceType(), ref.getIdPart(), null); if (dt.hasBaseUrl()) { - if (myDaoConfig.getTreatBaseUrlsAsLocal().contains(dt.getBaseUrl())) { + if (myStorageSettings.getTreatBaseUrlsAsLocal().contains(dt.getBaseUrl())) { dt = dt.toUnqualified(); targetIds.add(dt); } else { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/StringPredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/StringPredicateBuilder.java index d47d3776015..5fe66ae74b2 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/StringPredicateBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/StringPredicateBuilder.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.search.builder.predicate; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.context.RuntimeSearchParam; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.predicate.SearchFilterParser; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString; import ca.uhn.fhir.jpa.util.QueryParameterUtils; @@ -51,7 +51,7 @@ public class StringPredicateBuilder extends BaseSearchParamPredicateBuilder { private final DbColumn myColumnHashIdentity; private final DbColumn myColumnHashExact; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; /** * Constructor @@ -94,7 +94,7 @@ public class StringPredicateBuilder extends BaseSearchParamPredicateBuilder { StringParam id = (StringParam) theParameter; rawSearchTerm = id.getValue(); if (id.isContains()) { - if (!myDaoConfig.isAllowContainsSearches()) { + if (!myStorageSettings.isAllowContainsSearches()) { throw new MethodNotAllowedException(Msg.code(1258) + ":contains modifier is disabled on this server"); } } else { @@ -122,7 +122,7 @@ public class StringPredicateBuilder extends BaseSearchParamPredicateBuilder { String likeExpression; if ((theParameter instanceof StringParam) && (((((StringParam) theParameter).isContains()) && - (myDaoConfig.isAllowContainsSearches())) || + (myStorageSettings.isAllowContainsSearches())) || (operation == SearchFilterParser.CompareOperation.co))) { likeExpression = createLeftAndRightMatchLikeExpression(normalizedString); } else if ((operation != SearchFilterParser.CompareOperation.ne) && @@ -174,7 +174,7 @@ public class StringPredicateBuilder extends BaseSearchParamPredicateBuilder { @Nonnull public Condition createPredicateNormalLike(String theResourceType, String theParamName, String theNormalizedString, String theLikeExpression) { - Long hash = ResourceIndexedSearchParamString.calculateHashNormalized(getPartitionSettings(), getRequestPartitionId(), getModelConfig(), theResourceType, theParamName, theNormalizedString); + Long hash = ResourceIndexedSearchParamString.calculateHashNormalized(getPartitionSettings(), getRequestPartitionId(), getStorageSettings(), theResourceType, theParamName, theNormalizedString); Condition hashPredicate = BinaryCondition.equalTo(myColumnHashNormPrefix, generatePlaceholder(hash)); Condition valuePredicate = BinaryCondition.like(myColumnValueNormalized, generatePlaceholder(theLikeExpression)); return ComboCondition.and(hashPredicate, valuePredicate); @@ -182,7 +182,7 @@ public class StringPredicateBuilder extends BaseSearchParamPredicateBuilder { @Nonnull public Condition createPredicateNormal(String theResourceType, String theParamName, String theNormalizedString) { - Long hash = ResourceIndexedSearchParamString.calculateHashNormalized(getPartitionSettings(), getRequestPartitionId(), getModelConfig(), theResourceType, theParamName, theNormalizedString); + Long hash = ResourceIndexedSearchParamString.calculateHashNormalized(getPartitionSettings(), getRequestPartitionId(), getStorageSettings(), theResourceType, theParamName, theNormalizedString); Condition hashPredicate = BinaryCondition.equalTo(myColumnHashNormPrefix, generatePlaceholder(hash)); Condition valuePredicate = BinaryCondition.equalTo(myColumnValueNormalized, generatePlaceholder(theNormalizedString)); return ComboCondition.and(hashPredicate, valuePredicate); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/TokenPredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/TokenPredicateBuilder.java index 91a3d86cd2e..48fcc05c98d 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/TokenPredicateBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/TokenPredicateBuilder.java @@ -32,14 +32,13 @@ import ca.uhn.fhir.context.support.ValidationSupportContext; import ca.uhn.fhir.context.support.ValueSetExpansionOptions; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.predicate.SearchFilterParser; import ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParam; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken; -import ca.uhn.fhir.jpa.util.QueryParameterUtils; import ca.uhn.fhir.jpa.search.builder.sql.SearchQueryBuilder; import ca.uhn.fhir.jpa.term.api.ITermReadSvc; +import ca.uhn.fhir.jpa.util.QueryParameterUtils; import ca.uhn.fhir.model.api.IQueryParameterType; import ca.uhn.fhir.model.base.composite.BaseCodingDt; import ca.uhn.fhir.model.base.composite.BaseIdentifierDt; @@ -67,9 +66,6 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; -import static ca.uhn.fhir.jpa.util.QueryParameterUtils.toAndPredicate; -import static ca.uhn.fhir.jpa.util.QueryParameterUtils.toEqualToOrInPredicate; -import static ca.uhn.fhir.jpa.util.QueryParameterUtils.toOrPredicate; import static org.apache.commons.lang3.StringUtils.defaultIfBlank; import static org.apache.commons.lang3.StringUtils.isBlank; import static org.apache.commons.lang3.StringUtils.isNotBlank; @@ -88,11 +84,9 @@ public class TokenPredicateBuilder extends BaseSearchParamPredicateBuilder { @Autowired private ITermReadSvc myTerminologySvc; @Autowired - private ModelConfig myModelConfig; - @Autowired private FhirContext myContext; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; /** * Constructor @@ -181,7 +175,7 @@ public class TokenPredicateBuilder extends BaseSearchParamPredicateBuilder { if (modifier == TokenParamModifier.IN || modifier == TokenParamModifier.NOT_IN) { if (myContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU2)) { ValueSetExpansionOptions valueSetExpansionOptions = new ValueSetExpansionOptions(); - valueSetExpansionOptions.setCount(myDaoConfig.getMaximumExpansionSize()); + valueSetExpansionOptions.setCount(myStorageSettings.getMaximumExpansionSize()); IValidationSupport.ValueSetExpansionOutcome expanded = myValidationSupport.expandValueSet(new ValidationSupportContext(myValidationSupport), valueSetExpansionOptions, code); codes.addAll(extractValueSetCodes(expanded.getValueSet())); @@ -200,7 +194,7 @@ public class TokenPredicateBuilder extends BaseSearchParamPredicateBuilder { validateHaveSystemAndCodeForToken(paramName, code, system); codes.addAll(myTerminologySvc.findCodesBelow(system, code)); } else if (modifier == TokenParamModifier.OF_TYPE) { - if (!myModelConfig.isIndexIdentifierOfType()) { + if (!myStorageSettings.isIndexIdentifierOfType()) { throw new MethodNotAllowedException(Msg.code(2012) + "The :of-type modifier is not enabled on this server"); } if (isBlank(system) || isBlank(code)) { @@ -270,7 +264,7 @@ public class TokenPredicateBuilder extends BaseSearchParamPredicateBuilder { BaseRuntimeElementCompositeDefinition expansionDef = (BaseRuntimeElementCompositeDefinition) myContext.getElementDefinition(expansion.getClass()); BaseRuntimeChildDefinition containsChild = expansionDef.getChildByName("contains"); List contains = containsChild.getAccessor().getValues(expansion); - + BaseRuntimeChildDefinition.IAccessor systemAccessor = null; BaseRuntimeChildDefinition.IAccessor codeAccessor = null; for (IBase nextContains : contains) { @@ -282,13 +276,13 @@ public class TokenPredicateBuilder extends BaseSearchParamPredicateBuilder { } String system = systemAccessor .getFirstValueOrNull(nextContains) - .map(t->(IPrimitiveType)t) - .map(t->t.getValueAsString()) + .map(t -> (IPrimitiveType) t) + .map(t -> t.getValueAsString()) .orElse(null); String code = codeAccessor .getFirstValueOrNull(nextContains) - .map(t->(IPrimitiveType)t) - .map(t->t.getValueAsString()) + .map(t -> (IPrimitiveType) t) + .map(t -> t.getValueAsString()) .orElse(null); if (isNotBlank(system) && isNotBlank(code)) { retVal.add(new FhirVersionIndependentConcept(system, code)); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryBuilder.java index e3605e4970c..d098599650e 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryBuilder.java @@ -26,7 +26,7 @@ import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.config.HibernatePropertiesProvider; import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.dao.JpaPid; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.search.builder.QueryStack; import ca.uhn.fhir.jpa.search.builder.predicate.BaseJoiningPredicateBuilder; import ca.uhn.fhir.jpa.search.builder.predicate.ComboNonUniqueSearchParameterPredicateBuilder; @@ -97,7 +97,7 @@ public class SearchQueryBuilder { private final PartitionSettings myPartitionSettings; private final RequestPartitionId myRequestPartitionId; private final String myResourceType; - private final ModelConfig myModelConfig; + private final StorageSettings myStorageSettings; private final FhirContext myFhirContext; private final SqlObjectFactory mySqlBuilderFactory; private final boolean myCountQuery; @@ -113,16 +113,16 @@ public class SearchQueryBuilder { /** * Constructor */ - public SearchQueryBuilder(FhirContext theFhirContext, ModelConfig theModelConfig, PartitionSettings thePartitionSettings, RequestPartitionId theRequestPartitionId, String theResourceType, SqlObjectFactory theSqlBuilderFactory, HibernatePropertiesProvider theDialectProvider, boolean theCountQuery) { - this(theFhirContext, theModelConfig, thePartitionSettings, theRequestPartitionId, theResourceType, theSqlBuilderFactory, UUID.randomUUID() + "-", theDialectProvider.getDialect(), theCountQuery, new ArrayList<>()); + public SearchQueryBuilder(FhirContext theFhirContext, StorageSettings theStorageSettings, PartitionSettings thePartitionSettings, RequestPartitionId theRequestPartitionId, String theResourceType, SqlObjectFactory theSqlBuilderFactory, HibernatePropertiesProvider theDialectProvider, boolean theCountQuery) { + this(theFhirContext, theStorageSettings, thePartitionSettings, theRequestPartitionId, theResourceType, theSqlBuilderFactory, UUID.randomUUID() + "-", theDialectProvider.getDialect(), theCountQuery, new ArrayList<>()); } /** * Constructor for child SQL Builders */ - private SearchQueryBuilder(FhirContext theFhirContext, ModelConfig theModelConfig, PartitionSettings thePartitionSettings, RequestPartitionId theRequestPartitionId, String theResourceType, SqlObjectFactory theSqlBuilderFactory, String theBindVariableSubstitutionBase, Dialect theDialect, boolean theCountQuery, ArrayList theBindVariableValues) { + private SearchQueryBuilder(FhirContext theFhirContext, StorageSettings theStorageSettings, PartitionSettings thePartitionSettings, RequestPartitionId theRequestPartitionId, String theResourceType, SqlObjectFactory theSqlBuilderFactory, String theBindVariableSubstitutionBase, Dialect theDialect, boolean theCountQuery, ArrayList theBindVariableValues) { myFhirContext = theFhirContext; - myModelConfig = theModelConfig; + myStorageSettings = theStorageSettings; myPartitionSettings = thePartitionSettings; myRequestPartitionId = theRequestPartitionId; myResourceType = theResourceType; @@ -438,12 +438,6 @@ public class SearchQueryBuilder { mySelect.addJoins(SelectQuery.JoinType.INNER, join); } - public void addJoinWithCustomOnCondition(DbTable theFromTable, DbTable theToTable, DbColumn theFromColumn, DbColumn theToColumn, Condition theCondition) { - Join join = new DbJoin(mySpec, theFromTable, theToTable, new DbColumn[]{theFromColumn}, new DbColumn[]{theToColumn}); - // add hashIdentity codition here - mySelect.addJoins(SelectQuery.JoinType.INNER, join); - } - /** * Generate and return the SQL generated by this builder */ @@ -598,7 +592,7 @@ public class SearchQueryBuilder { public List generatePlaceholders(Collection theValues) { return theValues .stream() - .map(t -> generatePlaceholder(t)) + .map(this::generatePlaceholder) .collect(Collectors.toList()); } @@ -627,8 +621,8 @@ public class SearchQueryBuilder { return myResourceType; } - public ModelConfig getModelConfig() { - return myModelConfig; + public StorageSettings getStorageSettings() { + return myStorageSettings; } public void addPredicate(@Nonnull Condition theCondition) { @@ -708,13 +702,17 @@ public class SearchQueryBuilder { return BinaryCondition.greaterThanOrEq(theColumn, generatePlaceholder(theValue)); case NOT_EQUAL: return BinaryCondition.notEqualTo(theColumn, generatePlaceholder(theValue)); + case STARTS_AFTER: + case APPROXIMATE: + case ENDS_BEFORE: + case EQUAL: default: throw new IllegalArgumentException(Msg.code(1263)); } } public SearchQueryBuilder newChildSqlBuilder() { - return new SearchQueryBuilder(myFhirContext, myModelConfig, myPartitionSettings, myRequestPartitionId, myResourceType, mySqlBuilderFactory, myBindVariableSubstitutionBase, myDialect, false, myBindVariableValues); + return new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, myResourceType, mySqlBuilderFactory, myBindVariableSubstitutionBase, myDialect, false, myBindVariableValues); } public SelectQuery getSelect() { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/tasks/SearchContinuationTask.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/tasks/SearchContinuationTask.java index 18098c4f82a..6d4bec2f6a1 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/tasks/SearchContinuationTask.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/tasks/SearchContinuationTask.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.search.builder.tasks; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.SearchBuilderFactory; import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.dao.tx.HapiTransactionService; @@ -50,7 +50,7 @@ public class SearchContinuationTask extends SearchTask { IInterceptorBroadcaster theInterceptorBroadcaster, SearchBuilderFactory theSearchBuilderFactory, ISearchResultCacheSvc theSearchResultCacheSvc, - DaoConfig theDaoConfig, + JpaStorageSettings theStorageSettings, ISearchCacheSvc theSearchCacheSvc, IPagingProvider thePagingProvider, ExceptionService theExceptionSvc @@ -62,7 +62,7 @@ public class SearchContinuationTask extends SearchTask { theInterceptorBroadcaster, theSearchBuilderFactory, theSearchResultCacheSvc, - theDaoConfig, + theStorageSettings, theSearchCacheSvc, thePagingProvider ); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/tasks/SearchTask.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/tasks/SearchTask.java index 04c77c6fea3..759457b8d3f 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/tasks/SearchTask.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/tasks/SearchTask.java @@ -26,7 +26,7 @@ import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IDao; import ca.uhn.fhir.jpa.dao.IResultIterator; import ca.uhn.fhir.jpa.dao.ISearchBuilder; @@ -124,7 +124,7 @@ public class SearchTask implements Callable { private final IInterceptorBroadcaster myInterceptorBroadcaster; private final SearchBuilderFactory mySearchBuilderFactory; protected final ISearchResultCacheSvc mySearchResultCacheSvc; - private final DaoConfig myDaoConfig; + private final JpaStorageSettings myStorageSettings; private final ISearchCacheSvc mySearchCacheSvc; private final IPagingProvider myPagingProvider; @@ -138,7 +138,7 @@ public class SearchTask implements Callable { IInterceptorBroadcaster theInterceptorBroadcaster, SearchBuilderFactory theSearchBuilderFactory, ISearchResultCacheSvc theSearchResultCacheSvc, - DaoConfig theDaoConfig, + JpaStorageSettings theStorageSettings, ISearchCacheSvc theSearchCacheSvc, IPagingProvider thePagingProvider ) { @@ -148,7 +148,7 @@ public class SearchTask implements Callable { myInterceptorBroadcaster = theInterceptorBroadcaster; mySearchBuilderFactory = theSearchBuilderFactory; mySearchResultCacheSvc = theSearchResultCacheSvc; - myDaoConfig = theDaoConfig; + myStorageSettings = theStorageSettings; mySearchCacheSvc = theSearchCacheSvc; myPagingProvider = thePagingProvider; @@ -341,9 +341,9 @@ public class SearchTask implements Callable { numSynced = mySyncedPids.size(); } - if (myDaoConfig.getCountSearchResultsUpTo() == null || - myDaoConfig.getCountSearchResultsUpTo() <= 0 || - myDaoConfig.getCountSearchResultsUpTo() <= numSynced) { + if (myStorageSettings.getCountSearchResultsUpTo() == null || + myStorageSettings.getCountSearchResultsUpTo() <= 0 || + myStorageSettings.getCountSearchResultsUpTo() <= numSynced) { myInitialCollectionLatch.countDown(); } @@ -487,7 +487,7 @@ public class SearchTask implements Callable { * before doing anything else. */ boolean myParamWantOnlyCount = isWantOnlyCount(myParams); - boolean myParamOrDefaultWantCount = nonNull(myParams.getSearchTotalMode()) ? isWantCount(myParams) : SearchParameterMapCalculator.isWantCount(myDaoConfig.getDefaultTotalMode()); + boolean myParamOrDefaultWantCount = nonNull(myParams.getSearchTotalMode()) ? isWantCount(myParams) : SearchParameterMapCalculator.isWantCount(myStorageSettings.getDefaultTotalMode()); if (myParamWantOnlyCount || myParamOrDefaultWantCount) { ourLog.trace("Performing count"); @@ -524,7 +524,7 @@ public class SearchTask implements Callable { /* * Figure out how many results we're actually going to fetch from the * database in this pass. This calculation takes into consideration the - * "pre-fetch thresholds" specified in DaoConfig#getSearchPreFetchThresholds() + * "pre-fetch thresholds" specified in StorageSettings#getSearchPreFetchThresholds() * as well as the value of the _count parameter. */ int currentlyLoaded = defaultIfNull(mySearch.getNumFound(), 0); @@ -535,7 +535,7 @@ public class SearchTask implements Callable { minWanted += currentlyLoaded; } - for (Iterator iter = myDaoConfig.getSearchPreFetchThresholds().iterator(); iter.hasNext(); ) { + for (Iterator iter = myStorageSettings.getSearchPreFetchThresholds().iterator(); iter.hasNext(); ) { int next = iter.next(); if (next != -1 && next <= currentlyLoaded) { continue; @@ -599,9 +599,9 @@ public class SearchTask implements Callable { boolean shouldSync = myUnsyncedPids.size() >= syncSize; - if (myDaoConfig.getCountSearchResultsUpTo() != null && - myDaoConfig.getCountSearchResultsUpTo() > 0 && - myDaoConfig.getCountSearchResultsUpTo() < myUnsyncedPids.size()) { + if (myStorageSettings.getCountSearchResultsUpTo() != null && + myStorageSettings.getCountSearchResultsUpTo() > 0 && + myStorageSettings.getCountSearchResultsUpTo() < myUnsyncedPids.size()) { shouldSync = false; } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/cache/DatabaseSearchCacheSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/cache/DatabaseSearchCacheSvcImpl.java index 61309724438..6e1d5128a1f 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/cache/DatabaseSearchCacheSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/cache/DatabaseSearchCacheSvcImpl.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.search.cache; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.data.ISearchDao; import ca.uhn.fhir.jpa.dao.data.ISearchIncludeDao; import ca.uhn.fhir.jpa.dao.data.ISearchResultDao; @@ -81,7 +81,7 @@ public class DatabaseSearchCacheSvcImpl implements ISearchCacheSvc { @Autowired private PlatformTransactionManager myTxManager; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @VisibleForTesting public void setCutoffSlackForUnitTest(long theCutoffSlack) { @@ -156,13 +156,13 @@ public class DatabaseSearchCacheSvcImpl implements ISearchCacheSvc { @Transactional(propagation = Propagation.NEVER) @Override public void pollForStaleSearchesAndDeleteThem() { - if (!myDaoConfig.isExpireSearchResults()) { + if (!myStorageSettings.isExpireSearchResults()) { return; } - long cutoffMillis = myDaoConfig.getExpireSearchResultsAfterMillis(); - if (myDaoConfig.getReuseCachedSearchResultsForMillis() != null) { - cutoffMillis = cutoffMillis + myDaoConfig.getReuseCachedSearchResultsForMillis(); + long cutoffMillis = myStorageSettings.getExpireSearchResultsAfterMillis(); + if (myStorageSettings.getReuseCachedSearchResultsForMillis() != null) { + cutoffMillis = cutoffMillis + myStorageSettings.getReuseCachedSearchResultsForMillis(); } final Date cutoff = new Date((now() - cutoffMillis) - myCutoffSlack); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java index 3bc53c3412f..ee58c5e4db9 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.search.elastic; import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import org.apache.commons.lang3.StringUtils; import org.hibernate.search.backend.elasticsearch.index.layout.IndexLayoutStrategy; import org.hibernate.search.backend.elasticsearch.logging.impl.Log; @@ -37,43 +37,48 @@ import java.util.regex.Pattern; /** * This class instructs hibernate search on how to create index names for indexed entities. * In our case, we use this class to add an optional prefix to all indices which are created, which can be controlled via - * {@link DaoConfig#setHSearchIndexPrefix(String)}. + * {@link JpaStorageSettings#setHSearchIndexPrefix(String)}. */ @Service public class IndexNamePrefixLayoutStrategy implements IndexLayoutStrategy { @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; static final Log log = LoggerFactory.make(Log.class, MethodHandles.lookup()); public static final String NAME = "prefix"; public static final Pattern UNIQUE_KEY_EXTRACTION_PATTERN = Pattern.compile("(.*)-\\d{6}"); + @Override public String createInitialElasticsearchIndexName(String hibernateSearchIndexName) { return addPrefixIfNecessary(hibernateSearchIndexName + "-000001"); } + @Override public String createWriteAlias(String hibernateSearchIndexName) { return addPrefixIfNecessary(hibernateSearchIndexName +"-write"); } + @Override public String createReadAlias(String hibernateSearchIndexName) { return addPrefixIfNecessary(hibernateSearchIndexName + "-read"); } private String addPrefixIfNecessary(String theCandidateName) { - validateDaoConfigIsPresent(); - if (!StringUtils.isBlank(myDaoConfig.getHSearchIndexPrefix())) { - return myDaoConfig.getHSearchIndexPrefix() + "-" + theCandidateName; + validateStorageSettingsIsPresent(); + if (!StringUtils.isBlank(myStorageSettings.getHSearchIndexPrefix())) { + return myStorageSettings.getHSearchIndexPrefix() + "-" + theCandidateName; } else { return theCandidateName; } } + @Override public String extractUniqueKeyFromHibernateSearchIndexName(String hibernateSearchIndexName) { return hibernateSearchIndexName; } + @Override public String extractUniqueKeyFromElasticsearchIndexName(String elasticsearchIndexName) { Matcher matcher = UNIQUE_KEY_EXTRACTION_PATTERN.matcher(elasticsearchIndexName); if (!matcher.matches()) { @@ -85,16 +90,16 @@ public class IndexNamePrefixLayoutStrategy implements IndexLayoutStrategy { } private String removePrefixIfNecessary(String theCandidateUniqueKey) { - validateDaoConfigIsPresent(); - if (!StringUtils.isBlank(myDaoConfig.getHSearchIndexPrefix())) { - return theCandidateUniqueKey.replace(myDaoConfig.getHSearchIndexPrefix() + "-", ""); + validateStorageSettingsIsPresent(); + if (!StringUtils.isBlank(myStorageSettings.getHSearchIndexPrefix())) { + return theCandidateUniqueKey.replace(myStorageSettings.getHSearchIndexPrefix() + "-", ""); } else { return theCandidateUniqueKey; } } - private void validateDaoConfigIsPresent() { - if (myDaoConfig == null) { - throw new ConfigurationException(Msg.code(1168) + "While attempting to boot HAPI FHIR, the Hibernate Search bootstrapper failed to find the DaoConfig. This probably means Hibernate Search has been recently upgraded, or somebody modified HapiFhirLocalContainerEntityManagerFactoryBean."); + private void validateStorageSettingsIsPresent() { + if (myStorageSettings == null) { + throw new ConfigurationException(Msg.code(1168) + "While attempting to boot HAPI FHIR, the Hibernate Search bootstrapper failed to find the StorageSettings. This probably means Hibernate Search has been recently upgraded, or somebody modified HapiFhirLocalContainerEntityManagerFactoryBean."); } } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImpl.java index b8ad52ad179..ac49b3a5ded 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImpl.java @@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.search.reindex; import ca.uhn.fhir.batch2.model.JobInstanceStartRequest; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; import ca.uhn.fhir.jpa.dao.data.IForcedIdDao; @@ -94,7 +94,7 @@ public class ResourceReindexingSvcImpl implements IResourceReindexingSvc, IHasSc @Autowired private IResourceReindexJobDao myReindexJobDao; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Autowired private PlatformTransactionManager myTxManager; private TransactionTemplate myTxTemplate; @@ -116,8 +116,8 @@ public class ResourceReindexingSvcImpl implements IResourceReindexingSvc, IHasSc private ResourceReindexer myResourceReindexer; @VisibleForTesting - void setDaoConfigForUnitTest(DaoConfig theDaoConfig) { - myDaoConfig = theDaoConfig; + void setStorageSettingsForUnitTest(JpaStorageSettings theStorageSettings) { + myStorageSettings = theStorageSettings; } @VisibleForTesting @@ -133,7 +133,7 @@ public class ResourceReindexingSvcImpl implements IResourceReindexingSvc, IHasSc public void initExecutor() { // Create the threadpool executor used for reindex jobs - int reindexThreadCount = myDaoConfig.getReindexThreadCount(); + int reindexThreadCount = myStorageSettings.getReindexThreadCount(); RejectedExecutionHandler rejectHandler = new BlockPolicy(); myTaskExecutor = new ThreadPoolExecutor(0, reindexThreadCount, 0L, TimeUnit.MILLISECONDS, @@ -202,7 +202,7 @@ public class ResourceReindexingSvcImpl implements IResourceReindexingSvc, IHasSc @Override @Transactional(propagation = Propagation.NEVER) public Integer runReindexingPass() { - if (myDaoConfig.isSchedulingDisabled() || !myDaoConfig.isEnableTaskPreExpandValueSets()) { + if (myStorageSettings.isSchedulingDisabled() || !myStorageSettings.isEnableTaskPreExpandValueSets()) { return null; } if (myIndexingLock.tryLock()) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/warm/CacheWarmingSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/warm/CacheWarmingSvcImpl.java index e8d5eb0a1f2..dca2291a6c1 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/warm/CacheWarmingSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/warm/CacheWarmingSvcImpl.java @@ -24,7 +24,7 @@ import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.model.WarmCacheEntry; @@ -55,7 +55,7 @@ public class CacheWarmingSvcImpl implements ICacheWarmingSvc, IHasScheduledJobs private static final Logger ourLog = LoggerFactory.getLogger(CacheWarmingSvcImpl.class); @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; private Map myCacheEntryToNextRefresh = new LinkedHashMap<>(); @Autowired private FhirContext myCtx; @@ -131,7 +131,7 @@ public class CacheWarmingSvcImpl implements ICacheWarmingSvc, IHasScheduledJobs public synchronized Set initCacheMap() { myCacheEntryToNextRefresh.clear(); - List warmCacheEntries = myDaoConfig.getWarmCacheEntries(); + List warmCacheEntries = myStorageSettings.getWarmCacheEntries(); for (WarmCacheEntry next : warmCacheEntries) { // Validate diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/sp/SearchParamPresenceSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/sp/SearchParamPresenceSvcImpl.java index 7542fa79cd4..1f39d5e894d 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/sp/SearchParamPresenceSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/sp/SearchParamPresenceSvcImpl.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.sp; * #L% */ -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.data.ISearchParamPresentDao; import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.entity.ResourceTable; @@ -46,17 +46,17 @@ public class SearchParamPresenceSvcImpl implements ISearchParamPresenceSvc { @Autowired private PartitionSettings myPartitionSettings; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @VisibleForTesting - public void setDaoConfig(DaoConfig theDaoConfig) { - myDaoConfig = theDaoConfig; + public void setStorageSettings(JpaStorageSettings theStorageSettings) { + myStorageSettings = theStorageSettings; } @Override public AddRemoveCount updatePresence(ResourceTable theResource, Map theParamNameToPresence) { AddRemoveCount retVal = new AddRemoveCount(); - if (myDaoConfig.getIndexMissingFields() == DaoConfig.IndexEnabledEnum.DISABLED) { + if (myStorageSettings.getIndexMissingFields() == JpaStorageSettings.IndexEnabledEnum.DISABLED) { return retVal; } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermCodeSystemStorageSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermCodeSystemStorageSvcImpl.java index 5adb6e5a300..15486da8827 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermCodeSystemStorageSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermCodeSystemStorageSvcImpl.java @@ -24,7 +24,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; @@ -120,7 +120,7 @@ public class TermCodeSystemStorageSvcImpl implements ITermCodeSystemStorageSvc { @Autowired private ITermReadSvc myTerminologySvc; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Autowired private IResourceTableDao myResourceTableDao; @@ -499,7 +499,7 @@ public class TermCodeSystemStorageSvcImpl implements ITermCodeSystemStorageSvc { termConceptProperty.setConcept(theConceptToAdd); termConceptProperty.setCodeSystemVersion(theCsv); }); - if (theStatisticsTracker.getUpdatedConceptCount() <= myDaoConfig.getDeferIndexingForCodesystemsOfSize()) { + if (theStatisticsTracker.getUpdatedConceptCount() <= myStorageSettings.getDeferIndexingForCodesystemsOfSize()) { saveConcept(conceptToAdd); Long nextConceptPid = conceptToAdd.getId(); Validate.notNull(nextConceptPid); @@ -522,7 +522,7 @@ public class TermCodeSystemStorageSvcImpl implements ITermCodeSystemStorageSvc { conceptToAdd.getParents().add(parentLink); ourLog.info("Saving parent/child link - Parent[{}] Child[{}]", parentLink.getParent().getCode(), parentLink.getChild().getCode()); - if (theStatisticsTracker.getUpdatedConceptCount() <= myDaoConfig.getDeferIndexingForCodesystemsOfSize()) { + if (theStatisticsTracker.getUpdatedConceptCount() <= myStorageSettings.getDeferIndexingForCodesystemsOfSize()) { myConceptParentChildLinkDao.save(parentLink); } else { myDeferredStorageSvc.addConceptLinkToStorageQueue(parentLink); @@ -574,7 +574,7 @@ public class TermCodeSystemStorageSvcImpl implements ITermCodeSystemStorageSvc { theConcept.setCodeSystemVersion(theCodeSystem); theConcept.setIndexStatus(BaseHapiFhirDao.INDEX_STATUS_INDEXED); - if (theConceptsStack.size() <= myDaoConfig.getDeferIndexingForCodesystemsOfSize()) { + if (theConceptsStack.size() <= myStorageSettings.getDeferIndexingForCodesystemsOfSize()) { saveConcept(theConcept); } else { myDeferredStorageSvc.addConceptToStorageQueue(theConcept); @@ -585,7 +585,7 @@ public class TermCodeSystemStorageSvcImpl implements ITermCodeSystemStorageSvc { } for (TermConceptParentChildLink next : theConcept.getChildren()) { - if (theConceptsStack.size() <= myDaoConfig.getDeferIndexingForCodesystemsOfSize()) { + if (theConceptsStack.size() <= myStorageSettings.getDeferIndexingForCodesystemsOfSize()) { saveConceptLink(next); } else { myDeferredStorageSvc.addConceptLinkToStorageQueue(next); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermDeferredStorageSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermDeferredStorageSvcImpl.java index 582bf435fc8..6ea9f5b3697 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermDeferredStorageSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermDeferredStorageSvcImpl.java @@ -374,7 +374,7 @@ public class TermDeferredStorageSvcImpl implements ITermDeferredStorageSvc, IHas request.setParameters(parameters); Batch2JobStartResponse response = myJobCoordinator.startInstance(request); - myJobExecutions.add(response.getJobId()); + myJobExecutions.add(response.getInstanceId()); } private void deleteTermCodeSystemOffline(Long theCodeSystemPid) { @@ -384,7 +384,7 @@ public class TermDeferredStorageSvcImpl implements ITermDeferredStorageSvc, IHas request.setParameters(parameters); request.setJobDefinitionId(TERM_CODE_SYSTEM_DELETE_JOB_NAME); Batch2JobStartResponse response = myJobCoordinator.startInstance(request); - myJobExecutions.add(response.getJobId()); + myJobExecutions.add(response.getInstanceId()); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcImpl.java index eb35ef43202..38860db808c 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcImpl.java @@ -28,7 +28,7 @@ import ca.uhn.fhir.context.support.ValidationSupportContext; import ca.uhn.fhir.context.support.ValueSetExpansionOptions; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IDao; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; @@ -235,7 +235,7 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs { @Autowired private ITermCodeSystemVersionDao myCodeSystemVersionDao; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; private TransactionTemplate myTxTemplate; @Autowired private PlatformTransactionManager myTransactionManager; @@ -350,8 +350,8 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs { private boolean addToSet(Set theSetToPopulate, TermConcept theConcept) { boolean retVal = theSetToPopulate.add(theConcept); if (retVal) { - if (theSetToPopulate.size() >= myDaoConfig.getMaximumExpansionSize()) { - String msg = myContext.getLocalizer().getMessage(TermReadSvcImpl.class, "expansionTooLarge", myDaoConfig.getMaximumExpansionSize()); + if (theSetToPopulate.size() >= myStorageSettings.getMaximumExpansionSize()) { + String msg = myContext.getLocalizer().getMessage(TermReadSvcImpl.class, "expansionTooLarge", myStorageSettings.getMaximumExpansionSize()); throw new ExpansionTooCostlyException(Msg.code(885) + msg); } } @@ -432,7 +432,7 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs { int count = expansionOptions.getCount(); ValueSetExpansionComponentWithConceptAccumulator accumulator = new ValueSetExpansionComponentWithConceptAccumulator(myContext, count, expansionOptions.isIncludeHierarchy()); - accumulator.setHardExpansionMaximumSize(myDaoConfig.getMaximumExpansionSize()); + accumulator.setHardExpansionMaximumSize(myStorageSettings.getMaximumExpansionSize()); accumulator.setSkipCountRemaining(offset); accumulator.setIdentifier(UUID.randomUUID().toString()); accumulator.setTimestamp(new Date()); @@ -535,7 +535,7 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs { offset = Math.min(offset, theTermValueSet.getTotalConcepts().intValue()); Integer count = theAccumulator.getCapacityRemaining(); - count = defaultIfNull(count, myDaoConfig.getMaximumExpansionSize()); + count = defaultIfNull(count, myStorageSettings.getMaximumExpansionSize()); int conceptsExpanded = 0; int designationsExpanded = 0; @@ -1900,7 +1900,7 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs { @Override public synchronized void preExpandDeferredValueSetsToTerminologyTables() { - if (!myDaoConfig.isEnableTaskPreExpandValueSets()) { + if (!myStorageSettings.isEnableTaskPreExpandValueSets()) { return; } if (isNotSafeToPreExpandValueSets()) { diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/export/svc/BulkDataExportJobSchedulingHelperImplTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/export/svc/BulkDataExportJobSchedulingHelperImplTest.java index 81b01008578..9da78f5ee94 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/export/svc/BulkDataExportJobSchedulingHelperImplTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/export/svc/BulkDataExportJobSchedulingHelperImplTest.java @@ -4,7 +4,7 @@ import ca.uhn.fhir.batch2.api.IJobPersistence; import ca.uhn.fhir.batch2.model.JobInstance; import ca.uhn.fhir.batch2.model.StatusEnum; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.model.BulkExportJobResults; @@ -49,32 +49,24 @@ import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) public class BulkDataExportJobSchedulingHelperImplTest { + private final FhirContext myFhirContext = FhirContext.forR4Cached(); @Mock - private DaoConfig myDaoConfig; - + private JpaStorageSettings myStorageSettings; @Mock private PlatformTransactionManager myTxManager; - @Mock private TransactionTemplate myTxTemplate; - @Mock private IJobPersistence myJpaJobPersistence; - @Mock private BulkExportHelperService myBulkExportHelperSvc; - @Mock private DaoRegistry myDaoRegistry; - @Mock private IFhirResourceDao myBinaryDao; - @Captor private ArgumentCaptor myCutoffCaptor; - private BulkDataExportJobSchedulingHelperImpl myBulkDataExportJobSchedulingHelper; - private final FhirContext myFhirContext = FhirContext.forR4Cached(); @Test public void testPurgeExpiredFilesDisabledDoesNothing() { @@ -225,7 +217,7 @@ public class BulkDataExportJobSchedulingHelperImplTest { public void purgeExpiredFilesMultipleJobsMultipleBinariesTwoHourRetention() { final int expectedRetentionHours = 2; final int numBinariesPerJob = 3; - final List jobInstances = getJobInstances( numBinariesPerJob, StatusEnum.COMPLETED, StatusEnum.COMPLETED, StatusEnum.COMPLETED); + final List jobInstances = getJobInstances(numBinariesPerJob, StatusEnum.COMPLETED, StatusEnum.COMPLETED, StatusEnum.COMPLETED); setupTestEnabled(expectedRetentionHours, jobInstances); @@ -249,7 +241,7 @@ public class BulkDataExportJobSchedulingHelperImplTest { public void purgeExpiredFilesMultipleJobsMultipleBinariesTwoHourRetentionMixedStatuses() { final int expectedRetentionHours = 2; final int numBinariesPerJob = 3; - final List jobInstances = getJobInstances( numBinariesPerJob, StatusEnum.COMPLETED, StatusEnum.FAILED, StatusEnum.COMPLETED); + final List jobInstances = getJobInstances(numBinariesPerJob, StatusEnum.COMPLETED, StatusEnum.FAILED, StatusEnum.COMPLETED); setupTestEnabled(expectedRetentionHours, jobInstances); @@ -272,35 +264,6 @@ public class BulkDataExportJobSchedulingHelperImplTest { assertEquals(DateUtils.truncate(computeDateFromConfig(expectedRetentionHours), Calendar.MINUTE), DateUtils.truncate(cutoffDate, Calendar.MINUTE)); } - @Nonnull - private static List getJobInstances(int theNumBinaries, StatusEnum... theStatusEnums) { - return IntStream.range(0, theStatusEnums.length) - .mapToObj(index -> Pair.of(index, theStatusEnums[index])) - .map(pair -> { - final JobInstance jobInstance = new JobInstance(); - final StatusEnum status = pair.getSecond(); - final String instanceId = status.name() + pair.getFirst(); - jobInstance.setInstanceId(instanceId); - jobInstance.setReport(serialize(getBulkExportJobResults(instanceId, theNumBinaries))); - jobInstance.setStatus(status); - return jobInstance; - }).toList(); - } - - private static String serialize(BulkExportJobResults theBulkExportJobResults) { - return JsonUtil.serialize(theBulkExportJobResults); - } - - @Nonnull - private static BulkExportJobResults getBulkExportJobResults(String theInstanceId, int theNumBinaries) { - final BulkExportJobResults bulkExportJobResults = new BulkExportJobResults(); - bulkExportJobResults.setResourceTypeToBinaryIds(Map.of("Patient", - IntStream.range(0, theNumBinaries) - .mapToObj(theInt -> theInstanceId + "-binary-" + theInt) - .toList())); - return bulkExportJobResults; - } - @Nonnull private Date computeDateFromConfig(int theExpectedRetentionHours) { return Date.from(LocalDateTime.now() @@ -322,9 +285,9 @@ public class BulkDataExportJobSchedulingHelperImplTest { } private void setupTest(boolean theIsEnabled, int theRetentionHours, List theJobInstances, boolean theIsEnableBinaryMocks) { - myBulkDataExportJobSchedulingHelper = new BulkDataExportJobSchedulingHelperImpl(myDaoRegistry, myTxManager, myDaoConfig, myBulkExportHelperSvc, myJpaJobPersistence, myTxTemplate); + myBulkDataExportJobSchedulingHelper = new BulkDataExportJobSchedulingHelperImpl(myDaoRegistry, myTxManager, myStorageSettings, myBulkExportHelperSvc, myJpaJobPersistence, myTxTemplate); - when(myDaoConfig.isEnableTaskBulkExportJobExecution()).thenReturn(theIsEnabled); + when(myStorageSettings.isEnableTaskBulkExportJobExecution()).thenReturn(theIsEnabled); if (!theIsEnabled) { return; @@ -346,12 +309,12 @@ public class BulkDataExportJobSchedulingHelperImplTest { eq(StatusEnum.getEndedStatuses()), myCutoffCaptor.capture(), any(PageRequest.class))) - .thenReturn(theJobInstances); + .thenReturn(theJobInstances); when(myTxTemplate.execute(any())) .thenAnswer(fetchInstancesAnswer).thenAnswer(purgeExpiredJobsAnswer); - when(myDaoConfig.getBulkExportFileRetentionPeriodHours()) + when(myStorageSettings.getBulkExportFileRetentionPeriodHours()) .thenReturn(theRetentionHours); if (theJobInstances.isEmpty()) { @@ -379,4 +342,33 @@ public class BulkDataExportJobSchedulingHelperImplTest { retVal.setValue(theResourceId); return retVal; } + + @Nonnull + private static List getJobInstances(int theNumBinaries, StatusEnum... theStatusEnums) { + return IntStream.range(0, theStatusEnums.length) + .mapToObj(index -> Pair.of(index, theStatusEnums[index])) + .map(pair -> { + final JobInstance jobInstance = new JobInstance(); + final StatusEnum status = pair.getSecond(); + final String instanceId = status.name() + pair.getFirst(); + jobInstance.setInstanceId(instanceId); + jobInstance.setReport(serialize(getBulkExportJobResults(instanceId, theNumBinaries))); + jobInstance.setStatus(status); + return jobInstance; + }).toList(); + } + + private static String serialize(BulkExportJobResults theBulkExportJobResults) { + return JsonUtil.serialize(theBulkExportJobResults); + } + + @Nonnull + private static BulkExportJobResults getBulkExportJobResults(String theInstanceId, int theNumBinaries) { + final BulkExportJobResults bulkExportJobResults = new BulkExportJobResults(); + bulkExportJobResults.setResourceTypeToBinaryIds(Map.of("Patient", + IntStream.range(0, theNumBinaries) + .mapToObj(theInt -> theInstanceId + "-binary-" + theInt) + .toList())); + return bulkExportJobResults; + } } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/export/svc/JpaBulkExportProcessorTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/export/svc/JpaBulkExportProcessorTest.java index b2c98123632..d7f7896bbbe 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/export/svc/JpaBulkExportProcessorTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/export/svc/JpaBulkExportProcessorTest.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.bulk.export.svc; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.model.PersistentIdToForcedIdMap; @@ -113,7 +113,7 @@ public class JpaBulkExportProcessorTest { private BulkExportHelperService myBulkExportHelperService; @Mock - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Mock private DaoRegistry myDaoRegistry; @@ -182,8 +182,8 @@ public class JpaBulkExportProcessorTest { ISearchBuilder searchBuilder = mock(ISearchBuilder.class); // when - when(myDaoConfig.getIndexMissingFields()) - .thenReturn(DaoConfig.IndexEnabledEnum.ENABLED); + when(myStorageSettings.getIndexMissingFields()) + .thenReturn(JpaStorageSettings.IndexEnabledEnum.ENABLED); when(myBulkExportHelperService.createSearchParameterMapsForResourceType(any(RuntimeResourceDefinition.class), eq(parameters), any(boolean.class))) .thenReturn(maps); // from getSearchBuilderForLocalResourceType @@ -218,8 +218,8 @@ public class JpaBulkExportProcessorTest { parameters.setResourceType("Patient"); // when - when(myDaoConfig.getIndexMissingFields()) - .thenReturn(DaoConfig.IndexEnabledEnum.DISABLED); + when(myStorageSettings.getIndexMissingFields()) + .thenReturn(JpaStorageSettings.IndexEnabledEnum.DISABLED); // test try { diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml b/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml index 489052ae189..eb3c5855045 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml +++ b/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/bulk/BulkGroupExportWithIndexedSearchParametersTest.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/bulk/BulkGroupExportWithIndexedSearchParametersTest.java index f3f6047758a..4973213ac12 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/bulk/BulkGroupExportWithIndexedSearchParametersTest.java +++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/bulk/BulkGroupExportWithIndexedSearchParametersTest.java @@ -1,7 +1,6 @@ package ca.uhn.fhir.jpa.bulk; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.api.model.BulkExportJobResults; import ca.uhn.fhir.jpa.api.svc.IBatch2JobRunner; @@ -46,7 +45,6 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; public class BulkGroupExportWithIndexedSearchParametersTest extends BaseJpaTest { private final FhirContext myCtx = FhirContext.forR4Cached(); - @Autowired private DaoConfig myDaoConfig; @Autowired private IBatch2JobRunner myJobRunner; @Autowired private PlatformTransactionManager myTxManager; @Autowired @@ -56,9 +54,13 @@ public class BulkGroupExportWithIndexedSearchParametersTest extends BaseJpaTest @BeforeEach void setUp() { - myDaoConfig.setAdvancedHSearchIndexing(true); + myStorageSettings.setAdvancedHSearchIndexing(true); } + @BeforeEach + public void beforeEach() { + myStorageSettings.setJobFastTrackingEnabled(false); + } @Test @@ -86,12 +88,12 @@ public class BulkGroupExportWithIndexedSearchParametersTest extends BaseJpaTest assertNotNull(startResponse); // Run a scheduled pass to build the export - myBatch2JobHelper.awaitJobCompletion(startResponse.getJobId()); + myBatch2JobHelper.awaitJobCompletion(startResponse.getInstanceId()); - await().until(() -> myJobRunner.getJobInfo(startResponse.getJobId()).getReport() != null); + await().until(() -> myJobRunner.getJobInfo(startResponse.getInstanceId()).getReport() != null); // Iterate over the files - String report = myJobRunner.getJobInfo(startResponse.getJobId()).getReport(); + String report = myJobRunner.getJobInfo(startResponse.getInstanceId()).getReport(); return JsonUtil.deserialize(report, BulkExportJobResults.class); } diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/config/ElasticsearchWithPrefixConfig.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/config/ElasticsearchWithPrefixConfig.java index c49b4e58257..7d93aa506e4 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/config/ElasticsearchWithPrefixConfig.java +++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/config/ElasticsearchWithPrefixConfig.java @@ -2,14 +2,13 @@ package ca.uhn.fhir.jpa.config; import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.r4.ElasticsearchPrefixTest; import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect; import ca.uhn.fhir.jpa.search.HapiHSearchAnalysisConfigurers; import ca.uhn.fhir.jpa.search.elastic.IndexNamePrefixLayoutStrategy; import ca.uhn.fhir.jpa.search.lastn.ElasticsearchRestClientFactory; import ca.uhn.fhir.jpa.test.config.BlockLargeNumbersOfParamsListener; -import ca.uhn.fhir.jpa.test.config.TestElasticsearchContainerHelper; import ca.uhn.fhir.jpa.test.config.TestHSearchAddInConfig; import ca.uhn.fhir.jpa.util.CurrentThreadCaptureQueriesListener; import net.ttddyy.dsproxy.listener.logging.SLF4JLogLevel; @@ -50,10 +49,10 @@ import java.util.concurrent.TimeUnit; public class ElasticsearchWithPrefixConfig { @Bean - public DaoConfig daoConfig() { - DaoConfig daoConfig = new DaoConfig(); - daoConfig.setHSearchIndexPrefix(ElasticsearchPrefixTest.ELASTIC_PREFIX); - return daoConfig; + public JpaStorageSettings storageSettings() { + JpaStorageSettings storageSettings = new JpaStorageSettings(); + storageSettings.setHSearchIndexPrefix(ElasticsearchPrefixTest.ELASTIC_PREFIX); + return storageSettings; } @Bean diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseR4SearchLastN.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseR4SearchLastN.java index efb76d3f6f0..c3492a08500 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseR4SearchLastN.java +++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseR4SearchLastN.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoObservation; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoPatient; import ca.uhn.fhir.jpa.config.TestR4ConfigWithElasticHSearch; @@ -109,16 +109,16 @@ abstract public class BaseR4SearchLastN extends BaseJpaTest { @AfterEach public void afterDisableLastN() { - myDaoConfig.setLastNEnabled(new DaoConfig().isLastNEnabled()); + myStorageSettings.setLastNEnabled(new JpaStorageSettings().isLastNEnabled()); } @BeforeAll public void beforeCreateTestPatientsAndObservations() throws IOException { ourLog.info("setup Patients and Observations"); - myDaoConfig.setLastNEnabled(true); + myStorageSettings.setLastNEnabled(true); // enabled to also create extended lucene index during creation of test data - boolean hsearchSaved = myDaoConfig.isAdvancedHSearchIndexing(); - myDaoConfig.setAdvancedHSearchIndexing(true); + boolean hsearchSaved = myStorageSettings.isAdvancedHSearchIndexing(); + myStorageSettings.setAdvancedHSearchIndexing(true); // Using a static flag to ensure that test data and elasticsearch index is only created once. // Creating this data and the index is time consuming and as such want to avoid having to repeat for each test. @@ -140,7 +140,7 @@ abstract public class BaseR4SearchLastN extends BaseJpaTest { myElasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_INDEX); myElasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX); // turn off the setting enabled earlier - myDaoConfig.setAdvancedHSearchIndexing(hsearchSaved); + myStorageSettings.setAdvancedHSearchIndexing(hsearchSaved); } @@ -215,7 +215,7 @@ abstract public class BaseR4SearchLastN extends BaseJpaTest { @Test public void testLastNNoPatients() { - ourLog.info("testLastNNoPatients lastn {} hsearch {}", myDaoConfig.isLastNEnabled(), myDaoConfig.isAdvancedHSearchIndexing()); + ourLog.info("testLastNNoPatients lastn {} hsearch {}", myStorageSettings.isLastNEnabled(), myStorageSettings.isAdvancedHSearchIndexing()); SearchParameterMap params = new SearchParameterMap(); diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNAsyncIT.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNAsyncIT.java index 8cd974c44c9..1e619d17e99 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNAsyncIT.java +++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNAsyncIT.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.dao.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.data.ISearchDao; import ca.uhn.fhir.jpa.entity.Search; import ca.uhn.fhir.jpa.search.builder.SearchBuilder; @@ -33,14 +33,14 @@ import static org.mockito.Mockito.when; public class FhirResourceDaoR4SearchLastNAsyncIT extends BaseR4SearchLastN { private static final Logger ourLog = LoggerFactory.getLogger(FhirResourceDaoR4SearchLastNAsyncIT.class); - @Autowired - protected DaoConfig myDaoConfig; private List originalPreFetchThresholds; @Autowired private ISearchDao mySearchDao; + @Override @BeforeEach - public void before() { + public void before() throws Exception { + super.before(); RestfulServer myServer = new RestfulServer(myFhirCtx); myServer.setPagingProvider(myDatabaseBackedPagingProvider); @@ -49,22 +49,22 @@ public class FhirResourceDaoR4SearchLastNAsyncIT extends BaseR4SearchLastN { // Set pre-fetch sizes small so that most tests are forced to do multiple fetches. // This will allow testing a common use case where result set is larger than first fetch size but smaller than the normal query chunk size. - originalPreFetchThresholds = myDaoConfig.getSearchPreFetchThresholds(); + originalPreFetchThresholds = myStorageSettings.getSearchPreFetchThresholds(); List mySmallerPreFetchThresholds = new ArrayList<>(); mySmallerPreFetchThresholds.add(20); mySmallerPreFetchThresholds.add(400); mySmallerPreFetchThresholds.add(-1); - myDaoConfig.setSearchPreFetchThresholds(mySmallerPreFetchThresholds); + myStorageSettings.setSearchPreFetchThresholds(mySmallerPreFetchThresholds); SearchBuilder.setMaxPageSize50ForTest(true); - myDaoConfig.setLastNEnabled(true); + myStorageSettings.setLastNEnabled(true); } @AfterEach public void after() { - myDaoConfig.setSearchPreFetchThresholds(originalPreFetchThresholds); + myStorageSettings.setSearchPreFetchThresholds(originalPreFetchThresholds); SearchBuilder.setMaxPageSize50ForTest(false); } @@ -101,7 +101,7 @@ public class FhirResourceDaoR4SearchLastNAsyncIT extends BaseR4SearchLastN { myBiggerPreFetchThresholds.add(100); myBiggerPreFetchThresholds.add(1000); myBiggerPreFetchThresholds.add(-1); - myDaoConfig.setSearchPreFetchThresholds(myBiggerPreFetchThresholds); + myStorageSettings.setSearchPreFetchThresholds(myBiggerPreFetchThresholds); myCaptureQueriesListener.clear(); List results = toUnqualifiedVersionlessIdValues(myObservationDao.observationsLastN(params, mockSrd(), null)); diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNIT.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNIT.java index 35dbde1ad16..f9307f1cfb2 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNIT.java +++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNIT.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.dao.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.search.builder.SearchBuilder; import ca.uhn.fhir.jpa.search.lastn.ElasticsearchSvcImpl; @@ -36,13 +36,13 @@ import static org.mockito.Mockito.when; public class FhirResourceDaoR4SearchLastNIT extends BaseR4SearchLastN { @BeforeEach public void enableAdvancedHSearchIndexing() { - myDaoConfig.setLastNEnabled(true); + myStorageSettings.setLastNEnabled(true); } @AfterEach public void reset() { SearchBuilder.setMaxPageSize50ForTest(false); - myDaoConfig.setStoreResourceInHSearchIndex(new DaoConfig().isStoreResourceInHSearchIndex()); + myStorageSettings.setStoreResourceInHSearchIndex(new JpaStorageSettings().isStoreResourceInHSearchIndex()); } @Test @@ -107,7 +107,7 @@ public class FhirResourceDaoR4SearchLastNIT extends BaseR4SearchLastN { @Test public void testLastN_onEnablingStoringObservationWithIndexMapping_shouldSkipLoadingResourceFromDB() throws IOException { // Enable flag - myDaoConfig.setStoreResourceInHSearchIndex(true); + myStorageSettings.setStoreResourceInHSearchIndex(true); // Create Data Patient pt = new Patient(); diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNUsingExtendedHSearchIndexAsyncIT.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNUsingExtendedHSearchIndexAsyncIT.java index b26c5d5aa4a..0e547dca1f7 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNUsingExtendedHSearchIndexAsyncIT.java +++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNUsingExtendedHSearchIndexAsyncIT.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.dao.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.extension.ExtendWith; @@ -15,13 +15,13 @@ public class FhirResourceDaoR4SearchLastNUsingExtendedHSearchIndexAsyncIT extend @BeforeEach public void enableAdvancedHSearchIndexing() { - myDaoConfig.setLastNEnabled(true); - myDaoConfig.setAdvancedHSearchIndexing(true); + myStorageSettings.setLastNEnabled(true); + myStorageSettings.setAdvancedHSearchIndexing(true); } @AfterEach public void disableAdvancedHSearchIndex() { - myDaoConfig.setAdvancedHSearchIndexing(new DaoConfig().isAdvancedHSearchIndexing()); + myStorageSettings.setAdvancedHSearchIndexing(new JpaStorageSettings().isAdvancedHSearchIndexing()); } } diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNUsingExtendedHSearchIndexIT.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNUsingExtendedHSearchIndexIT.java index 847a68f4171..057ed57e48e 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNUsingExtendedHSearchIndexIT.java +++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNUsingExtendedHSearchIndexIT.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.dao.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.IHSearchEventListener; import ca.uhn.fhir.jpa.test.util.TestHSearchEventDispatcher; import org.hl7.fhir.instance.model.api.IIdType; @@ -35,16 +35,16 @@ public class FhirResourceDaoR4SearchLastNUsingExtendedHSearchIndexIT extends Fhi @BeforeEach public void enableAdvancedHSearchIndexing() { - myDaoConfig.setLastNEnabled(true); - myDaoConfig.setAdvancedHSearchIndexing(true); + myStorageSettings.setLastNEnabled(true); + myStorageSettings.setAdvancedHSearchIndexing(true); myHSearchEventDispatcher.register(mySearchEventListener); - ourLog.info("enableAdvancedHSearchIndexing finished. lastn {} advancedHSearchIndexing {}", myDaoConfig.isLastNEnabled(), myDaoConfig.isAdvancedHSearchIndexing()); + ourLog.info("enableAdvancedHSearchIndexing finished. lastn {} advancedHSearchIndexing {}", myStorageSettings.isLastNEnabled(), myStorageSettings.isAdvancedHSearchIndexing()); } @AfterEach public void disableAdvancedHSearchIndex() { - myDaoConfig.setAdvancedHSearchIndexing(new DaoConfig().isAdvancedHSearchIndexing()); + myStorageSettings.setAdvancedHSearchIndexing(new JpaStorageSettings().isAdvancedHSearchIndexing()); } /** diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java index fa5b697119c..f42868e6cc9 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java +++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithElasticSearchIT.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.support.ValueSetExpansionOptions; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoValueSet; @@ -18,10 +18,8 @@ import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; import ca.uhn.fhir.jpa.entity.TermConcept; import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink; import ca.uhn.fhir.jpa.model.dao.JpaPid; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; import ca.uhn.fhir.jpa.model.entity.ResourceTable; -import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.jpa.search.CompositeSearchParameterTestCases; import ca.uhn.fhir.jpa.search.QuantitySearchParameterTestCases; import ca.uhn.fhir.jpa.search.reindex.IResourceReindexingSvc; @@ -36,6 +34,7 @@ import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.SearchTotalModeEnum; import ca.uhn.fhir.rest.api.SortSpec; import ca.uhn.fhir.rest.api.server.IBundleProvider; +import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId; import ca.uhn.fhir.rest.param.ReferenceParam; import ca.uhn.fhir.rest.param.StringOrListParam; @@ -151,8 +150,6 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirResourceDaoR4SearchWithElasticSearchIT.class); private static final String SPACE = "%20"; - @Autowired - protected DaoConfig myDaoConfig; @Autowired protected PlatformTransactionManager myTxManager; @Autowired @@ -222,7 +219,7 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl @BeforeEach public void beforePurgeDatabase() { - purgeDatabase(myDaoConfig, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); + purgeDatabase(myStorageSettings, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); } @Override @@ -247,16 +244,16 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl @BeforeEach public void enableContainsAndLucene() { - myDaoConfig.setAllowContainsSearches(true); - myDaoConfig.setAdvancedHSearchIndexing(true); + myStorageSettings.setAllowContainsSearches(true); + myStorageSettings.setAdvancedHSearchIndexing(true); } @AfterEach public void restoreContains() { - DaoConfig defaultConfig = new DaoConfig(); - myDaoConfig.setAllowContainsSearches(defaultConfig.isAllowContainsSearches()); - myDaoConfig.setAdvancedHSearchIndexing(defaultConfig.isAdvancedHSearchIndexing()); - myDaoConfig.setStoreResourceInHSearchIndex(defaultConfig.isStoreResourceInHSearchIndex()); + JpaStorageSettings defaultConfig = new JpaStorageSettings(); + myStorageSettings.setAllowContainsSearches(defaultConfig.isAllowContainsSearches()); + myStorageSettings.setAdvancedHSearchIndexing(defaultConfig.isAdvancedHSearchIndexing()); + myStorageSettings.setStoreResourceInHSearchIndex(defaultConfig.isStoreResourceInHSearchIndex()); } @Test @@ -710,7 +707,7 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl IIdType id1 = myTestDataBuilder.createObservation(List.of(myTestDataBuilder.withObservationCode("http://example.com/", "theCode"))); // set it after creating resource, so search doesn't find it in the index - myDaoConfig.setStoreResourceInHSearchIndex(true); + myStorageSettings.setStoreResourceInHSearchIndex(true); myCaptureQueriesListener.clear(); @@ -722,8 +719,8 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl assertEquals(2, myCaptureQueriesListener.getSelectQueriesForCurrentThread().size(), "JPA search for IDs and for resources"); // restore changed property - DaoConfig defaultConfig = new DaoConfig(); - myDaoConfig.setStoreResourceInHSearchIndex(defaultConfig.isStoreResourceInHSearchIndex()); + JpaStorageSettings defaultConfig = new JpaStorageSettings(); + myStorageSettings.setStoreResourceInHSearchIndex(defaultConfig.isStoreResourceInHSearchIndex()); } @Test @@ -1185,15 +1182,14 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl @BeforeEach public void enableContains() { // we don't support chained or contained yet, but turn it on to test we don't blow up. - myDaoConfig.getModelConfig().setIndexOnContainedResources(true); - myDaoConfig.getModelConfig().setIndexOnContainedResourcesRecursively(true); + myStorageSettings.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResourcesRecursively(true); } @AfterEach public void restoreContains() { - ModelConfig defaultModelConfig = new ModelConfig(); - myDaoConfig.getModelConfig().setIndexOnContainedResources(defaultModelConfig.isIndexOnContainedResources()); - myDaoConfig.getModelConfig().setIndexOnContainedResourcesRecursively(defaultModelConfig.isIndexOnContainedResourcesRecursively()); + myStorageSettings.setIndexOnContainedResources(new JpaStorageSettings().isIndexOnContainedResources()); + myStorageSettings.setIndexOnContainedResourcesRecursively(new JpaStorageSettings().isIndexOnContainedResourcesRecursively()); } /** @@ -1241,12 +1237,12 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl @BeforeEach public void enableResourceStorage() { - myDaoConfig.setStoreResourceInHSearchIndex(true); + myStorageSettings.setStoreResourceInHSearchIndex(true); } @AfterEach public void resetResourceStorage() { - myDaoConfig.setStoreResourceInHSearchIndex(new DaoConfig().isStoreResourceInHSearchIndex()); + myStorageSettings.setStoreResourceInHSearchIndex(new JpaStorageSettings().isStoreResourceInHSearchIndex()); } @@ -1396,7 +1392,7 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl @Nested class QuantityAndNormalizedQuantitySearch extends QuantitySearchParameterTestCases { QuantityAndNormalizedQuantitySearch() { - super(myTestDataBuilder.getTestDataBuilderSupport(), myTestDaoSearch, myDaoConfig); + super(myTestDataBuilder.getTestDataBuilderSupport(), myTestDaoSearch, myStorageSettings); } } @@ -1405,12 +1401,12 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl @BeforeEach public void enableResourceStorage() { - myDaoConfig.setStoreResourceInHSearchIndex(true); + myStorageSettings.setStoreResourceInHSearchIndex(true); } @AfterEach public void resetResourceStorage() { - myDaoConfig.setStoreResourceInHSearchIndex(new DaoConfig().isStoreResourceInHSearchIndex()); + myStorageSettings.setStoreResourceInHSearchIndex(new JpaStorageSettings().isStoreResourceInHSearchIndex()); } @Test @@ -1539,7 +1535,7 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl @BeforeEach public void enableResourceStorage() { - myDaoConfig.setStoreResourceInHSearchIndex(true); + myStorageSettings.setStoreResourceInHSearchIndex(true); myOldObsId = myTestDataBuilder.createObservation(List.of( myTestDataBuilder.withObservationCode("http://example.com/", "theCodeOld"), @@ -1552,7 +1548,7 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl @AfterEach public void resetResourceStorage() { - myDaoConfig.setStoreResourceInHSearchIndex(new DaoConfig().isStoreResourceInHSearchIndex()); + myStorageSettings.setStoreResourceInHSearchIndex(new JpaStorageSettings().isStoreResourceInHSearchIndex()); } @Test @@ -1653,7 +1649,7 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl @BeforeEach public void enableResourceStorage() { - myDaoConfig.setStoreResourceInHSearchIndex(true); + myStorageSettings.setStoreResourceInHSearchIndex(true); } @@ -1709,27 +1705,27 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl @BeforeEach void setUp() { - myDaoConfig.getModelConfig().setNormalizedQuantitySearchLevel( + myStorageSettings.setNormalizedQuantitySearchLevel( NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); } @BeforeEach public void enableContainsAndLucene() { - myDaoConfig.setAllowContainsSearches(true); - myDaoConfig.setAdvancedHSearchIndexing(true); - myDaoConfig.setStoreResourceInHSearchIndex(true); - myDaoConfig.getModelConfig().setNormalizedQuantitySearchLevel( + myStorageSettings.setAllowContainsSearches(true); + myStorageSettings.setAdvancedHSearchIndexing(true); + myStorageSettings.setStoreResourceInHSearchIndex(true); + myStorageSettings.setNormalizedQuantitySearchLevel( NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); } @AfterEach public void restoreContains() { - DaoConfig defaultConfig = new DaoConfig(); - myDaoConfig.setAllowContainsSearches(defaultConfig.isAllowContainsSearches()); - myDaoConfig.setAdvancedHSearchIndexing(defaultConfig.isAdvancedHSearchIndexing()); - myDaoConfig.setStoreResourceInHSearchIndex(defaultConfig.isStoreResourceInHSearchIndex()); - myDaoConfig.getModelConfig().setNormalizedQuantitySearchLevel( - defaultConfig.getModelConfig().getNormalizedQuantitySearchLevel()); + JpaStorageSettings defaultConfig = new JpaStorageSettings(); + myStorageSettings.setAllowContainsSearches(defaultConfig.isAllowContainsSearches()); + myStorageSettings.setAdvancedHSearchIndexing(defaultConfig.isAdvancedHSearchIndexing()); + myStorageSettings.setStoreResourceInHSearchIndex(defaultConfig.isStoreResourceInHSearchIndex()); + myStorageSettings.setNormalizedQuantitySearchLevel( + defaultConfig.getNormalizedQuantitySearchLevel()); } @Test @@ -2141,21 +2137,21 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl @BeforeEach public void enableContainsAndLucene() { - myDaoConfig.setAllowContainsSearches(true); - myDaoConfig.setAdvancedHSearchIndexing(true); - myDaoConfig.setStoreResourceInHSearchIndex(true); - myDaoConfig.getModelConfig().setNormalizedQuantitySearchLevel( + myStorageSettings.setAllowContainsSearches(true); + myStorageSettings.setAdvancedHSearchIndexing(true); + myStorageSettings.setStoreResourceInHSearchIndex(true); + myStorageSettings.setNormalizedQuantitySearchLevel( NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); } @AfterEach public void restoreContains() { - DaoConfig defaultConfig = new DaoConfig(); - myDaoConfig.setAllowContainsSearches(defaultConfig.isAllowContainsSearches()); - myDaoConfig.setAdvancedHSearchIndexing(defaultConfig.isAdvancedHSearchIndexing()); - myDaoConfig.setStoreResourceInHSearchIndex(defaultConfig.isStoreResourceInHSearchIndex()); - myDaoConfig.getModelConfig().setNormalizedQuantitySearchLevel( - defaultConfig.getModelConfig().getNormalizedQuantitySearchLevel()); + JpaStorageSettings defaultConfig = new JpaStorageSettings(); + myStorageSettings.setAllowContainsSearches(defaultConfig.isAllowContainsSearches()); + myStorageSettings.setAdvancedHSearchIndexing(defaultConfig.isAdvancedHSearchIndexing()); + myStorageSettings.setStoreResourceInHSearchIndex(defaultConfig.isStoreResourceInHSearchIndex()); + myStorageSettings.setNormalizedQuantitySearchLevel( + defaultConfig.getNormalizedQuantitySearchLevel()); } @Test @@ -2280,13 +2276,13 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl @BeforeEach public void setup() { - myDaoConfig.setAdvancedHSearchIndexing(true); + myStorageSettings.setAdvancedHSearchIndexing(true); } @AfterEach public void tearDown() { - DaoConfig defaultConfig = new DaoConfig(); - myDaoConfig.setAdvancedHSearchIndexing(defaultConfig.isAdvancedHSearchIndexing()); + JpaStorageSettings defaultConfig = new JpaStorageSettings(); + myStorageSettings.setAdvancedHSearchIndexing(defaultConfig.isAdvancedHSearchIndexing()); } @Test @@ -2299,7 +2295,7 @@ public class FhirResourceDaoR4SearchWithElasticSearchIT extends BaseJpaTest impl myCaptureQueriesListener.clear(); assertFindId("when exact", obsId, "/Observation?subject=" + patId.getVersionIdPartAsLong()); - assertEquals(myDaoConfig.isAdvancedHSearchIndexing() ? 1 : 2, + assertEquals(myStorageSettings.isAdvancedHSearchIndexing() ? 1 : 2, myCaptureQueriesListener.getSelectQueriesForCurrentThread().size(), "we build the bundle with no sql"); } } diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyElasticsearchIT.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyElasticsearchIT.java index f927253d212..e7cda5488c3 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyElasticsearchIT.java +++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyElasticsearchIT.java @@ -1,7 +1,6 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoCodeSystem; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoValueSet; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; @@ -55,8 +54,6 @@ public class FhirResourceDaoR4TerminologyElasticsearchIT extends BaseJpaTest { public static final String URL_MY_VALUE_SET = "http://example.com/my_value_set"; private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirResourceDaoR4TerminologyElasticsearchIT.class); - @Autowired - protected DaoConfig myDaoConfig; @Autowired @Qualifier("myCodeSystemDaoR4") protected IFhirResourceDaoCodeSystem myCodeSystemDao; @@ -155,7 +152,7 @@ public class FhirResourceDaoR4TerminologyElasticsearchIT extends BaseJpaTest { @AfterEach public void afterPurgeDatabase() { - purgeDatabase(myDaoConfig, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); + purgeDatabase(myStorageSettings, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); } @AfterAll diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/HSearchSandboxTest.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/HSearchSandboxTest.java index fc674395e2e..452217fe751 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/HSearchSandboxTest.java +++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/HSearchSandboxTest.java @@ -97,15 +97,11 @@ public class HSearchSandboxTest extends BaseJpaTest { @Qualifier("myObservationDaoR4") private IFhirResourceDao myObservationDao; -// @BeforeEach -// public void beforePurgeDatabase() { -// purgeDatabase(myDaoConfig, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); -// } @BeforeEach public void enableContainsAndLucene() { - myDaoConfig.setAllowContainsSearches(true); - myDaoConfig.setAdvancedHSearchIndexing(true); + myStorageSettings.setAllowContainsSearches(true); + myStorageSettings.setAdvancedHSearchIndexing(true); } @@ -477,18 +473,6 @@ public class HSearchSandboxTest extends BaseJpaTest { QuantityParam qtyParam = QuantityParam.toQuantityParam(theParamType); ParamPrefixEnum activePrefix = qtyParam.getPrefix() == null ? ParamPrefixEnum.EQUAL : qtyParam.getPrefix(); -// if (myModelConfig.getNormalizedQuantitySearchLevel() == NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED) { -// QuantityParam canonicalQty = UcumServiceUtil.toCanonicalQuantityOrNull(qtyParam); -// if (canonicalQty != null) { -// String valueFieldPath = fieldPath + "." + QTY_VALUE_NORM; -// setPrefixedQuantityPredicate(orQuantityTerms, activePrefix, canonicalQty, valueFieldPath); -// orQuantityTerms.must(myPredicateFactory.match() -// .field(fieldPath + "." + QTY_CODE_NORM) -// .matching(canonicalQty.getUnits())); -// return orQuantityTerms; -// } -// } - // not NORMALIZED_QUANTITY_SEARCH_SUPPORTED or non-canonicalizable parameter addQuantityTerms(theTopBool, theIsMust, activePrefix, qtyParam, fieldPath); } diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/PersistObservationIndexedSearchParamLastNR4IT.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/PersistObservationIndexedSearchParamLastNR4IT.java index 2a1ce2c8d2e..522c1e76dee 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/PersistObservationIndexedSearchParamLastNR4IT.java +++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/PersistObservationIndexedSearchParamLastNR4IT.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.config.TestR4ConfigWithElasticHSearch; import ca.uhn.fhir.jpa.dao.ObservationLastNIndexPersistSvc; @@ -85,12 +85,12 @@ public class PersistObservationIndexedSearchParamLastNR4IT { @Autowired private IFhirSystemDao myDao; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; private ReferenceAndListParam multiSubjectParams = null; @BeforeEach public void before() throws IOException { - myDaoConfig.setLastNEnabled(true); + myStorageSettings.setLastNEnabled(true); elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_INDEX); elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX); @@ -101,7 +101,7 @@ public class PersistObservationIndexedSearchParamLastNR4IT { @AfterEach public void afterDisableLastN() { - myDaoConfig.setLastNEnabled(new DaoConfig().isLastNEnabled()); + myStorageSettings.setLastNEnabled(new JpaStorageSettings().isLastNEnabled()); } @Order(0) diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ElasticTest.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ElasticTest.java index dc29984a20f..e9a2a8e6350 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ElasticTest.java +++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ElasticTest.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.provider.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.config.TestR4ConfigWithElasticHSearch; import ca.uhn.fhir.jpa.provider.BaseJpaResourceProvider; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; @@ -55,23 +55,20 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class ResourceProviderR4ElasticTest extends BaseResourceProviderR4Test { private static final Logger ourLog = LoggerFactory.getLogger(ResourceProviderR4ElasticTest.class); - @Autowired - private DaoConfig myDaoConfig; - private BaseJpaResourceProvider myObservationResourceProvider; @BeforeEach public void beforeEach() { - myDaoConfig.setLastNEnabled(true); - myDaoConfig.setAdvancedHSearchIndexing(true); - myDaoConfig.setStoreResourceInHSearchIndex(true); + myStorageSettings.setLastNEnabled(true); + myStorageSettings.setAdvancedHSearchIndexing(true); + myStorageSettings.setStoreResourceInHSearchIndex(true); } @AfterEach public void afterEach() { - myDaoConfig.setLastNEnabled(new DaoConfig().isLastNEnabled()); - myDaoConfig.setAdvancedHSearchIndexing(new DaoConfig().isAdvancedHSearchIndexing()); - myDaoConfig.setStoreResourceInHSearchIndex(new DaoConfig().isStoreResourceInHSearchIndex()); + myStorageSettings.setLastNEnabled(new JpaStorageSettings().isLastNEnabled()); + myStorageSettings.setAdvancedHSearchIndexing(new JpaStorageSettings().isAdvancedHSearchIndexing()); + myStorageSettings.setStoreResourceInHSearchIndex(new JpaStorageSettings().isStoreResourceInHSearchIndex()); } diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/autocomplete/TokenAutocompleteElasticsearchIT.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/autocomplete/TokenAutocompleteElasticsearchIT.java index 0b47e056784..bb9573636b7 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/autocomplete/TokenAutocompleteElasticsearchIT.java +++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/autocomplete/TokenAutocompleteElasticsearchIT.java @@ -1,14 +1,13 @@ package ca.uhn.fhir.jpa.search.autocomplete; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc; import ca.uhn.fhir.jpa.bulk.export.api.IBulkDataExportJobSchedulingHelper; import ca.uhn.fhir.jpa.config.TestR4ConfigWithElasticHSearch; import ca.uhn.fhir.jpa.dao.TestDaoSearch; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.search.reindex.IResourceReindexingSvc; import ca.uhn.fhir.jpa.sp.ISearchParamPresenceSvc; import ca.uhn.fhir.jpa.test.BaseJpaTest; @@ -71,8 +70,6 @@ public class TokenAutocompleteElasticsearchIT extends BaseJpaTest { @Autowired protected EntityManager myEntityManager; @Autowired - protected DaoConfig myDaoConfig; - @Autowired protected ISearchParamPresenceSvc mySearchParamPresenceSvc; @Autowired protected ISearchCoordinatorSvc mySearchCoordinatorSvc; @@ -87,23 +84,20 @@ public class TokenAutocompleteElasticsearchIT extends BaseJpaTest { @Autowired ITestDataBuilder myDataBuilder; - @Autowired - private ModelConfig myModelConfig; - // a few different codes static final Coding mean_blood_pressure = new Coding("http://loinc.org", "8478-0", "Mean blood pressure"); static final Coding gram_positive_culture = new Coding("http://loinc.org", "88262-1", "Gram positive blood culture panel by Probe in Positive blood culture"); @BeforeEach public void beforePurgeDatabase() { - BaseJpaTest.purgeDatabase(myDaoConfig, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); - myDaoConfig.setAdvancedHSearchIndexing(true); + BaseJpaTest.purgeDatabase(myStorageSettings, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); + myStorageSettings.setAdvancedHSearchIndexing(true); } @AfterEach void resetConfig() { - DaoConfig defaultConfig = new DaoConfig(); - myDaoConfig.setAdvancedHSearchIndexing(defaultConfig.isAdvancedHSearchIndexing()); + JpaStorageSettings defaultConfig = new JpaStorageSettings(); + myStorageSettings.setAdvancedHSearchIndexing(defaultConfig.isAdvancedHSearchIndexing()); } @Override @@ -195,7 +189,7 @@ public class TokenAutocompleteElasticsearchIT extends BaseJpaTest { List autocompleteSearch(String theResourceType, String theSPName, String theModifier, String theSearchText) { return new TransactionTemplate(myTxManager).execute(s -> { - TokenAutocompleteSearch tokenAutocompleteSearch = new TokenAutocompleteSearch(myFhirCtx, myModelConfig, Search.session(myEntityManager)); + TokenAutocompleteSearch tokenAutocompleteSearch = new TokenAutocompleteSearch(myFhirCtx, myStorageSettings, Search.session(myEntityManager)); return tokenAutocompleteSearch.search(theResourceType, theSPName, theSearchText, theModifier,30); }); } diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteOptionsTest.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteOptionsTest.java index 1dbd39fe2cd..fa840d18ae3 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteOptionsTest.java +++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteOptionsTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.search.autocomplete; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.IntegerDt; import ca.uhn.fhir.model.primitive.StringDt; @@ -36,10 +36,10 @@ class ValueSetAutocompleteOptionsTest { private IPrimitiveType myUrl; private ValueSet myValueSet; private ValueSetAutocompleteOptions myOptionsResult; - final private DaoConfig myDaoConfig = new DaoConfig(); + final private JpaStorageSettings myStorageSettings = new JpaStorageSettings(); { - myDaoConfig.setAdvancedHSearchIndexing(true); + myStorageSettings.setAdvancedHSearchIndexing(true); } @Test @@ -170,7 +170,7 @@ class ValueSetAutocompleteOptionsTest { @Test public void whenAdvancedIndexingOff() { // given - myDaoConfig.setAdvancedHSearchIndexing(false); + myStorageSettings.setAdvancedHSearchIndexing(false); assertParseThrowsInvalidRequestWithErrorCode(ERROR_REQUIRES_EXTENDED_INDEXING); } @@ -184,7 +184,7 @@ class ValueSetAutocompleteOptionsTest { } void parseOptions() { - myOptionsResult = ValueSetAutocompleteOptions.validateAndParseOptions(myDaoConfig, myContext, myFilter, myCount, myId, myUrl, myValueSet); + myOptionsResult = ValueSetAutocompleteOptions.validateAndParseOptions(myStorageSettings, myContext, myFilter, myCount, myId, myUrl, myValueSet); } } diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteSearchTest.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteSearchTest.java index 78a932829a0..3bf987009a5 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteSearchTest.java +++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteSearchTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.search.autocomplete; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import org.hl7.fhir.r4.model.ValueSet; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -14,8 +14,8 @@ import static org.hamcrest.Matchers.nullValue; class ValueSetAutocompleteSearchTest { FhirContext myFhirContext = FhirContext.forR4(); - private ModelConfig myModelConfig; - ValueSetAutocompleteSearch myValueSetAutocompleteSearch = new ValueSetAutocompleteSearch(myFhirContext, myModelConfig, null); + private StorageSettings myStorageSettings; + ValueSetAutocompleteSearch myValueSetAutocompleteSearch = new ValueSetAutocompleteSearch(myFhirContext, myStorageSettings, null); @Nested public class HitToValueSetConversion { diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/term/ValueSetExpansionR4ElasticsearchIT.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/term/ValueSetExpansionR4ElasticsearchIT.java index 10341210003..3760a18cdbb 100644 --- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/term/ValueSetExpansionR4ElasticsearchIT.java +++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/term/ValueSetExpansionR4ElasticsearchIT.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.term; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoCodeSystem; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoValueSet; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; @@ -17,13 +17,13 @@ import ca.uhn.fhir.jpa.entity.TermValueSet; import ca.uhn.fhir.jpa.entity.TermValueSetPreExpansionStatusEnum; import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.model.entity.ResourceTable; -import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.jpa.search.reindex.IResourceReindexingSvc; import ca.uhn.fhir.jpa.term.api.ITermCodeSystemStorageSvc; import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc; import ca.uhn.fhir.jpa.term.api.ITermReadSvc; import ca.uhn.fhir.jpa.term.custom.CustomTerminologySet; import ca.uhn.fhir.jpa.test.BaseJpaTest; +import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; @@ -72,8 +72,6 @@ public class ValueSetExpansionR4ElasticsearchIT extends BaseJpaTest { protected static final String CS_URL = "http://example.com/my_code_system"; @Autowired - protected DaoConfig myDaoConfig; - @Autowired @Qualifier("myCodeSystemDaoR4") protected IFhirResourceDaoCodeSystem myCodeSystemDao; @Autowired @@ -115,12 +113,12 @@ public class ValueSetExpansionR4ElasticsearchIT extends BaseJpaTest { @AfterEach public void after() { - myDaoConfig.setMaximumExpansionSize(DaoConfig.DEFAULT_MAX_EXPANSION_SIZE); + myStorageSettings.setMaximumExpansionSize(JpaStorageSettings.DEFAULT_MAX_EXPANSION_SIZE); } @AfterEach public void afterPurgeDatabase() { - purgeDatabase(myDaoConfig, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataExportJobSchedulingHelper); + purgeDatabase(myStorageSettings, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataExportJobSchedulingHelper); } void createCodeSystem() { @@ -188,7 +186,7 @@ public class ValueSetExpansionR4ElasticsearchIT extends BaseJpaTest { // Codes available exceeds the max - myDaoConfig.setMaximumExpansionSize(50); + myStorageSettings.setMaximumExpansionSize(50); ValueSet vs = new ValueSet(); ValueSet.ConceptSetComponent include = vs.getCompose().addInclude(); include.setSystem(CS_URL); @@ -200,7 +198,7 @@ public class ValueSetExpansionR4ElasticsearchIT extends BaseJpaTest { } // Increase the max so it won't exceed - myDaoConfig.setMaximumExpansionSize(150); + myStorageSettings.setMaximumExpansionSize(150); vs = new ValueSet(); include = vs.getCompose().addInclude(); include.setSystem(CS_URL); @@ -325,10 +323,10 @@ public class ValueSetExpansionR4ElasticsearchIT extends BaseJpaTest { int valuesPerPropKey = thePropertiesCount / thePropertyKeysCount; int propsCreated = 0; - while(propsCreated < thePropertiesCount) { + while (propsCreated < thePropertiesCount) { int propKeysCreated = 0; - while(propKeysCreated < thePropertyKeysCount && propsCreated < thePropertiesCount) { + while (propKeysCreated < thePropertyKeysCount && propsCreated < thePropertiesCount) { String propKey = String.format("%05d", propKeysCreated); String propSeq = String.format("%05d", propsCreated); theTermConcept.addPropertyString("prop-key-" + propKey, "value-" + propSeq); diff --git a/hapi-fhir-jpaserver-ips/pom.xml b/hapi-fhir-jpaserver-ips/pom.xml index 740f7a310fc..f448ee6a1fa 100644 --- a/hapi-fhir-jpaserver-ips/pom.xml +++ b/hapi-fhir-jpaserver-ips/pom.xml @@ -3,7 +3,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-ips/src/test/java/ca/uhn/fhir/jpa/ips/generator/IpsGenerationTest.java b/hapi-fhir-jpaserver-ips/src/test/java/ca/uhn/fhir/jpa/ips/generator/IpsGenerationTest.java index f8d7d76ec1b..64e48248ec6 100644 --- a/hapi-fhir-jpaserver-ips/src/test/java/ca/uhn/fhir/jpa/ips/generator/IpsGenerationTest.java +++ b/hapi-fhir-jpaserver-ips/src/test/java/ca/uhn/fhir/jpa/ips/generator/IpsGenerationTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.ips.generator; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.ips.api.IIpsGenerationStrategy; import ca.uhn.fhir.jpa.ips.provider.IpsOperationProvider; @@ -49,7 +49,7 @@ public class IpsGenerationTest extends BaseResourceProviderR4Test { @AfterEach public void afterEach() { myServer.withServer(t -> t.unregisterProvider(myIpsOperationProvider)); - myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ALPHANUMERIC); + myStorageSettings.setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.ALPHANUMERIC); } @@ -85,7 +85,7 @@ public class IpsGenerationTest extends BaseResourceProviderR4Test { @Test public void testGenerateTinyPatientSummary() { - myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ANY); + myStorageSettings.setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.ANY); Bundle sourceData = ClasspathUtil.loadCompressedResource(myFhirContext, Bundle.class, "/tiny-patient-everything.json.gz"); sourceData.setType(Bundle.BundleType.TRANSACTION); diff --git a/hapi-fhir-jpaserver-mdm/pom.xml b/hapi-fhir-jpaserver-mdm/pom.xml index 12efcf662ff..aa8b77635bd 100644 --- a/hapi-fhir-jpaserver-mdm/pom.xml +++ b/hapi-fhir-jpaserver-mdm/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmControllerSvcImpl.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmControllerSvcImpl.java index 57093c633d3..5440057bd78 100644 --- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmControllerSvcImpl.java +++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/svc/MdmControllerSvcImpl.java @@ -217,7 +217,7 @@ public class MdmControllerSvcImpl implements IMdmControllerSvc { request.setJobDefinitionId(MdmClearAppCtx.JOB_MDM_CLEAR); request.setParameters(params); Batch2JobStartResponse response = myJobCoordinator.startInstance(request); - String id = response.getJobId(); + String id = response.getInstanceId(); IBaseParameters retVal = ParametersUtil.newInstance(myFhirContext); ParametersUtil.addParameterToParametersString(myFhirContext, retVal, ProviderConstants.OPERATION_BATCH_RESPONSE_JOB_ID, id); @@ -241,7 +241,7 @@ public class MdmControllerSvcImpl implements IMdmControllerSvc { request.setJobDefinitionId(MdmSubmitAppCtx.MDM_SUBMIT_JOB); Batch2JobStartResponse batch2JobStartResponse = myJobCoordinator.startInstance(request); - String id = batch2JobStartResponse.getJobId(); + String id = batch2JobStartResponse.getInstanceId(); IBaseParameters retVal = ParametersUtil.newInstance(myFhirContext); ParametersUtil.addParameterToParametersString(myFhirContext, retVal, ProviderConstants.OPERATION_BATCH_RESPONSE_JOB_ID, id); diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmExpungeTest.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmExpungeTest.java index 628b7a6ffb4..a1778c89fc5 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmExpungeTest.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmExpungeTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.mdm.interceptor; import ca.uhn.fhir.interceptor.api.IInterceptorService; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.entity.MdmLink; import ca.uhn.fhir.jpa.mdm.BaseMdmR4Test; @@ -28,15 +28,15 @@ public class MdmExpungeTest extends BaseMdmR4Test { IInterceptorService myInterceptorService; @Autowired IMdmStorageInterceptor myMdmStorageInterceptor; - @Autowired - DaoConfig myDaoConfig; private ResourceTable myTargetEntity; private ResourceTable mySourceEntity; private IdDt myTargetId; + @Override @BeforeEach - public void before() { - myDaoConfig.setExpungeEnabled(true); + public void before() throws Exception { + super.before(); + myStorageSettings.setExpungeEnabled(true); myTargetEntity = (ResourceTable) myPatientDao.create(new Patient()).getEntity(); myTargetId = myTargetEntity.getIdDt().toVersionless(); diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmSearchExpandingInterceptorIT.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmSearchExpandingInterceptorIT.java index c2d0aca065e..8e60678d180 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmSearchExpandingInterceptorIT.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmSearchExpandingInterceptorIT.java @@ -1,6 +1,5 @@ package ca.uhn.fhir.jpa.mdm.interceptor; -import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoPatient; import ca.uhn.fhir.jpa.api.dao.PatientEverythingParameters; import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; @@ -49,16 +48,14 @@ public class MdmSearchExpandingInterceptorIT extends BaseMdmR4Test { @RegisterExtension @Autowired public MdmHelperR4 myMdmHelper; - @Autowired - private DaoConfig myDaoConfig; /** * creates a GoldenPatient * a number of patients, * and Observations for each created patient. - * + *

* Returns a list of stringified ids for the various resources. - * + *

* Currently, order of returned resources is patientids first, * observation ids next. But this can be refined as needed. * @@ -66,8 +63,8 @@ public class MdmSearchExpandingInterceptorIT extends BaseMdmR4Test { * @return */ private List createAndLinkNewResources(int theResourceCount) throws InterruptedException { - boolean expansion = myDaoConfig.isAllowMdmExpansion(); - myDaoConfig.setAllowMdmExpansion(false); + boolean expansion = myStorageSettings.isAllowMdmExpansion(); + myStorageSettings.setAllowMdmExpansion(false); List createdResourceIds = new ArrayList<>(); List observationIds = new ArrayList<>(); @@ -89,13 +86,13 @@ public class MdmSearchExpandingInterceptorIT extends BaseMdmR4Test { // add in our observationIds createdResourceIds.addAll(observationIds); - myDaoConfig.setAllowMdmExpansion(expansion); + myStorageSettings.setAllowMdmExpansion(expansion); return createdResourceIds; } private List updateAndLinkNewResources(int theResourceCount) throws InterruptedException { - boolean expansion = myDaoConfig.isAllowMdmExpansion(); - myDaoConfig.setAllowMdmExpansion(false); + boolean expansion = myStorageSettings.isAllowMdmExpansion(); + myStorageSettings.setAllowMdmExpansion(false); List createdResourceIds = new ArrayList<>(); List observationIds = new ArrayList<>(); @@ -119,7 +116,7 @@ public class MdmSearchExpandingInterceptorIT extends BaseMdmR4Test { // add in our observationIds createdResourceIds.addAll(observationIds); - myDaoConfig.setAllowMdmExpansion(expansion); + myStorageSettings.setAllowMdmExpansion(expansion); return createdResourceIds; } @@ -137,12 +134,12 @@ public class MdmSearchExpandingInterceptorIT extends BaseMdmR4Test { searchParameterMap.add(Observation.SP_SUBJECT, referenceOrListParam); //With MDM Expansion disabled, this should return 1 result. - myDaoConfig.setAllowMdmExpansion(false); + myStorageSettings.setAllowMdmExpansion(false); IBundleProvider search = myObservationDao.search(searchParameterMap); assertThat(search.size(), is(equalTo(1))); //Once MDM Expansion is allowed, this should now return 4 resourecs. - myDaoConfig.setAllowMdmExpansion(true); + myStorageSettings.setAllowMdmExpansion(true); search = myObservationDao.search(searchParameterMap); assertThat(search.size(), is(equalTo(4))); List all = myMdmLinkDao.findAll(); @@ -159,6 +156,7 @@ public class MdmSearchExpandingInterceptorIT extends BaseMdmR4Test { search = myObservationDao.search(goldenSpMap); assertThat(search.size(), is(equalTo(resourceCount))); } + @Test public void testReferenceExpansionWorks() throws InterruptedException { int resourceCount = 4; @@ -172,12 +170,12 @@ public class MdmSearchExpandingInterceptorIT extends BaseMdmR4Test { searchParameterMap.add(Observation.SP_SUBJECT, referenceOrListParam); //With MDM Expansion disabled, this should return 1 result. - myDaoConfig.setAllowMdmExpansion(false); + myStorageSettings.setAllowMdmExpansion(false); IBundleProvider search = myObservationDao.search(searchParameterMap); assertThat(search.size(), is(equalTo(1))); //Once MDM Expansion is allowed, this should now return 4 resourecs. - myDaoConfig.setAllowMdmExpansion(true); + myStorageSettings.setAllowMdmExpansion(true); search = myObservationDao.search(searchParameterMap); assertThat(search.size(), is(equalTo(4))); List all = myMdmLinkDao.findAll(); @@ -201,7 +199,7 @@ public class MdmSearchExpandingInterceptorIT extends BaseMdmR4Test { List expectedIds = createAndLinkNewResources(resourceCount); String patientId = expectedIds.get(0); - myDaoConfig.setAllowMdmExpansion(true); + myStorageSettings.setAllowMdmExpansion(true); SearchParameterMap map = new SearchParameterMap(); TokenOrListParam orListParam = new TokenOrListParam(); @@ -231,7 +229,7 @@ public class MdmSearchExpandingInterceptorIT extends BaseMdmR4Test { String id = expectedIds.get(0); HashMap queryParameters = new HashMap<>(); - queryParameters.put("_mdm", new String[] { "true" }); + queryParameters.put("_mdm", new String[]{"true"}); HttpServletRequest req = Mockito.mock(HttpServletRequest.class); RequestDetails theDetails = Mockito.mock(RequestDetails.class); @@ -240,12 +238,12 @@ public class MdmSearchExpandingInterceptorIT extends BaseMdmR4Test { .thenReturn(queryParameters); // test - myDaoConfig.setAllowMdmExpansion(true); + myStorageSettings.setAllowMdmExpansion(true); IFhirResourceDaoPatient dao = (IFhirResourceDaoPatient) myPatientDao; IBundleProvider outcome = dao.patientInstanceEverything( - req, - theDetails, new PatientEverythingParameters(), new IdDt(id) - ); + req, + theDetails, new PatientEverythingParameters(), new IdDt(id) + ); // verify return results // we expect all the linked ids to be returned too @@ -260,7 +258,7 @@ public class MdmSearchExpandingInterceptorIT extends BaseMdmR4Test { @Test public void testReferenceExpansionQuietlyFailsOnMissingMdmMatches() { - myDaoConfig.setAllowMdmExpansion(true); + myStorageSettings.setAllowMdmExpansion(true); Patient patient = buildJanePatient(); patient.getMeta().addTag(MdmConstants.SYSTEM_MDM_MANAGED, MdmConstants.CODE_NO_MDM_MANAGED, "Don't MDM on me!"); DaoMethodOutcome daoMethodOutcome = myMdmHelper.doCreateResource(patient, true); diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseLinkR4Test.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseLinkR4Test.java index 36ea4c994da..cc487ee066c 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseLinkR4Test.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseLinkR4Test.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.mdm.provider; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.entity.MdmLink; import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.mdm.api.IMdmLink; @@ -25,9 +25,6 @@ public abstract class BaseLinkR4Test extends BaseProviderR4Test { protected static final StringType POSSIBLE_MATCH_RESULT = new StringType(MdmMatchResultEnum.POSSIBLE_MATCH.name()); protected static final StringType POSSIBLE_DUPLICATE_RESULT = new StringType(MdmMatchResultEnum.POSSIBLE_DUPLICATE.name()); - @Autowired - DaoConfig myDaoConfig; - protected Patient myPatient; protected IAnyResource mySourcePatient; protected MdmLink myLink; @@ -52,15 +49,15 @@ public abstract class BaseLinkR4Test extends BaseProviderR4Test { myLink.setMatchResult(MdmMatchResultEnum.POSSIBLE_MATCH); saveLink(myLink); assertEquals(MdmLinkSourceEnum.AUTO, myLink.getLinkSource()); - myDaoConfig.setExpungeEnabled(true); - myDaoConfig.setAllowMultipleDelete(true); - myDaoConfig.setDeleteExpungeEnabled(true); + myStorageSettings.setExpungeEnabled(true); + myStorageSettings.setAllowMultipleDelete(true); + myStorageSettings.setDeleteExpungeEnabled(true); } @Override @AfterEach public void after() throws IOException { - myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled()); + myStorageSettings.setExpungeEnabled(new JpaStorageSettings().isExpungeEnabled()); myPartitionSettings.setPartitioningEnabled(new PartitionSettings().isPartitioningEnabled()); super.after(); } diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/MdmProviderClearLinkR4Test.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/MdmProviderClearLinkR4Test.java index 59188cb2ad8..8bfd440dcf1 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/MdmProviderClearLinkR4Test.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/MdmProviderClearLinkR4Test.java @@ -35,6 +35,7 @@ public class MdmProviderClearLinkR4Test extends BaseLinkR4Test { protected IAnyResource myPractitionerGoldenResource; protected StringType myPractitionerGoldenResourceId; + @Override @BeforeEach public void before() throws Exception { super.before(); diff --git a/hapi-fhir-jpaserver-model/pom.xml b/hapi-fhir-jpaserver-model/pom.xml index 991fef9b60a..a77c5d691cc 100644 --- a/hapi-fhir-jpaserver-model/pom.xml +++ b/hapi-fhir-jpaserver-model/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiSequenceStyleGenerator.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiSequenceStyleGenerator.java index d88ce9b3935..f3465520aa9 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiSequenceStyleGenerator.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiSequenceStyleGenerator.java @@ -20,33 +20,26 @@ package ca.uhn.fhir.jpa.model.dialect; * #L% */ -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.util.ReflectionUtil; import org.apache.commons.lang3.Validate; import org.hibernate.HibernateException; import org.hibernate.MappingException; import org.hibernate.boot.model.relational.Database; import org.hibernate.boot.model.relational.SqlStringGenerationContext; -import org.hibernate.boot.registry.StandardServiceInitiator; -import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.id.BulkInsertionCapableIdentifierGenerator; import org.hibernate.id.IdentifierGenerator; import org.hibernate.id.PersistentIdentifierGenerator; import org.hibernate.id.enhanced.SequenceStyleGenerator; import org.hibernate.id.enhanced.StandardOptimizerDescriptor; -import org.hibernate.service.Service; import org.hibernate.service.ServiceRegistry; -import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.type.Type; import org.springframework.beans.factory.annotation.Autowired; import java.io.Serializable; -import java.util.Map; import java.util.Properties; -import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; - /** * This is a sequence generator that wraps the Hibernate default sequence generator {@link SequenceStyleGenerator} * and by default will therefore work exactly as the default would, but allows for customization. @@ -55,7 +48,7 @@ import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; public class HapiSequenceStyleGenerator implements IdentifierGenerator, PersistentIdentifierGenerator, BulkInsertionCapableIdentifierGenerator { private final SequenceStyleGenerator myGen = new SequenceStyleGenerator(); @Autowired - private ModelConfig myModelConfig; + private StorageSettings myStorageSettings; private ISequenceValueMassager myIdMassager; private boolean myConfigured; private String myGeneratorName; @@ -80,9 +73,9 @@ public class HapiSequenceStyleGenerator implements IdentifierGenerator, Persiste public void configure(Type theType, Properties theParams, ServiceRegistry theServiceRegistry) throws MappingException { // Instantiate the ID massager - // ModelConfig should only be null when running in the DDL generation maven plugin - if (myModelConfig != null) { - myIdMassager = ReflectionUtil.newInstance(myModelConfig.getSequenceValueMassagerClass()); + // StorageSettings should only be null when running in the DDL generation maven plugin + if (myStorageSettings != null) { + myIdMassager = ReflectionUtil.newInstance(myStorageSettings.getSequenceValueMassagerClass()); } // Create a HAPI FHIR sequence style generator diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndexedSearchParam.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndexedSearchParam.java index b1e9a363b82..36f65380a0a 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndexedSearchParam.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndexedSearchParam.java @@ -82,7 +82,7 @@ public abstract class BaseResourceIndexedSearchParam extends BaseResourceIndex { private transient PartitionSettings myPartitionSettings; @Transient - private transient ModelConfig myModelConfig; + private transient StorageSettings myStorageSettings; @Override public abstract Long getId(); @@ -111,7 +111,7 @@ public abstract class BaseResourceIndexedSearchParam extends BaseResourceIndex { myMissing = source.myMissing; myParamName = source.myParamName; myUpdated = source.myUpdated; - myModelConfig = source.myModelConfig; + myStorageSettings = source.myStorageSettings; myPartitionSettings = source.myPartitionSettings; setPartitionId(source.getPartitionId()); } @@ -160,12 +160,12 @@ public abstract class BaseResourceIndexedSearchParam extends BaseResourceIndex { return this; } - public ModelConfig getModelConfig() { - return myModelConfig; + public StorageSettings getStorageSettings() { + return myStorageSettings; } - public BaseResourceIndexedSearchParam setModelConfig(ModelConfig theModelConfig) { - myModelConfig = theModelConfig; + public BaseResourceIndexedSearchParam setStorageSettings(StorageSettings theStorageSettings) { + myStorageSettings = theStorageSettings; return this; } diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamString.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamString.java index fc4a7e05b3d..f3348d114ed 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamString.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamString.java @@ -108,9 +108,9 @@ public class ResourceIndexedSearchParamString extends BaseResourceIndexedSearchP super(); } - public ResourceIndexedSearchParamString(PartitionSettings thePartitionSettings, ModelConfig theModelConfig, String theResourceType, String theParamName, String theValueNormalized, String theValueExact) { + public ResourceIndexedSearchParamString(PartitionSettings thePartitionSettings, StorageSettings theStorageSettings, String theResourceType, String theParamName, String theValueNormalized, String theValueExact) { setPartitionSettings(thePartitionSettings); - setModelConfig(theModelConfig); + setStorageSettings(theStorageSettings); setResourceType(theResourceType); setParamName(theParamName); setValueNormalized(theValueNormalized); @@ -147,7 +147,7 @@ public class ResourceIndexedSearchParamString extends BaseResourceIndexedSearchP String paramName = getParamName(); String valueNormalized = getValueNormalized(); String valueExact = getValueExact(); - setHashNormalizedPrefix(calculateHashNormalized(getPartitionSettings(), getPartitionId(), getModelConfig(), resourceType, paramName, valueNormalized)); + setHashNormalizedPrefix(calculateHashNormalized(getPartitionSettings(), getPartitionId(), getStorageSettings(), resourceType, paramName, valueNormalized)); setHashExact(calculateHashExact(getPartitionSettings(), getPartitionId(), resourceType, paramName, valueExact)); setHashIdentity(calculateHashIdentity(getPartitionSettings(), getPartitionId(), resourceType, paramName)); } @@ -282,12 +282,12 @@ public class ResourceIndexedSearchParamString extends BaseResourceIndexedSearchP return hash(thePartitionSettings, theRequestPartitionId, theResourceType, theParamName, theValueExact); } - public static long calculateHashNormalized(PartitionSettings thePartitionSettings, PartitionablePartitionId theRequestPartitionId, ModelConfig theModelConfig, String theResourceType, String theParamName, String theValueNormalized) { + public static long calculateHashNormalized(PartitionSettings thePartitionSettings, PartitionablePartitionId theRequestPartitionId, StorageSettings theStorageSettings, String theResourceType, String theParamName, String theValueNormalized) { RequestPartitionId requestPartitionId = PartitionablePartitionId.toRequestPartitionId(theRequestPartitionId); - return calculateHashNormalized(thePartitionSettings, requestPartitionId, theModelConfig, theResourceType, theParamName, theValueNormalized); + return calculateHashNormalized(thePartitionSettings, requestPartitionId, theStorageSettings, theResourceType, theParamName, theValueNormalized); } - public static long calculateHashNormalized(PartitionSettings thePartitionSettings, RequestPartitionId theRequestPartitionId, ModelConfig theModelConfig, String theResourceType, String theParamName, String theValueNormalized) { + public static long calculateHashNormalized(PartitionSettings thePartitionSettings, RequestPartitionId theRequestPartitionId, StorageSettings theStorageSettings, String theResourceType, String theParamName, String theValueNormalized) { /* * If we're not allowing contained searches, we'll add the first * bit of the normalized value to the hash. This helps to @@ -295,7 +295,7 @@ public class ResourceIndexedSearchParamString extends BaseResourceIndexedSearchP * performance. */ int hashPrefixLength = HASH_PREFIX_LENGTH; - if (theModelConfig.isAllowContainsSearches()) { + if (theStorageSettings.isAllowContainsSearches()) { hashPrefixLength = 0; } diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ModelConfig.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/StorageSettings.java similarity index 78% rename from hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ModelConfig.java rename to hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/StorageSettings.java index 38293b14afa..9591becee61 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ModelConfig.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/StorageSettings.java @@ -25,6 +25,7 @@ import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.jpa.model.dialect.ISequenceValueMassager; import ca.uhn.fhir.model.api.TemporalPrecisionEnum; import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc; +import ca.uhn.fhir.util.HapiExtensions; import com.google.common.annotations.VisibleForTesting; import org.apache.commons.lang3.Validate; import org.hl7.fhir.dstu2.model.Subscription; @@ -41,9 +42,13 @@ import java.util.Set; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; -// TODO: move this to ca.uhn.fhir.jpa.model.config -public class ModelConfig { - +public class StorageSettings { + /** + * @since 5.6.0 + */ + // Thread Pool size used by batch in bundle + public static final int DEFAULT_BUNDLE_BATCH_POOL_SIZE = 20; // 1 for single thread + public static final int DEFAULT_BUNDLE_BATCH_MAX_POOL_SIZE = 100; // 1 for single thread /** * Default {@link #getTreatReferencesAsLogical() logical URL bases}. Includes the following * values: @@ -54,9 +59,7 @@ public class ModelConfig { * */ public static final Set DEFAULT_LOGICAL_BASE_URLS = Collections.unmodifiableSet(new HashSet<>(Arrays.asList("http://hl7.org/fhir/ValueSet/*", "http://hl7.org/fhir/CodeSystem/*", "http://hl7.org/fhir/valueset-*", "http://hl7.org/fhir/codesystem-*", "http://hl7.org/fhir/StructureDefinition/*"))); - public static final String DEFAULT_WEBSOCKET_CONTEXT_PATH = "/websocket"; - /* *

* Note the following database documented limitations: @@ -71,6 +74,7 @@ public class ModelConfig { */ protected static final String DEFAULT_PERIOD_INDEX_START_OF_TIME = "1001-01-01"; protected static final String DEFAULT_PERIOD_INDEX_END_OF_TIME = "9000-01-01"; + private static final Integer DEFAULT_MAXIMUM_TRANSACTION_BUNDLE_SIZE = null; /** * update setter javadoc if default changes */ @@ -80,7 +84,235 @@ public class ModelConfig { private Set myTreatReferencesAsLogical = new HashSet<>(DEFAULT_LOGICAL_BASE_URLS); private boolean myDefaultSearchParamsCanBeOverridden = true; private Set mySupportedSubscriptionTypes = new HashSet<>(); - private boolean myCrossPartitionSubscription = false; + private boolean myAutoCreatePlaceholderReferenceTargets; + private boolean myCrossPartitionSubscriptionEnabled = false; + private Integer myBundleBatchPoolSize = DEFAULT_BUNDLE_BATCH_POOL_SIZE; + private Integer myBundleBatchMaxPoolSize = DEFAULT_BUNDLE_BATCH_MAX_POOL_SIZE; + private boolean myEnableInMemorySubscriptionMatching = true; + private boolean myTriggerSubscriptionsForNonVersioningChanges; + private boolean myMassIngestionMode; + private Integer myMaximumTransactionBundleSize = DEFAULT_MAXIMUM_TRANSACTION_BUNDLE_SIZE; + private boolean myNormalizeTerminologyForBulkExportJobs = false; + private String myEmailFromAddress = "noreply@unknown.com"; + private String myWebsocketContextPath = DEFAULT_WEBSOCKET_CONTEXT_PATH; + /** + * Update setter javadoc if default changes. + */ + private boolean myUseOrdinalDatesForDayPrecisionSearches = true; + private boolean mySuppressStringIndexingInTokens = false; + private Class mySequenceValueMassagerClass; + private IPrimitiveType myPeriodIndexStartOfTime; + private IPrimitiveType myPeriodIndexEndOfTime; + private NormalizedQuantitySearchLevel myNormalizedQuantitySearchLevel; + private Set myAutoVersionReferenceAtPaths = Collections.emptySet(); + private Map> myTypeToAutoVersionReferenceAtPaths = Collections.emptyMap(); + private boolean myRespectVersionsForSearchIncludes; + private boolean myIndexOnContainedResources = false; + private boolean myIndexOnContainedResourcesRecursively = false; + private boolean myAllowMdmExpansion = false; + private boolean myAutoSupportDefaultSearchParams = true; + private boolean myIndexIdentifierOfType = false; + /** + * Since 6.4.0 + */ + private boolean myQualifySubscriptionMatchingChannelName = true; + + /** + * Constructor + */ + public StorageSettings() { + setSequenceValueMassagerClass(ISequenceValueMassager.NoopSequenceValueMassager.class); + setPeriodIndexStartOfTime(new DateTimeType(DEFAULT_PERIOD_INDEX_START_OF_TIME)); + setPeriodIndexEndOfTime(new DateTimeType(DEFAULT_PERIOD_INDEX_END_OF_TIME)); + setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); + } + + /** + * When creating or updating a resource: If this property is set to true + * (default is false), if the resource has a reference to another resource + * on the local server but that reference does not exist, a placeholder resource will be + * created. + *

+ * In other words, if an observation with subject Patient/FOO is created, but + * there is no resource called Patient/FOO on the server, this property causes + * an empty patient with ID "FOO" to be created in order to prevent this operation + * from failing. + *

+ *

+ * This property can be useful in cases where replication between two servers is wanted. + * Note however that references containing purely numeric IDs will not be auto-created + * as they are never allowed to be client supplied in HAPI FHIR JPA. + *

+ * All placeholder resources created in this way have an extension + * with the URL {@link HapiExtensions#EXT_RESOURCE_PLACEHOLDER} and the value "true". + *

+ */ + public boolean isAutoCreatePlaceholderReferenceTargets() { + return myAutoCreatePlaceholderReferenceTargets; + } + + /** + * When creating or updating a resource: If this property is set to true + * (default is false), if the resource has a reference to another resource + * on the local server but that reference does not exist, a placeholder resource will be + * created. + *

+ * In other words, if an observation with subject Patient/FOO is created, but + * there is no resource called Patient/FOO on the server, this property causes + * an empty patient with ID "FOO" to be created in order to prevent this operation + * from failing. + *

+ *

+ * This property can be useful in cases where replication between two servers is wanted. + * Note however that references containing purely numeric IDs will not be auto-created + * as they are never allowed to be client supplied in HAPI FHIR JPA. + *

+ * All placeholder resources created in this way have an extension + * with the URL {@link HapiExtensions#EXT_RESOURCE_PLACEHOLDER} and the value "true". + *

+ */ + public void setAutoCreatePlaceholderReferenceTargets(boolean theAutoCreatePlaceholderReferenceTargets) { + myAutoCreatePlaceholderReferenceTargets = theAutoCreatePlaceholderReferenceTargets; + } + + /** + * Get the batch transaction thread pool size. + * + * @since 5.6.0 + */ + public Integer getBundleBatchPoolSize() { + return myBundleBatchPoolSize; + } + + /** + * Set the batch transaction thread pool size. The default is @see {@link #DEFAULT_BUNDLE_BATCH_POOL_SIZE} + * set pool size to 1 for single thread + * + * @since 5.6.0 + */ + public void setBundleBatchPoolSize(Integer theBundleBatchPoolSize) { + this.myBundleBatchPoolSize = theBundleBatchPoolSize; + } + + /** + * Get the batch transaction thread max pool size. + * set max pool size to 1 for single thread + * + * @since 5.6.0 + */ + public Integer getBundleBatchMaxPoolSize() { + return myBundleBatchMaxPoolSize; + } + + /** + * Set the batch transaction thread pool size. The default is @see {@link #DEFAULT_BUNDLE_BATCH_MAX_POOL_SIZE} + * + * @since 5.6.0 + */ + public void setBundleBatchMaxPoolSize(Integer theBundleBatchMaxPoolSize) { + this.myBundleBatchMaxPoolSize = theBundleBatchMaxPoolSize; + } + + /** + * If set to false (default is true) the server will not use + * in-memory subscription searching and instead use the database matcher for all subscription + * criteria matching. + *

+ * When there are subscriptions registered + * on the server, the default behaviour is to compare the changed resource to the + * subscription criteria directly in-memory without going out to the database. + * Certain types of subscription criteria, e.g. chained references of queries with + * qualifiers or prefixes, are not supported by the in-memory matcher and will fall back + * to a database matcher. + *

+ * The database matcher performs a query against the + * database by prepending ?id=XYZ to the subscription criteria where XYZ is the id of the changed entity + * + * @since 3.6.1 + */ + public boolean isEnableInMemorySubscriptionMatching() { + return myEnableInMemorySubscriptionMatching; + } + + /** + * If set to false (default is true) the server will not use + * in-memory subscription searching and instead use the database matcher for all subscription + * criteria matching. + *

+ * When there are subscriptions registered + * on the server, the default behaviour is to compare the changed resource to the + * subscription criteria directly in-memory without going out to the database. + * Certain types of subscription criteria, e.g. chained references of queries with + * qualifiers or prefixes, are not supported by the in-memory matcher and will fall back + * to a database matcher. + *

+ * The database matcher performs a query against the + * database by prepending ?id=XYZ to the subscription criteria where XYZ is the id of the changed entity + * + * @since 3.6.1 + */ + public void setEnableInMemorySubscriptionMatching(boolean theEnableInMemorySubscriptionMatching) { + myEnableInMemorySubscriptionMatching = theEnableInMemorySubscriptionMatching; + } + + /** + * If this is enabled (disabled by default), Mass Ingestion Mode is enabled. In this mode, a number of + * runtime checks are disabled. This mode is designed for rapid backloading of data while the system is not + * being otherwise used. + *

+ * In this mode: + *

+ * - Tags/Profiles/Security Labels will not be updated on existing resources that already have them + * - Resources modification checks will be skipped in favour of a simple hash check + * - Extra resource ID caching is enabled + * + * @since 5.5.0 + */ + public boolean isMassIngestionMode() { + return myMassIngestionMode; + } + + /** + * If this is enabled (disabled by default), Mass Ingestion Mode is enabled. In this mode, a number of + * runtime checks are disabled. This mode is designed for rapid backloading of data while the system is not + * being otherwise used. + *

+ * In this mode: + *

+ * - Tags/Profiles/Security Labels will not be updated on existing resources that already have them + * - Resources modification checks will be skipped in favour of a simple hash check + * - Extra resource ID caching is enabled + * + * @since 5.5.0 + */ + public void setMassIngestionMode(boolean theMassIngestionMode) { + myMassIngestionMode = theMassIngestionMode; + } + + /** + * Specifies the maximum number of resources permitted within a single transaction bundle. + * If a transaction bundle is submitted with more than this number of resources, it will be + * rejected with a PayloadTooLarge exception. + *

+ * The default value is null, which means that there is no limit. + *

+ */ + public Integer getMaximumTransactionBundleSize() { + return myMaximumTransactionBundleSize; + } + + /** + * Specifies the maximum number of resources permitted within a single transaction bundle. + * If a transaction bundle is submitted with more than this number of resources, it will be + * rejected with a PayloadTooLarge exception. + *

+ * The default value is null, which means that there is no limit. + *

+ */ + public StorageSettings setMaximumTransactionBundleSize(Integer theMaximumTransactionBundleSize) { + myMaximumTransactionBundleSize = theMaximumTransactionBundleSize; + return this; + } /** * If set to true, attempt to map terminology for bulk export jobs using the @@ -104,36 +336,6 @@ public class ModelConfig { myNormalizeTerminologyForBulkExportJobs = theNormalizeTerminologyForBulkExportJobs; } - private boolean myNormalizeTerminologyForBulkExportJobs = false; - private String myEmailFromAddress = "noreply@unknown.com"; - private String myWebsocketContextPath = DEFAULT_WEBSOCKET_CONTEXT_PATH; - /** - * Update setter javadoc if default changes. - */ - private boolean myUseOrdinalDatesForDayPrecisionSearches = true; - private boolean mySuppressStringIndexingInTokens = false; - private Class mySequenceValueMassagerClass; - private IPrimitiveType myPeriodIndexStartOfTime; - private IPrimitiveType myPeriodIndexEndOfTime; - private NormalizedQuantitySearchLevel myNormalizedQuantitySearchLevel; - private Set myAutoVersionReferenceAtPaths = Collections.emptySet(); - private Map> myTypeToAutoVersionReferenceAtPaths = Collections.emptyMap(); - private boolean myRespectVersionsForSearchIncludes; - private boolean myIndexOnContainedResources = false; - private boolean myIndexOnContainedResourcesRecursively = false; - private boolean myAllowMdmExpansion = false; - private boolean myAutoSupportDefaultSearchParams = true; - private boolean myIndexIdentifierOfType = false; - /** - * Constructor - */ - public ModelConfig() { - setSequenceValueMassagerClass(ISequenceValueMassager.NoopSequenceValueMassager.class); - setPeriodIndexStartOfTime(new DateTimeType(DEFAULT_PERIOD_INDEX_START_OF_TIME)); - setPeriodIndexEndOfTime(new DateTimeType(DEFAULT_PERIOD_INDEX_END_OF_TIME)); - setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); - } - /** * This is an internal API and may change or disappear without notice * @@ -153,6 +355,26 @@ public class ModelConfig { mySequenceValueMassagerClass = theSequenceValueMassagerClass; } + /** + * If set to true (default is false) then subscriptions will be triggered for resource updates even if they + * do not trigger a new version (e.g. $meta-add and $meta-delete). + * + * @since 5.5.0 + */ + public boolean isTriggerSubscriptionsForNonVersioningChanges() { + return myTriggerSubscriptionsForNonVersioningChanges; + } + + /** + * If set to true (default is false) then subscriptions will be triggered for resource updates even if they + * do not trigger a new version (e.g. $meta-add and $meta-delete). + * + * @since 5.5.0 + */ + public void setTriggerSubscriptionsForNonVersioningChanges(boolean theTriggerSubscriptionsForNonVersioningChanges) { + myTriggerSubscriptionsForNonVersioningChanges = theTriggerSubscriptionsForNonVersioningChanges; + } + /** * If set to true (default is false) the * :of-type modifier on token search parameters for @@ -348,7 +570,7 @@ public class ModelConfig { * convert this reference to Patient/1 *

*

- * Note that this property has different behaviour from {@link ModelConfig#getTreatReferencesAsLogical()} + * Note that this property has different behaviour from {@link StorageSettings#getTreatReferencesAsLogical()} *

* * @see #getTreatReferencesAsLogical() @@ -448,7 +670,7 @@ public class ModelConfig { * * @see #DEFAULT_LOGICAL_BASE_URLS Default values for this property */ - public ModelConfig setTreatReferencesAsLogical(Set theTreatReferencesAsLogical) { + public StorageSettings setTreatReferencesAsLogical(Set theTreatReferencesAsLogical) { myTreatReferencesAsLogical = theTreatReferencesAsLogical; return this; } @@ -458,7 +680,7 @@ public class ModelConfig { * This setting indicates which subscription channel types are supported by the server. Any subscriptions submitted * to the server matching these types will be activated. */ - public ModelConfig addSupportedSubscriptionType(Subscription.SubscriptionChannelType theSubscriptionChannelType) { + public StorageSettings addSupportedSubscriptionType(Subscription.SubscriptionChannelType theSubscriptionChannelType) { mySupportedSubscriptionTypes.add(theSubscriptionChannelType); return this; } @@ -915,10 +1137,10 @@ public class ModelConfig { * Default is false *

* - * @since 7.5.0 + * @since 5.7.0 */ - public boolean isCrossPartitionSubscription() { - return myCrossPartitionSubscription; + public boolean isCrossPartitionSubscriptionEnabled() { + return myCrossPartitionSubscriptionEnabled; } /** @@ -930,12 +1152,36 @@ public class ModelConfig { * Default is false *

* - * @since 7.5.0 + * @since 5.7.0 */ - public void setCrossPartitionSubscription(boolean theAllowCrossPartitionSubscription) { - myCrossPartitionSubscription = theAllowCrossPartitionSubscription; + public void setCrossPartitionSubscriptionEnabled(boolean theAllowCrossPartitionSubscription) { + myCrossPartitionSubscriptionEnabled = theAllowCrossPartitionSubscription; } + /** + * This setting controls whether the {@link BaseChannelSettings#isQualifyChannelName} + * should be qualified or not. + * Default is true, ie, the channel name will be qualified. + * + * @since 6.4.0 + */ + public void setQualifySubscriptionMatchingChannelName(boolean theQualifySubscriptionMatchingChannelName) { + myQualifySubscriptionMatchingChannelName = theQualifySubscriptionMatchingChannelName; + } + + /** + * This setting return whether the {@link BaseChannelSettings#isQualifyChannelName} + * should be qualified or not. + * + * @return whether the {@link BaseChannelSettings#isQualifyChannelName} is qualified or not + * @since 6.4.0 + */ + public boolean isQualifySubscriptionMatchingChannelName() { + return myQualifySubscriptionMatchingChannelName; + } + + + private static void validateTreatBaseUrlsAsLocal(String theUrl) { Validate.notBlank(theUrl, "Base URL must not be null or empty"); diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/search/ExtendedHSearchIndexData.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/search/ExtendedHSearchIndexData.java index 856b0e7565d..ff59717f466 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/search/ExtendedHSearchIndexData.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/search/ExtendedHSearchIndexData.java @@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.model.search; */ import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.model.dstu2.composite.CodingDt; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimaps; @@ -45,7 +45,7 @@ public class ExtendedHSearchIndexData { private static final Logger ourLog = LoggerFactory.getLogger(ExtendedHSearchIndexData.class); final FhirContext myFhirContext; - final ModelConfig myModelConfig; + final StorageSettings myStorageSettings; final SetMultimap mySearchParamStrings = HashMultimap.create(); final SetMultimap mySearchParamTokens = HashMultimap.create(); @@ -59,9 +59,9 @@ public class ExtendedHSearchIndexData { private String myResourceJSON; private IBaseResource myResource; - public ExtendedHSearchIndexData(FhirContext theFhirContext, ModelConfig theModelConfig, IBaseResource theResource) { + public ExtendedHSearchIndexData(FhirContext theFhirContext, StorageSettings theStorageSettings, IBaseResource theResource) { this.myFhirContext = theFhirContext; - this.myModelConfig = theModelConfig; + this.myStorageSettings = theStorageSettings; myResource = theResource; } @@ -83,7 +83,7 @@ public class ExtendedHSearchIndexData { * @param theDocument the Hibernate Search document for ResourceTable */ public void writeIndexElements(DocumentElement theDocument) { - HSearchIndexWriter indexWriter = HSearchIndexWriter.forRoot(myModelConfig, theDocument); + HSearchIndexWriter indexWriter = HSearchIndexWriter.forRoot(myStorageSettings, theDocument); ourLog.debug("Writing JPA index to Hibernate Search"); diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/search/HSearchIndexWriter.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/search/HSearchIndexWriter.java index 6949a8309cf..ad5da3dae43 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/search/HSearchIndexWriter.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/search/HSearchIndexWriter.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.model.search; * #L% */ -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.util.UcumServiceUtil; import org.apache.commons.lang3.StringUtils; import org.fhir.ucum.Pair; @@ -70,10 +70,10 @@ public class HSearchIndexWriter { final HSearchElementCache myNodeCache; - final ModelConfig myModelConfig; + final StorageSettings myStorageSettings; - HSearchIndexWriter(ModelConfig theModelConfig, DocumentElement theRoot) { - myModelConfig = theModelConfig; + HSearchIndexWriter(StorageSettings theStorageSettings, DocumentElement theRoot) { + myStorageSettings = theStorageSettings; myNodeCache = new HSearchElementCache(theRoot); } @@ -81,8 +81,8 @@ public class HSearchIndexWriter { return myNodeCache.getObjectElement(SEARCH_PARAM_ROOT, theSearchParamName, theIndexType); } - public static HSearchIndexWriter forRoot(ModelConfig theModelConfig, DocumentElement theDocument) { - return new HSearchIndexWriter(theModelConfig, theDocument); + public static HSearchIndexWriter forRoot(StorageSettings theStorageSettings, DocumentElement theDocument) { + return new HSearchIndexWriter(theStorageSettings, theDocument); } public void writeStringIndex(String theSearchParam, String theValue) { @@ -169,7 +169,7 @@ public class HSearchIndexWriter { addDocumentValue(nestedQtyNode, QTY_SYSTEM, theValue.getSystem()); addDocumentValue(nestedQtyNode, QTY_VALUE, theValue.getValue()); - if ( ! myModelConfig.getNormalizedQuantitySearchLevel().storageOrSearchSupported()) { + if ( ! myStorageSettings.getNormalizedQuantitySearchLevel().storageOrSearchSupported()) { return; } diff --git a/hapi-fhir-jpaserver-model/src/test/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamStringTest.java b/hapi-fhir-jpaserver-model/src/test/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamStringTest.java index 17db85927ba..9fb37e4556f 100644 --- a/hapi-fhir-jpaserver-model/src/test/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamStringTest.java +++ b/hapi-fhir-jpaserver-model/src/test/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamStringTest.java @@ -12,7 +12,7 @@ public class ResourceIndexedSearchParamStringTest { @Test public void testHashFunctions() { - ResourceIndexedSearchParamString token = new ResourceIndexedSearchParamString(new PartitionSettings(), new ModelConfig(), "Patient", "NAME", "value", "VALUE"); + ResourceIndexedSearchParamString token = new ResourceIndexedSearchParamString(new PartitionSettings(), new StorageSettings(), "Patient", "NAME", "value", "VALUE"); token.setResource(new ResourceTable().setResourceType("Patient")); token.calculateHashes(); @@ -23,7 +23,7 @@ public class ResourceIndexedSearchParamStringTest { @Test public void testHashFunctionsPrefixOnly() { - ResourceIndexedSearchParamString token = new ResourceIndexedSearchParamString(new PartitionSettings(), new ModelConfig(), "Patient", "NAME", "vZZZZZZZZZZZZZZZZ", "VZZZZZZzzzZzzzZ"); + ResourceIndexedSearchParamString token = new ResourceIndexedSearchParamString(new PartitionSettings(), new StorageSettings(), "Patient", "NAME", "vZZZZZZZZZZZZZZZZ", "VZZZZZZzzzZzzzZ"); token.setResource(new ResourceTable().setResourceType("Patient")); token.calculateHashes(); @@ -36,11 +36,11 @@ public class ResourceIndexedSearchParamStringTest { @Test public void testHashFunctionsPrefixOnly_John_JN_vs_JAN() { - final ResourceIndexedSearchParamString token1 = new ResourceIndexedSearchParamString(new PartitionSettings(), new ModelConfig(), "Patient", "query-1-param", "JN", "John"); + final ResourceIndexedSearchParamString token1 = new ResourceIndexedSearchParamString(new PartitionSettings(), new StorageSettings(), "Patient", "query-1-param", "JN", "John"); token1.setResource(new ResourceTable().setResourceType("Patient")); token1.calculateHashes(); - final ResourceIndexedSearchParamString token2 = new ResourceIndexedSearchParamString(new PartitionSettings(), new ModelConfig(), "Patient", "query-1-param", "JAN", "John"); + final ResourceIndexedSearchParamString token2 = new ResourceIndexedSearchParamString(new PartitionSettings(), new StorageSettings(), "Patient", "query-1-param", "JAN", "John"); token2.setResource(new ResourceTable().setResourceType("Patient")); token2.calculateHashes(); @@ -54,11 +54,11 @@ public class ResourceIndexedSearchParamStringTest { @Test public void testHashFunctionsPrefixOnly_Doe_T_vs_D() { - final ResourceIndexedSearchParamString token1 = new ResourceIndexedSearchParamString(new PartitionSettings(), new ModelConfig(), "Patient", "query-1-param", "T", "Doe"); + final ResourceIndexedSearchParamString token1 = new ResourceIndexedSearchParamString(new PartitionSettings(), new StorageSettings(), "Patient", "query-1-param", "T", "Doe"); token1.setResource(new ResourceTable().setResourceType("Patient")); token1.calculateHashes(); - final ResourceIndexedSearchParamString token2 = new ResourceIndexedSearchParamString(new PartitionSettings(), new ModelConfig(), "Patient", "query-1-param", "D", "Doe"); + final ResourceIndexedSearchParamString token2 = new ResourceIndexedSearchParamString(new PartitionSettings(), new StorageSettings(), "Patient", "query-1-param", "D", "Doe"); token2.setResource(new ResourceTable().setResourceType("Patient")); token2.calculateHashes(); @@ -75,13 +75,13 @@ public class ResourceIndexedSearchParamStringTest { .setValueExact("aaa") .setValueNormalized("AAA"); val1.setPartitionSettings(new PartitionSettings()); - val1.setModelConfig(new ModelConfig()); + val1.setStorageSettings(new StorageSettings()); val1.calculateHashes(); ResourceIndexedSearchParamString val2 = new ResourceIndexedSearchParamString() .setValueExact("aaa") .setValueNormalized("AAA"); val2.setPartitionSettings(new PartitionSettings()); - val2.setModelConfig(new ModelConfig()); + val2.setStorageSettings(new StorageSettings()); val2.calculateHashes(); assertEquals(val1, val1); assertEquals(val1, val2); @@ -95,13 +95,13 @@ public class ResourceIndexedSearchParamStringTest { .setValueExact("aaa") .setValueNormalized("AAA"); val1.setPartitionSettings(new PartitionSettings().setIncludePartitionInSearchHashes(true)); - val1.setModelConfig(new ModelConfig()); + val1.setStorageSettings(new StorageSettings()); val1.calculateHashes(); ResourceIndexedSearchParamString val2 = new ResourceIndexedSearchParamString() .setValueExact("aaa") .setValueNormalized("AAA"); val2.setPartitionSettings(new PartitionSettings().setIncludePartitionInSearchHashes(true)); - val2.setModelConfig(new ModelConfig()); + val2.setStorageSettings(new StorageSettings()); val2.calculateHashes(); assertEquals(val1, val1); assertEquals(val1, val2); diff --git a/hapi-fhir-jpaserver-searchparam/pom.xml b/hapi-fhir-jpaserver-searchparam/pom.xml index 2d6a1b0ca8d..bc6152c23b7 100755 --- a/hapi-fhir-jpaserver-searchparam/pom.xml +++ b/hapi-fhir-jpaserver-searchparam/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/BaseSearchParamExtractor.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/BaseSearchParamExtractor.java index 69d1a968cf4..88d95e175e4 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/BaseSearchParamExtractor.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/BaseSearchParamExtractor.java @@ -30,20 +30,8 @@ import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.context.RuntimeSearchParam; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParam; -import ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParamQuantity; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedComboStringUnique; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedComboTokenNonUnique; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamCoords; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamNumber; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantity; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantityNormalized; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamUri; -import ca.uhn.fhir.jpa.model.entity.ResourceLink; +import ca.uhn.fhir.jpa.model.entity.*; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.util.UcumServiceUtil; import ca.uhn.fhir.jpa.searchparam.SearchParamConstants; import ca.uhn.fhir.jpa.searchparam.util.JpaParamUtil; @@ -118,7 +106,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor @Autowired private ISearchParamRegistry mySearchParamRegistry; @Autowired - private ModelConfig myModelConfig; + private StorageSettings myStorageSettings; @Autowired private PartitionSettings myPartitionSettings; private Set myIgnoredForSearchDatatypes; @@ -175,12 +163,12 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor /** * UNIT TEST constructor */ - BaseSearchParamExtractor(ModelConfig theModelConfig, PartitionSettings thePartitionSettings, FhirContext theCtx, ISearchParamRegistry theSearchParamRegistry) { - Validate.notNull(theModelConfig); + BaseSearchParamExtractor(StorageSettings theStorageSettings, PartitionSettings thePartitionSettings, FhirContext theCtx, ISearchParamRegistry theSearchParamRegistry) { + Validate.notNull(theStorageSettings); Validate.notNull(theCtx); Validate.notNull(theSearchParamRegistry); - myModelConfig = theModelConfig; + myStorageSettings = theStorageSettings; myContext = theCtx; mySearchParamRegistry = theSearchParamRegistry; myPartitionSettings = thePartitionSettings; @@ -710,7 +698,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor @Nonnull private IExtractor createQuantityExtractor(IBaseResource theResource) { IExtractor result; - if (myModelConfig.getNormalizedQuantitySearchLevel().storageOrSearchSupported()) { + if (myStorageSettings.getNormalizedQuantitySearchLevel().storageOrSearchSupported()) { result = new MultiplexExtractor( createQuantityUnnormalizedExtractor(theResource), createQuantityNormalizedExtractor(theResource) @@ -869,13 +857,13 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor myContext = theContext; } - protected ModelConfig getModelConfig() { - return myModelConfig; + protected StorageSettings getStorageSettings() { + return myStorageSettings; } @VisibleForTesting - public void setModelConfig(ModelConfig theModelConfig) { - myModelConfig = theModelConfig; + public void setStorageSettings(StorageSettings theStorageSettings) { + myStorageSettings = theStorageSettings; } @VisibleForTesting @@ -974,7 +962,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor if (isNotBlank(value)) { createTokenIndexIfNotBlankAndAdd(theResourceType, theParams, theSearchParam, system, value); - boolean indexIdentifierType = myModelConfig.isIndexIdentifierOfType(); + boolean indexIdentifierType = myStorageSettings.isIndexIdentifierOfType(); if (indexIdentifierType) { Optional type = myIdentifierTypeValueChild.getAccessor().getFirstValueOrNull(theValue); if (type.isPresent()) { @@ -999,7 +987,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor } protected boolean shouldIndexTextComponentOfToken(RuntimeSearchParam theSearchParam) { - return tokenTextIndexingEnabledForSearchParam(myModelConfig, theSearchParam); + return tokenTextIndexingEnabledForSearchParam(myStorageSettings, theSearchParam); } private void addToken_CodeableConcept(String theResourceType, Set theParams, RuntimeSearchParam theSearchParam, IBase theValue) { @@ -1104,12 +1092,12 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor if (start != null || end != null) { if (start == null) { - start = myModelConfig.getPeriodIndexStartOfTime().getValue(); - startAsString = myModelConfig.getPeriodIndexStartOfTime().getValueAsString(); + start = myStorageSettings.getPeriodIndexStartOfTime().getValue(); + startAsString = myStorageSettings.getPeriodIndexStartOfTime().getValueAsString(); } if (end == null) { - end = myModelConfig.getPeriodIndexEndOfTime().getValue(); - endAsString = myModelConfig.getPeriodIndexEndOfTime().getValueAsString(); + end = myStorageSettings.getPeriodIndexEndOfTime().getValue(); + endAsString = myStorageSettings.getPeriodIndexEndOfTime().getValueAsString(); } ResourceIndexedSearchParamDate nextEntity = new ResourceIndexedSearchParamDate(myPartitionSettings, theResourceType, theSearchParam.getName(), start, startAsString, end, endAsString, startAsString); @@ -1340,7 +1328,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor */ private void cleanUpContainedResourceReferences(IBaseResource theResource, RestSearchParameterTypeEnum theSearchParamType, Collection searchParams) { boolean havePathWithResolveExpression = - myModelConfig.isIndexOnContainedResources() + myStorageSettings.isIndexOnContainedResources() || anySearchParameterUsesResolve(searchParams, theSearchParamType); if (havePathWithResolveExpression && myContext.getParserOptions().isAutoContainReferenceTargetsWithNoId()) { @@ -1420,7 +1408,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor valueEncoded = valueEncoded.substring(0, ResourceIndexedSearchParamString.MAX_LENGTH); } - ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(myPartitionSettings, getModelConfig(), theResourceType, searchParamName, valueEncoded, value); + ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(myPartitionSettings, getStorageSettings(), theResourceType, searchParamName, valueEncoded, value); Set params = theParams; params.add(nextEntity); @@ -1674,7 +1662,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor return tok.getTokenArray(); } - public static boolean tokenTextIndexingEnabledForSearchParam(ModelConfig theModelConfig, RuntimeSearchParam theSearchParam) { + public static boolean tokenTextIndexingEnabledForSearchParam(StorageSettings theStorageSettings, RuntimeSearchParam theSearchParam) { Optional noSuppressForSearchParam = theSearchParam.getExtensions(HapiExtensions.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING).stream() .map(IBaseExtension::getValue) .map(val -> (IPrimitiveType) val) @@ -1684,7 +1672,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor //if the SP doesn't care, use the system default. if (!noSuppressForSearchParam.isPresent()) { - return !theModelConfig.isSuppressStringIndexingInTokens(); + return !theStorageSettings.isSuppressStringIndexingInTokens(); //If the SP does care, use its value. } else { boolean suppressForSearchParam = noSuppressForSearchParam.get(); @@ -1892,12 +1880,12 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor if (start != null || end != null) { if (start == null) { - start = myModelConfig.getPeriodIndexStartOfTime().getValue(); - startAsString = myModelConfig.getPeriodIndexStartOfTime().getValueAsString(); + start = myStorageSettings.getPeriodIndexStartOfTime().getValue(); + startAsString = myStorageSettings.getPeriodIndexStartOfTime().getValueAsString(); } if (end == null) { - end = myModelConfig.getPeriodIndexEndOfTime().getValue(); - endAsString = myModelConfig.getPeriodIndexEndOfTime().getValueAsString(); + end = myStorageSettings.getPeriodIndexEndOfTime().getValue(); + endAsString = myStorageSettings.getPeriodIndexEndOfTime().getValueAsString(); } myIndexedSearchParamDate = new ResourceIndexedSearchParamDate(myPartitionSettings, theResourceType, theSearchParam.getName(), start, startAsString, end, endAsString, startAsString); diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/LogicalReferenceHelper.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/LogicalReferenceHelper.java index 91e4e798199..d688e46f0e3 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/LogicalReferenceHelper.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/LogicalReferenceHelper.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.searchparam.extractor; * #L% */ -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import org.hl7.fhir.instance.model.api.IIdType; import java.util.Set; @@ -29,7 +29,7 @@ import static org.apache.commons.lang3.StringUtils.trim; public class LogicalReferenceHelper { - public static boolean isLogicalReference(ModelConfig myConfig, IIdType theId) { + public static boolean isLogicalReference(StorageSettings myConfig, IIdType theId) { Set treatReferencesAsLogical = myConfig.getTreatReferencesAsLogical(); if (treatReferencesAsLogical != null) { for (String nextLogicalRef : treatReferencesAsLogical) { diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/ResourceIndexedSearchParams.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/ResourceIndexedSearchParams.java index 08ff1c65d15..1c5c905a59e 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/ResourceIndexedSearchParams.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/ResourceIndexedSearchParams.java @@ -23,21 +23,8 @@ package ca.uhn.fhir.jpa.searchparam.extractor; import ca.uhn.fhir.context.RuntimeSearchParam; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParam; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; -import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedComboStringUnique; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedComboTokenNonUnique; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamCoords; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamNumber; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantity; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantityNormalized; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamUri; -import ca.uhn.fhir.jpa.model.entity.ResourceLink; -import ca.uhn.fhir.jpa.model.entity.ResourceTable; +import ca.uhn.fhir.jpa.model.entity.*; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.util.UcumServiceUtil; import ca.uhn.fhir.model.api.IQueryParameterType; import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum; @@ -204,7 +191,7 @@ public final class ResourceIndexedSearchParams { return myPopulatedResourceLinkParameters; } - public boolean matchParam(ModelConfig theModelConfig, String theResourceName, String theParamName, RuntimeSearchParam theParamDef, IQueryParameterType theValue) { + public boolean matchParam(StorageSettings theStorageSettings, String theResourceName, String theParamName, RuntimeSearchParam theParamDef, IQueryParameterType theValue) { if (theParamDef == null) { return false; @@ -216,7 +203,7 @@ public final class ResourceIndexedSearchParams { resourceParams = myTokenParams; break; case QUANTITY: - if (theModelConfig.getNormalizedQuantitySearchLevel().equals(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED)) { + if (theStorageSettings.getNormalizedQuantitySearchLevel().equals(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED)) { QuantityParam quantity = QuantityParam.toQuantityParam(theValue); QuantityParam normalized = UcumServiceUtil.toCanonicalQuantityOrNull(quantity); if (normalized != null) { @@ -242,7 +229,7 @@ public final class ResourceIndexedSearchParams { resourceParams = myDateParams; break; case REFERENCE: - return matchResourceLinks(theModelConfig, theResourceName, theParamName, value, theParamDef.getPathsSplitForResourceType(theResourceName)); + return matchResourceLinks(theStorageSettings, theResourceName, theParamName, value, theParamDef.getPathsSplitForResourceType(theResourceName)); case COMPOSITE: case HAS: case SPECIAL: @@ -270,12 +257,12 @@ public final class ResourceIndexedSearchParams { // KHS This needs to be public as libraries outside of hapi call it directly @Deprecated public boolean matchResourceLinks(String theResourceName, String theParamName, IQueryParameterType theParam, String theParamPath) { - return matchResourceLinks(new ModelConfig(), theResourceName, theParamName, theParam, theParamPath); + return matchResourceLinks(new StorageSettings(), theResourceName, theParamName, theParam, theParamPath); } - public boolean matchResourceLinks(ModelConfig theModelConfig, String theResourceName, String theParamName, IQueryParameterType theParam, List theParamPaths) { + public boolean matchResourceLinks(StorageSettings theStorageSettings, String theResourceName, String theParamName, IQueryParameterType theParam, List theParamPaths) { for (String nextPath : theParamPaths) { - if (matchResourceLinks(theModelConfig, theResourceName, theParamName, theParam, nextPath)) { + if (matchResourceLinks(theStorageSettings, theResourceName, theParamName, theParam, nextPath)) { return true; } } @@ -283,20 +270,20 @@ public final class ResourceIndexedSearchParams { } // KHS This needs to be public as libraries outside of hapi call it directly - public boolean matchResourceLinks(ModelConfig theModelConfig, String theResourceName, String theParamName, IQueryParameterType theParam, String theParamPath) { + public boolean matchResourceLinks(StorageSettings theStorageSettings, String theResourceName, String theParamName, IQueryParameterType theParam, String theParamPath) { ReferenceParam reference = (ReferenceParam) theParam; Predicate namedParamPredicate = resourceLink -> searchParameterPathMatches(theResourceName, resourceLink, theParamName, theParamPath) - && resourceIdMatches(theModelConfig, resourceLink, reference); + && resourceIdMatches(theStorageSettings, resourceLink, reference); return myLinks.stream().anyMatch(namedParamPredicate); } - private boolean resourceIdMatches(ModelConfig theModelConfig, ResourceLink theResourceLink, ReferenceParam theReference) { + private boolean resourceIdMatches(StorageSettings theStorageSettings, ResourceLink theResourceLink, ReferenceParam theReference) { String baseUrl = theReference.getBaseUrl(); if (isNotBlank(baseUrl)) { - if (!theModelConfig.getTreatBaseUrlsAsLocal().contains(baseUrl)) { + if (!theStorageSettings.getTreatBaseUrlsAsLocal().contains(baseUrl)) { return false; } } @@ -342,18 +329,18 @@ public final class ResourceIndexedSearchParams { '}'; } - public void findMissingSearchParams(PartitionSettings thePartitionSettings, ModelConfig theModelConfig, ResourceTable theEntity, ResourceSearchParams theActiveSearchParams) { - findMissingSearchParams(thePartitionSettings, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.STRING, myStringParams); - findMissingSearchParams(thePartitionSettings, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.NUMBER, myNumberParams); - findMissingSearchParams(thePartitionSettings, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.QUANTITY, myQuantityParams); - findMissingSearchParams(thePartitionSettings, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.DATE, myDateParams); - findMissingSearchParams(thePartitionSettings, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.URI, myUriParams); - findMissingSearchParams(thePartitionSettings, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.TOKEN, myTokenParams); - findMissingSearchParams(thePartitionSettings, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.SPECIAL, myCoordsParams); + public void findMissingSearchParams(PartitionSettings thePartitionSettings, StorageSettings theStorageSettings, ResourceTable theEntity, ResourceSearchParams theActiveSearchParams) { + findMissingSearchParams(thePartitionSettings, theStorageSettings, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.STRING, myStringParams); + findMissingSearchParams(thePartitionSettings, theStorageSettings, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.NUMBER, myNumberParams); + findMissingSearchParams(thePartitionSettings, theStorageSettings, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.QUANTITY, myQuantityParams); + findMissingSearchParams(thePartitionSettings, theStorageSettings, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.DATE, myDateParams); + findMissingSearchParams(thePartitionSettings, theStorageSettings, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.URI, myUriParams); + findMissingSearchParams(thePartitionSettings, theStorageSettings, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.TOKEN, myTokenParams); + findMissingSearchParams(thePartitionSettings, theStorageSettings, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.SPECIAL, myCoordsParams); } @SuppressWarnings("unchecked") - private void findMissingSearchParams(PartitionSettings thePartitionSettings, ModelConfig theModelConfig, ResourceTable theEntity, ResourceSearchParams activeSearchParams, RestSearchParameterTypeEnum type, + private void findMissingSearchParams(PartitionSettings thePartitionSettings, StorageSettings theStorageSettings, ResourceTable theEntity, ResourceSearchParams activeSearchParams, RestSearchParameterTypeEnum type, Collection paramCollection) { for (String nextParamName : activeSearchParams.getSearchParamNames()) { if (nextParamName == null || nextParamName.startsWith("_")) { @@ -384,7 +371,7 @@ public final class ResourceIndexedSearchParams { break; case STRING: param = new ResourceIndexedSearchParamString() - .setModelConfig(theModelConfig); + .setStorageSettings(theStorageSettings); break; case TOKEN: param = new ResourceIndexedSearchParamToken(); diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu2.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu2.java index 9af3b924b42..47e2eed9880 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu2.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu2.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.searchparam.extractor; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import ca.uhn.fhir.model.dstu2.composite.ContactPointDt; import ca.uhn.fhir.util.FhirTerser; @@ -41,8 +41,8 @@ public class SearchParamExtractorDstu2 extends BaseSearchParamExtractor implemen /** * Constructor for unit tests */ - SearchParamExtractorDstu2(ModelConfig theModelConfig, PartitionSettings thePartitionSettings, FhirContext theCtx, ISearchParamRegistry theSearchParamRegistry) { - super(theModelConfig, thePartitionSettings, theCtx, theSearchParamRegistry); + SearchParamExtractorDstu2(StorageSettings theStorageSettings, PartitionSettings thePartitionSettings, FhirContext theCtx, ISearchParamRegistry theSearchParamRegistry) { + super(theStorageSettings, thePartitionSettings, theCtx, theSearchParamRegistry); start(); } diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu3.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu3.java index 8d6a979c8b3..4730fa593ad 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu3.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu3.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.searchparam.extractor; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import com.google.common.annotations.VisibleForTesting; import org.hl7.fhir.dstu3.context.IWorkerContext; @@ -48,8 +48,8 @@ public class SearchParamExtractorDstu3 extends BaseSearchParamExtractor implemen // This constructor is used by tests @VisibleForTesting - public SearchParamExtractorDstu3(ModelConfig theModelConfig, PartitionSettings thePartitionSettings, FhirContext theCtx, ISearchParamRegistry theSearchParamRegistry) { - super(theModelConfig, thePartitionSettings, theCtx, theSearchParamRegistry); + public SearchParamExtractorDstu3(StorageSettings theStorageSettings, PartitionSettings thePartitionSettings, FhirContext theCtx, ISearchParamRegistry theSearchParamRegistry) { + super(theStorageSettings, thePartitionSettings, theCtx, theSearchParamRegistry); initFhirPathEngine(); start(); } diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4.java index cc55a8a62fe..4d4632213f8 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.searchparam.extractor; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import ca.uhn.fhir.sl.cache.Cache; import ca.uhn.fhir.sl.cache.CacheFactory; @@ -64,8 +64,8 @@ public class SearchParamExtractorR4 extends BaseSearchParamExtractor implements // This constructor is used by tests @VisibleForTesting - public SearchParamExtractorR4(ModelConfig theModelConfig, PartitionSettings thePartitionSettings, FhirContext theCtx, ISearchParamRegistry theSearchParamRegistry) { - super(theModelConfig, thePartitionSettings, theCtx, theSearchParamRegistry); + public SearchParamExtractorR4(StorageSettings theStorageSettings, PartitionSettings thePartitionSettings, FhirContext theCtx, ISearchParamRegistry theSearchParamRegistry) { + super(theStorageSettings, thePartitionSettings, theCtx, theSearchParamRegistry); initFhirPath(); start(); } diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4B.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4B.java index a186c8effa8..cac4ac93656 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4B.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4B.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.searchparam.extractor; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import ca.uhn.fhir.sl.cache.Cache; import ca.uhn.fhir.sl.cache.CacheFactory; @@ -64,8 +64,8 @@ public class SearchParamExtractorR4B extends BaseSearchParamExtractor implements // This constructor is used by tests @VisibleForTesting - public SearchParamExtractorR4B(ModelConfig theModelConfig, PartitionSettings thePartitionSettings, FhirContext theCtx, ISearchParamRegistry theSearchParamRegistry) { - super(theModelConfig, thePartitionSettings, theCtx, theSearchParamRegistry); + public SearchParamExtractorR4B(StorageSettings theStorageSettings, PartitionSettings thePartitionSettings, FhirContext theCtx, ISearchParamRegistry theSearchParamRegistry) { + super(theStorageSettings, thePartitionSettings, theCtx, theSearchParamRegistry); initFhirPath(); start(); } diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR5.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR5.java index 626231c6b6f..fd680f004f1 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR5.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR5.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.searchparam.extractor; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import ca.uhn.fhir.sl.cache.Cache; import ca.uhn.fhir.sl.cache.CacheFactory; @@ -61,8 +61,8 @@ public class SearchParamExtractorR5 extends BaseSearchParamExtractor implements /** * Constructor for unit tests */ - public SearchParamExtractorR5(ModelConfig theModelConfig, PartitionSettings thePartitionSettings, FhirContext theCtx, ISearchParamRegistry theSearchParamRegistry) { - super(theModelConfig, thePartitionSettings, theCtx, theSearchParamRegistry); + public SearchParamExtractorR5(StorageSettings theStorageSettings, PartitionSettings thePartitionSettings, FhirContext theCtx, ISearchParamRegistry theSearchParamRegistry) { + super(theStorageSettings, thePartitionSettings, theCtx, theSearchParamRegistry); initFhirPath(); start(); } diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorService.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorService.java index 425f78fc52f..97aaa45408f 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorService.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorService.java @@ -35,7 +35,7 @@ import ca.uhn.fhir.jpa.model.entity.BasePartitionable; import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParam; import ca.uhn.fhir.jpa.model.entity.IResourceIndexComboSearchParameter; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedComboStringUnique; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedComboTokenNonUnique; @@ -84,7 +84,7 @@ public class SearchParamExtractorService { @Autowired private IInterceptorBroadcaster myInterceptorBroadcaster; @Autowired - private ModelConfig myModelConfig; + private StorageSettings myStorageSettings; @Autowired private FhirContext myContext; @Autowired @@ -117,7 +117,7 @@ public class SearchParamExtractorService { extractSearchIndexParameters(theRequestDetails, normalParams, theResource); mergeParams(normalParams, theNewParams); - if (myModelConfig.isIndexOnContainedResources()) { + if (myStorageSettings.isIndexOnContainedResources()) { ResourceIndexedSearchParams containedParams = new ResourceIndexedSearchParams(); extractSearchIndexParametersForContainedResources(theRequestDetails, containedParams, theResource, theEntity); mergeParams(containedParams, theNewParams); @@ -129,7 +129,7 @@ public class SearchParamExtractorService { // Reference search parameters extractResourceLinks(theRequestPartitionId, theExistingParams, theNewParams, theEntity, theResource, theTransactionDetails, theFailOnInvalidReference, theRequestDetails); - if (myModelConfig.isIndexOnContainedResources()) { + if (myStorageSettings.isIndexOnContainedResources()) { extractResourceLinksForContainedResources(theRequestPartitionId, theNewParams, theEntity, theResource, theTransactionDetails, theFailOnInvalidReference, theRequestDetails); } @@ -137,8 +137,8 @@ public class SearchParamExtractorService { } @VisibleForTesting - public void setModelConfig(ModelConfig theModelConfig) { - myModelConfig = theModelConfig; + public void setStorageSettings(StorageSettings theStorageSettings) { + myStorageSettings = theStorageSettings; } private void extractSearchIndexParametersForContainedResources(RequestDetails theRequestDetails, ResourceIndexedSearchParams theParams, IBaseResource theResource, ResourceTable theEntity) { @@ -182,7 +182,7 @@ public class SearchParamExtractorService { extractSearchIndexParameters(theRequestDetails, currParams, containedResource); // 3.4 recurse to process any other contained resources referenced by this one - if (myModelConfig.isIndexOnContainedResourcesRecursively()) { + if (myStorageSettings.isIndexOnContainedResourcesRecursively()) { HashSet nextAlreadySeenResources = new HashSet<>(theAlreadySeenResources); nextAlreadySeenResources.add(containedResource); extractSearchIndexParametersForContainedResources(theRequestDetails, currParams, containedResource, theEntity, theContainedResources, nextAlreadySeenResources); @@ -237,7 +237,7 @@ public class SearchParamExtractorService { handleWarnings(theRequestDetails, myInterceptorBroadcaster, quantities); theParams.myQuantityParams.addAll(quantities); - if (myModelConfig.getNormalizedQuantitySearchLevel().equals(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_STORAGE_SUPPORTED) || myModelConfig.getNormalizedQuantitySearchLevel().equals(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED)) { + if (myStorageSettings.getNormalizedQuantitySearchLevel().equals(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_STORAGE_SUPPORTED) || myStorageSettings.getNormalizedQuantitySearchLevel().equals(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED)) { ISearchParamExtractor.SearchParamSet quantitiesNormalized = extractSearchParamQuantityNormalized(theResource); handleWarnings(theRequestDetails, myInterceptorBroadcaster, quantitiesNormalized); theParams.myQuantityNormalizedParams.addAll(quantitiesNormalized); @@ -341,7 +341,7 @@ public class SearchParamExtractorService { theNewParams.myPopulatedResourceLinkParameters.add(thePathAndRef.getSearchParamName()); boolean canonical = thePathAndRef.isCanonical(); - if (LogicalReferenceHelper.isLogicalReference(myModelConfig, nextId) || canonical) { + if (LogicalReferenceHelper.isLogicalReference(myStorageSettings, nextId) || canonical) { String value = nextId.getValue(); ResourceLink resourceLink = ResourceLink.forLogicalReference(thePathAndRef.getPath(), theEntity, value, transactionDate); if (theNewParams.myLinks.add(resourceLink)) { @@ -381,7 +381,7 @@ public class SearchParamExtractorService { } if (isNotBlank(baseUrl)) { - if (!myModelConfig.getTreatBaseUrlsAsLocal().contains(baseUrl) && !myModelConfig.isAllowExternalReferences()) { + if (!myStorageSettings.getTreatBaseUrlsAsLocal().contains(baseUrl) && !myStorageSettings.isAllowExternalReferences()) { String msg = myContext.getLocalizer().getMessage(BaseSearchParamExtractor.class, "externalReferenceNotAllowed", nextId.getValue()); throw new InvalidRequestException(Msg.code(507) + msg); } else { @@ -531,7 +531,7 @@ public class SearchParamExtractorService { extractResourceLinks(theRequestPartitionId, currParams, theEntity, containedResource, theTransactionDetails, theFailOnInvalidReference, theRequest); // 3.4 recurse to process any other contained resources referenced by this one - if (myModelConfig.isIndexOnContainedResourcesRecursively()) { + if (myStorageSettings.isIndexOnContainedResourcesRecursively()) { HashSet nextAlreadySeenResources = new HashSet<>(theAlreadySeenResources); nextAlreadySeenResources.add(containedResource); extractResourceLinksForContainedResources(theRequestPartitionId, currParams, theEntity, containedResource, theTransactionDetails, theFailOnInvalidReference, theRequest, theContainedResources, nextAlreadySeenResources); diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryResourceMatcher.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryResourceMatcher.java index f48f1d42a1c..bd1affaddbe 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryResourceMatcher.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryResourceMatcher.java @@ -28,7 +28,7 @@ import ca.uhn.fhir.context.support.ConceptValidationOptions; import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.context.support.ValidationSupportContext; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken; import ca.uhn.fhir.jpa.searchparam.MatchUrlService; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; @@ -76,7 +76,7 @@ public class InMemoryResourceMatcher { @Autowired ISearchParamRegistry mySearchParamRegistry; @Autowired - ModelConfig myModelConfig; + StorageSettings myStorageSettings; @Autowired FhirContext myFhirContext; @@ -197,7 +197,7 @@ public class InMemoryResourceMatcher { case Constants.PARAM_SOURCE: return InMemoryMatchResult.fromBoolean(matchSourcesAndOr(theAndOrParams, theResource)); default: - return matchResourceParam(myModelConfig, theParamName, theAndOrParams, theSearchParams, resourceName, paramDef); + return matchResourceParam(myStorageSettings, theParamName, theAndOrParams, theSearchParams, resourceName, paramDef); } } @@ -279,7 +279,7 @@ public class InMemoryResourceMatcher { return theValue.equals(theId.getValue()) || theValue.equals(theId.getIdPart()); } - private InMemoryMatchResult matchResourceParam(ModelConfig theModelConfig, String theParamName, List> theAndOrParams, ResourceIndexedSearchParams theSearchParams, String theResourceName, RuntimeSearchParam theParamDef) { + private InMemoryMatchResult matchResourceParam(StorageSettings theStorageSettings, String theParamName, List> theAndOrParams, ResourceIndexedSearchParams theSearchParams, String theResourceName, RuntimeSearchParam theParamDef) { if (theParamDef != null) { switch (theParamDef.getParamType()) { case QUANTITY: @@ -292,7 +292,7 @@ public class InMemoryResourceMatcher { if (theSearchParams == null) { return InMemoryMatchResult.successfulMatch(); } else { - return InMemoryMatchResult.fromBoolean(theAndOrParams.stream().allMatch(nextAnd -> matchParams(theModelConfig, theResourceName, theParamName, theParamDef, nextAnd, theSearchParams))); + return InMemoryMatchResult.fromBoolean(theAndOrParams.stream().allMatch(nextAnd -> matchParams(theStorageSettings, theResourceName, theParamName, theParamDef, nextAnd, theSearchParams))); } case COMPOSITE: case HAS: @@ -309,14 +309,14 @@ public class InMemoryResourceMatcher { } } - private boolean matchParams(ModelConfig theModelConfig, String theResourceName, String theParamName, RuntimeSearchParam theParamDef, List theOrList, ResourceIndexedSearchParams theSearchParams) { + private boolean matchParams(StorageSettings theStorageSettings, String theResourceName, String theParamName, RuntimeSearchParam theParamDef, List theOrList, ResourceIndexedSearchParams theSearchParams) { boolean isNegativeTest = isNegative(theParamDef, theOrList); // negative tests like :not and :not-in must not match any or-clause, so we invert the quantifier. if (isNegativeTest) { - return theOrList.stream().allMatch(token -> matchParam(theModelConfig, theResourceName, theParamName, theParamDef, theSearchParams, token)); + return theOrList.stream().allMatch(token -> matchParam(theStorageSettings, theResourceName, theParamName, theParamDef, theSearchParams, token)); } else { - return theOrList.stream().anyMatch(token -> matchParam(theModelConfig, theResourceName, theParamName, theParamDef, theSearchParams, token)); + return theOrList.stream().anyMatch(token -> matchParam(theStorageSettings, theResourceName, theParamName, theParamDef, theSearchParams, token)); } } @@ -332,11 +332,11 @@ public class InMemoryResourceMatcher { } - private boolean matchParam(ModelConfig theModelConfig, String theResourceName, String theParamName, RuntimeSearchParam theParamDef, ResourceIndexedSearchParams theSearchParams, IQueryParameterType theToken) { + private boolean matchParam(StorageSettings theStorageSettings, String theResourceName, String theParamName, RuntimeSearchParam theParamDef, ResourceIndexedSearchParams theSearchParams, IQueryParameterType theToken) { if (theParamDef.getParamType().equals(RestSearchParameterTypeEnum.TOKEN)) { - return matchTokenParam(theModelConfig, theResourceName, theParamName, theParamDef, theSearchParams, (TokenParam) theToken); + return matchTokenParam(theStorageSettings, theResourceName, theParamName, theParamDef, theSearchParams, (TokenParam) theToken); } else { - return theSearchParams.matchParam(theModelConfig, theResourceName, theParamName, theParamDef, theToken); + return theSearchParams.matchParam(theStorageSettings, theResourceName, theParamName, theParamDef, theToken); } } @@ -345,7 +345,7 @@ public class InMemoryResourceMatcher { * The :not modifier is supported. * The :in and :not-in qualifiers are supported only if a bean implementing IValidationSupport is available. * Any other qualifier will be ignored and the match will be treated as unqualified. - * @param theModelConfig a model configuration + * @param theStorageSettings a model configuration * @param theResourceName the name of the resource type being matched * @param theParamName the name of the parameter * @param theParamDef the definition of the search parameter @@ -353,7 +353,7 @@ public class InMemoryResourceMatcher { * @param theQueryParam the query parameter to compare with theSearchParams * @return true if theQueryParam matches the collection of theSearchParams, otherwise false */ - private boolean matchTokenParam(ModelConfig theModelConfig, String theResourceName, String theParamName, RuntimeSearchParam theParamDef, ResourceIndexedSearchParams theSearchParams, TokenParam theQueryParam) { + private boolean matchTokenParam(StorageSettings theStorageSettings, String theResourceName, String theParamName, RuntimeSearchParam theParamDef, ResourceIndexedSearchParams theSearchParams, TokenParam theQueryParam) { if (theQueryParam.getModifier() != null) { switch (theQueryParam.getModifier()) { case IN: @@ -365,12 +365,12 @@ public class InMemoryResourceMatcher { .filter(t -> t.getParamName().equals(theParamName)) .noneMatch(t -> systemContainsCode(theQueryParam, t)); case NOT: - return !theSearchParams.matchParam(theModelConfig, theResourceName, theParamName, theParamDef, theQueryParam); + return !theSearchParams.matchParam(theStorageSettings, theResourceName, theParamName, theParamDef, theQueryParam); default: - return theSearchParams.matchParam(theModelConfig, theResourceName, theParamName, theParamDef, theQueryParam); + return theSearchParams.matchParam(theStorageSettings, theResourceName, theParamName, theParamDef, theQueryParam); } } else { - return theSearchParams.matchParam(theModelConfig, theResourceName, theParamName, theParamDef, theQueryParam); + return theSearchParams.matchParam(theStorageSettings, theResourceName, theParamName, theParamDef, theQueryParam); } } diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/SearchParamRegistryImpl.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/SearchParamRegistryImpl.java index 1f9e1252ac9..e06199911e5 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/SearchParamRegistryImpl.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/SearchParamRegistryImpl.java @@ -31,7 +31,7 @@ import ca.uhn.fhir.jpa.cache.IResourceChangeListener; import ca.uhn.fhir.jpa.cache.IResourceChangeListenerCache; import ca.uhn.fhir.jpa.cache.IResourceChangeListenerRegistry; import ca.uhn.fhir.jpa.cache.ResourceChangeResult; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; @@ -77,7 +77,7 @@ public class SearchParamRegistryImpl implements ISearchParamRegistry, IResourceC private final JpaSearchParamCache myJpaSearchParamCache = new JpaSearchParamCache(); @Autowired - private ModelConfig myModelConfig; + private StorageSettings myStorageSettings; @Autowired private ISearchParamProvider mySearchParamProvider; @Autowired @@ -200,7 +200,7 @@ public class SearchParamRegistryImpl implements ISearchParamRegistry, IResourceC private ReadOnlySearchParamCache getBuiltInSearchParams() { if (myBuiltInSearchParams == null) { - if (myModelConfig.isAutoSupportDefaultSearchParams()) { + if (myStorageSettings.isAutoSupportDefaultSearchParams()) { myBuiltInSearchParams = ReadOnlySearchParamCache.fromFhirContext(myFhirContext, mySearchParameterCanonicalizer); } else { // Only the built-in search params that can not be disabled will be supported automatically @@ -218,12 +218,12 @@ public class SearchParamRegistryImpl implements ISearchParamRegistry, IResourceC } @VisibleForTesting - public void setModelConfig(ModelConfig theModelConfig) { - myModelConfig = theModelConfig; + public void setStorageSettings(StorageSettings theStorageSettings) { + myStorageSettings = theStorageSettings; } private long overrideBuiltinSearchParamsWithActiveJpaSearchParams(RuntimeSearchParamCache theSearchParamCache, Collection theSearchParams) { - if (!myModelConfig.isDefaultSearchParamsCanBeOverridden() || theSearchParams == null) { + if (!myStorageSettings.isDefaultSearchParamsCanBeOverridden() || theSearchParams == null) { return 0; } diff --git a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/IndexStressTest.java b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/IndexStressTest.java index c8eff33dc6b..85452c0ca67 100644 --- a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/IndexStressTest.java +++ b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/IndexStressTest.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.searchparam; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString; import ca.uhn.fhir.jpa.searchparam.extractor.SearchParamExtractorDstu3; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; @@ -38,7 +38,7 @@ public class IndexStressTest { IValidationSupport mockValidationSupport = mock(IValidationSupport.class); when(mockValidationSupport.getFhirContext()).thenReturn(ctx); ISearchParamRegistry searchParamRegistry = mock(ISearchParamRegistry.class); - SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new ModelConfig(), new PartitionSettings(), ctx, searchParamRegistry); + SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new StorageSettings(), new PartitionSettings(), ctx, searchParamRegistry); extractor.start(); ResourceSearchParams resourceSearchParams = new ResourceSearchParams("Patient"); diff --git a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/ResourceIndexedSearchParamsTest.java b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/ResourceIndexedSearchParamsTest.java index 0c5323ada8f..a95b46d3600 100644 --- a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/ResourceIndexedSearchParamsTest.java +++ b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/ResourceIndexedSearchParamsTest.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.searchparam.extractor; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceLink; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.rest.param.ReferenceParam; @@ -24,7 +24,7 @@ public class ResourceIndexedSearchParamsTest { public static final String LONG_ID = "123"; private ResourceIndexedSearchParams myParams; private ResourceTable mySource; - private ModelConfig myModelConfig = new ModelConfig(); + private StorageSettings myStorageSettings = new StorageSettings(); @BeforeEach public void before() { @@ -40,7 +40,7 @@ public class ResourceIndexedSearchParamsTest { myParams.getResourceLinks().add(link); ReferenceParam referenceParam = getReferenceParam(STRING_ID); - boolean result = myParams.matchResourceLinks(myModelConfig, "Patient", "organization", referenceParam, "organization"); + boolean result = myParams.matchResourceLinks(myStorageSettings, "Patient", "organization", referenceParam, "organization"); assertFalse(result); } @@ -50,7 +50,7 @@ public class ResourceIndexedSearchParamsTest { myParams.getResourceLinks().add(link); ReferenceParam referenceParam = getReferenceParam(STRING_ID); - boolean result = myParams.matchResourceLinks(myModelConfig, "Patient", "organization", referenceParam, "organization"); + boolean result = myParams.matchResourceLinks(myStorageSettings, "Patient", "organization", referenceParam, "organization"); assertTrue(result); } @@ -60,7 +60,7 @@ public class ResourceIndexedSearchParamsTest { myParams.getResourceLinks().add(link); ReferenceParam referenceParam = getReferenceParam(LONG_ID); - boolean result = myParams.matchResourceLinks(myModelConfig, "Patient", "organization", referenceParam, "organization"); + boolean result = myParams.matchResourceLinks(myStorageSettings, "Patient", "organization", referenceParam, "organization"); assertFalse(result); } @@ -70,7 +70,7 @@ public class ResourceIndexedSearchParamsTest { myParams.getResourceLinks().add(link); ReferenceParam referenceParam = getReferenceParam(LONG_ID); - boolean result = myParams.matchResourceLinks(myModelConfig, "Patient", "organization", referenceParam, "organization"); + boolean result = myParams.matchResourceLinks(myStorageSettings, "Patient", "organization", referenceParam, "organization"); assertTrue(result); } diff --git a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu3Test.java b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu3Test.java index a81f25a5e9f..eb3024f548d 100644 --- a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu3Test.java +++ b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorDstu3Test.java @@ -9,7 +9,7 @@ import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.jpa.cache.ResourceChangeResult; import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParam; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamCoords; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamNumber; @@ -64,7 +64,7 @@ public class SearchParamExtractorDstu3Test { ISearchParamRegistry searchParamRegistry = new MySearchParamRegistry(); - SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new ModelConfig(), new PartitionSettings(), ourCtx, searchParamRegistry); + SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new StorageSettings(), new PartitionSettings(), ourCtx, searchParamRegistry); extractor.start(); Set tokens = extractor.extractSearchParamTokens(obs); assertEquals(1, tokens.size()); @@ -87,7 +87,7 @@ public class SearchParamExtractorDstu3Test { ISearchParamRegistry searchParamRegistry = new MySearchParamRegistry(); - SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new ModelConfig(), new PartitionSettings(), ourCtx, searchParamRegistry); + SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new StorageSettings(), new PartitionSettings(), ourCtx, searchParamRegistry); extractor.start(); Set params = extractor.extractSearchParamStrings(questionnaire); assertEquals(1, params.size()); @@ -105,7 +105,7 @@ public class SearchParamExtractorDstu3Test { ISearchParamRegistry searchParamRegistry = new MySearchParamRegistry(); - SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new ModelConfig(), new PartitionSettings(), ourCtx, searchParamRegistry); + SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new StorageSettings(), new PartitionSettings(), ourCtx, searchParamRegistry); extractor.start(); Set params = extractor.extractSearchParamNumber(enc); assertEquals(1, params.size()); @@ -116,7 +116,7 @@ public class SearchParamExtractorDstu3Test { @Test public void testPathSplitOnSpsWorks() { ISearchParamRegistry searchParamRegistry = new MySearchParamRegistry(); - SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new ModelConfig(), new PartitionSettings(), ourCtx, searchParamRegistry); + SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new StorageSettings(), new PartitionSettings(), ourCtx, searchParamRegistry); String threeSegmentPath = "Patient.telecom.where(system='phone' or system='email') | Patient.telecom.where(system='email') or Patient.telecom.where(system='mail' | system='phone')"; String[] expressions = extractor.split(threeSegmentPath); @@ -141,7 +141,7 @@ public class SearchParamExtractorDstu3Test { ISearchParamRegistry searchParamRegistry = new MySearchParamRegistry(); - SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new ModelConfig(), new PartitionSettings(), ourCtx, searchParamRegistry); + SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new StorageSettings(), new PartitionSettings(), ourCtx, searchParamRegistry); extractor.start(); Set params = extractor.extractSearchParamNumber(enc); assertEquals(1, params.size()); @@ -153,7 +153,7 @@ public class SearchParamExtractorDstu3Test { public void testEmptyPath() { MySearchParamRegistry searchParamRegistry = new MySearchParamRegistry(); - SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new ModelConfig(), new PartitionSettings(), ourCtx, searchParamRegistry); + SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new StorageSettings(), new PartitionSettings(), ourCtx, searchParamRegistry); extractor.start(); searchParamRegistry.addSearchParam(new RuntimeSearchParam(null, null, "foo", "foo", "", RestSearchParameterTypeEnum.STRING, Sets.newHashSet(), Sets.newHashSet(), RuntimeSearchParam.RuntimeSearchParamStatusEnum.ACTIVE, null, null, null)); @@ -169,7 +169,7 @@ public class SearchParamExtractorDstu3Test { public void testStringMissingResourceType() { MySearchParamRegistry searchParamRegistry = new MySearchParamRegistry(); - SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new ModelConfig(), new PartitionSettings(), ourCtx, searchParamRegistry); + SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new StorageSettings(), new PartitionSettings(), ourCtx, searchParamRegistry); extractor.start(); searchParamRegistry.addSearchParam(new RuntimeSearchParam(null, null, "foo", "foo", "communication.language.coding.system | communication.language.coding.code", RestSearchParameterTypeEnum.STRING, Sets.newHashSet(), Sets.newHashSet(), RuntimeSearchParam.RuntimeSearchParamStatusEnum.ACTIVE, null, null, null)); @@ -186,7 +186,7 @@ public class SearchParamExtractorDstu3Test { public void testInvalidType() { MySearchParamRegistry searchParamRegistry = new MySearchParamRegistry(); - SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new ModelConfig(), new PartitionSettings(), ourCtx, searchParamRegistry); + SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new StorageSettings(), new PartitionSettings(), ourCtx, searchParamRegistry); extractor.start(); ArrayList base = Lists.newArrayList("Patient"); @@ -238,7 +238,7 @@ public class SearchParamExtractorDstu3Test { ISearchParamRegistry searchParamRegistry = new MySearchParamRegistry(); - SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new ModelConfig(), new PartitionSettings(), ourCtx, searchParamRegistry); + SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new StorageSettings(), new PartitionSettings(), ourCtx, searchParamRegistry); extractor.start(); ISearchParamExtractor.SearchParamSet coords = extractor.extractSearchParamTokens(loc); assertEquals(1, coords.size()); diff --git a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorMegaTest.java b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorMegaTest.java index 9d26d410443..f953903e732 100644 --- a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorMegaTest.java +++ b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorMegaTest.java @@ -16,7 +16,7 @@ import ca.uhn.fhir.context.RuntimePrimitiveDatatypeNarrativeDefinition; import ca.uhn.fhir.context.RuntimePrimitiveDatatypeXhtmlHl7OrgDefinition; import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.rest.server.util.FhirContextSearchParamRegistry; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import com.google.common.collect.Lists; @@ -56,16 +56,16 @@ public class SearchParamExtractorMegaTest { BaseSearchParamExtractor extractor; switch (theFhirContext.getVersion().getVersion()) { case DSTU2: - extractor = new SearchParamExtractorDstu2(new ModelConfig(), partitionSettings, theFhirContext, searchParamRegistry); + extractor = new SearchParamExtractorDstu2(new StorageSettings(), partitionSettings, theFhirContext, searchParamRegistry); break; case DSTU3: - extractor = new SearchParamExtractorDstu3(new ModelConfig(), partitionSettings, theFhirContext, searchParamRegistry); + extractor = new SearchParamExtractorDstu3(new StorageSettings(), partitionSettings, theFhirContext, searchParamRegistry); break; case R4: - extractor = new SearchParamExtractorR4(new ModelConfig(), partitionSettings, theFhirContext, searchParamRegistry); + extractor = new SearchParamExtractorR4(new StorageSettings(), partitionSettings, theFhirContext, searchParamRegistry); break; case R5: - extractor = new SearchParamExtractorR5(new ModelConfig(), partitionSettings, theFhirContext, searchParamRegistry); + extractor = new SearchParamExtractorR5(new StorageSettings(), partitionSettings, theFhirContext, searchParamRegistry); break; case R4B: case DSTU2_HL7ORG: diff --git a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryResourceMatcherConfigurationR5Test.java b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryResourceMatcherConfigurationR5Test.java index 95ce82fd6da..d8bfac3c3c0 100644 --- a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryResourceMatcherConfigurationR5Test.java +++ b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryResourceMatcherConfigurationR5Test.java @@ -5,7 +5,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeSearchParam; import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken; import ca.uhn.fhir.jpa.searchparam.MatchUrlService; import ca.uhn.fhir.jpa.searchparam.extractor.ResourceIndexedSearchParams; @@ -125,8 +125,8 @@ public class InMemoryResourceMatcherConfigurationR5Test { } @Bean - ModelConfig modelConfig() { - return new ModelConfig(); + StorageSettings storageSettings() { + return new StorageSettings(); } } diff --git a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryResourceMatcherR5Test.java b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryResourceMatcherR5Test.java index 606a26154e3..535d232d8e8 100644 --- a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryResourceMatcherR5Test.java +++ b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryResourceMatcherR5Test.java @@ -4,7 +4,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeSearchParam; import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken; import ca.uhn.fhir.jpa.searchparam.MatchUrlService; @@ -418,8 +418,8 @@ public class InMemoryResourceMatcherR5Test { } @Bean - ModelConfig modelConfig() { - return new ModelConfig(); + StorageSettings storageSettings() { + return new StorageSettings(); } } diff --git a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/registry/SearchParamRegistryImplTest.java b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/registry/SearchParamRegistryImplTest.java index 39799424eeb..1381d5971ea 100644 --- a/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/registry/SearchParamRegistryImplTest.java +++ b/hapi-fhir-jpaserver-searchparam/src/test/java/ca/uhn/fhir/jpa/searchparam/registry/SearchParamRegistryImplTest.java @@ -12,9 +12,8 @@ import ca.uhn.fhir.jpa.cache.ResourceChangeListenerRegistryImpl; import ca.uhn.fhir.jpa.cache.ResourceChangeResult; import ca.uhn.fhir.jpa.cache.ResourceVersionMap; import ca.uhn.fhir.jpa.cache.config.RegisteredResourceListenerFactoryConfig; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceTable; -import ca.uhn.fhir.jpa.model.sched.ISchedulerService; import ca.uhn.fhir.jpa.searchparam.MatchUrlService; import ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult; import ca.uhn.fhir.jpa.searchparam.matcher.InMemoryResourceMatcher; @@ -109,10 +108,10 @@ public class SearchParamRegistryImplTest { } @Bean - ModelConfig modelConfig() { - ModelConfig modelConfig = new ModelConfig(); - modelConfig.setDefaultSearchParamsCanBeOverridden(true); - return modelConfig; + StorageSettings storageSettings() { + StorageSettings storageSettings = new StorageSettings(); + storageSettings.setDefaultSearchParamsCanBeOverridden(true); + return storageSettings; } @Bean diff --git a/hapi-fhir-jpaserver-subscription/pom.xml b/hapi-fhir-jpaserver-subscription/pom.xml index 1ec3b1d97fc..508e1d29417 100644 --- a/hapi-fhir-jpaserver-subscription/pom.xml +++ b/hapi-fhir-jpaserver-subscription/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/config/SubscriptionProcessorConfig.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/config/SubscriptionProcessorConfig.java index 4c62f43567d..ca98cee942d 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/config/SubscriptionProcessorConfig.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/config/SubscriptionProcessorConfig.java @@ -39,7 +39,6 @@ import ca.uhn.fhir.jpa.subscription.match.matcher.subscriber.SubscriptionRegiste import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionLoader; import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry; import ca.uhn.fhir.jpa.subscription.model.config.SubscriptionModelConfig; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Primary; diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/config/WebsocketDispatcherConfig.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/config/WebsocketDispatcherConfig.java index 249857ec5d6..d65fa1a6999 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/config/WebsocketDispatcherConfig.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/config/WebsocketDispatcherConfig.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.subscription.match.config; * #L% */ -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.subscription.match.deliver.websocket.SubscriptionWebsocketHandler; import ca.uhn.fhir.jpa.subscription.match.deliver.websocket.WebsocketConnectionValidator; import org.springframework.beans.factory.annotation.Autowired; @@ -39,7 +39,7 @@ import org.springframework.web.socket.handler.PerConnectionWebSocketHandler; public class WebsocketDispatcherConfig implements WebSocketConfigurer { @Autowired - ModelConfig myModelConfig; + StorageSettings myStorageSettings; @Bean public WebsocketConnectionValidator websocketConnectionValidator() { @@ -48,7 +48,7 @@ public class WebsocketDispatcherConfig implements WebSocketConfigurer { @Override public void registerWebSocketHandlers(WebSocketHandlerRegistry theRegistry) { - theRegistry.addHandler(subscriptionWebSocketHandler(), myModelConfig.getWebsocketContextPath()).setAllowedOrigins("*"); + theRegistry.addHandler(subscriptionWebSocketHandler(), myStorageSettings.getWebsocketContextPath()).setAllowedOrigins("*"); } @Bean diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/deliver/email/SubscriptionDeliveringEmailSubscriber.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/deliver/email/SubscriptionDeliveringEmailSubscriber.java index ef642d7a007..61ff8b2505b 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/deliver/email/SubscriptionDeliveringEmailSubscriber.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/deliver/email/SubscriptionDeliveringEmailSubscriber.java @@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.subscription.match.deliver.email; */ import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.subscription.match.deliver.BaseSubscriptionDeliverySubscriber; import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription; import ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage; @@ -42,7 +42,7 @@ public class SubscriptionDeliveringEmailSubscriber extends BaseSubscriptionDeliv private Logger ourLog = LoggerFactory.getLogger(SubscriptionDeliveringEmailSubscriber.class); @Autowired - private ModelConfig myModelConfig; + private StorageSettings myStorageSettings; @Autowired private FhirContext myCtx; @@ -76,7 +76,7 @@ public class SubscriptionDeliveringEmailSubscriber extends BaseSubscriptionDeliv } } - String from = processEmailAddressUri(defaultString(subscription.getEmailDetails().getFrom(), myModelConfig.getEmailFromAddress())); + String from = processEmailAddressUri(defaultString(subscription.getEmailDetails().getFrom(), myStorageSettings.getEmailFromAddress())); String subjectTemplate = defaultString(subscription.getEmailDetails().getSubjectTemplate(), provideDefaultSubjectTemplate()); EmailDetails details = new EmailDetails(); diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/matcher/matching/CompositeInMemoryDaoSubscriptionMatcher.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/matcher/matching/CompositeInMemoryDaoSubscriptionMatcher.java index 5319e168f35..741cc7bac4b 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/matcher/matching/CompositeInMemoryDaoSubscriptionMatcher.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/matcher/matching/CompositeInMemoryDaoSubscriptionMatcher.java @@ -20,7 +20,8 @@ package ca.uhn.fhir.jpa.subscription.match.matcher.matching; * #L% */ -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult; import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription; import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage; @@ -34,7 +35,7 @@ public class CompositeInMemoryDaoSubscriptionMatcher implements ISubscriptionMat private final DaoSubscriptionMatcher myDaoSubscriptionMatcher; private final InMemorySubscriptionMatcher myInMemorySubscriptionMatcher; @Autowired - DaoConfig myDaoConfig; + StorageSettings myStorageSettings; public CompositeInMemoryDaoSubscriptionMatcher(DaoSubscriptionMatcher theDaoSubscriptionMatcher, InMemorySubscriptionMatcher theInMemorySubscriptionMatcher) { myDaoSubscriptionMatcher = theDaoSubscriptionMatcher; @@ -44,7 +45,7 @@ public class CompositeInMemoryDaoSubscriptionMatcher implements ISubscriptionMat @Override public InMemoryMatchResult match(CanonicalSubscription theSubscription, ResourceModifiedMessage theMsg) { InMemoryMatchResult result; - if (myDaoConfig.isEnableInMemorySubscriptionMatching()) { + if (myStorageSettings.isEnableInMemorySubscriptionMatching()) { result = myInMemorySubscriptionMatcher.match(theSubscription, theMsg); if (result.supported()) { result.setInMemory(true); diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/matcher/subscriber/MatchingQueueSubscriberLoader.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/matcher/subscriber/MatchingQueueSubscriberLoader.java index b9d2798968a..f0ee61fefcb 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/matcher/subscriber/MatchingQueueSubscriberLoader.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/matcher/subscriber/MatchingQueueSubscriberLoader.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.subscription.match.matcher.subscriber; import ca.uhn.fhir.IHapiBootOrder; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.subscription.channel.api.ChannelConsumerSettings; import ca.uhn.fhir.jpa.subscription.channel.api.IChannelReceiver; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory; @@ -38,7 +38,7 @@ import static ca.uhn.fhir.jpa.subscription.match.matcher.subscriber.Subscription public class MatchingQueueSubscriberLoader { protected IChannelReceiver myMatchingChannel; - private Logger ourLog = LoggerFactory.getLogger(MatchingQueueSubscriberLoader.class); + private static final Logger ourLog = LoggerFactory.getLogger(MatchingQueueSubscriberLoader.class); @Autowired private SubscriptionMatchingSubscriber mySubscriptionMatchingSubscriber; @Autowired @@ -48,7 +48,7 @@ public class MatchingQueueSubscriberLoader { @Autowired private SubscriptionActivatingSubscriber mySubscriptionActivatingSubscriber; @Autowired - private DaoConfig myDaoConfig; + private StorageSettings myStorageSettings; @EventListener(ContextRefreshedEvent.class) @Order(IHapiBootOrder.SUBSCRIPTION_MATCHING_CHANNEL_HANDLER) @@ -65,9 +65,9 @@ public class MatchingQueueSubscriberLoader { } private ChannelConsumerSettings getChannelConsumerSettings() { - ChannelConsumerSettings channelConsumerSettings = new ChannelConsumerSettings(); - channelConsumerSettings.setQualifyChannelName(myDaoConfig.isQualifySubscriptionMatchingChannelName()); - return channelConsumerSettings; + ChannelConsumerSettings channelConsumerSettings = new ChannelConsumerSettings(); + channelConsumerSettings.setQualifyChannelName(myStorageSettings.isQualifySubscriptionMatchingChannelName()); + return channelConsumerSettings; } @SuppressWarnings("unused") diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/matcher/subscriber/SubscriptionActivatingSubscriber.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/matcher/subscriber/SubscriptionActivatingSubscriber.java index 0db6757cfce..2e67b757470 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/matcher/subscriber/SubscriptionActivatingSubscriber.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/matcher/subscriber/SubscriptionActivatingSubscriber.java @@ -20,9 +20,10 @@ package ca.uhn.fhir.jpa.subscription.match.matcher.subscriber; * #L% */ -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer; import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionConstants; @@ -56,7 +57,7 @@ public class SubscriptionActivatingSubscriber extends BaseSubscriberForSubscript @Autowired private SubscriptionCanonicalizer mySubscriptionCanonicalizer; @Autowired - private DaoConfig myDaoConfig; + private StorageSettings myStorageSettings; /** * Constructor @@ -82,6 +83,7 @@ public class SubscriptionActivatingSubscriber extends BaseSubscriberForSubscript case UPDATE: activateSubscriptionIfRequired(payload.getNewPayload(myFhirContext)); break; + case TRANSACTION: case DELETE: case MANUALLY_TRIGGERED: default: @@ -103,7 +105,7 @@ public class SubscriptionActivatingSubscriber extends BaseSubscriberForSubscript // Only activate supported subscriptions if (subscriptionChannelType == null - || !myDaoConfig.getSupportedSubscriptionTypes().contains(subscriptionChannelType.toCanonical())) { + || !myStorageSettings.getSupportedSubscriptionTypes().contains(subscriptionChannelType.toCanonical())) { return false; } @@ -147,7 +149,7 @@ public class SubscriptionActivatingSubscriber extends BaseSubscriberForSubscript public boolean isChannelTypeSupported(IBaseResource theSubscription) { Subscription.SubscriptionChannelType channelType = mySubscriptionCanonicalizer.getChannelType(theSubscription).toCanonical(); - return myDaoConfig.getSupportedSubscriptionTypes().contains(channelType); + return myStorageSettings.getSupportedSubscriptionTypes().contains(channelType); } } diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionMatcherInterceptor.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionMatcherInterceptor.java index 36e6a4b1f6b..712a0c8832d 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionMatcherInterceptor.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionMatcherInterceptor.java @@ -7,7 +7,7 @@ import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.Interceptor; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc; import ca.uhn.fhir.jpa.subscription.channel.api.ChannelProducerSettings; import ca.uhn.fhir.jpa.subscription.channel.impl.LinkedBlockingChannel; @@ -62,7 +62,7 @@ public class SubscriptionMatcherInterceptor implements IResourceModifiedConsumer @Autowired private SubscriptionChannelFactory mySubscriptionChannelFactory; @Autowired - private DaoConfig myDaoConfig; + private StorageSettings myStorageSettings; @Autowired private IRequestPartitionHelperSvc myRequestPartitionHelperSvc; @@ -77,7 +77,7 @@ public class SubscriptionMatcherInterceptor implements IResourceModifiedConsumer @EventListener(classes = {ContextRefreshedEvent.class}) public void startIfNeeded() { - if (myDaoConfig.getSupportedSubscriptionTypes().isEmpty()) { + if (myStorageSettings.getSupportedSubscriptionTypes().isEmpty()) { ourLog.debug("Subscriptions are disabled on this server. Skipping {} channel creation.", SubscriptionMatchingSubscriber.SUBSCRIPTION_MATCHING_CHANNEL_NAME); return; } @@ -101,7 +101,7 @@ public class SubscriptionMatcherInterceptor implements IResourceModifiedConsumer @Hook(Pointcut.STORAGE_PRECOMMIT_RESOURCE_UPDATED) public void resourceUpdated(IBaseResource theOldResource, IBaseResource theNewResource, RequestDetails theRequest) { startIfNeeded(); - if (!myDaoConfig.isTriggerSubscriptionsForNonVersioningChanges()) { + if (!myStorageSettings.isTriggerSubscriptionsForNonVersioningChanges()) { if (theOldResource != null && theNewResource != null) { String oldVersion = theOldResource.getIdElement().getVersionIdPart(); String newVersion = theNewResource.getIdElement().getVersionIdPart(); @@ -168,8 +168,8 @@ public class SubscriptionMatcherInterceptor implements IResourceModifiedConsumer } private ChannelProducerSettings getChannelProducerSettings() { - ChannelProducerSettings channelProducerSettings= new ChannelProducerSettings(); - channelProducerSettings.setQualifyChannelName(myDaoConfig.isQualifySubscriptionMatchingChannelName()); + ChannelProducerSettings channelProducerSettings = new ChannelProducerSettings(); + channelProducerSettings.setQualifyChannelName(myStorageSettings.isQualifySubscriptionMatchingChannelName()); return channelProducerSettings; } diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionSubmitInterceptorLoader.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionSubmitInterceptorLoader.java index 2315359c542..034c6ed82e9 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionSubmitInterceptorLoader.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionSubmitInterceptorLoader.java @@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.subscription.submit.interceptor; */ import ca.uhn.fhir.interceptor.api.IInterceptorService; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import com.google.common.annotations.VisibleForTesting; import org.hl7.fhir.dstu2.model.Subscription; import org.slf4j.Logger; @@ -39,7 +39,7 @@ public class SubscriptionSubmitInterceptorLoader { @Autowired private SubscriptionValidatingInterceptor mySubscriptionValidatingInterceptor; @Autowired - private DaoConfig myDaoConfig; + private StorageSettings myStorageSettings; @Autowired private IInterceptorService myInterceptorRegistry; private boolean mySubscriptionValidatingInterceptorRegistered; @@ -47,7 +47,7 @@ public class SubscriptionSubmitInterceptorLoader { @PostConstruct public void start() { - Set supportedSubscriptionTypes = myDaoConfig.getSupportedSubscriptionTypes(); + Set supportedSubscriptionTypes = myStorageSettings.getSupportedSubscriptionTypes(); if (supportedSubscriptionTypes.isEmpty()) { ourLog.info("Subscriptions are disabled on this server. Subscriptions will not be activated and incoming resources will not be matched against subscriptions."); diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionValidatingInterceptor.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionValidatingInterceptor.java index 12f7d275214..f555d0a1278 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionValidatingInterceptor.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionValidatingInterceptor.java @@ -26,8 +26,9 @@ import ca.uhn.fhir.interceptor.api.Hook; import ca.uhn.fhir.interceptor.api.Interceptor; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc; import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionMatchingStrategy; @@ -60,7 +61,7 @@ public class SubscriptionValidatingInterceptor { @Autowired private DaoRegistry myDaoRegistry; @Autowired - private DaoConfig myDaoConfig; + private StorageSettings myStorageSettings; @Autowired private SubscriptionStrategyEvaluator mySubscriptionStrategyEvaluator; @@ -171,7 +172,7 @@ public class SubscriptionValidatingInterceptor { Pointcut thePointcut) { // If the subscription has the cross partition tag if (SubscriptionUtil.isCrossPartition(theSubscription) && !(theRequestDetails instanceof SystemRequestDetails)) { - if (!myDaoConfig.isCrossPartitionSubscriptionEnabled()){ + if (!myStorageSettings.isCrossPartitionSubscriptionEnabled()){ throw new UnprocessableEntityException(Msg.code(2009) + "Cross partition subscription is not enabled on this server"); } @@ -296,8 +297,8 @@ public class SubscriptionValidatingInterceptor { } @VisibleForTesting - public void setDaoConfigForUnitTest(DaoConfig theDaoConfig) { - myDaoConfig = theDaoConfig; + public void setStorageSettingsForUnitTest(JpaStorageSettings theStorageSettings) { + myStorageSettings = theStorageSettings; } @VisibleForTesting diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/triggering/SubscriptionTriggeringSvcImpl.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/triggering/SubscriptionTriggeringSvcImpl.java index df8a15483c2..52bfbd4e7ec 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/triggering/SubscriptionTriggeringSvcImpl.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/triggering/SubscriptionTriggeringSvcImpl.java @@ -24,7 +24,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc; @@ -96,7 +96,7 @@ public class SubscriptionTriggeringSvcImpl implements ISubscriptionTriggeringSvc @Autowired private DaoRegistry myDaoRegistry; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Autowired private ISearchCoordinatorSvc mySearchCoordinatorSvc; @Autowired @@ -112,7 +112,7 @@ public class SubscriptionTriggeringSvcImpl implements ISubscriptionTriggeringSvc @Override public IBaseParameters triggerSubscription(List> theResourceIds, List> theSearchUrls, @IdParam IIdType theSubscriptionId) { - if (myDaoConfig.getSupportedSubscriptionTypes().isEmpty()) { + if (myStorageSettings.getSupportedSubscriptionTypes().isEmpty()) { throw new PreconditionFailedException(Msg.code(22) + "Subscription processing not active on this server"); } diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/match/matcher/matching/DaoSubscriptionMatcherTest.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/match/matcher/matching/DaoSubscriptionMatcherTest.java index b61d8cce945..975b78a6565 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/match/matcher/matching/DaoSubscriptionMatcherTest.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/match/matcher/matching/DaoSubscriptionMatcherTest.java @@ -3,12 +3,10 @@ package ca.uhn.fhir.jpa.subscription.match.matcher.matching; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.interceptor.api.IInterceptorService; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.cache.IResourceVersionSvc; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; -import ca.uhn.fhir.jpa.model.sched.ISchedulerService; import ca.uhn.fhir.jpa.searchparam.config.SearchParamConfig; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamProvider; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory; @@ -38,12 +36,8 @@ public class DaoSubscriptionMatcherTest { @Autowired(required = false) private PlatformTransactionManager myTxManager; - @Autowired - private DaoSubscriptionMatcher mySvc; @MockBean - private ModelConfig myModelConfig; - @MockBean - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @MockBean private ISearchParamProvider mySearchParamProvider; @MockBean diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/match/matcher/subscriber/SubscriptionActivatingSubscriberTest.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/match/matcher/subscriber/SubscriptionActivatingSubscriberTest.java index d4f73a96ad9..986ab5ce5ca 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/match/matcher/subscriber/SubscriptionActivatingSubscriberTest.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/match/matcher/subscriber/SubscriptionActivatingSubscriberTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.subscription.match.matcher.subscriber; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.rest.api.server.SystemRequestDetails; @@ -55,7 +55,7 @@ public class SubscriptionActivatingSubscriberTest { private SubscriptionCanonicalizer mySubscriptionCanonicallizer; @Mock - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Mock private SubscriptionStrategyEvaluator mySubscriptionStrategyEvaluator; @@ -93,7 +93,7 @@ public class SubscriptionActivatingSubscriberTest { // when Mockito.when(mySubscriptionCanonicallizer.getChannelType(Mockito.any(IBaseResource.class))) .thenReturn(type); - Mockito.when(myDaoConfig.getSupportedSubscriptionTypes()) + Mockito.when(myStorageSettings.getSupportedSubscriptionTypes()) .thenReturn(Sets.newSet(type.toCanonical())); Mockito.when(mySubscriptionCanonicallizer.getSubscriptionStatus(Mockito.any(IBaseResource.class))) .thenReturn(SubscriptionConstants.REQUESTED_STATUS); diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/BaseSubscriptionTest.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/BaseSubscriptionTest.java index 7a75d48a9d0..de4f081da57 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/BaseSubscriptionTest.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/BaseSubscriptionTest.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.subscription.module; import ca.uhn.fhir.interceptor.api.IInterceptorService; import ca.uhn.fhir.interceptor.executor.InterceptorService; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.searchparam.config.SearchParamConfig; import ca.uhn.fhir.jpa.searchparam.registry.SearchParamRegistryImpl; import ca.uhn.fhir.jpa.subscription.channel.api.IChannelFactory; @@ -65,8 +65,8 @@ public abstract class BaseSubscriptionTest { public static class MyConfig { @Bean - public DaoConfig daoConfig() { - return new DaoConfig(); + public JpaStorageSettings storageSettings() { + return new JpaStorageSettings(); } @Bean diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/channel/SubscriptionChannelRegistryTest.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/channel/SubscriptionChannelRegistryTest.java index 7a86cd36902..d0b78555c90 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/channel/SubscriptionChannelRegistryTest.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/channel/SubscriptionChannelRegistryTest.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.subscription.module.channel; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.subscription.channel.api.IChannelProducer; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelRegistry; @@ -33,7 +33,7 @@ public class SubscriptionChannelRegistryTest { @MockBean SubscriptionChannelFactory mySubscriptionDeliveryChannelFactory; @MockBean - ModelConfig myModelConfig; + StorageSettings myStorageSettings; @Test public void testAddAddRemoveRemove() { diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/config/TestSubscriptionConfig.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/config/TestSubscriptionConfig.java index b6454087a99..32d1147f8b3 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/config/TestSubscriptionConfig.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/config/TestSubscriptionConfig.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.subscription.module.config; import ca.uhn.fhir.jpa.cache.IResourceVersionSvc; import ca.uhn.fhir.jpa.cache.ResourceVersionMap; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.subscription.match.matcher.matching.InMemorySubscriptionMatcher; import ca.uhn.fhir.rest.client.api.IGenericClient; import org.springframework.context.annotation.Bean; @@ -26,8 +26,8 @@ public class TestSubscriptionConfig { } @Bean - public ModelConfig modelConfig() { - return new ModelConfig(); + public StorageSettings storageSettings() { + return new StorageSettings(); } @Bean diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/matcher/InMemorySubscriptionMatcherR3Test.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/matcher/InMemorySubscriptionMatcherR3Test.java index 0a7fe59ec30..80057404860 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/matcher/InMemorySubscriptionMatcherR3Test.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/matcher/InMemorySubscriptionMatcherR3Test.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.subscription.module.matcher; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult; import ca.uhn.fhir.jpa.searchparam.matcher.SearchParamMatcher; import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionMatchingStrategy; @@ -47,7 +47,7 @@ public class InMemorySubscriptionMatcherR3Test extends BaseSubscriptionDstu3Test @Autowired SearchParamMatcher mySearchParamMatcher; @Autowired - ModelConfig myModelConfig; + StorageSettings myStorageSettings; private void assertUnsupported(IBaseResource resource, String criteria) { assertFalse(mySearchParamMatcher.match(criteria, resource, null).supported()); @@ -77,7 +77,7 @@ public class InMemorySubscriptionMatcherR3Test extends BaseSubscriptionDstu3Test @AfterEach public void after() { - myModelConfig.setTreatBaseUrlsAsLocal(new ModelConfig().getTreatBaseUrlsAsLocal()); + myStorageSettings.setTreatBaseUrlsAsLocal(new StorageSettings().getTreatBaseUrlsAsLocal()); } /** @@ -626,7 +626,7 @@ public class InMemorySubscriptionMatcherR3Test extends BaseSubscriptionDstu3Test Set urls = new HashSet<>(); urls.add("http://example.com/base/"); - myModelConfig.setTreatBaseUrlsAsLocal(urls); + myStorageSettings.setTreatBaseUrlsAsLocal(urls); Patient patient = new Patient(); patient.getManagingOrganization().setReference("Organization/FOO"); diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/standalone/BaseBlockingQueueSubscribableChannelDstu3Test.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/standalone/BaseBlockingQueueSubscribableChannelDstu3Test.java index 55586bafb55..9821f972d08 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/standalone/BaseBlockingQueueSubscribableChannelDstu3Test.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/standalone/BaseBlockingQueueSubscribableChannelDstu3Test.java @@ -5,9 +5,9 @@ import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IInterceptorService; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.model.config.PartitionSettings; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.subscription.channel.api.ChannelConsumerSettings; import ca.uhn.fhir.jpa.subscription.channel.subscription.ISubscriptionDeliveryChannelNamer; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory; @@ -57,17 +57,35 @@ import java.util.Collections; import java.util.List; public abstract class BaseBlockingQueueSubscribableChannelDstu3Test extends BaseSubscriptionDstu3Test { - private static final Logger ourLog = LoggerFactory.getLogger(SubscriptionMatchingSubscriberTest.class); public static final ChannelConsumerSettings CONSUMER_OPTIONS = new ChannelConsumerSettings().setConcurrentConsumers(1); - protected static ObservationListener ourObservationListener; - - @Autowired - FhirContext myFhirContext; - @Autowired - protected DaoRegistry myDaoRegistry; + protected static final List ourCreatedObservations = Collections.synchronizedList(Lists.newArrayList()); + protected static final List ourUpdatedObservations = Collections.synchronizedList(Lists.newArrayList()); + protected static final List ourContentTypes = Collections.synchronizedList(new ArrayList<>()); + private static final Logger ourLog = LoggerFactory.getLogger(SubscriptionMatchingSubscriberTest.class); // Caused by: java.lang.IllegalStateException: Unable to register mock bean org.springframework.messaging.MessageHandler expected a single matching bean to replace but found [subscriptionActivatingSubscriber, subscriptionDeliveringEmailSubscriber, subscriptionDeliveringRestHookSubscriber, subscriptionMatchingSubscriber, subscriptionRegisteringSubscriber] - + protected static ObservationListener ourObservationListener; + protected static String ourListenerServerBase; + private static int ourListenerPort; + private static RestfulServer ourListenerRestServer; + private static Server ourListenerServer; + private static SubscribableChannel ourSubscribableChannel; + protected final PointcutLatch mySubscriptionMatchingPost = new PointcutLatch(Pointcut.SUBSCRIPTION_AFTER_PERSISTED_RESOURCE_CHECKED); + protected final PointcutLatch mySubscriptionActivatedPost = new PointcutLatch(Pointcut.SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_REGISTERED); + protected final PointcutLatch mySubscriptionAfterDelivery = new PointcutLatch(Pointcut.SUBSCRIPTION_AFTER_DELIVERY); + protected final PointcutLatch mySubscriptionResourceMatched = new PointcutLatch(Pointcut.SUBSCRIPTION_RESOURCE_MATCHED); + protected final PointcutLatch mySubscriptionResourceNotMatched = new PointcutLatch(Pointcut.SUBSCRIPTION_RESOURCE_DID_NOT_MATCH_ANY_SUBSCRIPTIONS); + @Autowired + protected DaoRegistry myDaoRegistry; + @Autowired + protected SubscriptionRegistry mySubscriptionRegistry; + @Autowired + protected PartitionSettings myPartitionSettings; + @Autowired + protected StorageSettings myStorageSettings; + protected String myCode = "1000000050"; + @Autowired + FhirContext myFhirContext; @Autowired @Qualifier("subscriptionActivatingSubscriber") MessageHandler mySubscriptionActivatingSubscriber; @@ -77,37 +95,14 @@ public abstract class BaseBlockingQueueSubscribableChannelDstu3Test extends Base @Autowired @Qualifier("subscriptionMatchingSubscriber") MessageHandler subscriptionMatchingSubscriber; - @Autowired SubscriptionChannelFactory mySubscriptionChannelFactory; @Autowired IInterceptorService myInterceptorRegistry; @Autowired - protected SubscriptionRegistry mySubscriptionRegistry; - @Autowired private SubscriptionLoader mySubscriptionLoader; @Autowired private ISubscriptionDeliveryChannelNamer mySubscriptionDeliveryChannelNamer; - @Autowired - protected PartitionSettings myPartitionSettings; - @Autowired - protected DaoConfig myDaoConfig; - - protected String myCode = "1000000050"; - - private static int ourListenerPort; - private static RestfulServer ourListenerRestServer; - private static Server ourListenerServer; - protected static String ourListenerServerBase; - protected static final List ourCreatedObservations = Collections.synchronizedList(Lists.newArrayList()); - protected static final List ourUpdatedObservations = Collections.synchronizedList(Lists.newArrayList()); - protected static final List ourContentTypes = Collections.synchronizedList(new ArrayList<>()); - private static SubscribableChannel ourSubscribableChannel; - protected final PointcutLatch mySubscriptionMatchingPost = new PointcutLatch(Pointcut.SUBSCRIPTION_AFTER_PERSISTED_RESOURCE_CHECKED); - protected final PointcutLatch mySubscriptionActivatedPost = new PointcutLatch(Pointcut.SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_REGISTERED); - protected final PointcutLatch mySubscriptionAfterDelivery = new PointcutLatch(Pointcut.SUBSCRIPTION_AFTER_DELIVERY); - protected final PointcutLatch mySubscriptionResourceMatched = new PointcutLatch(Pointcut.SUBSCRIPTION_RESOURCE_MATCHED); - protected final PointcutLatch mySubscriptionResourceNotMatched = new PointcutLatch(Pointcut.SUBSCRIPTION_RESOURCE_DID_NOT_MATCH_ANY_SUBSCRIPTIONS); @BeforeEach public void beforeReset() { @@ -179,36 +174,6 @@ public abstract class BaseBlockingQueueSubscribableChannelDstu3Test extends Base return sendResource(observation, theRequestPartitionId); } - @BeforeAll - public static void startListenerServer() throws Exception { - ourListenerRestServer = new RestfulServer(FhirContext.forDstu3()); - - ourObservationListener = new ObservationListener(); - ourListenerRestServer.setResourceProviders(ourObservationListener); - - ourListenerServer = new Server(0); - - ServletContextHandler proxyHandler = new ServletContextHandler(); - proxyHandler.setContextPath("/"); - - ServletHolder servletHolder = new ServletHolder(); - servletHolder.setServlet(ourListenerRestServer); - proxyHandler.addServlet(servletHolder, "/fhir/context/*"); - - ourListenerServer.setHandler(proxyHandler); - JettyUtil.startServer(ourListenerServer); - ourListenerPort = JettyUtil.getPortForStartedServer(ourListenerServer); - ourListenerServerBase = "http://localhost:" + ourListenerPort + "/fhir/context"; - FhirContext context = ourListenerRestServer.getFhirContext(); - //Preload structure definitions so the load doesn't happen during the test (first load can be a little slow) - context.getValidationSupport().fetchAllStructureDefinitions(); - } - - @AfterAll - public static void stopListenerServer() throws Exception { - JettyUtil.closeServer(ourListenerServer); - } - public static class ObservationListener implements IResourceProvider, IPointcutLatch { private final PointcutLatch updateLatch = new PointcutLatch("Observation Update"); @@ -250,4 +215,34 @@ public abstract class BaseBlockingQueueSubscribableChannelDstu3Test extends Base updateLatch.clear(); } } + + @BeforeAll + public static void startListenerServer() throws Exception { + ourListenerRestServer = new RestfulServer(FhirContext.forDstu3()); + + ourObservationListener = new ObservationListener(); + ourListenerRestServer.setResourceProviders(ourObservationListener); + + ourListenerServer = new Server(0); + + ServletContextHandler proxyHandler = new ServletContextHandler(); + proxyHandler.setContextPath("/"); + + ServletHolder servletHolder = new ServletHolder(); + servletHolder.setServlet(ourListenerRestServer); + proxyHandler.addServlet(servletHolder, "/fhir/context/*"); + + ourListenerServer.setHandler(proxyHandler); + JettyUtil.startServer(ourListenerServer); + ourListenerPort = JettyUtil.getPortForStartedServer(ourListenerServer); + ourListenerServerBase = "http://localhost:" + ourListenerPort + "/fhir/context"; + FhirContext context = ourListenerRestServer.getFhirContext(); + //Preload structure definitions so the load doesn't happen during the test (first load can be a little slow) + context.getValidationSupport().fetchAllStructureDefinitions(); + } + + @AfterAll + public static void stopListenerServer() throws Exception { + JettyUtil.closeServer(ourListenerServer); + } } diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/subscriber/SubscriptionMatchingSubscriberTest.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/subscriber/SubscriptionMatchingSubscriberTest.java index cc66832a24b..73e839509c2 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/subscriber/SubscriptionMatchingSubscriberTest.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/subscriber/SubscriptionMatchingSubscriberTest.java @@ -325,7 +325,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri @Test public void testCrossPartitionSubscriptionForResourceOnTheSamePartitionMatch() throws InterruptedException { myPartitionSettings.setPartitioningEnabled(true); - myDaoConfig.setCrossPartitionSubscription(true); + myStorageSettings.setCrossPartitionSubscriptionEnabled(true); String payload = "application/fhir+json"; String code = "1000000050"; @@ -347,7 +347,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri @Test public void testCrossPartitionSubscriptionForResourceOnDifferentPartitionMatch() throws InterruptedException { myPartitionSettings.setPartitioningEnabled(true); - myDaoConfig.setCrossPartitionSubscription(true); + myStorageSettings.setCrossPartitionSubscriptionEnabled(true); String payload = "application/fhir+json"; String code = "1000000050"; @@ -370,7 +370,7 @@ public class SubscriptionMatchingSubscriberTest extends BaseBlockingQueueSubscri @Test public void testCrossPartitionSubscriptionForMultipleResourceOnDifferentPartitionMatch() throws InterruptedException { myPartitionSettings.setPartitioningEnabled(true); - myDaoConfig.setCrossPartitionSubscription(true); + myStorageSettings.setCrossPartitionSubscriptionEnabled(true); String payload = "application/fhir+json"; String code = "1000000050"; diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/subscriber/websocket/WebsocketConnectionValidatorTest.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/subscriber/websocket/WebsocketConnectionValidatorTest.java index 3ffa3fa9334..4f82228bc8b 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/subscriber/websocket/WebsocketConnectionValidatorTest.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/subscriber/websocket/WebsocketConnectionValidatorTest.java @@ -2,16 +2,13 @@ package ca.uhn.fhir.jpa.subscription.module.subscriber.websocket; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.cache.IResourceChangeListenerRegistry; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; -import ca.uhn.fhir.jpa.model.sched.ISchedulerService; import ca.uhn.fhir.jpa.searchparam.MatchUrlService; import ca.uhn.fhir.jpa.searchparam.matcher.InMemoryResourceMatcher; import ca.uhn.fhir.jpa.searchparam.matcher.SearchParamMatcher; -import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import ca.uhn.fhir.jpa.subscription.channel.config.SubscriptionChannelConfig; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory; import ca.uhn.fhir.jpa.subscription.match.config.SubscriptionProcessorConfig; @@ -21,6 +18,7 @@ import ca.uhn.fhir.jpa.subscription.match.registry.ActiveSubscription; import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry; import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription; import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType; +import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import org.hl7.fhir.r4.model.IdType; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -114,8 +112,8 @@ public class WebsocketConnectionValidatorTest { public static class SpringConfig extends SubscriptionProcessorConfig { @Bean - public DaoConfig daoConfig() { - return new DaoConfig(); + public JpaStorageSettings storageSettings() { + return new JpaStorageSettings(); } @Bean @@ -123,11 +121,6 @@ public class WebsocketConnectionValidatorTest { return new PartitionSettings(); } - @Bean - public ModelConfig modelConfig() { - return new ModelConfig(); - } - @Bean public FhirContext fhirContext() { return FhirContext.forR4(); diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionMatcherInterceptorTest.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionMatcherInterceptorTest.java index 0ccec77aea7..889e2963160 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionMatcherInterceptorTest.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionMatcherInterceptorTest.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.subscription.submit.interceptor; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.subscription.channel.api.ChannelProducerSettings; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory; import org.junit.jupiter.api.extension.ExtendWith; @@ -26,7 +26,7 @@ import static org.mockito.Mockito.when; public class SubscriptionMatcherInterceptorTest { @Mock - DaoConfig myDaoConfig; + StorageSettings myStorageSettings; @Mock SubscriptionChannelFactory mySubscriptionChannelFactory; @InjectMocks @@ -39,8 +39,8 @@ public class SubscriptionMatcherInterceptorTest { public void testMethodStartIfNeeded_withQualifySubscriptionMatchingChannelNameProperty_mayQualifyChannelName(boolean theIsQualifySubMatchingChannelName){ // given boolean expectedResult = theIsQualifySubMatchingChannelName; - when(myDaoConfig.isQualifySubscriptionMatchingChannelName()).thenReturn(theIsQualifySubMatchingChannelName); - when(myDaoConfig.getSupportedSubscriptionTypes()).thenReturn(Set.of(RESTHOOK)); + when(myStorageSettings.isQualifySubscriptionMatchingChannelName()).thenReturn(theIsQualifySubMatchingChannelName); + when(myStorageSettings.getSupportedSubscriptionTypes()).thenReturn(Set.of(RESTHOOK)); // when myUnitUnderTest.startIfNeeded(); diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionSubmitInterceptorLoaderTest.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionSubmitInterceptorLoaderTest.java index b752539106f..6ad42669f81 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionSubmitInterceptorLoaderTest.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionSubmitInterceptorLoaderTest.java @@ -3,12 +3,10 @@ package ca.uhn.fhir.jpa.subscription.submit.interceptor; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.interceptor.api.IInterceptorService; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.cache.IResourceVersionSvc; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; -import ca.uhn.fhir.jpa.model.sched.ISchedulerService; import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc; import ca.uhn.fhir.jpa.searchparam.config.SearchParamConfig; import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamProvider; @@ -78,15 +76,10 @@ public class SubscriptionSubmitInterceptorLoaderTest { } @Bean - public ModelConfig modelConfig() { - return new ModelConfig(); - } - - @Bean - public DaoConfig daoConfig() { - DaoConfig daoConfig = new DaoConfig(); - daoConfig.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); - return daoConfig; + public JpaStorageSettings storageSettings() { + JpaStorageSettings storageSettings = new JpaStorageSettings(); + storageSettings.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); + return storageSettings; } } diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionValidatingInterceptorTest.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionValidatingInterceptorTest.java index 681a8ba99ac..ca9db0807db 100644 --- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionValidatingInterceptorTest.java +++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/submit/interceptor/SubscriptionValidatingInterceptorTest.java @@ -1,14 +1,13 @@ package ca.uhn.fhir.jpa.subscription.submit.interceptor; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.i18n.Msg; +import ca.uhn.fhir.interceptor.api.Pointcut; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc; import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionStrategyEvaluator; import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer; -import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import org.hl7.fhir.r4.model.Subscription; import org.junit.jupiter.api.BeforeEach; @@ -41,7 +40,7 @@ public class SubscriptionValidatingInterceptorTest { @MockBean private SubscriptionStrategyEvaluator mySubscriptionStrategyEvaluator; @MockBean - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @MockBean private IRequestPartitionHelperSvc myRequestPartitionHelperSvc; @@ -59,7 +58,7 @@ public class SubscriptionValidatingInterceptorTest { } catch (UnprocessableEntityException e) { assertThat(e.getMessage(), is(Msg.code(8) + "Can not process submitted Subscription - Subscription.status must be populated on this server")); ourLog.info("Expected exception", e); - } + } } @Test @@ -170,17 +169,6 @@ public class SubscriptionValidatingInterceptorTest { } } - @Nonnull - private static Subscription createSubscription() { - final Subscription subscription = new Subscription(); - subscription.setStatus(Subscription.SubscriptionStatus.REQUESTED); - subscription.setCriteria("Patient?"); - final Subscription.SubscriptionChannelComponent channel = subscription.getChannel(); - channel.setType(Subscription.SubscriptionChannelType.RESTHOOK); - channel.setEndpoint("channel"); - return subscription; - } - @Configuration public static class SpringConfig { @Bean @@ -198,4 +186,15 @@ public class SubscriptionValidatingInterceptorTest { return new SubscriptionCanonicalizer(theFhirContext); } } + + @Nonnull + private static Subscription createSubscription() { + final Subscription subscription = new Subscription(); + subscription.setStatus(Subscription.SubscriptionStatus.REQUESTED); + subscription.setCriteria("Patient?"); + final Subscription.SubscriptionChannelComponent channel = subscription.getChannel(); + channel.setType(Subscription.SubscriptionChannelType.RESTHOOK); + channel.setEndpoint("channel"); + return subscription; + } } diff --git a/hapi-fhir-jpaserver-test-dstu2/pom.xml b/hapi-fhir-jpaserver-test-dstu2/pom.xml index b25d68bdda4..bb6c4785982 100644 --- a/hapi-fhir-jpaserver-test-dstu2/pom.xml +++ b/hapi-fhir-jpaserver-test-dstu2/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java index 0dcef38db22..bd8155202ae 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.dstu2; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoPatient; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoSubscription; @@ -14,7 +14,6 @@ import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamStringDao; import ca.uhn.fhir.jpa.dao.data.IResourceIndexedSearchParamTokenDao; import ca.uhn.fhir.jpa.dao.data.IResourceLinkDao; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.provider.JpaSystemProvider; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.reindex.IResourceReindexingSvc; @@ -106,8 +105,6 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest { @Qualifier("myConceptMapDaoDstu2") protected IFhirResourceDao myConceptMapDao; @Autowired - protected ModelConfig myModelConfig; - @Autowired @Qualifier("myDeviceDaoDstu2") protected IFhirResourceDao myDeviceDao; @Autowired @@ -222,19 +219,19 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest { public void beforeFlushFT() { purgeHibernateSearch(myEntityManager); - myDaoConfig.setSchedulingDisabled(true); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setSchedulingDisabled(true); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); } @BeforeEach @Transactional() public void beforePurgeDatabase() { - purgeDatabase(myDaoConfig, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkExportJobSchedulingHelper); + purgeDatabase(myStorageSettings, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkExportJobSchedulingHelper); } @BeforeEach public void beforeResetConfig() { - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); } @Override diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchCustomSearchParamTest.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchCustomSearchParamTest.java index 8fc23513cf7..fc831bb7779 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchCustomSearchParamTest.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchCustomSearchParamTest.java @@ -1,8 +1,7 @@ package ca.uhn.fhir.jpa.dao.dstu2; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.model.api.ExtensionDt; @@ -37,7 +36,6 @@ import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; -import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; import org.hl7.fhir.instance.model.api.IIdType; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -60,13 +58,13 @@ public class FhirResourceDaoDstu2SearchCustomSearchParamTest extends BaseJpaDstu @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); - myDaoConfig.setDefaultSearchParamsCanBeOverridden(new ModelConfig().isDefaultSearchParamsCanBeOverridden()); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(new JpaStorageSettings().isDefaultSearchParamsCanBeOverridden()); } @AfterEach public void after() { - myDaoConfig.setValidateSearchParameterExpressionsOnSave(new DaoConfig().isValidateSearchParameterExpressionsOnSave()); + myStorageSettings.setValidateSearchParameterExpressionsOnSave(new JpaStorageSettings().isValidateSearchParameterExpressionsOnSave()); } @@ -88,7 +86,7 @@ public class FhirResourceDaoDstu2SearchCustomSearchParamTest extends BaseJpaDstu @Test public void testIndexFailsIfInvalidSearchParameterExists() { - myDaoConfig.setValidateSearchParameterExpressionsOnSave(false); + myStorageSettings.setValidateSearchParameterExpressionsOnSave(false); SearchParameter threadIdSp = new SearchParameter(); threadIdSp.setBase(ResourceTypeEnum.COMMUNICATION); @@ -280,7 +278,7 @@ public class FhirResourceDaoDstu2SearchCustomSearchParamTest extends BaseJpaDstu @Test public void testOverrideAndDisableBuiltInSearchParametersWithOverridingEnabled() { - myModelConfig.setDefaultSearchParamsCanBeOverridden(true); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(true); SearchParameter memberSp = new SearchParameter(); memberSp.setCode("member"); diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchFtTest.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchFtTest.java index a8b72629ac5..57c472b280d 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchFtTest.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchFtTest.java @@ -35,7 +35,7 @@ public class FhirResourceDaoDstu2SearchFtTest extends BaseJpaDstu2Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @Test diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java index f494f8cc8f6..12bfe63c89d 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java @@ -110,7 +110,7 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @Test diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java index bff1138067f..1493e170075 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.dstu2; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.HistoryCountModeEnum; import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; import ca.uhn.fhir.jpa.dao.BaseStorageDao; @@ -117,10 +117,10 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test { @AfterEach public final void after() { - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setTreatReferencesAsLogical(new DaoConfig().getTreatReferencesAsLogical()); - myDaoConfig.setEnforceReferentialIntegrityOnDelete(new DaoConfig().isEnforceReferentialIntegrityOnDelete()); - myDaoConfig.setHistoryCountMode(DaoConfig.DEFAULT_HISTORY_COUNT_MODE); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + myStorageSettings.setTreatReferencesAsLogical(new JpaStorageSettings().getTreatReferencesAsLogical()); + myStorageSettings.setEnforceReferentialIntegrityOnDelete(new JpaStorageSettings().isEnforceReferentialIntegrityOnDelete()); + myStorageSettings.setHistoryCountMode(JpaStorageSettings.DEFAULT_HISTORY_COUNT_MODE); } private void assertGone(IIdType theId) { @@ -147,7 +147,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } private List extractNames(IBundleProvider theSearch) { @@ -210,7 +210,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test { */ @Test public void testBuiltInLogicalReferences() throws IOException { - myDaoConfig.getTreatReferencesAsLogical().add("http://phr.kanta.fi/fiphr-vs-*"); + myStorageSettings.getTreatReferencesAsLogical().add("http://phr.kanta.fi/fiphr-vs-*"); ValueSet vsBodySite = loadResourceFromClasspath(ValueSet.class, "/issue534/fiphr-vs-bodysite.xml"); myValueSetDao.create(vsBodySite, mySrd); @@ -646,7 +646,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test { @Test public void testDeleteResource() { - myDaoConfig.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); + myStorageSettings.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); int initialHistory = myPatientDao.history(null, null, null, mySrd).size(); @@ -714,7 +714,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test { */ @Test public void testDeleteResourceWithOutboundDeletedResources() { - myDaoConfig.setEnforceReferentialIntegrityOnDelete(false); + myStorageSettings.setEnforceReferentialIntegrityOnDelete(false); Organization org = new Organization(); org.setId("ORG"); @@ -1033,7 +1033,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test { @Test public void testHistoryOverMultiplePages() throws Exception { - myDaoConfig.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); + myStorageSettings.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); String methodName = "testHistoryOverMultiplePages"; Patient patient = new Patient(); @@ -2679,7 +2679,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test { @Test public void testStringParamWhichIsTooLong() { - myDaoConfig.setAdvancedHSearchIndexing(false); + myStorageSettings.setAdvancedHSearchIndexing(false); Organization org = new Organization(); String str = "testStringParamLong__lvdaoy843s89tll8gvs89l4s3gelrukveilufyebrew8r87bv4b77feli7fsl4lv3vb7rexloxe7olb48vov4o78ls7bvo7vb48o48l4bb7vbvx"; @@ -2828,7 +2828,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test { @Test public void testValidateAgainstDstu2Profile() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); String stream = loadResource("/binu_testpatient_structuredefinition_dstu2.xml"); diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2ValidateTest.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2ValidateTest.java index 86514f49aaf..3d64fcad5d1 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2ValidateTest.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2ValidateTest.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.dao.dstu2; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.dstu2.resource.Bundle; @@ -36,12 +36,12 @@ public class FhirResourceDaoDstu2ValidateTest extends BaseJpaDstu2Test { @BeforeEach public void before() { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); } @AfterEach public void after() { - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); } @Test diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirSystemDaoDstu2Test.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirSystemDaoDstu2Test.java index 2b680a8fe45..95d375c09cd 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirSystemDaoDstu2Test.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirSystemDaoDstu2Test.java @@ -747,7 +747,7 @@ public class FhirSystemDaoDstu2Test extends BaseJpaDstu2SystemTest { @Test public void testTransactionDeleteMatchUrlWithTwoMatch() { - myDaoConfig.setAllowMultipleDelete(false); + myStorageSettings.setAllowMultipleDelete(false); String methodName = "testTransactionDeleteMatchUrlWithTwoMatch"; diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/BaseResourceProviderDstu2Test.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/BaseResourceProviderDstu2Test.java index 794b70444b0..b3b66f7206c 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/BaseResourceProviderDstu2Test.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/BaseResourceProviderDstu2Test.java @@ -46,7 +46,7 @@ public abstract class BaseResourceProviderDstu2Test extends BaseJpaDstu2Test { s.registerProvider(myAppCtx.getBean(ProcessMessageProvider.class)); s.registerProvider(myAppCtx.getBean(ValueSetOperationProvider.class)); - JpaConformanceProviderDstu2 confProvider = new JpaConformanceProviderDstu2(s, mySystemDao, myDaoConfig); + JpaConformanceProviderDstu2 confProvider = new JpaConformanceProviderDstu2(s, mySystemDao, myStorageSettings); confProvider.setImplementationDescription("THIS IS THE DESC"); s.setServerConformanceProvider(confProvider); diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java index f42d4892647..af9704df95b 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderDstu2Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.util.JpaConstants; import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl; import ca.uhn.fhir.jpa.util.QueryParameterUtils; @@ -144,9 +144,9 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test { public void after() throws Exception { super.after(); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(null); mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(QueryParameterUtils.DEFAULT_SYNC_SIZE); @@ -159,12 +159,12 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test { public void before() throws Exception { super.before(); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); } @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); mySearchCoordinatorSvcRaw = AopTestUtils.getTargetObject(mySearchCoordinatorSvc); } @@ -633,7 +633,7 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test { public void testDeleteConditionalMultiple() { String methodName = "testDeleteConditionalMultiple"; - myDaoConfig.setAllowMultipleDelete(false); + myStorageSettings.setAllowMultipleDelete(false); Patient p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); @@ -663,7 +663,7 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test { myClient.read().resource("Patient").withId(id1).execute(); myClient.read().resource("Patient").withId(id2).execute(); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); //@formatter:off myClient @@ -2786,7 +2786,7 @@ public class ResourceProviderDstu2Test extends BaseResourceProviderDstu2Test { @Test @Disabled public void testValidateDavidsAllergyIntolerance() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); /* * Upload structurredef diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderExpungeDstu2Test.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderExpungeDstu2Test.java index 66e1ff78a25..5d51f9102d9 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderExpungeDstu2Test.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/ResourceProviderExpungeDstu2Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.model.dstu2.resource.Observation; @@ -28,8 +28,8 @@ public class ResourceProviderExpungeDstu2Test extends BaseResourceProviderDstu2T @AfterEach public void afterDisableExpunge() { - myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled()); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); + myStorageSettings.setExpungeEnabled(new JpaStorageSettings().isExpungeEnabled()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); } private void assertExpunged(IIdType theId) { @@ -106,8 +106,8 @@ public class ResourceProviderExpungeDstu2Test extends BaseResourceProviderDstu2T @BeforeEach public void beforeEnableExpunge() { - myDaoConfig.setExpungeEnabled(true); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setExpungeEnabled(true); + myStorageSettings.setAllowMultipleDelete(true); } private IFhirResourceDao getDao(IIdType theId) { diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/SubscriptionsDstu2Test.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/SubscriptionsDstu2Test.java index dfa36888c9c..a428d1fb818 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/SubscriptionsDstu2Test.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/SubscriptionsDstu2Test.java @@ -44,12 +44,12 @@ public class SubscriptionsDstu2Test extends BaseResourceProviderDstu2Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @BeforeEach public void beforeEnableScheduling() { - myDaoConfig.setSchedulingDisabled(false); + myStorageSettings.setSchedulingDisabled(false); } diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu2Test.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu2Test.java index e2f0ae12d21..615309cca5a 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu2Test.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu2Test.java @@ -44,7 +44,6 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; import java.io.IOException; import java.io.InputStream; @@ -106,7 +105,7 @@ public class SystemProviderDstu2Test extends BaseJpaDstu2Test { restServer.setPlainProviders(mySystemProvider); - JpaConformanceProviderDstu2 myConformanceProvider = new JpaConformanceProviderDstu2(restServer, mySystemDao, myDaoConfig); + JpaConformanceProviderDstu2 myConformanceProvider = new JpaConformanceProviderDstu2(restServer, mySystemDao, myStorageSettings); restServer.setServerConformanceProvider(myConformanceProvider); ourServer = new Server(0); diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderTransactionSearchDstu2Test.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderTransactionSearchDstu2Test.java index e8559cde2c8..1a3509cd3f4 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderTransactionSearchDstu2Test.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderTransactionSearchDstu2Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.dstu2.BaseJpaDstu2Test; import ca.uhn.fhir.jpa.rp.dstu2.ObservationResourceProvider; import ca.uhn.fhir.jpa.rp.dstu2.OrganizationResourceProvider; @@ -49,7 +49,7 @@ public class SystemProviderTransactionSearchDstu2Test extends BaseJpaDstu2Test { @AfterEach public void after() { myClient.unregisterInterceptor(mySimpleHeaderInterceptor); - myDaoConfig.setMaximumSearchResultCountInTransaction(new DaoConfig().getMaximumSearchResultCountInTransaction()); + myStorageSettings.setMaximumSearchResultCountInTransaction(new JpaStorageSettings().getMaximumSearchResultCountInTransaction()); } @BeforeEach @@ -127,7 +127,7 @@ public class SystemProviderTransactionSearchDstu2Test extends BaseJpaDstu2Test { .setMethod(HTTPVerbEnum.GET) .setUrl("Patient?_count=5&_sort=name"); - myDaoConfig.setMaximumSearchResultCountInTransaction(100); + myStorageSettings.setMaximumSearchResultCountInTransaction(100); Bundle output = myClient.transaction().withBundle(input).execute(); ourLog.debug(myFhirContext.newXmlParser().setPrettyPrint(true).encodeResourceToString(output)); @@ -212,7 +212,7 @@ public class SystemProviderTransactionSearchDstu2Test extends BaseJpaDstu2Test { .setMethod(HTTPVerbEnum.GET) .setUrl("Patient?_count=5&_sort=_id"); - myDaoConfig.setMaximumSearchResultCountInTransaction(100); + myStorageSettings.setMaximumSearchResultCountInTransaction(100); Bundle output = myClient.transaction().withBundle(input).execute(); ourLog.debug(myFhirContext.newXmlParser().setPrettyPrint(true).encodeResourceToString(output)); diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/BaseSearchSvc.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/BaseSearchSvc.java index 48f42b519c1..37f52a21cf1 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/BaseSearchSvc.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/BaseSearchSvc.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.search; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.IResultIterator; @@ -13,12 +13,10 @@ import ca.uhn.fhir.jpa.util.BaseIterator; import ca.uhn.fhir.model.dstu2.resource.Patient; import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.mockito.Answers; import org.mockito.Mock; import org.mockito.Spy; import org.mockito.stubbing.Answer; import org.springframework.beans.factory.BeanFactory; -import org.springframework.transaction.PlatformTransactionManager; import java.util.ArrayList; import java.util.Collection; @@ -48,7 +46,7 @@ public class BaseSearchSvc { protected BeanFactory myBeanFactory; @Spy - protected DaoConfig myDaoConfig = new DaoConfig(); + protected JpaStorageSettings myStorageSettings = new JpaStorageSettings(); protected static final FhirContext ourCtx = FhirContext.forDstu3Cached(); diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java index 9ebf44cb906..ab602016790 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.search; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.config.SearchConfig; import ca.uhn.fhir.jpa.dao.IResultIterator; import ca.uhn.fhir.jpa.dao.ISearchBuilder; @@ -42,9 +42,6 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.data.domain.Pageable; -import org.springframework.transaction.TransactionStatus; -import org.springframework.transaction.annotation.Isolation; -import org.springframework.transaction.annotation.Propagation; import javax.annotation.Nonnull; import java.util.ArrayList; @@ -129,7 +126,7 @@ public class SearchCoordinatorSvcImplTest extends BaseSearchSvc{ // classes. This forces them in mySvc = new SearchCoordinatorSvcImpl( myContext, - myDaoConfig, + myStorageSettings, myInterceptorBroadcaster, myTransactionService, mySearchCacheSvc, @@ -304,7 +301,7 @@ public class SearchCoordinatorSvcImplTest extends BaseSearchSvc{ SearchTask searchTask = t.getArgument(2, SearchTask.class); ISearchBuilder searchBuilder = t.getArgument(3, ISearchBuilder.class); PersistedJpaSearchFirstPageBundleProvider retVal = new PersistedJpaSearchFirstPageBundleProvider(search, searchTask, searchBuilder, requestDetails); - retVal.setDaoConfigForUnitTest(new DaoConfig()); + retVal.setStorageSettingsForUnitTest(new JpaStorageSettings()); retVal.setTxServiceForUnitTest(myTransactionService); retVal.setSearchCoordinatorSvcForUnitTest(mySvc); retVal.setContext(myContext); @@ -494,7 +491,7 @@ public class SearchCoordinatorSvcImplTest extends BaseSearchSvc{ provider.setDaoRegistryForUnitTest(myDaoRegistry); provider.setSearchBuilderFactoryForUnitTest(mySearchBuilderFactory); provider.setSearchCoordinatorSvcForUnitTest(mySvc); - provider.setDaoConfigForUnitTest(new DaoConfig()); + provider.setStorageSettingsForUnitTest(new JpaStorageSettings()); resources = provider.getResources(20, 40); assertEquals(20, resources.size()); assertEquals("30", resources.get(0).getIdElement().getValueAsString()); @@ -513,7 +510,7 @@ public class SearchCoordinatorSvcImplTest extends BaseSearchSvc{ provider.setSearchBuilderFactoryForUnitTest(mySearchBuilderFactory); provider.setDaoRegistryForUnitTest(myDaoRegistry); provider.setSearchCoordinatorSvcForUnitTest(mySvc); - provider.setDaoConfigForUnitTest(new DaoConfig()); + provider.setStorageSettingsForUnitTest(new JpaStorageSettings()); return provider; } @@ -759,7 +756,7 @@ public class SearchCoordinatorSvcImplTest extends BaseSearchSvc{ myInterceptorBroadcaster, mySearchBuilderFactory, mySearchResultCacheSvc, - myDaoConfig, + myStorageSettings, mySearchCacheSvc, pagingProvider ); @@ -771,7 +768,7 @@ public class SearchCoordinatorSvcImplTest extends BaseSearchSvc{ myInterceptorBroadcaster, mySearchBuilderFactory, mySearchResultCacheSvc, - myDaoConfig, + myStorageSettings, mySearchCacheSvc, pagingProvider, myExceptionSvc diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/SynchronousSearchSvcImplTest.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/SynchronousSearchSvcImplTest.java index c71a41508fa..5c9309b4369 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/SynchronousSearchSvcImplTest.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/search/SynchronousSearchSvcImplTest.java @@ -12,7 +12,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.transaction.TransactionStatus; import java.util.Collection; import java.util.List; @@ -87,7 +86,7 @@ public class SynchronousSearchSvcImplTest extends BaseSearchSvc { @Test public void testSynchronousSearchUpTo() { when(mySearchBuilderFactory.newSearchBuilder(any(), any(), any())).thenReturn(mySearchBuilder); - when(myDaoConfig.getDefaultTotalMode()).thenReturn(null); + when(myStorageSettings.getDefaultTotalMode()).thenReturn(null); SearchParameterMap params = new SearchParameterMap(); params.setLoadSynchronousUpTo(100); diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu2Test.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu2Test.java index 4bb3953e14d..429a6cc69db 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu2Test.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu2Test.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.subscription.resthook; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.provider.BaseResourceProviderDstu2Test; import ca.uhn.fhir.jpa.test.util.SubscriptionTestUtil; import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt; @@ -73,12 +73,12 @@ public class RestHookTestDstu2Test extends BaseResourceProviderDstu2Test { } mySubscriptionIds.clear(); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); ourLog.info("Deleting all subscriptions"); myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); myClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute(); ourLog.info("Done deleting all subscriptions"); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); mySubscriptionTestUtil.unregisterSubscriptionInterceptor(); } diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToStorageSettingsDstu2Test.java similarity index 96% rename from hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test.java rename to hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToStorageSettingsDstu2Test.java index 34576eb6c13..d9b42cb7683 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToStorageSettingsDstu2Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.subscription.resthook; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.provider.BaseResourceProviderDstu2Test; import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry; import ca.uhn.fhir.jpa.test.util.SubscriptionTestUtil; @@ -43,9 +43,9 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; /** * Test the rest-hook subscriptions */ -public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends BaseResourceProviderDstu2Test { +public class RestHookTestWithInterceptorRegisteredToStorageSettingsDstu2Test extends BaseResourceProviderDstu2Test { - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test.class); + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestWithInterceptorRegisteredToStorageSettingsDstu2Test.class); private static final List ourCreatedObservations = Collections.synchronizedList(Lists.newArrayList()); private static int ourListenerPort; private static RestfulServer ourListenerRestServer; @@ -60,11 +60,11 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B @AfterEach public void afterUnregisterRestHookListener() { ourLog.info("** AFTER **"); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); ourLog.info("Deleting all subscriptions"); myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); ourLog.info("Done deleting all subscriptions"); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); mySubscriptionTestUtil.unregisterSubscriptionInterceptor(); } diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithCriteriaDstu2Test.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithCriteriaDstu2Test.java index 5a44f8f353e..57fa0a31364 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithCriteriaDstu2Test.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithCriteriaDstu2Test.java @@ -29,7 +29,7 @@ import static org.hamcrest.Matchers.contains; public class WebsocketWithCriteriaDstu2Test extends BaseResourceProviderDstu2Test { private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(WebsocketWithCriteriaDstu2Test.class); @RegisterExtension - private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myModelConfig); + private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myStorageSettings); private String myPatientId; private String mySubscriptionId; diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithSubscriptionIdDstu2Test.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithSubscriptionIdDstu2Test.java index 905d220eccc..24c0dd66368 100644 --- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithSubscriptionIdDstu2Test.java +++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithSubscriptionIdDstu2Test.java @@ -43,7 +43,7 @@ import static org.hamcrest.Matchers.contains; public class WebsocketWithSubscriptionIdDstu2Test extends BaseResourceProviderDstu2Test { private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(WebsocketWithSubscriptionIdDstu2Test.class); @RegisterExtension - private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myModelConfig); + private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myStorageSettings); private String myPatientId; private String mySubscriptionId; @Autowired diff --git a/hapi-fhir-jpaserver-test-dstu3/pom.xml b/hapi-fhir-jpaserver-test-dstu3/pom.xml index 8889685dbf6..62099e0b239 100644 --- a/hapi-fhir-jpaserver-test-dstu3/pom.xml +++ b/hapi-fhir-jpaserver-test-dstu3/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ExternalReferenceTest.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ExternalReferenceTest.java index fa99f7f2d79..35039dd7df7 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ExternalReferenceTest.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ExternalReferenceTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.dstu3; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test; import ca.uhn.fhir.rest.param.ReferenceParam; @@ -26,15 +26,15 @@ public class FhirResourceDaoDstu3ExternalReferenceTest extends BaseJpaDstu3Test @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @BeforeEach @AfterEach public void resetDefaultBehaviour() { // Reset to default - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setTreatBaseUrlsAsLocal(null); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + myStorageSettings.setTreatBaseUrlsAsLocal(null); } @Test @@ -73,7 +73,7 @@ public class FhirResourceDaoDstu3ExternalReferenceTest extends BaseJpaDstu3Test org.setName("Org Name"); myOrganizationDao.update(org, mySrd); - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); Patient p = new Patient(); p.getManagingOrganization().setReference("http://example.com/base/Organization/FOO"); @@ -98,7 +98,7 @@ public class FhirResourceDaoDstu3ExternalReferenceTest extends BaseJpaDstu3Test Set urls = new HashSet(); urls.add("http://example.com/base/"); - myDaoConfig.setTreatBaseUrlsAsLocal(urls); + myStorageSettings.setTreatBaseUrlsAsLocal(urls); Patient p = new Patient(); p.getManagingOrganization().setReference("http://example.com/base/Organization/FOO"); @@ -137,7 +137,7 @@ public class FhirResourceDaoDstu3ExternalReferenceTest extends BaseJpaDstu3Test Set urls = new HashSet(); urls.add("http://example.com/base/"); - myDaoConfig.setTreatBaseUrlsAsLocal(urls); + myStorageSettings.setTreatBaseUrlsAsLocal(urls); Patient p = new Patient(); p.getManagingOrganization().setReference("http://example.com/base/Organization/FOO"); diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3PhoneticSearchNoFtTest.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3PhoneticSearchNoFtTest.java index 4ed8646244c..c990447556a 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3PhoneticSearchNoFtTest.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3PhoneticSearchNoFtTest.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.dao.dstu3; import ca.uhn.fhir.context.phonetic.ApacheEncoder; import ca.uhn.fhir.context.phonetic.NumericEncoder; import ca.uhn.fhir.context.phonetic.PhoneticEncoderEnum; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test; @@ -54,9 +54,9 @@ public class FhirResourceDaoDstu3PhoneticSearchNoFtTest extends BaseJpaDstu3Test @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); - myDaoConfig.setReuseCachedSearchResultsForMillis(null); - myDaoConfig.setFetchSizeDefaultMaximum(new DaoConfig().getFetchSizeDefaultMaximum()); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setFetchSizeDefaultMaximum(new JpaStorageSettings().getFetchSizeDefaultMaximum()); createPhoneticSearchParameter(NAME_SOUNDEX_SP, PhoneticEncoderEnum.SOUNDEX, "Patient.name"); createPhoneticSearchParameter(ADDRESS_LINE_SOUNDEX_SP, PhoneticEncoderEnum.SOUNDEX, "Patient.address.line"); diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ReferentialIntegrityTest.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ReferentialIntegrityTest.java index 726ab71c3de..cbb853f7323 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ReferentialIntegrityTest.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ReferentialIntegrityTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.dstu3; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException; @@ -19,8 +19,8 @@ public class FhirResourceDaoDstu3ReferentialIntegrityTest extends BaseJpaDstu3Te @AfterEach public void afterResetConfig() { - myDaoConfig.setEnforceReferentialIntegrityOnWrite(new DaoConfig().isEnforceReferentialIntegrityOnWrite()); - myDaoConfig.setEnforceReferentialIntegrityOnDelete(new DaoConfig().isEnforceReferentialIntegrityOnDelete()); + myStorageSettings.setEnforceReferentialIntegrityOnWrite(new JpaStorageSettings().isEnforceReferentialIntegrityOnWrite()); + myStorageSettings.setEnforceReferentialIntegrityOnDelete(new JpaStorageSettings().isEnforceReferentialIntegrityOnDelete()); } @Test @@ -39,7 +39,7 @@ public class FhirResourceDaoDstu3ReferentialIntegrityTest extends BaseJpaDstu3Te @Test public void testCreateUnknownReferenceAllow() throws Exception { - myDaoConfig.setEnforceReferentialIntegrityOnWrite(false); + myStorageSettings.setEnforceReferentialIntegrityOnWrite(false); Patient p = new Patient(); p.setManagingOrganization(new Reference("Organization/AAA")); @@ -74,7 +74,7 @@ public class FhirResourceDaoDstu3ReferentialIntegrityTest extends BaseJpaDstu3Te @Test public void testDeleteAllow() throws Exception { - myDaoConfig.setEnforceReferentialIntegrityOnDelete(false); + myStorageSettings.setEnforceReferentialIntegrityOnDelete(false); Organization o = new Organization(); o.setName("FOO"); diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchCustomSearchParamTest.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchCustomSearchParamTest.java index 07ae5681b11..81cf4de3caf 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchCustomSearchParamTest.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchCustomSearchParamTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.dstu3; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; @@ -67,12 +67,12 @@ public class FhirResourceDaoDstu3SearchCustomSearchParamTest extends BaseJpaDstu @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @AfterEach public void after() { - myDaoConfig.setValidateSearchParameterExpressionsOnSave(new DaoConfig().isValidateSearchParameterExpressionsOnSave()); + myStorageSettings.setValidateSearchParameterExpressionsOnSave(new JpaStorageSettings().isValidateSearchParameterExpressionsOnSave()); } @Test @@ -290,7 +290,7 @@ public class FhirResourceDaoDstu3SearchCustomSearchParamTest extends BaseJpaDstu @Test public void testIndexFailsIfInvalidSearchParameterExists() { - myDaoConfig.setValidateSearchParameterExpressionsOnSave(false); + myStorageSettings.setValidateSearchParameterExpressionsOnSave(false); SearchParameter threadIdSp = new SearchParameter(); threadIdSp.addBase("Communication"); diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchDistanceTest.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchDistanceTest.java index 814cbf73b9f..4da9846868d 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchDistanceTest.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchDistanceTest.java @@ -11,7 +11,6 @@ import org.hl7.fhir.dstu3.model.Location; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.InvalidDataAccessApiUsageException; import java.util.List; @@ -27,7 +26,7 @@ public class FhirResourceDaoDstu3SearchDistanceTest extends BaseJpaDstu3Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @Test diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchFtTest.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchFtTest.java index 08c7646caef..a20b849cacf 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchFtTest.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchFtTest.java @@ -43,7 +43,7 @@ public class FhirResourceDaoDstu3SearchFtTest extends BaseJpaDstu3Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @Test diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchNoFtTest.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchNoFtTest.java index 6c4e826933b..48e3d1403bc 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchNoFtTest.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchNoFtTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.dstu3; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.PatientEverythingParameters; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamNumber; @@ -138,8 +138,8 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); - myDaoConfig.setFetchSizeDefaultMaximum(new DaoConfig().getFetchSizeDefaultMaximum()); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setFetchSizeDefaultMaximum(new JpaStorageSettings().getFetchSizeDefaultMaximum()); } /** @@ -1968,7 +1968,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test { @Test public void testSearchWithFetchSizeDefaultMaximum() { - myDaoConfig.setFetchSizeDefaultMaximum(5); + myStorageSettings.setFetchSizeDefaultMaximum(5); for (int i = 0; i < 10; i++) { Patient p = new Patient(); diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SourceTest.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SourceTest.java index eb853f1f4be..f7c80422711 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SourceTest.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SourceTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.dstu3; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test; import ca.uhn.fhir.rest.api.Constants; @@ -32,12 +32,12 @@ public class FhirResourceDaoDstu3SourceTest extends BaseJpaDstu3Test { @AfterEach public final void after() { when(mySrd.getRequestId()).thenReturn(null); - myDaoConfig.setStoreMetaSourceInformation(new DaoConfig().getStoreMetaSourceInformation()); + myStorageSettings.setStoreMetaSourceInformation(new JpaStorageSettings().getStoreMetaSourceInformation()); } @BeforeEach public void before() { - myDaoConfig.setStoreMetaSourceInformation(DaoConfig.StoreMetaSourceInformationEnum.SOURCE_URI_AND_REQUEST_ID); + myStorageSettings.setStoreMetaSourceInformation(JpaStorageSettings.StoreMetaSourceInformationEnum.SOURCE_URI_AND_REQUEST_ID); } @Test @@ -184,7 +184,7 @@ public class FhirResourceDaoDstu3SourceTest extends BaseJpaDstu3Test { @Test public void testSourceDisabled() { - myDaoConfig.setStoreMetaSourceInformation(DaoConfig.StoreMetaSourceInformationEnum.NONE); + myStorageSettings.setStoreMetaSourceInformation(JpaStorageSettings.StoreMetaSourceInformationEnum.NONE); when(mySrd.getRequestId()).thenReturn("0000000000000000"); Patient pt0 = new Patient(); diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3TerminologyTest.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3TerminologyTest.java index abd3d2e0380..d5c500e4b17 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3TerminologyTest.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3TerminologyTest.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.dao.dstu3; import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.context.support.ValueSetExpansionOptions; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; import ca.uhn.fhir.jpa.entity.TermConcept; import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum; @@ -68,14 +68,14 @@ public class FhirResourceDaoDstu3TerminologyTest extends BaseJpaDstu3Test { @AfterEach public void after() { - myDaoConfig.setDeferIndexingForCodesystemsOfSize(new DaoConfig().getDeferIndexingForCodesystemsOfSize()); + myStorageSettings.setDeferIndexingForCodesystemsOfSize(new JpaStorageSettings().getDeferIndexingForCodesystemsOfSize()); TermReindexingSvcImpl.setForceSaveDeferredAlwaysForUnitTest(false); } @BeforeEach public void before() { - myDaoConfig.setMaximumExpansionSize(5000); + myStorageSettings.setMaximumExpansionSize(5000); myCachingValidationSupport.invalidateCaches(); } @@ -641,7 +641,7 @@ public class FhirResourceDaoDstu3TerminologyTest extends BaseJpaDstu3Test { @Test public void testIndexingIsDeferredForLargeCodeSystems() { - myDaoConfig.setDeferIndexingForCodesystemsOfSize(1); + myStorageSettings.setDeferIndexingForCodesystemsOfSize(1); myTerminologyDeferredStorageSvc.setProcessDeferred(false); @@ -708,7 +708,7 @@ public class FhirResourceDaoDstu3TerminologyTest extends BaseJpaDstu3Test { @Disabled public void testRefuseCostlyExpansionFhirCodesystem() { createLocalCsAndVs(); - myDaoConfig.setMaximumExpansionSize(1); + myStorageSettings.setMaximumExpansionSize(1); SearchParameterMap params = new SearchParameterMap(); params.add(AuditEvent.SP_TYPE, new TokenParam(null, "http://hl7.org/fhir/ValueSet/audit-event-type").setModifier(TokenParamModifier.IN)); @@ -723,7 +723,7 @@ public class FhirResourceDaoDstu3TerminologyTest extends BaseJpaDstu3Test { @Test public void testRefuseCostlyExpansionLocalCodesystem() { createLocalCsAndVs(); - myDaoConfig.setMaximumExpansionSize(1); + myStorageSettings.setMaximumExpansionSize(1); SearchParameterMap params = new SearchParameterMap(); params.add(Observation.SP_CODE, new TokenParam(URL_MY_CODE_SYSTEM, "AAA").setModifier(TokenParamModifier.ABOVE)); diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java index 8bbdf700a18..ba54399a2ea 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3Test.java @@ -1,9 +1,9 @@ package ca.uhn.fhir.jpa.dao.dstu3; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; -import ca.uhn.fhir.jpa.api.config.DaoConfig.ClientIdStrategyEnum; -import ca.uhn.fhir.jpa.api.config.DaoConfig.IdStrategyEnum; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings.ClientIdStrategyEnum; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings.IdStrategyEnum; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; import ca.uhn.fhir.jpa.api.model.HistoryCountModeEnum; @@ -134,10 +134,10 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { @AfterEach public final void after() { - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setTreatReferencesAsLogical(new DaoConfig().getTreatReferencesAsLogical()); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); - myDaoConfig.setHistoryCountMode(DaoConfig.DEFAULT_HISTORY_COUNT_MODE); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + myStorageSettings.setTreatReferencesAsLogical(new JpaStorageSettings().getTreatReferencesAsLogical()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); + myStorageSettings.setHistoryCountMode(JpaStorageSettings.DEFAULT_HISTORY_COUNT_MODE); } private void assertGone(IIdType theId) { @@ -167,7 +167,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } private List extractNames(IBundleProvider theSearch) { @@ -565,8 +565,8 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { @AfterEach void tearDown() { - myDaoConfig.setResourceClientIdStrategy(new DaoConfig().getResourceClientIdStrategy()); - myDaoConfig.setResourceServerIdStrategy(new DaoConfig().getResourceServerIdStrategy()); + myStorageSettings.setResourceClientIdStrategy(new JpaStorageSettings().getResourceClientIdStrategy()); + myStorageSettings.setResourceServerIdStrategy(new JpaStorageSettings().getResourceServerIdStrategy()); } @ParameterizedTest @@ -592,8 +592,8 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { String theClientId ) { // given id configuration settings - myDaoConfig.setResourceClientIdStrategy(theClientIdStrategy); - myDaoConfig.setResourceServerIdStrategy(theServerIdStrategy); + myStorageSettings.setResourceClientIdStrategy(theClientIdStrategy); + myStorageSettings.setResourceServerIdStrategy(theServerIdStrategy); // create the resource with POST or PUT Patient pat = new Patient(); @@ -1007,7 +1007,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { @Test public void testDeleteResource() { - myDaoConfig.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); + myStorageSettings.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); int initialHistory = myPatientDao.history(null, null, null, mySrd).size(); @@ -1395,8 +1395,8 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { @Test public void testHistoryOverMultiplePages() throws Exception { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); - myDaoConfig.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); + myStorageSettings.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); String methodName = "testHistoryOverMultiplePages"; @@ -1548,7 +1548,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { @Test public void testHistoryReflectsMetaOperations() { - myDaoConfig.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); + myStorageSettings.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); Patient inPatient = new Patient(); inPatient.addName().setFamily("version1"); @@ -1634,7 +1634,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { @Test public void testHistoryWithFromAndTo() throws Exception { - myDaoConfig.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); + myStorageSettings.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); String methodName = "testHistoryWithFromAndTo"; @@ -1671,7 +1671,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { @Test public void testHistoryWithFutureSinceDate() throws Exception { - myDaoConfig.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); + myStorageSettings.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); Date before = new Date(); Thread.sleep(10); @@ -1993,8 +1993,8 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test { */ @Test public void testLogicalReferencesAreSearchable() { - myDaoConfig.setTreatReferencesAsLogical(null); - myDaoConfig.addTreatReferencesAsLogical("http://foo.com/identifier*"); + myStorageSettings.setTreatReferencesAsLogical(null); + myStorageSettings.addTreatReferencesAsLogical("http://foo.com/identifier*"); Patient p1 = new Patient(); p1.getManagingOrganization().setReference("http://foo.com/identifier/1"); diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3UpdateTest.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3UpdateTest.java index 8f5f6cd5fc4..8ab5d48b2e8 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3UpdateTest.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3UpdateTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.dstu3; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test; @@ -131,12 +131,12 @@ public class FhirResourceDaoDstu3UpdateTest extends BaseJpaDstu3Test { @AfterEach public void afterResetDao() { - myDaoConfig.setResourceMetaCountHardLimit(new DaoConfig().getResourceMetaCountHardLimit()); + myStorageSettings.setResourceMetaCountHardLimit(new JpaStorageSettings().getResourceMetaCountHardLimit()); } @Test public void testHardMetaCapIsEnforcedOnCreate() { - myDaoConfig.setResourceMetaCountHardLimit(3); + myStorageSettings.setResourceMetaCountHardLimit(3); IIdType id; { @@ -157,7 +157,7 @@ public class FhirResourceDaoDstu3UpdateTest extends BaseJpaDstu3Test { @Test public void testHardMetaCapIsEnforcedOnMetaAdd() { - myDaoConfig.setResourceMetaCountHardLimit(3); + myStorageSettings.setResourceMetaCountHardLimit(3); IIdType id; { @@ -644,7 +644,7 @@ public class FhirResourceDaoDstu3UpdateTest extends BaseJpaDstu3Test { @Test public void testUpdateWithNoChangeDetectionDisabledUpdateUnchanged() { - myDaoConfig.setSuppressUpdatesWithNoChange(false); + myStorageSettings.setSuppressUpdatesWithNoChange(false); String name = "testUpdateUnchanged"; IIdType id1, id2; diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3Test.java index dcd43295325..9464a634194 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3Test.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.dao.dstu3; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.api.IInterceptorService; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; import ca.uhn.fhir.jpa.dao.GZipUtil; @@ -116,20 +116,20 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { @AfterEach public void after() { - myDaoConfig.setAllowInlineMatchUrlReferences(false); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); - myDaoConfig.setMaximumDeleteConflictQueryCount(new DaoConfig().getMaximumDeleteConflictQueryCount()); - myDaoConfig.setBundleBatchPoolSize(new DaoConfig().getBundleBatchPoolSize()); - myDaoConfig.setBundleBatchMaxPoolSize(new DaoConfig().getBundleBatchMaxPoolSize()); + myStorageSettings.setAllowInlineMatchUrlReferences(false); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); + myStorageSettings.setMaximumDeleteConflictQueryCount(new JpaStorageSettings().getMaximumDeleteConflictQueryCount()); + myStorageSettings.setBundleBatchPoolSize(new JpaStorageSettings().getBundleBatchPoolSize()); + myStorageSettings.setBundleBatchMaxPoolSize(new JpaStorageSettings().getBundleBatchMaxPoolSize()); } @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); - myDaoConfig.setBundleBatchPoolSize(1); - myDaoConfig.setBundleBatchMaxPoolSize(1); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setBundleBatchPoolSize(1); + myStorageSettings.setBundleBatchMaxPoolSize(1); } private Bundle createInputTransactionWithPlaceholderIdInMatchUrl(HTTPVerb theVerb) { @@ -689,7 +689,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { String methodName = "testTransactionCreateInlineMatchUrlWithNoMatches"; Bundle request = new Bundle(); - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Observation o = new Observation(); o.getCode().setText("Some Observation"); @@ -709,7 +709,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { String methodName = "testTransactionCreateInlineMatchUrlWithOneMatch"; Bundle request = new Bundle(); - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Patient p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); @@ -742,7 +742,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { String methodName = "testTransactionCreateInlineMatchUrlWithOneMatch2"; Bundle request = new Bundle(); - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Patient p = new Patient(); p.addName().addGiven("Heute"); @@ -810,7 +810,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { String methodName = "testTransactionCreateInlineMatchUrlWithTwoMatches"; Bundle request = new Bundle(); - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Patient p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); @@ -1344,7 +1344,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { @Test public void testTransactionDeleteMatchUrlWithTwoMatch() { - myDaoConfig.setAllowMultipleDelete(false); + myStorageSettings.setAllowMultipleDelete(false); String methodName = "testTransactionDeleteMatchUrlWithTwoMatch"; @@ -1741,8 +1741,8 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { @Test @Disabled public void testTransactionFromBundle_Slow() throws Exception { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); - myDaoConfig.setMaximumDeleteConflictQueryCount(10000); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); + myStorageSettings.setMaximumDeleteConflictQueryCount(10000); StopWatch sw = new StopWatch(); sw.startTask("Parse Bundle"); @@ -1854,7 +1854,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { @Test public void testTransactionOruBundle() throws IOException { - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); String input = IOUtils.toString(getClass().getResourceAsStream("/oruBundle.json"), StandardCharsets.UTF_8); @@ -2418,7 +2418,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { @Test public void testTransactionWithInlineMatchUrl() throws Exception { - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Patient patient = new Patient(); patient.addIdentifier().setSystem("http://www.ghh.org/identifiers").setValue("condreftestpatid1"); @@ -2434,7 +2434,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { @Test public void testTransactionWithInlineMatchUrlMultipleMatches() throws Exception { - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Patient patient = new Patient(); patient.addIdentifier().setSystem("http://www.ghh.org/identifiers").setValue("condreftestpatid1"); @@ -2458,7 +2458,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest { @Test public void testTransactionWithInlineMatchUrlNoMatches() throws Exception { - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); String input = IOUtils.toString(getClass().getResourceAsStream("/simone-conditional-url.xml"), StandardCharsets.UTF_8); Bundle bundle = myFhirContext.newXmlParser().parseResource(Bundle.class, input); diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoTransactionDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoTransactionDstu3Test.java index 8db6ddc8b7b..1efbcf72234 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoTransactionDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoTransactionDstu3Test.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.dao.dstu3; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.rest.server.exceptions.PayloadTooLargeException; import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.Bundle.BundleType; @@ -20,12 +20,12 @@ public class FhirSystemDaoTransactionDstu3Test extends BaseJpaDstu3SystemTest { @AfterEach public void after() { - myDaoConfig.setMaximumTransactionBundleSize(new DaoConfig().getMaximumTransactionBundleSize()); + myStorageSettings.setMaximumTransactionBundleSize(new JpaStorageSettings().getMaximumTransactionBundleSize()); } @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setMaximumTransactionBundleSize(TEST_MAXIMUM_TRANSACTION_BUNDLE_SIZE); + myStorageSettings.setMaximumTransactionBundleSize(TEST_MAXIMUM_TRANSACTION_BUNDLE_SIZE); } private Bundle createInputTransactionWithSize(int theSize) { diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeHookTest.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeHookTest.java index c337a3c6f05..ca1991681f0 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeHookTest.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeHookTest.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.dao.expunge; import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IInterceptorService; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoPatient; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.model.dao.JpaPid; @@ -32,17 +32,15 @@ public class ExpungeHookTest extends BaseJpaDstu3Test { private ExpungeService myExpungeService; @Autowired private IInterceptorService myInterceptorService; - @Autowired - private DaoConfig myDaoConfig; PointcutLatch myEverythingLatch = new PointcutLatch(Pointcut.STORAGE_PRESTORAGE_EXPUNGE_EVERYTHING); PointcutLatch myExpungeResourceLatch = new PointcutLatch(Pointcut.STORAGE_PRESTORAGE_EXPUNGE_RESOURCE); @BeforeEach public void before() { - myDaoConfig.setExpungeEnabled(true); - myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ALPHANUMERIC); - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setExpungeEnabled(true); + myStorageSettings.setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.ALPHANUMERIC); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); myInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PRESTORAGE_EXPUNGE_EVERYTHING, myEverythingLatch); myInterceptorService.registerAnonymousInterceptor(Pointcut.STORAGE_PRESTORAGE_EXPUNGE_RESOURCE, myExpungeResourceLatch); } @@ -51,9 +49,9 @@ public class ExpungeHookTest extends BaseJpaDstu3Test { public void after() { assertTrue(myInterceptorService.unregisterInterceptor(myEverythingLatch)); assertTrue(myInterceptorService.unregisterInterceptor(myExpungeResourceLatch)); - myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled()); - myDaoConfig.setResourceClientIdStrategy(new DaoConfig().getResourceClientIdStrategy()); - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(new DaoConfig().isAutoCreatePlaceholderReferenceTargets()); + myStorageSettings.setExpungeEnabled(new JpaStorageSettings().isExpungeEnabled()); + myStorageSettings.setResourceClientIdStrategy(new JpaStorageSettings().getResourceClientIdStrategy()); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(new JpaStorageSettings().isAutoCreatePlaceholderReferenceTargets()); } @Test diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/packages/IgInstallerDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/packages/IgInstallerDstu3Test.java index 497edfb525b..90eb50373b4 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/packages/IgInstallerDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/packages/IgInstallerDstu3Test.java @@ -1,12 +1,9 @@ package ca.uhn.fhir.jpa.packages; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.data.INpmPackageVersionDao; -import ca.uhn.fhir.jpa.model.entity.IBaseResourceEntity; -import ca.uhn.fhir.jpa.model.entity.NpmPackageVersionEntity; import ca.uhn.fhir.jpa.packages.util.PackageUtils; import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; @@ -18,8 +15,6 @@ import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.hl7.fhir.instance.model.api.IBaseBinary; import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.r4.model.Patient; -import org.hl7.fhir.utilities.npm.IPackageCacheManager; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -28,16 +23,12 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import java.util.Date; -import java.util.Optional; import java.util.concurrent.Callable; import java.util.stream.Collectors; import static ca.uhn.fhir.util.ClasspathUtil.loadResourceAsByteArray; -import static com.healthmarketscience.sqlbuilder.Conditions.not; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.hasItem; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -49,8 +40,6 @@ public class IgInstallerDstu3Test extends BaseJpaDstu3Test { private static final Logger ourLog = LoggerFactory.getLogger(IgInstallerDstu3Test.class); @Autowired - private DaoConfig daoConfig; - @Autowired private PackageInstallerSvcImpl igInstaller; @Autowired @Qualifier(PackageUtils.LOADER_WITH_CACHE) @@ -61,8 +50,10 @@ public class IgInstallerDstu3Test extends BaseJpaDstu3Test { private INpmPackageVersionDao myPackageVersionDao; private int myPort; + @Override @BeforeEach public void before() throws Exception { + super.before(); JpaPackageCache jpaPackageCache = ProxyUtil.getSingletonTarget(myPackageCacheManager, JpaPackageCache.class); myServer = new Server(0); @@ -83,12 +74,12 @@ public class IgInstallerDstu3Test extends BaseJpaDstu3Test { @AfterEach public void after() throws Exception { JettyUtil.closeServer(myServer); - daoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); } @Test public void testNegativeInstallFromCache() { - daoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); byte[] bytes = loadResourceAsByteArray("/packages/erroneous-ig.tar.gz"); @@ -114,7 +105,7 @@ public class IgInstallerDstu3Test extends BaseJpaDstu3Test { bytes = loadResourceAsByteArray("/packages/nictiz.fhir.nl.stu3.zib2017-1.3.10.tgz"); myFakeNpmServlet.getResponses().put("/nictiz.fhir.nl.stu3.zib2017/1.3.10", bytes); - daoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); PackageInstallationSpec spec = new PackageInstallationSpec() .setName("nictiz.fhir.nl.stu3.questionnaires") .setVersion("1.0.2") @@ -142,7 +133,7 @@ public class IgInstallerDstu3Test extends BaseJpaDstu3Test { bytes = loadResourceAsByteArray("/packages/nictiz.fhir.nl.stu3.zib2017-1.3.10.tgz"); myFakeNpmServlet.getResponses().put("/nictiz.fhir.nl.stu3.zib2017/1.3.x", bytes); - daoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); igInstaller.install(new PackageInstallationSpec().setName("nictiz.fhir.nl.stu3.questionnaires").setVersion("1.0.2").setInstallMode(PackageInstallationSpec.InstallModeEnum.STORE_AND_INSTALL).setFetchDependencies(false)); runInTransaction(() -> { @@ -212,7 +203,7 @@ public class IgInstallerDstu3Test extends BaseJpaDstu3Test { } @Test public void testMultipleUploads() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); PackageInstallationSpec installationSpec = new PackageInstallationSpec() .setName("nictiz.fhir.nl.stu3.questionnaires") .setVersion("1.0.2") diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/BaseResourceProviderDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/BaseResourceProviderDstu3Test.java index 48004ff23f4..0cd0ba037fd 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/BaseResourceProviderDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/BaseResourceProviderDstu3Test.java @@ -69,7 +69,7 @@ public abstract class BaseResourceProviderDstu3Test extends BaseJpaDstu3Test { s.setPagingProvider(myAppCtx.getBean(DatabaseBackedPagingProvider.class)); - JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(s, mySystemDao, myDaoConfig, mySearchParamRegistry); + JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(s, mySystemDao, myStorageSettings, mySearchParamRegistry); confProvider.setImplementationDescription("THIS IS THE DESC"); s.setServerConformanceProvider(confProvider); diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/CompositionDocumentDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/CompositionDocumentDstu3Test.java index b8f572d3b3e..d8f32b4c334 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/CompositionDocumentDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/CompositionDocumentDstu3Test.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.provider.dstu3; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.parser.StrictErrorHandler; import ca.uhn.fhir.rest.api.EncodingEnum; import com.google.common.base.Charsets; @@ -48,7 +48,7 @@ public class CompositionDocumentDstu3Test extends BaseResourceProviderDstu3Test @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @Override @@ -56,7 +56,7 @@ public class CompositionDocumentDstu3Test extends BaseResourceProviderDstu3Test public void after() throws Exception { super.after(); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); } @Override @@ -65,7 +65,7 @@ public class CompositionDocumentDstu3Test extends BaseResourceProviderDstu3Test super.before(); myFhirContext.setParserErrorHandler(new StrictErrorHandler()); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); Organization org = new Organization(); org.setName("an org"); diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/PatientEverythingDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/PatientEverythingDstu3Test.java index 0a2b8fd9d69..f8d8bf143e8 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/PatientEverythingDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/PatientEverythingDstu3Test.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.provider.dstu3; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.parser.StrictErrorHandler; import ca.uhn.fhir.rest.api.EncodingEnum; import com.google.common.base.Charsets; @@ -50,7 +50,7 @@ public class PatientEverythingDstu3Test extends BaseResourceProviderDstu3Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @Override @@ -58,8 +58,8 @@ public class PatientEverythingDstu3Test extends BaseResourceProviderDstu3Test { public void after() throws Exception { super.after(); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setEverythingIncludesFetchPageSize(new DaoConfig().getEverythingIncludesFetchPageSize()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setEverythingIncludesFetchPageSize(new JpaStorageSettings().getEverythingIncludesFetchPageSize()); } @BeforeEach @@ -68,7 +68,7 @@ public class PatientEverythingDstu3Test extends BaseResourceProviderDstu3Test { super.before(); myFhirContext.setParserErrorHandler(new StrictErrorHandler()); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); myOrg = new Organization(); myOrg.setName("an org"); @@ -181,7 +181,7 @@ public class PatientEverythingDstu3Test extends BaseResourceProviderDstu3Test { */ @Test public void testEverythingReturnsCorrectResourcesSmallPage() throws Exception { - myDaoConfig.setEverythingIncludesFetchPageSize(1); + myStorageSettings.setEverythingIncludesFetchPageSize(1); Bundle bundle = fetchBundle(myServerBase + "/" + myPatientId + "/$everything?_format=json&_count=100", EncodingEnum.JSON); diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderCustomSearchParamDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderCustomSearchParamDstu3Test.java index 0a5b7680b8c..e0e0022dc4e 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderCustomSearchParamDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderCustomSearchParamDstu3Test.java @@ -5,7 +5,7 @@ import ca.uhn.fhir.batch2.jobs.reindex.ReindexJobParameters; import ca.uhn.fhir.batch2.model.JobInstance; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.rest.api.Constants; @@ -61,7 +61,7 @@ public class ResourceProviderCustomSearchParamDstu3Test extends BaseResourceProv public void after() throws Exception { super.after(); - myModelConfig.setDefaultSearchParamsCanBeOverridden(new ModelConfig().isDefaultSearchParamsCanBeOverridden()); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(new StorageSettings().isDefaultSearchParamsCanBeOverridden()); } @Override @@ -69,7 +69,7 @@ public class ResourceProviderCustomSearchParamDstu3Test extends BaseResourceProv public void beforeResetConfig() { super.beforeResetConfig(); - myModelConfig.setDefaultSearchParamsCanBeOverridden(new ModelConfig().isDefaultSearchParamsCanBeOverridden()); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(new StorageSettings().isDefaultSearchParamsCanBeOverridden()); mySearchParamRegistry.forceRefresh(); } @@ -106,7 +106,7 @@ public class ResourceProviderCustomSearchParamDstu3Test extends BaseResourceProv @Test public void testConformanceOverrideAllowed() { - myModelConfig.setDefaultSearchParamsCanBeOverridden(true); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(true); CapabilityStatement conformance = myClient .fetchConformance() diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3DistanceTest.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3DistanceTest.java index 6dc64625c5b..48aa84666a6 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3DistanceTest.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3DistanceTest.java @@ -18,7 +18,7 @@ public class ResourceProviderDstu3DistanceTest extends BaseResourceProviderDstu3 @Override public void before() throws Exception { super.before(); - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @Test diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3Test.java index 9e1ca135fe4..71f568ec1d2 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider.dstu3; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.data.ISearchDao; import ca.uhn.fhir.jpa.entity.Search; import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl; @@ -191,9 +191,9 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test { public void after() throws Exception { super.after(); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(null); mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(QueryParameterUtils.DEFAULT_SYNC_SIZE); @@ -234,7 +234,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test { @Test public void testSearchByExternalReference() { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); Patient patient = new Patient(); patient.addName().setFamily("FooName"); @@ -396,9 +396,9 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test { super.before(); myFhirContext.setParserErrorHandler(new StrictErrorHandler()); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); mySearchCoordinatorSvcRaw = AopTestUtils.getTargetObject(mySearchCoordinatorSvc); } @@ -488,7 +488,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test { @Test public void testSearchWithIncludeAllWithNotResolvableReference() { // Arrange - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); Patient patient = new Patient(); patient.addName().setFamily(UUID.randomUUID().toString()); @@ -1076,7 +1076,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test { public void testDeleteConditionalMultiple() { String methodName = "testDeleteConditionalMultiple"; - myDaoConfig.setAllowMultipleDelete(false); + myStorageSettings.setAllowMultipleDelete(false); Patient p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); @@ -1106,7 +1106,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test { myClient.read().resource("Patient").withId(id1).execute(); myClient.read().resource("Patient").withId(id2).execute(); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); MethodOutcome response = myClient .delete() @@ -2474,7 +2474,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test { @Test public void testIncludeWithExternalReferences() { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); Patient p = new Patient(); p.getManagingOrganization().setReference("http://example.com/Organization/123"); @@ -3366,7 +3366,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test { } myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); - myDaoConfig.setReuseCachedSearchResultsForMillis(1000L); + myStorageSettings.setReuseCachedSearchResultsForMillis(1000L); Bundle result1 = myClient .search() @@ -3397,7 +3397,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test { } myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); Bundle result1 = myClient .search() @@ -3443,7 +3443,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test { } myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); - myDaoConfig.setReuseCachedSearchResultsForMillis(1000L); + myStorageSettings.setReuseCachedSearchResultsForMillis(1000L); Bundle result1 = myClient .search() @@ -3507,7 +3507,7 @@ public class ResourceProviderDstu3Test extends BaseResourceProviderDstu3Test { } myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); - myDaoConfig.setReuseCachedSearchResultsForMillis(100000L); + myStorageSettings.setReuseCachedSearchResultsForMillis(100000L); Bundle result1 = myClient .search() diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetTest.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetTest.java index 93e6e4576d8..5a1465e79de 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetTest.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider.dstu3; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; @@ -310,7 +310,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 @Test public void testExpandByIdWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -409,7 +409,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 @Test public void testExpandByUrlNoPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(false); + myStorageSettings.setPreExpandValueSets(false); loadAndPersistCodeSystemAndValueSet(); @@ -448,7 +448,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 @Test public void testExpandByUrlWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -471,7 +471,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 @Test public void testExpandByUrlWithPreExpansionAndBogusUrl() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -937,7 +937,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3 @AfterEach public void afterResetPreExpansionDefault() { - myDaoConfig.setPreExpandValueSets(new DaoConfig().isPreExpandValueSets()); + myStorageSettings.setPreExpandValueSets(new JpaStorageSettings().isPreExpandValueSets()); } diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetVersionedTest.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetVersionedTest.java index 7058883ee12..d5e38616652 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetVersionedTest.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetVersionedTest.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.provider.dstu3; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; @@ -318,7 +318,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv @Test public void testExpandByIdWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -413,7 +413,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv @Test public void testExpandByIdWithFilterWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -507,7 +507,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv @Test public void testExpandByUrlAndVersionNoPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(false); + myStorageSettings.setPreExpandValueSets(false); loadAndPersistCodeSystemAndValueSet(); // Check expansion of multi-versioned ValueSet with version 1 @@ -580,7 +580,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv @Test public void testExpandByUrlWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -640,7 +640,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv @Test public void testExpandByUrlWithPreExpansionAndBogusVersion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -727,7 +727,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv @Test public void testExpandByValueSetWithPreExpansion() throws IOException { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystem(); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -957,7 +957,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv @Test public void testUpdateValueSetTriggersAnotherPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(); @@ -1005,7 +1005,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv @Test public void testUpdateValueSetTriggersAnotherPreExpansionUsingTransactionBundle() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(); @@ -1455,7 +1455,7 @@ public class ResourceProviderDstu3ValueSetVersionedTest extends BaseResourceProv @AfterEach public void afterResetPreExpansionDefault() { - myDaoConfig.setPreExpandValueSets(new DaoConfig().isPreExpandValueSets()); + myStorageSettings.setPreExpandValueSets(new JpaStorageSettings().isPreExpandValueSets()); } public CodeSystem createExternalCs(IFhirResourceDao theCodeSystemDao, IResourceTableDao theResourceTableDao, ITermCodeSystemStorageSvc theTermCodeSystemStorageSvc, ServletRequestDetails theRequestDetails) { diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderExpungeDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderExpungeDstu3Test.java index 58c0b76755d..7c22e468ac8 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderExpungeDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderExpungeDstu3Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider.dstu3; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.model.util.JpaConstants; @@ -37,8 +37,8 @@ public class ResourceProviderExpungeDstu3Test extends BaseResourceProviderDstu3T @AfterEach public void afterDisableExpunge() { - myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled()); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); + myStorageSettings.setExpungeEnabled(new JpaStorageSettings().isExpungeEnabled()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); } private void assertExpunged(IIdType theId) { @@ -115,8 +115,8 @@ public class ResourceProviderExpungeDstu3Test extends BaseResourceProviderDstu3T @BeforeEach public void beforeEnableExpunge() { - myDaoConfig.setExpungeEnabled(true); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setExpungeEnabled(true); + myStorageSettings.setAllowMultipleDelete(true); } private IFhirResourceDao getDao(IIdType theId) { diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SubscriptionsDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SubscriptionsDstu3Test.java index d41cd25ea67..95c777537f6 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SubscriptionsDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SubscriptionsDstu3Test.java @@ -44,12 +44,12 @@ public class SubscriptionsDstu3Test extends BaseResourceProviderDstu3Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @BeforeEach public void beforeEnableScheduling() { - myDaoConfig.setSchedulingDisabled(false); + myStorageSettings.setSchedulingDisabled(false); } diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SystemProviderTransactionSearchDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SystemProviderTransactionSearchDstu3Test.java index 9b029b92715..75f5a7301d7 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SystemProviderTransactionSearchDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SystemProviderTransactionSearchDstu3Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider.dstu3; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.rp.dstu3.ObservationResourceProvider; import ca.uhn.fhir.jpa.rp.dstu3.OrganizationResourceProvider; import ca.uhn.fhir.jpa.rp.dstu3.PatientResourceProvider; @@ -64,7 +64,7 @@ public class SystemProviderTransactionSearchDstu3Test extends BaseJpaDstu3Test { @AfterEach public void after() { ourClient.unregisterInterceptor(mySimpleHeaderInterceptor); - myDaoConfig.setMaximumSearchResultCountInTransaction(new DaoConfig().getMaximumSearchResultCountInTransaction()); + myStorageSettings.setMaximumSearchResultCountInTransaction(new JpaStorageSettings().getMaximumSearchResultCountInTransaction()); } @BeforeEach @@ -148,7 +148,7 @@ public class SystemProviderTransactionSearchDstu3Test extends BaseJpaDstu3Test { .setMethod(HTTPVerb.GET) .setUrl("Patient?_count=5&_sort=_id"); - myDaoConfig.setMaximumSearchResultCountInTransaction(100); + myStorageSettings.setMaximumSearchResultCountInTransaction(100); Bundle output = ourClient.transaction().withBundle(input).execute(); ourLog.debug(myFhirContext.newXmlParser().setPrettyPrint(true).encodeResourceToString(output)); @@ -251,7 +251,7 @@ public class SystemProviderTransactionSearchDstu3Test extends BaseJpaDstu3Test { .setMethod(HTTPVerb.GET) .setUrl("Patient?_count=5&_sort=_id"); - myDaoConfig.setMaximumSearchResultCountInTransaction(100); + myStorageSettings.setMaximumSearchResultCountInTransaction(100); Bundle output = ourClient.transaction().withBundle(input).execute(); ourLog.debug(myFhirContext.newXmlParser().setPrettyPrint(true).encodeResourceToString(output)); diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/search/PagingMultinodeProviderDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/search/PagingMultinodeProviderDstu3Test.java index 17b3d147e39..a32e59e86e8 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/search/PagingMultinodeProviderDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/search/PagingMultinodeProviderDstu3Test.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.search; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test; import ca.uhn.fhir.jpa.util.QueryParameterUtils; import ca.uhn.fhir.parser.StrictErrorHandler; @@ -25,8 +25,8 @@ public class PagingMultinodeProviderDstu3Test extends BaseResourceProviderDstu3T public void after() throws Exception { super.after(); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(null); mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(QueryParameterUtils.DEFAULT_SYNC_SIZE); @@ -39,7 +39,7 @@ public class PagingMultinodeProviderDstu3Test extends BaseResourceProviderDstu3T super.before(); myFhirContext.setParserErrorHandler(new StrictErrorHandler()); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); mySearchCoordinatorSvcRaw = AopTestUtils.getTargetObject(mySearchCoordinatorSvc); } diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/email/EmailSubscriptionDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/email/EmailSubscriptionDstu3Test.java index 2458a593fea..505942346a6 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/email/EmailSubscriptionDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/email/EmailSubscriptionDstu3Test.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.subscription.email; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test; import ca.uhn.fhir.jpa.subscription.match.deliver.email.EmailSenderImpl; import ca.uhn.fhir.jpa.test.util.SubscriptionTestUtil; @@ -60,12 +60,12 @@ public class EmailSubscriptionDstu3Test extends BaseResourceProviderDstu3Test { } mySubscriptionIds.clear(); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); ourLog.info("Deleting all subscriptions"); myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); myClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute(); ourLog.info("Done deleting all subscriptions"); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); mySubscriptionTestUtil.unregisterSubscriptionInterceptor(); } @@ -82,7 +82,7 @@ public class EmailSubscriptionDstu3Test extends BaseResourceProviderDstu3Test { ourLog.info("After re-registering interceptors"); logAllInterceptors(myInterceptorRegistry); - myDaoConfig.setEmailFromAddress("123@hapifhir.io"); + myStorageSettings.setEmailFromAddress("123@hapifhir.io"); } private Subscription createSubscription(String theCriteria, String thePayload, Consumer... theModifiers) throws InterruptedException { diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu3Test.java index def778cb2ec..1b55c5392bd 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestDstu3Test.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.subscription.resthook; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.DaoTestUtils; import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test; import ca.uhn.fhir.jpa.subscription.NotificationServlet; @@ -101,12 +101,12 @@ public class RestHookTestDstu3Test extends BaseResourceProviderDstu3Test { } mySubscriptionIds.clear(); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); ourLog.info("Deleting all subscriptions"); myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); myClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute(); ourLog.info("Done deleting all subscriptions"); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); mySubscriptionTestUtil.unregisterSubscriptionInterceptor(); myInterceptorRegistry.unregisterInterceptor(ourSubscriptionDebugLogInterceptor); diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToStorageSettingsDstu3Test.java similarity index 96% rename from hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test.java rename to hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToStorageSettingsDstu3Test.java index 5e61710daf4..a4d4f22eff2 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToStorageSettingsDstu3Test.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.subscription.resthook; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test; import ca.uhn.fhir.jpa.test.util.SubscriptionTestUtil; import ca.uhn.fhir.model.primitive.IdDt; @@ -39,14 +39,14 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; /** * Test the rest-hook subscriptions */ -public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends BaseResourceProviderDstu3Test { +public class RestHookTestWithInterceptorRegisteredToStorageSettingsDstu3Test extends BaseResourceProviderDstu3Test { private static final List ourCreatedObservations = Collections.synchronizedList(Lists.newArrayList()); private static int ourListenerPort; private static RestfulServer ourListenerRestServer; private static Server ourListenerServer; private static String ourListenerServerBase; - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test.class); + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestWithInterceptorRegisteredToStorageSettingsDstu3Test.class); private static final List ourUpdatedObservations = Collections.synchronizedList(Lists.newArrayList()); @Autowired @@ -59,11 +59,11 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu3Test extends B @AfterEach public void afterUnregisterRestHookListener() { - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); ourLog.info("Deleting all subscriptions"); myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); ourLog.info("Done deleting all subscriptions"); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); mySubscriptionTestUtil.unregisterSubscriptionInterceptor(); } diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/SubscriptionTriggeringDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/SubscriptionTriggeringDstu3Test.java index 15837e871c4..79c2f798c1c 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/SubscriptionTriggeringDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/SubscriptionTriggeringDstu3Test.java @@ -3,8 +3,7 @@ package ca.uhn.fhir.jpa.subscription.resthook; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.api.IInterceptorService; -import ca.uhn.fhir.jpa.api.config.DaoConfig; -import ca.uhn.fhir.jpa.model.sched.ISchedulerService; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.util.JpaConstants; import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test; import ca.uhn.fhir.jpa.subscription.triggering.ISubscriptionTriggeringSvc; @@ -92,12 +91,12 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te } mySubscriptionIds.clear(); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); ourLog.info("Deleting all subscriptions"); myClient.delete().resourceConditionalByUrl("Subscription?_lastUpdated=lt3000").execute(); myClient.delete().resourceConditionalByUrl("Observation?_lastUpdated=lt3000").execute(); ourLog.info("Done deleting all subscriptions"); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); mySubscriptionTestUtil.unregisterSubscriptionInterceptor(); @@ -105,7 +104,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te svc.cancelAll(); svc.setMaxSubmitPerPass(null); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); } @BeforeEach @@ -205,7 +204,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te @Test public void testTriggerUsingMultipleSearches() throws Exception { - myDaoConfig.setSearchPreFetchThresholds(Lists.newArrayList(13, 22, 100)); + myStorageSettings.setSearchPreFetchThresholds(Lists.newArrayList(13, 22, 100)); String payload = "application/fhir+json"; IdType sub1id = createSubscription("Observation?", payload, ourListenerServerBase).getIdElement(); @@ -306,7 +305,7 @@ public class SubscriptionTriggeringDstu3Test extends BaseResourceProviderDstu3Te @Test public void testTriggerUsingOrSeparatedList_SingleString() throws Exception { - myDaoConfig.setSearchPreFetchThresholds(Lists.newArrayList(13, 22, 100)); + myStorageSettings.setSearchPreFetchThresholds(Lists.newArrayList(13, 22, 100)); String payload = "application/fhir+json"; IdType sub2id = createSubscription("Patient?", payload, ourListenerServerBase).getIdElement(); diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithCriteriaDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithCriteriaDstu3Test.java index d12ca3f83c9..715faa4acb3 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithCriteriaDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithCriteriaDstu3Test.java @@ -26,7 +26,7 @@ public class WebsocketWithCriteriaDstu3Test extends BaseResourceProviderDstu3Tes private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(WebsocketWithCriteriaDstu3Test.class); @RegisterExtension - private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myModelConfig); + private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myStorageSettings); private String myPatientId; private String mySubscriptionId; diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithSubscriptionIdDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithSubscriptionIdDstu3Test.java index 7b1b6e92da0..3210ebdf4a6 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithSubscriptionIdDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithSubscriptionIdDstu3Test.java @@ -42,7 +42,7 @@ public class WebsocketWithSubscriptionIdDstu3Test extends BaseResourceProviderDs private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(WebsocketWithSubscriptionIdDstu3Test.class); @RegisterExtension - private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myModelConfig); + private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myStorageSettings); private String myPatientId; private String mySubscriptionId; @Autowired diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/term/TerminologyLoaderSvcIntegrationDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/term/TerminologyLoaderSvcIntegrationDstu3Test.java index 3f1b23acc28..2fae182387b 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/term/TerminologyLoaderSvcIntegrationDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/term/TerminologyLoaderSvcIntegrationDstu3Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.term; import ca.uhn.fhir.context.support.IValidationSupport; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.term.api.ITermLoaderSvc; import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test; import com.google.common.collect.Lists; @@ -45,12 +45,12 @@ public class TerminologyLoaderSvcIntegrationDstu3Test extends BaseJpaDstu3Test { @AfterEach public void after() { - myDaoConfig.setDeferIndexingForCodesystemsOfSize(new DaoConfig().getDeferIndexingForCodesystemsOfSize()); + myStorageSettings.setDeferIndexingForCodesystemsOfSize(new JpaStorageSettings().getDeferIndexingForCodesystemsOfSize()); } @BeforeEach public void before() { - myDaoConfig.setDeferIndexingForCodesystemsOfSize(20000); + myStorageSettings.setDeferIndexingForCodesystemsOfSize(20000); } @SuppressWarnings("unchecked") diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplDstu3Test.java index 7dc5e1e8653..b36ee053d6e 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplDstu3Test.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplDstu3Test.java @@ -4,7 +4,7 @@ import ca.uhn.fhir.context.support.ConceptValidationOptions; import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.context.support.ValidationSupportContext; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.entity.TermCodeSystem; import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; import ca.uhn.fhir.jpa.entity.TermConcept; @@ -56,7 +56,7 @@ public class TerminologySvcImplDstu3Test extends BaseJpaDstu3Test { @AfterEach public void after() { - myDaoConfig.setDeferIndexingForCodesystemsOfSize(new DaoConfig().getDeferIndexingForCodesystemsOfSize()); + myStorageSettings.setDeferIndexingForCodesystemsOfSize(new JpaStorageSettings().getDeferIndexingForCodesystemsOfSize()); TermReindexingSvcImpl.setForceSaveDeferredAlwaysForUnitTest(false); } @@ -244,7 +244,7 @@ public class TerminologySvcImplDstu3Test extends BaseJpaDstu3Test { @Test public void testCreatePropertiesAndDesignationsWithDeferredConcepts() { - myDaoConfig.setDeferIndexingForCodesystemsOfSize(1); + myStorageSettings.setDeferIndexingForCodesystemsOfSize(1); TermReindexingSvcImpl.setForceSaveDeferredAlwaysForUnitTest(true); createCodeSystem(); diff --git a/hapi-fhir-jpaserver-test-r4/pom.xml b/hapi-fhir-jpaserver-test-r4/pom.xml index c4d2950f61a..cb74e3b903a 100644 --- a/hapi-fhir-jpaserver-test-r4/pom.xml +++ b/hapi-fhir-jpaserver-test-r4/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/batch2/Batch2CoordinatorIT.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/batch2/Batch2CoordinatorIT.java index f3355933943..1e7d48945d6 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/batch2/Batch2CoordinatorIT.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/batch2/Batch2CoordinatorIT.java @@ -139,7 +139,7 @@ public class Batch2CoordinatorIT extends BaseJpaR4Test { for (int i = 0; i < maxJobsToSave; i++) { JobInstanceStartRequest request = buildRequest(jobId); Batch2JobStartResponse response = myJobCoordinator.startInstance(request); - jobIds.add(response.getJobId()); + jobIds.add(response.getInstanceId()); } // run the test @@ -189,7 +189,7 @@ public class Batch2CoordinatorIT extends BaseJpaR4Test { Batch2JobStartResponse startResponse = myJobCoordinator.startInstance(request); myFirstStepLatch.awaitExpected(); - myBatch2JobHelper.awaitJobCompletion(startResponse.getJobId()); + myBatch2JobHelper.awaitJobCompletion(startResponse.getInstanceId()); } @Test @@ -210,7 +210,7 @@ public class Batch2CoordinatorIT extends BaseJpaR4Test { myFirstStepLatch.setExpectedCount(1); myLastStepLatch.setExpectedCount(1); - String batchJobId = myJobCoordinator.startInstance(request).getJobId(); + String batchJobId = myJobCoordinator.startInstance(request).getInstanceId(); myFirstStepLatch.awaitExpected(); myBatch2JobHelper.assertFastTracking(batchJobId); @@ -329,7 +329,7 @@ public class Batch2CoordinatorIT extends BaseJpaR4Test { myFirstStepLatch.setExpectedCount(1); Batch2JobStartResponse startResponse = myJobCoordinator.startInstance(request); - String instanceId = startResponse.getJobId(); + String instanceId = startResponse.getInstanceId(); myFirstStepLatch.awaitExpected(); assertNotNull(instanceId); @@ -378,7 +378,7 @@ public class Batch2CoordinatorIT extends BaseJpaR4Test { myFirstStepLatch.setExpectedCount(1); Batch2JobStartResponse startResponse = myJobCoordinator.startInstance(request); - String instanceId = startResponse.getJobId(); + String instanceId = startResponse.getInstanceId(); myFirstStepLatch.awaitExpected(); myLastStepLatch.setExpectedCount(2); @@ -407,7 +407,7 @@ public class Batch2CoordinatorIT extends BaseJpaR4Test { // execute Batch2JobStartResponse startResponse = myJobCoordinator.startInstance(request); - String instanceId = startResponse.getJobId(); + String instanceId = startResponse.getInstanceId(); // validate myBatch2JobHelper.awaitJobFailure(instanceId); @@ -432,7 +432,7 @@ public class Batch2CoordinatorIT extends BaseJpaR4Test { // execute myFirstStepLatch.setExpectedCount(1); Batch2JobStartResponse startResponse = myJobCoordinator.startInstance(request); - String instanceId = startResponse.getJobId(); + String instanceId = startResponse.getInstanceId(); myFirstStepLatch.awaitExpected(); // validate @@ -485,7 +485,7 @@ public class Batch2CoordinatorIT extends BaseJpaR4Test { JobInstanceStartRequest request = buildRequest(jobDefId); myFirstStepLatch.setExpectedCount(1); Batch2JobStartResponse response = myJobCoordinator.startInstance(request); - JobInstance instance = myBatch2JobHelper.awaitJobHasStatus(response.getJobId(), + JobInstance instance = myBatch2JobHelper.awaitJobHasStatus(response.getInstanceId(), 12, // we want to wait a long time (2 min here) cause backoff is incremental StatusEnum.FAILED ); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/batch2/Batch2JobMaintenanceIT.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/batch2/Batch2JobMaintenanceIT.java index 6d549b18cd2..529b317e882 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/batch2/Batch2JobMaintenanceIT.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/batch2/Batch2JobMaintenanceIT.java @@ -88,7 +88,7 @@ public class Batch2JobMaintenanceIT extends BaseJpaR4Test { @AfterEach public void after() { myWorkChannel.clearInterceptorsForUnitTest(); - myDaoConfig.setJobFastTrackingEnabled(true); + myStorageSettings.setJobFastTrackingEnabled(true); JobMaintenanceServiceImpl jobMaintenanceService = (JobMaintenanceServiceImpl) myJobMaintenanceService; jobMaintenanceService.setMaintenanceJobStartedCallback(() -> {}); } @@ -111,7 +111,7 @@ public class Batch2JobMaintenanceIT extends BaseJpaR4Test { myFirstStepLatch.setExpectedCount(1); myLastStepLatch.setExpectedCount(1); - String batchJobId = myJobCoordinator.startInstance(request).getJobId(); + String batchJobId = myJobCoordinator.startInstance(request).getInstanceId(); myFirstStepLatch.awaitExpected(); myBatch2JobHelper.assertFastTracking(batchJobId); @@ -143,7 +143,7 @@ public class Batch2JobMaintenanceIT extends BaseJpaR4Test { @Test public void testFirstStepToSecondStepFasttrackingDisabled_singleChunkDoesNotFasttrack() throws InterruptedException { - myDaoConfig.setJobFastTrackingEnabled(false); + myStorageSettings.setJobFastTrackingEnabled(false); IJobStepWorker firstStep = (step, sink) -> { sink.accept(new Batch2JobMaintenanceIT.FirstStepOutput()); @@ -162,7 +162,7 @@ public class Batch2JobMaintenanceIT extends BaseJpaR4Test { myFirstStepLatch.setExpectedCount(1); myLastStepLatch.setExpectedCount(1); - String batchJobId = myJobCoordinator.startInstance(request).getJobId(); + String batchJobId = myJobCoordinator.startInstance(request).getInstanceId(); myFirstStepLatch.awaitExpected(); myBatch2JobHelper.assertFastTracking(batchJobId); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/binstore/DatabaseBlobBinaryStorageSvcImplTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/binstore/DatabaseBlobBinaryStorageSvcImplTest.java index 43c2833f629..02bd9d6fcd2 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/binstore/DatabaseBlobBinaryStorageSvcImplTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/binstore/DatabaseBlobBinaryStorageSvcImplTest.java @@ -1,6 +1,5 @@ package ca.uhn.fhir.jpa.binstore; -import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.binary.api.IBinaryStorageSvc; import ca.uhn.fhir.jpa.binary.api.StoredDetails; import ca.uhn.fhir.jpa.model.entity.BinaryStorageEntity; @@ -42,9 +41,6 @@ public class DatabaseBlobBinaryStorageSvcImplTest extends BaseJpaR4Test { @Qualifier("databaseBlobBinaryStorageSvc") private IBinaryStorageSvc mySvc; - @Autowired - private DaoConfig myDaoConfig; - @Test public void testStoreAndRetrieve() throws IOException { @@ -93,7 +89,7 @@ public class DatabaseBlobBinaryStorageSvcImplTest extends BaseJpaR4Test { @Test public void testStoreAndRetrieveWithPreload() throws IOException { - myDaoConfig.setPreloadBlobFromInputStream(true); + myStorageSettings.setPreloadBlobFromInputStream(true); testStoreAndRetrieve(); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/BulkDataExportProviderTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/BulkDataExportProviderTest.java index 7b68e16af74..8dda2c2020c 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/BulkDataExportProviderTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/BulkDataExportProviderTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.bulk; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.model.Batch2JobInfo; import ca.uhn.fhir.jpa.api.model.Batch2JobOperationResult; @@ -97,7 +97,7 @@ public class BulkDataExportProviderTest { @Mock private IBatch2JobRunner myJobRunner; - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; private DaoRegistry myDaoRegistry; private CloseableHttpClient myClient; @@ -138,9 +138,9 @@ public class BulkDataExportProviderTest { } @BeforeEach - public void injectDaoConfig() { - myDaoConfig = new DaoConfig(); - myProvider.setDaoConfig(myDaoConfig); + public void injectStorageSettings() { + myStorageSettings = new JpaStorageSettings(); + myProvider.setStorageSettings(myStorageSettings); myDaoRegistry = mock(DaoRegistry.class); lenient().when(myDaoRegistry.getRegisteredDaoTypes()).thenReturn(Set.of("Patient", "Observation", "Encounter")); myProvider.setDaoRegistry(myDaoRegistry); @@ -162,7 +162,7 @@ public class BulkDataExportProviderTest { private Batch2JobStartResponse createJobStartResponse(String theJobId) { Batch2JobStartResponse response = new Batch2JobStartResponse(); - response.setJobId(theJobId); + response.setInstanceId(theJobId); return response; } @@ -764,7 +764,7 @@ public class BulkDataExportProviderTest { Batch2JobStartResponse startResponse = createJobStartResponse(); startResponse.setUsesCachedResult(true); - myDaoConfig.setEnableBulkExportJobReuse(false); + myStorageSettings.setEnableBulkExportJobReuse(false); // when when(myJobRunner.startNewJob(any(Batch2BaseJobParameters.class))) @@ -797,7 +797,7 @@ public class BulkDataExportProviderTest { // given Batch2JobStartResponse startResponse = createJobStartResponse(); startResponse.setUsesCachedResult(true); - startResponse.setJobId(A_JOB_ID); + startResponse.setInstanceId(A_JOB_ID); when(myJobRunner.startNewJob(any(Batch2BaseJobParameters.class))) .thenReturn(startResponse); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/BulkDataExportTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/BulkDataExportTest.java index 9038098aba2..28373df7037 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/BulkDataExportTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/BulkDataExportTest.java @@ -1,9 +1,10 @@ package ca.uhn.fhir.jpa.bulk; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.BulkExportJobResults; import ca.uhn.fhir.jpa.api.svc.IBatch2JobRunner; import ca.uhn.fhir.jpa.batch.models.Batch2JobStartResponse; +import ca.uhn.fhir.jpa.bulk.export.model.BulkExportJobStatusEnum; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.jpa.util.BulkExportUtils; import ca.uhn.fhir.rest.api.Constants; @@ -13,28 +14,13 @@ import com.google.common.collect.Sets; import org.apache.commons.io.LineIterator; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; -import org.hl7.fhir.r4.model.Basic; -import org.hl7.fhir.r4.model.Binary; -import org.hl7.fhir.r4.model.CarePlan; -import org.hl7.fhir.r4.model.Device; -import org.hl7.fhir.r4.model.DocumentReference; -import org.hl7.fhir.r4.model.Encounter; -import org.hl7.fhir.r4.model.Enumerations; -import org.hl7.fhir.r4.model.Group; -import org.hl7.fhir.r4.model.IdType; -import org.hl7.fhir.r4.model.InstantType; -import org.hl7.fhir.r4.model.Location; -import org.hl7.fhir.r4.model.MedicationAdministration; -import org.hl7.fhir.r4.model.Observation; -import org.hl7.fhir.r4.model.Organization; -import org.hl7.fhir.r4.model.Patient; -import org.hl7.fhir.r4.model.Practitioner; -import org.hl7.fhir.r4.model.Provenance; -import org.hl7.fhir.r4.model.QuestionnaireResponse; -import org.hl7.fhir.r4.model.Reference; -import org.hl7.fhir.r4.model.ServiceRequest; +import org.hl7.fhir.r4.model.*; import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import org.slf4j.Logger; @@ -61,18 +47,21 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.fail; +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) public class BulkDataExportTest extends BaseResourceProviderR4Test { private static final Logger ourLog = LoggerFactory.getLogger(BulkDataExportTest.class); - @Autowired - private DaoConfig myDaoConfig; - @Autowired private IBatch2JobRunner myJobRunner; @AfterEach void afterEach() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); + } + + @BeforeEach + public void beforeEach() { + myStorageSettings.setJobFastTrackingEnabled(false); } @Test @@ -108,6 +97,7 @@ public class BulkDataExportTest extends BaseResourceProviderR4Test { } @Test + @Order(0) public void testGroupBulkExportNotInGroup_DoesNotShowUp() { // Create some resources Patient patient = new Patient(); @@ -183,7 +173,7 @@ public class BulkDataExportTest extends BaseResourceProviderR4Test { @Test public void testPatientBulkExportWithSingleId() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); // create some resources Patient patient = new Patient(); patient.setId("P1"); @@ -233,7 +223,7 @@ public class BulkDataExportTest extends BaseResourceProviderR4Test { @Test public void testPatientBulkExportWithMultiIds() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); // create some resources Patient patient = new Patient(); patient.setId("P1"); @@ -514,7 +504,7 @@ public class BulkDataExportTest extends BaseResourceProviderR4Test { @Test public void testPatientBulkExportWithReferenceToAuthor_ShouldShowUp() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); // Create some resources Patient patient = new Patient(); patient.setId("P1"); @@ -550,7 +540,7 @@ public class BulkDataExportTest extends BaseResourceProviderR4Test { @Test public void testPatientBulkExportWithReferenceToPerformer_ShouldShowUp() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); // Create some resources Patient patient = new Patient(); patient.setId("P1"); @@ -598,7 +588,7 @@ public class BulkDataExportTest extends BaseResourceProviderR4Test { @Test public void testPatientBulkExportWithResourceNotInCompartment_ShouldShowUp() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); // Create some resources Patient patient = new Patient(); patient.setId("P1"); @@ -658,24 +648,25 @@ public class BulkDataExportTest extends BaseResourceProviderR4Test { verifyBulkExportResults(options, expectedContainedIds, Collections.emptyList()); } - private static Stream> bulkExportOptionsResourceTypes() { - return Stream.of(Set.of("Patient", "Group"), Set.of("Patient", "Group", "Device")); - } - private void verifyBulkExportResults(BulkDataExportOptions theOptions, List theContainedList, List theExcludedList) { Batch2JobStartResponse startResponse = myJobRunner.startNewJob(BulkExportUtils.createBulkExportJobParametersFromExportOptions(theOptions)); assertNotNull(startResponse); + assertEquals(false, startResponse.isUsesCachedResult()); // Run a scheduled pass to build the export - myBatch2JobHelper.awaitJobCompletion(startResponse.getJobId(), 60); + myBatch2JobHelper.awaitJobCompletion(startResponse.getInstanceId(), 120); await() - .atMost(120, TimeUnit.SECONDS) - .until(() -> myJobRunner.getJobInfo(startResponse.getJobId()).getReport() != null); + .atMost(200, TimeUnit.SECONDS) + .until(() -> myJobRunner.getJobInfo(startResponse.getInstanceId()).getStatus() == BulkExportJobStatusEnum.COMPLETE); + + await() + .atMost(200, TimeUnit.SECONDS) + .until(() -> myJobRunner.getJobInfo(startResponse.getInstanceId()).getReport() != null); // Iterate over the files - String report = myJobRunner.getJobInfo(startResponse.getJobId()).getReport(); + String report = myJobRunner.getJobInfo(startResponse.getInstanceId()).getReport(); BulkExportJobResults results = JsonUtil.deserialize(report, BulkExportJobResults.class); Set foundIds = new HashSet<>(); @@ -717,4 +708,8 @@ public class BulkDataExportTest extends BaseResourceProviderR4Test { } } + private static Stream> bulkExportOptionsResourceTypes() { + return Stream.of(Set.of("Patient", "Group"), Set.of("Patient", "Group", "Device")); + } + } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/BulkExportUseCaseTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/BulkExportUseCaseTest.java index 89bd2e9acd0..2d458b93087 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/BulkExportUseCaseTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/BulkExportUseCaseTest.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.bulk; import ca.uhn.fhir.batch2.api.IJobPersistence; import ca.uhn.fhir.batch2.model.JobInstance; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.BulkExportJobResults; import ca.uhn.fhir.jpa.api.svc.IBatch2JobRunner; import ca.uhn.fhir.jpa.batch.models.Batch2JobStartResponse; @@ -83,6 +83,11 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test { @Autowired private IJobPersistence myJobPersistence; + @BeforeEach + public void beforeEach() { + myStorageSettings.setJobFastTrackingEnabled(false); + } + @Nested public class SpecConformanceTests { @@ -368,10 +373,10 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test { assertNotNull(startResponse); - final String jobId = startResponse.getJobId(); + final String jobId = startResponse.getInstanceId(); // Run a scheduled pass to build the export - myBatch2JobHelper.awaitJobCompletion(startResponse.getJobId()); + myBatch2JobHelper.awaitJobCompletion(startResponse.getInstanceId()); final Optional optJobInstance = myJobPersistence.fetchInstance(jobId); @@ -404,13 +409,13 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test { @BeforeEach public void before() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); } @AfterEach public void after() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); - myDaoConfig.setBulkExportFileMaximumCapacity(DaoConfig.DEFAULT_BULK_EXPORT_FILE_MAXIMUM_CAPACITY); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); + myStorageSettings.setBulkExportFileMaximumCapacity(JpaStorageSettings.DEFAULT_BULK_EXPORT_FILE_MAXIMUM_CAPACITY); } @Test @@ -442,8 +447,8 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test { @Test public void testBulkExportWithLowMaxFileCapacity() { final int numPatients = 250; - myDaoConfig.setBulkExportFileMaximumCapacity(1); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setBulkExportFileMaximumCapacity(1); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); RequestDetails details = new SystemRequestDetails(); List patientIds = new ArrayList<>(); @@ -464,19 +469,19 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test { options.setOutputFormat(Constants.CT_FHIR_NDJSON); Batch2JobStartResponse job = myJobRunner.startNewJob(BulkExportUtils.createBulkExportJobParametersFromExportOptions(options)); - myBatch2JobHelper.awaitJobCompletion(job.getJobId(), 60); - ourLog.debug("Job status after awaiting - {}", myJobRunner.getJobInfo(job.getJobId()).getStatus()); + myBatch2JobHelper.awaitJobCompletion(job.getInstanceId(), 60); + ourLog.debug("Job status after awaiting - {}", myJobRunner.getJobInfo(job.getInstanceId()).getStatus()); await() .atMost(300, TimeUnit.SECONDS) .until(() -> { - BulkExportJobStatusEnum status = myJobRunner.getJobInfo(job.getJobId()).getStatus(); + BulkExportJobStatusEnum status = myJobRunner.getJobInfo(job.getInstanceId()).getStatus(); if (!BulkExportJobStatusEnum.COMPLETE.equals(status)) { fail("Job status was changed from COMPLETE to " + status); } - return myJobRunner.getJobInfo(job.getJobId()).getReport() != null; + return myJobRunner.getJobInfo(job.getInstanceId()).getReport() != null; }); - String report = myJobRunner.getJobInfo(job.getJobId()).getReport(); + String report = myJobRunner.getJobInfo(job.getInstanceId()).getReport(); BulkExportJobResults results = JsonUtil.deserialize(report, BulkExportJobResults.class); List binaryUrls = results.getResourceTypeToBinaryIds().get("Patient"); @@ -662,8 +667,8 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test { public void testGroupExport_includesObservationsAndEncountersOfPatientsInExportedGroup_whenLuceneIdexingEnabled() { // Enable Lucene indexing - myDaoConfig.setAllowContainsSearches(true); - myDaoConfig.setAdvancedHSearchIndexing(true); + myStorageSettings.setAllowContainsSearches(true); + myStorageSettings.setAdvancedHSearchIndexing(true); Patient patient = new Patient(); patient.setId("A1"); @@ -1013,12 +1018,12 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test { @BeforeEach void setUp() { - myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ANY); + myStorageSettings.setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.ANY); } @AfterEach void tearDown() { - myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ALPHANUMERIC); + myStorageSettings.setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.ALPHANUMERIC); } @Test @@ -1121,11 +1126,11 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test { assertNotNull(startResponse); - myBatch2JobHelper.awaitJobCompletion(startResponse.getJobId(), 60); + myBatch2JobHelper.awaitJobCompletion(startResponse.getInstanceId(), 60); - await().atMost(300, TimeUnit.SECONDS).until(() -> myJobRunner.getJobInfo(startResponse.getJobId()).getReport() != null); + await().atMost(300, TimeUnit.SECONDS).until(() -> myJobRunner.getJobInfo(startResponse.getInstanceId()).getReport() != null); - String report = myJobRunner.getJobInfo(startResponse.getJobId()).getReport(); + String report = myJobRunner.getJobInfo(startResponse.getInstanceId()).getReport(); BulkExportJobResults results = JsonUtil.deserialize(report, BulkExportJobResults.class); return results; } @@ -1143,12 +1148,12 @@ public class BulkExportUseCaseTest extends BaseResourceProviderR4Test { assertNotNull(startResponse); // Run a scheduled pass to build the export - myBatch2JobHelper.awaitJobCompletion(startResponse.getJobId()); + myBatch2JobHelper.awaitJobCompletion(startResponse.getInstanceId()); - await().until(() -> myJobRunner.getJobInfo(startResponse.getJobId()).getReport() != null); + await().until(() -> myJobRunner.getJobInfo(startResponse.getInstanceId()).getReport() != null); // Iterate over the files - String report = myJobRunner.getJobInfo(startResponse.getJobId()).getReport(); + String report = myJobRunner.getJobInfo(startResponse.getInstanceId()).getReport(); BulkExportJobResults results = JsonUtil.deserialize(report, BulkExportJobResults.class); for (Map.Entry> file : results.getResourceTypeToBinaryIds().entrySet()) { List binaryIds = file.getValue(); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/BulkExportUseCaseTestAnyMode.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/BulkExportUseCaseTestAnyMode.java index 62028176ede..764722b5c70 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/BulkExportUseCaseTestAnyMode.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/BulkExportUseCaseTestAnyMode.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.bulk; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.slf4j.Logger; @@ -13,12 +13,12 @@ public class BulkExportUseCaseTestAnyMode extends BulkExportUseCaseTest { @BeforeEach public void setup() { - myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ANY); + myStorageSettings.setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.ANY); } @AfterEach public void tearDown() { - myDaoConfig.setResourceClientIdStrategy(new DaoConfig().getResourceClientIdStrategy()); + myStorageSettings.setResourceClientIdStrategy(new JpaStorageSettings().getResourceClientIdStrategy()); } } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/imprt2/BulkImportR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/imprt2/BulkImportR4Test.java index 957688d8706..62cf902d570 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/imprt2/BulkImportR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/imprt2/BulkImportR4Test.java @@ -96,7 +96,7 @@ public class BulkImportR4Test extends BaseJpaR4Test { // Execute Batch2JobStartResponse startResponse = myJobCoordinator.startInstance(request); - String instanceId = startResponse.getJobId(); + String instanceId = startResponse.getInstanceId(); assertThat(instanceId, not(blankOrNullString())); ourLog.info("Execution got ID: {}", instanceId); @@ -150,7 +150,7 @@ public class BulkImportR4Test extends BaseJpaR4Test { // Execute Batch2JobStartResponse startResponse = myJobCoordinator.startInstance(request); - String instanceId = startResponse.getJobId(); + String instanceId = startResponse.getInstanceId(); assertThat(instanceId, not(blankOrNullString())); ourLog.info("Execution got ID: {}", instanceId); @@ -230,7 +230,7 @@ public class BulkImportR4Test extends BaseJpaR4Test { // Execute Batch2JobStartResponse startResponse = myJobCoordinator.startInstance(request); - String instanceId = startResponse.getJobId(); + String instanceId = startResponse.getInstanceId(); assertThat(instanceId, not(blankOrNullString())); ourLog.info("Execution got ID: {}", instanceId); @@ -273,7 +273,7 @@ public class BulkImportR4Test extends BaseJpaR4Test { // Execute Batch2JobStartResponse startResponse = myJobCoordinator.startInstance(request); - String instanceId = startResponse.getJobId(); + String instanceId = startResponse.getInstanceId(); assertThat(instanceId, not(blankOrNullString())); ourLog.info("Execution got ID: {}", instanceId); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDaoTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDaoTest.java index 3230cd75d38..e96ba93c668 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDaoTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDaoTest.java @@ -8,7 +8,7 @@ import ca.uhn.fhir.batch2.model.JobInstanceStartRequest; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; import ca.uhn.fhir.jpa.api.model.DeleteConflictList; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; @@ -41,13 +41,10 @@ import org.springframework.context.ApplicationContext; import javax.persistence.EntityManager; import java.util.List; -import java.util.List; - -import java.util.List; - import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.fail; +import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) class BaseHapiFhirResourceDaoTest { @@ -62,7 +59,7 @@ class BaseHapiFhirResourceDaoTest { private EntityManager myEntityManager; @Mock - private DaoConfig myConfig; + private JpaStorageSettings myStorageSettings; @Mock private IJobCoordinator myJobCoordinator; @@ -107,7 +104,7 @@ class BaseHapiFhirResourceDaoTest { public void validateResourceIdCreation_asSystem() { Patient patient = new Patient(); RequestDetails sysRequest = new SystemRequestDetails(); - mySvc.getConfig().setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.NOT_ALLOWED); + mySvc.getStorageSettings().setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.NOT_ALLOWED); mySvc.validateResourceIdCreation(patient, sysRequest); // no exception is thrown } @@ -116,7 +113,7 @@ class BaseHapiFhirResourceDaoTest { public void validateResourceIdCreation_asUser() { Patient patient = new Patient(); RequestDetails sysRequest = new ServletRequestDetails(); - mySvc.getConfig().setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.NOT_ALLOWED); + when(myStorageSettings.getResourceClientIdStrategy()).thenReturn(JpaStorageSettings.ClientIdStrategyEnum.NOT_ALLOWED); try { mySvc.validateResourceIdCreation(patient, sysRequest); fail(); @@ -130,7 +127,7 @@ class BaseHapiFhirResourceDaoTest { Patient patient = new Patient(); patient.setId("2401"); RequestDetails sysRequest = new ServletRequestDetails(); - mySvc.getConfig().setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ALPHANUMERIC); + when(myStorageSettings.getResourceClientIdStrategy()).thenReturn(JpaStorageSettings.ClientIdStrategyEnum.ALPHANUMERIC); try { mySvc.validateResourceIdCreation(patient, sysRequest); fail(); @@ -144,7 +141,7 @@ class BaseHapiFhirResourceDaoTest { Patient patient = new Patient(); patient.setId("P2401"); RequestDetails sysRequest = new ServletRequestDetails(); - mySvc.getConfig().setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ALPHANUMERIC); + mySvc.getStorageSettings().setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.ALPHANUMERIC); mySvc.validateResourceIdCreation(patient, sysRequest); // no exception is thrown } @@ -155,6 +152,8 @@ class BaseHapiFhirResourceDaoTest { setup(Patient.class); // setup + when(myStorageSettings.isDeleteEnabled()).thenReturn(true); + IIdType id = new IdType("Patient/123"); // id part is only numbers DeleteConflictList deleteConflicts = new DeleteConflictList(); RequestDetails requestDetails = new SystemRequestDetails(); @@ -166,17 +165,17 @@ class BaseHapiFhirResourceDaoTest { entity.setForcedId(new ForcedId()); // mock - Mockito.when(myRequestPartitionHelperSvc.determineReadPartitionForRequestForRead( + when(myRequestPartitionHelperSvc.determineReadPartitionForRequestForRead( Mockito.any(RequestDetails.class), Mockito.anyString(), Mockito.any(IIdType.class) )).thenReturn(partitionId); - Mockito.when(myIdHelperService.resolveResourcePersistentIds( + when(myIdHelperService.resolveResourcePersistentIds( Mockito.any(RequestPartitionId.class), Mockito.anyString(), Mockito.anyString() )).thenReturn(jpaPid); - Mockito.when(myEntityManager.find( + when(myEntityManager.find( Mockito.any(Class.class), Mockito.anyLong() )).thenReturn(entity); @@ -195,9 +194,11 @@ class BaseHapiFhirResourceDaoTest { @Test public void requestReindexForRelatedResources_withValidBase_includesUrlsInJobParameters() { + when(myStorageSettings.isMarkResourcesForReindexingUponSearchParameterChange()).thenReturn(true); + List base = Lists.newArrayList("Patient", "Group"); - Mockito.when(myUrlPartitioner.partitionUrl(Mockito.any(), Mockito.any())).thenAnswer(i -> { + when(myUrlPartitioner.partitionUrl(Mockito.any(), Mockito.any())).thenAnswer(i -> { PartitionedUrl partitionedUrl = new PartitionedUrl(); partitionedUrl.setUrl(i.getArgument(0)); return partitionedUrl; @@ -220,6 +221,8 @@ class BaseHapiFhirResourceDaoTest { @Test public void requestReindexForRelatedResources_withSpecialBaseResource_doesNotIncludeUrlsInJobParameters() { + when(myStorageSettings.isMarkResourcesForReindexingUponSearchParameterChange()).thenReturn(true); + List base = Lists.newArrayList("Resource"); mySvc.requestReindexForRelatedResources(false, base, new ServletRequestDetails()); @@ -236,11 +239,10 @@ class BaseHapiFhirResourceDaoTest { } static class TestResourceDao extends BaseHapiFhirResourceDao { - private final DaoConfig myDaoConfig = new DaoConfig(); @Override - public DaoConfig getConfig() { - return myDaoConfig; + public JpaStorageSettings getStorageSettings() { + return myStorageSettings; } @Override diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoSearchParameterTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoSearchParameterTest.java index d675cc7b3fc..838fb2d85f9 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoSearchParameterTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoSearchParameterTest.java @@ -4,7 +4,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.context.RuntimeSearchParam; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.validation.SearchParameterDaoValidator; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; @@ -43,8 +43,8 @@ public class JpaResourceDaoSearchParameterTest { myDao = new JpaResourceDaoSearchParameter<>(); myDao.setContext(myCtx); - DaoConfig defaultConfig = new DaoConfig(); - myDao.setDaoConfigForUnitTest(defaultConfig); + JpaStorageSettings defaultConfig = new JpaStorageSettings(); + myDao.setStorageSettingsForUnitTest(defaultConfig); myDao.setResourceType(SearchParameter.class); myDao.setApplicationContext(myApplicationContext); myDao.setVersionCanonicalizerForUnitTest(versionCanonicalizer); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/TransactionProcessorTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/TransactionProcessorTest.java index 09f2e5a9b04..97fe75a33a1 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/TransactionProcessorTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/TransactionProcessorTest.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.dao; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.executor.InterceptorService; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.config.ThreadPoolFactoryConfig; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; @@ -12,7 +12,7 @@ import ca.uhn.fhir.jpa.cache.IResourceVersionSvc; import ca.uhn.fhir.jpa.dao.r4.TransactionProcessorVersionAdapterR4; import ca.uhn.fhir.jpa.dao.tx.HapiTransactionService; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc; import ca.uhn.fhir.jpa.searchparam.MatchUrlService; import ca.uhn.fhir.jpa.searchparam.matcher.InMemoryResourceMatcher; @@ -68,8 +68,6 @@ public class TransactionProcessorTest { @MockBean private HapiTransactionService myHapiTransactionService; @MockBean - private ModelConfig myModelConfig; - @MockBean private InMemoryResourceMatcher myInMemoryResourceMatcher; @MockBean private IIdHelperService myIdHelperService; @@ -138,6 +136,11 @@ public class TransactionProcessorTest { return FhirContext.forR4Cached(); } + @Bean + public JpaStorageSettings storageSettings() { + return new JpaStorageSettings(); + } + @Bean public TransactionProcessor transactionProcessor() { return new TransactionProcessor(); @@ -148,11 +151,6 @@ public class TransactionProcessorTest { return new InterceptorService(); } - @Bean - public DaoConfig daoConfig() { - return new DaoConfig(); - } - @Bean public ITransactionProcessorVersionAdapter versionAdapter() { return new TransactionProcessorVersionAdapterR4(); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/expunge/DeleteExpungeDaoTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/expunge/DeleteExpungeDaoTest.java index 646e1cc501b..84d7edce70d 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/expunge/DeleteExpungeDaoTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/expunge/DeleteExpungeDaoTest.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.dao.expunge; import ca.uhn.fhir.batch2.model.JobInstance; import ca.uhn.fhir.batch2.model.StatusEnum; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.DeleteMethodOutcome; import ca.uhn.fhir.jpa.model.util.JpaConstants; import ca.uhn.fhir.rest.api.server.SystemRequestDetails; @@ -31,24 +31,24 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.when; class DeleteExpungeDaoTest extends BaseJpaR4Test { - @Autowired - DaoConfig myDaoConfig; + @Override @BeforeEach - public void before() { - myDaoConfig.setAllowMultipleDelete(true); - myDaoConfig.setExpungeEnabled(true); - myDaoConfig.setDeleteExpungeEnabled(true); - myDaoConfig.setInternalSynchronousSearchSize(new DaoConfig().getInternalSynchronousSearchSize()); + public void before() throws Exception { + super.before(); + myStorageSettings.setAllowMultipleDelete(true); + myStorageSettings.setExpungeEnabled(true); + myStorageSettings.setDeleteExpungeEnabled(true); + myStorageSettings.setInternalSynchronousSearchSize(new JpaStorageSettings().getInternalSynchronousSearchSize()); } @AfterEach public void after() { - DaoConfig defaultDaoConfig = new DaoConfig(); - myDaoConfig.setAllowMultipleDelete(defaultDaoConfig.isAllowMultipleDelete()); - myDaoConfig.setExpungeEnabled(defaultDaoConfig.isExpungeEnabled()); - myDaoConfig.setDeleteExpungeEnabled(defaultDaoConfig.isDeleteExpungeEnabled()); - myDaoConfig.setExpungeBatchSize(defaultDaoConfig.getExpungeBatchSize()); + JpaStorageSettings defaultStorageSettings = new JpaStorageSettings(); + myStorageSettings.setAllowMultipleDelete(defaultStorageSettings.isAllowMultipleDelete()); + myStorageSettings.setExpungeEnabled(defaultStorageSettings.isExpungeEnabled()); + myStorageSettings.setDeleteExpungeEnabled(defaultStorageSettings.isDeleteExpungeEnabled()); + myStorageSettings.setExpungeBatchSize(defaultStorageSettings.getExpungeBatchSize()); } @Test @@ -129,7 +129,7 @@ class DeleteExpungeDaoTest extends BaseJpaR4Test { builder.addTransactionUpdateEntry(p); } mySystemDao.transaction(new SystemRequestDetails(), (Bundle) builder.getBundle()); - myDaoConfig.setExpungeBatchSize(10); + myStorageSettings.setExpungeBatchSize(10); // execute DeleteMethodOutcome outcome = myOrganizationDao.deleteByUrl("Organization?" + JpaConstants.PARAM_DELETE_EXPUNGE + "=true", mySrd); @@ -144,7 +144,7 @@ class DeleteExpungeDaoTest extends BaseJpaR4Test { @Test public void testDeleteExpungeRespectsExpungeBatchSize() { // setup - myDaoConfig.setExpungeBatchSize(3); + myStorageSettings.setExpungeBatchSize(3); for (int i = 0; i < 10; ++i) { Patient patient = new Patient(); myPatientDao.create(patient); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/index/IdHelperServiceTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/index/IdHelperServiceTest.java index d88cf02a1d7..fd986e6745b 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/index/IdHelperServiceTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/index/IdHelperServiceTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.index; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.data.IForcedIdDao; import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.cross.IResourceLookup; @@ -38,7 +38,7 @@ import static org.mockito.Mockito.when; public class IdHelperServiceTest { @Mock - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Mock private IForcedIdDao myForcedIdDao; @@ -98,7 +98,7 @@ public class IdHelperServiceTest { }; // when - when(myDaoConfig.isDeleteEnabled()) + when(myStorageSettings.isDeleteEnabled()) .thenReturn(true); when(myForcedIdDao.findAndResolveByForcedIdWithNoType(Mockito.anyString(), Mockito.anyList(), Mockito.anyBoolean())) @@ -200,7 +200,7 @@ public class IdHelperServiceTest { Long id = 1L; JpaPid jpaPid1 = JpaPid.fromId(id); - when(myDaoConfig.getResourceClientIdStrategy()).thenReturn(DaoConfig.ClientIdStrategyEnum.ANY); + when(myStorageSettings.getResourceClientIdStrategy()).thenReturn(JpaStorageSettings.ClientIdStrategyEnum.ANY); when(myMemoryCacheService.getThenPutAfterCommit(any(), any(), any())).thenReturn(jpaPid1); JpaPid result = myHelperService.resolveResourcePersistentIds(partitionId, resourceType, id.toString()); assertEquals(id, result.getId()); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseComboParamsR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseComboParamsR4Test.java index 6593a6a64aa..bea022b22f8 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseComboParamsR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseComboParamsR4Test.java @@ -3,8 +3,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.reindex.ResourceReindexingSvcImpl; @@ -33,11 +32,13 @@ public abstract class BaseComboParamsR4Test extends BaseJpaR4Test { protected List myMessages = new ArrayList<>(); private IInterceptorBroadcaster myInterceptorBroadcaster; + @Override @BeforeEach - public void before() { - myModelConfig.setDefaultSearchParamsCanBeOverridden(true); - myDaoConfig.setSchedulingDisabled(true); - myDaoConfig.setUniqueIndexesEnabled(true); + public void before() throws Exception { + super.before(); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(true); + myStorageSettings.setSchedulingDisabled(true); + myStorageSettings.setUniqueIndexesEnabled(true); myInterceptorBroadcaster = mock(IInterceptorBroadcaster.class); when(mySrd.getInterceptorBroadcaster()).thenReturn(myInterceptorBroadcaster); @@ -64,11 +65,11 @@ public abstract class BaseComboParamsR4Test extends BaseJpaR4Test { @AfterEach public void after() throws Exception { - myModelConfig.setDefaultSearchParamsCanBeOverridden(new ModelConfig().isDefaultSearchParamsCanBeOverridden()); - myDaoConfig.setUniqueIndexesCheckedBeforeSave(new DaoConfig().isUniqueIndexesCheckedBeforeSave()); - myDaoConfig.setSchedulingDisabled(new DaoConfig().isSchedulingDisabled()); - myDaoConfig.setUniqueIndexesEnabled(new DaoConfig().isUniqueIndexesEnabled()); - myDaoConfig.setReindexThreadCount(new DaoConfig().getReindexThreadCount()); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(new JpaStorageSettings().isDefaultSearchParamsCanBeOverridden()); + myStorageSettings.setUniqueIndexesCheckedBeforeSave(new JpaStorageSettings().isUniqueIndexesCheckedBeforeSave()); + myStorageSettings.setSchedulingDisabled(new JpaStorageSettings().isSchedulingDisabled()); + myStorageSettings.setUniqueIndexesEnabled(new JpaStorageSettings().isUniqueIndexesEnabled()); + myStorageSettings.setReindexThreadCount(new JpaStorageSettings().getReindexThreadCount()); ResourceReindexingSvcImpl svc = SpringObjectCaster.getTargetObject(myResourceReindexingSvc, ResourceReindexingSvcImpl.class); svc.initExecutor(); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/BasePartitioningR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/BasePartitioningR4Test.java index 40e7c248995..3d68e7f458d 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/BasePartitioningR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/BasePartitioningR4Test.java @@ -4,7 +4,7 @@ import ca.uhn.fhir.interceptor.api.Hook; import ca.uhn.fhir.interceptor.api.Interceptor; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.entity.PartitionEntity; import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.entity.ForcedId; @@ -69,10 +69,10 @@ public abstract class BasePartitioningR4Test extends BaseJpaR4SystemTest { }); } - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(new DaoConfig().isAutoCreatePlaceholderReferenceTargets()); - myDaoConfig.setMassIngestionMode(new DaoConfig().isMassIngestionMode()); - myDaoConfig.setMatchUrlCacheEnabled(new DaoConfig().getMatchUrlCache()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(new JpaStorageSettings().isAutoCreatePlaceholderReferenceTargets()); + myStorageSettings.setMassIngestionMode(new JpaStorageSettings().isMassIngestionMode()); + myStorageSettings.setMatchUrlCacheEnabled(new JpaStorageSettings().getMatchUrlCache()); } @BeforeEach @@ -80,9 +80,9 @@ public abstract class BasePartitioningR4Test extends BaseJpaR4SystemTest { myPartitionSettings.setPartitioningEnabled(true); myPartitionSettings.setIncludePartitionInSearchHashes(new PartitionSettings().isIncludePartitionInSearchHashes()); - myDaoConfig.setUniqueIndexesEnabled(true); + myStorageSettings.setUniqueIndexesEnabled(true); - myModelConfig.setDefaultSearchParamsCanBeOverridden(true); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(true); myPartitionDate = LocalDate.of(2020, Month.JANUARY, 14); myPartitionDate2 = LocalDate.of(2020, Month.FEBRUARY, 15); @@ -97,7 +97,7 @@ public abstract class BasePartitioningR4Test extends BaseJpaR4SystemTest { myPartitionConfigSvc.createPartition(new PartitionEntity().setId(3).setName(PARTITION_3), null); myPartitionConfigSvc.createPartition(new PartitionEntity().setId(4).setName(PARTITION_4), null); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); // Ensure the partition names are resolved myPartitionInterceptor.addReadPartition(RequestPartitionId.fromPartitionNames(JpaConstants.DEFAULT_PARTITION_NAME, PARTITION_1, PARTITION_2, PARTITION_3, PARTITION_4)); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/ChainingR4SearchTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/ChainingR4SearchTest.java index e14bbc34d08..77733dc6a19 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/ChainingR4SearchTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/ChainingR4SearchTest.java @@ -1,9 +1,8 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.searchparam.MatchUrlService; import ca.uhn.fhir.jpa.searchparam.ResourceSearch; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; @@ -50,25 +49,26 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { @AfterEach public void after() throws Exception { - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setCountSearchResultsUpTo(new DaoConfig().getCountSearchResultsUpTo()); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); - myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches()); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); - - myModelConfig.setIndexOnContainedResources(new ModelConfig().isIndexOnContainedResources()); - myModelConfig.setIndexOnContainedResourcesRecursively(new ModelConfig().isIndexOnContainedResourcesRecursively()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setCountSearchResultsUpTo(new JpaStorageSettings().getCountSearchResultsUpTo()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); + myStorageSettings.setAllowContainsSearches(new JpaStorageSettings().isAllowContainsSearches()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); + myStorageSettings.setIndexOnContainedResources(new JpaStorageSettings().isIndexOnContainedResources()); + myStorageSettings.setIndexOnContainedResourcesRecursively(new JpaStorageSettings().isIndexOnContainedResourcesRecursively()); } + @Override @BeforeEach public void before() throws Exception { + super.before(); myFhirContext.setParserErrorHandler(new StrictErrorHandler()); - myDaoConfig.setAllowMultipleDelete(true); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setAllowMultipleDelete(true); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @Test @@ -107,7 +107,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldResolveATwoLinkChainWithStandAloneResources() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -141,7 +141,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldResolveATwoLinkChainWithStandAloneResources_CommonReference() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -185,7 +185,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldResolveATwoLinkChainWithStandAloneResources_CompoundReference() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; IIdType oid2; @@ -232,7 +232,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldResolveATwoLinkChainWithContainedResources_CompoundReference() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; IIdType oid2; @@ -278,7 +278,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { @Test public void testShouldResolveATwoLinkChainWithAContainedResource() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -353,7 +353,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { // TODO: This test fails because of a known limitation in qualified searches over contained resources. // Type information for intermediate resources in the chain is not being retained in the indexes. // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -401,7 +401,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { // Adding support for this case in SMILE-3151 // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; IIdType orgId; @@ -443,7 +443,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { // Adding support for this case in SMILE-3151 // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; IIdType orgId; @@ -484,7 +484,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldResolveATwoLinkChainWithAContainedResource_CommonReference() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -576,7 +576,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldResolveAThreeLinkChainWhereAllResourcesStandAlone() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -631,7 +631,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { // This is the case that is most relevant to SMILE-2899 // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -671,7 +671,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldResolveAThreeLinkChainWithAContainedResourceAtTheEndOfTheChain_CommonReference() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -717,7 +717,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { // Adding support for this case in SMILE-3151 // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -757,7 +757,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldResolveAThreeLinkChainWithAContainedResourceAtTheBeginningOfTheChain_CommonReference() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -801,7 +801,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldNotResolveAThreeLinkChainWithAllContainedResourcesWhenRecursiveContainedIndexesAreDisabled() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -840,8 +840,8 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldResolveAThreeLinkChainWithAllContainedResources() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); - myModelConfig.setIndexOnContainedResourcesRecursively(true); + myStorageSettings.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResourcesRecursively(true); IIdType oid1; @@ -883,7 +883,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldResolveAThreeLinkChainWithQualifiersWhereAllResourcesStandAlone() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -934,7 +934,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { // This is the case that is most relevant to SMILE-2899 // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -990,7 +990,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { // Adding support for this case in SMILE-3151 // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -1048,7 +1048,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { // Adding support for this case in SMILE-3151 // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -1104,8 +1104,8 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { // Type information for intermediate resources in the chain is not being retained in the indexes. // setup - myModelConfig.setIndexOnContainedResources(true); - myModelConfig.setIndexOnContainedResourcesRecursively(true); + myStorageSettings.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResourcesRecursively(true); IIdType oid1; @@ -1163,7 +1163,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldResolveAFourLinkChainWhereAllResourcesStandAlone() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -1208,7 +1208,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldResolveAFourLinkChainWhereTheLastReferenceIsContained() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -1253,8 +1253,8 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldResolveAFourLinkChainWhereTheLastTwoReferencesAreContained() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); - myModelConfig.setIndexOnContainedResourcesRecursively(true); + myStorageSettings.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResourcesRecursively(true); IIdType oid1; { @@ -1298,7 +1298,7 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldResolveAFourLinkChainWithAContainedResourceInTheMiddle() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); IIdType oid1; @@ -1349,8 +1349,8 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldResolveAFourLinkChainWhereTheFirstTwoReferencesAreContained() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); - myModelConfig.setIndexOnContainedResourcesRecursively(true); + myStorageSettings.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResourcesRecursively(true); IIdType oid1; { @@ -1395,8 +1395,8 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldResolveAFourLinkChainWhereTheFirstReferenceAndTheLastReferenceAreContained() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); - myModelConfig.setIndexOnContainedResourcesRecursively(true); + myStorageSettings.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResourcesRecursively(true); IIdType oid1; { @@ -1440,8 +1440,8 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldResolveAFourLinkChainWhereAllReferencesAreContained() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); - myModelConfig.setIndexOnContainedResourcesRecursively(true); + myStorageSettings.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResourcesRecursively(true); IIdType oid1; { @@ -1489,8 +1489,8 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { public void testShouldThrowAnExceptionForAFiveLinkChain() throws Exception { // setup - myModelConfig.setIndexOnContainedResources(true); - myModelConfig.setIndexOnContainedResourcesRecursively(true); + myStorageSettings.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResourcesRecursively(true); String url = "/Observation?subject.organization.partof.partof.name=HealthCo"; @@ -1514,14 +1514,14 @@ public class ChainingR4SearchTest extends BaseJpaR4Test { // With indexing of contained resources turned on, we take the UNION of several subselects that handle the different patterns of containment // Keeping in mind that the number of clauses is one greater than the number of UNION keywords, // this increases as the chain grows longer according to the Fibonacci sequence: (2, 3, 5, 8, 13) - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); countUnionStatementsInGeneratedQuery("/Observation?patient.name=Smith", 1); countUnionStatementsInGeneratedQuery("/Observation?patient.organization.name=Smith", 2); countUnionStatementsInGeneratedQuery("/Observation?patient.organization.partof.name=Smith", 4); // With recursive indexing of contained resources turned on, even more containment patterns are considered // This increases as the chain grows longer as powers of 2: (2, 4, 8, 16, 32) - myModelConfig.setIndexOnContainedResourcesRecursively(true); + myStorageSettings.setIndexOnContainedResourcesRecursively(true); countUnionStatementsInGeneratedQuery("/Observation?patient.name=Smith", 1); countUnionStatementsInGeneratedQuery("/Observation?patient.organization.name=Smith", 3); countUnionStatementsInGeneratedQuery("/Observation?patient.organization.partof.name=Smith", 7); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/ConsentEventsDaoR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/ConsentEventsDaoR4Test.java index e5b741287ef..1bd202ff9b6 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/ConsentEventsDaoR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/ConsentEventsDaoR4Test.java @@ -4,7 +4,7 @@ import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor; import ca.uhn.fhir.interceptor.api.IPointcut; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.entity.Search; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.test.config.TestR4Config; @@ -59,8 +59,8 @@ public class ConsentEventsDaoR4Test extends BaseJpaR4SystemTest { @AfterEach public void after() { - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); } @BeforeEach @@ -70,7 +70,7 @@ public class ConsentEventsDaoR4Test extends BaseJpaR4SystemTest { when(mySrd.getServer()).thenReturn(restfulServer); - myDaoConfig.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190)); + myStorageSettings.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190)); } @Test @@ -178,7 +178,7 @@ public class ConsentEventsDaoR4Test extends BaseJpaR4SystemTest { @Test public void testSearchAndBlockSomeOnRevIncludes() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); create50Observations(); @@ -204,7 +204,7 @@ public class ConsentEventsDaoR4Test extends BaseJpaR4SystemTest { @Test public void testSearchAndBlockSomeOnRevIncludes_LoadSynchronous() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); create50Observations(); AtomicInteger hitCount = new AtomicInteger(0); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoCreatePlaceholdersR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoCreatePlaceholdersR4Test.java index 295fb8f1a56..9a244590182 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoCreatePlaceholdersR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoCreatePlaceholdersR4Test.java @@ -1,14 +1,13 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.ResourceTable; -import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.test.BaseJpaR4Test; import ca.uhn.fhir.rest.api.server.IBundleProvider; +import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.rest.param.ReferenceParam; import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; @@ -55,11 +54,11 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { @AfterEach public final void afterResetDao() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(new DaoConfig().isAutoCreatePlaceholderReferenceTargets()); - myDaoConfig.setResourceClientIdStrategy(new DaoConfig().getResourceClientIdStrategy()); - myDaoConfig.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(new DaoConfig().isPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets()); - myDaoConfig.setBundleTypesAllowedForStorage(new DaoConfig().getBundleTypesAllowedForStorage()); - myModelConfig.setAutoVersionReferenceAtPaths(new ModelConfig().getAutoVersionReferenceAtPaths()); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(new JpaStorageSettings().isAutoCreatePlaceholderReferenceTargets()); + myStorageSettings.setResourceClientIdStrategy(new JpaStorageSettings().getResourceClientIdStrategy()); + myStorageSettings.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(new JpaStorageSettings().isPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets()); + myStorageSettings.setBundleTypesAllowedForStorage(new JpaStorageSettings().getBundleTypesAllowedForStorage()); + myStorageSettings.setAutoVersionReferenceAtPaths(new JpaStorageSettings().getAutoVersionReferenceAtPaths()); } @Test @@ -77,8 +76,8 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { @Test public void testCreateWithBadReferenceIsPermitted() { - assertFalse(myDaoConfig.isAutoCreatePlaceholderReferenceTargets()); - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); + assertFalse(myStorageSettings.isAutoCreatePlaceholderReferenceTargets()); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); Observation o = new Observation(); o.setStatus(ObservationStatus.FINAL); @@ -88,7 +87,7 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { @Test public void testCreateWithMultiplePlaceholders() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); Task task = new Task(); task.addNote().setText("A note"); @@ -128,8 +127,8 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { @Test public void testUpdateWithBadReferenceIsPermittedAlphanumeric() { - assertFalse(myDaoConfig.isAutoCreatePlaceholderReferenceTargets()); - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); + assertFalse(myStorageSettings.isAutoCreatePlaceholderReferenceTargets()); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); Observation o = new Observation(); o.setStatus(ObservationStatus.FINAL); @@ -154,9 +153,9 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { @Test public void testUpdateWithBadReferenceIsPermittedNumeric() { - assertFalse(myDaoConfig.isAutoCreatePlaceholderReferenceTargets()); - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); - myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ANY); + assertFalse(myStorageSettings.isAutoCreatePlaceholderReferenceTargets()); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.ANY); myCaptureQueriesListener.clear(); @@ -166,8 +165,8 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { myCaptureQueriesListener.logAllQueries(); - runInTransaction(()->{ - ResourceTable entity = myResourceTableDao.findById(id.getIdPartAsLong()).orElseThrow(()->new IllegalArgumentException()); + runInTransaction(() -> { + ResourceTable entity = myResourceTableDao.findById(id.getIdPartAsLong()).orElseThrow(() -> new IllegalArgumentException()); assertEquals(1, entity.getVersion()); }); @@ -184,8 +183,8 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { o.getSubject().setReference("Patient/999999999999999"); myObservationDao.update(o, mySrd); - runInTransaction(()->{ - ResourceTable entity = myResourceTableDao.findById(id.getIdPartAsLong()).orElseThrow(()->new IllegalArgumentException()); + runInTransaction(() -> { + ResourceTable entity = myResourceTableDao.findById(id.getIdPartAsLong()).orElseThrow(() -> new IllegalArgumentException()); assertEquals(2, entity.getVersion()); }); @@ -196,12 +195,12 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { map.add("_id", new TokenParam("999999999999999")); IBundleProvider outcome = myPatientDao.search(map); assertEquals(1, outcome.size().intValue()); - assertEquals("Patient/999999999999999", outcome.getResources(0,1).get(0).getIdElement().toUnqualifiedVersionless().getValue()); + assertEquals("Patient/999999999999999", outcome.getResources(0, 1).get(0).getIdElement().toUnqualifiedVersionless().getValue()); } @Test public void testCreatePlaceholderExtension_WithUpdateToTarget() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); // Create an Observation that references a Patient Observation obsToCreate = new Observation(); @@ -245,9 +244,9 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { @Test public void testCreatePlaceholderWithMatchUrl_IdentifierNotCopied() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); - myDaoConfig.setAllowInlineMatchUrlReferences(true); - myDaoConfig.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(false); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(false); Observation obsToCreate = new Observation(); obsToCreate.setStatus(ObservationStatus.FINAL); @@ -268,13 +267,13 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { // IF the inline match URL does include an identifier // AND the reference does not include an identifier // AND a placeholder reference target is to be created - // DO use the value of the inline match URL's identifier to populate an identifier in the placeholder + // DO use the value of the inline match URL's identifier to populate an identifier in the placeholder @Test public void testCreatePlaceholderWithMatchUrl_NoReferenceDefined() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); - myDaoConfig.setAllowInlineMatchUrlReferences(true); - myDaoConfig.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(true); /* * Create an Observation that references a Patient @@ -316,9 +315,9 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { // DO use the value of the reference's identifier to populate an identifier in the placeholder @Test public void testCreatePlaceholderReferenceWhereInlineMatchUrlDoesNotContainIdentifierButSubjectReferenceDoes() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); - myDaoConfig.setAllowInlineMatchUrlReferences(true); - myDaoConfig.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(true); /* * Create an Observation that references a Patient @@ -362,9 +361,9 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { // DO use only the value of the reference's identifier to populate an identifier in the placeholder @Test public void testCreatePlaceholderWithMatchingInlineAndSubjectReferenceIdentifiersCreatesOnlyOne() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); - myDaoConfig.setAllowInlineMatchUrlReferences(true); - myDaoConfig.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(true); /* * Create an Observation that references a Patient @@ -409,9 +408,9 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { // DO use both the value of the inline match URL's identifier and the value of the reference's identifier to populate two identifiers in the placeholder @Test public void testCreatePlaceholderWithMisMatchedIdentifiers_BothIdentifiersCopied() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); - myDaoConfig.setAllowInlineMatchUrlReferences(true); - myDaoConfig.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(true); /* * Create an Observation that references a Patient @@ -473,8 +472,8 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { @Test public void testCreatePlaceholderWithMatchUrl_IdentifierCopiedByDefault_WithUpdateToTarget() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); /* * Create an Observation that references a Patient @@ -523,8 +522,8 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { @Test public void testCreatePlaceholderWithMatchUrl_IdentifierCopiedByDefault_NotPreExisting() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Observation obsToCreate = new Observation(); obsToCreate.setStatus(ObservationStatus.FINAL); @@ -544,9 +543,9 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { @Test public void testCreatePlaceholderWithMatchUrl_IdentifierNotCopiedBecauseNoFieldMatches() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); - myDaoConfig.setAllowInlineMatchUrlReferences(true); - myDaoConfig.setBundleTypesAllowedForStorage(Sets.newHashSet("")); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setBundleTypesAllowedForStorage(Sets.newHashSet("")); AuditEvent eventToCreate = new AuditEvent(); Reference what = eventToCreate.addEntity().getWhat(); @@ -561,8 +560,8 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { @Test public void testCreatePlaceholderWithMatchUrl_PreExisting() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Patient patient = new Patient(); patient.setId("ABC"); @@ -581,7 +580,7 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { @Test public void testAutocreatePlaceholderTest() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); Observation obs = new Observation(); obs.setId("Observation/DEF"); @@ -600,8 +599,8 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { @Test public void testAutocreatePlaceholderWithTargetExistingAlreadyTest() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); - myModelConfig.setAutoVersionReferenceAtPaths("Observation.subject"); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAutoVersionReferenceAtPaths("Observation.subject"); String patientId = "Patient/RED"; @@ -638,8 +637,8 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { */ @Test public void testAutocreatePlaceholderWithExistingTargetWithServerAssignedIdTest() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); - myModelConfig.setAutoVersionReferenceAtPaths("Observation.subject"); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAutoVersionReferenceAtPaths("Observation.subject"); // create Patient patient = new Patient(); @@ -670,10 +669,10 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { @Test public void testMultipleVersionedReferencesToAutocreatedPlaceholder() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); HashSet refPaths = new HashSet<>(); refPaths.add("Observation.subject"); - myModelConfig.setAutoVersionReferenceAtPaths(refPaths); + myStorageSettings.setAutoVersionReferenceAtPaths(refPaths); Observation obs1 = new Observation(); @@ -696,7 +695,7 @@ public class FhirResourceDaoCreatePlaceholdersR4Test extends BaseJpaR4Test { @Test public void testMultipleReferencesToAutocreatedPlaceholder() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); Observation obs1 = new Observation(); obs1.setId("Observation/DEF1"); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4CacheWarmingTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4CacheWarmingTest.java index da591c5d757..ab769402ac4 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4CacheWarmingTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4CacheWarmingTest.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.WarmCacheEntry; import ca.uhn.fhir.jpa.search.PersistedJpaBundleProvider; import ca.uhn.fhir.jpa.search.cache.SearchCacheStatusEnum; @@ -28,9 +28,9 @@ public class FhirResourceDaoR4CacheWarmingTest extends BaseJpaR4Test { @AfterEach public void afterResetDao() { - myDaoConfig.setResourceServerIdStrategy(new DaoConfig().getResourceServerIdStrategy()); + myStorageSettings.setResourceServerIdStrategy(new JpaStorageSettings().getResourceServerIdStrategy()); - myDaoConfig.setWarmCacheEntries(new ArrayList<>()); + myStorageSettings.setWarmCacheEntries(new ArrayList<>()); CacheWarmingSvcImpl cacheWarmingSvc = (CacheWarmingSvcImpl) myCacheWarmingSvc; cacheWarmingSvc.initCacheMap(); } @@ -40,8 +40,8 @@ public class FhirResourceDaoR4CacheWarmingTest extends BaseJpaR4Test { public void testInvalidCacheEntries() { CacheWarmingSvcImpl cacheWarmingSvc = (CacheWarmingSvcImpl) myCacheWarmingSvc; - myDaoConfig.setWarmCacheEntries(new ArrayList<>()); - myDaoConfig.getWarmCacheEntries().add( + myStorageSettings.setWarmCacheEntries(new ArrayList<>()); + myStorageSettings.getWarmCacheEntries().add( new WarmCacheEntry() .setPeriodMillis(10) .setUrl("BadResource?name=smith") @@ -53,8 +53,8 @@ public class FhirResourceDaoR4CacheWarmingTest extends BaseJpaR4Test { assertEquals(Msg.code(1684) + "Unknown resource name \"BadResource\" (this name is not known in FHIR version \"R4\")", e.getMessage()); } - myDaoConfig.setWarmCacheEntries(new ArrayList<>()); - myDaoConfig.getWarmCacheEntries().add( + myStorageSettings.setWarmCacheEntries(new ArrayList<>()); + myStorageSettings.getWarmCacheEntries().add( new WarmCacheEntry() .setPeriodMillis(10) .setUrl("foo/Patient") @@ -71,8 +71,8 @@ public class FhirResourceDaoR4CacheWarmingTest extends BaseJpaR4Test { @Test public void testKeepCacheWarm() throws InterruptedException { - myDaoConfig.setWarmCacheEntries(new ArrayList<>()); - myDaoConfig.getWarmCacheEntries().add( + myStorageSettings.setWarmCacheEntries(new ArrayList<>()); + myStorageSettings.getWarmCacheEntries().add( new WarmCacheEntry() .setPeriodMillis(10) .setUrl("Patient?name=smith") diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ComboUniqueParamIT.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ComboUniqueParamIT.java index 732a621e262..723d6c402ed 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ComboUniqueParamIT.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ComboUniqueParamIT.java @@ -10,10 +10,8 @@ import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.jpa.batch.models.Batch2JobStartResponse; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedComboStringUnique; import ca.uhn.fhir.jpa.model.entity.ResourceTable; -import ca.uhn.fhir.jpa.search.reindex.ResourceReindexingSvcImpl; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.util.JpaParamUtil; -import ca.uhn.fhir.jpa.util.SpringObjectCaster; import ca.uhn.fhir.rest.api.server.IBundleProvider; import ca.uhn.fhir.rest.param.DateParam; import ca.uhn.fhir.rest.param.ReferenceParam; @@ -41,7 +39,6 @@ import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.SearchParameter; import org.hl7.fhir.r4.model.ServiceRequest; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.TransactionStatus; @@ -379,7 +376,7 @@ public class FhirResourceDaoR4ComboUniqueParamIT extends BaseComboParamsR4Test { @Test public void testDoubleMatchingOnAnd_Search() { - myDaoConfig.setAdvancedHSearchIndexing(false); + myStorageSettings.setAdvancedHSearchIndexing(false); createUniqueIndexPatientIdentifier(); Patient pt = new Patient(); @@ -678,8 +675,8 @@ public class FhirResourceDaoR4ComboUniqueParamIT extends BaseComboParamsR4Test { */ @Test public void testDuplicateUniqueValuesAreReIndexed() { - myDaoConfig.setSchedulingDisabled(true); - myDaoConfig.setReindexThreadCount(1); + myStorageSettings.setSchedulingDisabled(true); + myStorageSettings.setReindexThreadCount(1); List uniqueSearchParams = mySearchParamRegistry.getActiveComboSearchParams("Observation"); assertEquals(0, uniqueSearchParams.size()); @@ -740,7 +737,7 @@ public class FhirResourceDaoR4ComboUniqueParamIT extends BaseComboParamsR4Test { @Test public void testDuplicateUniqueValuesAreRejectedWithChecking_TestingDisabled() { - myDaoConfig.setUniqueIndexesCheckedBeforeSave(false); + myStorageSettings.setUniqueIndexesCheckedBeforeSave(false); createUniqueBirthdateAndGenderSps(); @@ -1060,7 +1057,7 @@ public class FhirResourceDaoR4ComboUniqueParamIT extends BaseComboParamsR4Test { @Test public void testSearchSynchronousUsingUniqueComposite() { - myDaoConfig.setAdvancedHSearchIndexing(false); + myStorageSettings.setAdvancedHSearchIndexing(false); createUniqueBirthdateAndGenderSps(); Patient pt1 = new Patient(); @@ -1203,7 +1200,7 @@ public class FhirResourceDaoR4ComboUniqueParamIT extends BaseComboParamsR4Test { @Test public void testUniqueValuesAreIndexed_Reference_UsingModifierSyntax() { - myDaoConfig.setAdvancedHSearchIndexing(false); + myStorageSettings.setAdvancedHSearchIndexing(false); createUniqueNameAndManagingOrganizationSps(); Organization org = new Organization(); @@ -1562,7 +1559,7 @@ public class FhirResourceDaoR4ComboUniqueParamIT extends BaseComboParamsR4Test { @Test public void testReplaceOneWithAnother() { - myDaoConfig.setAdvancedHSearchIndexing(false); + myStorageSettings.setAdvancedHSearchIndexing(false); createUniqueBirthdateAndGenderSps(); Patient pt1 = new Patient(); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ConcurrentWriteTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ConcurrentWriteTest.java index d368ddf7db5..0690929fc03 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ConcurrentWriteTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ConcurrentWriteTest.java @@ -87,7 +87,7 @@ public class FhirResourceDaoR4ConcurrentWriteTest extends BaseJpaR4Test { @Test public void testTransactionCreates_NoGuard() { - myDaoConfig.setMatchUrlCache(true); + myStorageSettings.setMatchUrlCache(true); AtomicInteger passCounter = new AtomicInteger(0); AtomicInteger fuzzCounter = new AtomicInteger(0); @@ -211,7 +211,7 @@ public class FhirResourceDaoR4ConcurrentWriteTest extends BaseJpaR4Test { @Test public void testTransactionCreates_WithConcurrencySemaphore_DontLockOnCachedMatchUrlsForConditionalCreate() throws ExecutionException, InterruptedException { - myDaoConfig.setMatchUrlCacheEnabled(true); + myStorageSettings.setMatchUrlCacheEnabled(true); myInterceptorRegistry.registerInterceptor(myConcurrencySemaphoreInterceptor); myConcurrencySemaphoreInterceptor.setLogWaits(true); @@ -765,7 +765,7 @@ public class FhirResourceDaoR4ConcurrentWriteTest extends BaseJpaR4Test { @Test public void testTransactionWithCreateClientAssignedIdAndReferenceToThatId() { myInterceptorRegistry.registerInterceptor(myRetryInterceptor); - myDaoConfig.setDeleteEnabled(false); + myStorageSettings.setDeleteEnabled(false); ServletRequestDetails srd = mock(ServletRequestDetails.class); setupRetryBehaviour(srd); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ContainedTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ContainedTest.java index 74755ada137..e4da612e69b 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ContainedTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ContainedTest.java @@ -39,12 +39,12 @@ public class FhirResourceDaoR4ContainedTest extends BaseJpaR4Test { @BeforeEach public void before() throws Exception { - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); } @AfterEach public void after() throws Exception { - myModelConfig.setIndexOnContainedResources(false); + myStorageSettings.setIndexOnContainedResources(false); } @Test diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4CreateTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4CreateTest.java index e06a51b6bbf..c2103a11fce 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4CreateTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4CreateTest.java @@ -1,9 +1,8 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; import ca.uhn.fhir.jpa.model.entity.ResourceHistoryTable; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantity; @@ -79,13 +78,13 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @AfterEach public void afterResetDao() { - myDaoConfig.setResourceServerIdStrategy(new DaoConfig().getResourceServerIdStrategy()); - myDaoConfig.setResourceClientIdStrategy(new DaoConfig().getResourceClientIdStrategy()); - myDaoConfig.setDefaultSearchParamsCanBeOverridden(new DaoConfig().isDefaultSearchParamsCanBeOverridden()); - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); - myModelConfig.setIndexOnContainedResources(new ModelConfig().isIndexOnContainedResources()); - myModelConfig.setIndexOnContainedResourcesRecursively(new ModelConfig().isIndexOnContainedResourcesRecursively()); - myDaoConfig.setInlineResourceTextBelowSize(new DaoConfig().getInlineResourceTextBelowSize()); + myStorageSettings.setResourceServerIdStrategy(new JpaStorageSettings().getResourceServerIdStrategy()); + myStorageSettings.setResourceClientIdStrategy(new JpaStorageSettings().getResourceClientIdStrategy()); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(new JpaStorageSettings().isDefaultSearchParamsCanBeOverridden()); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); + myStorageSettings.setIndexOnContainedResources(new JpaStorageSettings().isIndexOnContainedResources()); + myStorageSettings.setIndexOnContainedResourcesRecursively(new JpaStorageSettings().isIndexOnContainedResourcesRecursively()); + myStorageSettings.setInlineResourceTextBelowSize(new JpaStorageSettings().getInlineResourceTextBelowSize()); } @@ -117,7 +116,7 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateLinkCreatesAppropriatePaths_ContainedResource() { - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); Patient p = new Patient(); p.setId("Patient/A"); @@ -147,8 +146,8 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateLinkCreatesAppropriatePaths_ContainedResourceRecursive() { - myModelConfig.setIndexOnContainedResources(true); - myModelConfig.setIndexOnContainedResourcesRecursively(true); + myStorageSettings.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResourcesRecursively(true); Patient p = new Patient(); p.setId("pat"); @@ -179,8 +178,8 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateLinkCreatesAppropriatePaths_ContainedResourceRecursive_DoesNotLoop() { - myModelConfig.setIndexOnContainedResources(true); - myModelConfig.setIndexOnContainedResourcesRecursively(true); + myStorageSettings.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResourcesRecursively(true); Organization org1 = new Organization(); org1.setId("org1"); @@ -229,8 +228,8 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateLinkCreatesAppropriatePaths_ContainedResourceRecursive_ToOutboundReference() { - myModelConfig.setIndexOnContainedResources(true); - myModelConfig.setIndexOnContainedResourcesRecursively(true); + myStorageSettings.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResourcesRecursively(true); Organization org = new Organization(); org.setId("Organization/ABC"); @@ -265,8 +264,8 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateLinkCreatesAppropriatePaths_ContainedResourceRecursive_ToOutboundReference_NoLoops() { - myModelConfig.setIndexOnContainedResources(true); - myModelConfig.setIndexOnContainedResourcesRecursively(true); + myStorageSettings.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResourcesRecursively(true); Organization org = new Organization(); org.setId("Organization/ABC"); @@ -396,7 +395,7 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateWithUuidServerResourceStrategy() { - myDaoConfig.setResourceServerIdStrategy(DaoConfig.IdStrategyEnum.UUID); + myStorageSettings.setResourceServerIdStrategy(JpaStorageSettings.IdStrategyEnum.UUID); Patient p = new Patient(); p.addName().setFamily("FAM"); @@ -411,8 +410,8 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateWithUuidServerResourceStrategy_ClientIdNotAllowed() { - myDaoConfig.setResourceServerIdStrategy(DaoConfig.IdStrategyEnum.UUID); - myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.NOT_ALLOWED); + myStorageSettings.setResourceServerIdStrategy(JpaStorageSettings.IdStrategyEnum.UUID); + myStorageSettings.setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.NOT_ALLOWED); Patient p = new Patient(); p.addName().setFamily("FAM"); @@ -427,8 +426,8 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateWithUuidServerResourceStrategy_AnyClientIdAllowed() { - myDaoConfig.setResourceServerIdStrategy(DaoConfig.IdStrategyEnum.UUID); - myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ANY); + myStorageSettings.setResourceServerIdStrategy(JpaStorageSettings.IdStrategyEnum.UUID); + myStorageSettings.setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.ANY); CodeSystem cs = new CodeSystem(); @@ -462,7 +461,7 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateWithClientAssignedIdDisallowed() { - myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.NOT_ALLOWED); + myStorageSettings.setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.NOT_ALLOWED); Patient p = new Patient(); p.setId("AAA"); @@ -477,8 +476,8 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateWithClientAssignedIdPureNumeric() { - myDaoConfig.setResourceServerIdStrategy(DaoConfig.IdStrategyEnum.SEQUENTIAL_NUMERIC); - myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ANY); + myStorageSettings.setResourceServerIdStrategy(JpaStorageSettings.IdStrategyEnum.SEQUENTIAL_NUMERIC); + myStorageSettings.setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.ANY); // Create a server assigned ID Patient p = new Patient(); @@ -532,8 +531,8 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateWithClientAssignedIdPureNumericServerIdUuid() { - myDaoConfig.setResourceServerIdStrategy(DaoConfig.IdStrategyEnum.UUID); - myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ANY); + myStorageSettings.setResourceServerIdStrategy(JpaStorageSettings.IdStrategyEnum.UUID); + myStorageSettings.setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.ANY); // Create a server assigned ID Patient p = new Patient(); @@ -589,8 +588,8 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateAndSearchWithUuidResourceStrategy() { - myDaoConfig.setResourceServerIdStrategy(DaoConfig.IdStrategyEnum.UUID); - myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ANY); + myStorageSettings.setResourceServerIdStrategy(JpaStorageSettings.IdStrategyEnum.UUID); + myStorageSettings.setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.ANY); StructureDefinition sd = new StructureDefinition(); sd.setUrl("http://foo.com"); @@ -622,7 +621,7 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testTransactionCreateWithUuidResourceStrategy() { - myDaoConfig.setResourceServerIdStrategy(DaoConfig.IdStrategyEnum.UUID); + myStorageSettings.setResourceServerIdStrategy(JpaStorageSettings.IdStrategyEnum.UUID); Organization org = new Organization(); org.setId(IdType.newRandomUuid()); @@ -689,7 +688,7 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testOverrideBuiltInSearchParamFailsIfDisabled() { - myModelConfig.setDefaultSearchParamsCanBeOverridden(false); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(false); SearchParameter sp = new SearchParameter(); sp.setId("SearchParameter/patient-birthdate"); @@ -710,7 +709,7 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateWithNormalizedQuantitySearchSupported_AlreadyCanonicalUnit() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Observation obs = new Observation(); obs.setStatus(Observation.ObservationStatus.FINAL); Quantity q = new Quantity(); @@ -750,7 +749,7 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateWithNormalizedQuantitySearchSupported_SmallerThanCanonicalUnit() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Observation obs = new Observation(); obs.setStatus(Observation.ObservationStatus.FINAL); Quantity q = new Quantity(); @@ -827,7 +826,7 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateWithNormalizedQuantitySearchSupported_SmallerThanCanonicalUnit2() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Observation obs = new Observation(); obs.setStatus(Observation.ObservationStatus.FINAL); Quantity q = new Quantity(); @@ -879,7 +878,7 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateWithNormalizedQuantitySearchSupported_LargerThanCanonicalUnit() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Observation obs = new Observation(); obs.setStatus(Observation.ObservationStatus.FINAL); Quantity q = new Quantity(); @@ -919,7 +918,7 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateWithNormalizedQuantitySearchSupported_NonCanonicalUnit() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Observation obs = new Observation(); obs.setStatus(Observation.ObservationStatus.FINAL); Quantity q = new Quantity(); @@ -966,7 +965,7 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateWithNormalizedQuantityStorageSupported_SmallerThanCanonicalUnit() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_STORAGE_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_STORAGE_SUPPORTED); Observation obs = new Observation(); obs.setStatus(Observation.ObservationStatus.FINAL); Quantity q = new Quantity(); @@ -1099,7 +1098,7 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test { @Test public void testCreateWithNormalizedQuantitySearchNotSupported_SmallerThanCanonicalUnit() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); Observation obs = new Observation(); obs.setStatus(Observation.ObservationStatus.FINAL); Quantity q = new Quantity(); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4DeleteTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4DeleteTest.java index 36dd07e6b05..447a298c3cb 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4DeleteTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4DeleteTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceHistoryTable; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.test.BaseJpaR4Test; @@ -28,7 +28,7 @@ public class FhirResourceDaoR4DeleteTest extends BaseJpaR4Test { @AfterEach public void after() { - myDaoConfig.setDeleteEnabled(new DaoConfig().isDeleteEnabled()); + myStorageSettings.setDeleteEnabled(new JpaStorageSettings().isDeleteEnabled()); } @Test @@ -79,7 +79,7 @@ public class FhirResourceDaoR4DeleteTest extends BaseJpaR4Test { @Test public void testDeleteDisabled() { - myDaoConfig.setDeleteEnabled(false); + myStorageSettings.setDeleteEnabled(false); Patient p = new Patient(); p.setActive(true); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ExternalReferenceTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ExternalReferenceTest.java index 89099d3d5e8..e37ccc68aa3 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ExternalReferenceTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ExternalReferenceTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.test.BaseJpaR4Test; import ca.uhn.fhir.rest.param.ReferenceParam; @@ -26,15 +26,15 @@ public class FhirResourceDaoR4ExternalReferenceTest extends BaseJpaR4Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @BeforeEach @AfterEach public void resetDefaultBehaviour() { // Reset to default - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setTreatBaseUrlsAsLocal(null); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + myStorageSettings.setTreatBaseUrlsAsLocal(null); } @Test @@ -73,7 +73,7 @@ public class FhirResourceDaoR4ExternalReferenceTest extends BaseJpaR4Test { org.setName("Org Name"); myOrganizationDao.update(org, mySrd); - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); Patient p = new Patient(); p.getManagingOrganization().setReference("http://example.com/base/Organization/FOO"); @@ -98,7 +98,7 @@ public class FhirResourceDaoR4ExternalReferenceTest extends BaseJpaR4Test { Set urls = new HashSet(); urls.add("http://example.com/base/"); - myDaoConfig.setTreatBaseUrlsAsLocal(urls); + myStorageSettings.setTreatBaseUrlsAsLocal(urls); Patient p = new Patient(); p.getManagingOrganization().setReference("http://example.com/base/Organization/FOO"); @@ -137,7 +137,7 @@ public class FhirResourceDaoR4ExternalReferenceTest extends BaseJpaR4Test { Set urls = new HashSet(); urls.add("http://example.com/base/"); - myDaoConfig.setTreatBaseUrlsAsLocal(urls); + myStorageSettings.setTreatBaseUrlsAsLocal(urls); Patient p = new Patient(); p.getManagingOrganization().setReference("http://example.com/base/Organization/FOO"); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4FilterTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4FilterTest.java index cc5c5f2cae6..c6d928004f7 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4FilterTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4FilterTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.data.IResourceHistoryProvenanceDao; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; @@ -58,12 +58,12 @@ public class FhirResourceDaoR4FilterTest extends BaseJpaR4Test { @AfterEach public void after() { - myDaoConfig.setFilterParameterEnabled(new DaoConfig().isFilterParameterEnabled()); + myStorageSettings.setFilterParameterEnabled(new JpaStorageSettings().isFilterParameterEnabled()); } @BeforeEach public void before() { - myDaoConfig.setFilterParameterEnabled(true); + myStorageSettings.setFilterParameterEnabled(true); } @Test @@ -190,7 +190,7 @@ public class FhirResourceDaoR4FilterTest extends BaseJpaR4Test { @Test public void testSourceComparatorEq() { - myDaoConfig.setStoreMetaSourceInformation(DaoConfig.StoreMetaSourceInformationEnum.SOURCE_URI_AND_REQUEST_ID); + myStorageSettings.setStoreMetaSourceInformation(JpaStorageSettings.StoreMetaSourceInformationEnum.SOURCE_URI_AND_REQUEST_ID); Patient p = new Patient(); p.getMeta().setSource("http://source"); @@ -222,7 +222,7 @@ public class FhirResourceDaoR4FilterTest extends BaseJpaR4Test { @Test public void testFilterDisabled() { - myDaoConfig.setFilterParameterEnabled(false); + myStorageSettings.setFilterParameterEnabled(false); SearchParameterMap map = new SearchParameterMap(); map.setLoadSynchronous(true); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4HistoryRewriteTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4HistoryRewriteTest.java index dbd0812885f..98d6761fa83 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4HistoryRewriteTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4HistoryRewriteTest.java @@ -36,12 +36,12 @@ public class FhirResourceDaoR4HistoryRewriteTest extends BaseJpaR4Test { @BeforeEach public void setUp() { - myDaoConfig.setUpdateWithHistoryRewriteEnabled(true); + myStorageSettings.setUpdateWithHistoryRewriteEnabled(true); } @AfterEach public void tearDown() { - myDaoConfig.setUpdateWithHistoryRewriteEnabled(false); + myStorageSettings.setUpdateWithHistoryRewriteEnabled(false); when(mySrd.getHeader(eq(Constants.HEADER_REWRITE_HISTORY))).thenReturn(""); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InlineResourceModeTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InlineResourceModeTest.java index 94a7680b4e1..368519202f8 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InlineResourceModeTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InlineResourceModeTest.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.dao.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; import ca.uhn.fhir.jpa.model.entity.ResourceHistoryTable; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; @@ -24,12 +24,12 @@ public class FhirResourceDaoR4InlineResourceModeTest extends BaseJpaR4Test { @BeforeEach public void beforeSetDao() { - myDaoConfig.setInlineResourceTextBelowSize(5000); + myStorageSettings.setInlineResourceTextBelowSize(5000); } @AfterEach public void afterResetDao() { - myDaoConfig.setInlineResourceTextBelowSize(new DaoConfig().getInlineResourceTextBelowSize()); + myStorageSettings.setInlineResourceTextBelowSize(new JpaStorageSettings().getInlineResourceTextBelowSize()); } @Test diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InterceptorTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InterceptorTest.java index 2b881a7a20f..7c1f82b60c3 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InterceptorTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InterceptorTest.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.interceptor.api.Hook; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.DeleteMethodOutcome; import ca.uhn.fhir.jpa.test.BaseJpaR4Test; import ca.uhn.fhir.rest.api.server.RequestDetails; @@ -49,7 +49,7 @@ public class FhirResourceDaoR4InterceptorTest extends BaseJpaR4Test { @AfterEach public void after() { - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); if (myServerOperationInterceptor != null) { myInterceptorRegistry.unregisterInterceptor(myServerOperationInterceptor); } @@ -231,7 +231,7 @@ public class FhirResourceDaoR4InterceptorTest extends BaseJpaR4Test { public void testRequestOperationDeleteMulti() { IServerOperationInterceptor interceptor = registerServerOperationInterceptor(); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); Patient p = new Patient(); p.addName().setFamily("PATIENT"); @@ -339,7 +339,7 @@ public class FhirResourceDaoR4InterceptorTest extends BaseJpaR4Test { public void testRequestOperationTransactionDeleteMulti() { IServerOperationInterceptor interceptor = registerServerOperationInterceptor(); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); Patient p = new Patient(); p.addName().setFamily("PATIENT"); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InvalidSubscriptionTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InvalidSubscriptionTest.java index 09e40087bf4..4be29887771 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InvalidSubscriptionTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4InvalidSubscriptionTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; import ca.uhn.fhir.jpa.test.BaseJpaR4Test; import ca.uhn.fhir.jpa.test.util.SubscriptionTestUtil; @@ -23,7 +23,7 @@ public class FhirResourceDaoR4InvalidSubscriptionTest extends BaseJpaR4Test { @AfterEach public void afterResetDao() { - myDaoConfig.setResourceServerIdStrategy(new DaoConfig().getResourceServerIdStrategy()); + myStorageSettings.setResourceServerIdStrategy(new JpaStorageSettings().getResourceServerIdStrategy()); BaseHapiFhirDao.setValidationDisabledForUnitTest(false); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4QueryCountTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4QueryCountTest.java index a4648d633c7..a77ee156673 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4QueryCountTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4QueryCountTest.java @@ -2,15 +2,13 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.context.support.ValidationSupportContext; import ca.uhn.fhir.context.support.ValueSetExpansionOptions; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.HistoryCountModeEnum; import ca.uhn.fhir.jpa.entity.TermValueSet; import ca.uhn.fhir.jpa.entity.TermValueSetPreExpansionStatusEnum; import ca.uhn.fhir.jpa.model.entity.ForcedId; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.model.util.JpaConstants; -import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.jpa.search.PersistedJpaSearchFirstPageBundleProvider; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; @@ -19,7 +17,7 @@ import ca.uhn.fhir.jpa.util.SqlQuery; import ca.uhn.fhir.rest.api.RestOperationTypeEnum; import ca.uhn.fhir.rest.api.SortSpec; import ca.uhn.fhir.rest.api.server.IBundleProvider; -import ca.uhn.fhir.rest.param.HasParam; +import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.rest.param.ReferenceParam; import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.rest.server.SimpleBundleProvider; @@ -65,9 +63,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Date; -import java.util.HashSet; import java.util.List; -import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -88,20 +84,20 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @AfterEach public void afterResetDao() { - myDaoConfig.setResourceMetaCountHardLimit(new DaoConfig().getResourceMetaCountHardLimit()); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); - myDaoConfig.setDeleteEnabled(new DaoConfig().isDeleteEnabled()); - myDaoConfig.setMatchUrlCacheEnabled(new DaoConfig().isMatchUrlCacheEnabled()); - myDaoConfig.setHistoryCountMode(DaoConfig.DEFAULT_HISTORY_COUNT_MODE); - myDaoConfig.setMassIngestionMode(new DaoConfig().isMassIngestionMode()); - myModelConfig.setAutoVersionReferenceAtPaths(new ModelConfig().getAutoVersionReferenceAtPaths()); - myModelConfig.setRespectVersionsForSearchIncludes(new ModelConfig().isRespectVersionsForSearchIncludes()); + myStorageSettings.setResourceMetaCountHardLimit(new JpaStorageSettings().getResourceMetaCountHardLimit()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); + myStorageSettings.setDeleteEnabled(new JpaStorageSettings().isDeleteEnabled()); + myStorageSettings.setMatchUrlCacheEnabled(new JpaStorageSettings().isMatchUrlCacheEnabled()); + myStorageSettings.setHistoryCountMode(JpaStorageSettings.DEFAULT_HISTORY_COUNT_MODE); + myStorageSettings.setMassIngestionMode(new JpaStorageSettings().isMassIngestionMode()); + myStorageSettings.setAutoVersionReferenceAtPaths(new JpaStorageSettings().getAutoVersionReferenceAtPaths()); + myStorageSettings.setRespectVersionsForSearchIncludes(new JpaStorageSettings().isRespectVersionsForSearchIncludes()); myFhirContext.getParserOptions().setStripVersionsFromReferences(true); - myDaoConfig.setTagStorageMode(new DaoConfig().getTagStorageMode()); - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(new DaoConfig().isAutoCreatePlaceholderReferenceTargets()); - myDaoConfig.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(new DaoConfig().isPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets()); - myDaoConfig.setResourceClientIdStrategy(new DaoConfig().getResourceClientIdStrategy()); - myDaoConfig.setTagStorageMode(new DaoConfig().getTagStorageMode()); + myStorageSettings.setTagStorageMode(new JpaStorageSettings().getTagStorageMode()); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(new JpaStorageSettings().isAutoCreatePlaceholderReferenceTargets()); + myStorageSettings.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(new JpaStorageSettings().isPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets()); + myStorageSettings.setResourceClientIdStrategy(new JpaStorageSettings().getResourceClientIdStrategy()); + myStorageSettings.setTagStorageMode(new JpaStorageSettings().getTagStorageMode()); TermReadSvcImpl.setForceDisableHibernateSearchForUnitTest(false); } @@ -167,7 +163,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test } @Test - public void testUpdateGroup_withAddedReferences_willSucceed(){ + public void testUpdateGroup_withAddedReferences_willSucceed() { int initialPatientsCount = 30; int newPatientsCount = 5; int allPatientsCount = initialPatientsCount + newPatientsCount; @@ -177,12 +173,12 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test myCaptureQueriesListener.clear(); Group group = createGroup(patientList.subList(0, initialPatientsCount)); - assertQueryCount(31,0,4,0); + assertQueryCount(31, 0, 4, 0); myCaptureQueriesListener.clear(); group = updateGroup(group, patientList.subList(initialPatientsCount, allPatientsCount)); - assertQueryCount(10,1,2,0); + assertQueryCount(10, 1, 2, 0); assertEquals(allPatientsCount, group.getMember().size()); @@ -190,13 +186,13 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test } @Test - public void testUpdateGroup_NoChangesToReferences(){ + public void testUpdateGroup_NoChangesToReferences() { List patientList = createPatients(30); myCaptureQueriesListener.clear(); Group group = createGroup(patientList); - assertQueryCount(31,0,4,0); + assertQueryCount(31, 0, 4, 0); // Make a change to the group, but don't touch any references in it myCaptureQueriesListener.clear(); @@ -204,7 +200,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test group = updateGroup(group, Collections.emptyList()); myCaptureQueriesListener.logSelectQueries(); - assertQueryCount(5,1,2,0); + assertQueryCount(5, 1, 2, 0); assertEquals(30, group.getMember().size()); @@ -213,7 +209,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testUpdateWithChangesAndTags() { - myDaoConfig.setTagStorageMode(DaoConfig.TagStorageModeEnum.NON_VERSIONED); + myStorageSettings.setTagStorageMode(JpaStorageSettings.TagStorageModeEnum.NON_VERSIONED); IIdType id = runInTransaction(() -> { Patient p = new Patient(); @@ -222,7 +218,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test return myPatientDao.create(p).getId().toUnqualified(); }); - runInTransaction(()->{ + runInTransaction(() -> { assertEquals(1, myResourceTagDao.count()); }); @@ -345,7 +341,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testCreateWithClientAssignedId() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); runInTransaction(() -> { Patient p = new Patient(); @@ -382,8 +378,8 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testCreateWithServerAssignedId_AnyClientAssignedIdStrategy() { - myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ANY); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.ANY); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); myCaptureQueriesListener.clear(); @@ -433,8 +429,8 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testCreateWithClientAssignedId_AnyClientAssignedIdStrategy() { - myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ANY); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.ANY); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); runInTransaction(() -> { Patient p = new Patient(); @@ -519,8 +515,8 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testUpdateWithClientAssignedId_DeletesDisabled() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); - myDaoConfig.setDeleteEnabled(false); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); + myStorageSettings.setDeleteEnabled(false); runInTransaction(() -> { Patient p = new Patient(); @@ -572,7 +568,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testReferenceToForcedId() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); Patient patient = new Patient(); patient.setId("P"); @@ -618,8 +614,8 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testReferenceToForcedId_DeletesDisabled() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); - myDaoConfig.setDeleteEnabled(false); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); + myStorageSettings.setDeleteEnabled(false); Patient patient = new Patient(); patient.setId("P"); @@ -673,7 +669,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testHistory_Server() { - myDaoConfig.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); + myStorageSettings.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); runInTransaction(() -> { Patient p = new Patient(); @@ -731,7 +727,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test */ @Test public void testHistory_Server_WithTags() { - myDaoConfig.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); + myStorageSettings.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); runInTransaction(() -> { Patient p = new Patient(); @@ -797,7 +793,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test List foundIds = new ArrayList<>(); for (int i = 0; i < 170; i += 10) { List nextChunk = search.getResources(i, i + 10); - nextChunk.forEach(t->foundIds.add(t.getIdElement().toUnqualifiedVersionless().getValue())); + nextChunk.forEach(t -> foundIds.add(t.getIdElement().toUnqualifiedVersionless().getValue())); } ids.sort(new ComparableComparator<>()); @@ -821,7 +817,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test List foundIds = new ArrayList<>(); for (int i = 0; i < 170; i += 60) { List nextChunk = search.getResources(i, i + 60); - nextChunk.forEach(t->foundIds.add(t.getIdElement().toUnqualifiedVersionless().getValue())); + nextChunk.forEach(t -> foundIds.add(t.getIdElement().toUnqualifiedVersionless().getValue())); search = myPagingProvider.retrieveResultList(mySrd, search.getUuid()); } @@ -843,7 +839,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test List foundIds = new ArrayList<>(); for (int i = 0; i < 170; i += 60) { List nextChunk = search.getResources(i, i + 60); - nextChunk.forEach(t->foundIds.add(t.getIdElement().toUnqualifiedVersionless().getValue())); + nextChunk.forEach(t -> foundIds.add(t.getIdElement().toUnqualifiedVersionless().getValue())); } ids.sort(new ComparableComparator<>()); @@ -999,7 +995,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testSearchUsingForcedIdReference_DeletedDisabled() { - myDaoConfig.setDeleteEnabled(false); + myStorageSettings.setDeleteEnabled(false); Patient patient = new Patient(); patient.setId("P"); @@ -1140,7 +1136,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test assertEquals(3, myCaptureQueriesListener.getInsertQueriesForCurrentThread().size()); assertEquals(1, myCaptureQueriesListener.getUpdateQueriesForCurrentThread().size()); assertEquals(0, myCaptureQueriesListener.getDeleteQueriesForCurrentThread().size()); - runInTransaction(()->{ + runInTransaction(() -> { assertEquals(1, mySearchEntityDao.count()); assertEquals(3, mySearchIncludeEntityDao.count()); }); @@ -1225,11 +1221,11 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testTransactionWithMultipleCreates() { - myDaoConfig.setMassIngestionMode(true); - myDaoConfig.setMatchUrlCacheEnabled(true); - myDaoConfig.setDeleteEnabled(false); - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); - myDaoConfig.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(true); + myStorageSettings.setMassIngestionMode(true); + myStorageSettings.setMatchUrlCacheEnabled(true); + myStorageSettings.setDeleteEnabled(false); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(true); // First pass @@ -1292,11 +1288,11 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testTransactionWithMultipleCreates_PreExistingMatchUrl() { - myDaoConfig.setMassIngestionMode(true); - myDaoConfig.setMatchUrlCacheEnabled(true); - myDaoConfig.setDeleteEnabled(false); - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); - myDaoConfig.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(true); + myStorageSettings.setMassIngestionMode(true); + myStorageSettings.setMatchUrlCacheEnabled(true); + myStorageSettings.setDeleteEnabled(false); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(true); Practitioner pract = new Practitioner(); pract.addIdentifier().setSystem("foo").setValue("bar"); @@ -1435,7 +1431,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test /* * Third time with mass ingestion mode enabled */ - myDaoConfig.setMassIngestionMode(true); + myStorageSettings.setMassIngestionMode(true); myCaptureQueriesListener.clear(); outcome = mySystemDao.transaction(mySrd, input.get()); @@ -1518,7 +1514,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test /* * Third time with mass ingestion mode enabled */ - myDaoConfig.setMassIngestionMode(true); + myStorageSettings.setMassIngestionMode(true); myCaptureQueriesListener.clear(); outcome = mySystemDao.transaction(mySrd, input.get()); @@ -1535,10 +1531,10 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testTransactionWithMultipleInlineMatchUrls() { - myDaoConfig.setDeleteEnabled(false); - myDaoConfig.setMassIngestionMode(true); - myDaoConfig.setAllowInlineMatchUrlReferences(true); - myDaoConfig.setMatchUrlCacheEnabled(true); + myStorageSettings.setDeleteEnabled(false); + myStorageSettings.setMassIngestionMode(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setMatchUrlCacheEnabled(true); Location loc = new Location(); loc.setId("LOC"); @@ -1579,10 +1575,10 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testTransactionWithMultipleInlineMatchUrlsWithAuthentication() { - myDaoConfig.setDeleteEnabled(false); - myDaoConfig.setMassIngestionMode(true); - myDaoConfig.setAllowInlineMatchUrlReferences(true); - myDaoConfig.setMatchUrlCacheEnabled(true); + myStorageSettings.setDeleteEnabled(false); + myStorageSettings.setMassIngestionMode(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setMatchUrlCacheEnabled(true); Location loc = new Location(); loc.setId("LOC"); @@ -1630,10 +1626,10 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testTransactionWithMultipleForcedIdReferences() { - myDaoConfig.setDeleteEnabled(false); - myDaoConfig.setMassIngestionMode(true); - myDaoConfig.setAllowInlineMatchUrlReferences(true); - myDaoConfig.setMatchUrlCacheEnabled(true); + myStorageSettings.setDeleteEnabled(false); + myStorageSettings.setMassIngestionMode(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setMatchUrlCacheEnabled(true); Patient pt = new Patient(); pt.setId("ABC"); @@ -1684,10 +1680,10 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testTransactionWithMultipleNumericIdReferences() { - myDaoConfig.setDeleteEnabled(false); - myDaoConfig.setMassIngestionMode(true); - myDaoConfig.setAllowInlineMatchUrlReferences(true); - myDaoConfig.setMatchUrlCacheEnabled(true); + myStorageSettings.setDeleteEnabled(false); + myStorageSettings.setMassIngestionMode(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setMatchUrlCacheEnabled(true); Patient pt = new Patient(); pt.setActive(true); @@ -1812,8 +1808,8 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test /* * Third time with mass ingestion mode enabled */ - myDaoConfig.setMassIngestionMode(true); - myDaoConfig.setMatchUrlCacheEnabled(true); + myStorageSettings.setMassIngestionMode(true); + myStorageSettings.setMatchUrlCacheEnabled(true); myCaptureQueriesListener.clear(); outcome = mySystemDao.transaction(mySrd, input.get()); @@ -1845,7 +1841,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testTransactionWithConditionalCreate_MatchUrlCacheEnabled() { - myDaoConfig.setMatchUrlCacheEnabled(true); + myStorageSettings.setMatchUrlCacheEnabled(true); Supplier bundleCreator = () -> { BundleBuilder bb = new BundleBuilder(myFhirContext); @@ -1974,7 +1970,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testTransactionWithCreateClientAssignedIdAndReference() { - myDaoConfig.setDeleteEnabled(false); + myStorageSettings.setDeleteEnabled(false); Bundle input = new Bundle(); @@ -2119,7 +2115,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testTransactionWithMultiplePreExistingReferences_ForcedId() { - myDaoConfig.setDeleteEnabled(true); + myStorageSettings.setDeleteEnabled(true); Patient patient = new Patient(); patient.setId("Patient/A"); @@ -2210,7 +2206,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testTransactionWithMultiplePreExistingReferences_Numeric() { - myDaoConfig.setDeleteEnabled(true); + myStorageSettings.setDeleteEnabled(true); Patient patient = new Patient(); patient.setActive(true); @@ -2299,7 +2295,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testTransactionWithMultiplePreExistingReferences_ForcedId_DeletesDisabled() { - myDaoConfig.setDeleteEnabled(false); + myStorageSettings.setDeleteEnabled(false); Patient patient = new Patient(); patient.setId("Patient/A"); @@ -2390,7 +2386,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testTransactionWithMultiplePreExistingReferences_Numeric_DeletesDisabled() { - myDaoConfig.setDeleteEnabled(false); + myStorageSettings.setDeleteEnabled(false); Patient patient = new Patient(); patient.setActive(true); @@ -2478,7 +2474,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testTransactionWithMultiplePreExistingReferences_IfNoneExist() { - myDaoConfig.setDeleteEnabled(true); + myStorageSettings.setDeleteEnabled(true); Patient patient = new Patient(); patient.setId("Patient/A"); @@ -2613,8 +2609,8 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testTransactionWithMultipleProfiles() { - myDaoConfig.setDeleteEnabled(true); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setDeleteEnabled(true); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); // Create transaction @@ -2680,7 +2676,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test ValueSet expansion = (ValueSet) myValidationSupport.expandValueSet(new ValidationSupportContext(myValidationSupport), new ValueSetExpansionOptions(), valueSet).getValueSet(); ourLog.debug(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(expansion)); assertEquals(7, expansion.getExpansion().getContains().size()); - assertEquals(1, expansion.getExpansion().getContains().stream().filter(t->t.getCode().equals("A")).findFirst().orElseThrow(()->new IllegalArgumentException()).getDesignation().size()); + assertEquals(1, expansion.getExpansion().getContains().stream().filter(t -> t.getCode().equals("A")).findFirst().orElseThrow(() -> new IllegalArgumentException()).getDesignation().size()); myCaptureQueriesListener.logSelectQueriesForCurrentThread(); assertEquals(5, myCaptureQueriesListener.countSelectQueries()); assertEquals(0, myCaptureQueriesListener.countDeleteQueries()); @@ -2694,7 +2690,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test expansion = (ValueSet) myValidationSupport.expandValueSet(new ValidationSupportContext(myValidationSupport), new ValueSetExpansionOptions(), valueSet).getValueSet(); ourLog.debug(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(expansion)); assertEquals(7, expansion.getExpansion().getContains().size()); - assertEquals(1, expansion.getExpansion().getContains().stream().filter(t->t.getCode().equals("A")).findFirst().orElseThrow(()->new IllegalArgumentException()).getDesignation().size()); + assertEquals(1, expansion.getExpansion().getContains().stream().filter(t -> t.getCode().equals("A")).findFirst().orElseThrow(() -> new IllegalArgumentException()).getDesignation().size()); myCaptureQueriesListener.logSelectQueriesForCurrentThread(); assertEquals(0, myCaptureQueriesListener.countSelectQueries()); assertEquals(0, myCaptureQueriesListener.countDeleteQueries()); @@ -2720,7 +2716,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test ValueSet expansion = (ValueSet) myValidationSupport.expandValueSet(new ValidationSupportContext(myValidationSupport), new ValueSetExpansionOptions(), valueSet).getValueSet(); ourLog.debug(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(expansion)); assertEquals(7, expansion.getExpansion().getContains().size()); - assertEquals(1, expansion.getExpansion().getContains().stream().filter(t->t.getCode().equals("A")).findFirst().orElseThrow(()->new IllegalArgumentException()).getDesignation().size()); + assertEquals(1, expansion.getExpansion().getContains().stream().filter(t -> t.getCode().equals("A")).findFirst().orElseThrow(() -> new IllegalArgumentException()).getDesignation().size()); myCaptureQueriesListener.logSelectQueriesForCurrentThread(); assertEquals(5, myCaptureQueriesListener.countSelectQueries()); assertEquals(0, myCaptureQueriesListener.countDeleteQueries()); @@ -2734,7 +2730,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test expansion = (ValueSet) myValidationSupport.expandValueSet(new ValidationSupportContext(myValidationSupport), new ValueSetExpansionOptions(), valueSet).getValueSet(); ourLog.debug(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(expansion)); assertEquals(7, expansion.getExpansion().getContains().size()); - assertEquals(1, expansion.getExpansion().getContains().stream().filter(t->t.getCode().equals("A")).findFirst().orElseThrow(()->new IllegalArgumentException()).getDesignation().size()); + assertEquals(1, expansion.getExpansion().getContains().stream().filter(t -> t.getCode().equals("A")).findFirst().orElseThrow(() -> new IllegalArgumentException()).getDesignation().size()); myCaptureQueriesListener.logSelectQueriesForCurrentThread(); assertEquals(0, myCaptureQueriesListener.countSelectQueries()); assertEquals(0, myCaptureQueriesListener.countDeleteQueries()); @@ -2749,7 +2745,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test createLocalCsAndVs(); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); - runInTransaction(()->{ + runInTransaction(() -> { Slice page = myTermValueSetDao.findByExpansionStatus(PageRequest.of(0, 10), TermValueSetPreExpansionStatusEnum.EXPANDED); assertEquals(1, page.getContent().size()); }); @@ -2764,7 +2760,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test ValueSet expansion = (ValueSet) myValidationSupport.expandValueSet(new ValidationSupportContext(myValidationSupport), new ValueSetExpansionOptions(), valueSet).getValueSet(); ourLog.debug(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(expansion)); assertEquals(7, expansion.getExpansion().getContains().size()); - assertEquals(1, expansion.getExpansion().getContains().stream().filter(t->t.getCode().equals("A")).findFirst().orElseThrow(()->new IllegalArgumentException()).getDesignation().size()); + assertEquals(1, expansion.getExpansion().getContains().stream().filter(t -> t.getCode().equals("A")).findFirst().orElseThrow(() -> new IllegalArgumentException()).getDesignation().size()); myCaptureQueriesListener.logSelectQueriesForCurrentThread(); assertEquals(3, myCaptureQueriesListener.countSelectQueries()); assertEquals(0, myCaptureQueriesListener.countDeleteQueries()); @@ -2778,7 +2774,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test expansion = (ValueSet) myValidationSupport.expandValueSet(new ValidationSupportContext(myValidationSupport), new ValueSetExpansionOptions(), valueSet).getValueSet(); ourLog.debug(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(expansion)); assertEquals(7, expansion.getExpansion().getContains().size()); - assertEquals(1, expansion.getExpansion().getContains().stream().filter(t->t.getCode().equals("A")).findFirst().orElseThrow(()->new IllegalArgumentException()).getDesignation().size()); + assertEquals(1, expansion.getExpansion().getContains().stream().filter(t -> t.getCode().equals("A")).findFirst().orElseThrow(() -> new IllegalArgumentException()).getDesignation().size()); myCaptureQueriesListener.logSelectQueriesForCurrentThread(); assertEquals(0, myCaptureQueriesListener.countSelectQueries()); assertEquals(0, myCaptureQueriesListener.countDeleteQueries()); @@ -2790,12 +2786,12 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testMassIngestionMode_TransactionWithChanges() { - myDaoConfig.setDeleteEnabled(false); - myDaoConfig.setMatchUrlCacheEnabled(true); - myDaoConfig.setMassIngestionMode(true); + myStorageSettings.setDeleteEnabled(false); + myStorageSettings.setMatchUrlCacheEnabled(true); + myStorageSettings.setMassIngestionMode(true); myFhirContext.getParserOptions().setStripVersionsFromReferences(false); - myModelConfig.setRespectVersionsForSearchIncludes(true); - myModelConfig.setAutoVersionReferenceAtPaths( + myStorageSettings.setRespectVersionsForSearchIncludes(true); + myStorageSettings.setAutoVersionReferenceAtPaths( "ExplanationOfBenefit.patient", "ExplanationOfBenefit.insurance.coverage" ); @@ -2854,13 +2850,13 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test @Test public void testMassIngestionMode_TransactionWithChanges_2() throws IOException { - myDaoConfig.setDeleteEnabled(false); - myDaoConfig.setMatchUrlCacheEnabled(true); - myDaoConfig.setMassIngestionMode(true); + myStorageSettings.setDeleteEnabled(false); + myStorageSettings.setMatchUrlCacheEnabled(true); + myStorageSettings.setMassIngestionMode(true); myFhirContext.getParserOptions().setStripVersionsFromReferences(false); - myModelConfig.setRespectVersionsForSearchIncludes(true); - myDaoConfig.setTagStorageMode(DaoConfig.TagStorageModeEnum.NON_VERSIONED); - myModelConfig.setAutoVersionReferenceAtPaths( + myStorageSettings.setRespectVersionsForSearchIncludes(true); + myStorageSettings.setTagStorageMode(JpaStorageSettings.TagStorageModeEnum.NON_VERSIONED); + myStorageSettings.setAutoVersionReferenceAtPaths( "ExplanationOfBenefit.patient", "ExplanationOfBenefit.insurance.coverage" ); @@ -2896,8 +2892,8 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test } @Test - public void testDeleteResource_WithMassIngestionMode_enabled(){ - myDaoConfig.setMassIngestionMode(true); + public void testDeleteResource_WithMassIngestionMode_enabled() { + myStorageSettings.setMassIngestionMode(true); // given Observation observation = new Observation() @@ -2912,10 +2908,10 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test myObservationDao.delete(idDt, mySrd); // then - assertQueryCount(3,1,1, 1); + assertQueryCount(3, 1, 1, 1); } - private void printQueryCount(){ + private void printQueryCount() { ourLog.info("\tselect: {}", myCaptureQueriesListener.getSelectQueriesForCurrentThread().size()); ourLog.info("\tupdate: {}", myCaptureQueriesListener.getUpdateQueriesForCurrentThread().size()); @@ -2924,7 +2920,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test } - private void assertQueryCount(int theExpectedSelectCount, int theExpectedUpdateCount, int theExpectedInsertCount, int theExpectedDeleteCount){ + private void assertQueryCount(int theExpectedSelectCount, int theExpectedUpdateCount, int theExpectedInsertCount, int theExpectedDeleteCount) { assertEquals(theExpectedSelectCount, myCaptureQueriesListener.getSelectQueriesForCurrentThread().size()); myCaptureQueriesListener.logUpdateQueriesForCurrentThread(); @@ -2964,7 +2960,7 @@ public class FhirResourceDaoR4QueryCountTest extends BaseResourceProviderR4Test return reVal; } - private IIdType createAPatient(){ + private IIdType createAPatient() { IIdType retVal = runInTransaction(() -> { Patient p = new Patient(); p.getMeta().addTag("http://system", "foo", "display"); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ReferentialIntegrityTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ReferentialIntegrityTest.java index 0258bab4194..75688405d90 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ReferentialIntegrityTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ReferentialIntegrityTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.test.BaseJpaR4Test; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException; @@ -19,9 +19,9 @@ public class FhirResourceDaoR4ReferentialIntegrityTest extends BaseJpaR4Test { @AfterEach public void afterResetConfig() { - myDaoConfig.setEnforceReferentialIntegrityOnWrite(new DaoConfig().isEnforceReferentialIntegrityOnWrite()); - myDaoConfig.setEnforceReferentialIntegrityOnDelete(new DaoConfig().isEnforceReferentialIntegrityOnDelete()); - myDaoConfig.setEnforceReferenceTargetTypes(new DaoConfig().isEnforceReferenceTargetTypes()); + myStorageSettings.setEnforceReferentialIntegrityOnWrite(new JpaStorageSettings().isEnforceReferentialIntegrityOnWrite()); + myStorageSettings.setEnforceReferentialIntegrityOnDelete(new JpaStorageSettings().isEnforceReferentialIntegrityOnDelete()); + myStorageSettings.setEnforceReferenceTargetTypes(new JpaStorageSettings().isEnforceReferenceTargetTypes()); } @Test @@ -40,7 +40,7 @@ public class FhirResourceDaoR4ReferentialIntegrityTest extends BaseJpaR4Test { @Test public void testCreateUnknownReferenceAllowed() { - myDaoConfig.setEnforceReferentialIntegrityOnWrite(false); + myStorageSettings.setEnforceReferentialIntegrityOnWrite(false); Patient p = new Patient(); p.setManagingOrganization(new Reference("Organization/AAA")); @@ -53,8 +53,8 @@ public class FhirResourceDaoR4ReferentialIntegrityTest extends BaseJpaR4Test { @Test public void testCreateUnknownReferenceAllowed_NumericId() { - myDaoConfig.setEnforceReferentialIntegrityOnWrite(false); - myDaoConfig.setEnforceReferenceTargetTypes(false); + myStorageSettings.setEnforceReferentialIntegrityOnWrite(false); + myStorageSettings.setEnforceReferenceTargetTypes(false); Patient p = new Patient(); p.setManagingOrganization(new Reference("Organization/123")); @@ -89,7 +89,7 @@ public class FhirResourceDaoR4ReferentialIntegrityTest extends BaseJpaR4Test { @Test public void testDeleteAllow() throws Exception { - myDaoConfig.setEnforceReferentialIntegrityOnDelete(false); + myStorageSettings.setEnforceReferentialIntegrityOnDelete(false); Organization o = new Organization(); o.setName("FOO"); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchCustomSearchParamTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchCustomSearchParamTest.java index 4dd34aab214..c6a8c78b1c2 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchCustomSearchParamTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchCustomSearchParamTest.java @@ -8,8 +8,7 @@ import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken; import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage; @@ -96,21 +95,21 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test @AfterEach public void after() { - myDaoConfig.setValidateSearchParameterExpressionsOnSave(new DaoConfig().isValidateSearchParameterExpressionsOnSave()); - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); + myStorageSettings.setValidateSearchParameterExpressionsOnSave(new JpaStorageSettings().isValidateSearchParameterExpressionsOnSave()); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); } @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); - myModelConfig.setDefaultSearchParamsCanBeOverridden(new ModelConfig().isDefaultSearchParamsCanBeOverridden()); - myDaoConfig.setMarkResourcesForReindexingUponSearchParameterChange(new DaoConfig().isMarkResourcesForReindexingUponSearchParameterChange()); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(new JpaStorageSettings().isDefaultSearchParamsCanBeOverridden()); + myStorageSettings.setMarkResourcesForReindexingUponSearchParameterChange(new JpaStorageSettings().isMarkResourcesForReindexingUponSearchParameterChange()); } @Test public void testStoreSearchParamWithBracketsInExpression() { - myDaoConfig.setMarkResourcesForReindexingUponSearchParameterChange(true); + myStorageSettings.setMarkResourcesForReindexingUponSearchParameterChange(true); SearchParameter fooSp = new SearchParameter(); fooSp.setCode("foo"); @@ -129,8 +128,8 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test @Test public void testStoreSearchParamWithBracketsInExpressionNormalizedQuantitySearchSupported() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); - myDaoConfig.setMarkResourcesForReindexingUponSearchParameterChange(true); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setMarkResourcesForReindexingUponSearchParameterChange(true); SearchParameter fooSp = new SearchParameter(); fooSp.setCode("foo"); @@ -150,8 +149,8 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test @Test public void testStoreSearchParamWithBracketsInExpressionNormalizedQuantityStorageSupported() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_STORAGE_SUPPORTED); - myDaoConfig.setMarkResourcesForReindexingUponSearchParameterChange(true); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_STORAGE_SUPPORTED); + myStorageSettings.setMarkResourcesForReindexingUponSearchParameterChange(true); SearchParameter fooSp = new SearchParameter(); fooSp.setCode("foo"); @@ -297,7 +296,7 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test */ @Test public void testStoreDraftSearchParam_DontValidate() { - myDaoConfig.setMarkResourcesForReindexingUponSearchParameterChange(true); + myStorageSettings.setMarkResourcesForReindexingUponSearchParameterChange(true); SearchParameter fooSp = new SearchParameter(); fooSp.setCode("foo"); @@ -621,7 +620,7 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test @Test public void testBuiltInSearchParameterNotReplacedByDraftSearchParameter() { - myModelConfig.setDefaultSearchParamsCanBeOverridden(true); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(true); SearchParameter memberSp = new SearchParameter(); memberSp.setCode("family"); @@ -640,7 +639,7 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test @Test public void testOverrideAndDisableBuiltInSearchParametersWithOverridingDisabled() { - myModelConfig.setDefaultSearchParamsCanBeOverridden(false); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(false); SearchParameter memberSp = new SearchParameter(); memberSp.setCode("member"); @@ -658,7 +657,7 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test @Test public void testOverrideAndDisableBuiltInSearchParametersWithOverridingEnabled() { - myModelConfig.setDefaultSearchParamsCanBeOverridden(true); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(true); SearchParameter memberSp = new SearchParameter(); memberSp.setCode("member"); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchDistanceTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchDistanceTest.java index 0b2b4ba5daa..e3386ad110f 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchDistanceTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchDistanceTest.java @@ -18,7 +18,7 @@ import static org.hamcrest.Matchers.contains; public class FhirResourceDaoR4SearchDistanceTest extends BaseJpaR4Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @Autowired diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchFtTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchFtTest.java index d64f2329e4f..0c26341ce74 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchFtTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchFtTest.java @@ -47,9 +47,9 @@ public class FhirResourceDaoR4SearchFtTest extends BaseJpaR4Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); - myDaoConfig.setAllowContainsSearches(true); - myDaoConfig.setAdvancedHSearchIndexing(false); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setAllowContainsSearches(true); + myStorageSettings.setAdvancedHSearchIndexing(false); } /** diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchIncludeTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchIncludeTest.java index f555ca31da7..a379734b220 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchIncludeTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchIncludeTest.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.dao.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.search.PersistedJpaSearchFirstPageBundleProvider; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.test.BaseJpaR4Test; @@ -40,7 +40,7 @@ public class FhirResourceDaoR4SearchIncludeTest extends BaseJpaR4Test { @AfterEach public void afterEach() { - myDaoConfig.setMaximumIncludesToLoadPerPage(DaoConfig.DEFAULT_MAXIMUM_INCLUDES_TO_LOAD_PER_PAGE); + myStorageSettings.setMaximumIncludesToLoadPerPage(JpaStorageSettings.DEFAULT_MAXIMUM_INCLUDES_TO_LOAD_PER_PAGE); } @Test @@ -75,7 +75,7 @@ public class FhirResourceDaoR4SearchIncludeTest extends BaseJpaR4Test { @Test public void testRevIncludesPaged_SyncSearchWithoutCount() { createOrganizationWithReferencingEpisodesOfCare(10); - myDaoConfig.setMaximumIncludesToLoadPerPage(5); + myStorageSettings.setMaximumIncludesToLoadPerPage(5); logAllResourceLinks(); @@ -179,7 +179,7 @@ public class FhirResourceDaoR4SearchIncludeTest extends BaseJpaR4Test { @Test public void testRevIncludesPaged_AsyncSearch() { int eocCount = 10; - myDaoConfig.setMaximumIncludesToLoadPerPage(5); + myStorageSettings.setMaximumIncludesToLoadPerPage(5); createOrganizationWithReferencingEpisodesOfCare(eocCount); @@ -203,7 +203,6 @@ public class FhirResourceDaoR4SearchIncludeTest extends BaseJpaR4Test { @Test public void testRevIncludesPagedSyncSearch() { int eocCount = 10; -// myDaoConfig.setMaximumIncludesToLoadPerPage(5); createOrganizationWithReferencingEpisodesOfCare(eocCount); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchMissingTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchMissingTest.java index 320d2338c39..8c1958cd139 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchMissingTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchMissingTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.test.BaseJpaR4Test; @@ -45,17 +45,17 @@ public class FhirResourceDaoR4SearchMissingTest extends BaseJpaR4Test { @BeforeEach public void beforeResetMissing() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); } @AfterEach public void afterResetSearch() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); } @Test public void testIndexMissingFieldsDisabledDontAllowInSearch_NonReference() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); SearchParameterMap params = new SearchParameterMap(); params.add(Patient.SP_ACTIVE, new StringParam().setMissing(true)); @@ -68,7 +68,7 @@ public class FhirResourceDaoR4SearchMissingTest extends BaseJpaR4Test { @Test public void testIndexMissingFieldsDisabledDontAllowInSearch_Reference() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); SearchParameterMap params = new SearchParameterMap(); params.add(Patient.SP_ORGANIZATION, new StringParam().setMissing(true)); @@ -81,7 +81,7 @@ public class FhirResourceDaoR4SearchMissingTest extends BaseJpaR4Test { @Test public void testIndexMissingFieldsDisabledDontCreateIndexes() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); Organization org = new Organization(); org.setActive(true); myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); @@ -99,8 +99,8 @@ public class FhirResourceDaoR4SearchMissingTest extends BaseJpaR4Test { @Test public void testIndexMissingFieldsDisabledDontCreateIndexesWithNormalizedQuantitySearchSupported() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Organization org = new Organization(); org.setActive(true); myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); @@ -118,8 +118,8 @@ public class FhirResourceDaoR4SearchMissingTest extends BaseJpaR4Test { @Test public void testIndexMissingFieldsDisabledDontCreateIndexesWithNormalizedQuantityStorageSupported() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_STORAGE_SUPPORTED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_STORAGE_SUPPORTED); Organization org = new Organization(); org.setActive(true); myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); @@ -332,7 +332,7 @@ public class FhirResourceDaoR4SearchMissingTest extends BaseJpaR4Test { @Test public void testSearchWithMissingQuantityWithNormalizedQuantitySearchSupported() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); IIdType notMissing; IIdType missing; { @@ -381,7 +381,7 @@ public class FhirResourceDaoR4SearchMissingTest extends BaseJpaR4Test { @Test public void testSearchWithMissingQuantityWithNormalizedQuantityStorageSupported() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_STORAGE_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_STORAGE_SUPPORTED); IIdType notMissing; IIdType missing; { diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java index ddd2745f3d2..5ebe63379f4 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java @@ -6,12 +6,11 @@ import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor; import ca.uhn.fhir.interceptor.api.IInterceptorService; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.PatientEverythingParameters; import ca.uhn.fhir.jpa.entity.Search; import ca.uhn.fhir.jpa.interceptor.ForceOffsetSearchModeInterceptor; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamNumber; @@ -210,28 +209,28 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { @AfterEach public void afterResetSearchSize() { - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setFetchSizeDefaultMaximum(new DaoConfig().getFetchSizeDefaultMaximum()); - myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches()); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setFetchSizeDefaultMaximum(new JpaStorageSettings().getFetchSizeDefaultMaximum()); + myStorageSettings.setAllowContainsSearches(new JpaStorageSettings().isAllowContainsSearches()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); - myModelConfig.setAutoSupportDefaultSearchParams(true); - myModelConfig.setIndexIdentifierOfType(new ModelConfig().isIndexIdentifierOfType()); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); + myStorageSettings.setAutoSupportDefaultSearchParams(true); + myStorageSettings.setIndexIdentifierOfType(new JpaStorageSettings().isIndexIdentifierOfType()); mySearchParamRegistry.resetForUnitTest(); } @BeforeEach public void beforeDisableCacheReuse() { - myModelConfig.setSuppressStringIndexingInTokens(new ModelConfig().isSuppressStringIndexingInTokens()); - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setSuppressStringIndexingInTokens(new JpaStorageSettings().isSuppressStringIndexingInTokens()); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @Test public void testDisableAutoSupportDefaultSearchParams() { - myModelConfig.setAutoSupportDefaultSearchParams(false); + myStorageSettings.setAutoSupportDefaultSearchParams(false); mySearchParamRegistry.resetForUnitTest(); Patient patient = new Patient(); @@ -1333,7 +1332,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { @Test public void testIndexNoDuplicatesQuantityWithNormalizedQuantitySearchSupported() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Substance res = new Substance(); res.addInstance().getQuantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("m").setValue(123); res.addInstance().getQuantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("m").setValue(123); @@ -1351,7 +1350,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { @Test public void testQuantityWithNormalizedQuantitySearchSupported_InvalidUCUMCode() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Substance res = new Substance(); res.addInstance().getQuantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("FOO").setValue(123); @@ -1366,7 +1365,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { @Test public void testQuantityWithNormalizedQuantitySearchSupported_NotUCUM() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Substance res = new Substance(); res.addInstance().getQuantity().setSystem("http://bar").setCode("FOO").setValue(123); @@ -1381,7 +1380,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { @Test public void testIndexNoDuplicatesQuantityWithNormalizedQuantityStorageSupported() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_STORAGE_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_STORAGE_SUPPORTED); Substance res = new Substance(); res.addInstance().getQuantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("m").setValue(123); res.addInstance().getQuantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("m").setValue(123); @@ -2543,7 +2542,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { myPatientDao.create(p1).getId().toUnqualifiedVersionless().getValue(); } - myDaoConfig.setSearchPreFetchThresholds(Lists.newArrayList(3, 6, 10)); + myStorageSettings.setSearchPreFetchThresholds(Lists.newArrayList(3, 6, 10)); { // Don't load synchronous @@ -2826,7 +2825,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { @Test public void testSearchByMoneyParamWithNormalizedQuantitySearchSupported() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); ChargeItem ci = new ChargeItem(); ci.getPriceOverride().setValue(123).setCurrency("$"); @@ -3190,7 +3189,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { @Test public void testSearchQuantityWithNormalizedQuantitySearchSupported() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Condition c1 = new Condition(); c1.setAbatement(new Range().setLow(new SimpleQuantity().setValue(1L)).setHigh(new SimpleQuantity().setValue(1L))); String id1 = myConditionDao.create(c1).getId().toUnqualifiedVersionless().getValue(); @@ -4238,7 +4237,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { @Test public void testSearchWithContains() { - myDaoConfig.setAllowContainsSearches(true); + myStorageSettings.setAllowContainsSearches(true); Patient pt1 = new Patient(); pt1.addName().setFamily("ABCDEFGHIJK"); @@ -4284,7 +4283,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { @Test public void testSearchWithContainsLowerCase() { - myDaoConfig.setAllowContainsSearches(true); + myStorageSettings.setAllowContainsSearches(true); Patient pt1 = new Patient(); pt1.addName().setFamily("abcdefghijk"); @@ -4330,7 +4329,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { @Test public void testSearchWithContainsDisabled() { - myDaoConfig.setAllowContainsSearches(false); + myStorageSettings.setAllowContainsSearches(false); SearchParameterMap map = new SearchParameterMap(); map.setLoadSynchronous(true); @@ -4531,7 +4530,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { @Test public void testSearchWithFetchSizeDefaultMaximum() { - myDaoConfig.setFetchSizeDefaultMaximum(5); + myStorageSettings.setFetchSizeDefaultMaximum(5); for (int i = 0; i < 10; i++) { Patient p = new Patient(); @@ -5207,7 +5206,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { */ @Test public void testSearchWithVeryLongUrlLonger() { - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); Patient p = new Patient(); p.addName().setFamily("A1"); @@ -5242,7 +5241,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { @Test public void testTokenOfType() { - myModelConfig.setIndexIdentifierOfType(true); + myStorageSettings.setIndexIdentifierOfType(true); Patient patient = new Patient(); patient @@ -5310,7 +5309,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { @Test public void testTokenTextDisabled_Global() { - myModelConfig.setSuppressStringIndexingInTokens(true); + myStorageSettings.setSuppressStringIndexingInTokens(true); SearchParameterMap map = new SearchParameterMap(); map.setLoadSynchronous(true); @@ -5491,7 +5490,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { */ @Test public void testSearchWithVeryLongUrlShorter() { - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); Patient p = new Patient(); p.addName().setFamily("A1"); @@ -5528,7 +5527,7 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { */ @Test public void testSearchOnPeriod() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); // Matching period myCaptureQueriesListener.clear(); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java deleted file mode 100644 index 90f9bd6f2ca..00000000000 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoHashesTest.java +++ /dev/null @@ -1,3446 +0,0 @@ -package ca.uhn.fhir.jpa.dao.r4; - -import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; -import ca.uhn.fhir.jpa.api.dao.PatientEverythingParameters; -import ca.uhn.fhir.jpa.dao.data.ISearchDao; -import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamNumber; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantity; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken; -import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamUri; -import ca.uhn.fhir.jpa.model.entity.ResourceLink; -import ca.uhn.fhir.jpa.model.entity.ResourceTable; -import ca.uhn.fhir.jpa.model.util.UcumServiceUtil; -import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; -import ca.uhn.fhir.jpa.searchparam.SearchParameterMap.EverythingModeEnum; -import ca.uhn.fhir.jpa.test.BaseJpaR4Test; -import ca.uhn.fhir.jpa.util.TestUtil; -import ca.uhn.fhir.model.api.Include; -import ca.uhn.fhir.model.api.TemporalPrecisionEnum; -import ca.uhn.fhir.parser.StrictErrorHandler; -import ca.uhn.fhir.rest.api.Constants; -import ca.uhn.fhir.rest.api.server.IBundleProvider; -import ca.uhn.fhir.rest.param.CompositeParam; -import ca.uhn.fhir.rest.param.DateParam; -import ca.uhn.fhir.rest.param.DateRangeParam; -import ca.uhn.fhir.rest.param.HasAndListParam; -import ca.uhn.fhir.rest.param.HasOrListParam; -import ca.uhn.fhir.rest.param.HasParam; -import ca.uhn.fhir.rest.param.NumberParam; -import ca.uhn.fhir.rest.param.ParamPrefixEnum; -import ca.uhn.fhir.rest.param.QuantityParam; -import ca.uhn.fhir.rest.param.ReferenceAndListParam; -import ca.uhn.fhir.rest.param.ReferenceOrListParam; -import ca.uhn.fhir.rest.param.ReferenceParam; -import ca.uhn.fhir.rest.param.StringAndListParam; -import ca.uhn.fhir.rest.param.StringOrListParam; -import ca.uhn.fhir.rest.param.StringParam; -import ca.uhn.fhir.rest.param.TokenAndListParam; -import ca.uhn.fhir.rest.param.TokenOrListParam; -import ca.uhn.fhir.rest.param.TokenParam; -import ca.uhn.fhir.rest.param.TokenParamModifier; -import ca.uhn.fhir.rest.param.UriParam; -import ca.uhn.fhir.rest.param.UriParamQualifierEnum; -import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; -import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.hl7.fhir.instance.model.api.IAnyResource; -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.hl7.fhir.instance.model.api.IIdType; -import org.hl7.fhir.instance.model.api.IPrimitiveType; -import org.hl7.fhir.r4.model.Appointment; -import org.hl7.fhir.r4.model.Bundle; -import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent; -import org.hl7.fhir.r4.model.Bundle.BundleType; -import org.hl7.fhir.r4.model.Bundle.HTTPVerb; -import org.hl7.fhir.r4.model.CodeSystem; -import org.hl7.fhir.r4.model.CodeType; -import org.hl7.fhir.r4.model.CodeableConcept; -import org.hl7.fhir.r4.model.Coding; -import org.hl7.fhir.r4.model.Condition; -import org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem; -import org.hl7.fhir.r4.model.DateTimeType; -import org.hl7.fhir.r4.model.DateType; -import org.hl7.fhir.r4.model.DecimalType; -import org.hl7.fhir.r4.model.Device; -import org.hl7.fhir.r4.model.DiagnosticReport; -import org.hl7.fhir.r4.model.Encounter; -import org.hl7.fhir.r4.model.Enumerations.AdministrativeGender; -import org.hl7.fhir.r4.model.Group; -import org.hl7.fhir.r4.model.IdType; -import org.hl7.fhir.r4.model.IntegerType; -import org.hl7.fhir.r4.model.Location; -import org.hl7.fhir.r4.model.Medication; -import org.hl7.fhir.r4.model.MedicationAdministration; -import org.hl7.fhir.r4.model.MedicationRequest; -import org.hl7.fhir.r4.model.MolecularSequence; -import org.hl7.fhir.r4.model.Observation; -import org.hl7.fhir.r4.model.Observation.ObservationStatus; -import org.hl7.fhir.r4.model.Organization; -import org.hl7.fhir.r4.model.Patient; -import org.hl7.fhir.r4.model.Period; -import org.hl7.fhir.r4.model.Practitioner; -import org.hl7.fhir.r4.model.Quantity; -import org.hl7.fhir.r4.model.Range; -import org.hl7.fhir.r4.model.Reference; -import org.hl7.fhir.r4.model.RiskAssessment; -import org.hl7.fhir.r4.model.ServiceRequest; -import org.hl7.fhir.r4.model.SimpleQuantity; -import org.hl7.fhir.r4.model.StringType; -import org.hl7.fhir.r4.model.Subscription; -import org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType; -import org.hl7.fhir.r4.model.Subscription.SubscriptionStatus; -import org.hl7.fhir.r4.model.Substance; -import org.hl7.fhir.r4.model.Task; -import org.hl7.fhir.r4.model.ValueSet; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.TransactionDefinition; -import org.springframework.transaction.TransactionStatus; -import org.springframework.transaction.support.TransactionCallback; -import org.springframework.transaction.support.TransactionCallbackWithoutResult; -import org.springframework.transaction.support.TransactionTemplate; - -import javax.servlet.http.HttpServletRequest; -import java.io.IOException; -import java.math.BigDecimal; -import java.nio.charset.StandardCharsets; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; -import java.util.stream.Collectors; - -import static ca.uhn.fhir.test.utilities.CustomMatchersUtil.*; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.contains; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.empty; -import static org.hamcrest.Matchers.endsWith; -import static org.hamcrest.Matchers.hasItem; -import static org.hamcrest.Matchers.hasItems; -import static org.hamcrest.Matchers.not; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; -import static org.mockito.Mockito.mock; - -@SuppressWarnings({"unchecked", "Duplicates"}) -public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test { - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirResourceDaoR4SearchNoHashesTest.class); - @Autowired - private ISearchDao mySearchEntityDao; - - @AfterEach - public void afterResetSearchSize() { - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setFetchSizeDefaultMaximum(new DaoConfig().getFetchSizeDefaultMaximum()); - myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches()); - myDaoConfig.setDisableHashBasedSearches(false); - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); - } - - @BeforeEach - public void beforeInitialize() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); - myDaoConfig.setDisableHashBasedSearches(true); - myDaoConfig.setAdvancedHSearchIndexing(false); - } - - @Test - public void testChainWithMultipleTypePossibilities() { - - Patient sub1 = new Patient(); - sub1.setActive(true); - sub1.addIdentifier().setSystem("foo").setValue("bar"); - String sub1Id = myPatientDao.create(sub1).getId().toUnqualifiedVersionless().getValue(); - - Group sub2 = new Group(); - sub2.setActive(true); - sub2.addIdentifier().setSystem("foo").setValue("bar"); - String sub2Id = myGroupDao.create(sub2).getId().toUnqualifiedVersionless().getValue(); - - Encounter enc1 = new Encounter(); - enc1.getSubject().setReference(sub1Id); - String enc1Id = myEncounterDao.create(enc1).getId().toUnqualifiedVersionless().getValue(); - - Encounter enc2 = new Encounter(); - enc2.getSubject().setReference(sub2Id); - String enc2Id = myEncounterDao.create(enc2).getId().toUnqualifiedVersionless().getValue(); - - List ids; - SearchParameterMap map; - IBundleProvider results; - - map = new SearchParameterMap(); - map.add(Encounter.SP_SUBJECT, new ReferenceParam("subject", "foo|bar").setChain("identifier")); - results = myEncounterDao.search(map); - ids = toUnqualifiedVersionlessIdValues(results); - assertThat(ids, hasItems(enc1Id, enc2Id)); - - map = new SearchParameterMap(); - map.add(Encounter.SP_SUBJECT, new ReferenceParam("subject:Patient", "foo|bar").setChain("identifier")); - results = myEncounterDao.search(map); - ids = toUnqualifiedVersionlessIdValues(results); - assertThat(ids, hasItems(enc1Id)); - - map = new SearchParameterMap(); - map.add(Encounter.SP_SUBJECT, new ReferenceParam("subject:Group", "foo|bar").setChain("identifier")); - results = myEncounterDao.search(map); - ids = toUnqualifiedVersionlessIdValues(results); - assertThat(ids, hasItems(enc2Id)); - - map = new SearchParameterMap(); - map.add(Encounter.SP_SUBJECT, new ReferenceParam("subject", "04823543").setChain("identifier")); - results = myEncounterDao.search(map); - ids = toUnqualifiedVersionlessIdValues(results); - assertThat(ids, empty()); - } - - /** - * See #441 - */ - @Test - public void testChainedMedication() { - Medication medication = new Medication(); - medication.getCode().addCoding().setSystem("SYSTEM").setCode("04823543"); - IIdType medId = myMedicationDao.create(medication).getId().toUnqualifiedVersionless(); - - MedicationAdministration ma = new MedicationAdministration(); - ma.setMedication(new Reference(medId)); - IIdType moId = myMedicationAdministrationDao.create(ma).getId().toUnqualified(); - - SearchParameterMap map = new SearchParameterMap(); - map.add(MedicationAdministration.SP_MEDICATION, new ReferenceAndListParam().addAnd(new ReferenceOrListParam().add(new ReferenceParam("code", "04823543")))); - IBundleProvider results = myMedicationAdministrationDao.search(map); - List ids = toUnqualifiedIdValues(results); - - assertThat(ids, contains(moId.getValue())); - } - - @Test - public void testEmptyChain() { - - SearchParameterMap map = new SearchParameterMap(); - map.add(Encounter.SP_SUBJECT, new ReferenceAndListParam().addAnd(new ReferenceOrListParam().add(new ReferenceParam("subject", "04823543").setChain("identifier")))); - IBundleProvider results = myMedicationAdministrationDao.search(map); - List ids = toUnqualifiedIdValues(results); - - assertThat(ids, empty()); - } - - /** - * See #1053 - */ - @Test - public void testLastUpdateShouldntApplyToIncludes() { - SearchParameterMap map; - List ids; - - Date beforeAll = new Date(); - ca.uhn.fhir.jpa.util.TestUtil.sleepOneClick(); - - Organization org = new Organization(); - org.setName("O1"); - org.setId("O1"); - myOrganizationDao.update(org); - ca.uhn.fhir.jpa.util.TestUtil.sleepOneClick(); - - Date beforePatient = new Date(); - ca.uhn.fhir.jpa.util.TestUtil.sleepOneClick(); - - Patient p = new Patient(); - p.setId("P1"); - p.setActive(true); - p.setManagingOrganization(new Reference("Organization/O1")); - myPatientDao.update(p); - - ca.uhn.fhir.jpa.util.TestUtil.sleepOneClick(); - Date afterAll = new Date(); - - // Search with between date (should still return Organization even though - // it was created before that date, since it's an include) - map = new SearchParameterMap(); - map.setLastUpdated(new DateRangeParam().setLowerBoundInclusive(beforePatient)); - map.addInclude(Patient.INCLUDE_ORGANIZATION); - ids = toUnqualifiedVersionlessIdValues(myPatientDao.search(map)); - assertThat(ids, contains("Patient/P1", "Organization/O1")); - - // Search before everything - map = new SearchParameterMap(); - map.setLastUpdated(new DateRangeParam().setLowerBoundInclusive(beforeAll)); - map.addInclude(Patient.INCLUDE_ORGANIZATION); - ids = toUnqualifiedVersionlessIdValues(myPatientDao.search(map)); - assertThat(ids, contains("Patient/P1", "Organization/O1")); - - // Search after everything - map = new SearchParameterMap(); - map.setLastUpdated(new DateRangeParam().setLowerBoundInclusive(afterAll)); - map.addInclude(Patient.INCLUDE_ORGANIZATION); - ids = toUnqualifiedVersionlessIdValues(myPatientDao.search(map)); - assertThat(ids, empty()); - - } - - /** - * See #1053 - *

- * Note that I don't know that _lastUpdate actually should apply to reverse includes. The - * spec doesn't say one way or ther other, but it seems like sensible behaviour to me. - *

- * Definitely the $everything operation depends on this behaviour, so if we change it - * we need to account for the everything operation... - */ - @Test - public void testLastUpdateShouldApplyToReverseIncludes() { - SearchParameterMap map; - List ids; - - // This gets updated in a sec.. - Organization org = new Organization(); - org.setActive(false); - org.setId("O1"); - myOrganizationDao.update(org); - - Date beforeAll = new Date(); - ca.uhn.fhir.jpa.util.TestUtil.sleepOneClick(); - - Patient p = new Patient(); - p.setId("P1"); - p.setActive(true); - p.setManagingOrganization(new Reference("Organization/O1")); - myPatientDao.update(p); - - ca.uhn.fhir.jpa.util.TestUtil.sleepOneClick(); - - Date beforeOrg = new Date(); - ca.uhn.fhir.jpa.util.TestUtil.sleepOneClick(); - - org = new Organization(); - org.setActive(true); - org.setId("O1"); - myOrganizationDao.update(org); - - ca.uhn.fhir.jpa.util.TestUtil.sleepOneClick(); - Date afterAll = new Date(); - - // Everything should come back - map = new SearchParameterMap(); - map.setLastUpdated(new DateRangeParam().setLowerBoundInclusive(beforeAll)); - map.addRevInclude(Patient.INCLUDE_ORGANIZATION); - ids = toUnqualifiedVersionlessIdValues(myOrganizationDao.search(map)); - assertThat(ids, contains("Organization/O1", "Patient/P1")); - - // Search before everything - map = new SearchParameterMap(); - map.setLastUpdated(new DateRangeParam().setLowerBoundInclusive(beforeOrg)); - map.addInclude(Patient.INCLUDE_ORGANIZATION); - ids = toUnqualifiedVersionlessIdValues(myOrganizationDao.search(map)); - assertThat(ids, contains("Organization/O1")); - - // Search after everything - map = new SearchParameterMap(); - map.setLastUpdated(new DateRangeParam().setLowerBoundInclusive(afterAll)); - map.addInclude(Patient.INCLUDE_ORGANIZATION); - ids = toUnqualifiedVersionlessIdValues(myOrganizationDao.search(map)); - assertThat(ids, empty()); - - } - - @Test - public void testEverythingTimings() { - String methodName = "testEverythingTimings"; - - Organization org = new Organization(); - org.setName(methodName); - IIdType orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - - Medication med = new Medication(); - med.getCode().setText(methodName); - IIdType medId = myMedicationDao.create(med, mySrd).getId().toUnqualifiedVersionless(); - - Patient pat = new Patient(); - pat.addAddress().addLine(methodName); - pat.getManagingOrganization().setReferenceElement(orgId); - IIdType patId = myPatientDao.create(pat, mySrd).getId().toUnqualifiedVersionless(); - - Patient pat2 = new Patient(); - pat2.addAddress().addLine(methodName + "2"); - pat2.getManagingOrganization().setReferenceElement(orgId); - IIdType patId2 = myPatientDao.create(pat2, mySrd).getId().toUnqualifiedVersionless(); - - MedicationRequest mo = new MedicationRequest(); - mo.getSubject().setReferenceElement(patId); - mo.setMedication(new Reference(medId)); - IIdType moId = myMedicationRequestDao.create(mo, mySrd).getId().toUnqualifiedVersionless(); - - HttpServletRequest request = mock(HttpServletRequest.class); - IBundleProvider resp = myPatientDao.patientTypeEverything(request, mySrd, new PatientEverythingParameters(), null); - assertThat(toUnqualifiedVersionlessIds(resp), containsInAnyOrder(orgId, medId, patId, moId, patId2)); - - request = mock(HttpServletRequest.class); - resp = myPatientDao.patientInstanceEverything(request, mySrd, new PatientEverythingParameters(), patId); - assertThat(toUnqualifiedVersionlessIds(resp), containsInAnyOrder(orgId, medId, patId, moId)); - } - - /** - * Per message from David Hay on Skype - */ - @Test - @Disabled - public void testEverythingWithLargeSet() throws Exception { - myFhirContext.setParserErrorHandler(new StrictErrorHandler()); - - String inputString = IOUtils.toString(getClass().getResourceAsStream("/david_big_bundle.json"), StandardCharsets.UTF_8); - Bundle inputBundle = myFhirContext.newJsonParser().parseResource(Bundle.class, inputString); - inputBundle.setType(BundleType.TRANSACTION); - - Set allIds = new TreeSet<>(); - for (BundleEntryComponent nextEntry : inputBundle.getEntry()) { - nextEntry.getRequest().setMethod(HTTPVerb.PUT); - nextEntry.getRequest().setUrl(nextEntry.getResource().getId()); - allIds.add(nextEntry.getResource().getIdElement().toUnqualifiedVersionless().getValue()); - } - - mySystemDao.transaction(mySrd, inputBundle); - - SearchParameterMap map = new SearchParameterMap(); - map.setEverythingMode(EverythingModeEnum.PATIENT_INSTANCE); - IPrimitiveType count = new IntegerType(1000); - PatientEverythingParameters everythingParams = new PatientEverythingParameters(); - everythingParams.setCount(count); - IBundleProvider everything = myPatientDao.patientInstanceEverything(mySrd.getServletRequest(), mySrd, everythingParams, new IdType("Patient/A161443")); - - TreeSet ids = new TreeSet<>(toUnqualifiedVersionlessIdValues(everything)); - assertThat(ids, hasItem("List/A161444")); - assertThat(ids, hasItem("List/A161468")); - assertThat(ids, hasItem("List/A161500")); - - ourLog.info("Expected {} - {}", allIds.size(), allIds); - ourLog.info("Actual {} - {}", ids.size(), ids); - assertEquals(allIds, ids); - - ids = new TreeSet<>(); - for (int i = 0; i < everything.size(); i++) { - for (IBaseResource next : everything.getResources(i, i + 1)) { - ids.add(next.getIdElement().toUnqualifiedVersionless().getValue()); - } - } - assertThat(ids, hasItem("List/A161444")); - assertThat(ids, hasItem("List/A161468")); - assertThat(ids, hasItem("List/A161500")); - - ourLog.info("Expected {} - {}", allIds.size(), allIds); - ourLog.info("Actual {} - {}", ids.size(), ids); - assertEquals(allIds, ids); - - } - - @SuppressWarnings("unused") - @Test - public void testHasAndHas() { - Patient p1 = new Patient(); - p1.setActive(true); - IIdType p1id = myPatientDao.create(p1).getId().toUnqualifiedVersionless(); - - Patient p2 = new Patient(); - p2.setActive(true); - IIdType p2id = myPatientDao.create(p2).getId().toUnqualifiedVersionless(); - - Observation p1o1 = new Observation(); - p1o1.setStatus(ObservationStatus.FINAL); - p1o1.getSubject().setReferenceElement(p1id); - IIdType p1o1id = myObservationDao.create(p1o1).getId().toUnqualifiedVersionless(); - - Observation p1o2 = new Observation(); - p1o2.setEffective(new DateTimeType("2001-01-01")); - p1o2.getSubject().setReferenceElement(p1id); - IIdType p1o2id = myObservationDao.create(p1o2).getId().toUnqualifiedVersionless(); - - Observation p2o1 = new Observation(); - p2o1.setStatus(ObservationStatus.FINAL); - p2o1.getSubject().setReferenceElement(p2id); - IIdType p2o1id = myObservationDao.create(p2o1).getId().toUnqualifiedVersionless(); - - SearchParameterMap map = new SearchParameterMap(); - - HasAndListParam hasAnd = new HasAndListParam(); - hasAnd.addValue(new HasOrListParam().add(new HasParam("Observation", "subject", "status", "final"))); - hasAnd.addValue(new HasOrListParam().add(new HasParam("Observation", "subject", "date", "2001-01-01"))); - map.add("_has", hasAnd); - List actual = toUnqualifiedVersionlessIdValues(myPatientDao.search(map)); - assertThat(actual, containsInAnyOrder(p1id.getValue())); - - } - - @Test - public void testSearchTokenListLike() { - - Patient p = new Patient(); - p.addIdentifier().setSystem("SYS").setValue("FOO"); - myPatientDao.create(p); - p = new Patient(); - p.addIdentifier().setSystem("SYS").setValue("BAR"); - myPatientDao.create(p); - p = new Patient(); - p.addIdentifier().setSystem("SYS").setValue("BAZ"); - myPatientDao.create(p); - - myCaptureQueriesListener.clear(); - SearchParameterMap map = new SearchParameterMap(); - map.add(Patient.SP_IDENTIFIER, new TokenOrListParam().addOr(new TokenParam("FOO")).addOr(new TokenParam("BAR"))); - map.setLoadSynchronous(true); - IBundleProvider search = myPatientDao.search(map); - - myCaptureQueriesListener.logInsertQueriesForCurrentThread(); - List queries = myCaptureQueriesListener - .getSelectQueriesForCurrentThread() - .stream() - .map(t -> t.getSql(true, false)) - .collect(Collectors.toList()); - String resultingQueryNotFormatted = queries.get(0); - - assertEquals(0, StringUtils.countMatches(resultingQueryNotFormatted, "SP_VALUE"), resultingQueryNotFormatted); - assertEquals(1, StringUtils.countMatches(resultingQueryNotFormatted, "HASH_VALUE"), resultingQueryNotFormatted); - assertThat(resultingQueryNotFormatted, containsString("HASH_VALUE IN ('3140583648400062149','4929264259256651518')")); - - // Ensure that the search actually worked - assertEquals(2, search.size().intValue()); - - } - - - @Test - public void testHasParameter() { - IIdType pid0; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - patient.addName().setFamily("Tester").addGiven("Joe"); - pid0 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - patient.addName().setFamily("Tester").addGiven("Joe"); - myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - { - Observation obs = new Observation(); - obs.addIdentifier().setSystem("urn:system").setValue("FOO"); - obs.getSubject().setReferenceElement(pid0); - myObservationDao.create(obs, mySrd); - } - { - Device device = new Device(); - device.addIdentifier().setValue("DEVICEID"); - IIdType devId = myDeviceDao.create(device, mySrd).getId().toUnqualifiedVersionless(); - - Observation obs = new Observation(); - obs.addIdentifier().setSystem("urn:system").setValue("NOLINK"); - obs.setDevice(new Reference(devId)); - myObservationDao.create(obs, mySrd); - } - - SearchParameterMap params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add("_has", new HasParam("Observation", "subject", "identifier", "urn:system|FOO")); - assertThat(toUnqualifiedVersionlessIdValues(myPatientDao.search(params)), contains(pid0.getValue())); - - // No targets exist - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add("_has", new HasParam("Observation", "subject", "identifier", "urn:system|UNKNOWN")); - assertThat(toUnqualifiedVersionlessIdValues(myPatientDao.search(params)), empty()); - - // Target exists but doesn't link to us - params = new SearchParameterMap(); - params.add("_has", new HasParam("Observation", "subject", "identifier", "urn:system|NOLINK")); - assertThat(toUnqualifiedVersionlessIdValues(myPatientDao.search(params)), empty()); - } - - @Test - public void testHasParameterChained() { - IIdType pid0; - { - Device device = new Device(); - device.addIdentifier().setSystem("urn:system").setValue("DEVICEID"); - IIdType devId = myDeviceDao.create(device, mySrd).getId().toUnqualifiedVersionless(); - - Patient patient = new Patient(); - patient.setGender(AdministrativeGender.MALE); - pid0 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - - Observation obs = new Observation(); - obs.addIdentifier().setSystem("urn:system").setValue("FOO"); - obs.setDevice(new Reference(devId)); - obs.setSubject(new Reference(pid0)); - myObservationDao.create(obs, mySrd).getId(); - } - - SearchParameterMap params; - - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add("_has", new HasParam("Observation", "subject", "device.identifier", "urn:system|DEVICEID")); - assertThat(toUnqualifiedVersionlessIdValues(myPatientDao.search(params)), contains(pid0.getValue())); - - // No targets exist - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add("_has", new HasParam("Observation", "subject", "identifier", "urn:system|UNKNOWN")); - assertThat(toUnqualifiedVersionlessIdValues(myPatientDao.search(params)), empty()); - - // Target exists but doesn't link to us - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add("_has", new HasParam("Observation", "subject", "identifier", "urn:system|NOLINK")); - assertThat(toUnqualifiedVersionlessIdValues(myPatientDao.search(params)), empty()); - } - - @Test - public void testHasParameterInvalidResourceType() { - SearchParameterMap params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add("_has", new HasParam("Observation__", "subject", "identifier", "urn:system|FOO")); - try { - myPatientDao.search(params); - fail(); - } catch (InvalidRequestException e) { - assertEquals(Msg.code(1208) + "Invalid resource type: Observation__", e.getMessage()); - } - } - - @Test - public void testHasParameterInvalidSearchParam() { - SearchParameterMap params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add("_has", new HasParam("Observation", "subject", "IIIIDENFIEYR", "urn:system|FOO")); - try { - myPatientDao.search(params); - fail(); - } catch (InvalidRequestException e) { - assertEquals(Msg.code(1209) + "Unknown parameter name: Observation:IIIIDENFIEYR", e.getMessage()); - } - } - - @Test - public void testHasParameterInvalidTargetPath() { - SearchParameterMap params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add("_has", new HasParam("Observation", "soooooobject", "identifier", "urn:system|FOO")); - try { - myPatientDao.search(params); - fail(); - } catch (InvalidRequestException e) { - assertEquals(Msg.code(1209) + "Unknown parameter name: Observation:soooooobject", e.getMessage()); - } - } - - @Test - public void testIncludeLinkedObservations() { - - DiagnosticReport dr = new DiagnosticReport(); - dr.setId("DiagnosticReport/DR"); - dr.setStatus(DiagnosticReport.DiagnosticReportStatus.FINAL); - - Observation parentObs = new Observation(); - parentObs.setStatus(ObservationStatus.FINAL); - parentObs.setId("Observation/parentObs"); - - Observation childObs = new Observation(); - childObs.setId("Observation/childObs"); - childObs.setStatus(ObservationStatus.FINAL); - - dr.addResult().setReference("Observation/parentObs").setResource(parentObs); - parentObs.addHasMember(new Reference(childObs).setReference("Observation/childObs")); - childObs.addDerivedFrom(new Reference(parentObs).setReference("Observation/parentObs")); - - Bundle input = new Bundle(); - input.setType(BundleType.TRANSACTION); - input.addEntry() - .setResource(dr) - .getRequest().setMethod(HTTPVerb.PUT).setUrl(dr.getId()); - input.addEntry() - .setResource(parentObs) - .getRequest().setMethod(HTTPVerb.PUT).setUrl(parentObs.getId()); - input.addEntry() - .setResource(childObs) - .getRequest().setMethod(HTTPVerb.PUT).setUrl(childObs.getId()); - mySystemDao.transaction(mySrd, input); - - SearchParameterMap params = new SearchParameterMap(); - params.add("_id", new TokenParam(null, "DR")); - params.addInclude(new Include("DiagnosticReport:subject").setRecurse(true)); - params.addInclude(new Include("DiagnosticReport:result").setRecurse(true)); - params.addInclude(Observation.INCLUDE_HAS_MEMBER.setRecurse(true)); - - IBundleProvider result = myDiagnosticReportDao.search(params); - List resultIds = toUnqualifiedVersionlessIdValues(result); - assertThat(resultIds, containsInAnyOrder("DiagnosticReport/DR", "Observation/parentObs", "Observation/childObs")); - - } - - @Test - public void testIndexNoDuplicatesDate() { - Encounter order = new Encounter(); - order.addLocation().getPeriod().setStartElement(new DateTimeType("2011-12-12T11:12:12Z")).setEndElement(new DateTimeType("2011-12-12T11:12:12Z")); - order.addLocation().getPeriod().setStartElement(new DateTimeType("2011-12-12T11:12:12Z")).setEndElement(new DateTimeType("2011-12-12T11:12:12Z")); - order.addLocation().getPeriod().setStartElement(new DateTimeType("2011-12-12T11:12:12Z")).setEndElement(new DateTimeType("2011-12-12T11:12:12Z")); - order.addLocation().getPeriod().setStartElement(new DateTimeType("2011-12-11T11:12:12Z")).setEndElement(new DateTimeType("2011-12-11T11:12:12Z")); - order.addLocation().getPeriod().setStartElement(new DateTimeType("2011-12-11T11:12:12Z")).setEndElement(new DateTimeType("2011-12-11T11:12:12Z")); - order.addLocation().getPeriod().setStartElement(new DateTimeType("2011-12-11T11:12:12Z")).setEndElement(new DateTimeType("2011-12-11T11:12:12Z")); - - IIdType id = myEncounterDao.create(order, mySrd).getId().toUnqualifiedVersionless(); - - List actual = toUnqualifiedVersionlessIds( - myEncounterDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Encounter.SP_LOCATION_PERIOD, new DateParam("2011-12-12T11:12:12Z")))); - assertThat(actual, contains(id)); - - runInTransaction(() -> { - Class type = ResourceIndexedSearchParamDate.class; - List results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i WHERE i.myMissing = false", type).getResultList(); - ourLog.info(toStringMultiline(results)); - assertEquals(2, results.size()); - }); - } - - @Test - public void testIndexNoDuplicatesNumber() { - final RiskAssessment res = new RiskAssessment(); - res.addPrediction().setProbability(new DecimalType("1.0")); - res.addPrediction().setProbability(new DecimalType("1.0")); - res.addPrediction().setProbability(new DecimalType("1.0")); - res.addPrediction().setProbability(new DecimalType("2.0")); - res.addPrediction().setProbability(new DecimalType("2.0")); - res.addPrediction().setProbability(new DecimalType("2.0")); - res.addPrediction().setProbability(new DecimalType("2.0")); - - IIdType id = myRiskAssessmentDao.create(res, mySrd).getId().toUnqualifiedVersionless(); - - List actual = toUnqualifiedVersionlessIds(myRiskAssessmentDao.search(new SearchParameterMap().setLoadSynchronous(true).add(RiskAssessment.SP_PROBABILITY, new NumberParam("1.0")))); - assertThat(actual, contains(id)); - actual = toUnqualifiedVersionlessIds(myRiskAssessmentDao.search(new SearchParameterMap().setLoadSynchronous(true).add(RiskAssessment.SP_PROBABILITY, new NumberParam("99.0")))); - assertThat(actual, empty()); - - new TransactionTemplate(myTxManager).execute(new TransactionCallbackWithoutResult() { - @Override - protected void doInTransactionWithoutResult(TransactionStatus status) { - ResourceTable resource = myResourceTableDao.findAll().iterator().next(); - assertEquals("RiskAssessment", resource.getResourceType()); - - Class type = ResourceIndexedSearchParamNumber.class; - List results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i", type).getResultList(); - ourLog.info(toStringMultiline(results)); - - ResourceIndexedSearchParamNumber expect0 = new ResourceIndexedSearchParamNumber(new PartitionSettings(), "RiskAssessment", RiskAssessment.SP_PROBABILITY, new BigDecimal("1.00")); - expect0.setResource(resource); - expect0.calculateHashes(); - ResourceIndexedSearchParamNumber expect1 = new ResourceIndexedSearchParamNumber(new PartitionSettings(), "RiskAssessment", RiskAssessment.SP_PROBABILITY, new BigDecimal("2.00")); - expect1.setResource(resource); - expect1.calculateHashes(); - - assertThat("Got: \"" + results.toString() + "\"", results, containsInAnyOrder(expect0, expect1)); - } - }); - } - - @Test - public void testIndexNoDuplicatesQuantity() { - Substance res = new Substance(); - res.addInstance().getQuantity().setSystem("http://foo").setCode("UNIT").setValue(123); - res.addInstance().getQuantity().setSystem("http://foo").setCode("UNIT").setValue(123); - res.addInstance().getQuantity().setSystem("http://foo2").setCode("UNIT2").setValue(1232); - res.addInstance().getQuantity().setSystem("http://foo2").setCode("UNIT2").setValue(1232); - - IIdType id = mySubstanceDao.create(res, mySrd).getId().toUnqualifiedVersionless(); - - runInTransaction(() -> { - Class type = ResourceIndexedSearchParamQuantity.class; - List results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i", type).getResultList(); - ourLog.info(toStringMultiline(results)); - assertEquals(2, results.size()); - }); - - List actual = toUnqualifiedVersionlessIds( - mySubstanceDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Substance.SP_QUANTITY, new QuantityParam(null, 123, "http://foo", "UNIT")))); - assertThat(actual, contains(id)); - } - - @Test - public void testIndexNoDuplicatesReference() { - ServiceRequest pr = new ServiceRequest(); - pr.setId("ServiceRequest/somepract"); - pr.getAuthoredOnElement().setValue(new Date()); - myServiceRequestDao.update(pr, mySrd); - ServiceRequest pr2 = new ServiceRequest(); - pr2.setId("ServiceRequest/somepract2"); - pr2.getAuthoredOnElement().setValue(new Date()); - myServiceRequestDao.update(pr2, mySrd); - - ServiceRequest res = new ServiceRequest(); - res.addReplaces(new Reference("ServiceRequest/somepract")); - res.addReplaces(new Reference("ServiceRequest/somepract")); - res.addReplaces(new Reference("ServiceRequest/somepract2")); - res.addReplaces(new Reference("ServiceRequest/somepract2")); - - final IIdType id = myServiceRequestDao.create(res, mySrd).getId().toUnqualifiedVersionless(); - - TransactionTemplate txTemplate = new TransactionTemplate(myTransactionMgr); - txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); - txTemplate.execute(new TransactionCallbackWithoutResult() { - @Override - protected void doInTransactionWithoutResult(TransactionStatus theArg0) { - Class type = ResourceLink.class; - List results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i", type).getResultList(); - ourLog.info(toStringMultiline(results)); - assertEquals(2, results.size()); - List actual = toUnqualifiedVersionlessIds( - myServiceRequestDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ServiceRequest.SP_REPLACES, new ReferenceParam("ServiceRequest/somepract")))); - assertThat(actual, contains(id)); - } - }); - - } - - @Test - public void testIndexNoDuplicatesString() { - Patient p = new Patient(); - p.addAddress().addLine("123 Fake Street"); - p.addAddress().addLine("123 Fake Street"); - p.addAddress().addLine("123 Fake Street"); - p.addAddress().addLine("456 Fake Street"); - p.addAddress().addLine("456 Fake Street"); - p.addAddress().addLine("456 Fake Street"); - - IIdType id = myPatientDao.create(p, mySrd).getId().toUnqualifiedVersionless(); - - runInTransaction(() -> { - Class type = ResourceIndexedSearchParamString.class; - List results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i WHERE i.myMissing = false", type).getResultList(); - ourLog.info(toStringMultiline(results)); - assertEquals(2, results.size()); - }); - - List actual = toUnqualifiedVersionlessIds(myPatientDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Patient.SP_ADDRESS, new StringParam("123 Fake Street")))); - assertThat(actual, contains(id)); - } - - @Test - public void testIndexNoDuplicatesToken() { - Patient res = new Patient(); - res.addIdentifier().setSystem("http://foo1").setValue("123"); - res.addIdentifier().setSystem("http://foo1").setValue("123"); - res.addIdentifier().setSystem("http://foo2").setValue("1234"); - res.addIdentifier().setSystem("http://foo2").setValue("1234"); - - IIdType id = myPatientDao.create(res, mySrd).getId().toUnqualifiedVersionless(); - - runInTransaction(() -> { - Class type = ResourceIndexedSearchParamToken.class; - List results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i WHERE i.myMissing = false", type).getResultList(); - ourLog.info(toStringMultiline(results)); - // This is 3 for now because the FluentPath for Patient:deceased adds a value.. this should - // be corrected at some point, and we'll then drop back down to 2 - assertEquals(3, results.size()); - }); - - - List actual = toUnqualifiedVersionlessIds(myPatientDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Patient.SP_IDENTIFIER, new TokenParam("http://foo1", "123")))); - assertThat(actual, contains(id)); - } - - @Test - public void testIndexNoDuplicatesUri() { - ValueSet res = new ValueSet(); - res.setUrl("http://www.example.org/vs"); - res.getCompose().addInclude().setSystem("http://foo"); - res.getCompose().addInclude().setSystem("http://bar"); - res.getCompose().addInclude().setSystem("http://foo"); - res.getCompose().addInclude().setSystem("http://bar"); - res.getCompose().addInclude().setSystem("http://foo"); - res.getCompose().addInclude().setSystem("http://bar"); - - IIdType id = myValueSetDao.create(res, mySrd).getId().toUnqualifiedVersionless(); - - runInTransaction(() -> { - Class type = ResourceIndexedSearchParamUri.class; - List results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i WHERE i.myMissing = false", type).getResultList(); - ourLog.info(toStringMultiline(results)); - assertEquals(3, results.size()); - }); - - List actual = toUnqualifiedVersionlessIds(myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_REFERENCE, new UriParam("http://foo")))); - assertThat(actual, contains(id)); - } - - /** - * #454 - */ - @Test - public void testIndexWithUtf8Chars() throws IOException { - String input = IOUtils.toString(getClass().getResourceAsStream("/bug454_utf8.json"), StandardCharsets.UTF_8); - - CodeSystem cs = (CodeSystem) myFhirContext.newJsonParser().parseResource(input); - myCodeSystemDao.create(cs); - } - - @Test - public void testReturnOnlyCorrectResourceType() { - ValueSet vsRes = new ValueSet(); - vsRes.setUrl("http://foo"); - String vsId = myValueSetDao.create(vsRes).getId().toUnqualifiedVersionless().getValue(); - - CodeSystem csRes = new CodeSystem(); - csRes.setUrl("http://bar"); - String csId = myCodeSystemDao.create(csRes).getId().toUnqualifiedVersionless().getValue(); - - SearchParameterMap map = new SearchParameterMap().setLoadSynchronous(true); - map.add(ValueSet.SP_URL, new UriParam("http://foo")); - List actual = toUnqualifiedVersionlessIdValues(myValueSetDao.search(map)); - assertThat(actual, contains(vsId)); - - map = new SearchParameterMap().setLoadSynchronous(true); - map.add(ValueSet.SP_URL, new UriParam("http://bar")); - actual = toUnqualifiedVersionlessIdValues(myCodeSystemDao.search(map)); - assertThat(actual, contains(csId)); - } - - @Test - public void testSearchAll() { - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - patient.addName().setFamily("Tester").addGiven("Joe"); - myPatientDao.create(patient, mySrd); - } - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("002"); - patient.addName().setFamily("Tester").addGiven("John"); - myPatientDao.create(patient, mySrd); - } - - SearchParameterMap params = new SearchParameterMap(); - params.setLoadSynchronous(true); - List patients = toList(myPatientDao.search(params)); - assertTrue(patients.size() >= 2); - } - - @Test - public void testSearchByIdParam() { - String id1; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - id1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless().getValue(); - } - String id2; - { - Organization patient = new Organization(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - id2 = myOrganizationDao.create(patient, mySrd).getId().toUnqualifiedVersionless().getValue(); - } - - SearchParameterMap params = new SearchParameterMap(); - params.setLoadSynchronous(true); - assertThat(toUnqualifiedVersionlessIdValues(myPatientDao.search(params)), contains(id1)); - - params = new SearchParameterMap(); - params.add("_id", new StringParam(id1)); - assertThat(toUnqualifiedVersionlessIdValues(myPatientDao.search(params)), contains(id1)); - - params = new SearchParameterMap(); - params.add("_id", new StringParam("9999999999999999")); - assertEquals(0, toList(myPatientDao.search(params)).size()); - - params = new SearchParameterMap(); - params.add("_id", new StringParam(id2)); - assertEquals(0, toList(myPatientDao.search(params)).size()); - - } - - @Test - public void testSearchByIdParamAnd() { - IIdType id1; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - id1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType id2; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - id2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - - SearchParameterMap params; - StringAndListParam param; - - params = new SearchParameterMap(); - param = new StringAndListParam(); - param.addAnd(new StringOrListParam().addOr(new StringParam(id1.getIdPart())).addOr(new StringParam(id2.getIdPart()))); - param.addAnd(new StringOrListParam().addOr(new StringParam(id1.getIdPart()))); - params.add("_id", param); - assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1)); - - params = new SearchParameterMap(); - param = new StringAndListParam(); - param.addAnd(new StringOrListParam().addOr(new StringParam(id2.getIdPart()))); - param.addAnd(new StringOrListParam().addOr(new StringParam(id1.getIdPart()))); - params.add("_id", param); - assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty()); - - params = new SearchParameterMap(); - param = new StringAndListParam(); - param.addAnd(new StringOrListParam().addOr(new StringParam(id2.getIdPart()))); - param.addAnd(new StringOrListParam().addOr(new StringParam("9999999999999"))); - params.add("_id", param); - assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty()); - - params = new SearchParameterMap(); - param = new StringAndListParam(); - param.addAnd(new StringOrListParam().addOr(new StringParam("9999999999999"))); - param.addAnd(new StringOrListParam().addOr(new StringParam(id2.getIdPart()))); - params.add("_id", param); - assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty()); - - } - - @Test - public void testSearchByIdParamOr() { - IIdType id1; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - id1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - TestUtil.sleepOneClick(); - long betweenTime = System.currentTimeMillis(); - IIdType id2; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - id2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - - SearchParameterMap params = new SearchParameterMap(); - params.add("_id", new StringOrListParam().addOr(new StringParam(id1.getIdPart())).addOr(new StringParam(id2.getIdPart()))); - assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1, id2)); - - params = new SearchParameterMap(); - params.add("_id", new StringOrListParam().addOr(new StringParam(id1.getIdPart())).addOr(new StringParam(id1.getIdPart()))); - assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1)); - - params = new SearchParameterMap(); - params.add("_id", new StringOrListParam().addOr(new StringParam(id1.getIdPart())).addOr(new StringParam("999999999999"))); - assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1)); - - // With lastupdated - - params = new SearchParameterMap(); - params.add("_id", new StringOrListParam().addOr(new StringParam(id1.getIdPart())).addOr(new StringParam(id2.getIdPart()))); - params.setLastUpdated(new DateRangeParam(new Date(betweenTime), null)); - assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id2)); - - } - - @Test - public void testSearchByIdParamWrongType() { - IIdType id1; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - id1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType id2; - { - Organization patient = new Organization(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - id2 = myOrganizationDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - - SearchParameterMap params = new SearchParameterMap(); - params.add("_id", new StringOrListParam().addOr(new StringParam(id1.getIdPart())).addOr(new StringParam(id2.getIdPart()))); - assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(id1)); - - } - - @Test - public void testSearchCode() { - Subscription subs = new Subscription(); - subs.setStatus(SubscriptionStatus.ACTIVE); - subs.getChannel().setType(SubscriptionChannelType.WEBSOCKET); - subs.setCriteria("Observation?"); - IIdType id = mySubscriptionDao.create(subs, mySrd).getId().toUnqualifiedVersionless(); - - SearchParameterMap params = new SearchParameterMap(); - assertThat(toUnqualifiedVersionlessIds(mySubscriptionDao.search(params)), contains(id)); - - params = new SearchParameterMap(); - params.add(Subscription.SP_TYPE, new TokenParam(null, SubscriptionChannelType.WEBSOCKET.toCode())); - params.add(Subscription.SP_STATUS, new TokenParam(null, SubscriptionStatus.ACTIVE.toCode())); - assertThat(toUnqualifiedVersionlessIds(mySubscriptionDao.search(params)), contains(id)); - - params = new SearchParameterMap(); - params.add(Subscription.SP_TYPE, new TokenParam(null, SubscriptionChannelType.WEBSOCKET.toCode())); - params.add(Subscription.SP_STATUS, new TokenParam(null, SubscriptionStatus.ACTIVE.toCode() + "2")); - assertThat(toUnqualifiedVersionlessIds(mySubscriptionDao.search(params)), empty()); - - // Wrong param - params = new SearchParameterMap(); - params.add(Subscription.SP_STATUS, new TokenParam(null, SubscriptionChannelType.WEBSOCKET.toCode())); - assertThat(toUnqualifiedVersionlessIds(mySubscriptionDao.search(params)), empty()); - } - - @Test - public void testSearchCompositeParam() { - Observation o1 = new Observation(); - o1.getCode().addCoding().setSystem("foo").setCode("testSearchCompositeParamN01"); - o1.setValue(new StringType("testSearchCompositeParamS01")); - IIdType id1 = myObservationDao.create(o1, mySrd).getId(); - - Observation o2 = new Observation(); - o2.getCode().addCoding().setSystem("foo").setCode("testSearchCompositeParamN01"); - o2.setValue(new StringType("testSearchCompositeParamS02")); - IIdType id2 = myObservationDao.create(o2, mySrd).getId(); - - { - TokenParam v0 = new TokenParam("foo", "testSearchCompositeParamN01"); - StringParam v1 = new StringParam("testSearchCompositeParamS01"); - CompositeParam val = new CompositeParam<>(v0, v1); - IBundleProvider result = myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_CODE_VALUE_STRING, val)); - assertEquals(1, result.size().intValue()); - assertEquals(id1.toUnqualifiedVersionless(), result.getResources(0, 1).get(0).getIdElement().toUnqualifiedVersionless()); - } - { - TokenParam v0 = new TokenParam("foo", "testSearchCompositeParamN01"); - StringParam v1 = new StringParam("testSearchCompositeParamS02"); - CompositeParam val = new CompositeParam<>(v0, v1); - IBundleProvider result = myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_CODE_VALUE_STRING, val)); - assertEquals(1, result.size().intValue()); - assertEquals(id2.toUnqualifiedVersionless(), result.getResources(0, 1).get(0).getIdElement().toUnqualifiedVersionless()); - } - } - - @Test - public void testSearchCompositeParamDate() { - Observation o1 = new Observation(); - o1.getCode().addCoding().setSystem("foo").setCode("testSearchCompositeParamDateN01"); - o1.setValue(new Period().setStartElement(new DateTimeType("2001-01-01T11:11:11Z")).setEndElement(new DateTimeType("2001-01-01T12:11:11Z"))); - IIdType id1 = myObservationDao.create(o1, mySrd).getId().toUnqualifiedVersionless(); - - Observation o2 = new Observation(); - o2.getCode().addCoding().setSystem("foo").setCode("testSearchCompositeParamDateN01"); - o2.setValue(new Period().setStartElement(new DateTimeType("2001-01-02T11:11:11Z")).setEndElement(new DateTimeType("2001-01-02T12:11:11Z"))); - IIdType id2 = myObservationDao.create(o2, mySrd).getId().toUnqualifiedVersionless(); - - { - TokenParam v0 = new TokenParam("foo", "testSearchCompositeParamDateN01"); - DateParam v1 = new DateParam("2001-01-01"); - CompositeParam val = new CompositeParam<>(v0, v1); - IBundleProvider result = myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_CODE_VALUE_DATE, val)); - assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(id1)); - } - { - TokenParam v0 = new TokenParam("foo", "testSearchCompositeParamDateN01"); - DateParam v1 = new DateParam(">2001-01-01T10:12:12Z"); - CompositeParam val = new CompositeParam<>(v0, v1); - IBundleProvider result = myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_CODE_VALUE_DATE, val)); - assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(id1, id2)); - } - { - TokenParam v0 = new TokenParam("foo", "testSearchCompositeParamDateN01"); - DateParam v1 = new DateParam("gt2001-01-01T11:12:12Z"); - CompositeParam val = new CompositeParam<>(v0, v1); - IBundleProvider result = myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_CODE_VALUE_DATE, val)); - assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(id1, id2)); - } - { - TokenParam v0 = new TokenParam("foo", "testSearchCompositeParamDateN01"); - DateParam v1 = new DateParam("gt2001-01-01T15:12:12Z"); - CompositeParam val = new CompositeParam<>(v0, v1); - IBundleProvider result = myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_CODE_VALUE_DATE, val)); - assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(id2)); - } - - } - - @Test - public void testComponentQuantity() { - Observation o1 = new Observation(); - o1.addComponent() - .setCode(new CodeableConcept().addCoding(new Coding().setSystem("http://foo").setCode("code1"))) - .setValue(new Quantity().setSystem("http://bar").setCode("code1").setValue(200)); - o1.addComponent() - .setCode(new CodeableConcept().addCoding(new Coding().setSystem("http://foo").setCode("code2"))) - .setValue(new Quantity().setSystem("http://bar").setCode("code2").setValue(200)); - IIdType id1 = myObservationDao.create(o1, mySrd).getId().toUnqualifiedVersionless(); - - String param = Observation.SP_COMPONENT_VALUE_QUANTITY; - - { - QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 150, "http://bar", "code1"); - SearchParameterMap map = new SearchParameterMap().setLoadSynchronous(true).add(param, v1); - IBundleProvider result = myObservationDao.search(map); - assertThat("Got: " + toUnqualifiedVersionlessIdValues(result), toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(id1.getValue())); - } - } - - @Test - public void testComponentQuantityWithNormalizedQuantitySearchSupported() { - - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); - Observation o1 = new Observation(); - o1.addComponent() - .setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm"))) - .setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm").setValue(1.2)); - o1.addComponent() - .setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("m"))) - .setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("mm").setValue(2)); - IIdType id1 = myObservationDao.create(o1, mySrd).getId().toUnqualifiedVersionless(); - - String param = Observation.SP_COMPONENT_VALUE_QUANTITY; - - { - QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 0.012, UcumServiceUtil.UCUM_CODESYSTEM_URL, "m"); - SearchParameterMap map = new SearchParameterMap().setLoadSynchronous(true).add(param, v1); - IBundleProvider result = myObservationDao.search(map); - assertThat("Got: " + toUnqualifiedVersionlessIdValues(result), toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(id1.getValue())); - } - } - - @Test - public void testComponentQuantityWithNormalizedQuantityStorageSupported() { - - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_STORAGE_SUPPORTED); - Observation o1 = new Observation(); - o1.addComponent() - .setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm"))) - .setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm").setValue(1.2)); - o1.addComponent() - .setCode(new CodeableConcept().addCoding(new Coding().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("m"))) - .setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("mm").setValue(2)); - IIdType id1 = myObservationDao.create(o1, mySrd).getId().toUnqualifiedVersionless(); - - String param = Observation.SP_COMPONENT_VALUE_QUANTITY; - - { - QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 1.2, UcumServiceUtil.UCUM_CODESYSTEM_URL, "cm"); - SearchParameterMap map = new SearchParameterMap().setLoadSynchronous(true).add(param, v1); - IBundleProvider result = myObservationDao.search(map); - assertThat("Got: " + toUnqualifiedVersionlessIdValues(result), toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(id1.getValue())); - } - } - - @Test - public void testSearchCompositeParamQuantity() { - Observation o1 = new Observation(); - o1.addComponent() - .setCode(new CodeableConcept().addCoding(new Coding().setSystem("http://foo").setCode("code1"))) - .setValue(new Quantity().setSystem("http://bar").setCode("code1").setValue(100)); - o1.addComponent() - .setCode(new CodeableConcept().addCoding(new Coding().setSystem("http://foo").setCode("code2"))) - .setValue(new Quantity().setSystem("http://bar").setCode("code2").setValue(100)); - IIdType id1 = myObservationDao.create(o1, mySrd).getId().toUnqualifiedVersionless(); - - Observation o2 = new Observation(); - o2.addComponent() - .setCode(new CodeableConcept().addCoding(new Coding().setSystem("http://foo").setCode("code1"))) - .setValue(new Quantity().setSystem("http://bar").setCode("code1").setValue(200)); - o2.addComponent() - .setCode(new CodeableConcept().addCoding(new Coding().setSystem("http://foo").setCode("code3"))) - .setValue(new Quantity().setSystem("http://bar").setCode("code2").setValue(200)); - IIdType id2 = myObservationDao.create(o2, mySrd).getId().toUnqualifiedVersionless(); - - String param = Observation.SP_COMPONENT_CODE_VALUE_QUANTITY; - - { - TokenParam v0 = new TokenParam("http://foo", "code1"); - QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 150, "http://bar", "code1"); - CompositeParam val = new CompositeParam<>(v0, v1); - SearchParameterMap map = new SearchParameterMap().setLoadSynchronous(true).add(param, val); - IBundleProvider result = myObservationDao.search(map); - assertThat("Got: " + toUnqualifiedVersionlessIdValues(result), toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(id2.getValue())); - } - { - TokenParam v0 = new TokenParam("http://foo", "code1"); - QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 50, "http://bar", "code1"); - CompositeParam val = new CompositeParam<>(v0, v1); - IBundleProvider result = myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(param, val)); - assertThat(toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(id1.getValue(), id2.getValue())); - } - { - TokenParam v0 = new TokenParam("http://foo", "code4"); - QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 50, "http://bar", "code1"); - CompositeParam val = new CompositeParam<>(v0, v1); - IBundleProvider result = myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(param, val)); - assertThat(toUnqualifiedVersionlessIdValues(result), empty()); - } - { - TokenParam v0 = new TokenParam("http://foo", "code1"); - QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 50, "http://bar", "code4"); - CompositeParam val = new CompositeParam<>(v0, v1); - IBundleProvider result = myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(param, val)); - assertThat(toUnqualifiedVersionlessIdValues(result), empty()); - } - } - - @Test - public void testSearchCompositeParamQuantityWithNormalizedQuantitySearchSupported() { - - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); - Observation o1 = new Observation(); - o1.addComponent() - .setCode(new CodeableConcept().addCoding(new Coding().setSystem("http://foo").setCode("code1"))) - .setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("dm").setValue(10)); // 0.1m - o1.addComponent() - .setCode(new CodeableConcept().addCoding(new Coding().setSystem("http://foo").setCode("code2"))) - .setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm").setValue(12));// 0.012m - IIdType id1 = myObservationDao.create(o1, mySrd).getId().toUnqualifiedVersionless(); - - Observation o2 = new Observation(); - o2.addComponent() - .setCode(new CodeableConcept().addCoding(new Coding().setSystem("http://foo").setCode("code1"))) - .setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("dm").setValue(20)); //0.2m - o2.addComponent() - .setCode(new CodeableConcept().addCoding(new Coding().setSystem("http://foo").setCode("code3"))) - .setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("dm").setValue(22)); //0.022m - IIdType id2 = myObservationDao.create(o2, mySrd).getId().toUnqualifiedVersionless(); - - String param = Observation.SP_COMPONENT_CODE_VALUE_QUANTITY; - - { - TokenParam v0 = new TokenParam("http://foo", "code1"); - QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 15, UcumServiceUtil.UCUM_CODESYSTEM_URL, "dm"); // 0.15m - CompositeParam val = new CompositeParam<>(v0, v1); - SearchParameterMap map = new SearchParameterMap().setLoadSynchronous(true).add(param, val); - IBundleProvider result = myObservationDao.search(map); - assertThat("Got: " + toUnqualifiedVersionlessIdValues(result), toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(id2.getValue())); - } - { - TokenParam v0 = new TokenParam("http://foo", "code1"); - QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 5, UcumServiceUtil.UCUM_CODESYSTEM_URL, "cm"); //0.05m - CompositeParam val = new CompositeParam<>(v0, v1); - IBundleProvider result = myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(param, val)); - assertThat(toUnqualifiedVersionlessIdValues(result), containsInAnyOrder(id1.getValue(), id2.getValue())); - } - { - TokenParam v0 = new TokenParam("http://foo", "code4"); - QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 5, UcumServiceUtil.UCUM_CODESYSTEM_URL, "cm"); //0.05m - CompositeParam val = new CompositeParam<>(v0, v1); - IBundleProvider result = myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(param, val)); - assertThat(toUnqualifiedVersionlessIdValues(result), empty()); - } - { - TokenParam v0 = new TokenParam("http://foo", "code1"); - QuantityParam v1 = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, 5, UcumServiceUtil.UCUM_CODESYSTEM_URL, "m"); //5m - CompositeParam val = new CompositeParam<>(v0, v1); - IBundleProvider result = myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(param, val)); - assertThat(toUnqualifiedVersionlessIdValues(result), empty()); - } - - } - - @Test - public void testSearchDateWrongParam() { - Patient p1 = new Patient(); - p1.getBirthDateElement().setValueAsString("1980-01-01"); - String id1 = myPatientDao.create(p1).getId().toUnqualifiedVersionless().getValue(); - - Patient p2 = new Patient(); - p2.setDeceased(new DateTimeType("1980-01-01")); - String id2 = myPatientDao.create(p2).getId().toUnqualifiedVersionless().getValue(); - - { - IBundleProvider found = myPatientDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Patient.SP_BIRTHDATE, new DateParam("1980-01-01"))); - assertThat(toUnqualifiedVersionlessIdValues(found), containsInAnyOrder(id1)); - assertEquals(1, found.size().intValue()); - } - { - IBundleProvider found = myPatientDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Patient.SP_DEATH_DATE, new DateParam("1980-01-01"))); - assertThat(toUnqualifiedVersionlessIdValues(found), containsInAnyOrder(id2)); - assertEquals(1, found.size().intValue()); - } - - } - - /** - * #222 - */ - @Test - public void testSearchForDeleted() { - - { - Patient patient = new Patient(); - patient.setId("TEST"); - patient.setLanguageElement(new CodeType("TEST")); - patient.addName().setFamily("TEST"); - patient.addIdentifier().setSystem("TEST").setValue("TEST"); - myPatientDao.update(patient, mySrd); - } - - SearchParameterMap params; - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add("_id", new StringParam("TEST")); - assertEquals(1, toList(myPatientDao.search(params)).size()); - - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST")); - assertEquals(1, toList(myPatientDao.search(params)).size()); - - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add(Patient.SP_NAME, new StringParam("TEST")); - assertEquals(1, toList(myPatientDao.search(params)).size()); - - myPatientDao.delete(new IdType("Patient/TEST"), mySrd); - - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add("_id", new StringParam("TEST")); - assertEquals(0, toList(myPatientDao.search(params)).size()); - - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add(Patient.SP_IDENTIFIER, new TokenParam("TEST", "TEST")); - assertEquals(0, toList(myPatientDao.search(params)).size()); - - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add(Patient.SP_NAME, new StringParam("TEST")); - assertEquals(0, toList(myPatientDao.search(params)).size()); - - } - - @Test - public void testSearchForUnknownAlphanumericId() { - { - SearchParameterMap map = new SearchParameterMap(); - map.add("_id", new StringParam("testSearchForUnknownAlphanumericId")); - IBundleProvider retrieved = myPatientDao.search(map); - assertEquals(0, retrieved.size().intValue()); - } - } - - @Test - public void testSearchLastUpdatedParam() { - String methodName = "testSearchLastUpdatedParam"; - - TestUtil.sleepOneClick(); - - DateTimeType beforeAny = new DateTimeType(new Date(), TemporalPrecisionEnum.MILLI); - IIdType id1a; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - patient.addName().setFamily(methodName).addGiven("Joe"); - id1a = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType id1b; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("002"); - patient.addName().setFamily(methodName + "XXXX").addGiven("Joe"); - id1b = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - - ca.uhn.fhir.util.TestUtil.sleepAtLeast(1100); - DateTimeType beforeR2 = new DateTimeType(new Date(), TemporalPrecisionEnum.MILLI); - ca.uhn.fhir.util.TestUtil.sleepAtLeast(1100); - - IIdType id2; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("002"); - patient.addName().setFamily(methodName).addGiven("John"); - id2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - - { - SearchParameterMap params = new SearchParameterMap(); - List patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(patients, hasItems(id1a, id1b, id2)); - } - { - SearchParameterMap params = new SearchParameterMap(); - params.setLastUpdated(new DateRangeParam(beforeAny, null)); - List patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(patients, hasItems(id1a, id1b, id2)); - } - { - SearchParameterMap params = new SearchParameterMap(); - params.setLastUpdated(new DateRangeParam(beforeR2, null)); - List patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(patients, hasItems(id2)); - assertDoesNotContainAnyOf(patients, List.of(id1a, id1b)); - } - { - SearchParameterMap params = new SearchParameterMap(); - params.setLastUpdated(new DateRangeParam(beforeAny, beforeR2)); - List patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(patients.toString(), patients, not(hasItem(id2))); - assertThat(patients.toString(), patients, (hasItems(id1a, id1b))); - } - { - SearchParameterMap params = new SearchParameterMap(); - params.setLastUpdated(new DateRangeParam(null, beforeR2)); - List patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(patients, (hasItems(id1a, id1b))); - assertThat(patients, not(hasItem(id2))); - } - - - { - SearchParameterMap params = new SearchParameterMap(); - params.setLastUpdated(new DateRangeParam(new DateParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, beforeR2))); - List patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertDoesNotContainAnyOf(patients, List.of(id1a, id1b)); - assertThat(patients, (hasItems(id2))); - } - { - SearchParameterMap params = new SearchParameterMap(); - params.setLastUpdated(new DateRangeParam(new DateParam(ParamPrefixEnum.LESSTHAN_OR_EQUALS, beforeR2))); - List patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(patients, (hasItems(id1a, id1b))); - assertThat(patients, not(hasItem(id2))); - } - - } - - @Test - public void testSearchLastUpdatedParamWithComparator() { - IIdType id0; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - id0 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - - TestUtil.sleepOneClick(); - - long start = System.currentTimeMillis(); - - TestUtil.sleepOneClick(); - - IIdType id1a; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - id1a = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - - TestUtil.sleepOneClick(); - - IIdType id1b; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - id1b = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - - ourLog.info("Res 1: {}", myPatientDao.read(id0, mySrd).getMeta().getLastUpdatedElement().getValueAsString()); - ourLog.info("Res 2: {}", myPatientDao.read(id1a, mySrd).getMeta().getLastUpdatedElement().getValueAsString()); - ourLog.info("Res 3: {}", myPatientDao.read(id1b, mySrd).getMeta().getLastUpdatedElement().getValueAsString()); - - TestUtil.sleepOneClick(); - - long end = System.currentTimeMillis(); - - SearchParameterMap map; - Date startDate = new Date(start); - TestUtil.sleepOneClick(); - Date endDate = new Date(end); - DateTimeType startDateTime = new DateTimeType(startDate, TemporalPrecisionEnum.MILLI); - DateTimeType endDateTime = new DateTimeType(endDate, TemporalPrecisionEnum.MILLI); - - map = new SearchParameterMap(); - map.setLastUpdated(new DateRangeParam(startDateTime, endDateTime)); - ourLog.info("Searching: {}", map.getLastUpdated()); - assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(map)), containsInAnyOrder(id1a, id1b)); - - map = new SearchParameterMap(); - map.setLastUpdated(new DateRangeParam(new DateParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, startDateTime), new DateParam(ParamPrefixEnum.LESSTHAN_OR_EQUALS, endDateTime))); - ourLog.info("Searching: {}", map.getLastUpdated()); - assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(map)), containsInAnyOrder(id1a, id1b)); - - map = new SearchParameterMap(); - map.setLastUpdated(new DateRangeParam(new DateParam(ParamPrefixEnum.GREATERTHAN, startDateTime), new DateParam(ParamPrefixEnum.LESSTHAN, endDateTime))); - ourLog.info("Searching: {}", map.getLastUpdated()); - assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(map)), containsInAnyOrder(id1a, id1b)); - - map = new SearchParameterMap(); - map.setLastUpdated(new DateRangeParam(new DateParam(ParamPrefixEnum.GREATERTHAN, startDateTime.getValue()), - new DateParam(ParamPrefixEnum.LESSTHAN, TestUtil.getTimestamp(myPatientDao.read(id1b, mySrd))))); - ourLog.info("Searching: {}", map.getLastUpdated()); - assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(map)), containsInAnyOrder(id1a)); - } - - @Test - public void testSearchNameParam() { - IIdType id1; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - patient.addName().setFamily("testSearchNameParam01Fam").addGiven("testSearchNameParam01Giv"); - id1 = myPatientDao.create(patient, mySrd).getId(); - } - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("002"); - patient.addName().setFamily("testSearchNameParam02Fam").addGiven("testSearchNameParam02Giv"); - myPatientDao.create(patient, mySrd); - } - - SearchParameterMap params; - - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add(Patient.SP_FAMILY, new StringParam("testSearchNameParam01Fam")); - List patients = toList(myPatientDao.search(params)); - assertEquals(1, patients.size()); - assertEquals(id1.getIdPart(), patients.get(0).getIdElement().getIdPart()); - - // Given name shouldn't return for family param - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add(Patient.SP_FAMILY, new StringParam("testSearchNameParam01Giv")); - patients = toList(myPatientDao.search(params)); - assertEquals(0, patients.size()); - - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add(Patient.SP_NAME, new StringParam("testSearchNameParam01Fam")); - patients = toList(myPatientDao.search(params)); - assertEquals(1, patients.size()); - assertEquals(id1.getIdPart(), patients.get(0).getIdElement().getIdPart()); - - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add(Patient.SP_NAME, new StringParam("testSearchNameParam01Giv")); - patients = toList(myPatientDao.search(params)); - assertEquals(1, patients.size()); - assertEquals(id1.getIdPart(), patients.get(0).getIdElement().getIdPart()); - - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add(Patient.SP_FAMILY, new StringParam("testSearchNameParam01Foo")); - patients = toList(myPatientDao.search(params)); - assertEquals(0, patients.size()); - - } - - /** - * TODO: currently this doesn't index, we should get it working - */ - @Test - public void testSearchNearParam() { - { - Location loc = new Location(); - loc.getPosition().setLatitude(43.7); - loc.getPosition().setLatitude(79.4); - myLocationDao.create(loc, mySrd); - } - } - - @Test - public void testSearchNumberParam() { - RiskAssessment e1 = new RiskAssessment(); - e1.addIdentifier().setSystem("foo").setValue("testSearchNumberParam01"); - e1.addPrediction().setProbability(new DecimalType(4 * 24 * 60)); - IIdType id1 = myRiskAssessmentDao.create(e1, mySrd).getId(); - - RiskAssessment e2 = new RiskAssessment(); - e2.addIdentifier().setSystem("foo").setValue("testSearchNumberParam02"); - e2.addPrediction().setProbability(new DecimalType(4)); - IIdType id2 = myRiskAssessmentDao.create(e2, mySrd).getId(); - { - IBundleProvider found = myRiskAssessmentDao.search(new SearchParameterMap().setLoadSynchronous(true).add(RiskAssessment.SP_PROBABILITY, new NumberParam(">2"))); - assertEquals(2, found.size().intValue()); - assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1.toUnqualifiedVersionless(), id2.toUnqualifiedVersionless())); - } - { - IBundleProvider found = myRiskAssessmentDao.search(new SearchParameterMap().setLoadSynchronous(true).add(RiskAssessment.SP_PROBABILITY, new NumberParam("<1"))); - assertEquals(0, found.size().intValue()); - } - { - IBundleProvider found = myRiskAssessmentDao.search(new SearchParameterMap().setLoadSynchronous(true).add(RiskAssessment.SP_PROBABILITY, new NumberParam("4"))); - assertEquals(1, found.size().intValue()); - assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id2.toUnqualifiedVersionless())); - } - } - - @Test - public void testSearchNumberWrongParam() { - MolecularSequence ir1 = new MolecularSequence(); - ir1.addVariant().setStart(1); - String id1 = myMolecularSequenceDao.create(ir1).getId().toUnqualifiedVersionless().getValue(); - - MolecularSequence ir2 = new MolecularSequence(); - ir2.addVariant().setStart(2); - String id2 = myMolecularSequenceDao.create(ir2).getId().toUnqualifiedVersionless().getValue(); - - { - IBundleProvider found = myMolecularSequenceDao.search(new SearchParameterMap().setLoadSynchronous(true).add(MolecularSequence.SP_VARIANT_START, new NumberParam("1"))); - assertThat(toUnqualifiedVersionlessIdValues(found), containsInAnyOrder(id1)); - assertEquals(1, found.size().intValue()); - } - { - IBundleProvider found = myMolecularSequenceDao.search(new SearchParameterMap().setLoadSynchronous(true).add(MolecularSequence.SP_VARIANT_END, new NumberParam("1"))); - assertThat(toUnqualifiedVersionlessIdValues(found), empty()); - assertEquals(0, found.size().intValue()); - } - - } - - /** - * When a valueset expansion returns no codes - */ - @Test - public void testSearchOnCodesWithNone() { - ValueSet vs = new ValueSet(); - vs.setUrl("urn:testSearchOnCodesWithNone"); - myValueSetDao.create(vs); - - Patient p1 = new Patient(); - p1.setGender(AdministrativeGender.MALE); - String id1 = myPatientDao.create(p1).getId().toUnqualifiedVersionless().getValue(); - - Patient p2 = new Patient(); - p2.setGender(AdministrativeGender.FEMALE); - String id2 = myPatientDao.create(p2).getId().toUnqualifiedVersionless().getValue(); - - { - IBundleProvider found = myPatientDao - .search(new SearchParameterMap().setLoadSynchronous(true).add(Patient.SP_GENDER, new TokenParam().setModifier(TokenParamModifier.IN).setValue("urn:testSearchOnCodesWithNone"))); - assertThat(toUnqualifiedVersionlessIdValues(found), empty()); - assertEquals(0, found.size().intValue()); - } - - } - - @Test - public void testSearchParamChangesType() { - String name = "testSearchParamChangesType"; - IIdType id; - { - Patient patient = new Patient(); - patient.addName().setFamily(name); - id = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - - SearchParameterMap params; - - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add(Patient.SP_FAMILY, new StringParam(name)); - List patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(patients, contains(id)); - - Patient patient = new Patient(); - patient.addIdentifier().setSystem(name).setValue(name); - patient.setId(id); - myPatientDao.update(patient, mySrd); - - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add(Patient.SP_FAMILY, new StringParam(name)); - patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(patients, not(hasItem(id))); - - } - - @Test - public void testSearchPractitionerPhoneAndEmailParam() { - String methodName = "testSearchPractitionerPhoneAndEmailParam"; - IIdType id1; - { - Practitioner patient = new Practitioner(); - patient.addName().setFamily(methodName); - patient.addTelecom().setSystem(ContactPointSystem.PHONE).setValue("123"); - id1 = myPractitionerDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType id2; - { - Practitioner patient = new Practitioner(); - patient.addName().setFamily(methodName); - patient.addTelecom().setSystem(ContactPointSystem.EMAIL).setValue("abc"); - id2 = myPractitionerDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - - SearchParameterMap params; - List patients; - - params = new SearchParameterMap(); - params.add(Practitioner.SP_FAMILY, new StringParam(methodName)); - params.add(Practitioner.SP_EMAIL, new TokenParam(null, "123")); - patients = toUnqualifiedVersionlessIds(myPractitionerDao.search(params)); - assertEquals(0, patients.size()); - - params = new SearchParameterMap(); - params.add(Practitioner.SP_FAMILY, new StringParam(methodName)); - patients = toUnqualifiedVersionlessIds(myPractitionerDao.search(params)); - assertEquals(2, patients.size()); - assertThat(patients, containsInAnyOrder(id1, id2)); - - params = new SearchParameterMap(); - params.add(Practitioner.SP_FAMILY, new StringParam(methodName)); - params.add(Practitioner.SP_EMAIL, new TokenParam(null, "abc")); - patients = toUnqualifiedVersionlessIds(myPractitionerDao.search(params)); - assertEquals(1, patients.size()); - assertThat(patients, containsInAnyOrder(id2)); - - params = new SearchParameterMap(); - params.add(Practitioner.SP_FAMILY, new StringParam(methodName)); - params.add(Practitioner.SP_PHONE, new TokenParam(null, "123")); - patients = toUnqualifiedVersionlessIds(myPractitionerDao.search(params)); - assertEquals(1, patients.size()); - assertThat(patients, containsInAnyOrder(id1)); - - } - - @Test - public void testSearchQuantityWrongParam() { - Condition c1 = new Condition(); - c1.setAbatement(new Range().setLow(new SimpleQuantity().setValue(1L)).setHigh(new SimpleQuantity().setValue(1L))); - String id1 = myConditionDao.create(c1).getId().toUnqualifiedVersionless().getValue(); - - Condition c2 = new Condition(); - c2.setOnset(new Range().setLow(new SimpleQuantity().setValue(1L)).setHigh(new SimpleQuantity().setValue(1L))); - String id2 = myConditionDao.create(c2).getId().toUnqualifiedVersionless().getValue(); - - { - IBundleProvider found = myConditionDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Condition.SP_ABATEMENT_AGE, new QuantityParam("1"))); - assertThat(toUnqualifiedVersionlessIdValues(found), containsInAnyOrder(id1)); - assertEquals(1, found.size().intValue()); - } - { - IBundleProvider found = myConditionDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Condition.SP_ONSET_AGE, new QuantityParam("1"))); - assertThat(toUnqualifiedVersionlessIdValues(found), containsInAnyOrder(id2)); - assertEquals(1, found.size().intValue()); - } - - } - - @Test - public void testSearchResourceLinkWithChain() { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("testSearchResourceLinkWithChainXX"); - patient.addIdentifier().setSystem("urn:system").setValue("testSearchResourceLinkWithChain01"); - IIdType patientId01 = myPatientDao.create(patient, mySrd).getId(); - - Patient patient02 = new Patient(); - patient02.addIdentifier().setSystem("urn:system").setValue("testSearchResourceLinkWithChainXX"); - patient02.addIdentifier().setSystem("urn:system").setValue("testSearchResourceLinkWithChain02"); - IIdType patientId02 = myPatientDao.create(patient02, mySrd).getId(); - - Observation obs01 = new Observation(); - obs01.setEffective(new DateTimeType(new Date())); - obs01.setSubject(new Reference(patientId01)); - IIdType obsId01 = myObservationDao.create(obs01, mySrd).getId(); - - Observation obs02 = new Observation(); - obs02.setEffective(new DateTimeType(new Date())); - obs02.setSubject(new Reference(patientId02)); - IIdType obsId02 = myObservationDao.create(obs02, mySrd).getId(); - - // Create another type, that shouldn't be returned - DiagnosticReport dr01 = new DiagnosticReport(); - dr01.setSubject(new Reference(patientId01)); - IIdType drId01 = myDiagnosticReportDao.create(dr01, mySrd).getId(); - - ourLog.info("P1[{}] P2[{}] O1[{}] O2[{}] D1[{}]", patientId01, patientId02, obsId01, obsId02, drId01); - - List result = toList(myObservationDao - .search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_IDENTIFIER, "urn:system|testSearchResourceLinkWithChain01")))); - assertEquals(1, result.size()); - assertEquals(obsId01.getIdPart(), result.get(0).getIdElement().getIdPart()); - - result = toList(myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_PATIENT, new ReferenceParam(patientId01.getIdPart())))); - assertEquals(1, result.size()); - - result = toList(myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_PATIENT, new ReferenceParam(patientId01.getIdPart())))); - assertEquals(1, result.size()); - - result = toList(myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_IDENTIFIER, "999999999999")))); - assertEquals(0, result.size()); - - result = toList(myObservationDao - .search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_IDENTIFIER, "urn:system|testSearchResourceLinkWithChainXX")))); - assertEquals(2, result.size()); - - result = toList( - myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_IDENTIFIER, "testSearchResourceLinkWithChainXX")))); - assertEquals(2, result.size()); - - result = toList( - myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_IDENTIFIER, "|testSearchResourceLinkWithChainXX")))); - assertEquals(0, result.size()); - - } - - @Test - public void testSearchResourceLinkWithChainDouble() { - String methodName = "testSearchResourceLinkWithChainDouble"; - - Organization org = new Organization(); - org.setName(methodName); - IIdType orgId01 = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - - Location locParent = new Location(); - locParent.setManagingOrganization(new Reference(orgId01)); - IIdType locParentId = myLocationDao.create(locParent, mySrd).getId().toUnqualifiedVersionless(); - - Location locChild = new Location(); - locChild.setPartOf(new Reference(locParentId)); - IIdType locChildId = myLocationDao.create(locChild, mySrd).getId().toUnqualifiedVersionless(); - - Location locGrandchild = new Location(); - locGrandchild.setPartOf(new Reference(locChildId)); - IIdType locGrandchildId = myLocationDao.create(locGrandchild, mySrd).getId().toUnqualifiedVersionless(); - - IBundleProvider found; - ReferenceParam param; - - found = myLocationDao.search(new SearchParameterMap().setLoadSynchronous(true).add("organization", new ReferenceParam(orgId01.getIdPart()))); - assertEquals(1, found.size().intValue()); - assertEquals(locParentId, found.getResources(0, 1).get(0).getIdElement().toUnqualifiedVersionless()); - - param = new ReferenceParam(orgId01.getIdPart()); - param.setChain("organization"); - found = myLocationDao.search(new SearchParameterMap().setLoadSynchronous(true).add("partof", param)); - assertEquals(1, found.size().intValue()); - assertEquals(locChildId, found.getResources(0, 1).get(0).getIdElement().toUnqualifiedVersionless()); - - param = new ReferenceParam(orgId01.getIdPart()); - param.setChain("partof.organization"); - found = myLocationDao.search(new SearchParameterMap().setLoadSynchronous(true).add("partof", param)); - assertEquals(1, found.size().intValue()); - assertEquals(locGrandchildId, found.getResources(0, 1).get(0).getIdElement().toUnqualifiedVersionless()); - - param = new ReferenceParam(methodName); - param.setChain("partof.organization.name"); - found = myLocationDao.search(new SearchParameterMap().setLoadSynchronous(true).add("partof", param)); - assertEquals(1, found.size().intValue()); - assertEquals(locGrandchildId, found.getResources(0, 1).get(0).getIdElement().toUnqualifiedVersionless()); - } - - @Test - public void testSearchResourceLinkWithChainWithMultipleTypes() throws Exception { - Patient patient = new Patient(); - patient.addName().setFamily("testSearchResourceLinkWithChainWithMultipleTypes01"); - patient.addName().setFamily("testSearchResourceLinkWithChainWithMultipleTypesXX"); - IIdType patientId01 = myPatientDao.create(patient, mySrd).getId(); - - Location loc01 = new Location(); - loc01.getNameElement().setValue("testSearchResourceLinkWithChainWithMultipleTypes01"); - IIdType locId01 = myLocationDao.create(loc01, mySrd).getId(); - - Observation obs01 = new Observation(); - obs01.setEffective(new DateTimeType(new Date())); - obs01.setSubject(new Reference(patientId01)); - IIdType obsId01 = myObservationDao.create(obs01, mySrd).getId().toUnqualifiedVersionless(); - - Date between = new Date(); - TestUtil.sleepOneClick(); - - Observation obs02 = new Observation(); - obs02.setEffective(new DateTimeType(new Date())); - obs02.setSubject(new Reference(locId01)); - IIdType obsId02 = myObservationDao.create(obs02, mySrd).getId().toUnqualifiedVersionless(); - - TestUtil.sleepOneClick(); - Date after = new Date(); - - ourLog.info("P1[{}] L1[{}] Obs1[{}] Obs2[{}]", patientId01, locId01, obsId01, obsId02); - - List result; - SearchParameterMap params; - - result = toUnqualifiedVersionlessIds(myObservationDao - .search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_NAME, "testSearchResourceLinkWithChainWithMultipleTypesXX")))); - assertThat(result, containsInAnyOrder(obsId01)); - assertEquals(1, result.size()); - - result = toUnqualifiedVersionlessIds(myObservationDao.search( - new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam("Patient", Patient.SP_NAME, "testSearchResourceLinkWithChainWithMultipleTypes01")))); - assertThat(result, containsInAnyOrder(obsId01)); - assertEquals(1, result.size()); - - params = new SearchParameterMap(); - params.add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_NAME, "testSearchResourceLinkWithChainWithMultipleTypes01")); - result = toUnqualifiedVersionlessIds(myObservationDao.search(params)); - assertEquals(2, result.size()); - assertThat(result, containsInAnyOrder(obsId01, obsId02)); - - params = new SearchParameterMap(); - params.add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_NAME, "testSearchResourceLinkWithChainWithMultipleTypes01")); - params.setLastUpdated(new DateRangeParam(between, after)); - result = toUnqualifiedVersionlessIds(myObservationDao.search(params)); - assertEquals(1, result.size()); - assertThat(result, containsInAnyOrder(obsId02)); - - result = toUnqualifiedVersionlessIds(myObservationDao - .search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam(Patient.SP_NAME, "testSearchResourceLinkWithChainWithMultipleTypesYY")))); - assertEquals(0, result.size()); - - } - - @Test - public void testSearchResourceLinkWithTextLogicalId() { - Patient patient = new Patient(); - patient.setId("testSearchResourceLinkWithTextLogicalId01"); - patient.addIdentifier().setSystem("urn:system").setValue("testSearchResourceLinkWithTextLogicalIdXX"); - patient.addIdentifier().setSystem("urn:system").setValue("testSearchResourceLinkWithTextLogicalId01"); - IIdType patientId01 = myPatientDao.update(patient, mySrd).getId(); - - Patient patient02 = new Patient(); - patient02.setId("testSearchResourceLinkWithTextLogicalId02"); - patient02.addIdentifier().setSystem("urn:system").setValue("testSearchResourceLinkWithTextLogicalIdXX"); - patient02.addIdentifier().setSystem("urn:system").setValue("testSearchResourceLinkWithTextLogicalId02"); - IIdType patientId02 = myPatientDao.update(patient02, mySrd).getId(); - - Observation obs01 = new Observation(); - obs01.setEffective(new DateTimeType(new Date())); - obs01.setSubject(new Reference(patientId01)); - IIdType obsId01 = myObservationDao.create(obs01, mySrd).getId(); - - Observation obs02 = new Observation(); - obs02.setEffective(new DateTimeType(new Date())); - obs02.setSubject(new Reference(patientId02)); - IIdType obsId02 = myObservationDao.create(obs02, mySrd).getId(); - - // Create another type, that shouldn't be returned - DiagnosticReport dr01 = new DiagnosticReport(); - dr01.setSubject(new Reference(patientId01)); - IIdType drId01 = myDiagnosticReportDao.create(dr01, mySrd).getId(); - - ourLog.info("P1[{}] P2[{}] O1[{}] O2[{}] D1[{}]", patientId01, patientId02, obsId01, obsId02, drId01); - - List result = toList( - myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam("testSearchResourceLinkWithTextLogicalId01")))); - assertEquals(1, result.size()); - assertEquals(obsId01.getIdPart(), result.get(0).getIdElement().getIdPart()); - - result = toList(myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam("testSearchResourceLinkWithTextLogicalId99")))); - assertEquals(0, result.size()); - - result = toList(myObservationDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Observation.SP_SUBJECT, new ReferenceParam("999999999999999")))); - assertEquals(0, result.size()); - - } - - @SuppressWarnings("unused") - @Test - public void testSearchResourceReferenceOnlyCorrectPath() { - IIdType oid1; - { - Organization org = new Organization(); - org.setActive(true); - oid1 = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType tid1; - { - Task task = new Task(); - task.setRequester(new Reference(oid1)); - tid1 = myTaskDao.create(task, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType tid2; - { - Task task = new Task(); - task.setOwner(new Reference(oid1)); - tid2 = myTaskDao.create(task, mySrd).getId().toUnqualifiedVersionless(); - } - - SearchParameterMap map; - List ids; - - map = new SearchParameterMap(); - map.add(Task.SP_REQUESTER, new ReferenceParam(oid1.getValue())); - ids = toUnqualifiedVersionlessIds(myTaskDao.search(map)); - assertThat(ids, contains(tid1)); // NOT tid2 - - } - - @Test - public void testSearchStringParam() { - IIdType pid1; - IIdType pid2; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - patient.addName().setFamily("Tester_testSearchStringParam").addGiven("Joe"); - pid1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - TestUtil.sleepOneClick(); - Date between = new Date(); - TestUtil.sleepOneClick(); - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("002"); - patient.addName().setFamily("Tester_testSearchStringParam").addGiven("John"); - pid2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - TestUtil.sleepOneClick(); - Date after = new Date(); - - SearchParameterMap params; - List patients; - - params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("Tester_testSearchStringParam")); - params.setLastUpdated(new DateRangeParam(between, after)); - patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(patients, containsInAnyOrder(pid2)); - - params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("Tester_testSearchStringParam")); - patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(patients, containsInAnyOrder(pid1, pid2)); - assertEquals(2, patients.size()); - - params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("FOO_testSearchStringParam")); - patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertEquals(0, patients.size()); - - // Try with different casing - - params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("tester_testsearchstringparam")); - patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(patients, containsInAnyOrder(pid1, pid2)); - assertEquals(2, patients.size()); - - params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("TESTER_TESTSEARCHSTRINGPARAM")); - patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(patients, containsInAnyOrder(pid1, pid2)); - assertEquals(2, patients.size()); - } - - @Test - public void testSearchStringParamDoesntMatchWrongType() { - IIdType pid1; - IIdType pid2; - { - Patient patient = new Patient(); - patient.addName().setFamily("HELLO"); - pid1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - { - Practitioner patient = new Practitioner(); - patient.addName().setFamily("HELLO"); - pid2 = myPractitionerDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - - SearchParameterMap params; - List patients; - - params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("HELLO")); - patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(patients, containsInAnyOrder(pid1)); - assertThat(patients, not(hasItem(pid2))); - } - - @Test - public void testSearchStringParamReallyLong() { - String methodName = "testSearchStringParamReallyLong"; - String value = StringUtils.rightPad(methodName, 200, 'a'); - - IIdType longId; - IIdType shortId; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - patient.addName().setFamily(value); - longId = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("002"); - shortId = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - - SearchParameterMap params; - - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - - String substring = value.substring(0, ResourceIndexedSearchParamString.MAX_LENGTH); - params.add(Patient.SP_FAMILY, new StringParam(substring)); - IBundleProvider found = myPatientDao.search(params); - assertEquals(1, toList(found).size()); - assertThat(toUnqualifiedVersionlessIds(found), contains(longId)); - assertThat(toUnqualifiedVersionlessIds(found), not(hasItem(shortId))); - - } - - @Test - public void testSearchStringParamWithNonNormalized() { - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - patient.addName().addGiven("testSearchStringParamWithNonNormalized_h\u00F6ra"); - myPatientDao.create(patient, mySrd); - } - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("002"); - patient.addName().addGiven("testSearchStringParamWithNonNormalized_HORA"); - myPatientDao.create(patient, mySrd); - } - - SearchParameterMap params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add(Patient.SP_GIVEN, new StringParam("testSearchStringParamWithNonNormalized_hora")); - List patients = toList(myPatientDao.search(params)); - assertEquals(2, patients.size()); - - StringParam parameter = new StringParam("testSearchStringParamWithNonNormalized_hora"); - parameter.setExact(true); - params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add(Patient.SP_GIVEN, parameter); - patients = toList(myPatientDao.search(params)); - assertEquals(0, patients.size()); - - } - - @Test - public void testSearchStringWrongParam() { - Patient p1 = new Patient(); - p1.getNameFirstRep().setFamily("AAA"); - String id1 = myPatientDao.create(p1).getId().toUnqualifiedVersionless().getValue(); - - Patient p2 = new Patient(); - p2.getNameFirstRep().addGiven("AAA"); - String id2 = myPatientDao.create(p2).getId().toUnqualifiedVersionless().getValue(); - - { - IBundleProvider found = myPatientDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Patient.SP_FAMILY, new StringParam("AAA"))); - assertThat(toUnqualifiedVersionlessIdValues(found), containsInAnyOrder(id1)); - assertEquals(1, found.size().intValue()); - } - { - IBundleProvider found = myPatientDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Patient.SP_GIVEN, new StringParam("AAA"))); - assertThat(toUnqualifiedVersionlessIdValues(found), containsInAnyOrder(id2)); - assertEquals(1, found.size().intValue()); - } - - } - - @Test - public void testSearchTokenParam() { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("testSearchTokenParam001"); - patient.addName().setFamily("Tester").addGiven("testSearchTokenParam1"); - patient.addCommunication().getLanguage().setText("testSearchTokenParamComText").addCoding().setCode("testSearchTokenParamCode").setSystem("testSearchTokenParamSystem") - .setDisplay("testSearchTokenParamDisplay"); - myPatientDao.create(patient, mySrd); - - patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("testSearchTokenParam002"); - patient.addName().setFamily("Tester").addGiven("testSearchTokenParam2"); - myPatientDao.create(patient, mySrd); - - { - SearchParameterMap map = new SearchParameterMap(); - map.add(Patient.SP_IDENTIFIER, new TokenParam("urn:system", "testSearchTokenParam001")); - IBundleProvider retrieved = myPatientDao.search(map); - assertEquals(1, retrieved.size().intValue()); - } - { - SearchParameterMap map = new SearchParameterMap(); - map.add(Patient.SP_IDENTIFIER, new TokenParam(null, "testSearchTokenParam001")); - IBundleProvider retrieved = myPatientDao.search(map); - assertEquals(1, retrieved.size().intValue()); - } - { - SearchParameterMap map = new SearchParameterMap(); - map.add(Patient.SP_LANGUAGE, new TokenParam("testSearchTokenParamSystem", "testSearchTokenParamCode")); - assertEquals(1, myPatientDao.search(map).size().intValue()); - } - { - SearchParameterMap map = new SearchParameterMap(); - map.add(Patient.SP_LANGUAGE, new TokenParam(null, "testSearchTokenParamCode", true)); - assertEquals(0, myPatientDao.search(map).size().intValue()); - } - { - // Complete match - SearchParameterMap map = new SearchParameterMap(); - map.add(Patient.SP_LANGUAGE, new TokenParam(null, "testSearchTokenParamComText", true)); - assertEquals(1, myPatientDao.search(map).size().intValue()); - } - { - // Left match - SearchParameterMap map = new SearchParameterMap(); - map.add(Patient.SP_LANGUAGE, new TokenParam(null, "testSearchTokenParamcomtex", true)); - assertEquals(1, myPatientDao.search(map).size().intValue()); - } - { - // Right match - SearchParameterMap map = new SearchParameterMap(); - map.add(Patient.SP_LANGUAGE, new TokenParam(null, "testSearchTokenParamComTex", true)); - assertEquals(1, myPatientDao.search(map).size().intValue()); - } - { - SearchParameterMap map = new SearchParameterMap(); - TokenOrListParam listParam = new TokenOrListParam(); - listParam.add("urn:system", "testSearchTokenParam001"); - listParam.add("urn:system", "testSearchTokenParam002"); - map.add(Patient.SP_IDENTIFIER, listParam); - IBundleProvider retrieved = myPatientDao.search(map); - assertEquals(2, retrieved.size().intValue()); - } - { - SearchParameterMap map = new SearchParameterMap(); - TokenOrListParam listParam = new TokenOrListParam(); - listParam.add(null, "testSearchTokenParam001"); - listParam.add("urn:system", "testSearchTokenParam002"); - map.add(Patient.SP_IDENTIFIER, listParam); - IBundleProvider retrieved = myPatientDao.search(map); - assertEquals(2, retrieved.size().intValue()); - } - } - - @Test - public void testSearchTokenParamNoValue() { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("testSearchTokenParam001"); - patient.addName().setFamily("Tester").addGiven("testSearchTokenParam1"); - patient.addCommunication().getLanguage().setText("testSearchTokenParamComText").addCoding().setCode("testSearchTokenParamCode").setSystem("testSearchTokenParamSystem") - .setDisplay("testSearchTokenParamDisplay"); - String id1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless().getValue(); - - patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("testSearchTokenParam002"); - patient.addName().setFamily("Tester").addGiven("testSearchTokenParam2"); - String id2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless().getValue(); - - patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue(null); - patient.addName().setFamily("Tester").addGiven("testSearchTokenParam2"); - String id3 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless().getValue(); - - patient = new Patient(); - patient.addIdentifier().setSystem("urn:system2").setValue("testSearchTokenParam002"); - patient.addName().setFamily("Tester").addGiven("testSearchTokenParam2"); - String id4 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless().getValue(); - - { - SearchParameterMap map = SearchParameterMap.newSynchronous(); - map.add(Patient.SP_IDENTIFIER, new TokenParam("urn:system", null)); - myCaptureQueriesListener.clear(); - List values = toUnqualifiedVersionlessIdValues(myPatientDao.search(map)); - myCaptureQueriesListener.logSelectQueriesForCurrentThread(0); - assertThat(values, containsInAnyOrder(id1, id2)); - } - { - SearchParameterMap map = SearchParameterMap.newSynchronous(); - map.add(Patient.SP_IDENTIFIER, new TokenParam("urn:system", "")); - myCaptureQueriesListener.clear(); - List values = toUnqualifiedVersionlessIdValues(myPatientDao.search(map)); - myCaptureQueriesListener.logSelectQueriesForCurrentThread(0); - assertThat(values, containsInAnyOrder(id1, id2)); - } - } - - /** - * See #819 - */ - @Test - public void testSearchTokenWithNotModifier() { - String male, female; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - patient.addName().setFamily("Tester").addGiven("Joe"); - patient.setGender(AdministrativeGender.MALE); - male = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless().getValue(); - } - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("002"); - patient.addName().setFamily("Tester").addGiven("Jane"); - patient.setGender(AdministrativeGender.FEMALE); - female = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless().getValue(); - } - - List patients; - SearchParameterMap params; - - params = new SearchParameterMap(); - params.add(Patient.SP_GENDER, new TokenParam(null, "male")); - params.setLoadSynchronous(true); - patients = toUnqualifiedVersionlessIdValues(myPatientDao.search(params)); - assertThat(patients, contains(male)); - - params = new SearchParameterMap(); - params.add(Patient.SP_GENDER, new TokenParam(null, "male").setModifier(TokenParamModifier.NOT)); - params.setLoadSynchronous(true); - patients = toUnqualifiedVersionlessIdValues(myPatientDao.search(params)); - assertThat(patients, contains(female)); - } - - @Test - public void testSearchTokenWrongParam() { - Patient p1 = new Patient(); - p1.setGender(AdministrativeGender.MALE); - String id1 = myPatientDao.create(p1).getId().toUnqualifiedVersionless().getValue(); - - Patient p2 = new Patient(); - p2.addIdentifier().setValue(AdministrativeGender.MALE.toCode()); - String id2 = myPatientDao.create(p2).getId().toUnqualifiedVersionless().getValue(); - - { - IBundleProvider found = myPatientDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Patient.SP_GENDER, new TokenParam(null, "male"))); - assertThat(toUnqualifiedVersionlessIdValues(found), containsInAnyOrder(id1)); - assertEquals(1, found.size().intValue()); - } - { - IBundleProvider found = myPatientDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Patient.SP_IDENTIFIER, new TokenParam(null, "male"))); - assertThat(toUnqualifiedVersionlessIdValues(found), containsInAnyOrder(id2)); - assertEquals(1, found.size().intValue()); - } - - } - - @Test - @Disabled - public void testSearchUnknownContentParam() { - SearchParameterMap params = new SearchParameterMap(); - params.add(Constants.PARAM_CONTENT, new StringParam("fulltext")); - try { - myPatientDao.search(params); - fail(); - } catch (InvalidRequestException e) { - assertEquals("Fulltext search is not enabled on this service, can not process parameter: _content", e.getMessage()); - } - } - - @Test - @Disabled - public void testSearchUnknownTextParam() { - SearchParameterMap params = new SearchParameterMap(); - params.add(Constants.PARAM_TEXT, new StringParam("fulltext")); - try { - myPatientDao.search(params); - fail(); - } catch (InvalidRequestException e) { - assertEquals("Fulltext search is not enabled on this service, can not process parameter: _text", e.getMessage()); - } - } - - @Test - public void testSearchValueQuantity() { - String methodName = "testSearchValueQuantity"; - - String id1; - { - Observation o = new Observation(); - o.getCode().addCoding().setSystem("urn:foo").setCode(methodName + "code"); - Quantity q = new Quantity().setSystem("urn:bar:" + methodName).setCode(methodName + "units").setValue(100); - o.setValue(q); - id1 = myObservationDao.create(o, mySrd).getId().toUnqualifiedVersionless().getValue(); - } - - String id2; - { - Observation o = new Observation(); - o.getCode().addCoding().setSystem("urn:foo").setCode(methodName + "code"); - Quantity q = new Quantity().setSystem("urn:bar:" + methodName).setCode(methodName + "units").setValue(5); - o.setValue(q); - id2 = myObservationDao.create(o, mySrd).getId().toUnqualifiedVersionless().getValue(); - } - - SearchParameterMap map; - IBundleProvider found; - QuantityParam param; - - map = new SearchParameterMap(); - map.setLoadSynchronous(true); - param = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, new BigDecimal("10"), null, null); - map.add(Observation.SP_VALUE_QUANTITY, param); - found = myObservationDao.search(map); - assertThat(toUnqualifiedVersionlessIdValues(found), contains(id1)); - - map = new SearchParameterMap(); - map.setLoadSynchronous(true); - param = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, new BigDecimal("10"), null, methodName + "units"); - map.add(Observation.SP_VALUE_QUANTITY, param); - found = myObservationDao.search(map); - assertThat(toUnqualifiedVersionlessIdValues(found), contains(id1)); - - map = new SearchParameterMap(); - map.setLoadSynchronous(true); - param = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, new BigDecimal("10"), "urn:bar:" + methodName, null); - map.add(Observation.SP_VALUE_QUANTITY, param); - found = myObservationDao.search(map); - assertThat(toUnqualifiedVersionlessIdValues(found), contains(id1)); - - map = new SearchParameterMap(); - map.setLoadSynchronous(true); - param = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, new BigDecimal("10"), "urn:bar:" + methodName, methodName + "units"); - map.add(Observation.SP_VALUE_QUANTITY, param); - found = myObservationDao.search(map); - assertThat(toUnqualifiedVersionlessIdValues(found), contains(id1)); - - map = new SearchParameterMap(); - map.setLoadSynchronous(true); - param = new QuantityParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, new BigDecimal("1000"), "urn:bar:" + methodName, methodName + "units"); - map.add(Observation.SP_VALUE_QUANTITY, param); - found = myObservationDao.search(map); - assertThat(toUnqualifiedVersionlessIdValues(found), empty()); - - } - - @Test - public void testSearchWithContains() { - myDaoConfig.setAllowContainsSearches(true); - - Patient pt1 = new Patient(); - pt1.addName().setFamily("ABCDEFGHIJK"); - String pt1id = myPatientDao.create(pt1).getId().toUnqualifiedVersionless().getValue(); - - Patient pt2 = new Patient(); - pt2.addName().setFamily("FGHIJK"); - String pt2id = myPatientDao.create(pt2).getId().toUnqualifiedVersionless().getValue(); - - Patient pt3 = new Patient(); - pt3.addName().setFamily("ZZZZZ"); - myPatientDao.create(pt3).getId().toUnqualifiedVersionless().getValue(); - - - List ids; - SearchParameterMap map; - IBundleProvider results; - - // Contains = true - map = new SearchParameterMap(); - map.add(Patient.SP_NAME, new StringParam("FGHIJK").setContains(true)); - map.setLoadSynchronous(true); - results = myPatientDao.search(map); - ids = toUnqualifiedVersionlessIdValues(results); - assertThat(ids, containsInAnyOrder(pt1id, pt2id)); - - // Contains = false - map = new SearchParameterMap(); - map.add(Patient.SP_NAME, new StringParam("FGHIJK").setContains(false)); - map.setLoadSynchronous(true); - results = myPatientDao.search(map); - ids = toUnqualifiedVersionlessIdValues(results); - assertThat(ids, containsInAnyOrder(pt2id)); - - // No contains - map = new SearchParameterMap(); - map.add(Patient.SP_NAME, new StringParam("FGHIJK")); - map.setLoadSynchronous(true); - results = myPatientDao.search(map); - ids = toUnqualifiedVersionlessIdValues(results); - assertThat(ids, containsInAnyOrder(pt2id)); - } - - @Test - public void testSearchWithContainsDisabled() { - myDaoConfig.setAllowContainsSearches(false); - - SearchParameterMap map = new SearchParameterMap(); - map.setLoadSynchronous(true); - map.add(Patient.SP_NAME, new StringParam("FGHIJK").setContains(true)); - - try { - myPatientDao.search(map); - fail(); - } catch (MethodNotAllowedException e) { - assertEquals(Msg.code(1258) + ":contains modifier is disabled on this server", e.getMessage()); - } - } - - @Test - public void testSearchWithDate() { - IIdType orgId = myOrganizationDao.create(new Organization(), mySrd).getId(); - IIdType id2; - IIdType id1; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - id1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("002"); - patient.addName().setFamily("Tester_testSearchStringParam").addGiven("John"); - patient.setBirthDateElement(new DateType("2011-01-01")); - patient.getManagingOrganization().setReferenceElement(orgId); - id2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - { - SearchParameterMap params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add(Patient.SP_BIRTHDATE, new DateParam("2011-01-01")); - List patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(patients, contains(id2)); - } - { - SearchParameterMap params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add(Patient.SP_BIRTHDATE, new DateParam("2011-01-03")); - List patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(patients, empty()); - } - { - SearchParameterMap params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add(Patient.SP_BIRTHDATE, new DateParam("2011-01-03").setPrefix(ParamPrefixEnum.LESSTHAN)); - List patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(patients, contains(id2)); - } - { - SearchParameterMap params = new SearchParameterMap(); - params.setLoadSynchronous(true); - params.add(Patient.SP_BIRTHDATE, new DateParam("2010-01-01").setPrefix(ParamPrefixEnum.LESSTHAN)); - List patients = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(patients, empty()); - } - } - - @Test - public void testSearchWithFetchSizeDefaultMaximum() { - myDaoConfig.setFetchSizeDefaultMaximum(5); - - for (int i = 0; i < 10; i++) { - Patient p = new Patient(); - p.addName().setFamily("PT" + i); - myPatientDao.create(p); - } - - SearchParameterMap map = new SearchParameterMap(); - map.setLoadSynchronous(true); - IBundleProvider values = myPatientDao.search(map); - assertEquals(null, values.size()); - assertEquals(5, values.getResources(0, 1000).size()); - } - - @Test - public void testSearchWithIncludes() { - String methodName = "testSearchWithIncludes"; - IIdType parentOrgId; - { - Organization org = new Organization(); - org.getNameElement().setValue(methodName + "_O1Parent"); - parentOrgId = myOrganizationDao.create(org, mySrd).getId(); - } - { - Organization org = new Organization(); - org.getNameElement().setValue(methodName + "_O1"); - org.setPartOf(new Reference(parentOrgId)); - IIdType orgId = myOrganizationDao.create(org, mySrd).getId(); - - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - patient.addName().setFamily("Tester_" + methodName + "_P1").addGiven("Joe"); - patient.getManagingOrganization().setReferenceElement(orgId); - myPatientDao.create(patient, mySrd); - } - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("002"); - patient.addName().setFamily("Tester_" + methodName + "_P2").addGiven("John"); - myPatientDao.create(patient, mySrd); - } - - { - // No includes - SearchParameterMap params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("Tester_" + methodName + "_P1")); - List patients = toList(myPatientDao.search(params)); - assertEquals(1, patients.size()); - } - { - // Named include - SearchParameterMap params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("Tester_" + methodName + "_P1")); - params.addInclude(Patient.INCLUDE_ORGANIZATION.asNonRecursive()); - IBundleProvider search = myPatientDao.search(params); - List patients = toList(search); - assertEquals(2, patients.size()); - assertEquals(Patient.class, patients.get(0).getClass()); - assertEquals(Organization.class, patients.get(1).getClass()); - } - { - // Named include with parent non-recursive - SearchParameterMap params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("Tester_" + methodName + "_P1")); - params.addInclude(Patient.INCLUDE_ORGANIZATION); - params.addInclude(Organization.INCLUDE_PARTOF.asNonRecursive()); - IBundleProvider search = myPatientDao.search(params); - List patients = toList(search); - assertEquals(2, patients.size()); - assertEquals(Patient.class, patients.get(0).getClass()); - assertEquals(Organization.class, patients.get(1).getClass()); - } - { - // Named include with parent recursive - SearchParameterMap params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("Tester_" + methodName + "_P1")); - params.addInclude(Patient.INCLUDE_ORGANIZATION); - params.addInclude(Organization.INCLUDE_PARTOF.asRecursive()); - IBundleProvider search = myPatientDao.search(params); - List patients = toList(search); - assertEquals(3, patients.size()); - assertEquals(Patient.class, patients.get(0).getClass()); - assertEquals(Organization.class, patients.get(1).getClass()); - assertEquals(Organization.class, patients.get(2).getClass()); - } - { - // * include non recursive - SearchParameterMap params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("Tester_" + methodName + "_P1")); - params.addInclude(IBaseResource.INCLUDE_ALL.asNonRecursive()); - IBundleProvider search = myPatientDao.search(params); - List patients = toList(search); - assertEquals(2, patients.size()); - assertEquals(Patient.class, patients.get(0).getClass()); - assertEquals(Organization.class, patients.get(1).getClass()); - } - { - // * include recursive - SearchParameterMap params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("Tester_" + methodName + "_P1")); - params.addInclude(IBaseResource.INCLUDE_ALL.asRecursive()); - IBundleProvider search = myPatientDao.search(params); - List patients = toList(search); - assertEquals(3, patients.size()); - assertEquals(Patient.class, patients.get(0).getClass()); - assertEquals(Organization.class, patients.get(1).getClass()); - assertEquals(Organization.class, patients.get(2).getClass()); - } - { - // Irrelevant include - SearchParameterMap params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("Tester_" + methodName + "_P1")); - params.addInclude(Encounter.INCLUDE_EPISODE_OF_CARE); - IBundleProvider search = myPatientDao.search(params); - List patients = toList(search); - assertEquals(1, patients.size()); - assertEquals(Patient.class, patients.get(0).getClass()); - } - } - - @SuppressWarnings("unused") - @Test - public void testSearchWithIncludesParameterNoRecurse() { - String methodName = "testSearchWithIncludes"; - IIdType parentParentOrgId; - { - Organization org = new Organization(); - org.getNameElement().setValue(methodName + "_O1Parent"); - parentParentOrgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType parentOrgId; - { - Organization org = new Organization(); - org.getNameElement().setValue(methodName + "_O1Parent"); - org.setPartOf(new Reference(parentParentOrgId)); - parentOrgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType orgId; - { - Organization org = new Organization(); - org.getNameElement().setValue(methodName + "_O1"); - org.setPartOf(new Reference(parentOrgId)); - orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType patientId; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - patient.addName().setFamily("Tester_" + methodName + "_P1").addGiven("Joe"); - patient.getManagingOrganization().setReferenceElement(orgId); - patientId = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - - { - SearchParameterMap params = new SearchParameterMap(); - params.add(IAnyResource.SP_RES_ID, new StringParam(orgId.getIdPart())); - params.addInclude(Organization.INCLUDE_PARTOF.asNonRecursive()); - List resources = toUnqualifiedVersionlessIds(myOrganizationDao.search(params)); - assertThat(resources, contains(orgId, parentOrgId)); - } - } - - @SuppressWarnings("unused") - @Test - public void testSearchWithIncludesParameterRecurse() { - String methodName = "testSearchWithIncludes"; - IIdType parentParentOrgId; - { - Organization org = new Organization(); - org.getNameElement().setValue(methodName + "_O1Parent"); - parentParentOrgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType parentOrgId; - { - Organization org = new Organization(); - org.getNameElement().setValue(methodName + "_O1Parent"); - org.setPartOf(new Reference(parentParentOrgId)); - parentOrgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType orgId; - { - Organization org = new Organization(); - org.getNameElement().setValue(methodName + "_O1"); - org.setPartOf(new Reference(parentOrgId)); - orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType patientId; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - patient.addName().setFamily("Tester_" + methodName + "_P1").addGiven("Joe"); - patient.getManagingOrganization().setReferenceElement(orgId); - patientId = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - - { - SearchParameterMap params = new SearchParameterMap(); - params.add(IAnyResource.SP_RES_ID, new StringParam(orgId.getIdPart())); - params.addInclude(Organization.INCLUDE_PARTOF.asRecursive()); - List resources = toUnqualifiedVersionlessIds(myOrganizationDao.search(params)); - ourLog.info(resources.toString()); - assertThat(resources, containsInAnyOrder(orgId, parentOrgId, parentParentOrgId)); - } - } - - @Test - public void testSearchWithIncludesStarNoRecurse() { - String methodName = "testSearchWithIncludes"; - IIdType parentParentOrgId; - { - Organization org = new Organization(); - org.getNameElement().setValue(methodName + "_O1Parent"); - parentParentOrgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType parentOrgId; - { - Organization org = new Organization(); - org.getNameElement().setValue(methodName + "_O1Parent"); - org.setPartOf(new Reference(parentParentOrgId)); - parentOrgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType orgId; - { - Organization org = new Organization(); - org.getNameElement().setValue(methodName + "_O1"); - org.setPartOf(new Reference(parentOrgId)); - orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType patientId; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - patient.addName().setFamily("Tester_" + methodName + "_P1").addGiven("Joe"); - patient.getManagingOrganization().setReferenceElement(orgId); - patientId = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - - { - SearchParameterMap params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("Tester_" + methodName + "_P1")); - params.addInclude(new Include("*").asNonRecursive()); - List resources = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(resources, contains(patientId, orgId)); - } - } - - @Test - public void testSearchWithIncludesStarRecurse() { - String methodName = "testSearchWithIncludes"; - IIdType parentParentOrgId; - { - Organization org = new Organization(); - org.getNameElement().setValue(methodName + "_O1Parent"); - parentParentOrgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType parentOrgId; - { - Organization org = new Organization(); - org.getNameElement().setValue(methodName + "_O1Parent"); - org.setPartOf(new Reference(parentParentOrgId)); - parentOrgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType orgId; - { - Organization org = new Organization(); - org.getNameElement().setValue(methodName + "_O1"); - org.setPartOf(new Reference(parentOrgId)); - orgId = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType patientId; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - patient.addName().setFamily("Tester_" + methodName + "_P1").addGiven("Joe"); - patient.getManagingOrganization().setReferenceElement(orgId); - patientId = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - - { - SearchParameterMap params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("Tester_" + methodName + "_P1")); - params.addInclude(new Include("*").asRecursive()); - List resources = toUnqualifiedVersionlessIds(myPatientDao.search(params)); - assertThat(resources, containsInAnyOrder(patientId, orgId, parentOrgId, parentParentOrgId)); - } - } - - /** - * Test for #62 - */ - @Test - public void testSearchWithIncludesThatHaveTextId() { - { - Organization org = new Organization(); - org.setId("testSearchWithIncludesThatHaveTextIdid1"); - org.getNameElement().setValue("testSearchWithIncludesThatHaveTextId_O1"); - IIdType orgId = myOrganizationDao.update(org, mySrd).getId(); - assertThat(orgId.getValue(), endsWith("Organization/testSearchWithIncludesThatHaveTextIdid1/_history/1")); - - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - patient.addName().setFamily("Tester_testSearchWithIncludesThatHaveTextId_P1").addGiven("Joe"); - patient.getManagingOrganization().setReferenceElement(orgId); - myPatientDao.create(patient, mySrd); - } - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("002"); - patient.addName().setFamily("Tester_testSearchWithIncludesThatHaveTextId_P2").addGiven("John"); - myPatientDao.create(patient, mySrd); - } - - SearchParameterMap params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("Tester_testSearchWithIncludesThatHaveTextId_P1")); - params.addInclude(Patient.INCLUDE_ORGANIZATION); - IBundleProvider search = myPatientDao.search(params); - List patients = toList(search); - assertEquals(2, patients.size()); - assertEquals(Patient.class, patients.get(0).getClass()); - assertEquals(Organization.class, patients.get(1).getClass()); - - params = new SearchParameterMap(); - params.add(Patient.SP_FAMILY, new StringParam("Tester_testSearchWithIncludesThatHaveTextId_P1")); - patients = toList(myPatientDao.search(params)); - assertEquals(1, patients.size()); - - } - - @Test - public void testSearchWithNoResults() { - Device dev = new Device(); - dev.addIdentifier().setSystem("Foo"); - myDeviceDao.create(dev, mySrd); - - IBundleProvider value = myDeviceDao.search(new SearchParameterMap()); - ourLog.info("Initial size: " + value.size()); - for (IBaseResource next : value.getResources(0, value.size())) { - ourLog.info("Deleting: {}", next.getIdElement()); - myDeviceDao.delete(next.getIdElement(), mySrd); - } - - value = myDeviceDao.search(new SearchParameterMap()); - if (value.size() > 0) { - ourLog.info("Found: " + (value.getResources(0, 1).get(0).getIdElement())); - fail(myFhirContext.newXmlParser().setPrettyPrint(true).encodeResourceToString(value.getResources(0, 1).get(0))); - } - assertEquals(0, value.size().intValue()); - - List res = value.getResources(0, 0); - assertTrue(res.isEmpty()); - - } - - @Test - public void testSearchWithRevIncludes() { - final String methodName = "testSearchWithRevIncludes"; - TransactionTemplate txTemplate = new TransactionTemplate(myTransactionMgr); - txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); - IIdType pid = txTemplate.execute(new TransactionCallback() { - - @Override - public IIdType doInTransaction(TransactionStatus theStatus) { - Patient p = new Patient(); - p.addName().setFamily(methodName); - IIdType pid = myPatientDao.create(p).getId().toUnqualifiedVersionless(); - - Condition c = new Condition(); - c.getSubject().setReferenceElement(pid); - myConditionDao.create(c); - - return pid; - } - }); - - SearchParameterMap map = new SearchParameterMap(); - map.add(IAnyResource.SP_RES_ID, new StringParam(pid.getIdPart())); - map.addRevInclude(Condition.INCLUDE_PATIENT); - IBundleProvider results = myPatientDao.search(map); - List foundResources = results.getResources(0, results.size()); - assertEquals(Patient.class, foundResources.get(0).getClass()); - assertEquals(Condition.class, foundResources.get(1).getClass()); - } - - @Test - public void testSearchWithSecurityAndProfileParams() { - String methodName = "testSearchWithSecurityAndProfileParams"; - - IIdType tag1id; - { - Organization org = new Organization(); - org.getNameElement().setValue("FOO"); - org.getMeta().addSecurity("urn:taglist", methodName + "1a", null); - tag1id = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType tag2id; - { - Organization org = new Organization(); - org.getNameElement().setValue("FOO"); - org.getMeta().addProfile("http://" + methodName); - tag2id = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - { - SearchParameterMap params = new SearchParameterMap(); - params.add("_security", new TokenParam("urn:taglist", methodName + "1a")); - List patients = toUnqualifiedVersionlessIds(myOrganizationDao.search(params)); - assertThat(patients, containsInAnyOrder(tag1id)); - } - { - SearchParameterMap params = new SearchParameterMap(); - params.add("_profile", new UriParam("http://" + methodName)); - List patients = toUnqualifiedVersionlessIds(myOrganizationDao.search(params)); - assertThat(patients, containsInAnyOrder(tag2id)); - } - } - - @Test - public void testSearchWithTagParameter() { - String methodName = "testSearchWithTagParameter"; - - IIdType tag1id; - { - Organization org = new Organization(); - org.getNameElement().setValue("FOO"); - org.getMeta().addTag("urn:taglist", methodName + "1a", null); - org.getMeta().addTag("urn:taglist", methodName + "1b", null); - tag1id = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - - TestUtil.sleepOneClick(); - - Date betweenDate = new Date(); - - IIdType tag2id; - { - Organization org = new Organization(); - org.getNameElement().setValue("FOO"); - org.getMeta().addTag("urn:taglist", methodName + "2a", null); - org.getMeta().addTag("urn:taglist", methodName + "2b", null); - tag2id = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - - { - // One tag - SearchParameterMap params = new SearchParameterMap(); - params.add("_tag", new TokenParam("urn:taglist", methodName + "1a")); - List patients = toUnqualifiedVersionlessIds(myOrganizationDao.search(params)); - assertThat(patients, containsInAnyOrder(tag1id)); - } - { - // Code only - SearchParameterMap params = new SearchParameterMap(); - params.add("_tag", new TokenParam(null, methodName + "1a")); - List patients = toUnqualifiedVersionlessIds(myOrganizationDao.search(params)); - assertThat(patients, containsInAnyOrder(tag1id)); - } - { - // Or tags - SearchParameterMap params = new SearchParameterMap(); - TokenOrListParam orListParam = new TokenOrListParam(); - orListParam.add(new TokenParam("urn:taglist", methodName + "1a")); - orListParam.add(new TokenParam("urn:taglist", methodName + "2a")); - params.add("_tag", orListParam); - List patients = toUnqualifiedVersionlessIds(myOrganizationDao.search(params)); - assertThat(patients, containsInAnyOrder(tag1id, tag2id)); - } - { - // Or tags with lastupdated - SearchParameterMap params = new SearchParameterMap(); - TokenOrListParam orListParam = new TokenOrListParam(); - orListParam.add(new TokenParam("urn:taglist", methodName + "1a")); - orListParam.add(new TokenParam("urn:taglist", methodName + "2a")); - params.add("_tag", orListParam); - params.setLastUpdated(new DateRangeParam(betweenDate, null)); - List patients = toUnqualifiedVersionlessIds(myOrganizationDao.search(params)); - assertThat(patients, containsInAnyOrder(tag2id)); - } - // TODO: get multiple/AND working - { - // And tags - SearchParameterMap params = new SearchParameterMap(); - TokenAndListParam andListParam = new TokenAndListParam(); - andListParam.addValue(new TokenOrListParam("urn:taglist", methodName + "1a")); - andListParam.addValue(new TokenOrListParam("urn:taglist", methodName + "2a")); - params.add("_tag", andListParam); - List patients = toUnqualifiedVersionlessIds(myOrganizationDao.search(params)); - assertEquals(0, patients.size()); - } - - { - // And tags - SearchParameterMap params = new SearchParameterMap(); - TokenAndListParam andListParam = new TokenAndListParam(); - andListParam.addValue(new TokenOrListParam("urn:taglist", methodName + "1a")); - andListParam.addValue(new TokenOrListParam("urn:taglist", methodName + "1b")); - params.add("_tag", andListParam); - List patients = toUnqualifiedVersionlessIds(myOrganizationDao.search(params)); - assertThat(patients, containsInAnyOrder(tag1id)); - } - - } - - @Test - public void testSearchWithTagParameterMissing() { - String methodName = "testSearchWithTagParameterMissing"; - - IIdType tag1id; - { - Organization org = new Organization(); - org.getNameElement().setValue("FOO"); - org.getMeta().addTag("urn:taglist", methodName + "1a", null); - org.getMeta().addTag("urn:taglist", methodName + "1b", null); - tag1id = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - - IIdType tag2id; - { - Organization org = new Organization(); - org.getNameElement().setValue("FOO"); - org.getMeta().addTag("urn:taglist", methodName + "1b", null); - tag2id = myOrganizationDao.create(org, mySrd).getId().toUnqualifiedVersionless(); - } - - { - // One tag - SearchParameterMap params = new SearchParameterMap(); - params.add("_tag", new TokenParam("urn:taglist", methodName + "1a").setModifier(TokenParamModifier.NOT)); - List patients = toUnqualifiedVersionlessIds(myOrganizationDao.search(params)); - assertThat(patients, containsInAnyOrder(tag2id)); - assertThat(patients, not(hasItem(tag1id))); - } - { - // Non existant tag - SearchParameterMap params = new SearchParameterMap(); - params.add("_tag", new TokenParam("urn:taglist", methodName + "FOO").setModifier(TokenParamModifier.NOT)); - List patients = toUnqualifiedVersionlessIds(myOrganizationDao.search(params)); - assertThat(patients, containsInAnyOrder(tag1id, tag2id)); - } - { - // Common tag - SearchParameterMap params = new SearchParameterMap(); - params.add("_tag", new TokenParam("urn:taglist", methodName + "1b").setModifier(TokenParamModifier.NOT)); - List patients = toUnqualifiedVersionlessIds(myOrganizationDao.search(params)); - assertThat(patients, empty()); - } - } - - /** - * https://chat.fhir.org/#narrow/stream/implementers/topic/Understanding.20_include - */ - @Test - public void testSearchWithTypedInclude() { - IIdType patId; - { - Patient patient = new Patient(); - patient.addIdentifier().setSystem("urn:system").setValue("001"); - patId = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless(); - } - IIdType practId; - { - Practitioner pract = new Practitioner(); - pract.addIdentifier().setSystem("urn:system").setValue("001"); - practId = myPractitionerDao.create(pract, mySrd).getId().toUnqualifiedVersionless(); - } - - Appointment appt = new Appointment(); - appt.addParticipant().getActor().setReference(patId.getValue()); - appt.addParticipant().getActor().setReference(practId.getValue()); - IIdType apptId = myAppointmentDao.create(appt, mySrd).getId().toUnqualifiedVersionless(); - - SearchParameterMap params = new SearchParameterMap(); - params.addInclude(Appointment.INCLUDE_PATIENT); - assertThat(toUnqualifiedVersionlessIds(myAppointmentDao.search(params)), containsInAnyOrder(patId, apptId)); - - } - - @Test - public void testSearchWithUriParam() throws Exception { - Class type = ValueSet.class; - String resourceName = "/valueset-dstu2.json"; - ValueSet vs = loadResourceFromClasspath(type, resourceName); - IIdType id1 = myValueSetDao.update(vs, mySrd).getId().toUnqualifiedVersionless(); - - ValueSet vs2 = new ValueSet(); - vs2.setUrl("http://hl7.org/foo/bar"); - myValueSetDao.create(vs2, mySrd).getId().toUnqualifiedVersionless(); - - IBundleProvider result; - result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/fhir/ValueSet/basic-resource-type"))); - assertThat(toUnqualifiedVersionlessIds(result), contains(id1)); - - result = myValueSetDao - .search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/fhir/ValueSet/basic-resource-type").setQualifier(UriParamQualifierEnum.BELOW))); - assertThat(toUnqualifiedVersionlessIds(result), contains(id1)); - - result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/fhir/ValueSet/").setQualifier(UriParamQualifierEnum.BELOW))); - assertThat(toUnqualifiedVersionlessIds(result), contains(id1)); - - result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/fhir/ValueSet/FOOOOOO"))); - assertThat(toUnqualifiedVersionlessIds(result), empty()); - - } - - @Test - public void testSearchWithUriParamAbove() { - ValueSet vs1 = new ValueSet(); - vs1.setUrl("http://hl7.org/foo/baz"); - myValueSetDao.create(vs1, mySrd).getId().toUnqualifiedVersionless(); - - ValueSet vs2 = new ValueSet(); - vs2.setUrl("http://hl7.org/foo/bar"); - IIdType id2 = myValueSetDao.create(vs2, mySrd).getId().toUnqualifiedVersionless(); - - ValueSet vs3 = new ValueSet(); - vs3.setUrl("http://hl7.org/foo/bar/baz"); - IIdType id3 = myValueSetDao.create(vs3, mySrd).getId().toUnqualifiedVersionless(); - - IBundleProvider result; - result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/foo/bar/baz/boz").setQualifier(UriParamQualifierEnum.ABOVE))); - assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(id2, id3)); - - result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/foo/bar/baz").setQualifier(UriParamQualifierEnum.ABOVE))); - assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(id2, id3)); - - result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/foo/bar").setQualifier(UriParamQualifierEnum.ABOVE))); - assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(id2)); - - result = myValueSetDao - .search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/fhir/ValueSet/basic-resource-type").setQualifier(UriParamQualifierEnum.ABOVE))); - assertThat(toUnqualifiedVersionlessIds(result), empty()); - - result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org").setQualifier(UriParamQualifierEnum.ABOVE))); - assertThat(toUnqualifiedVersionlessIds(result), empty()); - } - - @Test - public void testSearchWithUriParamBelow() throws Exception { - myFhirContext.setParserErrorHandler(new StrictErrorHandler()); - - Class type = ValueSet.class; - String resourceName = "/valueset-dstu2.json"; - ValueSet vs = loadResourceFromClasspath(type, resourceName); - IIdType id1 = myValueSetDao.update(vs, mySrd).getId().toUnqualifiedVersionless(); - - ValueSet vs2 = new ValueSet(); - vs2.setUrl("http://hl7.org/foo/bar"); - IIdType id2 = myValueSetDao.create(vs2, mySrd).getId().toUnqualifiedVersionless(); - - IBundleProvider result; - - result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://").setQualifier(UriParamQualifierEnum.BELOW))); - assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(id1, id2)); - - result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org").setQualifier(UriParamQualifierEnum.BELOW))); - assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(id1, id2)); - - result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/foo").setQualifier(UriParamQualifierEnum.BELOW))); - assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(id2)); - - result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(ValueSet.SP_URL, new UriParam("http://hl7.org/foo/baz").setQualifier(UriParamQualifierEnum.BELOW))); - assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder()); - } - - /** - * See #744 - */ - @Test - public void testSearchWithVeryLongUrlLonger() { - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - - Patient p = new Patient(); - p.addName().setFamily("A1"); - myPatientDao.create(p); - - runInTransaction(()->assertEquals(0, mySearchEntityDao.count())); - - SearchParameterMap map = new SearchParameterMap(); - StringOrListParam or = new StringOrListParam(); - or.addOr(new StringParam("A1")); - for (int i = 0; i < 50; i++) { - or.addOr(new StringParam(StringUtils.leftPad("", 200, (char) ('A' + i)))); - } - map.add(Patient.SP_NAME, or); - IBundleProvider results = myPatientDao.search(map); - assertEquals(1, results.getResources(0, 10).size()); - runInTransaction(()->assertEquals(1, mySearchEntityDao.count())); - - map = new SearchParameterMap(); - or = new StringOrListParam(); - or.addOr(new StringParam("A1")); - or.addOr(new StringParam("A1")); - for (int i = 0; i < 50; i++) { - or.addOr(new StringParam(StringUtils.leftPad("", 200, (char) ('A' + i)))); - } - map.add(Patient.SP_NAME, or); - results = myPatientDao.search(map); - assertEquals(1, results.getResources(0, 10).size()); - // We expect a new one because we don't cache the search URL for very long search URLs - runInTransaction(()->assertEquals(2, mySearchEntityDao.count())); - - } - - @Test - public void testDateSearchParametersShouldBeTimezoneIndependent() { - - createObservationWithEffective("NO1", "2011-01-01T23:00:00-11:30"); - createObservationWithEffective("NO2", "2011-01-03T23:00:00+01:30"); - - createObservationWithEffective("YES01", "2011-01-02T00:00:00-11:30"); - createObservationWithEffective("YES02", "2011-01-02T00:00:00-10:00"); - createObservationWithEffective("YES03", "2011-01-02T00:00:00-09:00"); - createObservationWithEffective("YES04", "2011-01-02T00:00:00-08:00"); - createObservationWithEffective("YES05", "2011-01-02T00:00:00-07:00"); - createObservationWithEffective("YES06", "2011-01-02T00:00:00-06:00"); - createObservationWithEffective("YES07", "2011-01-02T00:00:00-05:00"); - createObservationWithEffective("YES08", "2011-01-02T00:00:00-04:00"); - createObservationWithEffective("YES09", "2011-01-02T00:00:00-03:00"); - createObservationWithEffective("YES10", "2011-01-02T00:00:00-02:00"); - createObservationWithEffective("YES11", "2011-01-02T00:00:00-01:00"); - createObservationWithEffective("YES12", "2011-01-02T00:00:00Z"); - createObservationWithEffective("YES13", "2011-01-02T00:00:00+01:00"); - createObservationWithEffective("YES14", "2011-01-02T00:00:00+02:00"); - createObservationWithEffective("YES15", "2011-01-02T00:00:00+03:00"); - createObservationWithEffective("YES16", "2011-01-02T00:00:00+04:00"); - createObservationWithEffective("YES17", "2011-01-02T00:00:00+05:00"); - createObservationWithEffective("YES18", "2011-01-02T00:00:00+06:00"); - createObservationWithEffective("YES19", "2011-01-02T00:00:00+07:00"); - createObservationWithEffective("YES20", "2011-01-02T00:00:00+08:00"); - createObservationWithEffective("YES21", "2011-01-02T00:00:00+09:00"); - createObservationWithEffective("YES22", "2011-01-02T00:00:00+10:00"); - createObservationWithEffective("YES23", "2011-01-02T00:00:00+11:00"); - - - SearchParameterMap map = new SearchParameterMap(); - map.setLoadSynchronous(true); - map.add(Observation.SP_DATE, new DateParam("2011-01-02")); - IBundleProvider results = myObservationDao.search(map); - List values = toUnqualifiedVersionlessIdValues(results); - Collections.sort(values); - assertThat(values.toString(), values, contains( - "Observation/YES01", - "Observation/YES02", - "Observation/YES03", - "Observation/YES04", - "Observation/YES05", - "Observation/YES06", - "Observation/YES07", - "Observation/YES08", - "Observation/YES09", - "Observation/YES10", - "Observation/YES11", - "Observation/YES12", - "Observation/YES13", - "Observation/YES14", - "Observation/YES15", - "Observation/YES16", - "Observation/YES17", - "Observation/YES18", - "Observation/YES19", - "Observation/YES20", - "Observation/YES21", - "Observation/YES22", - "Observation/YES23" - )); - } - - private void createObservationWithEffective(String theId, String theEffective) { - Observation obs = new Observation(); - obs.setId(theId); - obs.setEffective(new DateTimeType(theEffective)); - myObservationDao.update(obs); - - ourLog.info("Obs {} has time {}", theId, obs.getEffectiveDateTimeType().getValue().toString()); - } - - /** - * See #744 - */ - @Test - public void testSearchWithVeryLongUrlShorter() { - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - - Patient p = new Patient(); - p.addName().setFamily("A1"); - myPatientDao.create(p); - - runInTransaction(()->assertEquals(0, mySearchEntityDao.count())); - - SearchParameterMap map = new SearchParameterMap(); - StringOrListParam or = new StringOrListParam(); - or.addOr(new StringParam("A1")); - or.addOr(new StringParam(StringUtils.leftPad("", 200, 'A'))); - or.addOr(new StringParam(StringUtils.leftPad("", 200, 'B'))); - or.addOr(new StringParam(StringUtils.leftPad("", 200, 'C'))); - map.add(Patient.SP_NAME, or); - IBundleProvider results = myPatientDao.search(map); - assertEquals(1, results.getResources(0, 10).size()); - runInTransaction(()->assertEquals(1, mySearchEntityDao.count())); - - map = new SearchParameterMap(); - or = new StringOrListParam(); - or.addOr(new StringParam("A1")); - or.addOr(new StringParam(StringUtils.leftPad("", 200, 'A'))); - or.addOr(new StringParam(StringUtils.leftPad("", 200, 'B'))); - or.addOr(new StringParam(StringUtils.leftPad("", 200, 'C'))); - map.add(Patient.SP_NAME, or); - results = myPatientDao.search(map); - assertEquals(1, results.getResources(0, 10).size()); - runInTransaction(()->assertEquals(1, mySearchEntityDao.count())); - - } - - private String toStringMultiline(List theResults) { - StringBuilder b = new StringBuilder(); - for (Object next : theResults) { - b.append('\n'); - b.append(" * ").append(next.toString()); - } - return b.toString(); - } - - -} diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchOptimizedTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchOptimizedTest.java index 582af58145a..4a0f7ede0bc 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchOptimizedTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchOptimizedTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.context.RuntimeResourceDefinition; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.data.ISearchDao; import ca.uhn.fhir.jpa.dao.data.ISearchResultDao; import ca.uhn.fhir.jpa.entity.Search; @@ -95,16 +95,16 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { mySearchCoordinatorSvcImpl.setLoadingThrottleForUnitTests(null); mySearchCoordinatorSvcImpl.setSyncSizeForUnitTests(QueryParameterUtils.DEFAULT_SYNC_SIZE); myCaptureQueriesListener.setCaptureQueryStackTrace(true); - myDaoConfig.setAdvancedHSearchIndexing(false); + myStorageSettings.setAdvancedHSearchIndexing(false); } @AfterEach public final void after() { mySearchCoordinatorSvcImpl.setLoadingThrottleForUnitTests(null); mySearchCoordinatorSvcImpl.setSyncSizeForUnitTests(QueryParameterUtils.DEFAULT_SYNC_SIZE); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); myCaptureQueriesListener.setCaptureQueryStackTrace(false); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); } private void create200Patients() { @@ -123,7 +123,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { public void testFetchCountOnly() { create200Patients(); - myDaoConfig.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190)); + myStorageSettings.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190)); SearchParameterMap params = new SearchParameterMap(); params.setSort(new SortSpec(Patient.SP_NAME)); @@ -139,7 +139,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { @Test public void testFetchCountWithMultipleIndexesOnOneResource() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); create200Patients(); // Already have 200, let's add number 201 with a bunch of similar names @@ -153,7 +153,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { p.addName().addGiven("FAMB"); myPatientDao.update(p); - myDaoConfig.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190)); + myStorageSettings.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190)); SearchParameterMap params; IBundleProvider results; String uuid; @@ -221,7 +221,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { mySearchCoordinatorSvcImpl.setLoadingThrottleForUnitTests(25); mySearchCoordinatorSvcImpl.setSyncSizeForUnitTests(10); - myDaoConfig.setSearchPreFetchThresholds(Arrays.asList(1000, -1)); + myStorageSettings.setSearchPreFetchThresholds(Arrays.asList(1000, -1)); SearchParameterMap params = new SearchParameterMap(); params.setSort(new SortSpec(Patient.SP_NAME)); @@ -251,7 +251,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { public void testFetchCountAndData() { create200Patients(); - myDaoConfig.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190)); + myStorageSettings.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190)); SearchParameterMap params = new SearchParameterMap(); params.setSort(new SortSpec(Patient.SP_NAME)); @@ -292,7 +292,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { public void testCountEvenIfPreviousSimilarSearchDidNotRequestIt() { create200Patients(); - myDaoConfig.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190)); + myStorageSettings.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190)); SearchParameterMap params = new SearchParameterMap(); params.setSort(new SortSpec(Patient.SP_NAME)); @@ -330,7 +330,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { public void testFetchRightUpToActualNumberExistingThenFetchAnotherPage() { create200Patients(); - myDaoConfig.setSearchPreFetchThresholds(Arrays.asList(200, -1)); + myStorageSettings.setSearchPreFetchThresholds(Arrays.asList(200, -1)); /* * Load the first page of 200 @@ -390,7 +390,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { public void testFetchOnlySmallBatches() { create200Patients(); - myDaoConfig.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190)); + myStorageSettings.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190)); /* * Load the first page of 10 @@ -525,7 +525,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { public void testFetchMoreThanFirstPageSizeInFirstPage() { create200Patients(); - myDaoConfig.setSearchPreFetchThresholds(Arrays.asList(20, -1)); + myStorageSettings.setSearchPreFetchThresholds(Arrays.asList(20, -1)); /* * Load a page that exceeds the initial page siz @@ -567,7 +567,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { public void testFetchUnlimited() { create200Patients(); - myDaoConfig.setSearchPreFetchThresholds(Arrays.asList(20, -1)); + myStorageSettings.setSearchPreFetchThresholds(Arrays.asList(20, -1)); /* * Load the first page of 10 @@ -628,7 +628,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { @Test public void testFetchSecondBatchInManyThreads() throws Throwable { create200Patients(); - myDaoConfig.setSearchPreFetchThresholds(Arrays.asList(20, -1)); + myStorageSettings.setSearchPreFetchThresholds(Arrays.asList(20, -1)); /* * Load the first page of 10 @@ -704,7 +704,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { public void testSearchThatOnlyReturnsASmallResult() { create200Patients(); - myDaoConfig.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190)); + myStorageSettings.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190)); SearchParameterMap params = new SearchParameterMap(); params.setSort(new SortSpec(Patient.SP_NAME)); @@ -1106,13 +1106,13 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { @AfterEach public void afterResetDao() { - myDaoConfig.setResourceMetaCountHardLimit(new DaoConfig().getResourceMetaCountHardLimit()); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); + myStorageSettings.setResourceMetaCountHardLimit(new JpaStorageSettings().getResourceMetaCountHardLimit()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); } @Test public void testWritesPerformMinimalSqlStatements() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); Patient p = new Patient(); p.addIdentifier().setSystem("sys1").setValue("val1"); @@ -1185,7 +1185,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { @Test public void testCreateClientAssignedId() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); myCaptureQueriesListener.clear(); ourLog.info("** Starting Update Non-Existing resource with client assigned ID"); @@ -1230,7 +1230,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { @Test public void testOneRowPerUpdate() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); myCaptureQueriesListener.clear(); Patient p = new Patient(); @@ -1261,7 +1261,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { @Test public void testUpdateReusesIndexes() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); myCaptureQueriesListener.clear(); @@ -1285,7 +1285,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { @Test public void testUpdateReusesIndexesString() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); SearchParameterMap m1 = new SearchParameterMap().add("family", new StringParam("family1")).setLoadSynchronous(true); SearchParameterMap m2 = new SearchParameterMap().add("family", new StringParam("family2")).setLoadSynchronous(true); @@ -1318,7 +1318,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { @Test public void testUpdateReusesIndexesToken() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); SearchParameterMap m1 = new SearchParameterMap().add("gender", new TokenParam("male")).setLoadSynchronous(true); SearchParameterMap m2 = new SearchParameterMap().add("gender", new TokenParam("female")).setLoadSynchronous(true); @@ -1391,7 +1391,7 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test { org2.setName("org2"); IIdType orgId2 = myOrganizationDao.create(org2).getId().toUnqualifiedVersionless(); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); SearchParameterMap m1 = new SearchParameterMap().add("organization", new ReferenceParam(orgId1.getValue())).setLoadSynchronous(true); SearchParameterMap m2 = new SearchParameterMap().add("organization", new ReferenceParam(orgId2.getValue())).setLoadSynchronous(true); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchPageExpiryTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchPageExpiryTest.java index 603a4825792..8e92cde712f 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchPageExpiryTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchPageExpiryTest.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.dao.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.data.ISearchDao; import ca.uhn.fhir.jpa.entity.Search; import ca.uhn.fhir.jpa.model.search.SearchStatusEnum; @@ -62,13 +62,13 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test { public void before() { DatabaseSearchCacheSvcImpl staleSearchDeletingSvc = AopTestUtils.getTargetObject(mySearchCacheSvc); staleSearchDeletingSvc.setCutoffSlackForUnitTest(0); - myDaoConfig.setCountSearchResultsUpTo(new DaoConfig().getCountSearchResultsUpTo()); + myStorageSettings.setCountSearchResultsUpTo(new JpaStorageSettings().getCountSearchResultsUpTo()); } @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); - myDaoConfig.setCountSearchResultsUpTo(10000); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setCountSearchResultsUpTo(10000); } @Test @@ -89,10 +89,10 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test { Thread.sleep(10); long reuseCachedSearchResultsForMillis = 500L; - myDaoConfig.setReuseCachedSearchResultsForMillis(reuseCachedSearchResultsForMillis); + myStorageSettings.setReuseCachedSearchResultsForMillis(reuseCachedSearchResultsForMillis); long millisBetweenReuseAndExpire = 800L; long expireSearchResultsAfterMillis = 1000L; - myDaoConfig.setExpireSearchResultsAfterMillis(expireSearchResultsAfterMillis); + myStorageSettings.setExpireSearchResultsAfterMillis(expireSearchResultsAfterMillis); long start = System.currentTimeMillis(); DatabaseSearchCacheSvcImpl.setNowForUnitTests(start); @@ -222,9 +222,9 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test { }); int expireSearchResultsAfterMillis = 700; - myDaoConfig.setExpireSearchResultsAfterMillis(expireSearchResultsAfterMillis); + myStorageSettings.setExpireSearchResultsAfterMillis(expireSearchResultsAfterMillis); long reuseCachedSearchResultsForMillis = 400L; - myDaoConfig.setReuseCachedSearchResultsForMillis(reuseCachedSearchResultsForMillis); + myStorageSettings.setReuseCachedSearchResultsForMillis(reuseCachedSearchResultsForMillis); DatabaseSearchCacheSvcImpl.setNowForUnitTests(start.get() + expireSearchResultsAfterMillis - 1); myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); txTemplate.execute(new TransactionCallbackWithoutResult() { @@ -262,10 +262,10 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test { Thread.sleep(10); long expireSearchResultsAfterMillis = 1000L; - myDaoConfig.setExpireSearchResultsAfterMillis(expireSearchResultsAfterMillis); + myStorageSettings.setExpireSearchResultsAfterMillis(expireSearchResultsAfterMillis); long reuseCachedSearchResultsForMillis = 500L; - myDaoConfig.setReuseCachedSearchResultsForMillis(reuseCachedSearchResultsForMillis); + myStorageSettings.setReuseCachedSearchResultsForMillis(reuseCachedSearchResultsForMillis); long start = System.currentTimeMillis(); @@ -383,7 +383,7 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test { assertNotNull(search, "Search " + bundleProvider.getUuid() + " not found on disk after 10 seconds"); - myDaoConfig.setExpireSearchResults(false); + myStorageSettings.setExpireSearchResults(false); DatabaseSearchCacheSvcImpl.setNowForUnitTests(System.currentTimeMillis() + DateUtils.MILLIS_PER_DAY); myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); @@ -397,7 +397,7 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test { mySearchCoordinatorSvc.cancelAllActiveSearches(); - myDaoConfig.setExpireSearchResults(true); + myStorageSettings.setExpireSearchResults(true); myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); newTxTemplate().execute(new TransactionCallbackWithoutResult() { diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchSqlTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchSqlTest.java index 25a9c07a218..8c3e7ae8727 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchSqlTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchSqlTest.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.dao.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.test.BaseJpaR4Test; import ca.uhn.fhir.rest.api.Constants; @@ -32,12 +32,12 @@ public class FhirResourceDaoR4SearchSqlTest extends BaseJpaR4Test { @BeforeEach public void before() throws Exception { super.before(); - myDaoConfig.setAdvancedHSearchIndexing(false); + myStorageSettings.setAdvancedHSearchIndexing(false); } @AfterEach public void after() { - myDaoConfig.setTagStorageMode(DaoConfig.DEFAULT_TAG_STORAGE_MODE); + myStorageSettings.setTagStorageMode(JpaStorageSettings.DEFAULT_TAG_STORAGE_MODE); } /** @@ -105,9 +105,9 @@ public class FhirResourceDaoR4SearchSqlTest extends BaseJpaR4Test { @Test public void testSearchByProfile_InlineMode() { - myDaoConfig.setTagStorageMode(DaoConfig.TagStorageModeEnum.INLINE); - boolean reindexParamCache = myDaoConfig.isMarkResourcesForReindexingUponSearchParameterChange(); - myDaoConfig.setMarkResourcesForReindexingUponSearchParameterChange(false); + myStorageSettings.setTagStorageMode(JpaStorageSettings.TagStorageModeEnum.INLINE); + boolean reindexParamCache = myStorageSettings.isMarkResourcesForReindexingUponSearchParameterChange(); + myStorageSettings.setMarkResourcesForReindexingUponSearchParameterChange(false); SearchParameter searchParameter = FhirResourceDaoR4TagsTest.createSearchParamForInlineResourceProfile(); ourLog.debug("SearchParam:\n{}", myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(searchParameter)); @@ -136,7 +136,7 @@ public class FhirResourceDaoR4SearchSqlTest extends BaseJpaR4Test { assertThat(toUnqualifiedVersionlessIds(outcome), Matchers.contains(id)); - myDaoConfig.setMarkResourcesForReindexingUponSearchParameterChange(reindexParamCache); + myStorageSettings.setMarkResourcesForReindexingUponSearchParameterChange(reindexParamCache); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithHSearchDisabledTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithHSearchDisabledTest.java index 4ba86e9c5f5..5b93a30420d 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithHSearchDisabledTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchWithHSearchDisabledTest.java @@ -4,7 +4,6 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.support.ValueSetExpansionOptions; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoValueSet; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; @@ -59,8 +58,7 @@ import static org.junit.jupiter.api.Assertions.fail; @DirtiesContext public class FhirResourceDaoR4SearchWithHSearchDisabledTest extends BaseJpaTest { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirResourceDaoR4SearchWithHSearchDisabledTest.class); - @Autowired - protected DaoConfig myDaoConfig; + private final ValueSetTestUtil myValueSetTestUtil = new ValueSetTestUtil(FhirVersionEnum.R4); @Autowired protected PlatformTransactionManager myTxManager; @Autowired @@ -91,12 +89,11 @@ public class FhirResourceDaoR4SearchWithHSearchDisabledTest extends BaseJpaTest private IBulkDataExportJobSchedulingHelper myBulkDataScheduleHelper; @Autowired private ITermReadSvc myTermSvc; - private final ValueSetTestUtil myValueSetTestUtil = new ValueSetTestUtil(FhirVersionEnum.R4); @BeforeEach @Transactional() public void beforePurgeDatabase() { - purgeDatabase(myDaoConfig, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); + purgeDatabase(myStorageSettings, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); } @Override diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SortTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SortTest.java index 2fb82952185..ea781b9e4cc 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SortTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SortTest.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.dao.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.test.BaseJpaR4Test; import ca.uhn.fhir.rest.api.Constants; @@ -35,7 +35,7 @@ public class FhirResourceDaoR4SortTest extends BaseJpaR4Test { @AfterEach public final void after() { - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); } @Test @@ -216,7 +216,7 @@ public class FhirResourceDaoR4SortTest extends BaseJpaR4Test { @SuppressWarnings("unused") @Test public void testSortOnSparselyPopulatedFields() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); IIdType pid1, pid2, pid3, pid4, pid5, pid6; { @@ -264,7 +264,7 @@ public class FhirResourceDaoR4SortTest extends BaseJpaR4Test { @Test public void testSortOnSparselyPopulatedSearchParameter() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); Patient pCA = new Patient(); pCA.setId("CA"); @@ -326,7 +326,7 @@ public class FhirResourceDaoR4SortTest extends BaseJpaR4Test { @Test public void testSortWithChainedSearch() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); Patient pCA = new Patient(); pCA.setId("CA"); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SourceTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SourceTest.java index 10d48aa96ad..e2c0a516bf5 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SourceTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SourceTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.test.BaseJpaR4Test; import ca.uhn.fhir.rest.api.Constants; @@ -32,12 +32,12 @@ public class FhirResourceDaoR4SourceTest extends BaseJpaR4Test { @AfterEach public final void after() { when(mySrd.getRequestId()).thenReturn(null); - myDaoConfig.setStoreMetaSourceInformation(new DaoConfig().getStoreMetaSourceInformation()); + myStorageSettings.setStoreMetaSourceInformation(new JpaStorageSettings().getStoreMetaSourceInformation()); } @BeforeEach public void before() { - myDaoConfig.setStoreMetaSourceInformation(DaoConfig.StoreMetaSourceInformationEnum.SOURCE_URI_AND_REQUEST_ID); + myStorageSettings.setStoreMetaSourceInformation(JpaStorageSettings.StoreMetaSourceInformationEnum.SOURCE_URI_AND_REQUEST_ID); } @Test @@ -184,7 +184,7 @@ public class FhirResourceDaoR4SourceTest extends BaseJpaR4Test { @Test public void testSourceDisabled() { - myDaoConfig.setStoreMetaSourceInformation(DaoConfig.StoreMetaSourceInformationEnum.NONE); + myStorageSettings.setStoreMetaSourceInformation(JpaStorageSettings.StoreMetaSourceInformationEnum.NONE); when(mySrd.getRequestId()).thenReturn("0000000000000000"); Patient pt0 = new Patient(); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4StandardQueriesNoFTTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4StandardQueriesNoFTTest.java index e9202bde40d..e211e1d7bd0 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4StandardQueriesNoFTTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4StandardQueriesNoFTTest.java @@ -418,7 +418,7 @@ public class FhirResourceDaoR4StandardQueriesNoFTTest extends BaseJpaTest { @Nested class QuantityAndNormalizedQuantitySearch extends QuantitySearchParameterTestCases { QuantityAndNormalizedQuantitySearch() { - super(myDataBuilder, myTestDaoSearch, myDaoConfig); + super(myDataBuilder, myTestDaoSearch, myStorageSettings); } } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TagsTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TagsTest.java index d6215c5a62d..ec8b834464c 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TagsTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TagsTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.rest.api.Constants; @@ -38,7 +38,7 @@ public class FhirResourceDaoR4TagsTest extends BaseResourceProviderR4Test { @AfterEach public final void after() throws Exception { super.after(); - myDaoConfig.setTagStorageMode(DaoConfig.DEFAULT_TAG_STORAGE_MODE); + myStorageSettings.setTagStorageMode(JpaStorageSettings.DEFAULT_TAG_STORAGE_MODE); } @@ -353,7 +353,7 @@ public class FhirResourceDaoR4TagsTest extends BaseResourceProviderR4Test { @Test public void testInlineTags_StoreAndRetrieve() { - myDaoConfig.setTagStorageMode(DaoConfig.TagStorageModeEnum.INLINE); + myStorageSettings.setTagStorageMode(JpaStorageSettings.TagStorageModeEnum.INLINE); // Store a first version Patient patient = new Patient(); @@ -409,7 +409,7 @@ public class FhirResourceDaoR4TagsTest extends BaseResourceProviderR4Test { @Test public void testInlineTags_Search_Tag() { - myDaoConfig.setTagStorageMode(DaoConfig.TagStorageModeEnum.INLINE); + myStorageSettings.setTagStorageMode(JpaStorageSettings.TagStorageModeEnum.INLINE); SearchParameter searchParameter = createResourceTagSearchParameter(); ourLog.debug("SearchParam:\n{}", myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(searchParameter)); @@ -429,7 +429,7 @@ public class FhirResourceDaoR4TagsTest extends BaseResourceProviderR4Test { @Test public void testMetaDelete_TagStorageModeNonVersioned_ShouldShowRemainingTagsInGetAllResources() { - myDaoConfig.setTagStorageMode(DaoConfig.TagStorageModeEnum.NON_VERSIONED); + myStorageSettings.setTagStorageMode(JpaStorageSettings.TagStorageModeEnum.NON_VERSIONED); Patient pt = new Patient(); Meta pMeta = new Meta(); pMeta.addTag().setSystem("urn:system1").setCode("urn:code1"); @@ -474,7 +474,7 @@ public class FhirResourceDaoR4TagsTest extends BaseResourceProviderR4Test { @Test public void testInlineTags_Search_Profile() { - myDaoConfig.setTagStorageMode(DaoConfig.TagStorageModeEnum.INLINE); + myStorageSettings.setTagStorageMode(JpaStorageSettings.TagStorageModeEnum.INLINE); SearchParameter searchParameter = createSearchParamForInlineResourceProfile(); ourLog.debug("SearchParam:\n{}", myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(searchParameter)); @@ -493,7 +493,7 @@ public class FhirResourceDaoR4TagsTest extends BaseResourceProviderR4Test { @Test public void testInlineTags_Search_Security() { - myDaoConfig.setTagStorageMode(DaoConfig.TagStorageModeEnum.INLINE); + myStorageSettings.setTagStorageMode(JpaStorageSettings.TagStorageModeEnum.INLINE); SearchParameter searchParameter = new SearchParameter(); searchParameter.setId("SearchParameter/resource-security"); @@ -559,7 +559,7 @@ public class FhirResourceDaoR4TagsTest extends BaseResourceProviderR4Test { } private void initializeNonVersioned() { - myDaoConfig.setTagStorageMode(DaoConfig.TagStorageModeEnum.NON_VERSIONED); + myStorageSettings.setTagStorageMode(JpaStorageSettings.TagStorageModeEnum.NON_VERSIONED); Patient patient = new Patient(); patient.setId("Patient/A"); @@ -577,7 +577,7 @@ public class FhirResourceDaoR4TagsTest extends BaseResourceProviderR4Test { } private void initializeVersioned() { - myDaoConfig.setTagStorageMode(DaoConfig.TagStorageModeEnum.VERSIONED); + myStorageSettings.setTagStorageMode(JpaStorageSettings.TagStorageModeEnum.VERSIONED); Patient patient = new Patient(); patient.setId("Patient/A"); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyTest.java index 51e46a4531b..ac107678214 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4TerminologyTest.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.context.support.ValueSetExpansionOptions; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; import ca.uhn.fhir.jpa.entity.TermConcept; import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum; @@ -66,14 +66,14 @@ public class FhirResourceDaoR4TerminologyTest extends BaseJpaR4Test { @AfterEach public void after() { - myDaoConfig.setDeferIndexingForCodesystemsOfSize(new DaoConfig().getDeferIndexingForCodesystemsOfSize()); + myStorageSettings.setDeferIndexingForCodesystemsOfSize(new JpaStorageSettings().getDeferIndexingForCodesystemsOfSize()); TermReindexingSvcImpl.setForceSaveDeferredAlwaysForUnitTest(false); } @BeforeEach public void before() { - myDaoConfig.setMaximumExpansionSize(5000); + myStorageSettings.setMaximumExpansionSize(5000); myCachingValidationSupport.invalidateCaches(); } @@ -784,7 +784,7 @@ public class FhirResourceDaoR4TerminologyTest extends BaseJpaR4Test { @Test public void testIndexingIsDeferredForLargeCodeSystems() { - myDaoConfig.setDeferIndexingForCodesystemsOfSize(1); + myStorageSettings.setDeferIndexingForCodesystemsOfSize(1); myTerminologyDeferredStorageSvc.setProcessDeferred(false); @@ -851,7 +851,7 @@ public class FhirResourceDaoR4TerminologyTest extends BaseJpaR4Test { @Disabled public void testRefuseCostlyExpansionFhirCodesystem() { createLocalCsAndVs(); - myDaoConfig.setMaximumExpansionSize(1); + myStorageSettings.setMaximumExpansionSize(1); SearchParameterMap params = new SearchParameterMap(); params.add(AuditEvent.SP_TYPE, new TokenParam(null, "http://hl7.org/fhir/ValueSet/audit-event-type").setModifier(TokenParamModifier.IN)); @@ -866,7 +866,7 @@ public class FhirResourceDaoR4TerminologyTest extends BaseJpaR4Test { @Test public void testRefuseCostlyExpansionLocalCodesystem() { createLocalCsAndVs(); - myDaoConfig.setMaximumExpansionSize(1); + myStorageSettings.setMaximumExpansionSize(1); SearchParameterMap params = new SearchParameterMap(); params.add(Observation.SP_CODE, new TokenParam(TermTestUtil.URL_MY_CODE_SYSTEM, "AAA").setModifier(TokenParamModifier.ABOVE)); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java index e8b4f1ae448..28f60fee5f9 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.model.HistoryCountModeEnum; import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; @@ -167,15 +167,15 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @AfterEach public final void after() { - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setTreatReferencesAsLogical(new DaoConfig().getTreatReferencesAsLogical()); - myDaoConfig.setEnforceReferentialIntegrityOnDelete(new DaoConfig().isEnforceReferentialIntegrityOnDelete()); - myDaoConfig.setEnforceReferenceTargetTypes(new DaoConfig().isEnforceReferenceTargetTypes()); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); - myDaoConfig.setInternalSynchronousSearchSize(new DaoConfig().getInternalSynchronousSearchSize()); - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); - myDaoConfig.setHistoryCountMode(DaoConfig.DEFAULT_HISTORY_COUNT_MODE); - myDaoConfig.setMassIngestionMode(false); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + myStorageSettings.setTreatReferencesAsLogical(new JpaStorageSettings().getTreatReferencesAsLogical()); + myStorageSettings.setEnforceReferentialIntegrityOnDelete(new JpaStorageSettings().isEnforceReferentialIntegrityOnDelete()); + myStorageSettings.setEnforceReferenceTargetTypes(new JpaStorageSettings().isEnforceReferenceTargetTypes()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); + myStorageSettings.setInternalSynchronousSearchSize(new JpaStorageSettings().getInternalSynchronousSearchSize()); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); + myStorageSettings.setHistoryCountMode(JpaStorageSettings.DEFAULT_HISTORY_COUNT_MODE); + myStorageSettings.setMassIngestionMode(false); } private void assertGone(IIdType theId) { @@ -204,7 +204,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } private List extractNames(IBundleProvider theSearch) { @@ -263,7 +263,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @Test public void testDeletedResourcesAreReindexed() { - myDaoConfig.setSchedulingDisabled(true); + myStorageSettings.setSchedulingDisabled(true); Patient pt1 = new Patient(); pt1.setActive(true); @@ -338,7 +338,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @Tag("intermittent") // @Test public void testTermConceptReindexingDoesntDuplicateData() { - myDaoConfig.setSchedulingDisabled(true); + myStorageSettings.setSchedulingDisabled(true); CodeSystem cs = new CodeSystem(); @@ -375,7 +375,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @Test public void testMissingVersionsAreReindexed() { - myDaoConfig.setSchedulingDisabled(true); + myStorageSettings.setSchedulingDisabled(true); Patient pt1 = new Patient(); pt1.setActive(true); @@ -618,7 +618,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @Test public void testChoiceParamQuantityWithNormalizedQuantitySearchSupported() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Observation o3 = new Observation(); o3.getCode().addCoding().setSystem("foo").setCode("testChoiceParam03"); o3.setValue(new Quantity(QuantityComparator.GREATER_THAN, 123.0, UcumServiceUtil.UCUM_CODESYSTEM_URL, "cm", "cm")); // 0.0123m @@ -719,7 +719,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @Test public void testChoiceParamQuantityPrecisionWithNormalizedQuantitySearchSupported() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Observation o3 = new Observation(); o3.getCode().addCoding().setSystem("foo").setCode("testChoiceParam03"); o3.setValue(new Quantity(null, 123.01, UcumServiceUtil.UCUM_CODESYSTEM_URL, "cm", "cm")); // 0.012301 m @@ -1229,7 +1229,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { } // Disable validation - myDaoConfig.setEnforceReferenceTargetTypes(false); + myStorageSettings.setEnforceReferenceTargetTypes(false); Patient p = new Patient(); p.getManagingOrganization().setReferenceElement(id1); myPatientDao.create(p, mySrd); @@ -1371,7 +1371,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @Test public void testDeleteResource() { - myDaoConfig.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); + myStorageSettings.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); int initialHistory = myPatientDao.history(null, null, null, mySrd).size(); @@ -1440,7 +1440,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { */ @Test public void testDeleteResourceWithOutboundDeletedResources() { - myDaoConfig.setEnforceReferentialIntegrityOnDelete(false); + myStorageSettings.setEnforceReferentialIntegrityOnDelete(false); Organization org = new Organization(); org.setId("ORG"); @@ -1761,7 +1761,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @Test public void testDeleteWithMatchUrlQualifierMissing() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); String methodName = "testDeleteWithMatchUrlChainedProfile"; @@ -1848,7 +1848,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @Test public void testHistoryOverMultiplePages() throws Exception { - myDaoConfig.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); + myStorageSettings.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); String methodName = "testHistoryOverMultiplePages"; @@ -2000,7 +2000,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @Test public void testHistoryReflectsMetaOperations() { - myDaoConfig.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); + myStorageSettings.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); Patient inPatient = new Patient(); inPatient.addName().setFamily("version1"); @@ -2086,7 +2086,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @Test public void testHistoryWithFromAndTo() throws Exception { - myDaoConfig.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); + myStorageSettings.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); String methodName = "testHistoryWithFromAndTo"; @@ -2122,7 +2122,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @Test public void testHistoryWithFutureSinceDate() throws Exception { - myDaoConfig.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); + myStorageSettings.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); Date before = new Date(); Thread.sleep(10); @@ -2444,8 +2444,8 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { */ @Test public void testLogicalReferencesAreSearchable() { - myDaoConfig.setTreatReferencesAsLogical(null); - myDaoConfig.addTreatReferencesAsLogical("http://foo.com/identifier*"); + myStorageSettings.setTreatReferencesAsLogical(null); + myStorageSettings.addTreatReferencesAsLogical("http://foo.com/identifier*"); Patient p1 = new Patient(); p1.getManagingOrganization().setReference("http://foo.com/identifier/1"); @@ -2500,13 +2500,13 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { } @Test - public void testDeleteWithMassInjectionModeEnabled(){ - myDaoConfig.setMassIngestionMode(true); + public void testDeleteWithMassInjectionModeEnabled() { + myStorageSettings.setMassIngestionMode(true); // given Observation observation = new Observation() .setStatus(ObservationStatus.FINAL) - .addCategory(newCodeableConcept("http://somesystem","somecode")) + .addCategory(newCodeableConcept("http://somesystem", "somecode")) .setCode(newCodeableConcept("http://loinc.org", "15074-8")); // when @@ -2705,7 +2705,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { IIdType qid2 = myQuestionnaireDao.create(q, mySrd).getId().toUnqualifiedVersionless(); IBundleProvider results = myQuestionnaireDao.search(new SearchParameterMap("title", new StringParam("testQuestionnaireTitleGetsIndexedQ_TITLE")).setLoadSynchronous(true)); - assertEquals(1, results.size().intValue()); + assertEquals(1, results.sizeOrThrowNpe()); assertEquals(qid1, results.getResources(0, 1).get(0).getIdElement().toUnqualifiedVersionless()); assertNotEquals(qid2, results.getResources(0, 1).get(0).getIdElement().toUnqualifiedVersionless()); @@ -3279,7 +3279,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @Test public void testSortByDate() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); Patient p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue("testtestSortByDate"); @@ -3438,7 +3438,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @ParameterizedTest @ValueSource(booleans = {true, false}) public void testSortByMissingAttribute(boolean theIndexMissingData) { - myDaoConfig.setIndexMissingFields(theIndexMissingData ? DaoConfig.IndexEnabledEnum.ENABLED : DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(theIndexMissingData ? JpaStorageSettings.IndexEnabledEnum.ENABLED : JpaStorageSettings.IndexEnabledEnum.DISABLED); Patient p = new Patient(); p.setGender(AdministrativeGender.MALE); @@ -3460,13 +3460,13 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { actual = toUnqualifiedVersionlessIds(myPatientDao.search(spMap)); myCaptureQueriesListener.logSelectQueries(); assertEquals(3, actual.size()); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); } @ParameterizedTest @ValueSource(booleans = {true, false}) public void testSortByMissingAttributeWithChainedSorting(boolean theIndexMissingData) { - myDaoConfig.setIndexMissingFields(theIndexMissingData ? DaoConfig.IndexEnabledEnum.ENABLED : DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(theIndexMissingData ? JpaStorageSettings.IndexEnabledEnum.ENABLED : JpaStorageSettings.IndexEnabledEnum.DISABLED); Patient p = new Patient(); p.addName().addGiven("MalePatientGivenName").setFamily("Bame"); @@ -3495,7 +3495,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { // assert the sorting order assertThat(actual, hasItems(patient2Id, patient3Id, patient1Id)); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); } @Test @@ -3642,7 +3642,6 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @Disabled public void testSortByQuantityWithNormalizedQuantitySearchFullSupported() { -// myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_FULL_SUPPORTED); Observation res; res = new Observation(); @@ -3743,8 +3742,8 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test { @Test public void testSortByString01() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); - myDaoConfig.setAdvancedHSearchIndexing(false); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); + myStorageSettings.setAdvancedHSearchIndexing(false); Patient p = new Patient(); String string = "testSortByString01"; diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UpdateTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UpdateTest.java index a0204af9ca5..7d007ca8cbd 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UpdateTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UpdateTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.jpa.model.entity.ResourceHistoryTable; import ca.uhn.fhir.jpa.model.entity.ResourceTable; @@ -62,10 +62,10 @@ public class FhirResourceDaoR4UpdateTest extends BaseJpaR4Test { @AfterEach public void afterResetDao() { - myDaoConfig.setResourceMetaCountHardLimit(new DaoConfig().getResourceMetaCountHardLimit()); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); - myDaoConfig.setResourceServerIdStrategy(new DaoConfig().getResourceServerIdStrategy()); - myDaoConfig.setResourceClientIdStrategy(new DaoConfig().getResourceClientIdStrategy()); + myStorageSettings.setResourceMetaCountHardLimit(new JpaStorageSettings().getResourceMetaCountHardLimit()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); + myStorageSettings.setResourceServerIdStrategy(new JpaStorageSettings().getResourceServerIdStrategy()); + myStorageSettings.setResourceClientIdStrategy(new JpaStorageSettings().getResourceClientIdStrategy()); } @@ -373,7 +373,7 @@ public class FhirResourceDaoR4UpdateTest extends BaseJpaR4Test { @Test public void testHardMetaCapIsEnforcedOnCreate() { - myDaoConfig.setResourceMetaCountHardLimit(3); + myStorageSettings.setResourceMetaCountHardLimit(3); IIdType id; { @@ -394,7 +394,7 @@ public class FhirResourceDaoR4UpdateTest extends BaseJpaR4Test { @Test public void testHardMetaCapIsEnforcedOnMetaAdd() { - myDaoConfig.setResourceMetaCountHardLimit(3); + myStorageSettings.setResourceMetaCountHardLimit(3); IIdType id; { @@ -874,7 +874,7 @@ public class FhirResourceDaoR4UpdateTest extends BaseJpaR4Test { @Test public void testUpdateWithNoChangeDetectionDisabledUpdateUnchanged() { - myDaoConfig.setSuppressUpdatesWithNoChange(false); + myStorageSettings.setSuppressUpdatesWithNoChange(false); String name = "testUpdateUnchanged"; IIdType id1, id2; @@ -1059,8 +1059,8 @@ public class FhirResourceDaoR4UpdateTest extends BaseJpaR4Test { @Test public void testUpdateWithUuidServerResourceStrategy_ClientIdNotAllowed() { - myDaoConfig.setResourceServerIdStrategy(DaoConfig.IdStrategyEnum.UUID); - myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.NOT_ALLOWED); + myStorageSettings.setResourceServerIdStrategy(JpaStorageSettings.IdStrategyEnum.UUID); + myStorageSettings.setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.NOT_ALLOWED); Patient p = new Patient(); p.setId(UUID.randomUUID().toString()); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java index a0e75b05c01..2056bc76f0d 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java @@ -4,7 +4,7 @@ import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.context.support.ValidationSupportContext; import ca.uhn.fhir.context.support.ValueSetExpansionOptions; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; @@ -118,9 +118,9 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test { FhirInstanceValidator val = AopTestUtils.getTargetObject(myValidatorModule); val.setBestPracticeWarningLevel(BestPracticeWarningLevel.Warning); - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setMaximumExpansionSize(DaoConfig.DEFAULT_MAX_EXPANSION_SIZE); - myDaoConfig.setPreExpandValueSets(new DaoConfig().isPreExpandValueSets()); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + myStorageSettings.setMaximumExpansionSize(JpaStorageSettings.DEFAULT_MAX_EXPANSION_SIZE); + myStorageSettings.setPreExpandValueSets(new JpaStorageSettings().isPreExpandValueSets()); TermReadSvcImpl.setInvokeOnNextCallForUnitTest(null); @@ -624,7 +624,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test { */ @Test public void testValidateCode_InMemoryExpansionAgainstHugeValueSet() throws Exception { - myDaoConfig.setPreExpandValueSets(false); + myStorageSettings.setPreExpandValueSets(false); ValueSet vs = new ValueSet(); vs.setUrl("http://example.com/fhir/ValueSet/observation-vitalsignresult"); @@ -645,7 +645,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test { } myTermCodeSystemStorageSvc.applyDeltaCodeSystemsAdd("http://loinc.org", codesToAdd); - myDaoConfig.setMaximumExpansionSize(50); + myStorageSettings.setMaximumExpansionSize(50); Observation obs = new Observation(); obs.getMeta().addProfile("http://example.com/fhir/StructureDefinition/vitalsigns-2"); @@ -1084,7 +1084,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test { */ @Test public void testValidateCode_PreExpansionAgainstHugeValueSet() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); // Add a bunch of codes CustomTerminologySet codesToAdd = new CustomTerminologySet(); @@ -1741,7 +1741,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test { @Test public void testValidateForDeleteWithReferentialIntegrityDisabled() { - myDaoConfig.setEnforceReferentialIntegrityOnDelete(false); + myStorageSettings.setEnforceReferentialIntegrityOnDelete(false); String methodName = "testValidateForDelete"; Organization org = new Organization(); @@ -1755,7 +1755,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test { myOrganizationDao.validate(null, orgId, null, null, ValidationModeEnum.DELETE, null, mySrd); - myDaoConfig.setEnforceReferentialIntegrityOnDelete(true); + myStorageSettings.setEnforceReferentialIntegrityOnDelete(true); try { myOrganizationDao.validate(null, orgId, null, null, ValidationModeEnum.DELETE, null, mySrd); fail(); @@ -1763,7 +1763,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test { // good } - myDaoConfig.setEnforceReferentialIntegrityOnDelete(false); + myStorageSettings.setEnforceReferentialIntegrityOnDelete(false); myOrganizationDao.read(orgId); @@ -1781,7 +1781,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test { @Test public void testValidateUsCoreR4Content() throws IOException { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); upload("/r4/uscore/CodeSystem-cdcrec.json"); upload("/r4/uscore/StructureDefinition-us-core-birthsex.json"); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValueSetTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValueSetTest.java index f33bb6b985c..bc9d9b61364 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValueSetTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValueSetTest.java @@ -5,7 +5,7 @@ import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.context.support.ValidationSupportContext; import ca.uhn.fhir.context.support.ValueSetExpansionOptions; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.entity.TermConcept; import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink; import ca.uhn.fhir.jpa.term.TermReadSvcImpl; @@ -51,8 +51,8 @@ public class FhirResourceDaoR4ValueSetTest extends BaseJpaR4Test { @AfterEach public void after() { TermReadSvcImpl.setForceDisableHibernateSearchForUnitTest(false); - myDaoConfig.setPreExpandValueSets(new DaoConfig().isPreExpandValueSets()); - myDaoConfig.setMaximumExpansionSize(new DaoConfig().getMaximumExpansionSize()); + myStorageSettings.setPreExpandValueSets(new JpaStorageSettings().isPreExpandValueSets()); + myStorageSettings.setMaximumExpansionSize(new JpaStorageSettings().getMaximumExpansionSize()); } @@ -380,7 +380,7 @@ public class FhirResourceDaoR4ValueSetTest extends BaseJpaR4Test { @Test public void testValidateCodeOperationByResourceIdAndCodeableConceptWithExistingValueSetAndPreExpansionEnabled() { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); UriType valueSetIdentifier = null; IIdType id = myExtensionalVsId; @@ -421,7 +421,7 @@ public class FhirResourceDaoR4ValueSetTest extends BaseJpaR4Test { @Test public void testValidateCodeOperationByResourceIdAndCodeAndSystemWithExistingValueSetAndPreExpansionEnabled() { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); UriType valueSetIdentifier = null; IIdType id = myExtensionalVsId; @@ -500,7 +500,7 @@ public class FhirResourceDaoR4ValueSetTest extends BaseJpaR4Test { codesToAdd.addRootConcept("CODE" + i, "Display " + i); } myTermCodeSystemStorageSvc.applyDeltaCodeSystemsAdd("http://loinc.org", codesToAdd); - myDaoConfig.setMaximumExpansionSize(50); + myStorageSettings.setMaximumExpansionSize(50); ValueSet vs = new ValueSet(); vs.setUrl("http://example.com/fhir/ValueSet/observation-vitalsignresult"); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4VersionedReferenceTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4VersionedReferenceTest.java index 91fd62cddbf..10e4ec59535 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4VersionedReferenceTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4VersionedReferenceTest.java @@ -1,8 +1,7 @@ package ca.uhn.fhir.jpa.dao.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.test.BaseJpaR4Test; @@ -56,15 +55,15 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { public void afterEach() { myFhirContext.getParserOptions().setStripVersionsFromReferences(true); myFhirContext.getParserOptions().getDontStripVersionsFromReferencesAtPaths().clear(); - myDaoConfig.setDeleteEnabled(new DaoConfig().isDeleteEnabled()); - myModelConfig.setRespectVersionsForSearchIncludes(new ModelConfig().isRespectVersionsForSearchIncludes()); - myModelConfig.setAutoVersionReferenceAtPaths(new ModelConfig().getAutoVersionReferenceAtPaths()); + myStorageSettings.setDeleteEnabled(new JpaStorageSettings().isDeleteEnabled()); + myStorageSettings.setRespectVersionsForSearchIncludes(new JpaStorageSettings().isRespectVersionsForSearchIncludes()); + myStorageSettings.setAutoVersionReferenceAtPaths(new JpaStorageSettings().getAutoVersionReferenceAtPaths()); } @Test public void testCreateAndUpdateVersionedReferencesInTransaction_VersionedReferenceToUpsertWithNop() { myFhirContext.getParserOptions().setStripVersionsFromReferences(false); - myModelConfig.setAutoVersionReferenceAtPaths("ExplanationOfBenefit.patient"); + myStorageSettings.setAutoVersionReferenceAtPaths("ExplanationOfBenefit.patient"); // We'll submit the same bundle twice. It has an UPSERT (with no changes // the second time) on a Patient, and a CREATE on an ExplanationOfBenefit @@ -107,7 +106,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { @Test public void testCreateAndUpdateVersionedReferencesInTransaction_VersionedReferenceToVersionedReferenceToUpsertWithNop() { myFhirContext.getParserOptions().setStripVersionsFromReferences(false); - myModelConfig.setAutoVersionReferenceAtPaths( + myStorageSettings.setAutoVersionReferenceAtPaths( "Patient.managingOrganization", "ExplanationOfBenefit.patient" ); @@ -167,7 +166,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { @Test public void testCreateAndUpdateVersionedReferencesInTransaction_VersionedReferenceToVersionedReferenceToUpsertWithChange() { myFhirContext.getParserOptions().setStripVersionsFromReferences(false); - myModelConfig.setAutoVersionReferenceAtPaths( + myStorageSettings.setAutoVersionReferenceAtPaths( "Patient.managingOrganization", "ExplanationOfBenefit.patient" ); @@ -268,7 +267,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { @Test public void testInsertVersionedReferenceAtPath() { myFhirContext.getParserOptions().setStripVersionsFromReferences(false); - myModelConfig.setAutoVersionReferenceAtPaths("Observation.subject"); + myStorageSettings.setAutoVersionReferenceAtPaths("Observation.subject"); Patient p = new Patient(); p.setActive(true); @@ -306,7 +305,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { @Test public void testInsertVersionedReferenceAtPath_InTransaction_SourceAndTargetBothCreated() { myFhirContext.getParserOptions().setStripVersionsFromReferences(false); - myModelConfig.setAutoVersionReferenceAtPaths("Observation.subject"); + myStorageSettings.setAutoVersionReferenceAtPaths("Observation.subject"); BundleBuilder builder = new BundleBuilder(myFhirContext); @@ -343,7 +342,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { @Test public void testInsertVersionedReferenceAtPath_InTransaction_TargetConditionalCreatedNop() { myFhirContext.getParserOptions().setStripVersionsFromReferences(false); - myModelConfig.setAutoVersionReferenceAtPaths("Observation.subject"); + myStorageSettings.setAutoVersionReferenceAtPaths("Observation.subject"); { // Create patient @@ -406,8 +405,8 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { @Test public void testInsertVersionedReferenceAtPath_InTransaction_TargetUpdate() { myFhirContext.getParserOptions().setStripVersionsFromReferences(false); - myDaoConfig.setDeleteEnabled(false); - myModelConfig.setAutoVersionReferenceAtPaths("Observation.subject"); + myStorageSettings.setDeleteEnabled(false); + myStorageSettings.setAutoVersionReferenceAtPaths("Observation.subject"); { // Create patient @@ -455,7 +454,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { @Test public void testInsertVersionedReferenceAtPath_InTransaction_TargetUpdateConditional() { myFhirContext.getParserOptions().setStripVersionsFromReferences(false); - myModelConfig.setAutoVersionReferenceAtPaths("Observation.subject"); + myStorageSettings.setAutoVersionReferenceAtPaths("Observation.subject"); { // Create patient @@ -505,7 +504,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { @Test public void testSearchAndIncludeVersionedReference_Asynchronous() { myFhirContext.getParserOptions().setStripVersionsFromReferences(false); - myModelConfig.setRespectVersionsForSearchIncludes(true); + myStorageSettings.setRespectVersionsForSearchIncludes(true); // Create the patient Patient p = new Patient(); @@ -546,7 +545,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { @Test public void testSearchAndIncludeVersionedReference_Synchronous() { myFhirContext.getParserOptions().setStripVersionsFromReferences(false); - myModelConfig.setRespectVersionsForSearchIncludes(true); + myStorageSettings.setRespectVersionsForSearchIncludes(true); // Create the patient Patient p = new Patient(); @@ -589,7 +588,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { HashSet refPaths = new HashSet(); refPaths.add("Task.basedOn"); myFhirContext.getParserOptions().setDontStripVersionsFromReferencesAtPaths(refPaths); - myModelConfig.setRespectVersionsForSearchIncludes(true); + myStorageSettings.setRespectVersionsForSearchIncludes(true); myFhirContext.getParserOptions().setStripVersionsFromReferences(false); // Create a Condition @@ -629,7 +628,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { HashSet refPaths = new HashSet(); refPaths.add("Task.basedOn"); myFhirContext.getParserOptions().setDontStripVersionsFromReferencesAtPaths(refPaths); - myModelConfig.setRespectVersionsForSearchIncludes(true); + myStorageSettings.setRespectVersionsForSearchIncludes(true); myFhirContext.getParserOptions().setStripVersionsFromReferences(false); // Create a Condition @@ -664,7 +663,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { HashSet refPaths = new HashSet(); refPaths.add("Task.basedOn"); myFhirContext.getParserOptions().setDontStripVersionsFromReferencesAtPaths(refPaths); - myModelConfig.setRespectVersionsForSearchIncludes(true); + myStorageSettings.setRespectVersionsForSearchIncludes(true); myFhirContext.getParserOptions().setStripVersionsFromReferences(false); // Create a Condition @@ -706,7 +705,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { @Test public void testSearchAndIncludeUnersionedReference_Asynchronous() { myFhirContext.getParserOptions().setStripVersionsFromReferences(true); - myModelConfig.setRespectVersionsForSearchIncludes(true); + myStorageSettings.setRespectVersionsForSearchIncludes(true); // Create the patient Patient p = new Patient(); @@ -747,7 +746,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { @Test public void testSearchAndIncludeUnversionedReference_Synchronous() { myFhirContext.getParserOptions().setStripVersionsFromReferences(true); - myModelConfig.setRespectVersionsForSearchIncludes(true); + myStorageSettings.setRespectVersionsForSearchIncludes(true); // Create the patient Patient p = new Patient(); @@ -790,7 +789,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { @Test public void testNoNpeOnEoBBundle() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); List strings = Arrays.asList( "ExplanationOfBenefit.patient", "ExplanationOfBenefit.insurer", @@ -799,7 +798,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { "ExplanationOfBenefit.insurance.coverage", "ExplanationOfBenefit.payee.party" ); - myModelConfig.setAutoVersionReferenceAtPaths(new HashSet<>(strings)); + myStorageSettings.setAutoVersionReferenceAtPaths(new HashSet<>(strings)); Bundle bundle = myFhirContext.newJsonParser().parseResource(Bundle.class, new InputStreamReader( @@ -812,7 +811,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { @Test public void testAutoVersionPathsWithAutoCreatePlaceholders() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); Observation obs = new Observation(); obs.setId("Observation/CDE"); @@ -825,7 +824,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { Patient p = myPatientDao.read(new IdDt("Patient/ABC")); Assertions.assertNotNull(p); - myModelConfig.setAutoVersionReferenceAtPaths("Observation.subject"); + myStorageSettings.setAutoVersionReferenceAtPaths("Observation.subject"); obs = new Observation(); obs.setId("Observation/DEF"); @@ -871,7 +870,7 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { @Test @DisplayName("Bundle transaction with AutoVersionReferenceAtPath on and with existing Patient resource should create") public void bundleTransaction_autoreferenceAtPathWithPreexistingPatientReference_shouldCreate() { - myModelConfig.setAutoVersionReferenceAtPaths("Observation.subject"); + myStorageSettings.setAutoVersionReferenceAtPaths("Observation.subject"); String patientId = "Patient/RED"; IIdType idType = new IdDt(patientId); @@ -911,8 +910,8 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { @Test @DisplayName("GH-2901 Test no NPE is thrown on autoversioned references") public void testNoNpeMinimal() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); - myModelConfig.setAutoVersionReferenceAtPaths("Observation.subject"); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAutoVersionReferenceAtPaths("Observation.subject"); Observation obs = new Observation(); obs.setId("Observation/DEF"); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java index 7a5bb105a16..7a3d8cc05e1 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java @@ -1,9 +1,8 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; import ca.uhn.fhir.jpa.model.entity.ResourceEncodingEnum; import ca.uhn.fhir.jpa.model.entity.ResourceHistoryTable; @@ -128,21 +127,21 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { @AfterEach public void after() { - myDaoConfig.setAllowInlineMatchUrlReferences(false); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); - myDaoConfig.setBundleBatchPoolSize(new DaoConfig().getBundleBatchPoolSize()); - myDaoConfig.setBundleBatchMaxPoolSize(new DaoConfig().getBundleBatchMaxPoolSize()); - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(new DaoConfig().isAutoCreatePlaceholderReferenceTargets()); - myModelConfig.setAutoVersionReferenceAtPaths(new ModelConfig().getAutoVersionReferenceAtPaths()); + myStorageSettings.setAllowInlineMatchUrlReferences(false); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); + myStorageSettings.setBundleBatchPoolSize(new JpaStorageSettings().getBundleBatchPoolSize()); + myStorageSettings.setBundleBatchMaxPoolSize(new JpaStorageSettings().getBundleBatchMaxPoolSize()); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(new JpaStorageSettings().isAutoCreatePlaceholderReferenceTargets()); + myStorageSettings.setAutoVersionReferenceAtPaths(new JpaStorageSettings().getAutoVersionReferenceAtPaths()); myFhirContext.getParserOptions().setAutoContainReferenceTargetsWithNoId(true); } @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); - myDaoConfig.setBundleBatchPoolSize(1); - myDaoConfig.setBundleBatchMaxPoolSize(1); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setBundleBatchPoolSize(1); + myStorageSettings.setBundleBatchMaxPoolSize(1); } private Bundle createInputTransactionWithPlaceholderIdInMatchUrl(HTTPVerb theVerb) { @@ -328,9 +327,9 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { myObservationDao.create(o); Map counts = mySystemDao.getResourceCounts(); - assertEquals(new Long(1L), counts.get("Patient")); - assertEquals(new Long(1L), counts.get("Observation")); - assertEquals(null, counts.get("Organization")); + assertEquals(Long.valueOf(1L), counts.get("Patient")); + assertEquals(Long.valueOf(1L), counts.get("Observation")); + assertNull(counts.get("Organization")); } @@ -674,7 +673,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { @Test public void testReindexingSingleStringHashValueIsDeleted() { - myDaoConfig.setAdvancedHSearchIndexing(false); + myStorageSettings.setAdvancedHSearchIndexing(false); Patient p = new Patient(); p.addName().setFamily("family1"); final IIdType id = myPatientDao.create(p, mySrd).getId().toUnqualifiedVersionless(); @@ -1086,7 +1085,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { String methodName = "testTransactionCreateInlineMatchUrlWithNoMatches"; Bundle request = new Bundle(); - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Observation o = new Observation(); o.getCode().setText("Some Observation"); @@ -1271,7 +1270,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { String methodName = "testTransactionCreateInlineMatchUrlWithOneMatch"; Bundle request = new Bundle(); - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Patient p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); @@ -1335,7 +1334,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { String methodName = "testTransactionCreateInlineMatchUrlWithOneMatch2"; Bundle request = new Bundle(); - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Patient p = new Patient(); p.addName().addGiven("Heute"); @@ -1422,7 +1421,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { String methodName = "testTransactionCreateInlineMatchUrlWithAuthorizationAllowed"; Bundle request = new Bundle(); - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Patient p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); @@ -1467,7 +1466,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { String methodName = "testTransactionCreateInlineMatchUrlWithAuthorizationDenied"; Bundle request = new Bundle(); - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Patient p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); @@ -1515,8 +1514,8 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { Bundle request1 = new Bundle(); Bundle request2 = new Bundle(); - myDaoConfig.setAllowInlineMatchUrlReferences(true); - myDaoConfig.setMatchUrlCacheEnabled(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setMatchUrlCacheEnabled(true); Patient p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(patientId); @@ -1782,7 +1781,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { String methodName = "testTransactionCreateInlineMatchUrlWithTwoMatches"; Bundle request = new Bundle(); - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Patient p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); @@ -2413,7 +2412,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { @Test public void testTransactionDeleteMatchUrlWithTwoMatch() { - myDaoConfig.setAllowMultipleDelete(false); + myStorageSettings.setAllowMultipleDelete(false); String methodName = "testTransactionDeleteMatchUrlWithTwoMatch"; @@ -2915,7 +2914,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { @Test public void testTransactionOruBundle() throws IOException { - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); String input = IOUtils.toString(getClass().getResourceAsStream("/r4/oruBundle.json"), StandardCharsets.UTF_8); @@ -3690,7 +3689,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { @Test public void testTransactionWithConditionalUpdateDoesntUpdateIfNoChangeWithNormalizedQuantitySearchSupported() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Observation obs = new Observation(); obs.addIdentifier() .setSystem("http://acme.org") @@ -3847,7 +3846,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { @Test public void testTransactionWithInlineMatchUrl() throws Exception { - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Patient patient = new Patient(); patient.addIdentifier().setSystem("http://www.ghh.org/identifiers").setValue("condreftestpatid1"); @@ -3863,7 +3862,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { @Test public void testTransactionWithInlineMatchUrlMultipleMatches() throws Exception { - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Patient patient = new Patient(); patient.addIdentifier().setSystem("http://www.ghh.org/identifiers").setValue("condreftestpatid1"); @@ -3887,7 +3886,7 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { @Test public void testTransactionWithInlineMatchUrlNoMatches() throws Exception { - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); String input = IOUtils.toString(getClass().getResourceAsStream("/simone-conditional-url.xml"), StandardCharsets.UTF_8); Bundle bundle = myFhirContext.newXmlParser().parseResource(Bundle.class, input); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/JpaHistoryR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/JpaHistoryR4Test.java index ea605ea5d46..2434b65c6b3 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/JpaHistoryR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/JpaHistoryR4Test.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.dao.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.HistoryCountModeEnum; import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.rest.api.server.IBundleProvider; @@ -35,12 +35,12 @@ public class JpaHistoryR4Test extends BaseJpaR4SystemTest { @AfterEach public void after() { - myDaoConfig.setHistoryCountMode(DaoConfig.DEFAULT_HISTORY_COUNT_MODE); + myStorageSettings.setHistoryCountMode(JpaStorageSettings.DEFAULT_HISTORY_COUNT_MODE); } @Test public void testTypeHistory_TotalDisabled() { - myDaoConfig.setHistoryCountMode(HistoryCountModeEnum.COUNT_DISABLED); + myStorageSettings.setHistoryCountMode(HistoryCountModeEnum.COUNT_DISABLED); create20Patients(); /* @@ -67,7 +67,7 @@ public class JpaHistoryR4Test extends BaseJpaR4SystemTest { @Test public void testTypeHistory_CountAccurate() { - myDaoConfig.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); + myStorageSettings.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); create20Patients(); /* diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningSqlR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningSqlR4Test.java index 63ad5e5090d..f4b32ac4d51 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningSqlR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/PartitioningSqlR4Test.java @@ -6,7 +6,7 @@ import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.entity.ForcedId; @@ -105,7 +105,7 @@ public class PartitioningSqlR4Test extends BasePartitioningR4Test { @BeforeEach public void disableAdvanceIndexing() { - myDaoConfig.setAdvancedHSearchIndexing(false); + myStorageSettings.setAdvancedHSearchIndexing(false); // ugh - somewhere the hibernate round trip is mangling LocalDate to h2 date column unless the tz=GMT TimeZone.setDefault(TimeZone.getTimeZone("GMT")); ourLog.info("Running with Timezone {}", TimeZone.getDefault().getID()); @@ -113,12 +113,12 @@ public class PartitioningSqlR4Test extends BasePartitioningR4Test { @BeforeEach public void beforeEach() { - myDaoConfig.setMarkResourcesForReindexingUponSearchParameterChange(false); + myStorageSettings.setMarkResourcesForReindexingUponSearchParameterChange(false); } @AfterEach public void afterEach() { - myDaoConfig.setMarkResourcesForReindexingUponSearchParameterChange(new DaoConfig().isMarkResourcesForReindexingUponSearchParameterChange()); + myStorageSettings.setMarkResourcesForReindexingUponSearchParameterChange(new JpaStorageSettings().isMarkResourcesForReindexingUponSearchParameterChange()); } @Test @@ -143,7 +143,7 @@ public class PartitioningSqlR4Test extends BasePartitioningR4Test { @Test public void testCreate_CrossPartitionReference_ByPid_Allowed() { myPartitionSettings.setAllowReferencesAcrossPartitions(PartitionSettings.CrossPartitionReferenceMode.ALLOWED_UNQUALIFIED); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); // Create patient in partition 1 addCreatePartition(myPartitionId, myPartitionDate); @@ -342,7 +342,7 @@ public class PartitioningSqlR4Test extends BasePartitioningR4Test { @Test public void testCreate_AutoCreatePlaceholderTargets() { - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); addCreatePartition(1, null); addCreatePartition(1, null); @@ -743,7 +743,7 @@ public class PartitioningSqlR4Test extends BasePartitioningR4Test { @Test public void testUpdateConditionalInPartition() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); createRequestId(); // Create a resource @@ -2703,7 +2703,7 @@ public class PartitioningSqlR4Test extends BasePartitioningR4Test { @Test public void testTransaction_MultipleConditionalUpdates() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); AtomicInteger counter = new AtomicInteger(0); Supplier input = () -> { @@ -2788,8 +2788,8 @@ public class PartitioningSqlR4Test extends BasePartitioningR4Test { /* * Third time with mass ingestion mode enabled */ - myDaoConfig.setMassIngestionMode(true); - myDaoConfig.setMatchUrlCache(true); + myStorageSettings.setMassIngestionMode(true); + myStorageSettings.setMatchUrlCache(true); myCaptureQueriesListener.clear(); outcome = mySystemDao.transaction(mySrd, input.get()); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchParamExtractorR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchParamExtractorR4Test.java index 2cc96efda2b..95ec6a99250 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchParamExtractorR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchParamExtractorR4Test.java @@ -4,7 +4,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeSearchParam; import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParam; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantity; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantityNormalized; @@ -68,14 +68,14 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { private static final FhirContext ourCtx = FhirContext.forR4Cached(); private final FhirContextSearchParamRegistry mySearchParamRegistry = new FhirContextSearchParamRegistry(ourCtx); private final PartitionSettings myPartitionSettings = new PartitionSettings(); - final ModelConfig myModelConfig = new ModelConfig(); + final StorageSettings myStorageSettings = new StorageSettings(); @Test public void testParamWithOrInPath() { Observation obs = new Observation(); obs.addCategory().addCoding().setSystem("SYSTEM").setCode("CODE"); - SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new ModelConfig(), new PartitionSettings(), ourCtx, mySearchParamRegistry); + SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new StorageSettings(), new PartitionSettings(), ourCtx, mySearchParamRegistry); Set tokens = extractor.extractSearchParamTokens(obs); assertEquals(1, tokens.size()); ResourceIndexedSearchParamToken token = (ResourceIndexedSearchParamToken) tokens.iterator().next(); @@ -95,7 +95,7 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { humanName.setText("King Jimmy Jones the Great"); humanName.setSuffix(suffixStrings); humanName.setPrefix(prefixStrings); - SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new ModelConfig(), new PartitionSettings(), ourCtx, mySearchParamRegistry); + SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new StorageSettings(), new PartitionSettings(), ourCtx, mySearchParamRegistry); ISearchParamExtractor.SearchParamSet stringSearchParams = extractor.extractSearchParamStrings(patient); List nameValues = stringSearchParams.stream().filter(param -> "name".equals(param.getParamName())).map(ResourceIndexedSearchParamString::getValueExact).collect(Collectors.toList()); assertThat(nameValues, containsInAnyOrder("Jimmy", "Jones", "King Jimmy Jones the Great", "King", "the Great")); @@ -106,7 +106,7 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { SearchParameter sp = new SearchParameter(); sp.addUseContext().setCode(new Coding().setSystem("http://system").setCode("code")); - SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new ModelConfig(), new PartitionSettings(), ourCtx, mySearchParamRegistry); + SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new StorageSettings(), new PartitionSettings(), ourCtx, mySearchParamRegistry); Set tokens = extractor.extractSearchParamTokens(sp); assertEquals(1, tokens.size()); ResourceIndexedSearchParamToken token = (ResourceIndexedSearchParamToken) tokens.iterator().next(); @@ -120,7 +120,7 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { Observation obs = new Observation(); obs.getCode().addCoding().setSystem("http://system").setCode("code").setDisplay("Help Im a Bug"); - SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new ModelConfig(), myPartitionSettings, ourCtx, mySearchParamRegistry); + SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new StorageSettings(), myPartitionSettings, ourCtx, mySearchParamRegistry); List tokens = extractor.extractSearchParamTokens(obs) .stream() @@ -149,7 +149,7 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { Observation obs = new Observation(); obs.getCode().addCoding().setSystem("http://system").setCode("code").setDisplay("Help Im a Bug"); - SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new ModelConfig(), myPartitionSettings, ourCtx, mySearchParamRegistry); + SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new StorageSettings(), myPartitionSettings, ourCtx, mySearchParamRegistry); List tokens = extractor.extractSearchParamTokens(obs) .stream() @@ -166,14 +166,14 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { } @Test - public void testTokenText_DisabledInModelConfig_Coding() { - ModelConfig modelConfig = new ModelConfig(); - modelConfig.setSuppressStringIndexingInTokens(true); + public void testTokenText_DisabledInStorageSettings_Coding() { + StorageSettings storageSettings = new StorageSettings(); + storageSettings.setSuppressStringIndexingInTokens(true); Observation obs = new Observation(); obs.getCode().addCoding().setSystem("http://system").setCode("code").setDisplay("Help Im a Bug"); - SearchParamExtractorR4 extractor = new SearchParamExtractorR4(modelConfig, myPartitionSettings, ourCtx, mySearchParamRegistry); + SearchParamExtractorR4 extractor = new SearchParamExtractorR4(storageSettings, myPartitionSettings, ourCtx, mySearchParamRegistry); List tokens = extractor.extractSearchParamTokens(obs) .stream() @@ -190,9 +190,9 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { } @Test - public void testTokenText_DisabledInModelConfigButForcedInSearchParam_Coding() { - ModelConfig modelConfig = new ModelConfig(); - modelConfig.setSuppressStringIndexingInTokens(true); + public void testTokenText_DisabledInStorageSettingsButForcedInSearchParam_Coding() { + StorageSettings storageSettings = new StorageSettings(); + storageSettings.setSuppressStringIndexingInTokens(true); RuntimeSearchParam existingCodeSp = mySearchParamRegistry.getActiveSearchParams("Observation").get("code"); RuntimeSearchParam codeSearchParam = new RuntimeSearchParam(existingCodeSp); @@ -202,7 +202,7 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { Observation obs = new Observation(); obs.getCode().addCoding().setSystem("http://system").setCode("code").setDisplay("Help Im a Bug"); - SearchParamExtractorR4 extractor = new SearchParamExtractorR4(modelConfig, myPartitionSettings, ourCtx, mySearchParamRegistry); + SearchParamExtractorR4 extractor = new SearchParamExtractorR4(storageSettings, myPartitionSettings, ourCtx, mySearchParamRegistry); List tokens = extractor.extractSearchParamTokens(obs) .stream() @@ -227,7 +227,7 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { Encounter enc = new Encounter(); enc.addLocation().setLocation(new Reference("Location/123")); - SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new ModelConfig(), new PartitionSettings(), ourCtx, mySearchParamRegistry); + SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new StorageSettings(), new PartitionSettings(), ourCtx, mySearchParamRegistry); RuntimeSearchParam param = mySearchParamRegistry.getActiveSearchParam("Encounter", "location"); assertNotNull(param); ISearchParamExtractor.SearchParamSet links = extractor.extractResourceLinks(enc, false); @@ -242,7 +242,7 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { Consent consent = new Consent(); consent.setSource(new Reference().setReference("Consent/999")); - SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new ModelConfig(), new PartitionSettings(), ourCtx, mySearchParamRegistry); + SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new StorageSettings(), new PartitionSettings(), ourCtx, mySearchParamRegistry); RuntimeSearchParam param = mySearchParamRegistry.getActiveSearchParam("Consent", Consent.SP_SOURCE_REFERENCE); assertNotNull(param); ISearchParamExtractor.SearchParamSet links = extractor.extractResourceLinks(consent, false); @@ -257,7 +257,7 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { Patient p = new Patient(); p.addIdentifier().setSystem("sys").setValue("val"); - SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new ModelConfig(), new PartitionSettings(), ourCtx, mySearchParamRegistry); + SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new StorageSettings(), new PartitionSettings(), ourCtx, mySearchParamRegistry); RuntimeSearchParam param = mySearchParamRegistry.getActiveSearchParam("Patient", Patient.SP_IDENTIFIER); assertNotNull(param); ISearchParamExtractor.SearchParamSet params = extractor.extractSearchParamTokens(p, param); @@ -279,7 +279,7 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { Patient patient = new Patient(); patient.addExtension("http://patext", new Reference("Organization/AAA")); - SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new ModelConfig(), new PartitionSettings(), ourCtx, mySearchParamRegistry); + SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new StorageSettings(), new PartitionSettings(), ourCtx, mySearchParamRegistry); ISearchParamExtractor.SearchParamSet links = extractor.extractResourceLinks(patient, false); assertEquals(1, links.size()); @@ -295,7 +295,7 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { .setCode(new CodeableConcept().addCoding(new Coding().setSystem("http://foo").setCode("code2"))) .setValue(new Quantity().setSystem("http://bar").setCode("code2").setValue(200)); - SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new ModelConfig(), new PartitionSettings(), ourCtx, mySearchParamRegistry); + SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new StorageSettings(), new PartitionSettings(), ourCtx, mySearchParamRegistry); Set links = extractor.extractSearchParamQuantity(o1); ourLog.info("Links:\n {}", links.stream().map(t -> t.toString()).collect(Collectors.joining("\n "))); assertEquals(4, links.size()); @@ -304,16 +304,16 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { @Test public void testExtractComponentQuantityWithNormalizedQuantitySearchSupported() { - ModelConfig modelConfig = new ModelConfig(); + StorageSettings storageSettings = new StorageSettings(); - modelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + storageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Observation o1 = new Observation(); o1.addComponent() .setCode(new CodeableConcept().addCoding(new Coding().setSystem("http://foo").setCode("code1"))) .setValue(new Quantity().setSystem(UcumServiceUtil.UCUM_CODESYSTEM_URL).setCode("cm").setValue(200)); - SearchParamExtractorR4 extractor = new SearchParamExtractorR4(modelConfig, new PartitionSettings(), ourCtx, mySearchParamRegistry); + SearchParamExtractorR4 extractor = new SearchParamExtractorR4(storageSettings, new PartitionSettings(), ourCtx, mySearchParamRegistry); Set links = extractor.extractSearchParamQuantityNormalized(o1); ourLog.info("Links:\n {}", links.stream().map(t -> t.toString()).collect(Collectors.joining("\n "))); assertEquals(2, links.size()); @@ -323,9 +323,9 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { @Test public void testExtractComponentQuantityValueWithNormalizedQuantitySearchSupported() { - ModelConfig modelConfig = new ModelConfig(); + StorageSettings storageSettings = new StorageSettings(); - modelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + storageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Observation o1 = new Observation(); @@ -335,7 +335,7 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { RuntimeSearchParam existingCodeSp = mySearchParamRegistry.getActiveSearchParams("Observation").get("component-value-quantity"); - SearchParamExtractorR4 extractor = new SearchParamExtractorR4(modelConfig, new PartitionSettings(), ourCtx, mySearchParamRegistry); + SearchParamExtractorR4 extractor = new SearchParamExtractorR4(storageSettings, new PartitionSettings(), ourCtx, mySearchParamRegistry); List list = extractor.extractParamValuesAsStrings(existingCodeSp, o1); assertEquals(2, list.size()); @@ -344,8 +344,8 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { @Test public void testExtractIdentifierOfType() { - ModelConfig modelConfig = new ModelConfig(); - modelConfig.setIndexIdentifierOfType(true); + StorageSettings storageSettings = new StorageSettings(); + storageSettings.setIndexIdentifierOfType(true); Patient patient = new Patient(); patient @@ -365,7 +365,7 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { .setSystem("http://terminology.hl7.org/CodeSystem/v2-0203") .setCode("MR"); - SearchParamExtractorR4 extractor = new SearchParamExtractorR4(modelConfig, new PartitionSettings(), ourCtx, mySearchParamRegistry); + SearchParamExtractorR4 extractor = new SearchParamExtractorR4(storageSettings, new PartitionSettings(), ourCtx, mySearchParamRegistry); List list = extractor .extractSearchParamTokens(patient) .stream() @@ -386,7 +386,7 @@ public class SearchParamExtractorR4Test implements ITestDataBuilder { @Nested class CompositeSearchParameter { - SearchParamExtractorR4 myExtractor = new SearchParamExtractorR4(myModelConfig, new PartitionSettings(), ourCtx, mySearchParamRegistry); + SearchParamExtractorR4 myExtractor = new SearchParamExtractorR4(myStorageSettings, new PartitionSettings(), ourCtx, mySearchParamRegistry); /** * Install a full definition of component-code-value-concept in the SP registry. diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchWithInterceptorR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchWithInterceptorR4Test.java index 77494ea5bda..09a0d4cafb5 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchWithInterceptorR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchWithInterceptorR4Test.java @@ -26,7 +26,7 @@ public class SearchWithInterceptorR4Test extends BaseJpaR4Test { @Test public void testRawSql_Search() { - myDaoConfig.setAdvancedHSearchIndexing(false); + myStorageSettings.setAdvancedHSearchIndexing(false); IAnonymousInterceptor interceptor = (pointcut, params) -> { RequestDetails requestDetails = params.get(RequestDetails.class); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/SyntheaPerfTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/SyntheaPerfTest.java index a5d5f4ecbf2..7f473cc6892 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/SyntheaPerfTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/SyntheaPerfTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.model.entity.ResourceEncodingEnum; import ca.uhn.fhir.rest.api.server.SystemRequestDetails; @@ -73,14 +73,14 @@ public class SyntheaPerfTest extends BaseJpaTest { public void testLoadSynthea() throws Exception { assertEquals(100, TestR4Config.getMaxThreads()); - myDaoConfig.setResourceEncoding(ResourceEncodingEnum.JSON); - myDaoConfig.setTagStorageMode(DaoConfig.TagStorageModeEnum.INLINE); - myDaoConfig.setMatchUrlCacheEnabled(true); - myDaoConfig.setDeleteEnabled(false); + myStorageSettings.setResourceEncoding(ResourceEncodingEnum.JSON); + myStorageSettings.setTagStorageMode(JpaStorageSettings.TagStorageModeEnum.INLINE); + myStorageSettings.setMatchUrlCacheEnabled(true); + myStorageSettings.setDeleteEnabled(false); myFhirContext.getParserOptions().setAutoContainReferenceTargetsWithNoId(false); - myDaoConfig.setInlineResourceTextBelowSize(4000); + myStorageSettings.setInlineResourceTextBelowSize(4000); - assertTrue(myDaoConfig.isMassIngestionMode()); + assertTrue(myStorageSettings.isMassIngestionMode()); List files = Files .list(FileSystems.getDefault().getPath(PATH_TO_SYNTHEA_OUTPUT)) diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/TransactionDeleteR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/TransactionDeleteR4Test.java index e16dc9a8850..436ad260c4b 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/TransactionDeleteR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/TransactionDeleteR4Test.java @@ -20,7 +20,7 @@ public class TransactionDeleteR4Test extends BaseJpaR4SystemTest { @AfterEach public void after() { - myDaoConfig.setEnforceReferentialIntegrityOnDelete(true); + myStorageSettings.setEnforceReferentialIntegrityOnDelete(true); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/TransactionHookTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/TransactionHookTest.java index a7a78a34adb..04219fe962d 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/TransactionHookTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/TransactionHookTest.java @@ -39,7 +39,7 @@ public class TransactionHookTest extends BaseJpaR4SystemTest { @AfterEach public void after() { - myDaoConfig.setEnforceReferentialIntegrityOnDelete(true); + myStorageSettings.setEnforceReferentialIntegrityOnDelete(true); } PointcutLatch myPointcutLatch = new PointcutLatch(Pointcut.STORAGE_TRANSACTION_PROCESSED); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/delete/DeleteConflictServiceR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/delete/DeleteConflictServiceR4Test.java index d094c5c2980..c0785d28c68 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/delete/DeleteConflictServiceR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/delete/DeleteConflictServiceR4Test.java @@ -152,7 +152,7 @@ public class DeleteConflictServiceR4Test extends BaseJpaR4Test { } DeleteConflictService.setMaxRetryAttempts(3); - myDaoConfig.setMaximumDeleteConflictQueryCount(5); + myStorageSettings.setMaximumDeleteConflictQueryCount(5); myDeleteInterceptor.deleteConflictFunction = this::deleteConflictsFixedRetryCount; try { myOrganizationDao.delete(organizationId); @@ -165,7 +165,7 @@ public class DeleteConflictServiceR4Test extends BaseJpaR4Test { // Try again with Maximum conflict count set to 6. myDeleteInterceptor.myCallCount=0; myInterceptorDeleteCount = 0; - myDaoConfig.setMaximumDeleteConflictQueryCount(6); + myStorageSettings.setMaximumDeleteConflictQueryCount(6); try { myOrganizationDao.delete(organizationId); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/delete/job/ReindexJobTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/delete/job/ReindexJobTest.java index 964367b365e..5b95a31f76b 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/delete/job/ReindexJobTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/delete/job/ReindexJobTest.java @@ -60,8 +60,8 @@ public class ReindexJobTest extends BaseJpaR4Test { // setup // make sure the resources don't get auto-reindexed when the search parameter is created - boolean reindexPropertyCache = myDaoConfig.isMarkResourcesForReindexingUponSearchParameterChange(); - myDaoConfig.setMarkResourcesForReindexingUponSearchParameterChange(false); + boolean reindexPropertyCache = myStorageSettings.isMarkResourcesForReindexingUponSearchParameterChange(); + myStorageSettings.setMarkResourcesForReindexingUponSearchParameterChange(false); IIdType obsFinalId = myReindexTestHelper.createObservationWithAlleleExtension(Observation.ObservationStatus.FINAL); myReindexTestHelper.createObservationWithAlleleExtension(Observation.ObservationStatus.CANCELLED); @@ -91,7 +91,7 @@ public class ReindexJobTest extends BaseJpaR4Test { assertThat(alleleObservationIds, hasSize(1)); assertEquals(obsFinalId.getIdPart(), alleleObservationIds.get(0)); - myDaoConfig.setMarkResourcesForReindexingUponSearchParameterChange(reindexPropertyCache); + myStorageSettings.setMarkResourcesForReindexingUponSearchParameterChange(reindexPropertyCache); } @Test diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/graphql/DaoRegistryGraphQLStorageServicesTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/graphql/DaoRegistryGraphQLStorageServicesTest.java index 401196ff52f..1f6dc258857 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/graphql/DaoRegistryGraphQLStorageServicesTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/graphql/DaoRegistryGraphQLStorageServicesTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.graphql; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.test.BaseJpaR4Test; import ca.uhn.fhir.jpa.test.config.TestR4Config; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; @@ -56,14 +56,14 @@ public class DaoRegistryGraphQLStorageServicesTest extends BaseJpaR4Test { @AfterEach public void after() { - myDaoConfig.setFilterParameterEnabled(new DaoConfig().isFilterParameterEnabled()); + myStorageSettings.setFilterParameterEnabled(new JpaStorageSettings().isFilterParameterEnabled()); } @Override @BeforeEach public void before() throws Exception { super.before(); - myDaoConfig.setFilterParameterEnabled(true); + myStorageSettings.setFilterParameterEnabled(true); } private void createSomeAppointmentWithType(String id, CodeableConcept type) { diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/interceptor/CascadingDeleteInterceptorMultiThreadTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/interceptor/CascadingDeleteInterceptorMultiThreadTest.java index 9fce4294e1b..211b2456d85 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/interceptor/CascadingDeleteInterceptorMultiThreadTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/interceptor/CascadingDeleteInterceptorMultiThreadTest.java @@ -1,12 +1,11 @@ package ca.uhn.fhir.jpa.interceptor; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc; import ca.uhn.fhir.jpa.bulk.export.api.IBulkDataExportJobSchedulingHelper; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.search.reindex.IResourceReindexingSvc; import ca.uhn.fhir.jpa.searchparam.registry.SearchParamRegistryImpl; import ca.uhn.fhir.jpa.test.config.DelayListener; @@ -79,11 +78,9 @@ public class CascadingDeleteInterceptorMultiThreadTest { @Autowired protected ApplicationContext myAppCtx; @Autowired - protected ModelConfig myModelConfig; - @Autowired protected FhirContext myFhirContext; @Autowired - protected DaoConfig myDaoConfig; + protected JpaStorageSettings myStorageSettings; @Autowired @Qualifier("mySystemDaoR4") protected IFhirSystemDao mySystemDao; @@ -155,7 +152,7 @@ public class CascadingDeleteInterceptorMultiThreadTest { @AfterEach public void afterTest() throws IOException { - purgeDatabase(myDaoConfig, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); + purgeDatabase(myStorageSettings, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); if (myCaptureQueriesListener != null) { myCaptureQueriesListener.clear(); } @@ -164,15 +161,15 @@ public class CascadingDeleteInterceptorMultiThreadTest { myHttpClient2.close(); } - protected static void purgeDatabase(DaoConfig theDaoConfig, IFhirSystemDao theSystemDao, IResourceReindexingSvc theResourceReindexingSvc, ISearchCoordinatorSvc theSearchCoordinatorSvc, ISearchParamRegistry theSearchParamRegistry, IBulkDataExportJobSchedulingHelper theBulkDataJobActivator) { + protected static void purgeDatabase(JpaStorageSettings theStorageSettings, IFhirSystemDao theSystemDao, IResourceReindexingSvc theResourceReindexingSvc, ISearchCoordinatorSvc theSearchCoordinatorSvc, ISearchParamRegistry theSearchParamRegistry, IBulkDataExportJobSchedulingHelper theBulkDataJobActivator) { theSearchCoordinatorSvc.cancelAllActiveSearches(); theResourceReindexingSvc.cancelAndPurgeAllJobs(); theBulkDataJobActivator.cancelAndPurgeAllJobs(); - boolean expungeEnabled = theDaoConfig.isExpungeEnabled(); - boolean multiDeleteEnabled = theDaoConfig.isAllowMultipleDelete(); - theDaoConfig.setExpungeEnabled(true); - theDaoConfig.setAllowMultipleDelete(true); + boolean expungeEnabled = theStorageSettings.isExpungeEnabled(); + boolean multiDeleteEnabled = theStorageSettings.isAllowMultipleDelete(); + theStorageSettings.setExpungeEnabled(true); + theStorageSettings.setAllowMultipleDelete(true); for (int count = 0; ; count++) { try { @@ -191,8 +188,8 @@ public class CascadingDeleteInterceptorMultiThreadTest { } } } - theDaoConfig.setExpungeEnabled(expungeEnabled); - theDaoConfig.setAllowMultipleDelete(multiDeleteEnabled); + theStorageSettings.setExpungeEnabled(expungeEnabled); + theStorageSettings.setAllowMultipleDelete(multiDeleteEnabled); theSearchParamRegistry.forceRefresh(); } @@ -245,7 +242,7 @@ public class CascadingDeleteInterceptorMultiThreadTest { public void testDeleteCascadingConcurrentThreadsWithOneDelayed() { myDelayListener.enable(); - myModelConfig.setRespectVersionsForSearchIncludes(false); + myStorageSettings.setRespectVersionsForSearchIncludes(false); createResources(); ourRestServer.getInterceptorService().registerInterceptor(myDeleteInterceptor); @@ -290,7 +287,7 @@ public class CascadingDeleteInterceptorMultiThreadTest { @Test public void testDeleteCascadingConcurrentThreads() { - myModelConfig.setRespectVersionsForSearchIncludes(false); + myStorageSettings.setRespectVersionsForSearchIncludes(false); createResources(); ourRestServer.getInterceptorService().registerInterceptor(myDeleteInterceptor); @@ -334,7 +331,7 @@ public class CascadingDeleteInterceptorMultiThreadTest { @Test public void testDeleteCascadingSequentialThreads() { - myModelConfig.setRespectVersionsForSearchIncludes(false); + myStorageSettings.setRespectVersionsForSearchIncludes(false); createResources(); ourRestServer.getInterceptorService().registerInterceptor(myDeleteInterceptor); @@ -377,7 +374,7 @@ public class CascadingDeleteInterceptorMultiThreadTest { @Test public void testDeleteCascadingSingleThread() { - myModelConfig.setRespectVersionsForSearchIncludes(false); + myStorageSettings.setRespectVersionsForSearchIncludes(false); createResources(); ourRestServer.getInterceptorService().registerInterceptor(myDeleteInterceptor); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/interceptor/PartitioningInterceptorR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/interceptor/PartitioningInterceptorR4Test.java index 19a26f1b5dd..a7ba89e62f7 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/interceptor/PartitioningInterceptorR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/interceptor/PartitioningInterceptorR4Test.java @@ -6,7 +6,7 @@ import ca.uhn.fhir.interceptor.api.Interceptor; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.ReadPartitionIdRequestDetails; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; import ca.uhn.fhir.jpa.dao.r4.BaseJpaR4SystemTest; @@ -74,7 +74,7 @@ public class PartitioningInterceptorR4Test extends BaseJpaR4SystemTest { myPartitionInterceptor.assertNoRemainingIds(); myInterceptorRegistry.unregisterInterceptor(myPartitionInterceptor); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); myInterceptorRegistry.unregisterAllInterceptors(); } @@ -90,7 +90,7 @@ public class PartitioningInterceptorR4Test extends BaseJpaR4SystemTest { myPartitionConfigSvc.createPartition(new PartitionEntity().setId(2).setName("PART-2"), null); myPartitionConfigSvc.createPartition(new PartitionEntity().setId(3).setName("PART-3"), null); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); } @Test @@ -118,7 +118,7 @@ public class PartitioningInterceptorR4Test extends BaseJpaR4SystemTest { subscription.setChannel(subscriptionChannelComponent); // set up partitioning for subscriptions - myDaoConfig.setCrossPartitionSubscription(true); + myStorageSettings.setCrossPartitionSubscriptionEnabled(true); // register interceptors that return different partition ids MySubscriptionReadInterceptor readInterceptor = new MySubscriptionReadInterceptor(); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/interceptor/ResponseTerminologyTranslationInterceptorTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/interceptor/ResponseTerminologyTranslationInterceptorTest.java index f7a28ade850..68171ffba51 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/interceptor/ResponseTerminologyTranslationInterceptorTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/interceptor/ResponseTerminologyTranslationInterceptorTest.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.interceptor; import ca.uhn.fhir.jpa.api.model.BulkExportJobResults; import ca.uhn.fhir.jpa.api.svc.IBatch2JobRunner; import ca.uhn.fhir.jpa.batch.models.Batch2JobStartResponse; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.jpa.util.BulkExportUtils; import ca.uhn.fhir.rest.api.Constants; @@ -55,7 +55,7 @@ public class ResponseTerminologyTranslationInterceptorTest extends BaseResourceP public void afterEach() { myResponseTerminologyTranslationInterceptor.clearMappingSpecifications(); myServer.unregisterInterceptor(myResponseTerminologyTranslationInterceptor); - myModelConfig.setNormalizeTerminologyForBulkExportJobs(new ModelConfig().isNormalizeTerminologyForBulkExportJobs()); + myStorageSettings.setNormalizeTerminologyForBulkExportJobs(new StorageSettings().isNormalizeTerminologyForBulkExportJobs()); } @Test @@ -140,7 +140,7 @@ public class ResponseTerminologyTranslationInterceptorTest extends BaseResourceP @Test public void testBulkExport_TerminologyTranslation_MappingFound() { - myModelConfig.setNormalizeTerminologyForBulkExportJobs(true); + myStorageSettings.setNormalizeTerminologyForBulkExportJobs(true); // Create some resources to load Observation observation = new Observation(); @@ -160,7 +160,7 @@ public class ResponseTerminologyTranslationInterceptorTest extends BaseResourceP @Test public void testBulkExport_TerminologyTranslation_MappingNotNeeded() { - myModelConfig.setNormalizeTerminologyForBulkExportJobs(true); + myStorageSettings.setNormalizeTerminologyForBulkExportJobs(true); // Create some resources to load Observation observation = new Observation(); @@ -181,7 +181,7 @@ public class ResponseTerminologyTranslationInterceptorTest extends BaseResourceP @Test public void testBulkExport_TerminologyTranslation_NoMapping() { - myModelConfig.setNormalizeTerminologyForBulkExportJobs(true); + myStorageSettings.setNormalizeTerminologyForBulkExportJobs(true); // Create some resources to load Observation observation = new Observation(); @@ -209,12 +209,12 @@ public class ResponseTerminologyTranslationInterceptorTest extends BaseResourceP assertNotNull(startResponse); // Run a scheduled pass to build the export - myBatch2JobHelper.awaitJobCompletion(startResponse.getJobId()); + myBatch2JobHelper.awaitJobCompletion(startResponse.getInstanceId()); - await().until(() -> myJobRunner.getJobInfo(startResponse.getJobId()).getReport() != null); + await().until(() -> myJobRunner.getJobInfo(startResponse.getInstanceId()).getReport() != null); // Iterate over the files - String report = myJobRunner.getJobInfo(startResponse.getJobId()).getReport(); + String report = myJobRunner.getJobInfo(startResponse.getInstanceId()).getReport(); BulkExportJobResults results = JsonUtil.deserialize(report, BulkExportJobResults.class); for (Map.Entry> file : results.getResourceTypeToBinaryIds().entrySet()) { String resourceTypeInFile = file.getKey(); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/interceptor/validation/RepositoryValidatingInterceptorR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/interceptor/validation/RepositoryValidatingInterceptorR4Test.java index c55b2e56a89..944b58fd1e8 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/interceptor/validation/RepositoryValidatingInterceptorR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/interceptor/validation/RepositoryValidatingInterceptorR4Test.java @@ -247,7 +247,7 @@ public class RepositoryValidatingInterceptorR4Test extends BaseJpaR4Test { public void testRequireValidationDoesNotApplyToPlaceholders() { //Given - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); List rules = newRuleBuilder() .forResourcesOfType("Organization") .requireValidationToDeclaredProfiles() @@ -271,7 +271,7 @@ public class RepositoryValidatingInterceptorR4Test extends BaseJpaR4Test { @Test public void testRequireAtLeastProfilesDoesNotApplyToPlaceholders() { //Given - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); List rules = newRuleBuilder() .forResourcesOfType("Organization") .requireAtLeastOneProfileOf("http://example.com/profile1", "http://example.com/profile2") diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/packages/NpmR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/packages/NpmR4Test.java index 704043dc3a5..6277ee7a989 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/packages/NpmR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/packages/NpmR4Test.java @@ -4,7 +4,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.IInterceptorService; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.data.INpmPackageDao; import ca.uhn.fhir.jpa.dao.data.INpmPackageVersionDao; @@ -121,8 +121,8 @@ public class NpmR4Test extends BaseJpaR4Test { @AfterEach public void after() throws Exception { JettyUtil.closeServer(myServer); - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(new DaoConfig().isAutoCreatePlaceholderReferenceTargets()); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(new JpaStorageSettings().isAutoCreatePlaceholderReferenceTargets()); myPartitionSettings.setPartitioningEnabled(false); myPartitionSettings.setUnnamedPartitionMode(false); myPartitionSettings.setDefaultPartitionId(new PartitionSettings().getDefaultPartitionId()); @@ -199,7 +199,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testInstallR4Package() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); byte[] bytes = ClasspathUtil.loadResourceAsByteArray("/packages/hl7.fhir.uv.shorthand-0.12.0.tgz"); myFakeNpmServlet.responses.put("/hl7.fhir.uv.shorthand/0.12.0", bytes); @@ -271,7 +271,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testInstallR4PackageWithExternalizedBinaries() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); myInterceptorService.registerInterceptor(myBinaryStorageInterceptor); byte[] bytes = ClasspathUtil.loadResourceAsByteArray("/packages/hl7.fhir.uv.shorthand-0.12.0.tgz"); @@ -343,7 +343,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testNumericIdsInstalledWithNpmPrefix() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); // Load a copy of hl7.fhir.uv.shorthand-0.12.0, but with id set to 1 instead of "shorthand-code-system" byte[] bytes = ClasspathUtil.loadResourceAsByteArray("/packages/hl7.fhir.uv.shorthand-0.13.0.tgz"); @@ -368,7 +368,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testInstallR4Package_NonConformanceResources() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); byte[] bytes = ClasspathUtil.loadResourceAsByteArray("/packages/test-organizations-package.tgz"); myFakeNpmServlet.responses.put("/test-organizations/1.0.0", bytes); @@ -405,7 +405,7 @@ public class NpmR4Test extends BaseJpaR4Test { public void testInstallR4Package_NonConformanceResources_Partitioned() throws Exception { myPartitionSettings.setPartitioningEnabled(true); myInterceptorService.registerInterceptor(myRequestTenantPartitionInterceptor); - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); byte[] bytes = ClasspathUtil.loadResourceAsByteArray("/packages/test-organizations-package.tgz"); myFakeNpmServlet.responses.put("/test-organizations/1.0.0", bytes); @@ -447,7 +447,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testInstallR4Package_NoIdentifierNoUrl() { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); byte[] bytes = ClasspathUtil.loadResourceAsByteArray("/packages/test-missing-identifier-package.tgz"); myFakeNpmServlet.responses.put("/test-missing-identifier-package/1.0.0", bytes); @@ -472,8 +472,8 @@ public class NpmR4Test extends BaseJpaR4Test { */ @Test public void testInstallR4Package_AutoCreatePlaceholder() throws Exception { - myDaoConfig.setAllowExternalReferences(true); - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(true); + myStorageSettings.setAllowExternalReferences(true); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(true); byte[] bytes = ClasspathUtil.loadResourceAsByteArray("/packages/test-auto-create-placeholder.tgz"); myFakeNpmServlet.responses.put("/test-ig/1.0.0", bytes); @@ -503,7 +503,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testInstallR4Package_DraftResourcesNotInstalled() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); byte[] bytes = ClasspathUtil.loadResourceAsByteArray("/packages/test-draft-sample.tgz"); myFakeNpmServlet.responses.put("/hl7.fhir.uv.onlydrafts/0.11.1", bytes); @@ -515,7 +515,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testInstallR4Package_Twice() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); byte[] bytes = ClasspathUtil.loadResourceAsByteArray("/packages/hl7.fhir.uv.shorthand-0.12.0.tgz"); myFakeNpmServlet.responses.put("/hl7.fhir.uv.shorthand/0.12.0", bytes); @@ -538,7 +538,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testInstallR4Package_Twice_partitioningEnabled() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); myPartitionSettings.setPartitioningEnabled(true); myInterceptorService.registerInterceptor(myRequestTenantPartitionInterceptor); @@ -562,7 +562,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testInstallR4PackageWithNoDescription() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); byte[] bytes = ClasspathUtil.loadResourceAsByteArray("/packages/UK.Core.r4-1.1.0.tgz"); myFakeNpmServlet.responses.put("/UK.Core.r4/1.1.0", bytes); @@ -582,7 +582,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testLoadPackageMetadata() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); myFakeNpmServlet.responses.put("/hl7.fhir.uv.shorthand/0.12.0", ClasspathUtil.loadResourceAsByteArray("/packages/hl7.fhir.uv.shorthand-0.12.0.tgz")); myFakeNpmServlet.responses.put("/hl7.fhir.uv.shorthand/0.11.1", ClasspathUtil.loadResourceAsByteArray("/packages/hl7.fhir.uv.shorthand-0.11.1.tgz")); @@ -608,7 +608,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testLoadPackageUsingImpreciseId() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); myFakeNpmServlet.responses.put("/hl7.fhir.uv.shorthand/0.12.0", ClasspathUtil.loadResourceAsByteArray("/packages/hl7.fhir.uv.shorthand-0.12.0.tgz")); myFakeNpmServlet.responses.put("/hl7.fhir.uv.shorthand/0.11.1", ClasspathUtil.loadResourceAsByteArray("/packages/hl7.fhir.uv.shorthand-0.11.1.tgz")); @@ -642,7 +642,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testInstallNewerPackageUpdatesLatestVersionFlag() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); byte[] contents0111 = ClasspathUtil.loadResourceAsByteArray("/packages/hl7.fhir.uv.shorthand-0.11.1.tgz"); byte[] contents0120 = ClasspathUtil.loadResourceAsByteArray("/packages/hl7.fhir.uv.shorthand-0.12.0.tgz"); @@ -687,7 +687,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testInstallOlderPackageDoesntUpdateLatestVersionFlag() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); myFakeNpmServlet.responses.put("/hl7.fhir.uv.shorthand/0.12.0", ClasspathUtil.loadResourceAsByteArray("/packages/hl7.fhir.uv.shorthand-0.12.0.tgz")); myFakeNpmServlet.responses.put("/hl7.fhir.uv.shorthand/0.11.1", ClasspathUtil.loadResourceAsByteArray("/packages/hl7.fhir.uv.shorthand-0.11.1.tgz")); @@ -730,7 +730,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testInstallAlreadyExistingIsIgnored() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); myFakeNpmServlet.responses.put("/hl7.fhir.uv.shorthand/0.12.0", ClasspathUtil.loadResourceAsByteArray("/packages/hl7.fhir.uv.shorthand-0.12.0.tgz")); @@ -755,7 +755,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testInstallPkgContainingSearchParameter() throws IOException { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); byte[] contents0111 = ClasspathUtil.loadResourceAsByteArray("/packages/test-exchange-sample.tgz"); myFakeNpmServlet.responses.put("/test-exchange.fhir.us.com/2.1.1", contents0111); @@ -825,7 +825,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testDeletePackage() throws IOException { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); myFakeNpmServlet.responses.put("/hl7.fhir.uv.shorthand/0.12.0", ClasspathUtil.loadResourceAsByteArray("/packages/hl7.fhir.uv.shorthand-0.12.0.tgz")); myFakeNpmServlet.responses.put("/hl7.fhir.uv.shorthand/0.11.1", ClasspathUtil.loadResourceAsByteArray("/packages/hl7.fhir.uv.shorthand-0.11.1.tgz")); @@ -870,7 +870,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testInstallPkgContainingLogicalStructureDefinition() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); byte[] bytes = ClasspathUtil.loadResourceAsByteArray("/packages/test-logical-structuredefinition.tgz"); myFakeNpmServlet.responses.put("/test-logical-structuredefinition/1.0.0", bytes); @@ -905,7 +905,7 @@ public class NpmR4Test extends BaseJpaR4Test { @Test public void testInstallPkgContainingNonPartitionedResourcesPartitionsEnabled() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); myPartitionSettings.setPartitioningEnabled(true); myInterceptorService.registerInterceptor(myRequestTenantPartitionInterceptor); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/packages/PackageInstallerSvcImplRewriteHistoryTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/packages/PackageInstallerSvcImplRewriteHistoryTest.java index a97a46d43fb..b1c88f6f508 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/packages/PackageInstallerSvcImplRewriteHistoryTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/packages/PackageInstallerSvcImplRewriteHistoryTest.java @@ -19,7 +19,7 @@ public class PackageInstallerSvcImplRewriteHistoryTest extends BaseJpaR4Test { @AfterEach void after() { - myDaoConfig.setUpdateWithHistoryRewriteEnabled(false); + myStorageSettings.setUpdateWithHistoryRewriteEnabled(false); } @Test @@ -30,7 +30,7 @@ public class PackageInstallerSvcImplRewriteHistoryTest extends BaseJpaR4Test { @Test void updateWithHistoryRewriteEnabled() { // setup - myDaoConfig.setUpdateWithHistoryRewriteEnabled(true); + myStorageSettings.setUpdateWithHistoryRewriteEnabled(true); ConceptMap conceptMap = new ConceptMap(); conceptMap.setId(CONCEPT_MAP_TEST_ID); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/partition/PartitionedSubscriptionTriggeringR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/partition/PartitionedSubscriptionTriggeringR4Test.java index 9773bee8c1d..7e4f9cbf279 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/partition/PartitionedSubscriptionTriggeringR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/partition/PartitionedSubscriptionTriggeringR4Test.java @@ -4,7 +4,7 @@ import ca.uhn.fhir.interceptor.api.Hook; import ca.uhn.fhir.interceptor.api.Interceptor; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.dao.r4.BasePartitioningR4Test; @@ -63,9 +63,9 @@ public class PartitionedSubscriptionTriggeringR4Test extends BaseSubscriptionsR4 myPartitionSettings.setPartitioningEnabled(true); myPartitionSettings.setIncludePartitionInSearchHashes(new PartitionSettings().isIncludePartitionInSearchHashes()); - myDaoConfig.setUniqueIndexesEnabled(true); + myStorageSettings.setUniqueIndexesEnabled(true); - myModelConfig.setDefaultSearchParamsCanBeOverridden(true); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(true); myPartitionDate = LocalDate.of(2020, Month.JANUARY, 14); myPartitionDate2 = LocalDate.of(2020, Month.JANUARY, 15); @@ -80,7 +80,7 @@ public class PartitionedSubscriptionTriggeringR4Test extends BaseSubscriptionsR4 myPartitionConfigSvc.createPartition(new PartitionEntity().setId(1).setName(PARTITION_1), null); myPartitionConfigSvc.createPartition(new PartitionEntity().setId(2).setName(PARTITION_2), null); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); } @AfterEach @@ -88,16 +88,16 @@ public class PartitionedSubscriptionTriggeringR4Test extends BaseSubscriptionsR4 public void afterUnregisterRestHookListener() { myStoppableSubscriptionDeliveringRestHookSubscriber.setCountDownLatch(null); myStoppableSubscriptionDeliveringRestHookSubscriber.unPause(); - myDaoConfig.setTriggerSubscriptionsForNonVersioningChanges(new DaoConfig().isTriggerSubscriptionsForNonVersioningChanges()); + myStorageSettings.setTriggerSubscriptionsForNonVersioningChanges(new JpaStorageSettings().isTriggerSubscriptionsForNonVersioningChanges()); myPartitionSettings.setPartitioningEnabled(false); myPartitionSettings.setUnnamedPartitionMode(false); - myDaoConfig.setExpungeEnabled(true); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setExpungeEnabled(true); + myStorageSettings.setAllowMultipleDelete(true); myDaoRegistry.getSystemDao().expunge(new ExpungeOptions().setExpungeEverything(true), null); - myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled()); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); + myStorageSettings.setExpungeEnabled(new JpaStorageSettings().isExpungeEnabled()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); mySrdInterceptorService.unregisterInterceptorsIf(t -> t instanceof BasePartitioningR4Test.MyReadWriteInterceptor); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/AuthorizationInterceptorJpaR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/AuthorizationInterceptorJpaR4Test.java index b85c81f1293..d9c591d45f3 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/AuthorizationInterceptorJpaR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/AuthorizationInterceptorJpaR4Test.java @@ -84,9 +84,9 @@ public class AuthorizationInterceptorJpaR4Test extends BaseResourceProviderR4Tes @Override public void before() throws Exception { super.before(); - myDaoConfig.setAllowMultipleDelete(true); - myDaoConfig.setExpungeEnabled(true); - myDaoConfig.setDeleteExpungeEnabled(true); + myStorageSettings.setAllowMultipleDelete(true); + myStorageSettings.setExpungeEnabled(true); + myStorageSettings.setDeleteExpungeEnabled(true); myServer.getRestfulServer().registerInterceptor(new BulkDataExportProvider()); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/BinaryAccessProviderR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/BinaryAccessProviderR4Test.java index a7264525daf..ee5c117bac5 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/BinaryAccessProviderR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/BinaryAccessProviderR4Test.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.binary.api.IBinaryStorageSvc; import ca.uhn.fhir.jpa.binstore.MemoryBinaryStorageSvcImpl; import ca.uhn.fhir.jpa.interceptor.UserRequestRetryVersionConflictsInterceptor; @@ -77,7 +77,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test { public void before() throws Exception { super.before(); myStorageSvc.setMinimumBinarySize(10); - myDaoConfig.setExpungeEnabled(true); + myStorageSettings.setExpungeEnabled(true); myInterceptorRegistry.registerInterceptor(myBinaryStorageInterceptor); } @@ -86,7 +86,7 @@ public class BinaryAccessProviderR4Test extends BaseResourceProviderR4Test { public void after() throws Exception { super.after(); myStorageSvc.setMinimumBinarySize(0); - myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled()); + myStorageSettings.setExpungeEnabled(new JpaStorageSettings().isExpungeEnabled()); myInterceptorRegistry.unregisterInterceptor(myBinaryStorageInterceptor); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/BinaryStorageInterceptorR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/BinaryStorageInterceptorR4Test.java index 4a533d89c48..dbe0bd6a1d7 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/BinaryStorageInterceptorR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/BinaryStorageInterceptorR4Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; import ca.uhn.fhir.jpa.binary.api.IBinaryStorageSvc; import ca.uhn.fhir.jpa.binary.interceptor.BinaryStorageInterceptor; @@ -50,7 +50,7 @@ public class BinaryStorageInterceptorR4Test extends BaseResourceProviderR4Test { public void before() throws Exception { super.before(); myStorageSvc.setMinimumBinarySize(10); - myDaoConfig.setExpungeEnabled(true); + myStorageSettings.setExpungeEnabled(true); myInterceptorRegistry.registerInterceptor(myBinaryStorageInterceptor); } @@ -60,7 +60,7 @@ public class BinaryStorageInterceptorR4Test extends BaseResourceProviderR4Test { public void after() throws Exception { super.after(); myStorageSvc.setMinimumBinarySize(0); - myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled()); + myStorageSettings.setExpungeEnabled(new JpaStorageSettings().isExpungeEnabled()); myBinaryStorageInterceptor.setAutoInflateBinariesMaximumSize(new BinaryStorageInterceptor<>(myFhirContext).getAutoInflateBinariesMaximumSize()); myBinaryStorageInterceptor.setAllowAutoInflateBinaries(new BinaryStorageInterceptor<>(myFhirContext).isAllowAutoInflateBinaries()); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/CompositionDocumentR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/CompositionDocumentR4Test.java index 5f66fa52428..a36330ae6f7 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/CompositionDocumentR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/CompositionDocumentR4Test.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.parser.StrictErrorHandler; import ca.uhn.fhir.rest.api.EncodingEnum; @@ -59,7 +59,7 @@ public class CompositionDocumentR4Test extends BaseResourceProviderR4Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @Override @@ -67,7 +67,7 @@ public class CompositionDocumentR4Test extends BaseResourceProviderR4Test { public void after() throws Exception { super.after(); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); } @Override @@ -76,7 +76,7 @@ public class CompositionDocumentR4Test extends BaseResourceProviderR4Test { super.before(); myFhirContext.setParserErrorHandler(new StrictErrorHandler()); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); Organization org = new Organization(); org.setName("an org"); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ConsentInterceptorResourceProviderR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ConsentInterceptorResourceProviderR4Test.java index 8662518842d..ae1d27dbbc5 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ConsentInterceptorResourceProviderR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ConsentInterceptorResourceProviderR4Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.config.JpaConfig; @@ -40,7 +40,6 @@ import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; -import org.hl7.fhir.instance.model.api.IBaseBundle; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.r4.model.Bundle; @@ -59,14 +58,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.support.TransactionSynchronizationManager; -import org.springframework.transaction.support.TransactionTemplate; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.TransactionDefinition; -import org.springframework.transaction.support.TransactionSynchronizationManager; -import org.springframework.transaction.support.TransactionTemplate; import java.io.IOException; import java.util.ArrayList; @@ -110,7 +102,7 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid public void after() throws Exception { super.after(); Validate.notNull(myConsentInterceptor); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); myServer.getRestfulServer().getInterceptorService().unregisterInterceptor(myConsentInterceptor); myServer.getRestfulServer().unregisterProvider(myGraphQlProvider); } @@ -119,13 +111,13 @@ public class ConsentInterceptorResourceProviderR4Test extends BaseResourceProvid @BeforeEach public void before() throws Exception { super.before(); - myDaoConfig.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190)); + myStorageSettings.setSearchPreFetchThresholds(Arrays.asList(20, 50, 190)); myServer.getRestfulServer().registerProvider(myGraphQlProvider); } @Test public void testConsentServiceWhichReadsDoesNotThrowNpe() { - myDaoConfig.setAllowAutoInflateBinaries(true); + myStorageSettings.setAllowAutoInflateBinaries(true); IConsentService consentService = new ReadingBackResourcesConsentSvc(myDaoRegistry); myConsentInterceptor = new ConsentInterceptor(consentService, IConsentContextServices.NULL_IMPL); myServer.getRestfulServer().getInterceptorService().registerInterceptor(myConsentInterceptor); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/EmptyIndexesR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/EmptyIndexesR4Test.java index 9bab54b7a0a..8619423aa9c 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/EmptyIndexesR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/EmptyIndexesR4Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.rp.r4.ObservationResourceProvider; import ca.uhn.fhir.jpa.rp.r4.OrganizationResourceProvider; import ca.uhn.fhir.jpa.rp.r4.PatientResourceProvider; @@ -42,7 +42,7 @@ public class EmptyIndexesR4Test extends BaseJpaR4Test { @AfterEach public void after() { ourClient.unregisterInterceptor(mySimpleHeaderInterceptor); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); } @BeforeEach @@ -98,7 +98,7 @@ public class EmptyIndexesR4Test extends BaseJpaR4Test { mySimpleHeaderInterceptor = new SimpleRequestHeaderInterceptor(); ourClient.registerInterceptor(mySimpleHeaderInterceptor); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ExpungeR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ExpungeR4Test.java index 362f87c3572..acc7cdc9025 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ExpungeR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ExpungeR4Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.api.model.ExpungeOutcome; @@ -96,18 +96,18 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test { @AfterEach public void afterDisableExpunge() { - myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled()); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); - myDaoConfig.setTagStorageMode(new DaoConfig().getTagStorageMode()); - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); + myStorageSettings.setExpungeEnabled(new JpaStorageSettings().isExpungeEnabled()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); + myStorageSettings.setTagStorageMode(new JpaStorageSettings().getTagStorageMode()); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); myServer.getRestfulServer().getInterceptorService().unregisterInterceptorsIf(t -> t instanceof CascadingDeleteInterceptor); } @BeforeEach public void beforeEnableExpunge() { - myDaoConfig.setExpungeEnabled(true); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setExpungeEnabled(true); + myStorageSettings.setAllowMultipleDelete(true); } private void assertExpunged(IIdType theId) { @@ -535,7 +535,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test { @Test public void testExpungeSystemEverythingWithNormalizedQuantitySearchSupported() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); createStandardPatients(); mySystemDao.expunge(new ExpungeOptions() @@ -557,7 +557,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test { @Test public void testExpungeSystemEverythingWithNormalizedQuantityStorageSupported() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_STORAGE_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_STORAGE_SUPPORTED); createStandardPatients(); mySystemDao.expunge(new ExpungeOptions() @@ -643,7 +643,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test { @Test public void testExpungeByTypeAndNoId_NonVersionedTags() { - myDaoConfig.setTagStorageMode(DaoConfig.TagStorageModeEnum.NON_VERSIONED); + myStorageSettings.setTagStorageMode(JpaStorageSettings.TagStorageModeEnum.NON_VERSIONED); Patient p = new Patient(); p.setId("PT-DELETED"); @@ -776,8 +776,8 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test { @Test public void testExpungeOperationRespectsConfiguration() { // set up - myDaoConfig.setExpungeEnabled(false); - myDaoConfig.setAllowMultipleDelete(false); + myStorageSettings.setExpungeEnabled(false); + myStorageSettings.setAllowMultipleDelete(false); createStandardPatients(); @@ -813,7 +813,7 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test { assertEquals("HAPI-2080: $expunge is not enabled on this server", e.getMessage()); } - myDaoConfig.setExpungeEnabled(true); + myStorageSettings.setExpungeEnabled(true); try { mySystemDao.expunge(new ExpungeOptions().setExpungeEverything(true), null); fail(); @@ -822,15 +822,15 @@ public class ExpungeR4Test extends BaseResourceProviderR4Test { } // re-enable multi-delete for clean-up - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); } @Test public void testExpungeRaceConditionsWithLowThreadCountAndBatchSize() { final SystemRequestDetails requestDetails = new SystemRequestDetails(); final int numPatients = 5; - myDaoConfig.setExpungeThreadCount(2); - myDaoConfig.setExpungeBatchSize(2); + myStorageSettings.setExpungeThreadCount(2); + myStorageSettings.setExpungeBatchSize(2); List patients = createPatientsWithForcedIds(numPatients); patients = updatePatients(patients, 1); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/HookInterceptorR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/HookInterceptorR4Test.java index b9757dca51e..1b87bb4265b 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/HookInterceptorR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/HookInterceptorR4Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IDao; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.model.dao.JpaPid; @@ -40,13 +40,13 @@ public class HookInterceptorR4Test extends BaseResourceProviderR4Test { public void before() throws Exception { super.before(); - myDaoConfig.setExpungeEnabled(true); + myStorageSettings.setExpungeEnabled(true); } @Override @AfterEach public void after() throws Exception { - myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled()); + myStorageSettings.setExpungeEnabled(new JpaStorageSettings().isExpungeEnabled()); myInterceptorRegistry.unregisterAllAnonymousInterceptors(); super.after(); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/MultitenantBatchOperationR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/MultitenantBatchOperationR4Test.java index 53541ac7953..b3f322c46b2 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/MultitenantBatchOperationR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/MultitenantBatchOperationR4Test.java @@ -6,7 +6,7 @@ import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor; import ca.uhn.fhir.interceptor.api.IPointcut; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.delete.job.ReindexTestHelper; import ca.uhn.fhir.rest.api.CacheControlDirective; import ca.uhn.fhir.rest.api.server.RequestDetails; @@ -43,28 +43,28 @@ public class MultitenantBatchOperationR4Test extends BaseMultitenantResourceProv @Override public void before() throws Exception { super.before(); - myDaoConfig.setAllowMultipleDelete(true); - myDaoConfig.setExpungeEnabled(true); - myDaoConfig.setDeleteExpungeEnabled(true); + myStorageSettings.setAllowMultipleDelete(true); + myStorageSettings.setExpungeEnabled(true); + myStorageSettings.setDeleteExpungeEnabled(true); - myReindexParameterCache = myDaoConfig.isMarkResourcesForReindexingUponSearchParameterChange(); - myDaoConfig.setMarkResourcesForReindexingUponSearchParameterChange(false); + myReindexParameterCache = myStorageSettings.isMarkResourcesForReindexingUponSearchParameterChange(); + myStorageSettings.setMarkResourcesForReindexingUponSearchParameterChange(false); } @BeforeEach public void disableAdvanceIndexing() { // advanced indexing doesn't support partitions - myDaoConfig.setAdvancedHSearchIndexing(false); + myStorageSettings.setAdvancedHSearchIndexing(false); } @AfterEach @Override public void after() throws Exception { - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); - myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled()); - myDaoConfig.setDeleteExpungeEnabled(new DaoConfig().isDeleteExpungeEnabled()); - myDaoConfig.setMarkResourcesForReindexingUponSearchParameterChange(myReindexParameterCache); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); + myStorageSettings.setExpungeEnabled(new JpaStorageSettings().isExpungeEnabled()); + myStorageSettings.setDeleteExpungeEnabled(new JpaStorageSettings().isDeleteExpungeEnabled()); + myStorageSettings.setMarkResourcesForReindexingUponSearchParameterChange(myReindexParameterCache); super.after(); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/MultitenantServerR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/MultitenantServerR4Test.java index 3520bc70d40..a45139d19cc 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/MultitenantServerR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/MultitenantServerR4Test.java @@ -654,7 +654,7 @@ public class MultitenantServerR4Test extends BaseMultitenantResourceProviderR4Te options.setExportStyle(BulkDataExportOptions.ExportStyle.SYSTEM); Batch2JobStartResponse startResponse = new Batch2JobStartResponse(); - startResponse.setJobId(jobId); + startResponse.setInstanceId(jobId); when(myJobRunner.startNewJob(any())) .thenReturn(startResponse); when(myJobRunner.getJobInfo(anyString())) diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientEverythingR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientEverythingR4Test.java index 53175ad00ce..6ce428f6d15 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientEverythingR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientEverythingR4Test.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.provider.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.parser.StrictErrorHandler; @@ -56,7 +56,7 @@ public class PatientEverythingR4Test extends BaseResourceProviderR4Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @Override @@ -64,11 +64,11 @@ public class PatientEverythingR4Test extends BaseResourceProviderR4Test { public void after() throws Exception { super.after(); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setEverythingIncludesFetchPageSize(new DaoConfig().getEverythingIncludesFetchPageSize()); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setEverythingIncludesFetchPageSize(new JpaStorageSettings().getEverythingIncludesFetchPageSize()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); } @Override @@ -77,7 +77,7 @@ public class PatientEverythingR4Test extends BaseResourceProviderR4Test { super.before(); myFhirContext.setParserErrorHandler(new StrictErrorHandler()); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); Organization org = new Organization(); org.setName("an org"); @@ -128,7 +128,7 @@ public class PatientEverythingR4Test extends BaseResourceProviderR4Test { @Test public void testEverythingWithCanonicalReferences() throws Exception { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); Patient p = new Patient(); p.setManagingOrganization(new Reference("http://example.com/Organization/123")); @@ -196,7 +196,7 @@ public class PatientEverythingR4Test extends BaseResourceProviderR4Test { */ @Test public void testEverythingReturnsCorrectResourcesSmallPage() throws Exception { - myDaoConfig.setEverythingIncludesFetchPageSize(1); + myStorageSettings.setEverythingIncludesFetchPageSize(1); Bundle bundle = fetchBundle(myServerBase + "/" + patId + "/$everything?_format=json&_count=100", EncodingEnum.JSON); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientMemberMatchOperationR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientMemberMatchOperationR4Test.java index 9626d2b15ee..4b3bbdbf580 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientMemberMatchOperationR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientMemberMatchOperationR4Test.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.provider.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.parser.StrictErrorHandler; import ca.uhn.fhir.rest.api.Constants; @@ -74,17 +74,17 @@ public class PatientMemberMatchOperationR4Test extends BaseResourceProviderR4Tes @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @Override @AfterEach public void after() throws Exception { super.after(); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setEverythingIncludesFetchPageSize(new DaoConfig().getEverythingIncludesFetchPageSize()); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setEverythingIncludesFetchPageSize(new JpaStorageSettings().getEverythingIncludesFetchPageSize()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); myServer.getRestfulServer().unregisterProvider(theMemberMatchR4ResourceProvider); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderCustomSearchParamR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderCustomSearchParamR4Test.java index 1e697c3c17a..261c04a8a69 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderCustomSearchParamR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderCustomSearchParamR4Test.java @@ -6,10 +6,9 @@ import ca.uhn.fhir.batch2.model.JobInstance; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.api.Hook; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; import ca.uhn.fhir.jpa.entity.Search; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.model.search.SearchStatusEnum; @@ -78,15 +77,15 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide @AfterEach public void after() throws Exception { super.after(); - myModelConfig.setDefaultSearchParamsCanBeOverridden(new ModelConfig().isDefaultSearchParamsCanBeOverridden()); - myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches()); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(new JpaStorageSettings().isDefaultSearchParamsCanBeOverridden()); + myStorageSettings.setAllowContainsSearches(new JpaStorageSettings().isAllowContainsSearches()); } @BeforeEach @Override public void before() throws Exception { super.before(); - myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches()); + myStorageSettings.setAllowContainsSearches(new JpaStorageSettings().isAllowContainsSearches()); } @Override @@ -94,7 +93,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide public void beforeResetConfig() { super.beforeResetConfig(); - myModelConfig.setDefaultSearchParamsCanBeOverridden(new ModelConfig().isDefaultSearchParamsCanBeOverridden()); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(new JpaStorageSettings().isDefaultSearchParamsCanBeOverridden()); mySearchParamRegistry.forceRefresh(); } @@ -148,7 +147,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide @Test public void testConformanceOverrideAllowed() { - myModelConfig.setDefaultSearchParamsCanBeOverridden(true); + myStorageSettings.setDefaultSearchParamsCanBeOverridden(true); CapabilityStatement conformance = myClient .fetchConformance() diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderExpungeR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderExpungeR4Test.java index 0f5c561d402..3857262c6ea 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderExpungeR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderExpungeR4Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException; @@ -34,9 +34,9 @@ public class ResourceProviderExpungeR4Test extends BaseResourceProviderR4Test { @AfterEach public void afterDisableExpunge() { - myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled()); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); - myDaoConfig.setEnforceReferentialIntegrityOnDelete(false); + myStorageSettings.setExpungeEnabled(new JpaStorageSettings().isExpungeEnabled()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); + myStorageSettings.setEnforceReferentialIntegrityOnDelete(false); } private void assertExpunged(IIdType theId) { @@ -113,8 +113,8 @@ public class ResourceProviderExpungeR4Test extends BaseResourceProviderR4Test { @BeforeEach public void beforeEnableExpunge() { - myDaoConfig.setExpungeEnabled(true); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setExpungeEnabled(true); + myStorageSettings.setAllowMultipleDelete(true); } private IFhirResourceDao getDao(IIdType theId) { @@ -177,7 +177,7 @@ public class ResourceProviderExpungeR4Test extends BaseResourceProviderR4Test { @Test public void testExpungeDisabled() { - myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled()); + myStorageSettings.setExpungeEnabled(new JpaStorageSettings().isExpungeEnabled()); Parameters input = new Parameters(); input.addParameter() @@ -338,7 +338,7 @@ public class ResourceProviderExpungeR4Test extends BaseResourceProviderR4Test { */ @Test public void testExpungeSucceedsWithIncomingReferences_ReferentialIntegrityDisabled() { - myDaoConfig.setEnforceReferentialIntegrityOnDelete(false); + myStorageSettings.setEnforceReferentialIntegrityOnDelete(false); Organization org = new Organization(); org.setActive(true); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderHasParamR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderHasParamR4Test.java index 9b34e8a84f3..d77440aeef7 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderHasParamR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderHasParamR4Test.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.provider.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.parser.StrictErrorHandler; import ca.uhn.fhir.rest.client.interceptor.CapturingInterceptor; @@ -48,13 +48,13 @@ public class ResourceProviderHasParamR4Test extends BaseResourceProviderR4Test { public void after() throws Exception { super.after(); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setCountSearchResultsUpTo(new DaoConfig().getCountSearchResultsUpTo()); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); - myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches()); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setCountSearchResultsUpTo(new JpaStorageSettings().getCountSearchResultsUpTo()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); + myStorageSettings.setAllowContainsSearches(new JpaStorageSettings().isAllowContainsSearches()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); myClient.unregisterInterceptor(myCapturingInterceptor); } @@ -65,14 +65,14 @@ public class ResourceProviderHasParamR4Test extends BaseResourceProviderR4Test { super.before(); myFhirContext.setParserErrorHandler(new StrictErrorHandler()); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); myClient.registerInterceptor(myCapturingInterceptor); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); } @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderInterceptorR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderInterceptorR4Test.java index 3e54510af86..b7e8e117bbc 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderInterceptorR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderInterceptorR4Test.java @@ -5,7 +5,7 @@ import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor; import ca.uhn.fhir.interceptor.api.Interceptor; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.interceptor.PerformanceTracingLoggingInterceptor; import ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails; import ca.uhn.fhir.jpa.model.search.SearchStatusEnum; @@ -50,6 +50,7 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.TimeUnit; import static java.util.Arrays.asList; import static org.apache.commons.lang3.time.DateUtils.MILLIS_PER_SECOND; @@ -88,13 +89,13 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes public void after() throws Exception { super.after(); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); myServer.getRestfulServer().getInterceptorService().unregisterAllInterceptors(); } @Test public void testPerfInterceptors() { - myDaoConfig.setSearchPreFetchThresholds(Lists.newArrayList(15, 100)); + myStorageSettings.setSearchPreFetchThresholds(Lists.newArrayList(15, 100)); for (int i = 0; i < 30; i++) { Patient p = new Patient(); p.addName().setFamily("FAM" + i); @@ -247,6 +248,7 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes IIdType pid = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless(); await() + .atMost(60, TimeUnit.SECONDS) .until(()->{ Bundle observations = myClient .search() diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderMeaningfulOutcomeMessageR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderMeaningfulOutcomeMessageR4Test.java index 38a3cb06883..4e67ad03fcb 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderMeaningfulOutcomeMessageR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderMeaningfulOutcomeMessageR4Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.i18n.HapiLocalizer; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.BaseStorageDao; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.model.api.StorageResponseCodeEnum; @@ -33,13 +33,13 @@ public class ResourceProviderMeaningfulOutcomeMessageR4Test extends BaseResource public void before() throws Exception { super.before(); HapiLocalizer.setOurFailOnMissingMessage(true); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); } @AfterEach @Override public void after() { - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); } @Test diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4BundleTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4BundleTest.java index 9c809584075..2b9f3891249 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4BundleTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4BundleTest.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.provider.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.util.JpaConstants; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.rest.server.exceptions.NotImplementedOperationException; @@ -41,16 +41,16 @@ public class ResourceProviderR4BundleTest extends BaseResourceProviderR4Test { @Override public void before() throws Exception { super.before(); - myDaoConfig.setBundleBatchPoolSize(20); - myDaoConfig.setBundleBatchMaxPoolSize(100); + myStorageSettings.setBundleBatchPoolSize(20); + myStorageSettings.setBundleBatchMaxPoolSize(100); } @AfterEach @Override public void after() throws Exception { super.after(); - myDaoConfig.setBundleBatchPoolSize(DaoConfig.DEFAULT_BUNDLE_BATCH_POOL_SIZE); - myDaoConfig.setBundleBatchMaxPoolSize(DaoConfig.DEFAULT_BUNDLE_BATCH_MAX_POOL_SIZE); + myStorageSettings.setBundleBatchPoolSize(JpaStorageSettings.DEFAULT_BUNDLE_BATCH_POOL_SIZE); + myStorageSettings.setBundleBatchMaxPoolSize(JpaStorageSettings.DEFAULT_BUNDLE_BATCH_MAX_POOL_SIZE); } /** * See #401 @@ -138,8 +138,8 @@ public class ResourceProviderR4BundleTest extends BaseResourceProviderR4Test { public void testBundleBatchWithSingleThread() { List ids = createPatients(50); - myDaoConfig.setBundleBatchPoolSize(1); - myDaoConfig.setBundleBatchMaxPoolSize(1); + myStorageSettings.setBundleBatchPoolSize(1); + myStorageSettings.setBundleBatchMaxPoolSize(1); Bundle input = new Bundle(); input.setType(BundleType.BATCH); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java index e3c1f9966bb..3a3bfe4ac0f 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.data.ISearchDao; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.jpa.util.TestUtil; @@ -45,8 +45,8 @@ public class ResourceProviderR4CacheTest extends BaseResourceProviderR4Test { @AfterEach public void after() throws Exception { super.after(); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setCacheControlNoStoreMaxResultsUpperLimit(new DaoConfig().getCacheControlNoStoreMaxResultsUpperLimit()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setCacheControlNoStoreMaxResultsUpperLimit(new JpaStorageSettings().getCacheControlNoStoreMaxResultsUpperLimit()); myClient.unregisterInterceptor(myCapturingInterceptor); } @@ -120,7 +120,7 @@ public class ResourceProviderR4CacheTest extends BaseResourceProviderR4Test { @Test public void testCacheNoStoreMaxResultsWithIllegalValue() { - myDaoConfig.setCacheControlNoStoreMaxResultsUpperLimit(123); + myStorageSettings.setCacheControlNoStoreMaxResultsUpperLimit(123); try { myClient .search() diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4DistanceTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4DistanceTest.java index 756a419fce1..5268cb1bb66 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4DistanceTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4DistanceTest.java @@ -17,7 +17,7 @@ public class ResourceProviderR4DistanceTest extends BaseResourceProviderR4Test { @Override public void before() throws Exception { super.before(); - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @Test diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4SearchContainedTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4SearchContainedTest.java index 92c1e2f6f2f..362fd24b7d7 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4SearchContainedTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4SearchContainedTest.java @@ -1,9 +1,8 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.parser.StrictErrorHandler; import ca.uhn.fhir.rest.client.interceptor.CapturingInterceptor; @@ -59,17 +58,17 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR public void after() throws Exception { super.after(); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setCountSearchResultsUpTo(new DaoConfig().getCountSearchResultsUpTo()); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); - myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches()); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setCountSearchResultsUpTo(new JpaStorageSettings().getCountSearchResultsUpTo()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); + myStorageSettings.setAllowContainsSearches(new JpaStorageSettings().isAllowContainsSearches()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); myClient.unregisterInterceptor(myCapturingInterceptor); - myModelConfig.setIndexOnContainedResources(false); - myModelConfig.setIndexOnContainedResources(new ModelConfig().isIndexOnContainedResources()); + myStorageSettings.setIndexOnContainedResources(false); + myStorageSettings.setIndexOnContainedResources(new JpaStorageSettings().isIndexOnContainedResources()); } @BeforeEach @@ -78,16 +77,16 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR super.before(); myFhirContext.setParserErrorHandler(new StrictErrorHandler()); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); myClient.registerInterceptor(myCapturingInterceptor); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); - myModelConfig.setIndexOnContainedResources(true); - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); + myStorageSettings.setIndexOnContainedResources(true); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @Test public void testContainedDisabled() throws Exception { - myModelConfig.setIndexOnContainedResources(false); + myStorageSettings.setIndexOnContainedResources(false); String uri = myServerBase + "/Observation?subject.name=Smith&_contained=true"; try (CloseableHttpResponse response = ourHttpClient.execute(new HttpGet(uri))) { diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java index d9e37b30660..a8900a686e4 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java @@ -2,11 +2,10 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.i18n.HapiLocalizer; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; import ca.uhn.fhir.jpa.dao.data.ISearchDao; import ca.uhn.fhir.jpa.entity.Search; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; import ca.uhn.fhir.jpa.model.entity.ResourceHistoryTable; import ca.uhn.fhir.jpa.model.util.JpaConstants; @@ -240,26 +239,26 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void after() throws Exception { super.after(); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setCountSearchResultsUpTo(new DaoConfig().getCountSearchResultsUpTo()); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); - myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches()); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); - myDaoConfig.setAdvancedHSearchIndexing(new DaoConfig().isAdvancedHSearchIndexing()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setCountSearchResultsUpTo(new JpaStorageSettings().getCountSearchResultsUpTo()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); + myStorageSettings.setAllowContainsSearches(new JpaStorageSettings().isAllowContainsSearches()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); + myStorageSettings.setAdvancedHSearchIndexing(new JpaStorageSettings().isAdvancedHSearchIndexing()); - myModelConfig.setIndexOnContainedResources(new ModelConfig().isIndexOnContainedResources()); + myStorageSettings.setIndexOnContainedResources(new JpaStorageSettings().isIndexOnContainedResources()); mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(null); mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(QueryParameterUtils.DEFAULT_SYNC_SIZE); mySearchCoordinatorSvcRaw.setNeverUseLocalSearchForUnitTests(false); mySearchCoordinatorSvcRaw.cancelAllActiveSearches(); - myDaoConfig.getModelConfig().setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); myClient.unregisterInterceptor(myCapturingInterceptor); - myDaoConfig.setUpdateWithHistoryRewriteEnabled(false); - myDaoConfig.setPreserveRequestIdInResourceBody(false); + myStorageSettings.setUpdateWithHistoryRewriteEnabled(false); + myStorageSettings.setPreserveRequestIdInResourceBody(false); } @@ -270,9 +269,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { myFhirContext.setParserErrorHandler(new StrictErrorHandler()); HapiLocalizer.setOurFailOnMissingMessage(true); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); myClient.registerInterceptor(myCapturingInterceptor); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); } @Test @@ -366,7 +365,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testSearchWithContainsLowerCase() { - myDaoConfig.setAllowContainsSearches(true); + myStorageSettings.setAllowContainsSearches(true); Patient pt1 = new Patient(); pt1.addName().setFamily("Elizabeth"); @@ -403,7 +402,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testSearchWithPercentSign() { - myDaoConfig.setAllowContainsSearches(true); + myStorageSettings.setAllowContainsSearches(true); Patient pt1 = new Patient(); pt1.addName().setFamily("Smith%"); @@ -459,7 +458,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testSearchWithSlashes() { - myDaoConfig.setSearchPreFetchThresholds(Lists.newArrayList(10, 50, 10000)); + myStorageSettings.setSearchPreFetchThresholds(Lists.newArrayList(10, 50, 10000)); Procedure procedure = new Procedure(); procedure.setStatus(Procedure.ProcedureStatus.COMPLETED); @@ -507,7 +506,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testManualPagingLinkOffsetDoesntReturnBeyondEnd() { - myDaoConfig.setSearchPreFetchThresholds(Lists.newArrayList(10, 1000)); + myStorageSettings.setSearchPreFetchThresholds(Lists.newArrayList(10, 1000)); for (int i = 0; i < 50; i++) { Organization o = new Organization(); @@ -838,7 +837,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); mySearchCoordinatorSvcRaw = AopTestUtils.getTargetObject(mySearchCoordinatorSvc); } @@ -1287,7 +1286,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testSearchByExternalReference() { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); Patient patient = new Patient(); patient.addName().setFamily("FooName"); @@ -1621,7 +1620,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testDeleteConditionalMultiple() { String methodName = "testDeleteConditionalMultiple"; - myDaoConfig.setAllowMultipleDelete(false); + myStorageSettings.setAllowMultipleDelete(false); Patient p = new Patient(); p.addIdentifier().setSystem("urn:system").setValue(methodName); @@ -1651,7 +1650,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { myClient.read().resource("Patient").withId(id1).execute(); myClient.read().resource("Patient").withId(id2).execute(); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); MethodOutcome response = myClient .delete() @@ -2831,7 +2830,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { */ @Test public void testEverythingWithLargeSet2() { - myDaoConfig.setSearchPreFetchThresholds(Arrays.asList(15, 30, -1)); + myStorageSettings.setSearchPreFetchThresholds(Arrays.asList(15, 30, -1)); myPagingProvider.setDefaultPageSize(500); myPagingProvider.setMaximumPageSize(1000); @@ -3140,7 +3139,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @ParameterizedTest @ValueSource(booleans = {true, false}) public void testHasParameterOnChain(boolean theWithIndexOnContainedResources) throws Exception { - myModelConfig.setIndexOnContainedResources(theWithIndexOnContainedResources); + myStorageSettings.setIndexOnContainedResources(theWithIndexOnContainedResources); IIdType pid0; IIdType pid1; @@ -3186,7 +3185,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @ParameterizedTest @ValueSource(booleans = {true, false}) public void testHasParameterWithIdTarget(boolean theWithIndexOnContainedResources) throws Exception { - myModelConfig.setIndexOnContainedResources(theWithIndexOnContainedResources); + myStorageSettings.setIndexOnContainedResources(theWithIndexOnContainedResources); IIdType pid0; IIdType obsId; @@ -3565,7 +3564,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testIncludeWithExternalReferences() { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); Patient p = new Patient(); p.getManagingOrganization().setReference("http://example.com/Organization/123"); @@ -4243,7 +4242,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testCodeInWithLargeValueSet() throws IOException { //Given: We load a large codesystem - myDaoConfig.setMaximumExpansionSize(1000); + myStorageSettings.setMaximumExpansionSize(1000); ZipCollectionBuilder zipCollectionBuilder = new ZipCollectionBuilder(); zipCollectionBuilder.addFileZip("/largecodesystem/", "concepts.csv"); zipCollectionBuilder.addFileZip("/largecodesystem/", "hierarchy.csv"); @@ -4270,7 +4269,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertOneResult(myClient.search().byUrl("Observation?code:in=http://smilecdr.com/V").returnBundle(Bundle.class).execute()); assertOneResult(myClient.search().byUrl("Observation?code:not-in=http://smilecdr.com/V").returnBundle(Bundle.class).execute()); - myDaoConfig.setMaximumExpansionSize(new DaoConfig().getMaximumExpansionSize()); + myStorageSettings.setMaximumExpansionSize(new JpaStorageSettings().getMaximumExpansionSize()); } private void assertOneResult(Bundle theResponse) { @@ -4943,7 +4942,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testSearchWithNormalizedQuantitySearchSupported() throws Exception { - myDaoConfig.getModelConfig().setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); IIdType pid0; { Patient patient = new Patient(); @@ -5025,7 +5024,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testSearchWithNormalizedQuantitySearchSupported_CombineUCUMOrNonUCUM() throws Exception { - myDaoConfig.getModelConfig().setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); IIdType pid0; { Patient patient = new Patient(); @@ -5096,7 +5095,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testSearchWithNormalizedQuantitySearchSupported_DegreeFahrenheit() throws Exception { - myDaoConfig.getModelConfig().setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); IIdType pid0; { Patient patient = new Patient(); @@ -5167,7 +5166,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); - myDaoConfig.setReuseCachedSearchResultsForMillis(10000L); + myStorageSettings.setReuseCachedSearchResultsForMillis(10000L); Bundle result1 = myClient .search() @@ -5200,7 +5199,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { { - myDaoConfig.setReuseCachedSearchResultsForMillis(10L); + myStorageSettings.setReuseCachedSearchResultsForMillis(10L); Bundle result1 = myClient .search() .forResource("Organization") @@ -5218,7 +5217,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } { - myDaoConfig.setReuseCachedSearchResultsForMillis(1000L); + myStorageSettings.setReuseCachedSearchResultsForMillis(1000L); Bundle result1 = myClient .search() .forResource("Organization") @@ -5253,7 +5252,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); Bundle result1 = myClient .search() @@ -5299,7 +5298,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); - myDaoConfig.setReuseCachedSearchResultsForMillis(1000L); + myStorageSettings.setReuseCachedSearchResultsForMillis(1000L); Bundle result1 = myClient .search() @@ -5353,7 +5352,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { } myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute(); - myDaoConfig.setReuseCachedSearchResultsForMillis(100000L); + myStorageSettings.setReuseCachedSearchResultsForMillis(100000L); Bundle result1 = myClient .search() @@ -5491,7 +5490,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testSearchWithCountSearchResultsUpTo20() { mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(1); mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(200); - myDaoConfig.setCountSearchResultsUpTo(20); + myStorageSettings.setCountSearchResultsUpTo(20); for (int i = 0; i < 10; i++) { Patient pat = new Patient(); @@ -5520,7 +5519,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public void testSearchWithCountSearchResultsUpTo5() { mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(1); mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(200); - myDaoConfig.setCountSearchResultsUpTo(5); + myStorageSettings.setCountSearchResultsUpTo(5); for (int i = 0; i < 10; i++) { Patient pat = new Patient(); @@ -5553,7 +5552,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testSearchWithEmptyParameter() throws Exception { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); Observation obs = new Observation(); obs.setStatus(ObservationStatus.FINAL); @@ -5863,7 +5862,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testSearchWithMissing() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); ourLog.info("Starting testSearchWithMissing"); String methodName = "testSearchWithMissing"; @@ -5934,7 +5933,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testSearchWithMissing2() throws Exception { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); checkParamMissing(Observation.SP_CODE); checkParamMissing(Observation.SP_CATEGORY); checkParamMissing(Observation.SP_VALUE_STRING); @@ -5944,7 +5943,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testSearchWithMissingDate2() throws Exception { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); MedicationRequest mr1 = new MedicationRequest(); mr1.addCategory().addCoding().setSystem("urn:medicationroute").setCode("oral"); @@ -6093,7 +6092,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testSmallResultIncludes() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); Patient p = new Patient(); p.setId("p"); @@ -6285,8 +6284,8 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testCreateResourcesWithAdvancedHSearchIndexingAndIndexMissingFieldsEnableSucceeds() throws Exception { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); - myDaoConfig.setAdvancedHSearchIndexing(true); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); + myStorageSettings.setAdvancedHSearchIndexing(true); String identifierValue = "someValue"; String searchPatientURIWithMissingBirthdate = "Patient?birthdate:missing=true"; String searchObsURIWithMissingValueQuantity = "Observation?value-quantity:missing=true"; @@ -7079,7 +7078,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testUpdateWithNormalizedQuantitySearchSupported() throws Exception { - myDaoConfig.getModelConfig().setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); IIdType pid0; { Patient patient = new Patient(); @@ -7226,7 +7225,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testUpdateHistoryRewriteWithIdNoHistoryVersion() { - myDaoConfig.setUpdateWithHistoryRewriteEnabled(true); + myStorageSettings.setUpdateWithHistoryRewriteEnabled(true); String testFamilyNameModified = "Jackson"; // setup @@ -7262,7 +7261,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testUpdateHistoryRewriteWithIdNull() { - myDaoConfig.setUpdateWithHistoryRewriteEnabled(true); + myStorageSettings.setUpdateWithHistoryRewriteEnabled(true); String testFamilyNameModified = "Jackson"; // setup @@ -7297,7 +7296,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void testUpdateHistoryRewriteWithIdNoIdPart() { - myDaoConfig.setUpdateWithHistoryRewriteEnabled(true); + myStorageSettings.setUpdateWithHistoryRewriteEnabled(true); String testFamilyNameModified = "Jackson"; // setup @@ -7334,7 +7333,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void createResource_withPreserveRequestIdEnabled_requestIdIsPreserved() { - myDaoConfig.setPreserveRequestIdInResourceBody(true); + myStorageSettings.setPreserveRequestIdInResourceBody(true); String expectedMetaSource = "mySource#345676"; String patientId = "1234a"; @@ -7357,7 +7356,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void createResource_withPreserveRequestIdEnabledAndRequestIdLengthGT16_requestIdIsPreserved() { - myDaoConfig.setPreserveRequestIdInResourceBody(true); + myStorageSettings.setPreserveRequestIdInResourceBody(true); String metaSource = "mySource#123456789012345678901234567890"; String expectedMetaSource = "mySource#1234567890123456"; @@ -7404,7 +7403,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void searchResource_bySourceAndRequestIdWithPreserveRequestIdEnabled_isSuccess() { - myDaoConfig.setPreserveRequestIdInResourceBody(true); + myStorageSettings.setPreserveRequestIdInResourceBody(true); String sourceUri = "mySource"; String requestId = "345676"; @@ -7621,17 +7620,17 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { assertTrue(orgs == null || orgs.isEmpty()); } - boolean isEnforceRefOnWrite = myDaoConfig.isEnforceReferentialIntegrityOnWrite(); - boolean isEnforceRefTargetTypes = myDaoConfig.isEnforceReferenceTargetTypes(); - boolean isAutoCreatePlaceholderReferences = myDaoConfig.isAutoCreatePlaceholderReferenceTargets(); + boolean isEnforceRefOnWrite = myStorageSettings.isEnforceReferentialIntegrityOnWrite(); + boolean isEnforceRefTargetTypes = myStorageSettings.isEnforceReferenceTargetTypes(); + boolean isAutoCreatePlaceholderReferences = myStorageSettings.isAutoCreatePlaceholderReferenceTargets(); try { // allows resources to be created even if they have local resources that do not exist - myDaoConfig.setEnforceReferentialIntegrityOnWrite(theInput.IsEnforceRefOnWrite); + myStorageSettings.setEnforceReferentialIntegrityOnWrite(theInput.IsEnforceRefOnWrite); // ensures target references are using the correct resource type - myDaoConfig.setEnforceReferenceTargetTypes(theInput.IsEnforceRefOnType); + myStorageSettings.setEnforceReferenceTargetTypes(theInput.IsEnforceRefOnType); // will create the resource if it does not already exist - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(theInput.IsAutoCreatePlaceholderReferences); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(theInput.IsAutoCreatePlaceholderReferences); // should fail DaoMethodOutcome result = myPatientDao.create(patient, new SystemRequestDetails()); @@ -7656,9 +7655,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { "Invalid resource reference" ), ex.getMessage()); } finally { - myDaoConfig.setEnforceReferentialIntegrityOnWrite(isEnforceRefOnWrite); - myDaoConfig.setEnforceReferenceTargetTypes(isEnforceRefTargetTypes); - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(isAutoCreatePlaceholderReferences); + myStorageSettings.setEnforceReferentialIntegrityOnWrite(isEnforceRefOnWrite); + myStorageSettings.setEnforceReferenceTargetTypes(isEnforceRefTargetTypes); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(isAutoCreatePlaceholderReferences); } } @@ -7691,7 +7690,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void searchResource_bySourceWithPreserveRequestIdEnabled_isSuccess() { - myDaoConfig.setPreserveRequestIdInResourceBody(true); + myStorageSettings.setPreserveRequestIdInResourceBody(true); String sourceUri = "http://acme.org"; String requestId = "my-fragment"; String expectedSourceUrl = sourceUri + "#" + requestId; @@ -7719,7 +7718,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void searchResource_byRequestIdWithPreserveRequestIdEnabled_isSuccess() { - myDaoConfig.setPreserveRequestIdInResourceBody(true); + myStorageSettings.setPreserveRequestIdInResourceBody(true); String sourceUri = "http://acme.org"; String requestId = "my-fragment"; String expectedSourceUrl = sourceUri + "#" + requestId; @@ -7748,7 +7747,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @Test public void searchResource_bySourceAndWrongRequestIdWithPreserveRequestIdEnabled_fails() { - myDaoConfig.setPreserveRequestIdInResourceBody(true); + myStorageSettings.setPreserveRequestIdInResourceBody(true); Patient patient = new Patient(); patient.getMeta().setSource("urn:source:0#my-fragment123"); @@ -7889,7 +7888,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { myParser = myFhirContext.newJsonParser(); myParser.setPrettyPrint(true); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); } /** @@ -7967,7 +7966,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { ); // setup - myDaoConfig.setIndexMissingFields(theParams.myEnableMissingFieldsValue); + myStorageSettings.setIndexMissingFields(theParams.myEnableMissingFieldsValue); // create our resource Resource resource = theResourceProvider.doTask(theParams.myIsValuePresentOnResource); @@ -8053,7 +8052,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { @ParameterizedTest @MethodSource("provideParameters") public void testMissingReferenceClientParameterOnIndexedContainedResources(MissingSearchTestParameters theParams) { - myModelConfig.setIndexOnContainedResources(true); + myStorageSettings.setIndexOnContainedResources(true); runTest(theParams, hasField -> { Observation obs = new Observation(); @@ -8069,7 +8068,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { return doSearch(Observation.class, criterion); }); - myModelConfig.setIndexOnContainedResources(false); + myStorageSettings.setIndexOnContainedResources(false); } @ParameterizedTest @@ -8142,7 +8141,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { /** * The setting for IndexMissingFields */ - public final DaoConfig.IndexEnabledEnum myEnableMissingFieldsValue; + public final JpaStorageSettings.IndexEnabledEnum myEnableMissingFieldsValue; /** * Whether to use :missing=true/false @@ -8157,7 +8156,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { public final boolean myIsValuePresentOnResource; public MissingSearchTestParameters( - DaoConfig.IndexEnabledEnum theEnableMissingFields, + JpaStorageSettings.IndexEnabledEnum theEnableMissingFields, boolean theIsMissing, boolean theHasField ) { @@ -8173,21 +8172,21 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test { private static Stream provideParameters() { return Stream.of( // 1 - Arguments.of(new MissingSearchTestParameters(DaoConfig.IndexEnabledEnum.ENABLED, true, true)), + Arguments.of(new MissingSearchTestParameters(JpaStorageSettings.IndexEnabledEnum.ENABLED, true, true)), // 2 - Arguments.of(new MissingSearchTestParameters(DaoConfig.IndexEnabledEnum.ENABLED, false, false)), + Arguments.of(new MissingSearchTestParameters(JpaStorageSettings.IndexEnabledEnum.ENABLED, false, false)), // 3 - Arguments.of(new MissingSearchTestParameters(DaoConfig.IndexEnabledEnum.ENABLED, false, true)), + Arguments.of(new MissingSearchTestParameters(JpaStorageSettings.IndexEnabledEnum.ENABLED, false, true)), // 4 - Arguments.of(new MissingSearchTestParameters(DaoConfig.IndexEnabledEnum.ENABLED, true, false)), + Arguments.of(new MissingSearchTestParameters(JpaStorageSettings.IndexEnabledEnum.ENABLED, true, false)), // 5 - Arguments.of(new MissingSearchTestParameters(DaoConfig.IndexEnabledEnum.DISABLED, true, true)), + Arguments.of(new MissingSearchTestParameters(JpaStorageSettings.IndexEnabledEnum.DISABLED, true, true)), // 6 - Arguments.of(new MissingSearchTestParameters(DaoConfig.IndexEnabledEnum.DISABLED, false, true)), + Arguments.of(new MissingSearchTestParameters(JpaStorageSettings.IndexEnabledEnum.DISABLED, false, true)), // 7 - Arguments.of(new MissingSearchTestParameters(DaoConfig.IndexEnabledEnum.DISABLED, true, false)), + Arguments.of(new MissingSearchTestParameters(JpaStorageSettings.IndexEnabledEnum.DISABLED, true, false)), // 8 - Arguments.of(new MissingSearchTestParameters(DaoConfig.IndexEnabledEnum.DISABLED, false, false)) + Arguments.of(new MissingSearchTestParameters(JpaStorageSettings.IndexEnabledEnum.DISABLED, false, false)) ); } } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetNoVerCSNoVerTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetNoVerCSNoVerTest.java index 2612fa6ce6d..3c0b880b903 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetNoVerCSNoVerTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetNoVerCSNoVerTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; @@ -254,7 +254,7 @@ public class ResourceProviderR4ValueSetNoVerCSNoVerTest extends BaseResourceProv @Test public void testExpandByIdWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); await().until(() -> clearDeferredStorageQueue()); @@ -311,7 +311,7 @@ public class ResourceProviderR4ValueSetNoVerCSNoVerTest extends BaseResourceProv @Test public void testExpandByIdWithFilterWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); await().until(() -> clearDeferredStorageQueue()); @@ -339,7 +339,7 @@ public class ResourceProviderR4ValueSetNoVerCSNoVerTest extends BaseResourceProv @Test public void testExpandByIdWithFilterWithPreExpansionWithPrefixValue() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); await().until(() -> clearDeferredStorageQueue()); @@ -366,7 +366,7 @@ public class ResourceProviderR4ValueSetNoVerCSNoVerTest extends BaseResourceProv @Test public void testExpandByIdWithFilterWithPreExpansionWithoutPrefixValue() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); await().until(() -> clearDeferredStorageQueue()); @@ -412,7 +412,7 @@ public class ResourceProviderR4ValueSetNoVerCSNoVerTest extends BaseResourceProv @Test public void testExpandByUrlNoPreExpand() throws Exception { - myDaoConfig.setPreExpandValueSets(false); + myStorageSettings.setPreExpandValueSets(false); loadAndPersistCodeSystemAndValueSet(); Parameters respParam = myClient @@ -450,7 +450,7 @@ public class ResourceProviderR4ValueSetNoVerCSNoVerTest extends BaseResourceProv @Test public void testExpandByUrlWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); await().until(() -> clearDeferredStorageQueue()); @@ -478,7 +478,7 @@ public class ResourceProviderR4ValueSetNoVerCSNoVerTest extends BaseResourceProv @Test public void testExpandByUrlWithPreExpansionAndBogusUrl() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -520,7 +520,7 @@ public class ResourceProviderR4ValueSetNoVerCSNoVerTest extends BaseResourceProv @Test public void testExpandByValueSetWithPreExpansion() throws IOException { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystem(); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -828,7 +828,7 @@ public class ResourceProviderR4ValueSetNoVerCSNoVerTest extends BaseResourceProv @Test public void testUpdateValueSetTriggersAnotherPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(); @@ -858,7 +858,7 @@ public class ResourceProviderR4ValueSetNoVerCSNoVerTest extends BaseResourceProv @Test public void testUpdateValueSetTriggersAnotherPreExpansionUsingTransactionBundle() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(); @@ -1543,7 +1543,7 @@ public class ResourceProviderR4ValueSetNoVerCSNoVerTest extends BaseResourceProv @AfterEach public void afterResetPreExpansionDefault() { - myDaoConfig.setPreExpandValueSets(new DaoConfig().isPreExpandValueSets()); + myStorageSettings.setPreExpandValueSets(new JpaStorageSettings().isPreExpandValueSets()); } public static CodeSystem createExternalCs(IFhirResourceDao theCodeSystemDao, IResourceTableDao theResourceTableDao, ITermCodeSystemStorageSvc theTermCodeSystemStorageSvc, ServletRequestDetails theRequestDetails) { diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetVerCSNoVerTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetVerCSNoVerTest.java index e7f0504dea0..035a23222ff 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetVerCSNoVerTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetVerCSNoVerTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; @@ -220,7 +220,7 @@ public class ResourceProviderR4ValueSetVerCSNoVerTest extends BaseResourceProvid @Test public void testExpandByIdWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); await().until(() -> clearDeferredStorageQueue()); @@ -277,7 +277,7 @@ public class ResourceProviderR4ValueSetVerCSNoVerTest extends BaseResourceProvid @Test public void testExpandByIdWithFilterWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); await().until(() -> clearDeferredStorageQueue()); @@ -324,7 +324,7 @@ public class ResourceProviderR4ValueSetVerCSNoVerTest extends BaseResourceProvid @Test public void testExpandByUrlNoPreExpand() throws Exception { - myDaoConfig.setPreExpandValueSets(false); + myStorageSettings.setPreExpandValueSets(false); loadAndPersistCodeSystemAndValueSet(); Parameters respParam = myClient @@ -362,7 +362,7 @@ public class ResourceProviderR4ValueSetVerCSNoVerTest extends BaseResourceProvid @Test public void testExpandByUrlWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); await().until(() -> clearDeferredStorageQueue()); @@ -390,7 +390,7 @@ public class ResourceProviderR4ValueSetVerCSNoVerTest extends BaseResourceProvid @Test public void testExpandByUrlWithPreExpansionAndBogusUrl() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -432,7 +432,7 @@ public class ResourceProviderR4ValueSetVerCSNoVerTest extends BaseResourceProvid @Test public void testExpandByValueSetWithPreExpansion() throws IOException { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystem(); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -718,7 +718,7 @@ public class ResourceProviderR4ValueSetVerCSNoVerTest extends BaseResourceProvid @Test public void testUpdateValueSetTriggersAnotherPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(); @@ -748,7 +748,7 @@ public class ResourceProviderR4ValueSetVerCSNoVerTest extends BaseResourceProvid @Test public void testUpdateValueSetTriggersAnotherPreExpansionUsingTransactionBundle() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(); @@ -1018,7 +1018,7 @@ public class ResourceProviderR4ValueSetVerCSNoVerTest extends BaseResourceProvid @AfterEach public void afterResetPreExpansionDefault() { - myDaoConfig.setPreExpandValueSets(new DaoConfig().isPreExpandValueSets()); + myStorageSettings.setPreExpandValueSets(new JpaStorageSettings().isPreExpandValueSets()); } public static CodeSystem createExternalCs(IFhirResourceDao theCodeSystemDao, IResourceTableDao theResourceTableDao, ITermCodeSystemStorageSvc theTermCodeSystemStorageSvc, ServletRequestDetails theRequestDetails) { diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetVerCSVerTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetVerCSVerTest.java index 20a2a8968f8..ad75e811737 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetVerCSVerTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetVerCSVerTest.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.provider.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; @@ -263,7 +263,7 @@ public class ResourceProviderR4ValueSetVerCSVerTest extends BaseResourceProvider @Test public void testExpandByIdWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); await().until(() -> clearDeferredStorageQueue()); @@ -361,7 +361,7 @@ public class ResourceProviderR4ValueSetVerCSVerTest extends BaseResourceProvider @Test public void testExpandByIdWithFilterWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); await().until(() -> clearDeferredStorageQueue()); @@ -457,7 +457,7 @@ public class ResourceProviderR4ValueSetVerCSVerTest extends BaseResourceProvider @Test public void testExpandByUrlAndVersionNoPreExpand() throws Exception { - myDaoConfig.setPreExpandValueSets(false); + myStorageSettings.setPreExpandValueSets(false); loadAndPersistCodeSystemAndValueSet(); // Check expansion of multi-versioned ValueSet with version 1 @@ -530,7 +530,7 @@ public class ResourceProviderR4ValueSetVerCSVerTest extends BaseResourceProvider @Test public void testExpandByUrlWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); await().until(() -> clearDeferredStorageQueue()); @@ -593,7 +593,7 @@ public class ResourceProviderR4ValueSetVerCSVerTest extends BaseResourceProvider @Test public void testExpandByUrlWithPreExpansionAndBogusVersion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -680,7 +680,7 @@ public class ResourceProviderR4ValueSetVerCSVerTest extends BaseResourceProvider @Test public void testExpandByValueSetWithPreExpansion() throws IOException { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystem(); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -910,7 +910,7 @@ public class ResourceProviderR4ValueSetVerCSVerTest extends BaseResourceProvider @Test public void testUpdateValueSetTriggersAnotherPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(); @@ -959,7 +959,7 @@ public class ResourceProviderR4ValueSetVerCSVerTest extends BaseResourceProvider @Test public void testUpdateValueSetTriggersAnotherPreExpansionUsingTransactionBundle() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(); @@ -1683,7 +1683,7 @@ public class ResourceProviderR4ValueSetVerCSVerTest extends BaseResourceProvider @AfterEach public void afterResetPreExpansionDefault() { - myDaoConfig.setPreExpandValueSets(new DaoConfig().isPreExpandValueSets()); + myStorageSettings.setPreExpandValueSets(new JpaStorageSettings().isPreExpandValueSets()); } public CodeSystem createExternalCs(IFhirResourceDao theCodeSystemDao, IResourceTableDao theResourceTableDao, ITermCodeSystemStorageSvc theTermCodeSystemStorageSvc, ServletRequestDetails theRequestDetails) { diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderSearchModifierR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderSearchModifierR4Test.java index 3c77ba18645..e008acdfd61 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderSearchModifierR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderSearchModifierR4Test.java @@ -1,8 +1,7 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.parser.StrictErrorHandler; import ca.uhn.fhir.rest.client.interceptor.CapturingInterceptor; @@ -25,7 +24,6 @@ import org.junit.jupiter.api.Test; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.ArrayList; -import java.util.Date; import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -42,15 +40,15 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4 public void after() throws Exception { super.after(); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setCountSearchResultsUpTo(new DaoConfig().getCountSearchResultsUpTo()); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); - myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches()); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setCountSearchResultsUpTo(new JpaStorageSettings().getCountSearchResultsUpTo()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); + myStorageSettings.setAllowContainsSearches(new JpaStorageSettings().isAllowContainsSearches()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); - myModelConfig.setIndexIdentifierOfType(new ModelConfig().isIndexIdentifierOfType()); + myStorageSettings.setIndexIdentifierOfType(new JpaStorageSettings().isIndexIdentifierOfType()); myClient.unregisterInterceptor(myCapturingInterceptor); } @@ -61,14 +59,14 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4 super.before(); myFhirContext.setParserErrorHandler(new StrictErrorHandler()); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); myClient.registerInterceptor(myCapturingInterceptor); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); } @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @Test @@ -222,7 +220,7 @@ public class ResourceProviderSearchModifierR4Test extends BaseResourceProviderR4 @Test public void testSearch_OfType_PartialBlocked() { - myModelConfig.setIndexIdentifierOfType(true); + myStorageSettings.setIndexIdentifierOfType(true); try { String uri = myServerBase + "/Patient?identifier:of-type=A"; diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderSummaryModeR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderSummaryModeR4Test.java index 1ad26f1b63a..b3392190f84 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderSummaryModeR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderSummaryModeR4Test.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.provider.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl; import ca.uhn.fhir.jpa.util.QueryParameterUtils; @@ -28,24 +28,24 @@ public class ResourceProviderSummaryModeR4Test extends BaseResourceProviderR4Tes @AfterEach public void after() throws Exception { super.after(); - myDaoConfig.setCountSearchResultsUpTo(null); + myStorageSettings.setCountSearchResultsUpTo(null); mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(null); mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(QueryParameterUtils.DEFAULT_SYNC_SIZE); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); - myDaoConfig.setDefaultTotalMode(null); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); + myStorageSettings.setDefaultTotalMode(null); } @BeforeEach @Override public void before() throws Exception { super.before(); - myDaoConfig.setCountSearchResultsUpTo(5); + myStorageSettings.setCountSearchResultsUpTo(5); mySearchCoordinatorSvcRaw = AopTestUtils.getTargetObject(mySearchCoordinatorSvc); mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(50); mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(5); - myDaoConfig.setSearchPreFetchThresholds(Lists.newArrayList(20, 50, -1)); + myStorageSettings.setSearchPreFetchThresholds(Lists.newArrayList(20, 50, -1)); runInTransaction(() -> { for (int i = 0; i < 104; i++) { @@ -99,7 +99,7 @@ public class ResourceProviderSummaryModeR4Test extends BaseResourceProviderR4Tes */ @Test public void testSearchWithTotalAccurateSpecifiedAsDefault() { - myDaoConfig.setDefaultTotalMode(SearchTotalModeEnum.ACCURATE); + myStorageSettings.setDefaultTotalMode(SearchTotalModeEnum.ACCURATE); Bundle outcome = myClient .search() @@ -117,7 +117,7 @@ public class ResourceProviderSummaryModeR4Test extends BaseResourceProviderR4Tes */ @Test public void testSearchNoHitsWithTotalAccurateSpecifiedAsDefault() { - myDaoConfig.setDefaultTotalMode(SearchTotalModeEnum.ACCURATE); + myStorageSettings.setDefaultTotalMode(SearchTotalModeEnum.ACCURATE); Bundle outcome = myClient .search() @@ -153,7 +153,7 @@ public class ResourceProviderSummaryModeR4Test extends BaseResourceProviderR4Tes */ @Test public void testSearchTotalNoneOverridingDefault() { - myDaoConfig.setDefaultTotalMode(SearchTotalModeEnum.ACCURATE); + myStorageSettings.setDefaultTotalMode(SearchTotalModeEnum.ACCURATE); Bundle outcome = myClient .search() diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ServerCapabilityStatementProviderJpaR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ServerCapabilityStatementProviderJpaR4Test.java index ff41aaeea52..d1a8a599a01 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ServerCapabilityStatementProviderJpaR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/ServerCapabilityStatementProviderJpaR4Test.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.provider.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.packages.PackageInstallationSpec; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.rest.api.CacheControlDirective; @@ -160,7 +160,7 @@ public class ServerCapabilityStatementProviderJpaR4Test extends BaseResourceProv @AfterEach public void after() throws Exception { super.after(); - myDaoConfig.setFilterParameterEnabled(new DaoConfig().isFilterParameterEnabled()); + myStorageSettings.setFilterParameterEnabled(new JpaStorageSettings().isFilterParameterEnabled()); } @@ -326,7 +326,7 @@ public class ServerCapabilityStatementProviderJpaR4Test extends BaseResourceProv @Test public void testFilterProperlyReported() { - myDaoConfig.setFilterParameterEnabled(false); + myStorageSettings.setFilterParameterEnabled(false); CapabilityStatement cs = myClient.capabilities().ofType(CapabilityStatement.class).execute(); assertThat(findSearchParams(cs, "Patient", Constants.PARAM_FILTER), hasSize(0)); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/StaleSearchDeletingSvcR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/StaleSearchDeletingSvcR4Test.java index cf8762433fd..3d9f3e0a6e9 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/StaleSearchDeletingSvcR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/StaleSearchDeletingSvcR4Test.java @@ -94,8 +94,8 @@ public class StaleSearchDeletingSvcR4Test extends BaseResourceProviderR4Test { myClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute(); Thread.sleep(20); - myDaoConfig.setExpireSearchResultsAfterMillis(10); - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setExpireSearchResultsAfterMillis(10); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem(); try { diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/SubscriptionsR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/SubscriptionsR4Test.java index 4c0ce9ac99a..d9a45aa3658 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/SubscriptionsR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/SubscriptionsR4Test.java @@ -50,12 +50,12 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test { @BeforeEach public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); + myStorageSettings.setReuseCachedSearchResultsForMillis(null); } @BeforeEach public void beforeEnableScheduling() { - myDaoConfig.setSchedulingDisabled(false); + myStorageSettings.setSchedulingDisabled(false); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/SystemProviderR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/SystemProviderR4Test.java index 0ced5ba463a..249b90d6ae7 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/SystemProviderR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/SystemProviderR4Test.java @@ -8,7 +8,7 @@ import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor; import ca.uhn.fhir.interceptor.api.IPointcut; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.rp.r4.BinaryResourceProvider; import ca.uhn.fhir.jpa.rp.r4.DiagnosticReportResourceProvider; import ca.uhn.fhir.jpa.rp.r4.LocationResourceProvider; @@ -125,11 +125,11 @@ public class SystemProviderR4Test extends BaseJpaR4Test { @AfterEach public void after() { myClient.unregisterInterceptor(mySimpleHeaderInterceptor); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); - myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled()); - myDaoConfig.setDeleteExpungeEnabled(new DaoConfig().isDeleteExpungeEnabled()); - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(new DaoConfig().isAutoCreatePlaceholderReferenceTargets()); - myDaoConfig.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(new DaoConfig().isPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); + myStorageSettings.setExpungeEnabled(new JpaStorageSettings().isExpungeEnabled()); + myStorageSettings.setDeleteExpungeEnabled(new JpaStorageSettings().isDeleteExpungeEnabled()); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(new JpaStorageSettings().isAutoCreatePlaceholderReferenceTargets()); + myStorageSettings.setPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets(new JpaStorageSettings().isPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets()); } @BeforeEach @@ -466,7 +466,7 @@ public class SystemProviderR4Test extends BaseJpaR4Test { @Test public void testTransactionDeleteWithDuplicateDeletes() throws Exception { - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Patient p = new Patient(); p.addName().setFamily("van de Heuvelcx85ioqWJbI").addGiven("Pietercx85ioqWJbI"); @@ -790,7 +790,7 @@ public class SystemProviderR4Test extends BaseJpaR4Test { @Test public void testTransactionWithInlineConditionalUrl() throws Exception { - myDaoConfig.setAllowInlineMatchUrlReferences(true); + myStorageSettings.setAllowInlineMatchUrlReferences(true); Patient p = new Patient(); p.addName().setFamily("van de Heuvelcx85ioqWJbI").addGiven("Pietercx85ioqWJbI"); @@ -926,9 +926,9 @@ public class SystemProviderR4Test extends BaseJpaR4Test { @Test public void testDeleteExpungeOperation() { - myDaoConfig.setAllowMultipleDelete(true); - myDaoConfig.setExpungeEnabled(true); - myDaoConfig.setDeleteExpungeEnabled(true); + myStorageSettings.setAllowMultipleDelete(true); + myStorageSettings.setExpungeEnabled(true); + myStorageSettings.setDeleteExpungeEnabled(true); // setup for (int i = 0; i < 12; ++i) { diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/SystemProviderTransactionSearchR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/SystemProviderTransactionSearchR4Test.java index 7c7345b8f3a..016e3de04e6 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/SystemProviderTransactionSearchR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/SystemProviderTransactionSearchR4Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider.r4; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.rp.r4.MedicationRequestResourceProvider; import ca.uhn.fhir.jpa.rp.r4.MedicationResourceProvider; import ca.uhn.fhir.jpa.rp.r4.ObservationResourceProvider; @@ -65,7 +65,7 @@ public class SystemProviderTransactionSearchR4Test extends BaseJpaR4Test { @AfterEach public void after() { ourClient.unregisterInterceptor(mySimpleHeaderInterceptor); - myDaoConfig.setMaximumSearchResultCountInTransaction(new DaoConfig().getMaximumSearchResultCountInTransaction()); + myStorageSettings.setMaximumSearchResultCountInTransaction(new JpaStorageSettings().getMaximumSearchResultCountInTransaction()); } @BeforeEach @@ -156,7 +156,7 @@ public class SystemProviderTransactionSearchR4Test extends BaseJpaR4Test { .setMethod(HTTPVerb.GET) .setUrl("Patient?_count=5&_sort=_id"); - myDaoConfig.setMaximumSearchResultCountInTransaction(100); + myStorageSettings.setMaximumSearchResultCountInTransaction(100); Bundle output = ourClient.transaction().withBundle(input).execute(); ourLog.debug(myFhirContext.newXmlParser().setPrettyPrint(true).encodeResourceToString(output)); @@ -303,7 +303,7 @@ public class SystemProviderTransactionSearchR4Test extends BaseJpaR4Test { .setMethod(HTTPVerb.GET) .setUrl("Patient?_count=5&_sort=_id"); - myDaoConfig.setMaximumSearchResultCountInTransaction(100); + myStorageSettings.setMaximumSearchResultCountInTransaction(100); Bundle output = ourClient.transaction().withBundle(input).execute(); ourLog.debug(myFhirContext.newXmlParser().setPrettyPrint(true).encodeResourceToString(output)); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/reindex/ReindexStepTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/reindex/ReindexStepTest.java index ccff34125ed..5a23c780ba4 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/reindex/ReindexStepTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/reindex/ReindexStepTest.java @@ -5,7 +5,7 @@ import ca.uhn.fhir.batch2.api.RunOutcome; import ca.uhn.fhir.batch2.api.VoidModel; import ca.uhn.fhir.batch2.jobs.chunk.ResourceIdListWorkChunkJson; import ca.uhn.fhir.batch2.jobs.reindex.ReindexStep; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.test.BaseJpaR4Test; import org.hl7.fhir.instance.model.api.IIdType; @@ -39,7 +39,7 @@ public class ReindexStepTest extends BaseJpaR4Test { @AfterEach public void after() { - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); } @Test @@ -75,7 +75,7 @@ public class ReindexStepTest extends BaseJpaR4Test { // Setup - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); Long id0 = createPatient(withActiveTrue(), withFamily("SIMPSON")).getIdPartAsLong(); Long id1 = createPatient(withActiveTrue(), withFamily("FLANDERS")).getIdPartAsLong(); @@ -139,9 +139,9 @@ public class ReindexStepTest extends BaseJpaR4Test { // Setup - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); - boolean markResourcesForReindexingUponSearchParameterChange = myDaoConfig.isMarkResourcesForReindexingUponSearchParameterChange(); - myDaoConfig.setMarkResourcesForReindexingUponSearchParameterChange(false); // if this were true, it would set up a lot of reindex jobs extraneous to the one we're trying to test + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); + boolean markResourcesForReindexingUponSearchParameterChange = myStorageSettings.isMarkResourcesForReindexingUponSearchParameterChange(); + myStorageSettings.setMarkResourcesForReindexingUponSearchParameterChange(false); // if this were true, it would set up a lot of reindex jobs extraneous to the one we're trying to test IIdType orgId = createOrganization(withId("ORG")); Long id0 = createPatient(withActiveTrue(), withFamily("SIMPSON"), withOrganization(orgId)).getIdPartAsLong(); @@ -199,7 +199,7 @@ public class ReindexStepTest extends BaseJpaR4Test { assertEquals(1, myCaptureQueriesListener.getCommitCount()); assertEquals(0, myCaptureQueriesListener.getRollbackCount()); - myDaoConfig.setMarkResourcesForReindexingUponSearchParameterChange(markResourcesForReindexingUponSearchParameterChange); + myStorageSettings.setMarkResourcesForReindexingUponSearchParameterChange(markResourcesForReindexingUponSearchParameterChange); } @Test diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/search/r4/PagingMultinodeProviderR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/search/r4/PagingMultinodeProviderR4Test.java index 3e18d273e37..518fbb7bd1f 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/search/r4/PagingMultinodeProviderR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/search/r4/PagingMultinodeProviderR4Test.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.search.r4; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl; import ca.uhn.fhir.jpa.util.QueryParameterUtils; @@ -25,8 +25,8 @@ public class PagingMultinodeProviderR4Test extends BaseResourceProviderR4Test { public void after() throws Exception { super.after(); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(null); mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(QueryParameterUtils.DEFAULT_SYNC_SIZE); @@ -39,7 +39,7 @@ public class PagingMultinodeProviderR4Test extends BaseResourceProviderR4Test { super.before(); myFhirContext.setParserErrorHandler(new StrictErrorHandler()); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); mySearchCoordinatorSvcRaw = AopTestUtils.getTargetObject(mySearchCoordinatorSvc); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImplTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImplTest.java index 402dab49c00..63587c86375 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImplTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImplTest.java @@ -10,7 +10,6 @@ import ca.uhn.fhir.jpa.dao.data.IResourceReindexJobDao; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; import ca.uhn.fhir.jpa.entity.ResourceReindexJobEntity; import ca.uhn.fhir.jpa.model.entity.ResourceTable; -import ca.uhn.fhir.jpa.model.sched.ISchedulerService; import ca.uhn.fhir.jpa.test.BaseJpaTest; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import org.apache.commons.lang3.time.DateUtils; @@ -99,12 +98,14 @@ public class ResourceReindexingSvcImplTest extends BaseJpaTest { return myTxManager; } + @Override @BeforeEach - public void before() { - myDaoConfig.setReindexThreadCount(2); + public void before() throws Exception { + super.before(); + myStorageSettings.setReindexThreadCount(2); mySvc.setContextForUnitTest(ourFhirContext); - mySvc.setDaoConfigForUnitTest(myDaoConfig); + mySvc.setStorageSettingsForUnitTest(myStorageSettings); mySvc.setResourceReindexerForUnitTest(myResourceReindexer); mySvc.start(); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/stresstest/GiantTransactionPerfTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/stresstest/GiantTransactionPerfTest.java index 7f958f3a8d2..68499535fbf 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/stresstest/GiantTransactionPerfTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/stresstest/GiantTransactionPerfTest.java @@ -5,7 +5,7 @@ import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.executor.InterceptorService; import ca.uhn.fhir.interceptor.model.ReadPartitionIdRequestDetails; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; @@ -120,7 +120,7 @@ public class GiantTransactionPerfTest { private TransactionProcessor myTransactionProcessor; private PlatformTransactionManager myTransactionManager; private MockEntityManager myEntityManager; - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; private HapiTransactionService myHapiTransactionService; private DaoRegistry myDaoRegistry; private JpaResourceDao myEobDao; @@ -151,16 +151,16 @@ public class GiantTransactionPerfTest { @AfterEach public void afterEach() { - myDaoConfig.setEnforceReferenceTargetTypes(new DaoConfig().isEnforceReferenceTargetTypes()); - myDaoConfig.setAllowInlineMatchUrlReferences(new DaoConfig().isAllowInlineMatchUrlReferences()); + myStorageSettings.setEnforceReferenceTargetTypes(new JpaStorageSettings().isEnforceReferenceTargetTypes()); + myStorageSettings.setAllowInlineMatchUrlReferences(new JpaStorageSettings().isAllowInlineMatchUrlReferences()); } @BeforeEach public void beforeEach() { - myDaoConfig = new DaoConfig(); + myStorageSettings = new JpaStorageSettings(); mySearchParamPresenceSvc = new SearchParamPresenceSvcImpl(); - mySearchParamPresenceSvc.setDaoConfig(myDaoConfig); + mySearchParamPresenceSvc.setStorageSettings(myStorageSettings); myTransactionManager = new MockTransactionManager(); @@ -184,8 +184,7 @@ public class GiantTransactionPerfTest { myTransactionProcessor.setTxManager(myTransactionManager); myTransactionProcessor.setEntityManagerForUnitTest(myEntityManager); myTransactionProcessor.setVersionAdapter(new TransactionProcessorVersionAdapterR4()); - myTransactionProcessor.setDaoConfig(myDaoConfig); - myTransactionProcessor.setModelConfig(myDaoConfig.getModelConfig()); + myTransactionProcessor.setStorageSettings(myStorageSettings); myTransactionProcessor.setHapiTransactionService(myHapiTransactionService); myTransactionProcessor.setDaoRegistry(myDaoRegistry); myTransactionProcessor.setPartitionSettingsForUnitTest(this.myPartitionSettings); @@ -195,7 +194,7 @@ public class GiantTransactionPerfTest { mySystemDao = new FhirSystemDaoR4(); mySystemDao.setTransactionProcessorForUnitTest(myTransactionProcessor); - mySystemDao.setDaoConfigForUnitTest(myDaoConfig); + mySystemDao.setStorageSettingsForUnitTest(myStorageSettings); when(myAppCtx.getBean(eq(IInstanceValidatorModule.class))).thenReturn(myInstanceValidatorSvc); when(myAppCtx.getBean(eq(IFhirSystemDao.class))).thenReturn(mySystemDao); @@ -224,26 +223,26 @@ public class GiantTransactionPerfTest { mySearchParamRegistry.setResourceChangeListenerRegistry(myResourceChangeListenerRegistry); mySearchParamRegistry.setSearchParameterCanonicalizerForUnitTest(new SearchParameterCanonicalizer(ourFhirContext)); mySearchParamRegistry.setFhirContext(ourFhirContext); - mySearchParamRegistry.setModelConfig(myDaoConfig.getModelConfig()); + mySearchParamRegistry.setStorageSettings(myStorageSettings); mySearchParamRegistry.registerListener(); mySearchParamExtractor = new SearchParamExtractorR4(); mySearchParamExtractor.setContext(ourFhirContext); mySearchParamExtractor.setSearchParamRegistry(mySearchParamRegistry); mySearchParamExtractor.setPartitionSettings(this.myPartitionSettings); - mySearchParamExtractor.setModelConfig(myDaoConfig.getModelConfig()); + mySearchParamExtractor.setStorageSettings(myStorageSettings); mySearchParamExtractor.start(); mySearchParamExtractorSvc = new SearchParamExtractorService(); mySearchParamExtractorSvc.setContext(ourFhirContext); mySearchParamExtractorSvc.setSearchParamExtractor(mySearchParamExtractor); - mySearchParamExtractorSvc.setModelConfig(myDaoConfig.getModelConfig()); + mySearchParamExtractorSvc.setStorageSettings(myStorageSettings); myDaoSearchParamSynchronizer = new DaoSearchParamSynchronizer(); myDaoSearchParamSynchronizer.setEntityManager(myEntityManager); mySearchParamWithInlineReferencesExtractor = new SearchParamWithInlineReferencesExtractor(); - mySearchParamWithInlineReferencesExtractor.setDaoConfig(myDaoConfig); + mySearchParamWithInlineReferencesExtractor.setStorageSettings(myStorageSettings); mySearchParamWithInlineReferencesExtractor.setContext(ourFhirContext); mySearchParamWithInlineReferencesExtractor.setPartitionSettings(this.myPartitionSettings); mySearchParamWithInlineReferencesExtractor.setSearchParamExtractorService(mySearchParamExtractorSvc); @@ -252,7 +251,7 @@ public class GiantTransactionPerfTest { myEobDao = new JpaResourceDao<>(); myEobDao.setContext(ourFhirContext); - myEobDao.setDaoConfigForUnitTest(myDaoConfig); + myEobDao.setStorageSettingsForUnitTest(myStorageSettings); myEobDao.setResourceType(ExplanationOfBenefit.class); myEobDao.setApplicationContext(myAppCtx); myEobDao.setTransactionService(myHapiTransactionService); @@ -263,7 +262,6 @@ public class GiantTransactionPerfTest { myEobDao.setSearchParamRegistry(mySearchParamRegistry); myEobDao.setSearchParamPresenceSvc(mySearchParamPresenceSvc); myEobDao.setDaoSearchParamSynchronizer(myDaoSearchParamSynchronizer); - myEobDao.setDaoConfigForUnitTest(myDaoConfig); myEobDao.setIdHelperSvcForUnitTest(myIdHelperService); myEobDao.setPartitionSettingsForUnitTest(myPartitionSettings); myEobDao.setJpaStorageResourceParserForUnitTest(myJpaStorageResourceParser); @@ -294,8 +292,8 @@ public class GiantTransactionPerfTest { @Test @Disabled public void testTransactionStressTest() { - myDaoConfig.setEnforceReferenceTargetTypes(false); - myDaoConfig.setAllowInlineMatchUrlReferences(false); + myStorageSettings.setEnforceReferenceTargetTypes(false); + myStorageSettings.setAllowInlineMatchUrlReferences(false); Bundle input = ClasspathUtil.loadResource(ourFhirContext, Bundle.class, "/r4/large-transaction.json"); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/stresstest/StressTestR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/stresstest/StressTestR4Test.java index b8d1272a46c..cc6b2c38010 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/stresstest/StressTestR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/stresstest/StressTestR4Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.stresstest; import ca.uhn.fhir.batch2.model.StatusEnum; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; @@ -97,13 +97,13 @@ public class StressTestR4Test extends BaseResourceProviderR4Test { super.after(); myServer.unregisterInterceptor(myRequestValidatingInterceptor); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); myPagingProvider.setMaximumPageSize(myPreviousMaxPageSize); SearchCoordinatorSvcImpl searchCoordinator = AopTestUtils.getTargetObject(mySearchCoordinatorSvc); searchCoordinator.setLoadingThrottleForUnitTests(null); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); } @@ -126,7 +126,7 @@ public class StressTestR4Test extends BaseResourceProviderR4Test { public void testNoDuplicatesInSearchResults() throws Exception { int resourceCount = 1000; int queryCount = 30; - myDaoConfig.setSearchPreFetchThresholds(Lists.newArrayList(50, 200, -1)); + myStorageSettings.setSearchPreFetchThresholds(Lists.newArrayList(50, 200, -1)); SearchCoordinatorSvcImpl searchCoordinator = AopTestUtils.getTargetObject(mySearchCoordinatorSvc); searchCoordinator.setLoadingThrottleForUnitTests(10); @@ -201,7 +201,7 @@ public class StressTestR4Test extends BaseResourceProviderR4Test { @Disabled @Test public void testPageThroughLotsOfPages() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); /* * This test creates a really huge number of resources to make sure that even large scale @@ -273,7 +273,7 @@ public class StressTestR4Test extends BaseResourceProviderR4Test { @Disabled @Test public void testPageThroughLotsOfPages2() { - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.DISABLED); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.DISABLED); Bundle bundle = new Bundle(); @@ -576,9 +576,9 @@ public class StressTestR4Test extends BaseResourceProviderR4Test { public void test_DeleteExpunge_withLargeBatchSizeManyResources() { // setup int batchSize = 1000; - myDaoConfig.setAllowMultipleDelete(true); - myDaoConfig.setExpungeEnabled(true); - myDaoConfig.setDeleteExpungeEnabled(true); + myStorageSettings.setAllowMultipleDelete(true); + myStorageSettings.setExpungeEnabled(true); + myStorageSettings.setDeleteExpungeEnabled(true); // create patients for (int i = 0; i < batchSize; i++) { @@ -616,9 +616,9 @@ public class StressTestR4Test extends BaseResourceProviderR4Test { @Disabled @Test public void testDeleteExpungeOperationOverLargeDataset() { - myDaoConfig.setAllowMultipleDelete(true); - myDaoConfig.setExpungeEnabled(true); - myDaoConfig.setDeleteExpungeEnabled(true); + myStorageSettings.setAllowMultipleDelete(true); + myStorageSettings.setExpungeEnabled(true); + myStorageSettings.setDeleteExpungeEnabled(true); // setup Patient patient = new Patient(); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionsR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionsR4Test.java index 2113f12e674..e26a390d9e1 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionsR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionsR4Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.subscription; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.jpa.subscription.channel.impl.LinkedBlockingChannel; import ca.uhn.fhir.jpa.subscription.submit.interceptor.SubscriptionMatcherInterceptor; @@ -74,12 +74,12 @@ public abstract class BaseSubscriptionsR4Test extends BaseResourceProviderR4Test } mySubscriptionIds.clear(); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); ourLog.info("Deleting all subscriptions"); myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); myClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute(); ourLog.info("Done deleting all subscriptions"); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); mySubscriptionTestUtil.unregisterSubscriptionInterceptor(); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/SubscriptionValidatingInterceptorTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/SubscriptionValidatingInterceptorTest.java index dd132f88c7f..fbe6dd12631 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/SubscriptionValidatingInterceptorTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/SubscriptionValidatingInterceptorTest.java @@ -3,16 +3,16 @@ package ca.uhn.fhir.jpa.subscription; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc; import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionMatchingStrategy; -import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionStrategyEvaluator; import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer; import ca.uhn.fhir.jpa.subscription.submit.interceptor.SubscriptionValidatingInterceptor; import ca.uhn.fhir.rest.api.RestOperationTypeEnum; import ca.uhn.fhir.rest.api.server.RequestDetails; +import ca.uhn.fhir.rest.api.server.SystemRequestDetails; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; import ca.uhn.fhir.util.HapiExtensions; @@ -47,16 +47,16 @@ import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) public class SubscriptionValidatingInterceptorTest { + private final FhirContext myCtx = FhirContext.forR4Cached(); @Mock public DaoRegistry myDaoRegistry; private SubscriptionValidatingInterceptor mySvc; - private final FhirContext myCtx = FhirContext.forR4Cached(); @Mock private SubscriptionStrategyEvaluator mySubscriptionStrategyEvaluator; @Mock private IRequestPartitionHelperSvc myRequestPartitionHelperSvc; @Mock - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; private SubscriptionCanonicalizer mySubscriptionCanonicalizer; @BeforeEach @@ -67,7 +67,7 @@ public class SubscriptionValidatingInterceptorTest { mySvc.setDaoRegistryForUnitTest(myDaoRegistry); mySvc.setSubscriptionStrategyEvaluatorForUnitTest(mySubscriptionStrategyEvaluator); mySvc.setFhirContext(myCtx); - mySvc.setDaoConfigForUnitTest(myDaoConfig); + mySvc.setStorageSettingsForUnitTest(myStorageSettings); mySvc.setRequestPartitionHelperSvcForUnitTest(myRequestPartitionHelperSvc); } @@ -204,7 +204,7 @@ public class SubscriptionValidatingInterceptorTest { @Test public void testValidate_Cross_Partition_Subscription() { when(myDaoRegistry.isResourceTypeSupported(eq("Patient"))).thenReturn(true); - when(myDaoConfig.isCrossPartitionSubscriptionEnabled()).thenReturn(true); + when(myStorageSettings.isCrossPartitionSubscriptionEnabled()).thenReturn(true); when(myRequestPartitionHelperSvc.determineCreatePartitionForRequest(isA(RequestDetails.class), isA(Subscription.class), eq("Subscription"))).thenReturn(RequestPartitionId.defaultPartition()); Subscription subscription = new Subscription(); @@ -221,14 +221,14 @@ public class SubscriptionValidatingInterceptorTest { // No asserts here because the function should throw an UnprocessableEntityException exception if the subscription // is invalid assertDoesNotThrow(() -> mySvc.resourcePreCreate(subscription, requestDetails, null)); - Mockito.verify(myDaoConfig, times(1)).isCrossPartitionSubscriptionEnabled(); + Mockito.verify(myStorageSettings, times(1)).isCrossPartitionSubscriptionEnabled(); Mockito.verify(myDaoRegistry, times(1)).isResourceTypeSupported(eq("Patient")); Mockito.verify(myRequestPartitionHelperSvc, times(1)).determineCreatePartitionForRequest(isA(RequestDetails.class), isA(Subscription.class), eq("Subscription")); } @Test public void testValidate_Cross_Partition_Subscription_On_Wrong_Partition() { - when(myDaoConfig.isCrossPartitionSubscriptionEnabled()).thenReturn(true); + when(myStorageSettings.isCrossPartitionSubscriptionEnabled()).thenReturn(true); when(myRequestPartitionHelperSvc.determineCreatePartitionForRequest(isA(RequestDetails.class), isA(Subscription.class), eq("Subscription"))).thenReturn(RequestPartitionId.fromPartitionId(1)); Subscription subscription = new Subscription(); @@ -252,7 +252,7 @@ public class SubscriptionValidatingInterceptorTest { @Test public void testValidate_Cross_Partition_Subscription_Without_Setting() { - when(myDaoConfig.isCrossPartitionSubscriptionEnabled()).thenReturn(false); + when(myStorageSettings.isCrossPartitionSubscriptionEnabled()).thenReturn(false); Subscription subscription = new Subscription(); subscription.setStatus(Subscription.SubscriptionStatus.ACTIVE); @@ -291,7 +291,7 @@ public class SubscriptionValidatingInterceptorTest { // No asserts here because the function should throw an UnprocessableEntityException exception if the subscription // is invalid mySvc.resourcePreCreate(subscription, requestDetails, null); - Mockito.verify(myDaoConfig, never()).isCrossPartitionSubscriptionEnabled(); + Mockito.verify(myStorageSettings, never()).isCrossPartitionSubscriptionEnabled(); Mockito.verify(myDaoRegistry, times(1)).isResourceTypeSupported(eq("Patient")); Mockito.verify(myRequestPartitionHelperSvc, never()).determineCreatePartitionForRequest(isA(RequestDetails.class), isA(Patient.class), eq("Patient")); } @@ -299,7 +299,7 @@ public class SubscriptionValidatingInterceptorTest { @Test public void testSubscriptionUpdate() { when(myDaoRegistry.isResourceTypeSupported(eq("Patient"))).thenReturn(true); - when(myDaoConfig.isCrossPartitionSubscriptionEnabled()).thenReturn(true); + when(myStorageSettings.isCrossPartitionSubscriptionEnabled()).thenReturn(true); lenient() .when(myRequestPartitionHelperSvc.determineReadPartitionForRequestForRead(isA(RequestDetails.class), isA(String.class), isA(IIdType.class))) .thenReturn(RequestPartitionId.allPartitions()); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/module/matcher/InMemorySubscriptionMatcherR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/module/matcher/InMemorySubscriptionMatcherR4Test.java index 6d5d34154c1..25e0401f23f 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/module/matcher/InMemorySubscriptionMatcherR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/module/matcher/InMemorySubscriptionMatcherR4Test.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.subscription.module.matcher; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString; import ca.uhn.fhir.jpa.model.util.UcumServiceUtil; @@ -99,11 +99,11 @@ public class InMemorySubscriptionMatcherR4Test { MatchUrlService myMatchUrlService; @Autowired - ModelConfig myModelConfig; + StorageSettings myStorageSettings; @AfterEach public void after() throws Exception { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); } private void assertMatched(Resource resource, SearchParameterMap params) { @@ -250,7 +250,7 @@ public class InMemorySubscriptionMatcherR4Test { @Test public void testSearchWithNormalizedQuantitySearchSupported() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Observation o1 = new Observation(); o1.addComponent() @@ -282,7 +282,7 @@ public class InMemorySubscriptionMatcherR4Test { @Test public void testSearchWithNormalizedQuantitySearchSupported_InvalidUCUMUnit() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Observation o1 = new Observation(); o1.addComponent() @@ -298,7 +298,7 @@ public class InMemorySubscriptionMatcherR4Test { @Test public void testSearchWithNormalizedQuantitySearchSupported_NoSystem() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Observation o1 = new Observation(); o1.addComponent() @@ -315,7 +315,7 @@ public class InMemorySubscriptionMatcherR4Test { @Test public void testSearchWithNormalizedQuantitySearchSupported_NotUcumSystem() { - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); + myStorageSettings.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); Observation o1 = new Observation(); o1.addComponent() diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookActivatesPreExistingSubscriptionsR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookActivatesPreExistingSubscriptionsR4Test.java index 95b0488795c..30e0e1ef63b 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookActivatesPreExistingSubscriptionsR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookActivatesPreExistingSubscriptionsR4Test.java @@ -57,12 +57,12 @@ public class RestHookActivatesPreExistingSubscriptionsR4Test extends BaseResourc @AfterEach public void afterUnregisterRestHookListener() { mySubscriptionTestUtil.unregisterSubscriptionInterceptor(); - myDaoConfig.clearSupportedSubscriptionTypesForUnitTest(); + myStorageSettings.clearSupportedSubscriptionTypesForUnitTest(); } @BeforeEach public void beforeSetSubscriptionActivatingInterceptor() { - myDaoConfig.addSupportedSubscriptionType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK); + myStorageSettings.addSupportedSubscriptionType(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.RESTHOOK); mySubscriptionMatcherInterceptor.startIfNeeded(); mySubscriptionLoader.doSyncSubscriptionsForUnitTest(); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR4Test.java index 408de41e6b6..c377d2c1224 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR4Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.subscription.resthook; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.subscription.BaseSubscriptionsR4Test; import ca.uhn.fhir.jpa.test.util.StoppableSubscriptionDeliveringRestHookSubscriber; import ca.uhn.fhir.model.primitive.IdDt; @@ -65,7 +65,7 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test { ourLog.info("@AfterEach"); myStoppableSubscriptionDeliveringRestHookSubscriber.setCountDownLatch(null); myStoppableSubscriptionDeliveringRestHookSubscriber.unPause(); - myDaoConfig.setTriggerSubscriptionsForNonVersioningChanges(new DaoConfig().isTriggerSubscriptionsForNonVersioningChanges()); + myStorageSettings.setTriggerSubscriptionsForNonVersioningChanges(new JpaStorageSettings().isTriggerSubscriptionsForNonVersioningChanges()); } @@ -76,7 +76,7 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test { */ @Test public void testReuseSubscriptionIdWithDifferentDatabaseMode() throws Exception { - myDaoConfig.setTagStorageMode(DaoConfig.TagStorageModeEnum.NON_VERSIONED); + myStorageSettings.setTagStorageMode(JpaStorageSettings.TagStorageModeEnum.NON_VERSIONED); String payload = "application/fhir+json"; IdType id = createSubscription("Observation?_has:DiagnosticReport:result:identifier=foo|IDENTIFIER", payload, null, "sub").getIdElement().toUnqualifiedVersionless(); @@ -379,7 +379,7 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test { @Test public void testRestHookSubscriptionMetaAddDoesTriggerNewDeliveryIfConfiguredToDoSo() throws Exception { - myDaoConfig.setTriggerSubscriptionsForNonVersioningChanges(true); + myStorageSettings.setTriggerSubscriptionsForNonVersioningChanges(true); String payload = "application/fhir+json"; @@ -708,7 +708,7 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test { @Test public void testRestHookSubscriptionApplicationJsonDatabase() throws Exception { // Same test as above, but now run it using database matching - myDaoConfig.setEnableInMemorySubscriptionMatching(false); + myStorageSettings.setEnableInMemorySubscriptionMatching(false); String payload = "application/json"; String code = "1000000050"; @@ -1149,8 +1149,8 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test { */ @Test public void testSubscriptionDoesntActivateIfRestHookIsNotEnabled() throws InterruptedException { - Set existingSupportedSubscriptionTypes = myDaoConfig.getSupportedSubscriptionTypes(); - myDaoConfig.clearSupportedSubscriptionTypesForUnitTest(); + Set existingSupportedSubscriptionTypes = myStorageSettings.getSupportedSubscriptionTypes(); + myStorageSettings.clearSupportedSubscriptionTypesForUnitTest(); try { Subscription subscription = newSubscription("Observation?", "application/fhir+json"); @@ -1161,7 +1161,7 @@ public class RestHookTestR4Test extends BaseSubscriptionsR4Test { assertEquals(Subscription.SubscriptionStatus.REQUESTED, subscription.getStatus()); } finally { - existingSupportedSubscriptionTypes.forEach(t -> myDaoConfig.addSupportedSubscriptionType(t)); + existingSupportedSubscriptionTypes.forEach(t -> myStorageSettings.addSupportedSubscriptionType(t)); } } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToStorageSettingsR4Test.java similarity index 96% rename from hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.java rename to hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToStorageSettingsR4Test.java index a18574fc3b1..1cd12d66bce 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToStorageSettingsR4Test.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.subscription.resthook; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.jpa.test.util.SubscriptionTestUtil; import ca.uhn.fhir.model.primitive.IdDt; @@ -40,14 +40,14 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; /** * Test the rest-hook subscriptions */ -public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends BaseResourceProviderR4Test { +public class RestHookTestWithInterceptorRegisteredToStorageSettingsR4Test extends BaseResourceProviderR4Test { private static final List ourCreatedObservations = Collections.synchronizedList(Lists.newArrayList()); private static int ourListenerPort; private static RestfulServer ourListenerRestServer; private static Server ourListenerServer; private static String ourListenerServerBase; - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.class); + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RestHookTestWithInterceptorRegisteredToStorageSettingsR4Test.class); private static final List ourUpdatedObservations = Collections.synchronizedList(Lists.newArrayList()); @Autowired @@ -60,11 +60,11 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base @AfterEach public void afterUnregisterRestHookListener() { - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); ourLog.info("Deleting all subscriptions"); myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); ourLog.info("Done deleting all subscriptions"); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); mySubscriptionTestUtil.unregisterSubscriptionInterceptor(); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookWithEventDefinitionR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookWithEventDefinitionR4Test.java index 08c466c7649..08c5ed0c58f 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookWithEventDefinitionR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookWithEventDefinitionR4Test.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.subscription.resthook; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.provider.BaseResourceProviderR4Test; import ca.uhn.fhir.jpa.subscription.FhirR4Util; import ca.uhn.fhir.jpa.test.util.SubscriptionTestUtil; @@ -73,12 +73,12 @@ public class RestHookWithEventDefinitionR4Test extends BaseResourceProviderR4Tes } mySubscriptionIds.clear(); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); ourLog.info("Deleting all subscriptions"); myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); myClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute(); ourLog.info("Done deleting all subscriptions"); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); mySubscriptionTestUtil.unregisterSubscriptionInterceptor(); } diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithCriteriaR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithCriteriaR4Test.java index 259486819ff..e26354cd98f 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithCriteriaR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithCriteriaR4Test.java @@ -27,7 +27,7 @@ public class WebsocketWithCriteriaR4Test extends BaseResourceProviderR4Test { private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(WebsocketWithCriteriaR4Test.class); @RegisterExtension - private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myModelConfig); + private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myStorageSettings); private String myPatientId; private String mySubscriptionId; diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithSubscriptionIdR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithSubscriptionIdR4Test.java index 13b7444a2a6..8b33fe892e0 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithSubscriptionIdR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/subscription/websocket/WebsocketWithSubscriptionIdR4Test.java @@ -43,7 +43,7 @@ public class WebsocketWithSubscriptionIdR4Test extends BaseResourceProviderR4Tes private static final Logger ourLog = org.slf4j.LoggerFactory.getLogger(WebsocketWithSubscriptionIdR4Test.class); @RegisterExtension - private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myModelConfig); + private final WebsocketSubscriptionClient myWebsocketClientExtension = new WebsocketSubscriptionClient(() -> myServer, () -> myStorageSettings); private String myPatientId; private String mySubscriptionId; @Autowired diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/BaseTermR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/BaseTermR4Test.java index 320705bc122..8fceada16bb 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/BaseTermR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/BaseTermR4Test.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.term; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; import ca.uhn.fhir.jpa.entity.TermConcept; import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink; @@ -29,14 +29,14 @@ public abstract class BaseTermR4Test extends BaseJpaR4Test { @BeforeEach public void before() { - myDaoConfig.setAllowExternalReferences(true); + myStorageSettings.setAllowExternalReferences(true); } @AfterEach public void after() { - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setPreExpandValueSets(new DaoConfig().isPreExpandValueSets()); - myDaoConfig.setMaximumExpansionSize(DaoConfig.DEFAULT_MAX_EXPANSION_SIZE); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + myStorageSettings.setPreExpandValueSets(new JpaStorageSettings().isPreExpandValueSets()); + myStorageSettings.setMaximumExpansionSize(JpaStorageSettings.DEFAULT_MAX_EXPANSION_SIZE); } IIdType createCodeSystem() { diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcDeltaR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcDeltaR4Test.java index 39e2e988478..e331f30585a 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcDeltaR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcDeltaR4Test.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.term; import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.context.support.ValidationSupportContext; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.entity.TermConcept; import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; @@ -45,7 +45,7 @@ public class TerminologySvcDeltaR4Test extends BaseJpaR4Test { @AfterEach public void after() { - myDaoConfig.setDeferIndexingForCodesystemsOfSize(new DaoConfig().getDeferIndexingForCodesystemsOfSize()); + myStorageSettings.setDeferIndexingForCodesystemsOfSize(new JpaStorageSettings().getDeferIndexingForCodesystemsOfSize()); TermDeferredStorageSvcImpl termDeferredStorageSvc = AopTestUtils.getTargetObject(myTermDeferredStorageSvc); termDeferredStorageSvc.clearDeferred(); } @@ -377,7 +377,7 @@ public class TerminologySvcDeltaR4Test extends BaseJpaR4Test { @Test public void testAddLargeHierarchy() { - myDaoConfig.setDeferIndexingForCodesystemsOfSize(5); + myStorageSettings.setDeferIndexingForCodesystemsOfSize(5); createNotPresentCodeSystem(); ValueSet vs; diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplR4Test.java index 45628664675..e4f8c3a23b4 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplR4Test.java @@ -4,7 +4,7 @@ import ca.uhn.fhir.context.support.ConceptValidationOptions; import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.context.support.ValidationSupportContext; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.entity.TermCodeSystem; import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; import ca.uhn.fhir.jpa.entity.TermConcept; @@ -58,7 +58,7 @@ public class TerminologySvcImplR4Test extends BaseTermR4Test { @AfterEach public void after() { super.after(); - myDaoConfig.setDeferIndexingForCodesystemsOfSize(new DaoConfig().getDeferIndexingForCodesystemsOfSize()); + myStorageSettings.setDeferIndexingForCodesystemsOfSize(new JpaStorageSettings().getDeferIndexingForCodesystemsOfSize()); TermCodeSystemDeleteJobSvcWithUniTestFailures.setFailNextDeleteCodeSystemVersion(false); } @@ -135,7 +135,7 @@ public class TerminologySvcImplR4Test extends BaseTermR4Test { @Test public void testDeleteValueSet() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.POST); @@ -176,7 +176,7 @@ public class TerminologySvcImplR4Test extends BaseTermR4Test { @Test public void testDeleteValueSetWithClientAssignedId() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.PUT); @@ -229,7 +229,7 @@ public class TerminologySvcImplR4Test extends BaseTermR4Test { @Test public void testDuplicateValueSetUrls() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); // DM 2019-03-05 - We pre-load our custom CodeSystem otherwise pre-expansion of the ValueSet will fail. loadAndPersistCodeSystemAndValueSet(); @@ -257,7 +257,7 @@ public class TerminologySvcImplR4Test extends BaseTermR4Test { @Test public void testValidateCodeIsInPreExpandedValueSet() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.POST); @@ -305,7 +305,7 @@ public class TerminologySvcImplR4Test extends BaseTermR4Test { @Test public void testValidateCodeIsInPreExpandedValueSetWithClientAssignedId() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.PUT); @@ -465,7 +465,7 @@ public class TerminologySvcImplR4Test extends BaseTermR4Test { */ @Test public void testUpdateLargeCodeSystemInRapidSuccession() { - myDaoConfig.setDeferIndexingForCodesystemsOfSize(100); + myStorageSettings.setDeferIndexingForCodesystemsOfSize(100); TermCodeSystemDeleteJobSvcWithUniTestFailures.setFailNextDeleteCodeSystemVersion(true); CodeSystem codeSystem; diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/ValueSetExpansionR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/ValueSetExpansionR4Test.java index 61d71e0eefb..957890811d2 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/ValueSetExpansionR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/ValueSetExpansionR4Test.java @@ -33,6 +33,7 @@ import org.hl7.fhir.r4.model.ValueSet; import org.hl7.fhir.r4.model.codesystems.HttpVerb; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.slf4j.Logger; @@ -46,6 +47,7 @@ import javax.annotation.Nonnull; import java.io.IOException; import java.util.List; import java.util.Optional; +import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import static ca.uhn.fhir.util.HapiExtensions.EXT_VALUESET_EXPANSION_MESSAGE; @@ -81,7 +83,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testDeletePreExpandedValueSet() throws IOException { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.POST); @@ -171,7 +173,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandInline_IncludePreExpandedValueSetByUri_FilterOnDisplay_LeftMatch_SelectAll() { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); create100ConceptsCodeSystemAndValueSet(); ValueSet input = new ValueSet(); @@ -202,7 +204,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandHugeValueSet_FilterOnDisplay_LeftMatch_SelectAll() { SearchBuilder.setMaxPageSize50ForTest(true); - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); IIdType vsId = createConceptsCodeSystemAndValueSet(1005); // Inline ValueSet @@ -248,7 +250,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandIntestExpandInline_IncludePreExpandedValueSetByUri_FilterOnDisplay_LeftMatch_SelectRangeline_IncludePreExpandedValueSetByUri_FilterOnDisplay_LeftMatch_SelectRange() { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); create100ConceptsCodeSystemAndValueSet(); List expandedConceptCodes = getExpandedConceptsByValueSetUrl("http://foo/vs"); @@ -289,7 +291,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandInline_IncludePreExpandedValueSetByUri_FilterOnDisplay_LeftMatchCaseInsensitive() { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); create100ConceptsCodeSystemAndValueSet(); ValueSet input = new ValueSet(); @@ -316,7 +318,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandInline_IncludePreExpandedValueSetByUri_ExcludeCodes_FilterOnDisplay_LeftMatch_SelectAll() { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); create100ConceptsCodeSystemAndValueSet(); ValueSet input = new ValueSet(); @@ -355,7 +357,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandInline_IncludePreExpandedValueSetByUri_ExcludeCodes_FilterOnDisplay_LeftMatch_SelectRange() { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); create100ConceptsCodeSystemAndValueSet(); ValueSet input = new ValueSet(); @@ -422,7 +424,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandInline_IncludeNonPreExpandedValueSetByUri_FilterOnDisplay_LeftMatch() { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); create100ConceptsCodeSystemAndValueSet(); ValueSet input = new ValueSet(); @@ -479,7 +481,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @SuppressWarnings("SpellCheckingInspection") @Test public void testExpandTermValueSetAndChildren() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.POST); @@ -503,7 +505,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { assertThat(myCaptureQueriesListener.getDeleteQueriesForCurrentThread(), empty()); assertEquals(codeSystem.getConcept().size(), expandedValueSet.getExpansion().getTotal()); - assertEquals(myDaoConfig.getPreExpandValueSetsDefaultOffset(), expandedValueSet.getExpansion().getOffset()); + assertEquals(myStorageSettings.getPreExpandValueSetsDefaultOffset(), expandedValueSet.getExpansion().getOffset()); assertEquals(0, expandedValueSet.getExpansion().getParameter().size()); assertEquals(codeSystem.getConcept().size(), expandedValueSet.getExpansion().getContains().size()); @@ -522,7 +524,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandTermValueSetAndChildren2() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); CodeSystem codeSystem = loadResource(myFhirContext, CodeSystem.class, "/r4/CodeSystem-iar-chymh-cb-calculated-cap-10.xml"); myCodeSystemDao.create(codeSystem); @@ -545,7 +547,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { public void testExpandExistingValueSetNotPreExpanded() throws Exception { loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.POST); - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); CodeSystem codeSystem = myCodeSystemDao.read(myExtensionalCsId); ourLog.debug("CodeSystem:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(codeSystem)); @@ -557,7 +559,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { ourLog.debug("Expanded ValueSet:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(expandedValueSet)); assertEquals(codeSystem.getConcept().size(), expandedValueSet.getExpansion().getTotal()); - assertEquals(myDaoConfig.getPreExpandValueSetsDefaultOffset(), expandedValueSet.getExpansion().getOffset()); + assertEquals(myStorageSettings.getPreExpandValueSetsDefaultOffset(), expandedValueSet.getExpansion().getOffset()); assertEquals(0, expandedValueSet.getExpansion().getParameter().size()); assertEquals(codeSystem.getConcept().size(), expandedValueSet.getExpansion().getContains().size()); @@ -575,7 +577,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { ourLog.debug("Expanded ValueSet:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(reexpandedValueSet)); assertEquals(codeSystem.getConcept().size(), reexpandedValueSet.getExpansion().getTotal()); - assertEquals(myDaoConfig.getPreExpandValueSetsDefaultOffset(), reexpandedValueSet.getExpansion().getOffset()); + assertEquals(myStorageSettings.getPreExpandValueSetsDefaultOffset(), reexpandedValueSet.getExpansion().getOffset()); assertEquals(0, reexpandedValueSet.getExpansion().getParameter().size()); assertEquals(codeSystem.getConcept().size(), reexpandedValueSet.getExpansion().getContains().size()); @@ -599,7 +601,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandTermValueSetAndChildrenWithClientAssignedId() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.PUT); @@ -615,7 +617,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { ourLog.debug("Expanded ValueSet:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(expandedValueSet)); assertEquals(codeSystem.getConcept().size(), expandedValueSet.getExpansion().getTotal()); - assertEquals(myDaoConfig.getPreExpandValueSetsDefaultOffset(), expandedValueSet.getExpansion().getOffset()); + assertEquals(myStorageSettings.getPreExpandValueSetsDefaultOffset(), expandedValueSet.getExpansion().getOffset()); assertEquals(0, expandedValueSet.getExpansion().getParameter().size()); assertEquals(codeSystem.getConcept().size(), expandedValueSet.getExpansion().getContains().size()); @@ -638,7 +640,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandTermValueSetAndChildrenWithCountWithDisplayLanguage() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.POST); @@ -660,7 +662,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { ourLog.debug("Expanded ValueSet:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(expandedValueSet)); assertEquals(codeSystem.getConcept().size(), expandedValueSet.getExpansion().getTotal()); - assertEquals(myDaoConfig.getPreExpandValueSetsDefaultOffset(), expandedValueSet.getExpansion().getOffset()); + assertEquals(myStorageSettings.getPreExpandValueSetsDefaultOffset(), expandedValueSet.getExpansion().getOffset()); assertEquals(2, expandedValueSet.getExpansion().getParameter().size()); assertEquals("offset", expandedValueSet.getExpansion().getParameter().get(0).getName()); assertEquals(0, expandedValueSet.getExpansion().getParameter().get(0).getValueIntegerType().getValue().intValue()); @@ -678,7 +680,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandTermValueSetAndChildrenWithCount() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.POST); @@ -699,7 +701,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { ourLog.debug("Expanded ValueSet:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(expandedValueSet)); assertEquals(codeSystem.getConcept().size(), expandedValueSet.getExpansion().getTotal()); - assertEquals(myDaoConfig.getPreExpandValueSetsDefaultOffset(), expandedValueSet.getExpansion().getOffset()); + assertEquals(myStorageSettings.getPreExpandValueSetsDefaultOffset(), expandedValueSet.getExpansion().getOffset()); assertEquals(2, expandedValueSet.getExpansion().getParameter().size()); assertEquals("offset", expandedValueSet.getExpansion().getParameter().get(0).getName()); assertEquals(0, expandedValueSet.getExpansion().getParameter().get(0).getValueIntegerType().getValue().intValue()); @@ -713,7 +715,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandTermValueSetAndChildrenWithCountWithClientAssignedId() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.PUT); @@ -739,7 +741,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { assertThat(expandedValueSetString, containsString("ValueSet was expanded using an expansion that was pre-calculated")); assertEquals(codeSystem.getConcept().size(), expandedValueSet.getExpansion().getTotal()); - assertEquals(myDaoConfig.getPreExpandValueSetsDefaultOffset(), expandedValueSet.getExpansion().getOffset()); + assertEquals(myStorageSettings.getPreExpandValueSetsDefaultOffset(), expandedValueSet.getExpansion().getOffset()); assertEquals(2, expandedValueSet.getExpansion().getParameter().size()); assertEquals("offset", expandedValueSet.getExpansion().getParameter().get(0).getName()); assertEquals(0, expandedValueSet.getExpansion().getParameter().get(0).getValueIntegerType().getValue().intValue()); @@ -761,7 +763,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandTermValueSetAndChildrenWithCountOfZero() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.POST); @@ -781,7 +783,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { ourLog.info("Expanded ValueSet:\n" + expanded); assertEquals(codeSystem.getConcept().size(), expandedValueSet.getExpansion().getTotal()); - assertEquals(myDaoConfig.getPreExpandValueSetsDefaultOffset(), expandedValueSet.getExpansion().getOffset()); + assertEquals(myStorageSettings.getPreExpandValueSetsDefaultOffset(), expandedValueSet.getExpansion().getOffset()); assertEquals(2, expandedValueSet.getExpansion().getParameter().size(), expanded); assertEquals("offset", expandedValueSet.getExpansion().getParameter().get(0).getName(), expanded); assertEquals(0, expandedValueSet.getExpansion().getParameter().get(0).getValueIntegerType().getValue().intValue(), expanded); @@ -793,7 +795,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandTermValueSetAndChildrenWithCountOfZeroWithClientAssignedId() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.PUT); @@ -812,7 +814,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { ourLog.debug("Expanded ValueSet:\n" + myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(expandedValueSet)); assertEquals(codeSystem.getConcept().size(), expandedValueSet.getExpansion().getTotal()); - assertEquals(myDaoConfig.getPreExpandValueSetsDefaultOffset(), expandedValueSet.getExpansion().getOffset()); + assertEquals(myStorageSettings.getPreExpandValueSetsDefaultOffset(), expandedValueSet.getExpansion().getOffset()); assertEquals(2, expandedValueSet.getExpansion().getParameter().size()); assertEquals("offset", expandedValueSet.getExpansion().getParameter().get(0).getName()); assertEquals(0, expandedValueSet.getExpansion().getParameter().get(0).getValueIntegerType().getValue().intValue()); @@ -824,7 +826,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandTermValueSetAndChildrenWithOffset() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.POST); @@ -856,7 +858,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandTermValueSetAndChildrenWithOffsetWithClientAssignedId() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.PUT); @@ -888,7 +890,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandTermValueSetAndChildrenWithOffsetAndCount() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.POST); @@ -984,7 +986,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testExpandTermValueSetAndChildrenWithOffsetAndCountWithClientAssignedId() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.PUT); @@ -1303,7 +1305,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testStoreTermValueSetAndChildren() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.POST); @@ -1364,7 +1366,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testStoreTermValueSetAndChildrenWithClientAssignedId() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HttpVerb.PUT); @@ -1422,7 +1424,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testStoreTermValueSetAndChildrenWithExclude() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignationsAndExclude(HttpVerb.POST); @@ -1482,7 +1484,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { @Test public void testStoreTermValueSetAndChildrenWithExcludeWithClientAssignedId() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignationsAndExclude(HttpVerb.PUT); @@ -1996,6 +1998,7 @@ public class ValueSetExpansionR4Test extends BaseTermR4Test { // Perform pre-expansion await().until(() -> { + myBatch2JobHelper.runMaintenancePass(); myTerminologyDeferredStorageSvc.saveAllDeferred(); return myTerminologyDeferredStorageSvc.isStorageQueueEmpty(true); }, equalTo(true)); diff --git a/hapi-fhir-jpaserver-test-r4b/pom.xml b/hapi-fhir-jpaserver-test-r4b/pom.xml index 8c3d6add245..ac59ecbb484 100644 --- a/hapi-fhir-jpaserver-test-r4b/pom.xml +++ b/hapi-fhir-jpaserver-test-r4b/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-r4b/src/test/java/ca/uhn/fhir/jpa/dao/r4b/BaseJpaR4BTest.java b/hapi-fhir-jpaserver-test-r4b/src/test/java/ca/uhn/fhir/jpa/dao/r4b/BaseJpaR4BTest.java index b4df3ab85e0..ac2ea630c33 100644 --- a/hapi-fhir-jpaserver-test-r4b/src/test/java/ca/uhn/fhir/jpa/dao/r4b/BaseJpaR4BTest.java +++ b/hapi-fhir-jpaserver-test-r4b/src/test/java/ca/uhn/fhir/jpa/dao/r4b/BaseJpaR4BTest.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.dao.r4b; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.interceptor.api.IInterceptorService; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoCodeSystem; @@ -43,7 +43,6 @@ import ca.uhn.fhir.jpa.dao.data.ITermValueSetConceptDao; import ca.uhn.fhir.jpa.dao.data.ITermValueSetConceptDesignationDao; import ca.uhn.fhir.jpa.dao.data.ITermValueSetDao; import ca.uhn.fhir.jpa.interceptor.PerformanceTracingLoggingInterceptor; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.provider.JpaSystemProvider; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.IStaleSearchDeletingSvc; @@ -54,7 +53,6 @@ import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry; import ca.uhn.fhir.jpa.term.api.ITermCodeSystemStorageSvc; import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc; import ca.uhn.fhir.jpa.test.BaseJpaTest; -import ca.uhn.fhir.jpa.test.PreventDanglingInterceptorsExtension; import ca.uhn.fhir.jpa.test.config.TestR4BConfig; import ca.uhn.fhir.jpa.util.ResourceCountCache; import ca.uhn.fhir.parser.IParser; @@ -118,7 +116,6 @@ import org.hl7.fhir.r5.utils.validation.constants.BestPracticeWarningLevel; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.jupiter.api.extension.RegisterExtension; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.ApplicationContext; @@ -210,8 +207,6 @@ public abstract class BaseJpaR4BTest extends BaseJpaTest implements ITestDataBui @Qualifier("myConditionDaoR4B") protected IFhirResourceDao myConditionDao; @Autowired - protected ModelConfig myModelConfig; - @Autowired @Qualifier("myDeviceDaoR4B") protected IFhirResourceDao myDeviceDao; @Autowired @@ -404,12 +399,12 @@ public abstract class BaseJpaR4BTest extends BaseJpaTest implements ITestDataBui @AfterEach() public void afterCleanupDao() { - myDaoConfig.setExpireSearchResults(new DaoConfig().isExpireSearchResults()); - myDaoConfig.setEnforceReferentialIntegrityOnDelete(new DaoConfig().isEnforceReferentialIntegrityOnDelete()); - myDaoConfig.setExpireSearchResultsAfterMillis(new DaoConfig().getExpireSearchResultsAfterMillis()); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setSuppressUpdatesWithNoChange(new DaoConfig().isSuppressUpdatesWithNoChange()); - myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches()); + this.myStorageSettings.setExpireSearchResults(new JpaStorageSettings().isExpireSearchResults()); + this.myStorageSettings.setEnforceReferentialIntegrityOnDelete(new JpaStorageSettings().isEnforceReferentialIntegrityOnDelete()); + this.myStorageSettings.setExpireSearchResultsAfterMillis(new JpaStorageSettings().getExpireSearchResultsAfterMillis()); + this.myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); + this.myStorageSettings.setSuppressUpdatesWithNoChange(new JpaStorageSettings().isSuppressUpdatesWithNoChange()); + this.myStorageSettings.setAllowContainsSearches(new JpaStorageSettings().isAllowContainsSearches()); myPagingProvider.setDefaultPageSize(BasePagingProvider.DEFAULT_DEFAULT_PAGE_SIZE); myPagingProvider.setMaximumPageSize(BasePagingProvider.DEFAULT_MAX_PAGE_SIZE); @@ -442,14 +437,14 @@ public abstract class BaseJpaR4BTest extends BaseJpaTest implements ITestDataBui public void beforeFlushFT() { purgeHibernateSearch(myEntityManager); - myDaoConfig.setSchedulingDisabled(true); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + this.myStorageSettings.setSchedulingDisabled(true); + this.myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); } @BeforeEach @Transactional() public void beforePurgeDatabase() { - purgeDatabase(myDaoConfig, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataSchedulerHelper); + purgeDatabase(this.myStorageSettings, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataSchedulerHelper); } @BeforeEach diff --git a/hapi-fhir-jpaserver-test-r4b/src/test/java/ca/uhn/fhir/jpa/provider/r4b/BaseResourceProviderR4BTest.java b/hapi-fhir-jpaserver-test-r4b/src/test/java/ca/uhn/fhir/jpa/provider/r4b/BaseResourceProviderR4BTest.java index 5964c12e310..bc9f7784056 100644 --- a/hapi-fhir-jpaserver-test-r4b/src/test/java/ca/uhn/fhir/jpa/provider/r4b/BaseResourceProviderR4BTest.java +++ b/hapi-fhir-jpaserver-test-r4b/src/test/java/ca/uhn/fhir/jpa/provider/r4b/BaseResourceProviderR4BTest.java @@ -57,7 +57,7 @@ public abstract class BaseResourceProviderR4BTest extends BaseJpaR4BTest { s.registerProvider(myBinaryAccessProvider); s.getInterceptorService().registerInterceptor(myBinaryStorageInterceptor); - JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(s, mySystemDao, myDaoConfig, mySearchParamRegistry, myValidationSupport); + JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(s, mySystemDao, this.myStorageSettings, mySearchParamRegistry, myValidationSupport); confProvider.setImplementationDescription("THIS IS THE DESC"); s.setServerConformanceProvider(confProvider); diff --git a/hapi-fhir-jpaserver-test-r4b/src/test/java/ca/uhn/fhir/jpa/provider/r4b/ResourceProviderR4BTest.java b/hapi-fhir-jpaserver-test-r4b/src/test/java/ca/uhn/fhir/jpa/provider/r4b/ResourceProviderR4BTest.java index d43bdd3da46..1e4a6d92d3c 100644 --- a/hapi-fhir-jpaserver-test-r4b/src/test/java/ca/uhn/fhir/jpa/provider/r4b/ResourceProviderR4BTest.java +++ b/hapi-fhir-jpaserver-test-r4b/src/test/java/ca/uhn/fhir/jpa/provider/r4b/ResourceProviderR4BTest.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.provider.r4b; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.entity.Search; import ca.uhn.fhir.jpa.model.search.SearchStatusEnum; import ca.uhn.fhir.parser.StrictErrorHandler; @@ -55,12 +55,12 @@ public class ResourceProviderR4BTest extends BaseResourceProviderR4BTest { public void after() throws Exception { super.after(); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setCountSearchResultsUpTo(new DaoConfig().getCountSearchResultsUpTo()); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); - myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches()); + this.myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); + this.myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + this.myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); + this.myStorageSettings.setCountSearchResultsUpTo(new JpaStorageSettings().getCountSearchResultsUpTo()); + this.myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); + this.myStorageSettings.setAllowContainsSearches(new JpaStorageSettings().isAllowContainsSearches()); myServer.getInterceptorService().unregisterInterceptorsIf(t -> t instanceof OpenApiInterceptor); } @@ -71,13 +71,13 @@ public class ResourceProviderR4BTest extends BaseResourceProviderR4BTest { super.before(); myFhirCtx.setParserErrorHandler(new StrictErrorHandler()); - myDaoConfig.setAllowMultipleDelete(true); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); + this.myStorageSettings.setAllowMultipleDelete(true); + this.myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); } @Test public void testSearchWithContainsLowerCase() { - myDaoConfig.setAllowContainsSearches(true); + this.myStorageSettings.setAllowContainsSearches(true); Patient pt1 = new Patient(); pt1.addName().setFamily("Elizabeth"); diff --git a/hapi-fhir-jpaserver-test-r5/pom.xml b/hapi-fhir-jpaserver-test-r5/pom.xml index 4c6573c7514..ed50c6255da 100644 --- a/hapi-fhir-jpaserver-test-r5/pom.xml +++ b/hapi-fhir-jpaserver-test-r5/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/BaseJpaR5Test.java b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/BaseJpaR5Test.java index 7dd5284b0c7..ec718d86496 100644 --- a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/BaseJpaR5Test.java +++ b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/BaseJpaR5Test.java @@ -3,7 +3,7 @@ package ca.uhn.fhir.jpa.dao.r5; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.interceptor.api.IInterceptorService; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoCodeSystem; @@ -45,7 +45,6 @@ import ca.uhn.fhir.jpa.dao.data.ITermValueSetDao; import ca.uhn.fhir.jpa.entity.TermValueSet; import ca.uhn.fhir.jpa.entity.TermValueSetConcept; import ca.uhn.fhir.jpa.interceptor.PerformanceTracingLoggingInterceptor; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.provider.JpaSystemProvider; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.IStaleSearchDeletingSvc; @@ -214,8 +213,6 @@ public abstract class BaseJpaR5Test extends BaseJpaTest implements ITestDataBuil @Qualifier("myConditionDaoR5") protected IFhirResourceDao myConditionDao; @Autowired - protected ModelConfig myModelConfig; - @Autowired @Qualifier("myDeviceDaoR5") protected IFhirResourceDao myDeviceDao; @Autowired @@ -412,12 +409,12 @@ public abstract class BaseJpaR5Test extends BaseJpaTest implements ITestDataBuil @AfterEach() public void afterCleanupDao() { - myDaoConfig.setExpireSearchResults(new DaoConfig().isExpireSearchResults()); - myDaoConfig.setEnforceReferentialIntegrityOnDelete(new DaoConfig().isEnforceReferentialIntegrityOnDelete()); - myDaoConfig.setExpireSearchResultsAfterMillis(new DaoConfig().getExpireSearchResultsAfterMillis()); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setSuppressUpdatesWithNoChange(new DaoConfig().isSuppressUpdatesWithNoChange()); - myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches()); + myStorageSettings.setExpireSearchResults(new JpaStorageSettings().isExpireSearchResults()); + myStorageSettings.setEnforceReferentialIntegrityOnDelete(new JpaStorageSettings().isEnforceReferentialIntegrityOnDelete()); + myStorageSettings.setExpireSearchResultsAfterMillis(new JpaStorageSettings().getExpireSearchResultsAfterMillis()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setSuppressUpdatesWithNoChange(new JpaStorageSettings().isSuppressUpdatesWithNoChange()); + myStorageSettings.setAllowContainsSearches(new JpaStorageSettings().isAllowContainsSearches()); myPagingProvider.setDefaultPageSize(BasePagingProvider.DEFAULT_DEFAULT_PAGE_SIZE); myPagingProvider.setMaximumPageSize(BasePagingProvider.DEFAULT_MAX_PAGE_SIZE); @@ -452,14 +449,14 @@ public abstract class BaseJpaR5Test extends BaseJpaTest implements ITestDataBuil public void beforeFlushFT() { purgeHibernateSearch(myEntityManager); - myDaoConfig.setSchedulingDisabled(true); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setSchedulingDisabled(true); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); } @BeforeEach @Transactional() public void beforePurgeDatabase() { - purgeDatabase(myDaoConfig, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataSchedulerHelper); + purgeDatabase(myStorageSettings, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataSchedulerHelper); } @BeforeEach diff --git a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoR5ValueSetTest.java b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoR5ValueSetTest.java index 77d4b524afb..ac5d9acc283 100644 --- a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoR5ValueSetTest.java +++ b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoR5ValueSetTest.java @@ -6,7 +6,7 @@ import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.context.support.ValidationSupportContext; import ca.uhn.fhir.context.support.ValueSetExpansionOptions; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc; @@ -22,7 +22,6 @@ import org.hl7.fhir.r5.model.CodeSystem; import org.hl7.fhir.r5.model.CodeType; import org.hl7.fhir.r5.model.CodeableConcept; import org.hl7.fhir.r5.model.Coding; -import org.hl7.fhir.r5.model.Enumerations; import org.hl7.fhir.r5.model.IdType; import org.hl7.fhir.r5.model.StringType; import org.hl7.fhir.r5.model.UriType; @@ -60,9 +59,9 @@ public class FhirResourceDaoR5ValueSetTest extends BaseJpaR5Test { @AfterEach public void after() { - myDaoConfig.setPreExpandValueSets(new DaoConfig().isPreExpandValueSets()); - myDaoConfig.setMaximumExpansionSize(new DaoConfig().getMaximumExpansionSize()); - myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled()); + myStorageSettings.setPreExpandValueSets(new JpaStorageSettings().isPreExpandValueSets()); + myStorageSettings.setMaximumExpansionSize(new JpaStorageSettings().getMaximumExpansionSize()); + myStorageSettings.setExpungeEnabled(new JpaStorageSettings().isExpungeEnabled()); } @@ -154,7 +153,7 @@ public class FhirResourceDaoR5ValueSetTest extends BaseJpaR5Test { @Test public void testValidateCodeOperationByResourceIdAndCodeableConceptWithExistingValueSetAndPreExpansionEnabled() { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); UriType valueSetIdentifier = null; IIdType id = myExtensionalVsId; @@ -195,7 +194,7 @@ public class FhirResourceDaoR5ValueSetTest extends BaseJpaR5Test { @Test public void testValidateCodeOperationByResourceIdAndCodeAndSystemWithExistingValueSetAndPreExpansionEnabled() { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); UriType valueSetIdentifier = null; IIdType id = myExtensionalVsId; @@ -261,7 +260,7 @@ public class FhirResourceDaoR5ValueSetTest extends BaseJpaR5Test { */ @Test public void testDeleteExpungePreExpandedValueSet() { - myDaoConfig.setExpungeEnabled(true); + myStorageSettings.setExpungeEnabled(true); // Create valueset ValueSet vs = myValidationSupport.fetchResource(ValueSet.class, "http://hl7.org/fhir/ValueSet/address-use"); @@ -306,7 +305,7 @@ public class FhirResourceDaoR5ValueSetTest extends BaseJpaR5Test { codesToAdd.addRootConcept("CODE" + i, "Display " + i); } myTermCodeSystemStorageSvc.applyDeltaCodeSystemsAdd("http://loinc.org", codesToAdd); - myDaoConfig.setMaximumExpansionSize(50); + myStorageSettings.setMaximumExpansionSize(50); ValueSet vs = new ValueSet(); vs.setUrl("http://example.com/fhir/ValueSet/observation-vitalsignresult"); diff --git a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/SearchParamExtractorR5Test.java b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/SearchParamExtractorR5Test.java index cf6b66f952b..90e3a93d45a 100644 --- a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/SearchParamExtractorR5Test.java +++ b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/SearchParamExtractorR5Test.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.dao.r5; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate; import ca.uhn.fhir.jpa.searchparam.extractor.ISearchParamExtractor; import ca.uhn.fhir.jpa.searchparam.extractor.SearchParamExtractorR5; @@ -43,7 +43,7 @@ public class SearchParamExtractorR5Test { //When we extract the Date SPs - SearchParamExtractorR5 extractor = new SearchParamExtractorR5(new ModelConfig(), new PartitionSettings(), ourCtx, mySearchParamRegistry); + SearchParamExtractorR5 extractor = new SearchParamExtractorR5(new StorageSettings(), new PartitionSettings(), ourCtx, mySearchParamRegistry); ISearchParamExtractor.SearchParamSet dates = extractor.extractSearchParamDates(appointment); //We find one, and the lexer doesn't explode. diff --git a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/StorageInterceptorEventsR5Test.java b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/StorageInterceptorEventsR5Test.java index 217987de64f..c735b75598b 100644 --- a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/StorageInterceptorEventsR5Test.java +++ b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/StorageInterceptorEventsR5Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.r5; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.PersistedJpaBundleProvider; @@ -29,7 +29,7 @@ public class StorageInterceptorEventsR5Test extends BaseJpaR5Test { @BeforeEach public void before() { - myDaoConfig.setExpungeEnabled(true); + myStorageSettings.setExpungeEnabled(true); } @Test @@ -124,7 +124,7 @@ public class StorageInterceptorEventsR5Test extends BaseJpaR5Test { @AfterEach public void after() { myInterceptorRegistry.unregisterAllInterceptors(); - myDaoConfig.setExpungeEnabled(new DaoConfig().isExpungeEnabled()); + myStorageSettings.setExpungeEnabled(new JpaStorageSettings().isExpungeEnabled()); } diff --git a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/AuthorizationInterceptorJpaR5Test.java b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/AuthorizationInterceptorJpaR5Test.java index 92511ef3cf2..7f041789a0a 100644 --- a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/AuthorizationInterceptorJpaR5Test.java +++ b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/AuthorizationInterceptorJpaR5Test.java @@ -24,9 +24,9 @@ public class AuthorizationInterceptorJpaR5Test extends BaseResourceProviderR5Tes @Override public void before() throws Exception { super.before(); - myDaoConfig.setAllowMultipleDelete(true); - myDaoConfig.setExpungeEnabled(true); - myDaoConfig.setDeleteExpungeEnabled(true); + myStorageSettings.setAllowMultipleDelete(true); + myStorageSettings.setExpungeEnabled(true); + myStorageSettings.setDeleteExpungeEnabled(true); } /** diff --git a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/BaseResourceProviderR5Test.java b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/BaseResourceProviderR5Test.java index 240ac960ce2..6717e74faa0 100644 --- a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/BaseResourceProviderR5Test.java +++ b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/BaseResourceProviderR5Test.java @@ -76,7 +76,7 @@ public abstract class BaseResourceProviderR5Test extends BaseJpaR5Test { s.getInterceptorService().registerInterceptor(myBinaryStorageInterceptor); - JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(s, mySystemDao, myDaoConfig, mySearchParamRegistry, myValidationSupport); + JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(s, mySystemDao, myStorageSettings, mySearchParamRegistry, myValidationSupport); confProvider.setImplementationDescription("THIS IS THE DESC"); s.setServerConformanceProvider(confProvider); diff --git a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5Test.java b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5Test.java index 2efa9a0c90c..21a41aef519 100644 --- a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5Test.java +++ b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5Test.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.provider.r5; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.entity.Search; import ca.uhn.fhir.jpa.model.search.SearchStatusEnum; import ca.uhn.fhir.parser.StrictErrorHandler; @@ -60,12 +60,12 @@ public class ResourceProviderR5Test extends BaseResourceProviderR5Test { public void after() throws Exception { super.after(); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setCountSearchResultsUpTo(new DaoConfig().getCountSearchResultsUpTo()); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); - myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); + myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setCountSearchResultsUpTo(new JpaStorageSettings().getCountSearchResultsUpTo()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); + myStorageSettings.setAllowContainsSearches(new JpaStorageSettings().isAllowContainsSearches()); myClient.unregisterInterceptor(myCapturingInterceptor); } @@ -76,14 +76,14 @@ public class ResourceProviderR5Test extends BaseResourceProviderR5Test { super.before(); myFhirCtx.setParserErrorHandler(new StrictErrorHandler()); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); myClient.registerInterceptor(myCapturingInterceptor); - myDaoConfig.setSearchPreFetchThresholds(new DaoConfig().getSearchPreFetchThresholds()); + myStorageSettings.setSearchPreFetchThresholds(new JpaStorageSettings().getSearchPreFetchThresholds()); } @Test public void testSearchWithContainsLowerCase() { - myDaoConfig.setAllowContainsSearches(true); + myStorageSettings.setAllowContainsSearches(true); Patient pt1 = new Patient(); pt1.addName().setFamily("Elizabeth"); diff --git a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetTest.java b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetTest.java index 5d4eadbde9b..ac43734dcc6 100644 --- a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetTest.java +++ b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.provider.r5; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; @@ -260,7 +260,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @Test public void testExpandByIdWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -293,7 +293,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @Test public void testExpandByIdWithPreExpansionWithOffset() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -330,7 +330,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @Test public void testExpandByIdWithPreExpansionWithCount() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -359,7 +359,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @Test public void testExpandByIdWithPreExpansionWithOffsetAndCount() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -410,7 +410,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @Test public void testExpandByIdWithFilterWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -452,7 +452,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @Test public void testExpandByUrlNoPreExpand() throws Exception { - myDaoConfig.setPreExpandValueSets(false); + myStorageSettings.setPreExpandValueSets(false); loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); Parameters respParam = myClient @@ -490,7 +490,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @Test public void testExpandByUrlWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -513,7 +513,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @Test public void testExpandByUrlWithPreExpansionWithOffset() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -544,7 +544,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @Test public void testExpandByUrlWithPreExpansionWithCount() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -574,7 +574,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @Test public void testExpandByUrlWithPreExpansionWithOffsetAndCount() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -607,7 +607,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @Test public void testExpandByUrlWithPreExpansionAndBogusUrl() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -649,7 +649,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @Test public void testExpandByValueSetWithPreExpansion() throws IOException { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -674,7 +674,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @Test public void testExpandByValueSetWithPreExpansionWithOffset() throws IOException { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -707,7 +707,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @Test public void testExpandByValueSetWithPreExpansionWithCount() throws IOException { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -740,7 +740,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @Test public void testExpandByValueSetWithPreExpansionWithOffsetAndCount() throws IOException { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(HTTPVerb.POST); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -1021,7 +1021,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @Test public void testUpdateValueSetTriggersAnotherPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(HTTPVerb.POST); @@ -1050,7 +1050,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @Test public void testUpdateValueSetTriggersAnotherPreExpansionUsingTransactionBundle() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(Bundle.HTTPVerb.POST); @@ -1441,7 +1441,7 @@ public class ResourceProviderR5ValueSetTest extends BaseResourceProviderR5Test { @AfterEach public void afterResetPreExpansionDefault() { - myDaoConfig.setPreExpandValueSets(new DaoConfig().isPreExpandValueSets()); + myStorageSettings.setPreExpandValueSets(new JpaStorageSettings().isPreExpandValueSets()); } diff --git a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetVersionedTest.java b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetVersionedTest.java index 6cb2eb01fad..72427a4d46b 100644 --- a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetVersionedTest.java +++ b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5ValueSetVersionedTest.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.provider.r5; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; @@ -298,7 +298,7 @@ public class ResourceProviderR5ValueSetVersionedTest extends BaseResourceProvide @Test public void testExpandByIdWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); await().until(() -> clearDeferredStorageQueue()); @@ -394,7 +394,7 @@ public class ResourceProviderR5ValueSetVersionedTest extends BaseResourceProvide @Test public void testExpandByIdWithFilterWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); await().until(() -> clearDeferredStorageQueue()); @@ -489,7 +489,7 @@ public class ResourceProviderR5ValueSetVersionedTest extends BaseResourceProvide @Test public void testExpandByUrlAndVersionNoPreExpand() throws Exception { - myDaoConfig.setPreExpandValueSets(false); + myStorageSettings.setPreExpandValueSets(false); loadAndPersistCodeSystemAndValueSet(); // Check expansion of multi-versioned ValueSet with version 1 @@ -562,7 +562,7 @@ public class ResourceProviderR5ValueSetVersionedTest extends BaseResourceProvide @Test public void testExpandByUrlWithPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); await().until(() -> clearDeferredStorageQueue()); @@ -623,7 +623,7 @@ public class ResourceProviderR5ValueSetVersionedTest extends BaseResourceProvide @Test public void testExpandByUrlWithPreExpansionAndBogusVersion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSet(); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -710,7 +710,7 @@ public class ResourceProviderR5ValueSetVersionedTest extends BaseResourceProvide @Test public void testExpandByValueSetWithPreExpansion() throws IOException { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystem(); myTermSvc.preExpandDeferredValueSetsToTerminologyTables(); @@ -940,7 +940,7 @@ public class ResourceProviderR5ValueSetVersionedTest extends BaseResourceProvide @Test public void testUpdateValueSetTriggersAnotherPreExpansion() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(); @@ -989,7 +989,7 @@ public class ResourceProviderR5ValueSetVersionedTest extends BaseResourceProvide @Test public void testUpdateValueSetTriggersAnotherPreExpansionUsingTransactionBundle() throws Exception { - myDaoConfig.setPreExpandValueSets(true); + myStorageSettings.setPreExpandValueSets(true); loadAndPersistCodeSystemAndValueSetWithDesignations(); @@ -1445,7 +1445,7 @@ public class ResourceProviderR5ValueSetVersionedTest extends BaseResourceProvide @AfterEach public void afterResetPreExpansionDefault() { - myDaoConfig.setPreExpandValueSets(new DaoConfig().isPreExpandValueSets()); + myStorageSettings.setPreExpandValueSets(new JpaStorageSettings().isPreExpandValueSets()); } public CodeSystem createExternalCs(IFhirResourceDao theCodeSystemDao, IResourceTableDao theResourceTableDao, ITermCodeSystemStorageSvc theTermCodeSystemStorageSvc, ServletRequestDetails theRequestDetails) { diff --git a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionsR5Test.java b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionsR5Test.java index 666e1ece58f..a618bc5385d 100644 --- a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionsR5Test.java +++ b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionsR5Test.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.subscription; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.provider.r5.BaseResourceProviderR5Test; import ca.uhn.fhir.jpa.subscription.channel.impl.LinkedBlockingChannel; import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType; @@ -75,12 +75,12 @@ public abstract class BaseSubscriptionsR5Test extends BaseResourceProviderR5Test } mySubscriptionIds.clear(); - myDaoConfig.setAllowMultipleDelete(true); + myStorageSettings.setAllowMultipleDelete(true); ourLog.info("Deleting all subscriptions"); myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute(); myClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute(); ourLog.info("Done deleting all subscriptions"); - myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete()); + myStorageSettings.setAllowMultipleDelete(new JpaStorageSettings().isAllowMultipleDelete()); mySubscriptionTestUtil.unregisterSubscriptionInterceptor(); } diff --git a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR5Test.java b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR5Test.java index de685c448ba..6c9b9f501bc 100644 --- a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR5Test.java +++ b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestR5Test.java @@ -515,7 +515,7 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test { @Test public void testRestHookSubscriptionApplicationJsonDatabase() throws Exception { // Same test as above, but now run it using database matching - myDaoConfig.setEnableInMemorySubscriptionMatching(false); + myStorageSettings.setEnableInMemorySubscriptionMatching(false); String payload = "application/json"; String code = "1000000050"; diff --git a/hapi-fhir-jpaserver-test-utilities/pom.xml b/hapi-fhir-jpaserver-test-utilities/pom.xml index fcdeab920a9..7c954543cce 100644 --- a/hapi-fhir-jpaserver-test-utilities/pom.xml +++ b/hapi-fhir-jpaserver-test-utilities/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/provider/BaseResourceProviderR4Test.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/provider/BaseResourceProviderR4Test.java index c703828e08d..79da95510df 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/provider/BaseResourceProviderR4Test.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/provider/BaseResourceProviderR4Test.java @@ -22,7 +22,6 @@ package ca.uhn.fhir.jpa.provider; import ca.uhn.fhir.batch2.jobs.expunge.DeleteExpungeProvider; import ca.uhn.fhir.batch2.jobs.reindex.ReindexProvider; -import ca.uhn.fhir.jpa.api.IDaoRegistry; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.bulk.export.provider.BulkDataExportProvider; import ca.uhn.fhir.jpa.dao.data.IPartitionDao; @@ -92,7 +91,7 @@ public abstract class BaseResourceProviderR4Test extends BaseJpaR4Test { s.setPagingProvider(myAppCtx.getBean(DatabaseBackedPagingProvider.class)); - JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(s, mySystemDao, myDaoConfig, mySearchParamRegistry, myValidationSupport); + JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(s, mySystemDao, myStorageSettings, mySearchParamRegistry, myValidationSupport); confProvider.setImplementationDescription("THIS IS THE DESC"); s.setServerConformanceProvider(confProvider); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java index 4a6043ba268..a351e7f4dea 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java @@ -184,7 +184,7 @@ public abstract class BaseResourceProviderR4Test extends BaseJpaR4Test { ourSearchParamRegistry = myAppCtx.getBean(SearchParamRegistryImpl.class); IValidationSupport validationSupport = myAppCtx.getBean(IValidationSupport.class); - ourCapabilityStatementProvider = new JpaCapabilityStatementProvider(ourRestServer, mySystemDao, myDaoConfig, ourSearchParamRegistry, validationSupport); + ourCapabilityStatementProvider = new JpaCapabilityStatementProvider(ourRestServer, mySystemDao, myStorageSettings, ourSearchParamRegistry, validationSupport); ourCapabilityStatementProvider.setImplementationDescription("THIS IS THE DESC"); ourRestServer.setServerConformanceProvider(ourCapabilityStatementProvider); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/search/QuantitySearchParameterTestCases.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/search/QuantitySearchParameterTestCases.java index eec9da09fcf..e5f9f6ba6d8 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/search/QuantitySearchParameterTestCases.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/search/QuantitySearchParameterTestCases.java @@ -20,13 +20,12 @@ package ca.uhn.fhir.jpa.search; * #L% */ -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.TestDaoSearch; import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; import ca.uhn.fhir.parser.DataFormatException; import ca.uhn.fhir.test.utilities.ITestDataBuilder; import org.hl7.fhir.instance.model.api.IIdType; -import org.hl7.fhir.r4.model.Observation; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; @@ -52,14 +51,14 @@ public class QuantitySearchParameterTestCases implements ITestDataBuilder.WithSu final Support myTestDataBuilder; final TestDaoSearch myTestDaoSearch; - final DaoConfig myDaoConfig; + final JpaStorageSettings myStorageSettings; private IIdType myResourceId; - protected QuantitySearchParameterTestCases(Support theTestDataBuilder, TestDaoSearch theTestDaoSearch, DaoConfig theDaoConfig) { + protected QuantitySearchParameterTestCases(Support theTestDataBuilder, TestDaoSearch theTestDaoSearch, JpaStorageSettings theStorageSettings) { myTestDataBuilder = theTestDataBuilder; myTestDaoSearch = theTestDaoSearch; - myDaoConfig = theDaoConfig; + myStorageSettings = theStorageSettings; } @Override @@ -416,14 +415,14 @@ public class QuantitySearchParameterTestCases implements ITestDataBuilder.WithSu @BeforeEach void setUp() { - mySavedNomalizedSetting = myDaoConfig.getModelConfig().getNormalizedQuantitySearchLevel(); - myDaoConfig.getModelConfig().setNormalizedQuantitySearchLevel( + mySavedNomalizedSetting = myStorageSettings.getNormalizedQuantitySearchLevel(); + myStorageSettings.setNormalizedQuantitySearchLevel( NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED); } @AfterEach void tearDown() { - myDaoConfig.getModelConfig().setNormalizedQuantitySearchLevel(mySavedNomalizedSetting); + myStorageSettings.setNormalizedQuantitySearchLevel(mySavedNomalizedSetting); } @Nested diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaDstu3Test.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaDstu3Test.java index dcc6921700c..5d866a22f04 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaDstu3Test.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaDstu3Test.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.test; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.support.IValidationSupport; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoCodeSystem; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoConceptMap; @@ -47,7 +47,6 @@ import ca.uhn.fhir.jpa.dao.data.ITermConceptDao; import ca.uhn.fhir.jpa.dao.data.ITermConceptMapDao; import ca.uhn.fhir.jpa.dao.data.ITermConceptMapGroupElementTargetDao; import ca.uhn.fhir.jpa.dao.data.ITermValueSetDao; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.provider.JpaSystemProvider; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.IStaleSearchDeletingSvc; @@ -183,8 +182,6 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest { @Qualifier("myConditionDaoDstu3") protected IFhirResourceDao myConditionDao; @Autowired - protected ModelConfig myModelConfig; - @Autowired @Qualifier("myDeviceDaoDstu3") protected IFhirResourceDao myDeviceDao; @Autowired @@ -354,10 +351,10 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest { @AfterEach() public void afterCleanupDao() { - myDaoConfig.setExpireSearchResults(new DaoConfig().isExpireSearchResults()); - myDaoConfig.setExpireSearchResultsAfterMillis(new DaoConfig().getExpireSearchResultsAfterMillis()); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setSuppressUpdatesWithNoChange(new DaoConfig().isSuppressUpdatesWithNoChange()); + myStorageSettings.setExpireSearchResults(new JpaStorageSettings().isExpireSearchResults()); + myStorageSettings.setExpireSearchResultsAfterMillis(new JpaStorageSettings().getExpireSearchResultsAfterMillis()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setSuppressUpdatesWithNoChange(new JpaStorageSettings().isSuppressUpdatesWithNoChange()); } @Override @@ -380,14 +377,14 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest { public void beforeFlushFT() { purgeHibernateSearch(myEntityManager); - myDaoConfig.setSchedulingDisabled(true); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setSchedulingDisabled(true); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); } @BeforeEach @Transactional() public void beforePurgeDatabase() { - purgeDatabase(myDaoConfig, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); + purgeDatabase(myStorageSettings, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); } @BeforeEach diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaR4Test.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaR4Test.java index 8176af776e4..717fac3d358 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaR4Test.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaR4Test.java @@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.test; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.interceptor.api.IInterceptorService; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoCodeSystem; @@ -77,7 +77,6 @@ import ca.uhn.fhir.jpa.entity.TermValueSet; import ca.uhn.fhir.jpa.entity.TermValueSetConcept; import ca.uhn.fhir.jpa.interceptor.PerformanceTracingLoggingInterceptor; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.packages.IPackageInstallerSvc; import ca.uhn.fhir.jpa.partition.IPartitionLookupSvc; import ca.uhn.fhir.jpa.provider.JpaSystemProvider; @@ -319,8 +318,6 @@ public abstract class BaseJpaR4Test extends BaseJpaTest implements ITestDataBuil @Autowired protected PartitionSettings myPartitionSettings; @Autowired - protected ModelConfig myModelConfig; - @Autowired @Qualifier("myDeviceDaoR4") protected IFhirResourceDao myDeviceDao; @Autowired @@ -525,13 +522,13 @@ public abstract class BaseJpaR4Test extends BaseJpaTest implements ITestDataBuil @AfterEach() public void afterCleanupDao() { - myDaoConfig.setExpireSearchResults(new DaoConfig().isExpireSearchResults()); - myDaoConfig.setEnforceReferentialIntegrityOnDelete(new DaoConfig().isEnforceReferentialIntegrityOnDelete()); - myDaoConfig.setExpireSearchResultsAfterMillis(new DaoConfig().getExpireSearchResultsAfterMillis()); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setSuppressUpdatesWithNoChange(new DaoConfig().isSuppressUpdatesWithNoChange()); - myDaoConfig.setAllowContainsSearches(new DaoConfig().isAllowContainsSearches()); - myDaoConfig.setAutoCreatePlaceholderReferenceTargets(new DaoConfig().isAutoCreatePlaceholderReferenceTargets()); + myStorageSettings.setExpireSearchResults(new JpaStorageSettings().isExpireSearchResults()); + myStorageSettings.setEnforceReferentialIntegrityOnDelete(new JpaStorageSettings().isEnforceReferentialIntegrityOnDelete()); + myStorageSettings.setExpireSearchResultsAfterMillis(new JpaStorageSettings().getExpireSearchResultsAfterMillis()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setSuppressUpdatesWithNoChange(new JpaStorageSettings().isSuppressUpdatesWithNoChange()); + myStorageSettings.setAllowContainsSearches(new JpaStorageSettings().isAllowContainsSearches()); + myStorageSettings.setAutoCreatePlaceholderReferenceTargets(new JpaStorageSettings().isAutoCreatePlaceholderReferenceTargets()); myPagingProvider.setDefaultPageSize(BasePagingProvider.DEFAULT_DEFAULT_PAGE_SIZE); myPagingProvider.setMaximumPageSize(BasePagingProvider.DEFAULT_MAX_PAGE_SIZE); @@ -572,8 +569,8 @@ public abstract class BaseJpaR4Test extends BaseJpaTest implements ITestDataBuil public void beforeFlushFT() { purgeHibernateSearch(this.myEntityManager); - myDaoConfig.setSchedulingDisabled(true); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); + myStorageSettings.setSchedulingDisabled(true); + myStorageSettings.setIndexMissingFields(new JpaStorageSettings().getIndexMissingFields()); } @AfterEach @@ -581,7 +578,7 @@ public abstract class BaseJpaR4Test extends BaseJpaTest implements ITestDataBuil runInTransaction(() -> { myMdmLinkDao.deleteAll(); }); - purgeDatabase(myDaoConfig, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); + purgeDatabase(myStorageSettings, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); } @BeforeEach diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaTest.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaTest.java index 4ac9eb7c552..1d51a1709d6 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaTest.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaTest.java @@ -26,7 +26,7 @@ import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor; import ca.uhn.fhir.interceptor.api.IInterceptorService; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.executor.InterceptorService; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc; @@ -177,7 +177,7 @@ public abstract class BaseJpaTest extends BaseTest { @Autowired protected FhirContext myFhirContext; @Autowired - protected DaoConfig myDaoConfig = new DaoConfig(); + protected JpaStorageSettings myStorageSettings = new JpaStorageSettings(); @Autowired protected DatabaseBackedPagingProvider myDatabaseBackedPagingProvider; @Autowired @@ -265,9 +265,9 @@ public abstract class BaseJpaTest extends BaseTest { if (myFhirInstanceValidator != null) { myFhirInstanceValidator.invalidateCaches(); } - DaoConfig defaultConfig = new DaoConfig(); - myDaoConfig.setAdvancedHSearchIndexing(defaultConfig.isAdvancedHSearchIndexing()); - myDaoConfig.setAllowContainsSearches(defaultConfig.isAllowContainsSearches()); + JpaStorageSettings defaultConfig = new JpaStorageSettings(); + myStorageSettings.setAdvancedHSearchIndexing(defaultConfig.isAdvancedHSearchIndexing()); + myStorageSettings.setAllowContainsSearches(defaultConfig.isAllowContainsSearches()); } @AfterEach @@ -766,15 +766,15 @@ public abstract class BaseJpaTest extends BaseTest { } @SuppressWarnings("BusyWait") - protected static void purgeDatabase(DaoConfig theDaoConfig, IFhirSystemDao theSystemDao, IResourceReindexingSvc theResourceReindexingSvc, ISearchCoordinatorSvc theSearchCoordinatorSvc, ISearchParamRegistry theSearchParamRegistry, IBulkDataExportJobSchedulingHelper theBulkDataJobActivator) { + protected static void purgeDatabase(JpaStorageSettings theStorageSettings, IFhirSystemDao theSystemDao, IResourceReindexingSvc theResourceReindexingSvc, ISearchCoordinatorSvc theSearchCoordinatorSvc, ISearchParamRegistry theSearchParamRegistry, IBulkDataExportJobSchedulingHelper theBulkDataJobActivator) { theSearchCoordinatorSvc.cancelAllActiveSearches(); theResourceReindexingSvc.cancelAndPurgeAllJobs(); theBulkDataJobActivator.cancelAndPurgeAllJobs(); - boolean expungeEnabled = theDaoConfig.isExpungeEnabled(); - boolean multiDeleteEnabled = theDaoConfig.isAllowMultipleDelete(); - theDaoConfig.setExpungeEnabled(true); - theDaoConfig.setAllowMultipleDelete(true); + boolean expungeEnabled = theStorageSettings.isExpungeEnabled(); + boolean multiDeleteEnabled = theStorageSettings.isAllowMultipleDelete(); + theStorageSettings.setExpungeEnabled(true); + theStorageSettings.setAllowMultipleDelete(true); for (int count = 0; ; count++) { try { @@ -793,8 +793,8 @@ public abstract class BaseJpaTest extends BaseTest { } } } - theDaoConfig.setExpungeEnabled(expungeEnabled); - theDaoConfig.setAllowMultipleDelete(multiDeleteEnabled); + theStorageSettings.setExpungeEnabled(expungeEnabled); + theStorageSettings.setAllowMultipleDelete(multiDeleteEnabled); theSearchParamRegistry.forceRefresh(); } diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseValueSetHSearchExpansionR4Test.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseValueSetHSearchExpansionR4Test.java index 2d803be2504..bff1c3e695e 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseValueSetHSearchExpansionR4Test.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseValueSetHSearchExpansionR4Test.java @@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.test; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoCodeSystem; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoValueSet; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; @@ -117,60 +117,42 @@ public abstract class BaseValueSetHSearchExpansionR4Test extends BaseJpaTest { private static final String CS_URL = "http://example.com/my_code_system"; private static final String CS_URL_2 = "http://example.com/my_code_system2"; private static final String CS_URL_3 = "http://example.com/my_code_system3"; - - @Autowired FhirContext myFhirContext; - @Autowired PlatformTransactionManager myTxManager; - - @Autowired - private EntityManager myEntityManager; - @Autowired protected ITermCodeSystemDao myTermCodeSystemDao; - - @Autowired - protected DaoConfig myDaoConfig; - @Autowired @Qualifier("myCodeSystemDaoR4") protected IFhirResourceDaoCodeSystem myCodeSystemDao; - @Autowired protected IResourceTableDao myResourceTableDao; - @Autowired protected ITermCodeSystemStorageSvc myTermCodeSystemStorageSvc; - @Autowired @Qualifier("myValueSetDaoR4") protected IFhirResourceDaoValueSet myValueSetDao; - @Autowired protected ITermReadSvc myTermSvc; - @Autowired protected ITermDeferredStorageSvc myTerminologyDeferredStorageSvc; - @Mock(answer = Answers.RETURNS_DEEP_STUBS) protected ServletRequestDetails mySrd; - - @Autowired - private IFhirSystemDao mySystemDao; - - @Autowired - private IResourceReindexingSvc myResourceReindexingSvc; - - @Autowired - private ISearchCoordinatorSvc mySearchCoordinatorSvc; - - @Autowired - private ISearchParamRegistry mySearchParamRegistry; - - @Autowired - private IBulkDataExportJobSchedulingHelper myBulkDataScheduleHelper; - @Autowired protected ITermCodeSystemVersionDao myTermCodeSystemVersionDao; - + @Autowired + FhirContext myFhirContext; + @Autowired + PlatformTransactionManager myTxManager; + @Autowired + private EntityManager myEntityManager; + @Autowired + private IFhirSystemDao mySystemDao; + @Autowired + private IResourceReindexingSvc myResourceReindexingSvc; + @Autowired + private ISearchCoordinatorSvc mySearchCoordinatorSvc; + @Autowired + private ISearchParamRegistry mySearchParamRegistry; + @Autowired + private IBulkDataExportJobSchedulingHelper myBulkDataScheduleHelper; @Mock private IValueSetConceptAccumulator myValueSetCodeAccumulator; @@ -182,30 +164,30 @@ public abstract class BaseValueSetHSearchExpansionR4Test extends BaseJpaTest { purgeHibernateSearch(myEntityManager); - myDaoConfig.setSchedulingDisabled(true); - myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + myStorageSettings.setSchedulingDisabled(true); + myStorageSettings.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); } @BeforeEach @Transactional() public void beforePurgeDatabase() { - purgeDatabase(myDaoConfig, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); + purgeDatabase(myStorageSettings, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); } @AfterEach public void after() { - myDaoConfig.setDeferIndexingForCodesystemsOfSize(new DaoConfig().getDeferIndexingForCodesystemsOfSize()); + myStorageSettings.setDeferIndexingForCodesystemsOfSize(new JpaStorageSettings().getDeferIndexingForCodesystemsOfSize()); TermReindexingSvcImpl.setForceSaveDeferredAlwaysForUnitTest(false); - myDaoConfig.setMaximumExpansionSize(DaoConfig.DEFAULT_MAX_EXPANSION_SIZE); - purgeDatabase(myDaoConfig, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); + myStorageSettings.setMaximumExpansionSize(JpaStorageSettings.DEFAULT_MAX_EXPANSION_SIZE); + purgeDatabase(myStorageSettings, mySystemDao, myResourceReindexingSvc, mySearchCoordinatorSvc, mySearchParamRegistry, myBulkDataScheduleHelper); } @AfterEach() public void afterCleanupDao() { - myDaoConfig.setExpireSearchResults(new DaoConfig().isExpireSearchResults()); - myDaoConfig.setExpireSearchResultsAfterMillis(new DaoConfig().getExpireSearchResultsAfterMillis()); - myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis()); - myDaoConfig.setSuppressUpdatesWithNoChange(new DaoConfig().isSuppressUpdatesWithNoChange()); + myStorageSettings.setExpireSearchResults(new JpaStorageSettings().isExpireSearchResults()); + myStorageSettings.setExpireSearchResultsAfterMillis(new JpaStorageSettings().getExpireSearchResultsAfterMillis()); + myStorageSettings.setReuseCachedSearchResultsForMillis(new JpaStorageSettings().getReuseCachedSearchResultsForMillis()); + myStorageSettings.setSuppressUpdatesWithNoChange(new JpaStorageSettings().isSuppressUpdatesWithNoChange()); } @AfterEach @@ -218,6 +200,246 @@ public abstract class BaseValueSetHSearchExpansionR4Test extends BaseJpaTest { deferredSvc.clearDeferred(); } + private List generateCodes(int theCodesQueriedCount) { + return IntStream.range(0, theCodesQueriedCount) + .mapToObj(i -> "generated-code-" + i).collect(Collectors.toList()); + } + + public long createLoincSystemWithSomeCodes() { + CodeSystem codeSystem = new CodeSystem(); + codeSystem.setUrl(LOINC_URI); + codeSystem.setId("test-loinc"); + codeSystem.setVersion("SYSTEM VERSION"); + codeSystem.setContent(CodeSystem.CodeSystemContentMode.NOTPRESENT); + IIdType csId = myCodeSystemDao.create(codeSystem).getId().toUnqualified(); + + ResourceTable table = myResourceTableDao.findById(csId.getIdPartAsLong()).orElseThrow(IllegalArgumentException::new); + + TermCodeSystemVersion termCodeSystemVersion = new TermCodeSystemVersion(); + termCodeSystemVersion.setResource(table); + + TermConcept code1 = new TermConcept(termCodeSystemVersion, "50015-7"); // has -3 as a child + TermConcept code2 = new TermConcept(termCodeSystemVersion, "43343-3"); // has -4 as a child + TermConcept code3 = new TermConcept(termCodeSystemVersion, "43343-4"); //has no children + TermConcept code4 = new TermConcept(termCodeSystemVersion, "47239-9"); //has no children + + code1.addPropertyString("SYSTEM", "Bld/Bone mar^Donor"); + code1.addPropertyCoding( + "child", + LOINC_URI, + code2.getCode(), + code2.getDisplay()); + code1.addChild(code2, RelationshipTypeEnum.ISA); + termCodeSystemVersion.getConcepts().add(code1); + + code2.addPropertyString("SYSTEM", "Ser"); + code2.addPropertyString("HELLO", "12345-1"); + code2.addPropertyCoding( + "parent", + LOINC_URI, + code1.getCode(), + code1.getDisplay()); + code2.addPropertyCoding( + "child", + LOINC_URI, + code3.getCode(), + code3.getDisplay()); + code2.addChild(code3, RelationshipTypeEnum.ISA); + code2.addPropertyCoding( + "child", + LOINC_URI, + code4.getCode(), + code4.getDisplay()); + code2.addChild(code4, RelationshipTypeEnum.ISA); + termCodeSystemVersion.getConcepts().add(code2); + + code3.addPropertyString("SYSTEM", "Ser"); + code3.addPropertyString("HELLO", "12345-2"); + code3.addPropertyCoding( + "parent", + LOINC_URI, + code2.getCode(), + code2.getDisplay()); + termCodeSystemVersion.getConcepts().add(code3); + + code4.addPropertyString("SYSTEM", "^Patient"); + code4.addPropertyString("EXTERNAL_COPYRIGHT_NOTICE", "Copyright © 2006 World Health Organization..."); + code4.addPropertyCoding( + "parent", + LOINC_URI, + code2.getCode(), + code2.getDisplay()); + termCodeSystemVersion.getConcepts().add(code4); + + myTermCodeSystemStorageSvc.storeNewCodeSystemVersion(JpaPid.fromId(table.getId()), LOINC_URI, "SYSTEM NAME", "SYSTEM VERSION", termCodeSystemVersion, table); + + return csId.getIdPartAsLong(); + } + + private IIdType createCodeSystem() { + CodeSystem codeSystem = new CodeSystem(); + codeSystem.setUrl(CS_URL); + codeSystem.setContent(CodeSystem.CodeSystemContentMode.NOTPRESENT); + codeSystem.setName("SYSTEM NAME"); + IIdType id = myCodeSystemDao.create(codeSystem, mySrd).getId().toUnqualified(); + + ResourceTable table = myResourceTableDao.findById(id.getIdPartAsLong()).orElseThrow(IllegalArgumentException::new); + + TermCodeSystemVersion cs = new TermCodeSystemVersion(); + cs.setResource(table); + + TermConcept parent; + parent = new TermConcept(cs, "ParentWithNoChildrenA"); + cs.getConcepts().add(parent); + parent = new TermConcept(cs, "ParentWithNoChildrenB"); + cs.getConcepts().add(parent); + parent = new TermConcept(cs, "ParentWithNoChildrenC"); + cs.getConcepts().add(parent); + + TermConcept parentA = new TermConcept(cs, "ParentA"); + cs.getConcepts().add(parentA); + + TermConcept childAA = new TermConcept(cs, "childAA"); + parentA.addChild(childAA, RelationshipTypeEnum.ISA); + + TermConcept childAAA = new TermConcept(cs, "childAAA"); + childAAA.addPropertyString("propA", "valueAAA"); + childAAA.addPropertyString("propB", "foo"); + childAA.addChild(childAAA, RelationshipTypeEnum.ISA); + + TermConcept childAAB = new TermConcept(cs, "childAAB"); + childAAB.addPropertyString("propA", "valueAAB"); + childAAB.addPropertyString("propB", "foo"); + childAAB.addDesignation() + .setLanguage("D1L") + .setUseSystem("D1S") + .setUseCode("D1C") + .setUseDisplay("D1D") + .setValue("D1V"); + childAA.addChild(childAAB, RelationshipTypeEnum.ISA); + + TermConcept childAB = new TermConcept(cs, "childAB"); + parentA.addChild(childAB, RelationshipTypeEnum.ISA); + + TermConcept parentB = new TermConcept(cs, "ParentB"); + cs.getConcepts().add(parentB); + + myTermCodeSystemStorageSvc.storeNewCodeSystemVersion(JpaPid.fromId(table.getId()), CS_URL, "SYSTEM NAME", null, cs, table); + + myTerminologyDeferredStorageSvc.saveAllDeferred(); + + return id; + } + + private void createCodeSystem2() { + CodeSystem codeSystem = new CodeSystem(); + codeSystem.setUrl(CS_URL_2); + codeSystem.setVersion("SYSTEM VERSION"); + codeSystem.setContent(CodeSystem.CodeSystemContentMode.NOTPRESENT); + IIdType id = myCodeSystemDao.create(codeSystem, mySrd).getId().toUnqualified(); + + ResourceTable table = myResourceTableDao.findById(id.getIdPartAsLong()).orElseThrow(IllegalArgumentException::new); + + TermCodeSystemVersion cs = new TermCodeSystemVersion(); + cs.setResource(table); + + TermConcept parentA = new TermConcept(cs, "CS2"); + cs.getConcepts().add(parentA); + + myTermCodeSystemStorageSvc.storeNewCodeSystemVersion(JpaPid.fromId(table.getId()), CS_URL_2, "SYSTEM NAME", "SYSTEM VERSION", cs, table); + + } + + private IIdType createCodeSystem3() { + CodeSystem codeSystem = new CodeSystem(); + codeSystem.setUrl(CS_URL_3); + codeSystem.setContent(CodeSystem.CodeSystemContentMode.NOTPRESENT); + codeSystem.setName("SYSTEM NAME 3"); + IIdType id = myCodeSystemDao.create(codeSystem, mySrd).getId().toUnqualified(); + + ResourceTable table = myResourceTableDao.findById(id.getIdPartAsLong()).orElseThrow(IllegalArgumentException::new); + + TermCodeSystemVersion cs = new TermCodeSystemVersion(); + cs.setResource(table); + + TermConcept parent; + parent = new TermConcept(cs, "ParentWithNoChildrenA"); + cs.getConcepts().add(parent); + parent = new TermConcept(cs, "ParentWithNoChildrenB"); + cs.getConcepts().add(parent); + parent = new TermConcept(cs, "ParentWithNoChildrenC"); + cs.getConcepts().add(parent); + + TermConcept parentA = new TermConcept(cs, "ParentA"); + cs.getConcepts().add(parentA); + + TermConcept childAA = new TermConcept(cs, "childAA"); + parentA.addChild(childAA, RelationshipTypeEnum.ISA); + + TermConcept childAAA = new TermConcept(cs, "childAAA"); + childAAA.addPropertyString("propA", "valueAAA"); + childAAA.addPropertyString("propB", "foo"); + childAA.addChild(childAAA, RelationshipTypeEnum.ISA); + + TermConcept childAAB = new TermConcept(cs, "childAAB"); + childAAB.addPropertyString("propA", "valueAAB"); + childAAB.addPropertyString("propB", "foo"); + childAAB.addDesignation() + .setLanguage("D1L") + .setUseSystem("D1S") + .setUseCode("D1C") + .setUseDisplay("D1D") + .setValue("D1V"); + childAA.addChild(childAAB, RelationshipTypeEnum.ISA); + + TermConcept childAAC = new TermConcept(cs, "childAAC"); + childAAC.addPropertyString("propA", "valueAAC"); + childAAC.addPropertyString("propB", "No IG exists"); + childAA.addChild(childAAC, RelationshipTypeEnum.ISA); + + TermConcept childAAD = new TermConcept(cs, "childAAD"); + childAAD.addPropertyString("propA", "valueAAD"); + childAAD.addPropertyString("propB", "IG exists"); + childAA.addChild(childAAD, RelationshipTypeEnum.ISA); + + // this one shouldn't come up in search result because searched argument is not in searched property (propB) but in propA + TermConcept childAAE = new TermConcept(cs, "childAAE"); + childAAE.addPropertyString("propA", "IG exists"); + childAAE.addPropertyString("propB", "valueAAE"); + childAA.addChild(childAAE, RelationshipTypeEnum.ISA); + + TermConcept childAB = new TermConcept(cs, "childAB"); + parentA.addChild(childAB, RelationshipTypeEnum.ISA); + + TermConcept parentB = new TermConcept(cs, "ParentB"); + cs.getConcepts().add(parentB); + + myTermCodeSystemStorageSvc.storeNewCodeSystemVersion(JpaPid.fromId(table.getId()), CS_URL, "SYSTEM NAME", null, cs, table); + + myTerminologyDeferredStorageSvc.saveAllDeferred(); + + return id; + } + + private List toCodesContains(List theContains) { + List retVal = new ArrayList<>(); + + for (ValueSet.ValueSetExpansionContainsComponent next : theContains) { + retVal.add(next.getCode()); + } + + return retVal; + } + + @Override + protected FhirContext getFhirContext() { + return myFhirContext; + } + + @Override + protected PlatformTransactionManager getTxManager() { + return myTxManager; + } @Nested public class TestExpandLoincValueSetFilter { @@ -1441,7 +1663,7 @@ public abstract class BaseValueSetHSearchExpansionR4Test extends BaseJpaTest { // Codes available exceeds the max - myDaoConfig.setMaximumExpansionSize(50); + myStorageSettings.setMaximumExpansionSize(50); ValueSet vs = new ValueSet(); ValueSet.ConceptSetComponent include = vs.getCompose().addInclude(); include.setSystem(CS_URL); @@ -1453,7 +1675,7 @@ public abstract class BaseValueSetHSearchExpansionR4Test extends BaseJpaTest { } // Increase the max so it won't exceed - myDaoConfig.setMaximumExpansionSize(150); + myStorageSettings.setMaximumExpansionSize(150); vs = new ValueSet(); include = vs.getCompose().addInclude(); include.setSystem(CS_URL); @@ -1477,10 +1699,8 @@ public abstract class BaseValueSetHSearchExpansionR4Test extends BaseJpaTest { } - } - @Nested public class TestExpandValueSetProperty { @Test @@ -1705,7 +1925,6 @@ public abstract class BaseValueSetHSearchExpansionR4Test extends BaseJpaTest { } - /** * Test associated to searching with a number of terms larger than BooleanQuery.getMaxClauseCount() */ @@ -1740,7 +1959,7 @@ public abstract class BaseValueSetHSearchExpansionR4Test extends BaseJpaTest { // insert existing codes into list of codes searched allCodesNotIncludingSearched.addAll(insertIndex, existingCodes); - List hits = search(allCodesNotIncludingSearched); + List hits = search(allCodesNotIncludingSearched); assertEquals(existingCodes.size(), hits.size()); } @@ -1808,253 +2027,4 @@ public abstract class BaseValueSetHSearchExpansionR4Test extends BaseJpaTest { } } - - - private List generateCodes(int theCodesQueriedCount) { - return IntStream.range(0, theCodesQueriedCount) - .mapToObj(i -> "generated-code-" + i).collect(Collectors.toList()); - } - - - - public long createLoincSystemWithSomeCodes() { - CodeSystem codeSystem = new CodeSystem(); - codeSystem.setUrl(LOINC_URI); - codeSystem.setId("test-loinc"); - codeSystem.setVersion("SYSTEM VERSION"); - codeSystem.setContent(CodeSystem.CodeSystemContentMode.NOTPRESENT); - IIdType csId = myCodeSystemDao.create(codeSystem).getId().toUnqualified(); - - ResourceTable table = myResourceTableDao.findById(csId.getIdPartAsLong()).orElseThrow(IllegalArgumentException::new); - - TermCodeSystemVersion termCodeSystemVersion = new TermCodeSystemVersion(); - termCodeSystemVersion.setResource(table); - - TermConcept code1 = new TermConcept(termCodeSystemVersion, "50015-7"); // has -3 as a child - TermConcept code2 = new TermConcept(termCodeSystemVersion, "43343-3"); // has -4 as a child - TermConcept code3 = new TermConcept(termCodeSystemVersion, "43343-4"); //has no children - TermConcept code4 = new TermConcept(termCodeSystemVersion, "47239-9"); //has no children - - code1.addPropertyString("SYSTEM", "Bld/Bone mar^Donor"); - code1.addPropertyCoding( - "child", - LOINC_URI, - code2.getCode(), - code2.getDisplay()); - code1.addChild(code2, RelationshipTypeEnum.ISA); - termCodeSystemVersion.getConcepts().add(code1); - - code2.addPropertyString("SYSTEM", "Ser"); - code2.addPropertyString("HELLO", "12345-1"); - code2.addPropertyCoding( - "parent", - LOINC_URI, - code1.getCode(), - code1.getDisplay()); - code2.addPropertyCoding( - "child", - LOINC_URI, - code3.getCode(), - code3.getDisplay()); - code2.addChild(code3, RelationshipTypeEnum.ISA); - code2.addPropertyCoding( - "child", - LOINC_URI, - code4.getCode(), - code4.getDisplay()); - code2.addChild(code4, RelationshipTypeEnum.ISA); - termCodeSystemVersion.getConcepts().add(code2); - - code3.addPropertyString("SYSTEM", "Ser"); - code3.addPropertyString("HELLO", "12345-2"); - code3.addPropertyCoding( - "parent", - LOINC_URI, - code2.getCode(), - code2.getDisplay()); - termCodeSystemVersion.getConcepts().add(code3); - - code4.addPropertyString("SYSTEM", "^Patient"); - code4.addPropertyString("EXTERNAL_COPYRIGHT_NOTICE", "Copyright © 2006 World Health Organization..."); - code4.addPropertyCoding( - "parent", - LOINC_URI, - code2.getCode(), - code2.getDisplay()); - termCodeSystemVersion.getConcepts().add(code4); - - myTermCodeSystemStorageSvc.storeNewCodeSystemVersion(JpaPid.fromId(table.getId()), LOINC_URI, "SYSTEM NAME", "SYSTEM VERSION", termCodeSystemVersion, table); - - return csId.getIdPartAsLong(); - } - - - - - private IIdType createCodeSystem() { - CodeSystem codeSystem = new CodeSystem(); - codeSystem.setUrl(CS_URL); - codeSystem.setContent(CodeSystem.CodeSystemContentMode.NOTPRESENT); - codeSystem.setName("SYSTEM NAME"); - IIdType id = myCodeSystemDao.create(codeSystem, mySrd).getId().toUnqualified(); - - ResourceTable table = myResourceTableDao.findById(id.getIdPartAsLong()).orElseThrow(IllegalArgumentException::new); - - TermCodeSystemVersion cs = new TermCodeSystemVersion(); - cs.setResource(table); - - TermConcept parent; - parent = new TermConcept(cs, "ParentWithNoChildrenA"); - cs.getConcepts().add(parent); - parent = new TermConcept(cs, "ParentWithNoChildrenB"); - cs.getConcepts().add(parent); - parent = new TermConcept(cs, "ParentWithNoChildrenC"); - cs.getConcepts().add(parent); - - TermConcept parentA = new TermConcept(cs, "ParentA"); - cs.getConcepts().add(parentA); - - TermConcept childAA = new TermConcept(cs, "childAA"); - parentA.addChild(childAA, RelationshipTypeEnum.ISA); - - TermConcept childAAA = new TermConcept(cs, "childAAA"); - childAAA.addPropertyString("propA", "valueAAA"); - childAAA.addPropertyString("propB", "foo"); - childAA.addChild(childAAA, RelationshipTypeEnum.ISA); - - TermConcept childAAB = new TermConcept(cs, "childAAB"); - childAAB.addPropertyString("propA", "valueAAB"); - childAAB.addPropertyString("propB", "foo"); - childAAB.addDesignation() - .setLanguage("D1L") - .setUseSystem("D1S") - .setUseCode("D1C") - .setUseDisplay("D1D") - .setValue("D1V"); - childAA.addChild(childAAB, RelationshipTypeEnum.ISA); - - TermConcept childAB = new TermConcept(cs, "childAB"); - parentA.addChild(childAB, RelationshipTypeEnum.ISA); - - TermConcept parentB = new TermConcept(cs, "ParentB"); - cs.getConcepts().add(parentB); - - myTermCodeSystemStorageSvc.storeNewCodeSystemVersion(JpaPid.fromId(table.getId()), CS_URL, "SYSTEM NAME", null, cs, table); - - myTerminologyDeferredStorageSvc.saveAllDeferred(); - - return id; - } - - private void createCodeSystem2() { - CodeSystem codeSystem = new CodeSystem(); - codeSystem.setUrl(CS_URL_2); - codeSystem.setVersion("SYSTEM VERSION"); - codeSystem.setContent(CodeSystem.CodeSystemContentMode.NOTPRESENT); - IIdType id = myCodeSystemDao.create(codeSystem, mySrd).getId().toUnqualified(); - - ResourceTable table = myResourceTableDao.findById(id.getIdPartAsLong()).orElseThrow(IllegalArgumentException::new); - - TermCodeSystemVersion cs = new TermCodeSystemVersion(); - cs.setResource(table); - - TermConcept parentA = new TermConcept(cs, "CS2"); - cs.getConcepts().add(parentA); - - myTermCodeSystemStorageSvc.storeNewCodeSystemVersion(JpaPid.fromId(table.getId()), CS_URL_2, "SYSTEM NAME", "SYSTEM VERSION", cs, table); - - } - - private IIdType createCodeSystem3() { - CodeSystem codeSystem = new CodeSystem(); - codeSystem.setUrl(CS_URL_3); - codeSystem.setContent(CodeSystem.CodeSystemContentMode.NOTPRESENT); - codeSystem.setName("SYSTEM NAME 3"); - IIdType id = myCodeSystemDao.create(codeSystem, mySrd).getId().toUnqualified(); - - ResourceTable table = myResourceTableDao.findById(id.getIdPartAsLong()).orElseThrow(IllegalArgumentException::new); - - TermCodeSystemVersion cs = new TermCodeSystemVersion(); - cs.setResource(table); - - TermConcept parent; - parent = new TermConcept(cs, "ParentWithNoChildrenA"); - cs.getConcepts().add(parent); - parent = new TermConcept(cs, "ParentWithNoChildrenB"); - cs.getConcepts().add(parent); - parent = new TermConcept(cs, "ParentWithNoChildrenC"); - cs.getConcepts().add(parent); - - TermConcept parentA = new TermConcept(cs, "ParentA"); - cs.getConcepts().add(parentA); - - TermConcept childAA = new TermConcept(cs, "childAA"); - parentA.addChild(childAA, RelationshipTypeEnum.ISA); - - TermConcept childAAA = new TermConcept(cs, "childAAA"); - childAAA.addPropertyString("propA", "valueAAA"); - childAAA.addPropertyString("propB", "foo"); - childAA.addChild(childAAA, RelationshipTypeEnum.ISA); - - TermConcept childAAB = new TermConcept(cs, "childAAB"); - childAAB.addPropertyString("propA", "valueAAB"); - childAAB.addPropertyString("propB", "foo"); - childAAB.addDesignation() - .setLanguage("D1L") - .setUseSystem("D1S") - .setUseCode("D1C") - .setUseDisplay("D1D") - .setValue("D1V"); - childAA.addChild(childAAB, RelationshipTypeEnum.ISA); - - TermConcept childAAC = new TermConcept(cs, "childAAC"); - childAAC.addPropertyString("propA", "valueAAC"); - childAAC.addPropertyString("propB", "No IG exists"); - childAA.addChild(childAAC, RelationshipTypeEnum.ISA); - - TermConcept childAAD = new TermConcept(cs, "childAAD"); - childAAD.addPropertyString("propA", "valueAAD"); - childAAD.addPropertyString("propB", "IG exists"); - childAA.addChild(childAAD, RelationshipTypeEnum.ISA); - - // this one shouldn't come up in search result because searched argument is not in searched property (propB) but in propA - TermConcept childAAE = new TermConcept(cs, "childAAE"); - childAAE.addPropertyString("propA", "IG exists"); - childAAE.addPropertyString("propB", "valueAAE"); - childAA.addChild(childAAE, RelationshipTypeEnum.ISA); - - TermConcept childAB = new TermConcept(cs, "childAB"); - parentA.addChild(childAB, RelationshipTypeEnum.ISA); - - TermConcept parentB = new TermConcept(cs, "ParentB"); - cs.getConcepts().add(parentB); - - myTermCodeSystemStorageSvc.storeNewCodeSystemVersion(JpaPid.fromId(table.getId()), CS_URL, "SYSTEM NAME", null, cs, table); - - myTerminologyDeferredStorageSvc.saveAllDeferred(); - - return id; - } - - - private List toCodesContains(List theContains) { - List retVal = new ArrayList<>(); - - for (ValueSet.ValueSetExpansionContainsComponent next : theContains) { - retVal.add(next.getCode()); - } - - return retVal; - } - - - @Override - protected FhirContext getFhirContext() { - return myFhirContext; - } - - @Override - protected PlatformTransactionManager getTxManager() { - return myTxManager; - } } diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/Batch2JobHelper.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/Batch2JobHelper.java index c218b07ab23..0a5a8953392 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/Batch2JobHelper.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/Batch2JobHelper.java @@ -60,7 +60,7 @@ public class Batch2JobHelper { } public JobInstance awaitJobCompletion(Batch2JobStartResponse theStartResponse) { - return awaitJobCompletion(theStartResponse.getJobId()); + return awaitJobCompletion(theStartResponse.getInstanceId()); } public JobInstance awaitJobCompletion(String theBatchJobId) { @@ -140,7 +140,7 @@ public class Batch2JobHelper { } public JobInstance awaitJobFailure(Batch2JobStartResponse theStartResponse) { - return awaitJobFailure(theStartResponse.getJobId()); + return awaitJobFailure(theStartResponse.getInstanceId()); } public JobInstance awaitJobFailure(String theJobId) { diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/PatientReindexTestHelper.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/PatientReindexTestHelper.java index 03ae3953379..4b1135b7016 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/PatientReindexTestHelper.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/PatientReindexTestHelper.java @@ -81,7 +81,7 @@ public class PatientReindexTestHelper { // Reindex 1 JobInstanceStartRequest reindexRequest1 = createPatientReindexRequest(theNumResources); Batch2JobStartResponse reindexResponse1 = myJobCoordinator.startInstance(reindexRequest1); - JobInstance instance1 = myBatch2JobHelper.awaitJobHasStatus(reindexResponse1.getJobId(), JOB_WAIT_TIME, StatusEnum.COMPLETED); + JobInstance instance1 = myBatch2JobHelper.awaitJobHasStatus(reindexResponse1.getInstanceId(), JOB_WAIT_TIME, StatusEnum.COMPLETED); validateReindexJob(instance1, theNumResources); @@ -97,7 +97,7 @@ public class PatientReindexTestHelper { // Reindex 1 JobInstanceStartRequest reindexRequest1 = createPatientReindexRequest(theNumResources); Batch2JobStartResponse reindexResponse1 = myJobCoordinator.startInstance(reindexRequest1); - JobInstance instance1 = myBatch2JobHelper.awaitJobHasStatus(reindexResponse1.getJobId(), JOB_WAIT_TIME, StatusEnum.COMPLETED); + JobInstance instance1 = myBatch2JobHelper.awaitJobHasStatus(reindexResponse1.getInstanceId(), JOB_WAIT_TIME, StatusEnum.COMPLETED); validateReindexJob(instance1, theNumResources); int expectedVersion = myIncrementVersionOnReindex ? VERSION_2 : VERSION_1; @@ -106,7 +106,7 @@ public class PatientReindexTestHelper { // Reindex 2 JobInstanceStartRequest reindexRequest2 = createPatientReindexRequest(theNumResources); Batch2JobStartResponse reindexResponse2 = myJobCoordinator.startInstance(reindexRequest2); - JobInstance instance2 = myBatch2JobHelper.awaitJobHasStatus(reindexResponse2.getJobId(), JOB_WAIT_TIME, StatusEnum.COMPLETED); + JobInstance instance2 = myBatch2JobHelper.awaitJobHasStatus(reindexResponse2.getInstanceId(), JOB_WAIT_TIME, StatusEnum.COMPLETED); validateReindexJob(instance2, theNumResources); expectedVersion = myIncrementVersionOnReindex ? VERSION_3 : VERSION_1; @@ -127,8 +127,8 @@ public class PatientReindexTestHelper { Batch2JobStartResponse reindexResponse2 = myJobCoordinator.startInstance(reindexRequest2); // Wait for jobs to finish - JobInstance instance1 = myBatch2JobHelper.awaitJobHasStatus(reindexResponse1.getJobId(), JOB_WAIT_TIME, StatusEnum.COMPLETED); - JobInstance instance2 = myBatch2JobHelper.awaitJobHasStatus(reindexResponse2.getJobId(), JOB_WAIT_TIME, StatusEnum.COMPLETED); + JobInstance instance1 = myBatch2JobHelper.awaitJobHasStatus(reindexResponse1.getInstanceId(), JOB_WAIT_TIME, StatusEnum.COMPLETED); + JobInstance instance2 = myBatch2JobHelper.awaitJobHasStatus(reindexResponse2.getInstanceId(), JOB_WAIT_TIME, StatusEnum.COMPLETED); validateReindexJob(instance1, theNumResources); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/config/TestJPAConfig.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/config/TestJPAConfig.java index cf6e88363cb..621af0a380f 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/config/TestJPAConfig.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/config/TestJPAConfig.java @@ -23,12 +23,11 @@ package ca.uhn.fhir.jpa.test.config; import ca.uhn.fhir.batch2.api.IJobCoordinator; import ca.uhn.fhir.batch2.api.IJobMaintenanceService; import ca.uhn.fhir.batch2.api.IJobPersistence; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.config.ThreadPoolFactoryConfig; import ca.uhn.fhir.jpa.binary.api.IBinaryStorageSvc; import ca.uhn.fhir.jpa.binstore.MemoryBinaryStorageSvcImpl; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.searchparam.submit.config.SearchParamSubmitterConfig; import ca.uhn.fhir.jpa.subscription.channel.config.SubscriptionChannelConfig; import ca.uhn.fhir.jpa.subscription.match.config.SubscriptionProcessorConfig; @@ -59,8 +58,8 @@ import javax.persistence.EntityManagerFactory; }) public class TestJPAConfig { @Bean - public DaoConfig daoConfig() { - DaoConfig retVal = new DaoConfig(); + public JpaStorageSettings storageSettings() { + JpaStorageSettings retVal = new JpaStorageSettings(); if (HapiTestSystemProperties.isMassIngestionModeEnabled()) { retVal.setMassIngestionMode(true); @@ -74,12 +73,6 @@ public class TestJPAConfig { return new PartitionSettings(); } - @Bean - public ModelConfig modelConfig() { - ModelConfig config = daoConfig().getModelConfig(); - return config; - } - @Bean @Primary public JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) { diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/util/SubscriptionTestUtil.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/util/SubscriptionTestUtil.java index 316a1f72586..ef9943cae38 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/util/SubscriptionTestUtil.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/util/SubscriptionTestUtil.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.test.util; * #L% */ -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.cache.IResourceChangeListenerCacheRefresher; import ca.uhn.fhir.jpa.subscription.channel.impl.LinkedBlockingChannel; import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelRegistry; @@ -39,7 +39,7 @@ public class SubscriptionTestUtil { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SubscriptionTestUtil.class); @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Autowired private SubscriptionSubmitInterceptorLoader mySubscriptionSubmitInterceptorLoader; @Autowired @@ -72,22 +72,22 @@ public class SubscriptionTestUtil { } public void registerEmailInterceptor() { - myDaoConfig.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL); + myStorageSettings.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL); mySubscriptionSubmitInterceptorLoader.start(); } public void registerRestHookInterceptor() { - myDaoConfig.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); + myStorageSettings.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); mySubscriptionSubmitInterceptorLoader.start(); } public void registerWebSocketInterceptor() { - myDaoConfig.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET); + myStorageSettings.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET); mySubscriptionSubmitInterceptorLoader.start(); } public void unregisterSubscriptionInterceptor() { - myDaoConfig.clearSupportedSubscriptionTypesForUnitTest(); + myStorageSettings.clearSupportedSubscriptionTypesForUnitTest(); mySubscriptionSubmitInterceptorLoader.unregisterInterceptorsForUnitTest(); } diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/util/WebsocketSubscriptionClient.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/util/WebsocketSubscriptionClient.java index 73c737a9ee9..3dbc3d102ce 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/util/WebsocketSubscriptionClient.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/util/WebsocketSubscriptionClient.java @@ -20,8 +20,7 @@ package ca.uhn.fhir.jpa.util; * #L% */ -import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.subscription.SocketImplementation; import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; @@ -43,19 +42,19 @@ import java.util.function.Supplier; public class WebsocketSubscriptionClient implements AfterEachCallback { private static final Logger ourLog = LoggerFactory.getLogger(WebsocketSubscriptionClient.class); private final Supplier myServerSupplier; - private final Supplier myModelConfig; + private final Supplier myStorageSettings; private WebSocketClient myWebSocketClient; private SocketImplementation mySocketImplementation; /** * Constructor */ - public WebsocketSubscriptionClient(Supplier theServerSupplier, Supplier theModelConfig) { + public WebsocketSubscriptionClient(Supplier theServerSupplier, Supplier theStorageSettings) { assert theServerSupplier != null; - assert theModelConfig != null; + assert theStorageSettings != null; myServerSupplier = theServerSupplier; - myModelConfig = theModelConfig; + myStorageSettings = theStorageSettings; } public void bind(String theSubscriptionId) { @@ -70,7 +69,7 @@ public class WebsocketSubscriptionClient implements AfterEachCallback { try { myWebSocketClient.start(); - URI echoUri = new URI("ws://localhost:" + server.getPort() + server.getWebsocketContextPath() + myModelConfig.get().getWebsocketContextPath()); + URI echoUri = new URI("ws://localhost:" + server.getPort() + server.getWebsocketContextPath() + myStorageSettings.get().getWebsocketContextPath()); ClientUpgradeRequest request = new ClientUpgradeRequest(); ourLog.info("Connecting to : {}", echoUri); diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/DaoConfigTest.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/JpaStorageSettingsTest.java similarity index 60% rename from hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/DaoConfigTest.java rename to hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/JpaStorageSettingsTest.java index ca962fafd09..3268e1db79a 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/DaoConfigTest.java +++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/JpaStorageSettingsTest.java @@ -1,34 +1,35 @@ package ca.uhn.fhir.jpa.dao; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.system.HapiSystemProperties; import org.junit.jupiter.api.Test; import java.util.Arrays; import java.util.HashSet; +import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; -public class DaoConfigTest { +public class JpaStorageSettingsTest { @Test public void testValidLogicalPattern() { - new DaoConfig().setTreatBaseUrlsAsLocal(new HashSet(Arrays.asList("http://foo"))); - new DaoConfig().setTreatBaseUrlsAsLocal(new HashSet(Arrays.asList("http://foo*"))); + new JpaStorageSettings().setTreatBaseUrlsAsLocal(new HashSet<>(List.of("http://foo"))); + new JpaStorageSettings().setTreatBaseUrlsAsLocal(new HashSet<>(List.of("http://foo*"))); } @Test public void testInvalidLogicalPattern() { try { - new DaoConfig().setTreatBaseUrlsAsLocal(new HashSet(Arrays.asList("http://*foo"))); + new JpaStorageSettings().setTreatBaseUrlsAsLocal(new HashSet<>(List.of("http://*foo"))); fail(); } catch (IllegalArgumentException e) { assertEquals(Msg.code(1525) + "Base URL wildcard character (*) can only appear at the end of the string: http://*foo", e.getMessage()); } try { - new DaoConfig().setTreatBaseUrlsAsLocal(new HashSet(Arrays.asList("http://foo**"))); + new JpaStorageSettings().setTreatBaseUrlsAsLocal(new HashSet<>(List.of("http://foo**"))); fail(); } catch (IllegalArgumentException e) { assertEquals(Msg.code(1525) + "Base URL wildcard character (*) can only appear at the end of the string: http://foo**", e.getMessage()); @@ -37,9 +38,9 @@ public class DaoConfigTest { @Test public void testDisableStatusBasedReindexUsingSystemProperty() { - assertEquals(false, new DaoConfig().isStatusBasedReindexingDisabled()); + assertEquals(false, new JpaStorageSettings().isStatusBasedReindexingDisabled()); HapiSystemProperties.disableStatusBasedReindex(); - assertEquals(true, new DaoConfig().isStatusBasedReindexingDisabled()); + assertEquals(true, new JpaStorageSettings().isStatusBasedReindexingDisabled()); HapiSystemProperties.enableStatusBasedReindex(); } diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/expunge/PartitionRunnerTest.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/expunge/PartitionRunnerTest.java index 439ca02fb52..4fa1dcf9ad3 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/expunge/PartitionRunnerTest.java +++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/expunge/PartitionRunnerTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.expunge; import ca.uhn.fhir.interceptor.api.HookParams; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.dao.JpaPid; import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId; import ca.uhn.test.concurrency.PointcutLatch; @@ -45,7 +45,7 @@ public class PartitionRunnerTest { } private PartitionRunner getPartitionRunner() { - return getPartitionRunner(DaoConfig.DEFAULT_EXPUNGE_BATCH_SIZE); + return getPartitionRunner(JpaStorageSettings.DEFAULT_EXPUNGE_BATCH_SIZE); } private PartitionRunner getPartitionRunner(int theBatchSize) { diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4StandardQueriesLuceneTest.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4StandardQueriesLuceneTest.java index f80dcb6e867..24ea7a6fd3f 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4StandardQueriesLuceneTest.java +++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4StandardQueriesLuceneTest.java @@ -1,7 +1,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.TestDaoSearch; import ca.uhn.fhir.jpa.search.CompositeSearchParameterTestCases; @@ -44,13 +44,13 @@ public class FhirResourceDaoR4StandardQueriesLuceneTest extends BaseJpaTest { // todo mb create an extension to restore via clone or xstream + BeanUtils.copyProperties(). @BeforeEach void setUp() { - myDaoConfig.setAdvancedHSearchIndexing(true); + myStorageSettings.setAdvancedHSearchIndexing(true); } @AfterEach void tearDown() { - DaoConfig defaultConfig = new DaoConfig(); - myDaoConfig.setAdvancedHSearchIndexing(defaultConfig.isAdvancedHSearchIndexing()); + JpaStorageSettings defaultConfig = new JpaStorageSettings(); + myStorageSettings.setAdvancedHSearchIndexing(defaultConfig.isAdvancedHSearchIndexing()); } @Override @@ -74,7 +74,7 @@ public class FhirResourceDaoR4StandardQueriesLuceneTest extends BaseJpaTest { @Nested class QuantityAndNormalizedQuantitySearch extends QuantitySearchParameterTestCases { QuantityAndNormalizedQuantitySearch() { - super(myDataBuilder, myTestDaoSearch, myDaoConfig); + super(myDataBuilder, myTestDaoSearch, myStorageSettings); } } diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchIndexExtractorTest.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchIndexExtractorTest.java index 933c1a71c30..a802be7402d 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchIndexExtractorTest.java +++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchIndexExtractorTest.java @@ -1,10 +1,9 @@ package ca.uhn.fhir.jpa.dao.search; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.config.PartitionSettings; import ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParam; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantity; import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken; @@ -31,10 +30,9 @@ import static org.hamcrest.Matchers.hasSize; class ExtendedHSearchIndexExtractorTest implements ITestDataBuilder.WithSupport { FhirContext myFhirContext = FhirContext.forR4Cached(); - DaoConfig myDaoConfig = new DaoConfig(); - ModelConfig myModelConfig = new ModelConfig(); + JpaStorageSettings myJpaStorageSettings = new JpaStorageSettings(); FhirContextSearchParamRegistry mySearchParamRegistry = new FhirContextSearchParamRegistry(myFhirContext); - SearchParamExtractorR4 mySearchParamExtractor = new SearchParamExtractorR4(myModelConfig, new PartitionSettings(), myFhirContext, mySearchParamRegistry); + SearchParamExtractorR4 mySearchParamExtractor = new SearchParamExtractorR4(myJpaStorageSettings, new PartitionSettings(), myFhirContext, mySearchParamRegistry); @Test @@ -56,7 +54,7 @@ class ExtendedHSearchIndexExtractorTest implements ITestDataBuilder.WithSupport // run: now translate to HSearch ResourceSearchParams activeSearchParams = mySearchParamRegistry.getActiveSearchParams("Observation"); ExtendedHSearchIndexExtractor extractor = new ExtendedHSearchIndexExtractor( - myDaoConfig, myFhirContext, activeSearchParams, mySearchParamExtractor, myModelConfig); + myJpaStorageSettings, myFhirContext, activeSearchParams, mySearchParamExtractor); ExtendedHSearchIndexData indexData = extractor.extract(new Observation(), extractedParams); // validate @@ -72,14 +70,14 @@ class ExtendedHSearchIndexExtractorTest implements ITestDataBuilder.WithSupport searchParamDate.setMissing(true); searchParams.myDateParams.add(searchParamDate); - ResourceIndexedSearchParamQuantity searchParamQuantity = new ResourceIndexedSearchParamQuantity(new PartitionSettings(), "SearchParameter","Quantity", null, null,null); + ResourceIndexedSearchParamQuantity searchParamQuantity = new ResourceIndexedSearchParamQuantity(new PartitionSettings(), "SearchParameter", "Quantity", null, null, null); searchParamQuantity.setMissing(true); searchParams.myQuantityParams.add(searchParamQuantity); // run: now translate to HSearch ResourceSearchParams activeSearchParams = mySearchParamRegistry.getActiveSearchParams("Patient"); ExtendedHSearchIndexExtractor extractor = new ExtendedHSearchIndexExtractor( - myDaoConfig, myFhirContext, activeSearchParams, mySearchParamExtractor, myModelConfig); + myJpaStorageSettings, myFhirContext, activeSearchParams, mySearchParamExtractor); ExtendedHSearchIndexData indexData = extractor.extract(new SearchParameter(), searchParams); // validate diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/delete/DeleteConflictServiceTest.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/delete/DeleteConflictServiceTest.java index 688aec5ee6a..f9a70508c29 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/delete/DeleteConflictServiceTest.java +++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/delete/DeleteConflictServiceTest.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.delete; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.DeleteConflictList; import ca.uhn.fhir.jpa.dao.data.IResourceLinkDao; import ca.uhn.fhir.jpa.model.config.PartitionSettings; @@ -68,8 +68,8 @@ public class DeleteConflictServiceTest { } @Bean - DaoConfig myDaoConfig() { - return new DaoConfig(); + JpaStorageSettings storageSettings() { + return new JpaStorageSettings(); } @Bean diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/builder/sql/BaseSearchQueryBuilderDialectTest.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/builder/sql/BaseSearchQueryBuilderDialectTest.java index aae795957b2..2546214bec9 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/builder/sql/BaseSearchQueryBuilderDialectTest.java +++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/builder/sql/BaseSearchQueryBuilderDialectTest.java @@ -4,7 +4,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.config.HibernatePropertiesProvider; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.search.builder.predicate.BaseJoiningPredicateBuilder; import ca.uhn.fhir.jpa.search.builder.predicate.DatePredicateBuilder; import ca.uhn.fhir.jpa.search.builder.predicate.ResourceTablePredicateBuilder; @@ -41,7 +41,7 @@ public abstract class BaseSearchQueryBuilderDialectTest { protected abstract Dialect createDialect(); protected SearchQueryBuilder createSearchQueryBuilder() { - return new SearchQueryBuilder(myFhirContext, new ModelConfig(), new PartitionSettings(), RequestPartitionId.allPartitions(), "Patient", mySqlObjectFactory, myHibernatePropertiesProvider, false); + return new SearchQueryBuilder(myFhirContext, new StorageSettings(), new PartitionSettings(), RequestPartitionId.allPartitions(), "Patient", mySqlObjectFactory, myHibernatePropertiesProvider, false); } protected GeneratedSql buildSqlWithNumericSort(Boolean theAscending, OrderObject.NullOrder theNullOrder) { diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryBuilderDialectPostgresTest.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryBuilderDialectPostgresTest.java index c96692af2c9..07eca1057f3 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryBuilderDialectPostgresTest.java +++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryBuilderDialectPostgresTest.java @@ -1,27 +1,20 @@ package ca.uhn.fhir.jpa.search.builder.sql; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.dao.predicate.SearchFilterParser; -import ca.uhn.fhir.jpa.search.builder.predicate.BaseJoiningPredicateBuilder; import ca.uhn.fhir.jpa.search.builder.predicate.DatePredicateBuilder; -import ca.uhn.fhir.jpa.search.builder.predicate.ResourceTablePredicateBuilder; import ca.uhn.fhir.rest.param.DateParam; -import ca.uhn.fhir.rest.param.DateRangeParam; import com.healthmarketscience.sqlbuilder.Condition; import org.apache.commons.lang3.StringUtils; import org.hibernate.dialect.Dialect; import org.hibernate.dialect.PostgreSQL10Dialect; -import org.hibernate.dialect.PostgreSQL95Dialect; -import org.hibernate.dialect.SQLServer2012Dialect; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; import javax.annotation.Nonnull; -import java.util.Locale; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; @@ -34,14 +27,14 @@ public class SearchQueryBuilderDialectPostgresTest extends BaseSearchQueryBuilde */ @Test public void testOrdinalSearchesUseIntegerParameters() { - DaoConfig daoConfig = new DaoConfig(); - daoConfig.getModelConfig().setUseOrdinalDatesForDayPrecisionSearches(true); + JpaStorageSettings storageSettings = new JpaStorageSettings(); + storageSettings.setUseOrdinalDatesForDayPrecisionSearches(true); SearchQueryBuilder searchQueryBuilder = createSearchQueryBuilder(); when(mySqlObjectFactory.dateIndexTable(any())).thenReturn(new DatePredicateBuilder(searchQueryBuilder)); DatePredicateBuilder datePredicateBuilder = searchQueryBuilder.addDatePredicateBuilder(null); - datePredicateBuilder.setDaoConfigForUnitTest(daoConfig); + datePredicateBuilder.setStorageSettingsForUnitTest(storageSettings); Condition datePredicate = datePredicateBuilder.createPredicateDateWithoutIdentityPredicate(new DateParam("2022"), SearchFilterParser.CompareOperation.eq); Condition comboPredicate = datePredicateBuilder.combineWithHashIdentityPredicate("Observation", "date", datePredicate); diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryBuilderTest.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryBuilderTest.java index 2686e61ddfa..8821649c729 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryBuilderTest.java +++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryBuilderTest.java @@ -4,7 +4,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.config.HibernatePropertiesProvider; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.search.builder.predicate.ResourceTablePredicateBuilder; import com.google.common.collect.Lists; import org.hibernate.dialect.DerbyTenSevenDialect; @@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; public class SearchQueryBuilderTest { private FhirContext myFhirContext; - private ModelConfig myModelConfig; + private StorageSettings myStorageSettings; private PartitionSettings myPartitionSettings; private RequestPartitionId myRequestPartitionId; @@ -45,7 +45,7 @@ public class SearchQueryBuilderTest { @BeforeEach public void before() { myFhirContext = FhirContext.forR4Cached(); - myModelConfig = new ModelConfig(); + myStorageSettings = new StorageSettings(); myPartitionSettings = new PartitionSettings(); myRequestPartitionId = RequestPartitionId.allPartitions(); } @@ -55,7 +55,7 @@ public class SearchQueryBuilderTest { HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider(); dialectProvider.setDialectForUnitTest(new SQLServer2005Dialect()); - SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myModelConfig, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); + SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); builder.addResourceIdsPredicate(Lists.newArrayList(500L, 501L)); GeneratedSql generated; @@ -81,7 +81,7 @@ public class SearchQueryBuilderTest { HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider(); dialectProvider.setDialectForUnitTest(new SQLServer2005Dialect()); - SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myModelConfig, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); + SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); builder.addResourceIdsPredicate(Lists.newArrayList(500L, 501L)); builder.addSortDate(builder.getOrCreateResourceTablePredicateBuilder().getColumnLastUpdated(), true); GeneratedSql generated; @@ -112,7 +112,7 @@ public class SearchQueryBuilderTest { HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider(); dialectProvider.setDialectForUnitTest(new SQLServer2012Dialect()); - SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myModelConfig, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); + SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); builder.addResourceIdsPredicate(Lists.newArrayList(500L, 501L)); GeneratedSql generated; @@ -138,7 +138,7 @@ public class SearchQueryBuilderTest { HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider(); dialectProvider.setDialectForUnitTest(new SQLServer2012Dialect()); - SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myModelConfig, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); + SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); builder.addResourceIdsPredicate(Lists.newArrayList(500L, 501L)); builder.addSortDate(builder.getOrCreateResourceTablePredicateBuilder().getColumnLastUpdated(), true); GeneratedSql generated; @@ -168,7 +168,7 @@ public class SearchQueryBuilderTest { HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider(); dialectProvider.setDialectForUnitTest(new PostgreSQL95Dialect()); - SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myModelConfig, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); + SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); builder.addResourceIdsPredicate(Lists.newArrayList(500L, 501L)); GeneratedSql generated; @@ -194,7 +194,7 @@ public class SearchQueryBuilderTest { HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider(); dialectProvider.setDialectForUnitTest(new PostgreSQL95Dialect()); - SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myModelConfig, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); + SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); builder.addResourceIdsPredicate(Lists.newArrayList(500L, 501L)); builder.addSortDate(builder.getOrCreateResourceTablePredicateBuilder().getColumnLastUpdated(), true); GeneratedSql generated; @@ -221,7 +221,7 @@ public class SearchQueryBuilderTest { HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider(); dialectProvider.setDialectForUnitTest(new Oracle12cDialect()); - SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myModelConfig, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); + SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); builder.addResourceIdsPredicate(Lists.newArrayList(500L, 501L)); GeneratedSql generated; @@ -247,7 +247,7 @@ public class SearchQueryBuilderTest { HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider(); dialectProvider.setDialectForUnitTest(new Oracle12cDialect()); - SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myModelConfig, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); + SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); builder.addResourceIdsPredicate(Lists.newArrayList(500L, 501L)); builder.addSortDate(builder.getOrCreateResourceTablePredicateBuilder().getColumnLastUpdated(), true); GeneratedSql generated; @@ -274,7 +274,7 @@ public class SearchQueryBuilderTest { HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider(); dialectProvider.setDialectForUnitTest(new MySQL8Dialect()); - SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myModelConfig, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); + SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); builder.addResourceIdsPredicate(Lists.newArrayList(500L, 501L)); GeneratedSql generated; @@ -300,7 +300,7 @@ public class SearchQueryBuilderTest { HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider(); dialectProvider.setDialectForUnitTest(new MySQL8Dialect()); - SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myModelConfig, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); + SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); builder.addResourceIdsPredicate(Lists.newArrayList(500L, 501L)); builder.addSortDate(builder.getOrCreateResourceTablePredicateBuilder().getColumnLastUpdated(), true); GeneratedSql generated; @@ -331,7 +331,7 @@ public class SearchQueryBuilderTest { HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider(); dialectProvider.setDialectForUnitTest(new MariaDB103Dialect()); - SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myModelConfig, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); + SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); builder.addResourceIdsPredicate(Lists.newArrayList(500L, 501L)); GeneratedSql generated; @@ -357,7 +357,7 @@ public class SearchQueryBuilderTest { HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider(); dialectProvider.setDialectForUnitTest(new MariaDB103Dialect()); - SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myModelConfig, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); + SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); builder.addResourceIdsPredicate(Lists.newArrayList(500L, 501L)); builder.addSortDate(builder.getOrCreateResourceTablePredicateBuilder().getColumnLastUpdated(), true); GeneratedSql generated; @@ -388,7 +388,7 @@ public class SearchQueryBuilderTest { HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider(); dialectProvider.setDialectForUnitTest(new DerbyTenSevenDialect()); - SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myModelConfig, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); + SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); builder.addResourceIdsPredicate(Lists.newArrayList(500L, 501L)); GeneratedSql generated; @@ -414,7 +414,7 @@ public class SearchQueryBuilderTest { HibernatePropertiesProvider dialectProvider = new HibernatePropertiesProvider(); dialectProvider.setDialectForUnitTest(new DerbyTenSevenDialect()); - SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myModelConfig, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); + SearchQueryBuilder builder = new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, "Patient", mySqlBuilderFactory, dialectProvider, false); builder.addResourceIdsPredicate(Lists.newArrayList(500L, 501L)); builder.addSortDate(builder.getOrCreateResourceTablePredicateBuilder().getColumnLastUpdated(), true); GeneratedSql generated; diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/util/MemoryCacheServiceTest.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/util/MemoryCacheServiceTest.java index 167ae699814..bdeef89e89e 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/util/MemoryCacheServiceTest.java +++ b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/util/MemoryCacheServiceTest.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.jpa.util; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.entity.TagDefinition; import ca.uhn.fhir.jpa.model.entity.TagTypeEnum; import ca.uhn.fhir.sl.cache.Cache; @@ -37,9 +37,9 @@ class MemoryCacheServiceTest { @BeforeEach public void setUp() { - DaoConfig daoConfig = new DaoConfig(); - daoConfig.setMassIngestionMode(false); - mySvc = new MemoryCacheService(daoConfig); + JpaStorageSettings storageSettings = new JpaStorageSettings(); + storageSettings.setMassIngestionMode(false); + mySvc = new MemoryCacheService(storageSettings); } @Test diff --git a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml index 15479158e12..a1af87d765d 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml +++ b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java index f1eb9ff5465..e86a90d65dd 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java @@ -5,7 +5,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.bulk.export.provider.BulkDataExportProvider; @@ -116,7 +116,7 @@ public class TestRestfulServer extends RestfulServer { beans = myAppCtx.getBean("myResourceProvidersDstu2", ResourceProviderFactory.class); systemDao = myAppCtx.getBean("mySystemDaoDstu2", IFhirSystemDao.class); etagSupport = ETagSupportEnum.ENABLED; - JpaConformanceProviderDstu2 confProvider = new JpaConformanceProviderDstu2(this, systemDao, myAppCtx.getBean(DaoConfig.class)); + JpaConformanceProviderDstu2 confProvider = new JpaConformanceProviderDstu2(this, systemDao, myAppCtx.getBean(JpaStorageSettings.class)); setServerConformanceProvider(confProvider); break; } @@ -131,7 +131,7 @@ public class TestRestfulServer extends RestfulServer { beans = myAppCtx.getBean("myResourceProvidersDstu3", ResourceProviderFactory.class); systemDao = myAppCtx.getBean("mySystemDaoDstu3", IFhirSystemDao.class); etagSupport = ETagSupportEnum.ENABLED; - JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(this, systemDao, myAppCtx.getBean(DaoConfig.class), myAppCtx.getBean(ISearchParamRegistry.class)); + JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(this, systemDao, myAppCtx.getBean(JpaStorageSettings.class), myAppCtx.getBean(ISearchParamRegistry.class)); setServerConformanceProvider(confProvider); providers.add(myAppCtx.getBean(TerminologyUploaderProvider.class)); providers.add(myAppCtx.getBean(GraphQLProvider.class)); @@ -149,7 +149,7 @@ public class TestRestfulServer extends RestfulServer { systemDao = myAppCtx.getBean("mySystemDaoR4", IFhirSystemDao.class); etagSupport = ETagSupportEnum.ENABLED; IValidationSupport validationSupport = myAppCtx.getBean(IValidationSupport.class); - JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(this, systemDao, myAppCtx.getBean(DaoConfig.class), myAppCtx.getBean(ISearchParamRegistry.class), validationSupport); + JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(this, systemDao, myAppCtx.getBean(JpaStorageSettings.class), myAppCtx.getBean(ISearchParamRegistry.class), validationSupport); setServerConformanceProvider(confProvider); providers.add(myAppCtx.getBean(TerminologyUploaderProvider.class)); providers.add(myAppCtx.getBean(GraphQLProvider.class)); @@ -168,7 +168,7 @@ public class TestRestfulServer extends RestfulServer { systemDao = myAppCtx.getBean("mySystemDaoR4B", IFhirSystemDao.class); etagSupport = ETagSupportEnum.ENABLED; IValidationSupport validationSupport = myAppCtx.getBean(IValidationSupport.class); - JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(this, systemDao, myAppCtx.getBean(DaoConfig.class), myAppCtx.getBean(ISearchParamRegistry.class), validationSupport); + JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(this, systemDao, myAppCtx.getBean(JpaStorageSettings.class), myAppCtx.getBean(ISearchParamRegistry.class), validationSupport); setServerConformanceProvider(confProvider); providers.add(myAppCtx.getBean(TerminologyUploaderProvider.class)); providers.add(myAppCtx.getBean(GraphQLProvider.class)); @@ -186,7 +186,7 @@ public class TestRestfulServer extends RestfulServer { systemDao = myAppCtx.getBean("mySystemDaoR5", IFhirSystemDao.class); etagSupport = ETagSupportEnum.ENABLED; IValidationSupport validationSupport = myAppCtx.getBean(IValidationSupport.class); - JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(this, systemDao, myAppCtx.getBean(DaoConfig.class), myAppCtx.getBean(ISearchParamRegistry.class), validationSupport); + JpaCapabilityStatementProvider confProvider = new JpaCapabilityStatementProvider(this, systemDao, myAppCtx.getBean(JpaStorageSettings.class), myAppCtx.getBean(ISearchParamRegistry.class), validationSupport); setServerConformanceProvider(confProvider); providers.add(myAppCtx.getBean(TerminologyUploaderProvider.class)); providers.add(myAppCtx.getBean(GraphQLProvider.class)); diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu2Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu2Config.java index 3b929394a1e..9cc7b540f9a 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu2Config.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu2Config.java @@ -1,13 +1,12 @@ package ca.uhn.fhirtest.config; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.config.HapiJpaConfig; import ca.uhn.fhir.jpa.config.JpaDstu2Config; import ca.uhn.fhir.jpa.config.util.HapiEntityManagerFactoryUtil; import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect; import ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.search.HapiHSearchAnalysisConfigurers; import ca.uhn.fhir.jpa.util.CurrentThreadCaptureQueriesListener; import ca.uhn.fhir.jpa.validation.ValidationSettings; @@ -55,8 +54,8 @@ public class TestDstu2Config { } @Bean - public DaoConfig daoConfig() { - DaoConfig retVal = new DaoConfig(); + public JpaStorageSettings storageSettings() { + JpaStorageSettings retVal = new JpaStorageSettings(); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET); @@ -70,20 +69,14 @@ public class TestDstu2Config { retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/baseDstu2"); retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/baseDstu2"); retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO); - retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + retVal.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); retVal.setFetchSizeDefaultMaximum(10000); retVal.setWebsocketContextPath("/"); retVal.setFilterParameterEnabled(true); retVal.setDefaultSearchParamsCanBeOverridden(false); - retVal.getModelConfig().setIndexOnContainedResources(true); -// retVal.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); - return retVal; - } - - @Bean - public ModelConfig modelConfig() { - ModelConfig retVal = daoConfig().getModelConfig(); + retVal.setIndexOnContainedResources(true); retVal.setIndexIdentifierOfType(true); +// retVal.setHistoryCountMode(HistoryCountModeEnum.COUNT_ACCURATE); return retVal; } diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu3Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu3Config.java index 57ce001ba9f..115f1df3790 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu3Config.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestDstu3Config.java @@ -1,13 +1,12 @@ package ca.uhn.fhirtest.config; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.config.HapiJpaConfig; import ca.uhn.fhir.jpa.config.dstu3.JpaDstu3Config; import ca.uhn.fhir.jpa.config.util.HapiEntityManagerFactoryUtil; import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect; import ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.HapiHSearchAnalysisConfigurers; import ca.uhn.fhir.jpa.util.CurrentThreadCaptureQueriesListener; @@ -50,8 +49,8 @@ public class TestDstu3Config { private String myFhirLuceneLocation = System.getProperty(FHIR_LUCENE_LOCATION_DSTU3); @Bean - public DaoConfig daoConfig() { - DaoConfig retVal = new DaoConfig(); + public JpaStorageSettings storageSettings() { + JpaStorageSettings retVal = new JpaStorageSettings(); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET); @@ -65,24 +64,17 @@ public class TestDstu3Config { retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/baseDstu3"); retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/baseDstu3"); retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO); - retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + retVal.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); retVal.setFetchSizeDefaultMaximum(10000); retVal.setReindexThreadCount(1); retVal.setExpungeEnabled(true); retVal.setFilterParameterEnabled(true); retVal.setDefaultSearchParamsCanBeOverridden(false); - retVal.getModelConfig().setIndexOnContainedResources(true); - return retVal; - } - - @Bean - public ModelConfig modelConfig() { - ModelConfig retVal = daoConfig().getModelConfig(); + retVal.setIndexOnContainedResources(true); retVal.setIndexIdentifierOfType(true); return retVal; } - @Bean public ValidationSettings validationSettings() { ValidationSettings retVal = new ValidationSettings(); diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4BConfig.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4BConfig.java index 46049347eca..c79bcfe0989 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4BConfig.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4BConfig.java @@ -1,13 +1,12 @@ package ca.uhn.fhirtest.config; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.config.HapiJpaConfig; import ca.uhn.fhir.jpa.config.r4b.JpaR4BConfig; import ca.uhn.fhir.jpa.config.util.HapiEntityManagerFactoryUtil; import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect; import ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.HapiHSearchAnalysisConfigurers; import ca.uhn.fhir.jpa.util.CurrentThreadCaptureQueriesListener; @@ -54,8 +53,8 @@ public class TestR4BConfig { private String myFhirLuceneLocation = System.getProperty(FHIR_LUCENE_LOCATION_R4B); @Bean - public DaoConfig daoConfig() { - DaoConfig retVal = new DaoConfig(); + public JpaStorageSettings storageSettings() { + JpaStorageSettings retVal = new JpaStorageSettings(); retVal.setAllowContainsSearches(true); retVal.setAllowMultipleDelete(true); retVal.setAllowInlineMatchUrlReferences(true); @@ -64,19 +63,13 @@ public class TestR4BConfig { retVal.getTreatBaseUrlsAsLocal().add("https://hapi.fhir.org/baseR4B"); retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/baseR4B"); retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/baseR4B"); - retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + retVal.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); retVal.setCountSearchResultsUpTo(TestR4BConfig.COUNT_SEARCH_RESULTS_UP_TO); retVal.setFetchSizeDefaultMaximum(10000); retVal.setExpungeEnabled(true); retVal.setFilterParameterEnabled(true); retVal.setDefaultSearchParamsCanBeOverridden(false); - retVal.getModelConfig().setIndexOnContainedResources(true); - return retVal; - } - - @Bean - public ModelConfig modelConfig() { - ModelConfig retVal = daoConfig().getModelConfig(); + retVal.setIndexOnContainedResources(true); retVal.setIndexIdentifierOfType(true); return retVal; } diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java index 2eb94a15a68..68e666b6c12 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java @@ -1,7 +1,7 @@ package ca.uhn.fhirtest.config; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.config.HapiJpaConfig; import ca.uhn.fhir.jpa.config.r4.JpaR4Config; @@ -13,7 +13,6 @@ import ca.uhn.fhir.jpa.ips.provider.IpsOperationProvider; import ca.uhn.fhir.jpa.ips.strategy.DefaultIpsGenerationStrategy; import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect; import ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.HapiHSearchAnalysisConfigurers; import ca.uhn.fhir.jpa.util.CurrentThreadCaptureQueriesListener; @@ -57,8 +56,8 @@ public class TestR4Config { private String myFhirLuceneLocation = System.getProperty(FHIR_LUCENE_LOCATION_R4); @Bean - public DaoConfig daoConfig() { - DaoConfig retVal = new DaoConfig(); + public JpaStorageSettings storageSettings() { + JpaStorageSettings retVal = new JpaStorageSettings(); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET); @@ -71,24 +70,17 @@ public class TestR4Config { retVal.getTreatBaseUrlsAsLocal().add("https://hapi.fhir.org/baseR4"); retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/baseR4"); retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/baseR4"); - retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + retVal.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO); retVal.setFetchSizeDefaultMaximum(10000); retVal.setExpungeEnabled(true); retVal.setFilterParameterEnabled(true); retVal.setDefaultSearchParamsCanBeOverridden(false); - retVal.getModelConfig().setIndexOnContainedResources(true); - return retVal; - } - - @Bean - public ModelConfig modelConfig() { - ModelConfig retVal = daoConfig().getModelConfig(); + retVal.setIndexOnContainedResources(true); retVal.setIndexIdentifierOfType(true); return retVal; } - @Bean public ValidationSettings validationSettings() { ValidationSettings retVal = new ValidationSettings(); diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR5Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR5Config.java index 6dd2d4edc31..a2beaf096f6 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR5Config.java +++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR5Config.java @@ -1,13 +1,12 @@ package ca.uhn.fhirtest.config; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.config.HapiJpaConfig; import ca.uhn.fhir.jpa.config.r5.JpaR5Config; import ca.uhn.fhir.jpa.config.util.HapiEntityManagerFactoryUtil; import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect; import ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgres94Dialect; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.HapiHSearchAnalysisConfigurers; import ca.uhn.fhir.jpa.util.CurrentThreadCaptureQueriesListener; @@ -55,8 +54,8 @@ public class TestR5Config { private String myFhirLuceneLocation = System.getProperty(FHIR_LUCENE_LOCATION_R5); @Bean - public DaoConfig daoConfig() { - DaoConfig retVal = new DaoConfig(); + public JpaStorageSettings storageSettings() { + JpaStorageSettings retVal = new JpaStorageSettings(); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.EMAIL); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.RESTHOOK); retVal.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.WEBSOCKET); @@ -69,19 +68,13 @@ public class TestR5Config { retVal.getTreatBaseUrlsAsLocal().add("https://hapi.fhir.org/baseR5"); retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/baseR5"); retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/baseR5"); - retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); + retVal.setIndexMissingFields(JpaStorageSettings.IndexEnabledEnum.ENABLED); retVal.setCountSearchResultsUpTo(TestR5Config.COUNT_SEARCH_RESULTS_UP_TO); retVal.setFetchSizeDefaultMaximum(10000); retVal.setExpungeEnabled(true); retVal.setFilterParameterEnabled(true); retVal.setDefaultSearchParamsCanBeOverridden(false); - retVal.getModelConfig().setIndexOnContainedResources(true); - return retVal; - } - - @Bean - public ModelConfig modelConfig() { - ModelConfig retVal = daoConfig().getModelConfig(); + retVal.setIndexOnContainedResources(true); retVal.setIndexIdentifierOfType(true); return retVal; } diff --git a/hapi-fhir-server-mdm/pom.xml b/hapi-fhir-server-mdm/pom.xml index 1d3328549a1..94fb2076ff4 100644 --- a/hapi-fhir-server-mdm/pom.xml +++ b/hapi-fhir-server-mdm/pom.xml @@ -7,7 +7,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/interceptor/MdmSearchExpandingInterceptor.java b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/interceptor/MdmSearchExpandingInterceptor.java index eb2d2720fe3..20f6d58b8f1 100644 --- a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/interceptor/MdmSearchExpandingInterceptor.java +++ b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/interceptor/MdmSearchExpandingInterceptor.java @@ -23,7 +23,7 @@ package ca.uhn.fhir.mdm.interceptor; import ca.uhn.fhir.interceptor.api.Hook; import ca.uhn.fhir.interceptor.api.Interceptor; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.mdm.api.IMdmLinkExpandSvc; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.mdm.log.Logs; @@ -57,11 +57,11 @@ public class MdmSearchExpandingInterceptor { private IMdmLinkExpandSvc myMdmLinkExpandSvc; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Hook(Pointcut.STORAGE_PRESEARCH_REGISTERED) public void hook(SearchParameterMap theSearchParameterMap) { - if (myDaoConfig.isAllowMdmExpansion()) { + if (myStorageSettings.isAllowMdmExpansion()) { for (Map.Entry>> set : theSearchParameterMap.entrySet()) { String paramName = set.getKey(); List> andList = set.getValue(); diff --git a/hapi-fhir-server-openapi/pom.xml b/hapi-fhir-server-openapi/pom.xml index 5f42e456352..36a2bc32d24 100644 --- a/hapi-fhir-server-openapi/pom.xml +++ b/hapi-fhir-server-openapi/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-server/pom.xml b/hapi-fhir-server/pom.xml index ecd919eecd3..e1622f46811 100644 --- a/hapi-fhir-server/pom.xml +++ b/hapi-fhir-server/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/IRestfulServerDefaults.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/IRestfulServerDefaults.java index 4fb66e528aa..b520fff097b 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/IRestfulServerDefaults.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/IRestfulServerDefaults.java @@ -75,7 +75,7 @@ public interface IRestfulServerDefaults { IPagingProvider getPagingProvider(); /** - * Default page size for searches. Null means no limit (DaoConfig might have size limit however) + * Default page size for searches. Null means no limit (JpaStorageSettings might have size limit however) */ default Integer getDefaultPageSize() { return null; diff --git a/hapi-fhir-serviceloaders/hapi-fhir-caching-api/pom.xml b/hapi-fhir-serviceloaders/hapi-fhir-caching-api/pom.xml index 0a13bfa98c1..53b68b9f641 100644 --- a/hapi-fhir-serviceloaders/hapi-fhir-caching-api/pom.xml +++ b/hapi-fhir-serviceloaders/hapi-fhir-caching-api/pom.xml @@ -7,7 +7,7 @@ hapi-fhir-serviceloaders ca.uhn.hapi.fhir - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-serviceloaders/hapi-fhir-caching-caffeine/pom.xml b/hapi-fhir-serviceloaders/hapi-fhir-caching-caffeine/pom.xml index 09bb2ee35e9..c296d73aa17 100644 --- a/hapi-fhir-serviceloaders/hapi-fhir-caching-caffeine/pom.xml +++ b/hapi-fhir-serviceloaders/hapi-fhir-caching-caffeine/pom.xml @@ -7,7 +7,7 @@ hapi-fhir-serviceloaders ca.uhn.hapi.fhir - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../pom.xml @@ -20,7 +20,7 @@ ca.uhn.hapi.fhir hapi-fhir-caching-api - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT com.github.ben-manes.caffeine diff --git a/hapi-fhir-serviceloaders/hapi-fhir-caching-guava/pom.xml b/hapi-fhir-serviceloaders/hapi-fhir-caching-guava/pom.xml index 2e9be45702c..d28ef13b6d6 100644 --- a/hapi-fhir-serviceloaders/hapi-fhir-caching-guava/pom.xml +++ b/hapi-fhir-serviceloaders/hapi-fhir-caching-guava/pom.xml @@ -7,7 +7,7 @@ hapi-fhir-serviceloaders ca.uhn.hapi.fhir - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-serviceloaders/hapi-fhir-caching-testing/pom.xml b/hapi-fhir-serviceloaders/hapi-fhir-caching-testing/pom.xml index 160568144b6..1fde459eddd 100644 --- a/hapi-fhir-serviceloaders/hapi-fhir-caching-testing/pom.xml +++ b/hapi-fhir-serviceloaders/hapi-fhir-caching-testing/pom.xml @@ -7,7 +7,7 @@ hapi-fhir ca.uhn.hapi.fhir - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../../pom.xml diff --git a/hapi-fhir-serviceloaders/pom.xml b/hapi-fhir-serviceloaders/pom.xml index edb3b3af712..2127498fd50 100644 --- a/hapi-fhir-serviceloaders/pom.xml +++ b/hapi-fhir-serviceloaders/pom.xml @@ -5,7 +5,7 @@ hapi-fhir ca.uhn.hapi.fhir - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml index b22acd2b0f6..76585461d6f 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/src/main/java/ca/uhn/fhir/spring/boot/autoconfigure/FhirAutoConfiguration.java b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/src/main/java/ca/uhn/fhir/spring/boot/autoconfigure/FhirAutoConfiguration.java index f360405240c..78b1f3b828a 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/src/main/java/ca/uhn/fhir/spring/boot/autoconfigure/FhirAutoConfiguration.java +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/src/main/java/ca/uhn/fhir/spring/boot/autoconfigure/FhirAutoConfiguration.java @@ -23,13 +23,12 @@ package ca.uhn.fhir.spring.boot.autoconfigure; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jaxrs.server.AbstractJaxRsProvider; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.config.HapiJpaConfig; import ca.uhn.fhir.jpa.config.JpaDstu2Config; import ca.uhn.fhir.jpa.config.dstu3.JpaDstu3Config; import ca.uhn.fhir.jpa.config.r4.JpaR4Config; import ca.uhn.fhir.jpa.model.config.PartitionSettings; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.provider.BaseJpaProvider; import ca.uhn.fhir.jpa.provider.BaseJpaSystemProvider; import ca.uhn.fhir.jpa.searchparam.submit.config.SearchParamSubmitterConfig; @@ -184,7 +183,7 @@ public class FhirAutoConfiguration { SubscriptionSubmitterConfig.class, SearchParamSubmitterConfig.class }) - static class FhirJpaDaoConfiguration { + static class FhirJpaStorageSettingsConfiguration { @Autowired private EntityManagerFactory emf; @@ -198,9 +197,8 @@ public class FhirAutoConfiguration { @Bean @ConditionalOnMissingBean @ConfigurationProperties("hapi.fhir.jpa") - public DaoConfig fhirDaoConfig() { - DaoConfig fhirDaoConfig = new DaoConfig(); - return fhirDaoConfig; + public JpaStorageSettings storageSettings() { + return new JpaStorageSettings(); } @Bean @@ -211,16 +209,10 @@ public class FhirAutoConfiguration { } - @Bean - @ConditionalOnMissingBean - @ConfigurationProperties("hapi.fhir.jpa") - public ModelConfig fhirModelConfig() { - return fhirDaoConfig().getModelConfig(); - } } @Configuration - @ConditionalOnBean({DaoConfig.class, RestfulServer.class}) + @ConditionalOnBean({JpaStorageSettings.class, RestfulServer.class}) @SuppressWarnings("rawtypes") static class RestfulServerCustomizer implements FhirRestfulServerCustomizer { diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/src/test/java/ca/uhn/fhir/spring/boot/autoconfigure/FhirAutoConfigurationTest.java b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/src/test/java/ca/uhn/fhir/spring/boot/autoconfigure/FhirAutoConfigurationTest.java index aef7b079515..dc939cde375 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/src/test/java/ca/uhn/fhir/spring/boot/autoconfigure/FhirAutoConfigurationTest.java +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/src/test/java/ca/uhn/fhir/spring/boot/autoconfigure/FhirAutoConfigurationTest.java @@ -1,21 +1,15 @@ package ca.uhn.fhir.spring.boot.autoconfigure; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.context.FhirVersionEnum; -import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.okhttp.client.OkHttpRestfulClientFactory; import ca.uhn.fhir.rest.client.apache.ApacheRestfulClientFactory; import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor; import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; -import ca.uhn.fhir.spring.boot.autoconfigure.FhirAutoConfiguration.FhirJpaServerConfiguration.Dstu3; -import org.assertj.core.util.Arrays; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.NoSuchBeanDefinitionException; -import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration; -import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.mock.env.MockEnvironment; diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml index d5c554c3224..7d5f78acc23 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT hapi-fhir-spring-boot-sample-client-apache diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml index ff86a9a217b..0c372797448 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT hapi-fhir-spring-boot-sample-client-okhttp diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml index f5f741469cf..d9e847f3d13 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT hapi-fhir-spring-boot-sample-server-jersey diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml index 0f5ad45e0f5..df6ea42bfc4 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT hapi-fhir-spring-boot-samples diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml index 3f544924474..e8ebd8e529e 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/pom.xml b/hapi-fhir-spring-boot/pom.xml index 429f4197a9f..85b7fb43578 100644 --- a/hapi-fhir-spring-boot/pom.xml +++ b/hapi-fhir-spring-boot/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-sql-migrate/pom.xml b/hapi-fhir-sql-migrate/pom.xml index 488e5953e3d..4c7b6206aec 100644 --- a/hapi-fhir-sql-migrate/pom.xml +++ b/hapi-fhir-sql-migrate/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-storage-batch2-jobs/pom.xml b/hapi-fhir-storage-batch2-jobs/pom.xml index 75fa906cf8d..07fba5d71e1 100644 --- a/hapi-fhir-storage-batch2-jobs/pom.xml +++ b/hapi-fhir-storage-batch2-jobs/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml 4.0.0 diff --git a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/export/ExpandResourcesStep.java b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/export/ExpandResourcesStep.java index 90104fa3518..f3d46355106 100644 --- a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/export/ExpandResourcesStep.java +++ b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/export/ExpandResourcesStep.java @@ -34,7 +34,7 @@ import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.bulk.export.api.IBulkExportProcessor; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc; import com.google.common.collect.ArrayListMultimap; @@ -66,7 +66,7 @@ public class ExpandResourcesStep implements IJobStepWorker= myDaoConfig.getBulkExportFileMaximumCapacity()) { + if (idsToSubmit.size() >= myStorageSettings.getBulkExportFileMaximumCapacity()) { submitWorkChunk(idsToSubmit, resourceType, params, theDataSink); submissionCount++; idsToSubmit = new ArrayList<>(); diff --git a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/expunge/DeleteExpungeJobSubmitterImpl.java b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/expunge/DeleteExpungeJobSubmitterImpl.java index 508405dffb3..e2cec69a4b5 100644 --- a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/expunge/DeleteExpungeJobSubmitterImpl.java +++ b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/expunge/DeleteExpungeJobSubmitterImpl.java @@ -30,7 +30,7 @@ import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.ReadPartitionIdRequestDetails; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.batch.models.Batch2JobStartResponse; import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc; import ca.uhn.fhir.jpa.searchparam.MatchUrlService; @@ -59,7 +59,7 @@ public class DeleteExpungeJobSubmitterImpl implements IDeleteExpungeJobSubmitter @Autowired IRequestPartitionHelperSvc myRequestPartitionHelperSvc; @Autowired - DaoConfig myDaoConfig; + JpaStorageSettings myStorageSettings; @Autowired IInterceptorBroadcaster myInterceptorBroadcaster; @Autowired @@ -69,10 +69,10 @@ public class DeleteExpungeJobSubmitterImpl implements IDeleteExpungeJobSubmitter @Transactional(propagation = Propagation.NEVER) public String submitJob(Integer theBatchSize, List theUrlsToDeleteExpunge, RequestDetails theRequestDetails) { if (theBatchSize == null) { - theBatchSize = myDaoConfig.getExpungeBatchSize(); + theBatchSize = myStorageSettings.getExpungeBatchSize(); } - if (!myDaoConfig.canDeleteExpunge()) { - throw new ForbiddenOperationException(Msg.code(820) + "Delete Expunge not allowed: " + myDaoConfig.cannotDeleteExpungeReason()); + if (!myStorageSettings.canDeleteExpunge()) { + throw new ForbiddenOperationException(Msg.code(820) + "Delete Expunge not allowed: " + myStorageSettings.cannotDeleteExpungeReason()); } for (String url : theUrlsToDeleteExpunge) { @@ -100,6 +100,6 @@ public class DeleteExpungeJobSubmitterImpl implements IDeleteExpungeJobSubmitter startRequest.setJobDefinitionId(JOB_DELETE_EXPUNGE); startRequest.setParameters(deleteExpungeJobParameters); Batch2JobStartResponse startResponse = myJobCoordinator.startInstance(startRequest); - return startResponse.getJobId(); + return startResponse.getInstanceId(); } } diff --git a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/imprt/BulkDataImportProvider.java b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/imprt/BulkDataImportProvider.java index 88adea108a1..5072ed9282f 100644 --- a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/imprt/BulkDataImportProvider.java +++ b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/imprt/BulkDataImportProvider.java @@ -167,7 +167,7 @@ public class BulkDataImportProvider { ourLog.info("Requesting Bulk Import Job ($import by Manifest) with {} urls", typeAndUrls.size()); Batch2JobStartResponse jobStartResponse = myJobCoordinator.startInstance(request); - String jobId = jobStartResponse.getJobId(); + String jobId = jobStartResponse.getInstanceId(); IBaseOperationOutcome response = OperationOutcomeUtil.newInstance(myFhirCtx); OperationOutcomeUtil.addIssue( diff --git a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/reindex/ReindexProvider.java b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/reindex/ReindexProvider.java index ebfb2bff044..930dbeba4e2 100644 --- a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/reindex/ReindexProvider.java +++ b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/reindex/ReindexProvider.java @@ -82,7 +82,7 @@ public class ReindexProvider { Batch2JobStartResponse response = myJobCoordinator.startInstance(request); IBaseParameters retVal = ParametersUtil.newInstance(myFhirContext); - ParametersUtil.addParameterToParametersString(myFhirContext, retVal, ProviderConstants.OPERATION_BATCH_RESPONSE_JOB_ID, response.getJobId()); + ParametersUtil.addParameterToParametersString(myFhirContext, retVal, ProviderConstants.OPERATION_BATCH_RESPONSE_JOB_ID, response.getInstanceId()); return retVal; } diff --git a/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/export/ExpandResourcesStepTest.java b/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/export/ExpandResourcesStepTest.java index 1994ca85a81..66e730e9be7 100644 --- a/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/export/ExpandResourcesStepTest.java +++ b/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/export/ExpandResourcesStepTest.java @@ -15,7 +15,7 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.bulk.export.api.IBulkExportProcessor; import ca.uhn.fhir.jpa.model.dao.JpaPid; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions; import ca.uhn.fhir.rest.api.server.storage.BaseResourcePersistentId; import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc; @@ -60,7 +60,7 @@ public class ExpandResourcesStepTest { private FhirContext myFhirContext = FhirContext.forR4Cached(); @Spy - private ModelConfig myModelConfig = new ModelConfig(); + private StorageSettings myStorageSettings = new StorageSettings(); @InjectMocks private ExpandResourcesStep mySecondStep; diff --git a/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/export/FetchResourceIdsStepTest.java b/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/export/FetchResourceIdsStepTest.java index 1f385d443bb..a844b8b9f0c 100644 --- a/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/export/FetchResourceIdsStepTest.java +++ b/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/export/FetchResourceIdsStepTest.java @@ -8,7 +8,7 @@ import ca.uhn.fhir.batch2.jobs.export.models.BulkExportJobParameters; import ca.uhn.fhir.batch2.jobs.export.models.ResourceIdList; import ca.uhn.fhir.batch2.jobs.models.BatchResourceId; import ca.uhn.fhir.batch2.model.JobInstance; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.bulk.export.api.IBulkExportProcessor; import ca.uhn.fhir.jpa.bulk.export.model.ExportPIDIteratorParameters; import ca.uhn.fhir.jpa.model.dao.JpaPid; @@ -57,7 +57,7 @@ public class FetchResourceIdsStepTest { @InjectMocks private FetchResourceIdsStep myFirstStep; @Mock - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @BeforeEach public void init() { @@ -120,7 +120,7 @@ public class FetchResourceIdsStepTest { )).thenReturn(patientIds.iterator()) .thenReturn(observationIds.iterator()); int maxFileCapacity = 1000; - when(myDaoConfig.getBulkExportFileMaximumCapacity()).thenReturn(maxFileCapacity); + when(myStorageSettings.getBulkExportFileMaximumCapacity()).thenReturn(maxFileCapacity); // test RunOutcome outcome = myFirstStep.run(input, sink); @@ -177,7 +177,7 @@ public class FetchResourceIdsStepTest { // when int maxFileCapacity = 5; - when(myDaoConfig.getBulkExportFileMaximumCapacity()).thenReturn(maxFileCapacity); + when(myStorageSettings.getBulkExportFileMaximumCapacity()).thenReturn(maxFileCapacity); for (int i = 0; i <= maxFileCapacity; i++) { JpaPid id = JpaPid.fromId((long) i); diff --git a/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/imprt/BulkDataImportProviderTest.java b/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/imprt/BulkDataImportProviderTest.java index 850308279b1..80d6d8aaf7d 100644 --- a/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/imprt/BulkDataImportProviderTest.java +++ b/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/imprt/BulkDataImportProviderTest.java @@ -85,7 +85,7 @@ public class BulkDataImportProviderTest { String jobId = UUID.randomUUID().toString(); Batch2JobStartResponse startResponse = new Batch2JobStartResponse(); - startResponse.setJobId(jobId); + startResponse.setInstanceId(jobId); when(myJobCoordinator.startInstance(any())) .thenReturn(startResponse); diff --git a/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/reindex/ReindexProviderTest.java b/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/reindex/ReindexProviderTest.java index 2f7b51e2b41..c69ed89db66 100644 --- a/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/reindex/ReindexProviderTest.java +++ b/hapi-fhir-storage-batch2-jobs/src/test/java/ca/uhn/fhir/batch2/jobs/reindex/ReindexProviderTest.java @@ -74,7 +74,7 @@ public class ReindexProviderTest { private Batch2JobStartResponse createJobStartResponse() { Batch2JobStartResponse response = new Batch2JobStartResponse(); - response.setJobId(TEST_JOB_ID); + response.setInstanceId(TEST_JOB_ID); return response; } diff --git a/hapi-fhir-storage-batch2/pom.xml b/hapi-fhir-storage-batch2/pom.xml index 29885285c8e..0db68563665 100644 --- a/hapi-fhir-storage-batch2/pom.xml +++ b/hapi-fhir-storage-batch2/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/config/BaseBatch2Config.java b/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/config/BaseBatch2Config.java index a781bb75f6b..3b8f27b2339 100644 --- a/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/config/BaseBatch2Config.java +++ b/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/config/BaseBatch2Config.java @@ -29,7 +29,7 @@ import ca.uhn.fhir.batch2.coordinator.JobDefinitionRegistry; import ca.uhn.fhir.batch2.coordinator.WorkChunkProcessor; import ca.uhn.fhir.batch2.maintenance.JobMaintenanceServiceImpl; import ca.uhn.fhir.batch2.model.JobWorkNotificationJsonMessage; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.sched.ISchedulerService; import ca.uhn.fhir.jpa.subscription.channel.api.ChannelConsumerSettings; import ca.uhn.fhir.jpa.subscription.channel.api.ChannelProducerSettings; @@ -83,13 +83,13 @@ public abstract class BaseBatch2Config { @Bean public IJobMaintenanceService batch2JobMaintenanceService(ISchedulerService theSchedulerService, JobDefinitionRegistry theJobDefinitionRegistry, - DaoConfig theDaoConfig, + JpaStorageSettings theStorageSettings, BatchJobSender theBatchJobSender, WorkChunkProcessor theExecutor ) { return new JobMaintenanceServiceImpl(theSchedulerService, myPersistence, - theDaoConfig, + theStorageSettings, theJobDefinitionRegistry, theBatchJobSender, theExecutor diff --git a/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/coordinator/JobCoordinatorImpl.java b/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/coordinator/JobCoordinatorImpl.java index 53d4888fd1e..4ca70513b6c 100644 --- a/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/coordinator/JobCoordinatorImpl.java +++ b/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/coordinator/JobCoordinatorImpl.java @@ -108,7 +108,7 @@ public class JobCoordinatorImpl implements IJobCoordinator { JobInstance first = existing.stream().findFirst().get(); Batch2JobStartResponse response = new Batch2JobStartResponse(); - response.setJobId(first.getInstanceId()); + response.setInstanceId(first.getInstanceId()); response.setUsesCachedResult(true); ourLog.info("Reusing cached {} job with status {} and id {}", first.getJobDefinitionId(), first.getStatus(), first.getInstanceId()); @@ -134,7 +134,7 @@ public class JobCoordinatorImpl implements IJobCoordinator { myBatchJobSender.sendWorkChannelMessage(workNotification); Batch2JobStartResponse response = new Batch2JobStartResponse(); - response.setJobId(instanceId); + response.setInstanceId(instanceId); return response; } diff --git a/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/maintenance/JobMaintenanceServiceImpl.java b/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/maintenance/JobMaintenanceServiceImpl.java index 26ec4eb8899..286cded48de 100644 --- a/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/maintenance/JobMaintenanceServiceImpl.java +++ b/hapi-fhir-storage-batch2/src/main/java/ca/uhn/fhir/batch2/maintenance/JobMaintenanceServiceImpl.java @@ -27,7 +27,7 @@ import ca.uhn.fhir.batch2.coordinator.JobDefinitionRegistry; import ca.uhn.fhir.batch2.coordinator.WorkChunkProcessor; import ca.uhn.fhir.batch2.model.JobInstance; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.sched.HapiJob; import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs; import ca.uhn.fhir.jpa.model.sched.ISchedulerService; @@ -85,7 +85,7 @@ public class JobMaintenanceServiceImpl implements IJobMaintenanceService, IHasSc private final IJobPersistence myJobPersistence; private final ISchedulerService mySchedulerService; - private final DaoConfig myDaoConfig; + private final JpaStorageSettings myStorageSettings; private final JobDefinitionRegistry myJobDefinitionRegistry; private final BatchJobSender myBatchJobSender; private final WorkChunkProcessor myJobExecutorSvc; @@ -101,12 +101,12 @@ public class JobMaintenanceServiceImpl implements IJobMaintenanceService, IHasSc */ public JobMaintenanceServiceImpl(@Nonnull ISchedulerService theSchedulerService, @Nonnull IJobPersistence theJobPersistence, - DaoConfig theDaoConfig, + JpaStorageSettings theStorageSettings, @Nonnull JobDefinitionRegistry theJobDefinitionRegistry, @Nonnull BatchJobSender theBatchJobSender, @Nonnull WorkChunkProcessor theExecutor ) { - myDaoConfig = theDaoConfig; + myStorageSettings = theStorageSettings; Validate.notNull(theSchedulerService); Validate.notNull(theJobPersistence); Validate.notNull(theJobDefinitionRegistry); @@ -141,7 +141,7 @@ public class JobMaintenanceServiceImpl implements IJobMaintenanceService, IHasSc */ @Override public boolean triggerMaintenancePass() { - if (!myDaoConfig.isJobFastTrackingEnabled()) { + if (!myStorageSettings.isJobFastTrackingEnabled()) { return false; } if (mySchedulerService.isClusteredSchedulingEnabled()) { diff --git a/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/coordinator/JobCoordinatorImplTest.java b/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/coordinator/JobCoordinatorImplTest.java index d5a344ddf36..531f0a592ed 100644 --- a/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/coordinator/JobCoordinatorImplTest.java +++ b/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/coordinator/JobCoordinatorImplTest.java @@ -184,7 +184,7 @@ public class JobCoordinatorImplTest extends BaseBatch2Test { Batch2JobStartResponse startResponse = mySvc.startInstance(startRequest); // verify - assertEquals(inProgressInstanceId, startResponse.getJobId()); // make sure it's the completed one + assertEquals(inProgressInstanceId, startResponse.getInstanceId()); // make sure it's the completed one assertTrue(startResponse.isUsesCachedResult()); ArgumentCaptor requestArgumentCaptor = ArgumentCaptor.forClass(FetchJobInstancesRequest.class); verify(myJobInstancePersister) diff --git a/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/maintenance/JobMaintenanceServiceImplTest.java b/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/maintenance/JobMaintenanceServiceImplTest.java index 063a799c61d..e8f271db5ac 100644 --- a/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/maintenance/JobMaintenanceServiceImplTest.java +++ b/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/maintenance/JobMaintenanceServiceImplTest.java @@ -14,7 +14,7 @@ import ca.uhn.fhir.batch2.model.JobInstance; import ca.uhn.fhir.batch2.model.JobWorkNotification; import ca.uhn.fhir.batch2.model.StatusEnum; import ca.uhn.fhir.batch2.model.WorkChunk; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.model.sched.ISchedulerService; import ca.uhn.fhir.jpa.subscription.channel.api.IChannelProducer; import com.google.common.collect.Lists; @@ -71,7 +71,7 @@ public class JobMaintenanceServiceImplTest extends BaseBatch2Test { @Mock private WorkChunkProcessor myJobExecutorSvc; @Spy - private DaoConfig myDaoConfig = new DaoConfig(); + private JpaStorageSettings myStorageSettings = new JpaStorageSettings(); private JobMaintenanceServiceImpl mySvc; @Captor private ArgumentCaptor myInstanceCaptor; @@ -91,12 +91,12 @@ public class JobMaintenanceServiceImplTest extends BaseBatch2Test { BatchJobSender batchJobSender = new BatchJobSender(myWorkChannelProducer); mySvc = new JobMaintenanceServiceImpl(mySchedulerService, myJobPersistence, - myDaoConfig, + myStorageSettings, myJobDefinitionRegistry, batchJobSender, myJobExecutorSvc ); - myDaoConfig.setJobFastTrackingEnabled(true); + myStorageSettings.setJobFastTrackingEnabled(true); } @Test @@ -405,7 +405,7 @@ public class JobMaintenanceServiceImplTest extends BaseBatch2Test { @Test void triggerMaintenancePassDisabled_noneInProgress_doesNotRunMaintenace() { - myDaoConfig.setJobFastTrackingEnabled(false); + myStorageSettings.setJobFastTrackingEnabled(false); mySvc.triggerMaintenancePass(); verifyNoMoreInteractions(myJobPersistence); } diff --git a/hapi-fhir-storage-cr/pom.xml b/hapi-fhir-storage-cr/pom.xml index b9411fac099..30a893b23a3 100644 --- a/hapi-fhir-storage-cr/pom.xml +++ b/hapi-fhir-storage-cr/pom.xml @@ -7,7 +7,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/TestCrConfig.java b/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/TestCrConfig.java index fcc048afa0e..9882b9bc0ad 100644 --- a/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/TestCrConfig.java +++ b/hapi-fhir-storage-cr/src/test/java/ca/uhn/fhir/cr/TestCrConfig.java @@ -1,6 +1,6 @@ package ca.uhn.fhir.cr; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.subscription.channel.config.SubscriptionChannelConfig; import ca.uhn.fhir.jpa.subscription.submit.config.SubscriptionSubmitterConfig; import org.springframework.context.annotation.Bean; @@ -12,14 +12,14 @@ import org.springframework.context.annotation.Import; public class TestCrConfig { @Bean - public DaoConfig daoConfig() { - DaoConfig daoConfig = new DaoConfig(); - daoConfig.setAllowExternalReferences(true); - daoConfig.setEnforceReferentialIntegrityOnWrite(false); - daoConfig.setEnforceReferenceTargetTypes(false); - daoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.ANY); - //daoConfig.setResourceServerIdStrategy(Id); - return daoConfig; + public JpaStorageSettings storageSettings() { + JpaStorageSettings storageSettings = new JpaStorageSettings(); + storageSettings.setAllowExternalReferences(true); + storageSettings.setEnforceReferentialIntegrityOnWrite(false); + storageSettings.setEnforceReferenceTargetTypes(false); + storageSettings.setResourceClientIdStrategy(JpaStorageSettings.ClientIdStrategyEnum.ANY); + //storageSettings.setResourceServerIdStrategy(Id); + return storageSettings; } @Bean diff --git a/hapi-fhir-storage-mdm/pom.xml b/hapi-fhir-storage-mdm/pom.xml index 48572e9c1cc..7163977bad8 100644 --- a/hapi-fhir-storage-mdm/pom.xml +++ b/hapi-fhir-storage-mdm/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml 4.0.0 diff --git a/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmSubmitterInterceptorLoader.java b/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmSubmitterInterceptorLoader.java index 8ef1ada45b4..f6c5fa38d8b 100644 --- a/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmSubmitterInterceptorLoader.java +++ b/hapi-fhir-storage-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmSubmitterInterceptorLoader.java @@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.mdm.interceptor; */ import ca.uhn.fhir.interceptor.api.IInterceptorService; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.subscription.submit.interceptor.SubscriptionSubmitInterceptorLoader; import ca.uhn.fhir.mdm.api.IMdmSettings; import ca.uhn.fhir.mdm.interceptor.IMdmStorageInterceptor; @@ -39,7 +39,7 @@ public class MdmSubmitterInterceptorLoader { @Autowired private IMdmSettings myMdmSettings; @Autowired - DaoConfig myDaoConfig; + JpaStorageSettings myStorageSettings; @Autowired private IMdmStorageInterceptor myIMdmStorageInterceptor; @Autowired @@ -55,7 +55,7 @@ public class MdmSubmitterInterceptorLoader { return; } - myDaoConfig.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.MESSAGE); + myStorageSettings.addSupportedSubscriptionType(Subscription.SubscriptionChannelType.MESSAGE); myInterceptorService.registerInterceptor(myIMdmStorageInterceptor); myInterceptorService.registerInterceptor(myMdmSearchExpandingInterceptorInterceptor); ourLog.info("MDM interceptor registered"); diff --git a/hapi-fhir-storage-test-utilities/pom.xml b/hapi-fhir-storage-test-utilities/pom.xml index c741f54e038..ea4f218dd6f 100644 --- a/hapi-fhir-storage-test-utilities/pom.xml +++ b/hapi-fhir-storage-test-utilities/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml 4.0.0 diff --git a/hapi-fhir-storage/pom.xml b/hapi-fhir-storage/pom.xml index 2a096606adf..e3fef4e756d 100644 --- a/hapi-fhir-storage/pom.xml +++ b/hapi-fhir-storage/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/config/JpaStorageSettings.java similarity index 76% rename from hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java rename to hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/config/JpaStorageSettings.java index 7a534c007e9..c466cc5a5ae 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/config/DaoConfig.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/config/JpaStorageSettings.java @@ -2,20 +2,17 @@ package ca.uhn.fhir.jpa.api.config; import ca.uhn.fhir.jpa.api.model.HistoryCountModeEnum; import ca.uhn.fhir.jpa.api.model.WarmCacheEntry; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.entity.ResourceEncodingEnum; -import ca.uhn.fhir.jpa.model.entity.ResourceHistoryTable; import ca.uhn.fhir.rest.api.SearchTotalModeEnum; import ca.uhn.fhir.system.HapiSystemProperties; import ca.uhn.fhir.util.HapiExtensions; import ca.uhn.fhir.validation.FhirValidator; -import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Sets; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.time.DateUtils; -import org.hl7.fhir.dstu2.model.Subscription; import org.hl7.fhir.r4.model.Bundle; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,7 +46,8 @@ import java.util.TreeSet; * #L% */ -public class DaoConfig { +@SuppressWarnings("JavadocLinkAsPlainText") +public class JpaStorageSettings extends StorageSettings { /** * Default value for {@link #setReuseCachedSearchResultsForMillis(Long)}: 60000ms (one minute) @@ -90,12 +88,6 @@ public class DaoConfig { */ public static final TagStorageModeEnum DEFAULT_TAG_STORAGE_MODE = TagStorageModeEnum.VERSIONED; public static final int DEFAULT_EXPUNGE_BATCH_SIZE = 800; - /** - * @since 5.6.0 - */ - // Thread Pool size used by batch in bundle - public static final int DEFAULT_BUNDLE_BATCH_POOL_SIZE = 20; // 1 for single thread - public static final int DEFAULT_BUNDLE_BATCH_MAX_POOL_SIZE = 100; // 1 for single thread public static final int DEFAULT_BUNDLE_BATCH_QUEUE_CAPACITY = 200; public static final int DEFAULT_BULK_EXPORT_FILE_MAXIMUM_CAPACITY = 1_000; @@ -105,15 +97,13 @@ public class DaoConfig { * @see #setMaximumSearchResultCountInTransaction(Integer) */ private static final Integer DEFAULT_MAXIMUM_SEARCH_RESULT_COUNT_IN_TRANSACTION = null; - private static final Integer DEFAULT_MAXIMUM_TRANSACTION_BUNDLE_SIZE = null; - private static final Logger ourLog = LoggerFactory.getLogger(DaoConfig.class); + private static final Logger ourLog = LoggerFactory.getLogger(JpaStorageSettings.class); private static final int DEFAULT_REINDEX_BATCH_SIZE = 800; private static final int DEFAULT_MAXIMUM_DELETE_CONFLICT_COUNT = 60; /** * Child Configurations */ private static final Integer DEFAULT_INTERNAL_SYNCHRONOUS_SEARCH_SIZE = 10000; - private final ModelConfig myModelConfig = new ModelConfig(); /** * Do not change default of {@code 0}! * @@ -147,7 +137,6 @@ public class DaoConfig { private boolean myEnforceReferentialIntegrityOnWrite = true; private SearchTotalModeEnum myDefaultTotalMode = null; private int myEverythingIncludesFetchPageSize = 50; - private int myBulkImportMaxRetryCount = 10; private TagStorageModeEnum myTagStorageMode = DEFAULT_TAG_STORAGE_MODE; /** * update setter javadoc if default changes @@ -159,7 +148,6 @@ public class DaoConfig { private Integer myFetchSizeDefaultMaximum = null; private int myMaximumExpansionSize = DEFAULT_MAX_EXPANSION_SIZE; private Integer myMaximumSearchResultCountInTransaction = DEFAULT_MAXIMUM_SEARCH_RESULT_COUNT_IN_TRANSACTION; - private Integer myMaximumTransactionBundleSize = DEFAULT_MAXIMUM_TRANSACTION_BUNDLE_SIZE; private ResourceEncodingEnum myResourceEncoding = ResourceEncodingEnum.JSONC; /** * update setter javadoc if default changes @@ -168,7 +156,6 @@ public class DaoConfig { private Long myReuseCachedSearchResultsForMillis = DEFAULT_REUSE_CACHED_SEARCH_RESULTS_FOR_MILLIS; private boolean mySchedulingDisabled; private boolean mySuppressUpdatesWithNoChange = true; - private boolean myAutoCreatePlaceholderReferenceTargets; private Integer myCacheControlNoStoreMaxResultsUpperLimit = 1000; private Integer myCountSearchResultsUpTo = null; private boolean myStatusBasedReindexingDisabled; @@ -177,7 +164,6 @@ public class DaoConfig { private boolean myExpungeEnabled; private boolean myDeleteExpungeEnabled; private int myExpungeBatchSize = DEFAULT_EXPUNGE_BATCH_SIZE; - private int myReindexBatchSize = DEFAULT_REINDEX_BATCH_SIZE; private int myReindexThreadCount; private int myExpungeThreadCount; private Set myBundleTypesAllowedForStorage; @@ -188,8 +174,6 @@ public class DaoConfig { // Use prime sizes to avoid empty next links. private List mySearchPreFetchThresholds = Arrays.asList(13, 503, 2003, -1); private List myWarmCacheEntries = new ArrayList<>(); - private boolean myDisableHashBasedSearches; - private boolean myEnableInMemorySubscriptionMatching = true; private boolean myEnforceReferenceTargetTypes = true; private ClientIdStrategyEnum myResourceClientIdStrategy = ClientIdStrategyEnum.ALPHANUMERIC; private boolean myFilterParameterEnabled = false; @@ -232,14 +216,6 @@ public class DaoConfig { * @since 5.1.0 */ private boolean myLastNEnabled = false; - /** - * @since 5.2.0 - */ - private boolean myUseLegacySearchBuilder = false; - /** - * @since 5.5.0 - */ - private boolean myReindexEnabled = true; /** * @since 5.4.0 */ @@ -264,15 +240,11 @@ public class DaoConfig { * @since 5.5.0 */ private boolean myEnableTaskBulkExportJobExecution; - private boolean myMassIngestionMode; private boolean myAccountForDateIndexNulls; - private boolean myTriggerSubscriptionsForNonVersioningChanges; /** * @since 5.6.0 */ private String myHSearchIndexPrefix; - private Integer myBundleBatchPoolSize = DEFAULT_BUNDLE_BATCH_POOL_SIZE; - private Integer myBundleBatchMaxPoolSize = DEFAULT_BUNDLE_BATCH_MAX_POOL_SIZE; /** * Activates the new HSearch indexing of search parameters. @@ -340,16 +312,10 @@ public class DaoConfig { */ private boolean myJobFastTrackingEnabled = false; - /** - * Since 6.4.0 - */ - - private boolean myQualifySubscriptionMatchingChannelName = true; - /** * Constructor */ - public DaoConfig() { + public JpaStorageSettings() { setMarkResourcesForReindexingUponSearchParameterChange(true); setReindexThreadCount(Runtime.getRuntime().availableProcessors()); setExpungeThreadCount(Runtime.getRuntime().availableProcessors()); @@ -414,26 +380,6 @@ public class DaoConfig { myTagStorageMode = theTagStorageMode; } - /** - * Specifies the maximum number of times that a chunk will be retried during bulk import - * processes before giving up. - * - * @since 5.5.0 - */ - public int getBulkImportMaxRetryCount() { - return myBulkImportMaxRetryCount; - } - - /** - * Specifies the maximum number of times that a chunk will be retried during bulk import - * processes before giving up. - * - * @since 5.5.0 - */ - public void setBulkImportMaxRetryCount(int theBulkImportMaxRetryCount) { - myBulkImportMaxRetryCount = theBulkImportMaxRetryCount; - } - /** * Specifies the maximum number of _include and _revinclude results to return in a * single page of results. The default is 1000, and null may be used @@ -527,32 +473,6 @@ public class DaoConfig { myLastNEnabled = theLastNEnabled; } - /** - * This method controls whether to use the new non-hibernate search SQL builder that was introduced in HAPI FHIR 5.2.0. - * By default this will be false meaning that the new SQL builder is used. Set to true to use the - * legacy SQL builder based on Hibernate. - *

Note that this method will be removed in HAPI FHIR 5.4.0

- * - * @since 5.3.0 - */ - public boolean isUseLegacySearchBuilder() { - return false; - } - - /** - * This method controls whether to use the new non-hibernate search SQL builder that was introduced in HAPI FHIR 5.2.0. - * By default this will be false meaning that the new SQL builder is used. Set to true to use the - * legacy SQL builder based on Hibernate. - *

Note that this method will be removed in HAPI FHIR 5.4.0

- * - * @since 5.3.0 - * @deprecated in 6.1.0, this toggle will be removed in 6.2.0 as the Legacy Search Builder has been removed. - */ - @Deprecated - public void setUseLegacySearchBuilder(boolean theUseLegacySearchBuilder) { - //Nop - } - /** * Specifies the duration in minutes for which values will be retained after being * written to the terminology translation cache. Defaults to 60. @@ -708,15 +628,6 @@ public class DaoConfig { myStatusBasedReindexingDisabled = theStatusBasedReindexingDisabled; } - /** - * Add a value to the {@link #setTreatReferencesAsLogical(Set) logical references list}. - * - * @see #setTreatReferencesAsLogical(Set) - */ - public void addTreatReferencesAsLogical(String theTreatReferencesAsLogical) { - myModelConfig.addTreatReferencesAsLogical(theTreatReferencesAsLogical); - } - /** * This setting specifies the bundle types (Bundle.type) that * are allowed to be stored as-is on the /Bundle endpoint. @@ -1028,31 +939,6 @@ public class DaoConfig { myMaximumSearchResultCountInTransaction = theMaximumSearchResultCountInTransaction; } - /** - * Specifies the maximum number of resources permitted within a single transaction bundle. - * If a transaction bundle is submitted with more than this number of resources, it will be - * rejected with a PayloadTooLarge exception. - *

- * The default value is null, which means that there is no limit. - *

- */ - public Integer getMaximumTransactionBundleSize() { - return myMaximumTransactionBundleSize; - } - - /** - * Specifies the maximum number of resources permitted within a single transaction bundle. - * If a transaction bundle is submitted with more than this number of resources, it will be - * rejected with a PayloadTooLarge exception. - *

- * The default value is null, which means that there is no limit. - *

- */ - public DaoConfig setMaximumTransactionBundleSize(Integer theMaximumTransactionBundleSize) { - myMaximumTransactionBundleSize = theMaximumTransactionBundleSize; - return this; - } - /** * This setting controls the number of threads allocated to resource reindexing * (which is only ever used if SearchParameters change, or a manual reindex is @@ -1239,115 +1125,6 @@ public class DaoConfig { myReuseCachedSearchResultsForMillis = theReuseCachedSearchResultsForMillis; } - /** - * This setting may be used to advise the server that any references found in - * resources that have any of the base URLs given here will be treated as logical - * references instead of being treated as real references. - *

- * A logical reference is a reference which is treated as an identifier, and - * does not neccesarily resolve. See references for - * a description of logical references. For example, the valueset - * valueset-quantity-comparator is a logical - * reference. - *

- *

- * Values for this field may take either of the following forms: - *

- *
    - *
  • http://example.com/some-url (will be matched exactly)
  • - *
  • http://example.com/some-base* (will match anything beginning with the part before the *)
  • - *
- * - * @see ModelConfig#DEFAULT_LOGICAL_BASE_URLS Default values for this property - */ - public Set getTreatReferencesAsLogical() { - return myModelConfig.getTreatReferencesAsLogical(); - } - - /** - * This setting may be used to advise the server that any references found in - * resources that have any of the base URLs given here will be treated as logical - * references instead of being treated as real references. - *

- * A logical reference is a reference which is treated as an identifier, and - * does not neccesarily resolve. See references for - * a description of logical references. For example, the valueset - * valueset-quantity-comparator is a logical - * reference. - *

- *

- * Values for this field may take either of the following forms: - *

- *
    - *
  • http://example.com/some-url (will be matched exactly)
  • - *
  • http://example.com/some-base* (will match anything beginning with the part before the *)
  • - *
- * - * @see ModelConfig#DEFAULT_LOGICAL_BASE_URLS Default values for this property - */ - public DaoConfig setTreatReferencesAsLogical(Set theTreatReferencesAsLogical) { - myModelConfig.setTreatReferencesAsLogical(theTreatReferencesAsLogical); - return this; - } - - /** - * If set to true (default is false) the server will allow - * resources to have references to external servers. For example if this server is - * running at http://example.com/fhir and this setting is set to - * true the server will allow a Patient resource to be saved with a - * Patient.organization value of http://foo.com/Organization/1. - *

- * Under the default behaviour if this value has not been changed, the above - * resource would be rejected by the server because it requires all references - * to be resolvable on the local server. - *

- *

- * Note that external references will be indexed by the server and may be searched - * (e.g. Patient:organization), but - * chained searches (e.g. Patient:organization.name) will not work across - * these references. - *

- *

- * It is recommended to also set {@link #setTreatBaseUrlsAsLocal(Set)} if this value - * is set to true - *

- * - * @see #setTreatBaseUrlsAsLocal(Set) - * @see #setAllowExternalReferences(boolean) - */ - public boolean isAllowExternalReferences() { - return myModelConfig.isAllowExternalReferences(); - } - - /** - * If set to true (default is false) the server will allow - * resources to have references to external servers. For example if this server is - * running at http://example.com/fhir and this setting is set to - * true the server will allow a Patient resource to be saved with a - * Patient.organization value of http://foo.com/Organization/1. - *

- * Under the default behaviour if this value has not been changed, the above - * resource would be rejected by the server because it requires all references - * to be resolvable on the local server. - *

- *

- * Note that external references will be indexed by the server and may be searched - * (e.g. Patient:organization), but - * chained searches (e.g. Patient:organization.name) will not work across - * these references. - *

- *

- * It is recommended to also set {@link #setTreatBaseUrlsAsLocal(Set)} if this value - * is set to true - *

- * - * @see #setTreatBaseUrlsAsLocal(Set) - * @see #setAllowExternalReferences(boolean) - */ - public void setAllowExternalReferences(boolean theAllowExternalReferences) { - myModelConfig.setAllowExternalReferences(theAllowExternalReferences); - } - /** * @see #setAllowInlineMatchUrlReferences(boolean) */ @@ -1380,54 +1157,6 @@ public class DaoConfig { myAllowMultipleDelete = theAllowMultipleDelete; } - /** - * When creating or updating a resource: If this property is set to true - * (default is false), if the resource has a reference to another resource - * on the local server but that reference does not exist, a placeholder resource will be - * created. - *

- * In other words, if an observation with subject Patient/FOO is created, but - * there is no resource called Patient/FOO on the server, this property causes - * an empty patient with ID "FOO" to be created in order to prevent this operation - * from failing. - *

- *

- * This property can be useful in cases where replication between two servers is wanted. - * Note however that references containing purely numeric IDs will not be auto-created - * as they are never allowed to be client supplied in HAPI FHIR JPA. - *

- * All placeholder resources created in this way have an extension - * with the URL {@link HapiExtensions#EXT_RESOURCE_PLACEHOLDER} and the value "true". - *

- */ - public boolean isAutoCreatePlaceholderReferenceTargets() { - return myAutoCreatePlaceholderReferenceTargets; - } - - /** - * When creating or updating a resource: If this property is set to true - * (default is false), if the resource has a reference to another resource - * on the local server but that reference does not exist, a placeholder resource will be - * created. - *

- * In other words, if an observation with subject Patient/FOO is created, but - * there is no resource called Patient/FOO on the server, this property causes - * an empty patient with ID "FOO" to be created in order to prevent this operation - * from failing. - *

- *

- * This property can be useful in cases where replication between two servers is wanted. - * Note however that references containing purely numeric IDs will not be auto-created - * as they are never allowed to be client supplied in HAPI FHIR JPA. - *

- * All placeholder resources created in this way have an extension - * with the URL {@link HapiExtensions#EXT_RESOURCE_PLACEHOLDER} and the value "true". - *

- */ - public void setAutoCreatePlaceholderReferenceTargets(boolean theAutoCreatePlaceholderReferenceTargets) { - myAutoCreatePlaceholderReferenceTargets = theAutoCreatePlaceholderReferenceTargets; - } - /** * When {@link #setAutoCreatePlaceholderReferenceTargets(boolean)} is enabled, if this * setting is set to true (default is true) and the source @@ -1770,38 +1499,6 @@ public class DaoConfig { myExpungeBatchSize = theExpungeBatchSize; } - /** - * The reindex batch size (default 800) determines the number of records reindexed in a single transaction. - */ - public int getReindexBatchSize() { - return myReindexBatchSize; - } - - /** - * The reindex batch size (default 800) determines the number of records reindexed in a single transaction. - */ - public void setReindexBatchSize(int theReindexBatchSize) { - myReindexBatchSize = theReindexBatchSize; - } - - - /** - * If set to false (default is true), reindexing of resources will be disabled on this - * server. - */ - public boolean isReindexEnabled() { - return myReindexEnabled; - } - - /** - * If set to false (default is true), reindexing of resources will be disabled on this - * server. - */ - - public void setReindexEnabled(boolean theReindexEnabled) { - myReindexEnabled = theReindexEnabled; - } - /** * Should resources be marked as needing reindexing when a * SearchParameter resource is added or changed. This should generally @@ -1978,276 +1675,6 @@ public class DaoConfig { mySearchPreFetchThresholds = thePreFetchThresholds; } - /** - * If set to true (default is false) the server will not use - * hash based searches. These searches were introduced in HAPI FHIR 3.5.0 - * and are the new default way of searching. However they require a very - * large data migration if an existing system has a large amount of data - * so this setting can be used to use the old search mechanism while data - * is migrated. - * - * @since 3.6.0 - */ - public boolean getDisableHashBasedSearches() { - return myDisableHashBasedSearches; - } - - /** - * If set to true (default is false) the server will not use - * hash based searches. These searches were introduced in HAPI FHIR 3.5.0 - * and are the new default way of searching. However they require a very - * large data migration if an existing system has a large amount of data - * so this setting can be used to use the old search mechanism while data - * is migrated. - * - * @since 3.6.0 - */ - public void setDisableHashBasedSearches(boolean theDisableHashBasedSearches) { - myDisableHashBasedSearches = theDisableHashBasedSearches; - } - - /** - * If set to false (default is true) the server will not use - * in-memory subscription searching and instead use the database matcher for all subscription - * criteria matching. - *

- * When there are subscriptions registered - * on the server, the default behaviour is to compare the changed resource to the - * subscription criteria directly in-memory without going out to the database. - * Certain types of subscription criteria, e.g. chained references of queries with - * qualifiers or prefixes, are not supported by the in-memory matcher and will fall back - * to a database matcher. - *

- * The database matcher performs a query against the - * database by prepending ?id=XYZ to the subscription criteria where XYZ is the id of the changed entity - * - * @since 3.6.1 - */ - - public boolean isEnableInMemorySubscriptionMatching() { - return myEnableInMemorySubscriptionMatching; - } - - /** - * If set to false (default is true) the server will not use - * in-memory subscription searching and instead use the database matcher for all subscription - * criteria matching. - *

- * When there are subscriptions registered - * on the server, the default behaviour is to compare the changed resource to the - * subscription criteria directly in-memory without going out to the database. - * Certain types of subscription criteria, e.g. chained references of queries with - * qualifiers or prefixes, are not supported by the in-memory matcher and will fall back - * to a database matcher. - *

- * The database matcher performs a query against the - * database by prepending ?id=XYZ to the subscription criteria where XYZ is the id of the changed entity - * - * @since 3.6.1 - */ - - public void setEnableInMemorySubscriptionMatching(boolean theEnableInMemorySubscriptionMatching) { - myEnableInMemorySubscriptionMatching = theEnableInMemorySubscriptionMatching; - } - - public ModelConfig getModelConfig() { - return myModelConfig; - } - - /** - * If enabled, the server will support the use of :contains searches, - * which are helpful but can have adverse effects on performance. - *

- * Default is false (Note that prior to HAPI FHIR - * 3.5.0 the default was true) - *

- *

- * Note: If you change this value after data already has - * already been stored in the database, you must for a reindexing - * of all data in the database or resources may not be - * searchable. - *

- */ - public boolean isAllowContainsSearches() { - return this.myModelConfig.isAllowContainsSearches(); - } - - /** - * If enabled, the server will support the use of :contains searches, - * which are helpful but can have adverse effects on performance. - *

- * Default is false (Note that prior to HAPI FHIR - * 3.5.0 the default was true) - *

- *

- * Note: If you change this value after data already has - * already been stored in the database, you must for a reindexing - * of all data in the database or resources may not be - * searchable. - *

- */ - public void setAllowContainsSearches(boolean theAllowContainsSearches) { - this.myModelConfig.setAllowContainsSearches(theAllowContainsSearches); - } - - /** - * If enabled, the server will support the use of :mdm search parameter qualifier on Reference Search Parameters. - * This Parameter Qualifier is HAPI-specific, and not defined anywhere in the FHIR specification. Using this qualifier - * will result in an MDM expansion being done on the reference, which will expand the search scope. For example, if Patient/1 - * is MDM-matched to Patient/2 and you execute the search: - * Observation?subject:mdm=Patient/1 , you will receive observations for both Patient/1 and Patient/2. - *

- * Default is false - *

- * - * @since 5.4.0 - */ - public boolean isAllowMdmExpansion() { - return myModelConfig.isAllowMdmExpansion(); - } - - /** - * If enabled, the server will support the use of :mdm search parameter qualifier on Reference Search Parameters. - * This Parameter Qualifier is HAPI-specific, and not defined anywhere in the FHIR specification. Using this qualifier - * will result in an MDM expansion being done on the reference, which will expand the search scope. For example, if Patient/1 - * is MDM-matched to Patient/2 and you execute the search: - * Observation?subject:mdm=Patient/1 , you will receive observations for both Patient/1 and Patient/2. - *

- * Default is false - *

- * - * @since 5.4.0 - */ - public void setAllowMdmExpansion(boolean theAllowMdmExpansion) { - myModelConfig.setAllowMdmExpansion(theAllowMdmExpansion); - } - - /** - * This setting may be used to advise the server that any references found in - * resources that have any of the base URLs given here will be replaced with - * simple local references. - *

- * For example, if the set contains the value http://example.com/base/ - * and a resource is submitted to the server that contains a reference to - * http://example.com/base/Patient/1, the server will automatically - * convert this reference to Patient/1 - *

- *

- * Note that this property has different behaviour from {@link DaoConfig#getTreatReferencesAsLogical()} - *

- * - * @see #getTreatReferencesAsLogical() - */ - public Set getTreatBaseUrlsAsLocal() { - return myModelConfig.getTreatBaseUrlsAsLocal(); - } - - /** - * This setting may be used to advise the server that any references found in - * resources that have any of the base URLs given here will be replaced with - * simple local references. - *

- * For example, if the set contains the value http://example.com/base/ - * and a resource is submitted to the server that contains a reference to - * http://example.com/base/Patient/1, the server will automatically - * convert this reference to Patient/1 - *

- * - * @param theTreatBaseUrlsAsLocal The set of base URLs. May be null, which - * means no references will be treated as external - */ - public void setTreatBaseUrlsAsLocal(Set theTreatBaseUrlsAsLocal) { - myModelConfig.setTreatBaseUrlsAsLocal(theTreatBaseUrlsAsLocal); - } - - /** - * If set to {@code true} the default search params (i.e. the search parameters that are - * defined by the FHIR specification itself) may be overridden by uploading search - * parameters to the server with the same code as the built-in search parameter. - *

- * This can be useful if you want to be able to disable or alter - * the behaviour of the default search parameters. - *

- *

- * The default value for this setting is {@code false} - *

- */ - public boolean isDefaultSearchParamsCanBeOverridden() { - return myModelConfig.isDefaultSearchParamsCanBeOverridden(); - } - - /** - * If set to {@code true} the default search params (i.e. the search parameters that are - * defined by the FHIR specification itself) may be overridden by uploading search - * parameters to the server with the same code as the built-in search parameter. - *

- * This can be useful if you want to be able to disable or alter - * the behaviour of the default search parameters. - *

- *

- * The default value for this setting is {@code false} - *

- */ - public void setDefaultSearchParamsCanBeOverridden(boolean theDefaultSearchParamsCanBeOverridden) { - myModelConfig.setDefaultSearchParamsCanBeOverridden(theDefaultSearchParamsCanBeOverridden); - } - - /** - * This setting indicates which subscription channel types are supported by the server. Any subscriptions submitted - * to the server matching these types will be activated. - */ - public DaoConfig addSupportedSubscriptionType(Subscription.SubscriptionChannelType theSubscriptionChannelType) { - myModelConfig.addSupportedSubscriptionType(theSubscriptionChannelType); - return this; - } - - /** - * This setting indicates which subscription channel types are supported by the server. Any subscriptions submitted - * to the server matching these types will be activated. - * - * @see #addSupportedSubscriptionType(Subscription.SubscriptionChannelType) - */ - public Set getSupportedSubscriptionTypes() { - return myModelConfig.getSupportedSubscriptionTypes(); - } - - @VisibleForTesting - public void clearSupportedSubscriptionTypesForUnitTest() { - myModelConfig.clearSupportedSubscriptionTypesForUnitTest(); - } - - /** - * If e-mail subscriptions are supported, the From address used when sending e-mails - */ - - public String getEmailFromAddress() { - return myModelConfig.getEmailFromAddress(); - } - - /** - * If e-mail subscriptions are supported, the From address used when sending e-mails - */ - - public void setEmailFromAddress(String theEmailFromAddress) { - myModelConfig.setEmailFromAddress(theEmailFromAddress); - } - - /** - * If websocket subscriptions are enabled, this defines the context path that listens to them. Default value "/websocket". - */ - - public String getWebsocketContextPath() { - return myModelConfig.getWebsocketContextPath(); - } - - /** - * If websocket subscriptions are enabled, this defines the context path that listens to them. Default value "/websocket". - */ - - public void setWebsocketContextPath(String theWebsocketContextPath) { - myModelConfig.setWebsocketContextPath(theWebsocketContextPath); - } - /** * If set to true the _filter search parameter will be enabled on this server. Note that _filter * is very powerful, but also potentially dangerous as it can allow a user to create a query for which there @@ -2328,7 +1755,7 @@ public class DaoConfig { /** *

* This is the default value of {@code offset} parameter for the ValueSet {@code $expand} operation when - * {@link DaoConfig#isPreExpandValueSets()} returns {@code true}. + * {@link JpaStorageSettings#isPreExpandValueSets()} returns {@code true}. *

*

* The default value for this setting is {@code 0}. @@ -2343,7 +1770,7 @@ public class DaoConfig { /** *

* This is the default value of {@code count} parameter for the ValueSet {@code $expand} operation when - * {@link DaoConfig#isPreExpandValueSets()} returns {@code true}. + * {@link JpaStorageSettings#isPreExpandValueSets()} returns {@code true}. *

*

* The default value for this setting is {@code 1000}. @@ -2358,11 +1785,11 @@ public class DaoConfig { /** *

* This is the default value of {@code count} parameter for the ValueSet {@code $expand} operation when - * {@link DaoConfig#isPreExpandValueSets()} returns {@code true}. + * {@link JpaStorageSettings#isPreExpandValueSets()} returns {@code true}. *

*

* If {@code thePreExpandValueSetsDefaultCount} is greater than - * {@link DaoConfig#getPreExpandValueSetsMaxCount()}, the lesser value is used. + * {@link JpaStorageSettings#getPreExpandValueSetsMaxCount()}, the lesser value is used. *

*

* The default value for this setting is {@code 1000}. @@ -2377,7 +1804,7 @@ public class DaoConfig { /** *

* This is the max value of {@code count} parameter for the ValueSet {@code $expand} operation when - * {@link DaoConfig#isPreExpandValueSets()} returns {@code true}. + * {@link JpaStorageSettings#isPreExpandValueSets()} returns {@code true}. *

*

* The default value for this setting is {@code 1000}. @@ -2392,11 +1819,11 @@ public class DaoConfig { /** *

* This is the max value of {@code count} parameter for the ValueSet {@code $expand} operation when - * {@link DaoConfig#isPreExpandValueSets()} returns {@code true}. + * {@link JpaStorageSettings#isPreExpandValueSets()} returns {@code true}. *

*

* If {@code thePreExpandValueSetsMaxCount} is lesser than - * {@link DaoConfig#getPreExpandValueSetsDefaultCount()}, the default {@code count} is lowered to the + * {@link JpaStorageSettings#getPreExpandValueSetsDefaultCount()}, the default {@code count} is lowered to the * new max {@code count}. *

*

@@ -2610,40 +2037,6 @@ public class DaoConfig { myEnableTaskResourceReindexing = theEnableTaskResourceReindexing; } - /** - * If this is enabled (disabled by default), Mass Ingestion Mode is enabled. In this mode, a number of - * runtime checks are disabled. This mode is designed for rapid backloading of data while the system is not - * being otherwise used. - *

- * In this mode: - *

- * - Tags/Profiles/Security Labels will not be updated on existing resources that already have them - * - Resources modification checks will be skipped in favour of a simple hash check - * - Extra resource ID caching is enabled - * - * @since 5.5.0 - */ - public boolean isMassIngestionMode() { - return myMassIngestionMode; - } - - /** - * If this is enabled (disabled by default), Mass Ingestion Mode is enabled. In this mode, a number of - * runtime checks are disabled. This mode is designed for rapid backloading of data while the system is not - * being otherwise used. - *

- * In this mode: - *

- * - Tags/Profiles/Security Labels will not be updated on existing resources that already have them - * - Resources modification checks will be skipped in favour of a simple hash check - * - Extra resource ID caching is enabled - * - * @since 5.5.0 - */ - public void setMassIngestionMode(boolean theMassIngestionMode) { - myMassIngestionMode = theMassIngestionMode; - } - /** * If set to true (default is false), date indexes will account for null values in the range columns. As of 5.3.0 * we no longer place null values in these columns, but legacy data may exist that still has these values. Note that @@ -2666,64 +2059,6 @@ public class DaoConfig { myAccountForDateIndexNulls = theAccountForDateIndexNulls; } - /** - * If set to true (default is false) then subscriptions will be triggered for resource updates even if they - * do not trigger a new version (e.g. $meta-add and $meta-delete). - * - * @since 5.5.0 - */ - public boolean isTriggerSubscriptionsForNonVersioningChanges() { - return myTriggerSubscriptionsForNonVersioningChanges; - } - - /** - * If set to true (default is false) then subscriptions will be triggered for resource updates even if they - * do not trigger a new version (e.g. $meta-add and $meta-delete). - * - * @since 5.5.0 - */ - public void setTriggerSubscriptionsForNonVersioningChanges(boolean theTriggerSubscriptionsForNonVersioningChanges) { - myTriggerSubscriptionsForNonVersioningChanges = theTriggerSubscriptionsForNonVersioningChanges; - } - - /** - * Get the batch transaction thread pool size. - * - * @since 5.6.0 - */ - public Integer getBundleBatchPoolSize() { - return myBundleBatchPoolSize; - } - - /** - * Set the batch transaction thread pool size. The default is @see {@link #DEFAULT_BUNDLE_BATCH_POOL_SIZE} - * set pool size to 1 for single thread - * - * @since 5.6.0 - */ - public void setBundleBatchPoolSize(Integer theBundleBatchPoolSize) { - this.myBundleBatchPoolSize = theBundleBatchPoolSize; - } - - /** - * Get the batch transaction thread max pool size. - * set max pool size to 1 for single thread - * - * @since 5.6.0 - */ - public Integer getBundleBatchMaxPoolSize() { - return myBundleBatchMaxPoolSize; - } - - /** - * Set the batch transaction thread pool size. The default is @see {@link #DEFAULT_BUNDLE_BATCH_MAX_POOL_SIZE} - * - * @since 5.6.0 - */ - public void setBundleBatchMaxPoolSize(Integer theBundleBatchMaxPoolSize) { - this.myBundleBatchMaxPoolSize = theBundleBatchMaxPoolSize; - } - public boolean canDeleteExpunge() { return isAllowMultipleDelete() && isExpungeEnabled() && isDeleteExpungeEnabled(); } @@ -2828,39 +2163,17 @@ public class DaoConfig { * @see FhirValidator#isConcurrentBundleValidation() * @since 5.7.0 */ - public DaoConfig setConcurrentBundleValidation(boolean theConcurrentBundleValidation) { + public JpaStorageSettings setConcurrentBundleValidation(boolean theConcurrentBundleValidation) { myConcurrentBundleValidation = theConcurrentBundleValidation; return this; } /** - * This setting indicates if a cross-partition subscription can be made. - * - * @see ModelConfig#setCrossPartitionSubscription(boolean) - * @since 7.5.0 - */ - public boolean isCrossPartitionSubscriptionEnabled() { - return this.myModelConfig.isCrossPartitionSubscription(); - } - - /** - * This setting indicates if a cross-partition subscription can be made. - * - * @see ModelConfig#setCrossPartitionSubscription(boolean) - * @since 5.7.0 - */ - public void setCrossPartitionSubscription(boolean theAllowCrossPartitionSubscription) { - this.myModelConfig.setCrossPartitionSubscription(theAllowCrossPartitionSubscription); - } - - - /** - * * This setting indicates whether binaries are allowed to be automatically inflated from external storage during requests. * Default is true. * - * @since 6.0.0 * @return whether binaries are allowed to be automatically inflated from external storage during requests. + * @since 6.0.0 */ public boolean isAllowAutoInflateBinaries() { return myAllowAutoInflateBinaries; @@ -2871,8 +2184,8 @@ public class DaoConfig { * This setting indicates whether binaries are allowed to be automatically inflated from external storage during requests. * Default is true. * - * @since 6.0.0 * @param theAllowAutoDeExternalizingBinaries the value to set. + * @since 6.0.0 */ public void setAllowAutoInflateBinaries(boolean theAllowAutoDeExternalizingBinaries) { myAllowAutoInflateBinaries = theAllowAutoDeExternalizingBinaries; @@ -2883,11 +2196,11 @@ public class DaoConfig { * which contain binary data. * Default is 10MB * + * @return the number of bytes to de-externalize during requests. * @since 6.0.0 - * @param theAutoInflateBinariesMaximumBytes the maximum number of bytes to de-externalize. */ - public void setAutoInflateBinariesMaximumBytes(long theAutoInflateBinariesMaximumBytes) { - myAutoInflateBinariesMaximumBytes = theAutoInflateBinariesMaximumBytes; + public long getAutoInflateBinariesMaximumBytes() { + return myAutoInflateBinariesMaximumBytes; } /** @@ -2895,23 +2208,22 @@ public class DaoConfig { * which contain binary data. * Default is 10MB * + * @param theAutoInflateBinariesMaximumBytes the maximum number of bytes to de-externalize. * @since 6.0.0 - * @return the number of bytes to de-externalize during requests. */ - public long getAutoInflateBinariesMaximumBytes() { - return myAutoInflateBinariesMaximumBytes; + public void setAutoInflateBinariesMaximumBytes(long theAutoInflateBinariesMaximumBytes) { + myAutoInflateBinariesMaximumBytes = theAutoInflateBinariesMaximumBytes; } - /** * This setting controls how long Bulk Export collection entities will be retained after job start. * Default is 2 hours. Setting this value to 0 or less will cause Bulk Export collection entities to never be expired. * * @since 6.0.0 */ - public int getBulkExportFileRetentionPeriodHours() { - return myBulkExportFileRetentionPeriodHours; - } + public int getBulkExportFileRetentionPeriodHours() { + return myBulkExportFileRetentionPeriodHours; + } /** * This setting controls how long Bulk Export collection entities will be retained after job start. @@ -3020,29 +2332,6 @@ public class DaoConfig { myJobFastTrackingEnabled = theJobFastTrackingEnabled; } - /** - * This setting controls whether the {@link BaseChannelSettings#isQualifyChannelName} - * should be qualified or not. - * Default is true, ie, the channel name will be qualified. - * - * @since 6.4.0 - */ - public void setQualifySubscriptionMatchingChannelName(boolean theQualifySubscriptionMatchingChannelName) { - myQualifySubscriptionMatchingChannelName = theQualifySubscriptionMatchingChannelName; - } - - /** - * This setting return whether the {@link BaseChannelSettings#isQualifyChannelName} - * should be qualified or not. - * - * @return whether the {@link BaseChannelSettings#isQualifyChannelName} is qualified or not - * @since 6.4.0 - */ - public boolean isQualifySubscriptionMatchingChannelName() { - return myQualifySubscriptionMatchingChannelName; - } - - public enum StoreMetaSourceInformationEnum { NONE(false, false), SOURCE_URI(true, false), @@ -3133,7 +2422,7 @@ public class DaoConfig { NON_VERSIONED, /** - * Tags are stored directly in the resource body (in the {@link ResourceHistoryTable} + * Tags are stored directly in the resource body (in the {@literal ResourceHistoryTable} * entry for the resource, meaning that they are not indexed separately, and are versioned with the rest * of the resource. */ diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/dao/IDao.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/dao/IDao.java index 253d07e92d4..b31652ea87f 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/dao/IDao.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/dao/IDao.java @@ -1,13 +1,6 @@ package ca.uhn.fhir.jpa.api.dao; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource; -import ca.uhn.fhir.jpa.model.entity.BaseHasResource; -import ca.uhn.fhir.jpa.model.entity.IBaseResourceEntity; -import ca.uhn.fhir.jpa.model.entity.ResourceTag; -import org.hl7.fhir.instance.model.api.IBaseResource; - -import java.util.Collection; /* * #%L diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/svc/IIdHelperService.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/svc/IIdHelperService.java index 195dbb1debe..df5e5fca7b8 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/svc/IIdHelperService.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/svc/IIdHelperService.java @@ -22,6 +22,7 @@ package ca.uhn.fhir.jpa.api.svc; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.interceptor.model.RequestPartitionId; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.PersistentIdToForcedIdMap; import ca.uhn.fhir.jpa.model.cross.IResourceLookup; import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId; @@ -115,10 +116,10 @@ public interface IIdHelperService { /** * Returns true if the given resource ID should be stored in a forced ID. Under default config - * (meaning client ID strategy is {@link ca.uhn.fhir.jpa.api.config.DaoConfig.ClientIdStrategyEnum#ALPHANUMERIC}) + * (meaning client ID strategy is {@link JpaStorageSettings.ClientIdStrategyEnum#ALPHANUMERIC}) * this will return true if the ID has any non-digit characters. *

- * In {@link ca.uhn.fhir.jpa.api.config.DaoConfig.ClientIdStrategyEnum#ANY} mode it will always return true. + * In {@link JpaStorageSettings.ClientIdStrategyEnum#ANY} mode it will always return true. */ boolean idRequiresForcedId(String theId); diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/batch/models/Batch2JobStartResponse.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/batch/models/Batch2JobStartResponse.java index 0b60f0ef43d..7f71267d9b6 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/batch/models/Batch2JobStartResponse.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/batch/models/Batch2JobStartResponse.java @@ -23,9 +23,9 @@ package ca.uhn.fhir.jpa.batch.models; public class Batch2JobStartResponse { /** - * The job id + * The job instance id */ - private String myJobId; + private String myInstanceId; /** * True if an existing job is being used instead @@ -34,12 +34,12 @@ public class Batch2JobStartResponse { */ private boolean myUsesCachedResult; - public String getJobId() { - return myJobId; + public String getInstanceId() { + return myInstanceId; } - public void setJobId(String theJobId) { - myJobId = theJobId; + public void setInstanceId(String theInstanceId) { + myInstanceId = theInstanceId; } public boolean isUsesCachedResult() { diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/bulk/export/provider/BulkDataExportProvider.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/bulk/export/provider/BulkDataExportProvider.java index 7dcdddf5c4a..dd5dba1e717 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/bulk/export/provider/BulkDataExportProvider.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/bulk/export/provider/BulkDataExportProvider.java @@ -25,7 +25,7 @@ import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.model.Batch2JobInfo; import ca.uhn.fhir.jpa.api.model.Batch2JobOperationResult; @@ -106,7 +106,7 @@ public class BulkDataExportProvider { private IBatch2JobRunner myJobRunner; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Autowired private DaoRegistry myDaoRegistry; @@ -158,7 +158,7 @@ public class BulkDataExportProvider { Batch2JobStartResponse response = myJobRunner.startNewJob(parameters); JobInfo info = new JobInfo(); - info.setJobMetadataId(response.getJobId()); + info.setJobMetadataId(response.getInstanceId()); // We set it to submitted, even if it's using a cached job // This isn't an issue because the actual status isn't used @@ -170,7 +170,7 @@ public class BulkDataExportProvider { private boolean shouldUseCache(ServletRequestDetails theRequestDetails) { CacheControlDirective cacheControlDirective = new CacheControlDirective().parse(theRequestDetails.getHeaders(Constants.HEADER_CACHE_CONTROL)); - return myDaoConfig.getEnableBulkExportJobReuse() && !cacheControlDirective.isNoCache(); + return myStorageSettings.getEnableBulkExportJobReuse() && !cacheControlDirective.isNoCache(); } private String getServerBase(ServletRequestDetails theRequestDetails) { @@ -518,8 +518,8 @@ public class BulkDataExportProvider { } @VisibleForTesting - public void setDaoConfig(DaoConfig theDaoConfig) { - myDaoConfig = theDaoConfig; + public void setStorageSettings(JpaStorageSettings theStorageSettings) { + myStorageSettings = theStorageSettings; } @VisibleForTesting diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageDao.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageDao.java index f611b8eceaa..61fb51910b2 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageDao.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageDao.java @@ -27,15 +27,15 @@ import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; import ca.uhn.fhir.jpa.api.model.LazyDaoMethodOutcome; import ca.uhn.fhir.jpa.cache.IResourceVersionSvc; import ca.uhn.fhir.jpa.cache.ResourcePersistentIdMap; import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.ResourceTable; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.searchparam.util.JpaParamUtil; import ca.uhn.fhir.model.api.IQueryParameterAnd; @@ -108,11 +108,9 @@ public abstract class BaseStorageDao { @Autowired protected DaoRegistry myDaoRegistry; @Autowired - protected ModelConfig myModelConfig; - @Autowired protected IResourceVersionSvc myResourceVersionSvc; @Autowired - protected DaoConfig myDaoConfig; + protected JpaStorageSettings myStorageSettings; @VisibleForTesting public void setSearchParamRegistry(ISearchParamRegistry theSearchParamRegistry) { @@ -143,7 +141,7 @@ public abstract class BaseStorageDao { verifyBundleTypeIsAppropriateForStorage(theResource); - if (!getConfig().getTreatBaseUrlsAsLocal().isEmpty()) { + if (!getStorageSettings().getTreatBaseUrlsAsLocal().isEmpty()) { replaceAbsoluteReferencesWithRelative(theResource, myFhirContext.newTerser()); } @@ -177,7 +175,7 @@ public abstract class BaseStorageDao { */ private void verifyBundleTypeIsAppropriateForStorage(IBaseResource theResource) { if (theResource instanceof IBaseBundle) { - Set allowedBundleTypes = getConfig().getBundleTypesAllowedForStorage(); + Set allowedBundleTypes = getStorageSettings().getBundleTypesAllowedForStorage(); String bundleType = BundleUtil.getBundleType(getContext(), (IBaseBundle) theResource); bundleType = defaultString(bundleType); if (!allowedBundleTypes.contains(bundleType)) { @@ -195,7 +193,7 @@ public abstract class BaseStorageDao { for (ResourceReferenceInfo nextRef : refs) { IIdType refId = nextRef.getResourceReference().getReferenceElement(); if (refId != null && refId.hasBaseUrl()) { - if (getConfig().getTreatBaseUrlsAsLocal().contains(refId.getBaseUrl())) { + if (getStorageSettings().getTreatBaseUrlsAsLocal().contains(refId.getBaseUrl())) { IIdType newRefId = refId.toUnqualified(); nextRef.getResourceReference().setReference(newRefId.getValue()); } @@ -204,7 +202,7 @@ public abstract class BaseStorageDao { } /** - * Handle {@link ModelConfig#getAutoVersionReferenceAtPaths() auto-populate-versions} + * Handle {@link JpaStorageSettings#getAutoVersionReferenceAtPaths() auto-populate-versions} *

* We only do this if thePerformIndexing is true because if it's false, that means * we're in a FHIR transaction during the first phase of write operation processing, @@ -216,12 +214,12 @@ public abstract class BaseStorageDao { *

* Also note that {@link BaseTransactionProcessor} also has code to do auto-versioning * and it is the one that takes care of the placeholder IDs. Look for the other caller of - * {@link #extractReferencesToAutoVersion(FhirContext, ModelConfig, IBaseResource)} + * {@link #extractReferencesToAutoVersion(FhirContext, StorageSettings, IBaseResource)} * to find this. */ private void performAutoVersioning(IBaseResource theResource, boolean thePerformIndexing) { if (thePerformIndexing) { - Set referencesToVersion = extractReferencesToAutoVersion(myFhirContext, myModelConfig, theResource); + Set referencesToVersion = extractReferencesToAutoVersion(myFhirContext, myStorageSettings, theResource); for (IBaseReference nextReference : referencesToVersion) { IIdType referenceElement = nextReference.getReferenceElement(); if (!referenceElement.hasBaseUrl()) { @@ -239,7 +237,7 @@ public abstract class BaseStorageDao { // the resource exists... latest id // will be the value in the IResourcePersistentId version = resourceVersionMap.getResourcePersistentId(referenceElement).getVersion(); - } else if (myDaoConfig.isAutoCreatePlaceholderReferenceTargets()) { + } else if (myStorageSettings.isAutoCreatePlaceholderReferenceTargets()) { // if idToPID doesn't contain object // but autcreateplaceholders is on // then the version will be 1 (the first version) @@ -431,9 +429,9 @@ public abstract class BaseStorageDao { } /** - * Provide the DaoConfig + * Provide the JpaStorageSettings */ - protected abstract DaoConfig getConfig(); + protected abstract JpaStorageSettings getStorageSettings(); /** * Returns the resource type for this DAO, or null if this is a system-level DAO @@ -555,14 +553,14 @@ public abstract class BaseStorageDao { } /** - * @see ModelConfig#getAutoVersionReferenceAtPaths() + * @see StorageSettings#getAutoVersionReferenceAtPaths() */ @Nonnull - public static Set extractReferencesToAutoVersion(FhirContext theFhirContext, ModelConfig theModelConfig, IBaseResource theResource) { + public static Set extractReferencesToAutoVersion(FhirContext theFhirContext, StorageSettings theStorageSettings, IBaseResource theResource) { Map references = Collections.emptyMap(); - if (!theModelConfig.getAutoVersionReferenceAtPaths().isEmpty()) { + if (!theStorageSettings.getAutoVersionReferenceAtPaths().isEmpty()) { String resourceName = theFhirContext.getResourceType(theResource); - for (String nextPath : theModelConfig.getAutoVersionReferenceAtPathsByResourceType(resourceName)) { + for (String nextPath : theStorageSettings.getAutoVersionReferenceAtPathsByResourceType(resourceName)) { List nextReferences = theFhirContext.newTerser().getValues(theResource, nextPath, IBaseReference.class); for (IBaseReference next : nextReferences) { if (next.getReferenceElement().hasVersionIdPart()) { diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageResourceDao.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageResourceDao.java index 98c8f045fa5..d1e8f71b61b 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageResourceDao.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseStorageResourceDao.java @@ -165,7 +165,7 @@ public abstract class BaseStorageResourceDao extends Ba } IBaseResource oldResource; - if (getConfig().isMassIngestionMode()) { + if (getStorageSettings().isMassIngestionMode()) { oldResource = null; } else { oldResource = getStorageResourceParser().toResource(theEntity, false); @@ -216,8 +216,8 @@ public abstract class BaseStorageResourceDao extends Ba } protected DeleteMethodOutcome deleteExpunge(String theUrl, RequestDetails theRequest) { - if (!getConfig().canDeleteExpunge()) { - throw new MethodNotAllowedException(Msg.code(963) + "_expunge is not enabled on this server: " + getConfig().cannotDeleteExpungeReason()); + if (!getStorageSettings().canDeleteExpunge()) { + throw new MethodNotAllowedException(Msg.code(963) + "_expunge is not enabled on this server: " + getStorageSettings().cannotDeleteExpungeReason()); } if (theUrl.contains(Constants.PARAMETER_CASCADE_DELETE) || (theRequest.getHeader(Constants.HEADER_CASCADE) != null && theRequest.getHeader(Constants.HEADER_CASCADE).equals(Constants.CASCADE_DELETE))) { @@ -226,7 +226,7 @@ public abstract class BaseStorageResourceDao extends Ba List urlsToDeleteExpunge = Collections.singletonList(theUrl); try { - String jobId = getDeleteExpungeJobSubmitter().submitJob(getConfig().getExpungeBatchSize(), urlsToDeleteExpunge, theRequest); + String jobId = getDeleteExpungeJobSubmitter().submitJob(getStorageSettings().getExpungeBatchSize(), urlsToDeleteExpunge, theRequest); return new DeleteMethodOutcome(createInfoOperationOutcome("Delete job submitted with id " + jobId)); } catch (InvalidRequestException e) { throw new InvalidRequestException(Msg.code(965) + "Invalid Delete Expunge Request: " + e.getMessage(), e); diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java index aac2fd419be..43c1de97dab 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java @@ -28,7 +28,6 @@ import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.Pointcut; import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.interceptor.model.TransactionWriteOperationsDetails; -import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.dao.IJpaDao; @@ -42,8 +41,8 @@ import ca.uhn.fhir.jpa.cache.ResourcePersistentIdMap; import ca.uhn.fhir.jpa.dao.tx.HapiTransactionService; import ca.uhn.fhir.jpa.delete.DeleteConflictUtil; import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource; -import ca.uhn.fhir.jpa.model.entity.ModelConfig; import ca.uhn.fhir.jpa.model.entity.ResourceTable; +import ca.uhn.fhir.jpa.model.entity.StorageSettings; import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage; import ca.uhn.fhir.jpa.searchparam.extractor.ResourceIndexedSearchParams; import ca.uhn.fhir.jpa.searchparam.matcher.InMemoryMatchResult; @@ -154,9 +153,7 @@ public abstract class BaseTransactionProcessor { @Autowired private HapiTransactionService myHapiTransactionService; @Autowired - private DaoConfig myDaoConfig; - @Autowired - private ModelConfig myModelConfig; + private StorageSettings myStorageSettings; @Autowired private InMemoryResourceMatcher myInMemoryResourceMatcher; @Autowired @@ -171,8 +168,8 @@ public abstract class BaseTransactionProcessor { private IResourceVersionSvc myResourceVersionSvc; @VisibleForTesting - public void setDaoConfig(DaoConfig theDaoConfig) { - myDaoConfig = theDaoConfig; + public void setStorageSettings(StorageSettings theStorageSettings) { + myStorageSettings = theStorageSettings; } public ITransactionProcessorVersionAdapter getVersionAdapter() { @@ -186,7 +183,7 @@ public abstract class BaseTransactionProcessor { private TaskExecutor getTaskExecutor() { if (myExecutor == null) { - myExecutor = myThreadPoolFactory.newThreadPool(myDaoConfig.getBundleBatchPoolSize(), myDaoConfig.getBundleBatchMaxPoolSize(), "bundle-batch-"); + myExecutor = myThreadPoolFactory.newThreadPool(myStorageSettings.getBundleBatchPoolSize(), myStorageSettings.getBundleBatchMaxPoolSize(), "bundle-batch-"); } return myExecutor; } @@ -373,7 +370,7 @@ public abstract class BaseTransactionProcessor { //Execute all non-gets on calling thread. nonGetCalls.forEach(RetriableBundleTask::run); //Execute all gets (potentially in a pool) - if (myDaoConfig.getBundleBatchPoolSize() == 1) { + if (myStorageSettings.getBundleBatchPoolSize() == 1) { getCalls.forEach(RetriableBundleTask::run); } else { getCalls.forEach(getCall -> getTaskExecutor().execute(getCall)); @@ -432,10 +429,10 @@ public abstract class BaseTransactionProcessor { List requestEntries = myVersionAdapter.getEntries(theRequest); int numberOfEntries = requestEntries.size(); - if (myDaoConfig.getMaximumTransactionBundleSize() != null && numberOfEntries > myDaoConfig.getMaximumTransactionBundleSize()) { + if (myStorageSettings.getMaximumTransactionBundleSize() != null && numberOfEntries > myStorageSettings.getMaximumTransactionBundleSize()) { throw new PayloadTooLargeException(Msg.code(528) + "Transaction Bundle Too large. Transaction bundle contains " + numberOfEntries + - " which exceedes the maximum permitted transaction bundle size of " + myDaoConfig.getMaximumTransactionBundleSize()); + " which exceedes the maximum permitted transaction bundle size of " + myStorageSettings.getMaximumTransactionBundleSize()); } ourLog.debug("Beginning {} with {} resources", theActionName, numberOfEntries); @@ -707,11 +704,6 @@ public abstract class BaseTransactionProcessor { return myContext.getVersion().newIdType().setValue(theValue); } - @VisibleForTesting - public void setModelConfig(ModelConfig theModelConfig) { - myModelConfig = theModelConfig; - } - /** * Searches for duplicate conditional creates and consolidates them. */ @@ -1157,7 +1149,7 @@ public abstract class BaseTransactionProcessor { if (conditionalRequestUrls.size() > 0) { theTransactionStopWatch.startTask("Check for conflicts in conditional resources"); } - if (!myDaoConfig.isMassIngestionMode()) { + if (!myStorageSettings.isMassIngestionMode()) { validateNoDuplicates(theRequest, theActionName, conditionalRequestUrls, theIdToPersistedOutcome.values()); } @@ -1166,7 +1158,7 @@ public abstract class BaseTransactionProcessor { theTransactionStopWatch.startTask("Check that all conditionally created/updated entities actually match their conditionals."); } - if (!myDaoConfig.isMassIngestionMode()) { + if (!myStorageSettings.isMassIngestionMode()) { validateAllInsertsMatchTheirConditionalUrls(theIdToPersistedOutcome, conditionalUrlToIdMap, theRequest); } theTransactionStopWatch.endCurrentTask(); @@ -1340,7 +1332,7 @@ public abstract class BaseTransactionProcessor { continue; } - Set referencesToAutoVersion = BaseStorageDao.extractReferencesToAutoVersion(myContext, myModelConfig, nextResource); + Set referencesToAutoVersion = BaseStorageDao.extractReferencesToAutoVersion(myContext, myStorageSettings, nextResource); if (referencesToAutoVersion.isEmpty()) { // no references to autoversion - we can do the resolve and save now resolveReferencesThenSaveAndIndexResource(theRequest, theTransactionDetails, @@ -1432,7 +1424,7 @@ public abstract class BaseTransactionProcessor { for (IBaseReference baseRef : theReferencesToAutoVersion) { IIdType id = baseRef.getReferenceElement(); if (!resourceVersionMap.containsKey(id) - && myDaoConfig.isAutoCreatePlaceholderReferenceTargets()) { + && myStorageSettings.isAutoCreatePlaceholderReferenceTargets()) { // not in the db, but autocreateplaceholders is true // so the version we'll set is "1" (since it will be // created later) diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/MatchResourceUrlService.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/MatchResourceUrlService.java index e87dfeb814a..c0a239a7bf6 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/MatchResourceUrlService.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/MatchResourceUrlService.java @@ -26,7 +26,7 @@ import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.api.HookParams; import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster; import ca.uhn.fhir.interceptor.api.Pointcut; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage; @@ -71,7 +71,7 @@ public class MatchResourceUrlService { @Autowired private MatchUrlService myMatchUrlService; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Autowired private IInterceptorBroadcaster myInterceptorBroadcaster; @Autowired @@ -154,7 +154,7 @@ public class MatchResourceUrlService { if (retVal.size() == 1) { T pid = retVal.iterator().next(); theTransactionDetails.addResolvedMatchUrl(matchUrl, pid); - if (myDaoConfig.isMatchUrlCacheEnabled()) { + if (myStorageSettings.isMatchUrlCacheEnabled()) { myMemoryCacheService.putAfterCommit(MemoryCacheService.CacheEnum.MATCH_URL, matchUrl, pid); } } @@ -185,7 +185,7 @@ public class MatchResourceUrlService { @Nullable public T processMatchUrlUsingCacheOnly(String theResourceType, String theMatchUrl) { T existing = null; - if (myDaoConfig.isMatchUrlCacheEnabled()) { + if (myStorageSettings.isMatchUrlCacheEnabled()) { String matchUrl = massageForStorage(theResourceType, theMatchUrl); existing = myMemoryCacheService.getIfPresent(MemoryCacheService.CacheEnum.MATCH_URL, matchUrl); } @@ -218,7 +218,7 @@ public class MatchResourceUrlService { Validate.notNull(theResourcePersistentId); String matchUrl = massageForStorage(theResourceType, theMatchUrl); theTransactionDetails.addResolvedMatchUrl(matchUrl, theResourcePersistentId); - if (myDaoConfig.isMatchUrlCacheEnabled()) { + if (myStorageSettings.isMatchUrlCacheEnabled()) { myMemoryCacheService.putAfterCommit(MemoryCacheService.CacheEnum.MATCH_URL, matchUrl, theResourcePersistentId); } } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilderFactory.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilderFactory.java index 7354f24575e..07e79f61c97 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilderFactory.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilderFactory.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.dao; * #L% */ -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.IDao; import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId; import org.hl7.fhir.instance.model.api.IBaseResource; @@ -32,10 +32,10 @@ public class SearchBuilderFactory> { @Autowired private ApplicationContext myApplicationContext; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; public ISearchBuilder newSearchBuilder(IDao theDao, String theResourceName, Class theResourceType) { - return (ISearchBuilder) myApplicationContext.getBean(ISearchBuilder.SEARCH_BUILDER_BEAN_NAME, theDao, theResourceName, theResourceType, myDaoConfig); + return (ISearchBuilder) myApplicationContext.getBean(ISearchBuilder.SEARCH_BUILDER_BEAN_NAME, theDao, theResourceName, theResourceType); } } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeOperation.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeOperation.java index 0bcc586940a..2bc78e4ad71 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeOperation.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeOperation.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.dao.expunge; * #L% */ -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.api.model.ExpungeOutcome; import ca.uhn.fhir.jpa.dao.tx.HapiTransactionService; @@ -46,7 +46,7 @@ public class ExpungeOperation implements Callable { @Autowired private IResourceExpungeService myExpungeDaoService; @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; private final String myResourceName; private final IResourcePersistentId myResourceId; @@ -119,7 +119,7 @@ public class ExpungeOperation implements Callable { } private PartitionRunner getPartitionRunner() { - return new PartitionRunner(PROCESS_NAME, THREAD_PREFIX, myDaoConfig.getExpungeBatchSize(), myDaoConfig.getExpungeThreadCount(), myTxService, myRequestDetails); + return new PartitionRunner(PROCESS_NAME, THREAD_PREFIX, myStorageSettings.getExpungeBatchSize(), myStorageSettings.getExpungeThreadCount(), myTxService, myRequestDetails); } private void deleteCurrentVersionsOfDeletedResources(List theResourceIds) { diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoResourceLinkResolver.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoResourceLinkResolver.java index 9794c79294b..6823407a7ec 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoResourceLinkResolver.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoResourceLinkResolver.java @@ -28,7 +28,7 @@ import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.context.RuntimeSearchParam; import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; @@ -67,7 +67,7 @@ import java.util.Optional; public class DaoResourceLinkResolver implements IResourceLinkResolver { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(DaoResourceLinkResolver.class); @Autowired - private DaoConfig myDaoConfig; + private JpaStorageSettings myStorageSettings; @Autowired private FhirContext myContext; @Autowired @@ -116,7 +116,7 @@ public class DaoResourceLinkResolver implements Optional createdTableOpt = createPlaceholderTargetIfConfiguredToDoSo(type, targetReference, idPart, theRequest, theTransactionDetails); if (!createdTableOpt.isPresent()) { - if (myDaoConfig.isEnforceReferentialIntegrityOnWrite() == false) { + if (myStorageSettings.isEnforceReferentialIntegrityOnWrite() == false) { return null; } @@ -160,7 +160,7 @@ public class DaoResourceLinkResolver implements public Optional createPlaceholderTargetIfConfiguredToDoSo(Class theType, IBaseReference theReference, @Nullable String theIdToAssignToPlaceholder, RequestDetails theRequest, TransactionDetails theTransactionDetails) { IBasePersistedResource valueOf = null; - if (myDaoConfig.isAutoCreatePlaceholderReferenceTargets()) { + if (myStorageSettings.isAutoCreatePlaceholderReferenceTargets()) { RuntimeResourceDefinition missingResourceDef = myContext.getResourceDefinition(theType); String resName = missingResourceDef.getName(); @@ -172,7 +172,7 @@ public class DaoResourceLinkResolver implements IFhirResourceDao placeholderResourceDao = myDaoRegistry.getResourceDao(theType); ourLog.debug("Automatically creating empty placeholder resource: {}", newResource.getIdElement().getValue()); - if (myDaoConfig.isPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets()) { + if (myStorageSettings.isPopulateIdentifierInAutoCreatedPlaceholderReferenceTargets()) { tryToCopyIdentifierFromReferenceToTargetResource(theReference, missingResourceDef, newResource); } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/validation/SearchParameterDaoValidator.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/validation/SearchParameterDaoValidator.java index 4faa84fbdd8..175a79a15fe 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/validation/SearchParameterDaoValidator.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/validation/SearchParameterDaoValidator.java @@ -24,7 +24,7 @@ import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirVersionEnum; import ca.uhn.fhir.context.RuntimeSearchParam; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import ca.uhn.fhir.util.ElementUtil; @@ -42,12 +42,12 @@ public class SearchParameterDaoValidator { private static final Pattern REGEX_SP_EXPRESSION_HAS_PATH = Pattern.compile("[( ]*([A-Z][a-zA-Z]+\\.)?[a-z].*"); private final FhirContext myFhirContext; - private final DaoConfig myDaoConfig; + private final JpaStorageSettings myStorageSettings; private final ISearchParamRegistry mySearchParamRegistry; - public SearchParameterDaoValidator(FhirContext theContext, DaoConfig theDaoConfig, ISearchParamRegistry theSearchParamRegistry) { + public SearchParameterDaoValidator(FhirContext theContext, JpaStorageSettings theStorageSettings, ISearchParamRegistry theSearchParamRegistry) { myFhirContext = theContext; - myDaoConfig = theDaoConfig; + myStorageSettings = theStorageSettings; mySearchParamRegistry = theSearchParamRegistry; } @@ -56,7 +56,7 @@ public class SearchParameterDaoValidator { * If overriding built-in SPs is disabled on this server, make sure we aren't * doing that */ - if (myDaoConfig.getModelConfig().isDefaultSearchParamsCanBeOverridden() == false) { + if (myStorageSettings.isDefaultSearchParamsCanBeOverridden() == false) { for (IPrimitiveType nextBaseType : searchParameter.getBase()) { String nextBase = nextBaseType.getValueAsString(); RuntimeSearchParam existingSearchParam = mySearchParamRegistry.getActiveSearchParam(nextBase, searchParameter.getCode()); @@ -113,7 +113,7 @@ public class SearchParameterDaoValidator { // omitting validation for DSTU2_HL7ORG, DSTU2_1 and DSTU2 } else { - if (myDaoConfig.isValidateSearchParameterExpressionsOnSave()) { + if (myStorageSettings.isValidateSearchParameterExpressionsOnSave()) { validateExpressionPath(searchParameter); diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaProvider.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaProvider.java index 9b051546d8d..c1dd9a15f0b 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaProvider.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaProvider.java @@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.provider; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.api.model.ExpungeOutcome; import ca.uhn.fhir.jpa.model.util.JpaConstants; @@ -47,7 +47,7 @@ public abstract class BaseJpaProvider { public static final String REMOTE_UA = "req.userAgent"; private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseJpaProvider.class); @Autowired - protected DaoConfig myDaoConfig; + protected JpaStorageSettings myStorageSettings; @Autowired private FhirContext myContext; @@ -55,8 +55,8 @@ public abstract class BaseJpaProvider { super(); } - public void setDaoConfigForUnitTest(DaoConfig theDaoConfig) { - myDaoConfig = theDaoConfig; + public void setStorageSettingsForUnitTest(JpaStorageSettings theStorageSettings) { + myStorageSettings = theStorageSettings; } protected ExpungeOptions createExpungeOptions(IPrimitiveType theLimit, IPrimitiveType theExpungeDeletedResources, IPrimitiveType theExpungeOldVersions, IPrimitiveType theExpungeEverything) { diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/util/MemoryCacheService.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/util/MemoryCacheService.java index cef7f02513d..fda4305fb38 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/util/MemoryCacheService.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/util/MemoryCacheService.java @@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.util; * #L% */ -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import ca.uhn.fhir.jpa.api.model.TranslationQuery; import ca.uhn.fhir.jpa.model.entity.TagTypeEnum; import ca.uhn.fhir.sl.cache.Cache; @@ -49,11 +49,11 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank; // TODO: JA2 extract an interface for this class and use it everywhere public class MemoryCacheService { - private final DaoConfig myDaoConfig; + private final JpaStorageSettings myStorageSettings; private final EnumMap> myCaches = new EnumMap<>(CacheEnum.class); - public MemoryCacheService(DaoConfig theDaoConfig) { - myDaoConfig = theDaoConfig; + public MemoryCacheService(JpaStorageSettings theStorageSettings) { + myStorageSettings = theStorageSettings; populateCaches(); } @@ -67,7 +67,7 @@ public class MemoryCacheService { switch (next) { case CONCEPT_TRANSLATION: case CONCEPT_TRANSLATION_REVERSE: - timeoutSeconds = SECONDS.convert(myDaoConfig.getTranslationCachesExpireAfterWriteInMinutes(), MINUTES); + timeoutSeconds = SECONDS.convert(myStorageSettings.getTranslationCachesExpireAfterWriteInMinutes(), MINUTES); maximumSize = 10000; break; case PID_TO_FORCED_ID: @@ -80,7 +80,7 @@ public class MemoryCacheService { default: timeoutSeconds = SECONDS.convert(1, MINUTES); maximumSize = 10000; - if (myDaoConfig.isMassIngestionMode()) { + if (myStorageSettings.isMassIngestionMode()) { timeoutSeconds = SECONDS.convert(50, MINUTES); maximumSize = 100000; } diff --git a/hapi-fhir-structures-dstu2.1/pom.xml b/hapi-fhir-structures-dstu2.1/pom.xml index e97e6d2a274..8d574d26289 100644 --- a/hapi-fhir-structures-dstu2.1/pom.xml +++ b/hapi-fhir-structures-dstu2.1/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml index 2d2d2105102..95412544583 100644 --- a/hapi-fhir-structures-dstu2/pom.xml +++ b/hapi-fhir-structures-dstu2/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-dstu3/pom.xml b/hapi-fhir-structures-dstu3/pom.xml index ca7693f26fb..9b4521c92b1 100644 --- a/hapi-fhir-structures-dstu3/pom.xml +++ b/hapi-fhir-structures-dstu3/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-hl7org-dstu2/pom.xml b/hapi-fhir-structures-hl7org-dstu2/pom.xml index 7f617a13f4f..c24f230bc71 100644 --- a/hapi-fhir-structures-hl7org-dstu2/pom.xml +++ b/hapi-fhir-structures-hl7org-dstu2/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r4/pom.xml b/hapi-fhir-structures-r4/pom.xml index 42be98440b7..27e5e0062c9 100644 --- a/hapi-fhir-structures-r4/pom.xml +++ b/hapi-fhir-structures-r4/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r4b/pom.xml b/hapi-fhir-structures-r4b/pom.xml index e40909134f0..4feb10e4b7a 100644 --- a/hapi-fhir-structures-r4b/pom.xml +++ b/hapi-fhir-structures-r4b/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r5/pom.xml b/hapi-fhir-structures-r5/pom.xml index 0a3d52c191d..cc0465c3c0b 100644 --- a/hapi-fhir-structures-r5/pom.xml +++ b/hapi-fhir-structures-r5/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-test-utilities/pom.xml b/hapi-fhir-test-utilities/pom.xml index 7eafd84b929..2cbf65827a3 100644 --- a/hapi-fhir-test-utilities/pom.xml +++ b/hapi-fhir-test-utilities/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/system/HapiTestSystemProperties.java b/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/system/HapiTestSystemProperties.java index 015bea3ba8a..817a3dc0578 100644 --- a/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/system/HapiTestSystemProperties.java +++ b/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/system/HapiTestSystemProperties.java @@ -43,7 +43,7 @@ public final class HapiTestSystemProperties { } /** - * Creates a DaoConfig with setMassIngestionMode(true) at test app context startup time + * Creates a JpaStorageSettings with setMassIngestionMode(true) at test app context startup time */ public static void enableMassIngestionMode() { System.setProperty(MASS_INGESTION_MODE, "true"); diff --git a/hapi-fhir-testpage-overlay/pom.xml b/hapi-fhir-testpage-overlay/pom.xml index 7894c345226..6cd2289821e 100644 --- a/hapi-fhir-testpage-overlay/pom.xml +++ b/hapi-fhir-testpage-overlay/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-testpage-overlay/src/test/java/ca/uhn/fhir/jpa/test/FhirServerConfig.java b/hapi-fhir-testpage-overlay/src/test/java/ca/uhn/fhir/jpa/test/FhirServerConfig.java index baf895604f9..43f8c9648ad 100644 --- a/hapi-fhir-testpage-overlay/src/test/java/ca/uhn/fhir/jpa/test/FhirServerConfig.java +++ b/hapi-fhir-testpage-overlay/src/test/java/ca/uhn/fhir/jpa/test/FhirServerConfig.java @@ -4,7 +4,7 @@ package ca.uhn.fhir.jpa.test; //import org.hibernate.jpa.HibernatePersistenceProvider; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.transaction.annotation.EnableTransactionManagement; @@ -14,8 +14,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; public class FhirServerConfig { @Bean - public DaoConfig daoConfig() { - DaoConfig retVal = new DaoConfig(); + public JpaStorageSettings storageSettings() { + JpaStorageSettings retVal = new JpaStorageSettings(); return retVal; } } diff --git a/hapi-fhir-testpage-overlay/src/test/resources/fhir-jpabase-spring-test-config.xml b/hapi-fhir-testpage-overlay/src/test/resources/fhir-jpabase-spring-test-config.xml deleted file mode 100644 index 8ebadf06b5c..00000000000 --- a/hapi-fhir-testpage-overlay/src/test/resources/fhir-jpabase-spring-test-config.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/hapi-fhir-validation-resources-dstu2.1/pom.xml b/hapi-fhir-validation-resources-dstu2.1/pom.xml index e3b8da53ffe..742e11b93c1 100644 --- a/hapi-fhir-validation-resources-dstu2.1/pom.xml +++ b/hapi-fhir-validation-resources-dstu2.1/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-dstu2/pom.xml b/hapi-fhir-validation-resources-dstu2/pom.xml index 7a95f37b9ca..4b1d759f233 100644 --- a/hapi-fhir-validation-resources-dstu2/pom.xml +++ b/hapi-fhir-validation-resources-dstu2/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-dstu3/pom.xml b/hapi-fhir-validation-resources-dstu3/pom.xml index 18c0bc8892a..680b4a9699b 100644 --- a/hapi-fhir-validation-resources-dstu3/pom.xml +++ b/hapi-fhir-validation-resources-dstu3/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-r4/pom.xml b/hapi-fhir-validation-resources-r4/pom.xml index 902d40d49b0..cde9cb17ea6 100644 --- a/hapi-fhir-validation-resources-r4/pom.xml +++ b/hapi-fhir-validation-resources-r4/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-r5/pom.xml b/hapi-fhir-validation-resources-r5/pom.xml index 2283b5ba37b..91dc24b6f59 100644 --- a/hapi-fhir-validation-resources-r5/pom.xml +++ b/hapi-fhir-validation-resources-r5/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation/pom.xml b/hapi-fhir-validation/pom.xml index 9465d75881b..4debf4152bf 100644 --- a/hapi-fhir-validation/pom.xml +++ b/hapi-fhir-validation/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-tinder-plugin/pom.xml b/hapi-tinder-plugin/pom.xml index f57efeddec6..9b0546f0981 100644 --- a/hapi-tinder-plugin/pom.xml +++ b/hapi-tinder-plugin/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../pom.xml diff --git a/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans_java.vm b/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans_java.vm index effa0dc4c9b..1cb6f5e6102 100644 --- a/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans_java.vm +++ b/hapi-tinder-plugin/src/main/resources/vm/jpa_spring_beans_java.vm @@ -7,7 +7,7 @@ import java.util.concurrent.Executors; import javax.persistence.EntityManager; import org.springframework.transaction.PlatformTransactionManager; -import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.config.JpaStorageSettings; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/hapi-tinder-test/pom.xml b/hapi-tinder-test/pom.xml index 62328d32bd7..b5339e92174 100644 --- a/hapi-tinder-test/pom.xml +++ b/hapi-tinder-test/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 46eb4230597..86c24b00d60 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ ca.uhn.hapi.fhir hapi-fhir pom - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT HAPI-FHIR An open-source implementation of the FHIR specification in Java. https://hapifhir.io @@ -2247,7 +2247,7 @@ org.apache.maven.plugins maven-war-plugin - 3.2.3 + 3.3.2 org.codehaus.mojo diff --git a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml index 37ee9cf3992..8e5b3359bbd 100644 --- a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml +++ b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../../pom.xml diff --git a/tests/hapi-fhir-base-test-mindeps-client/pom.xml b/tests/hapi-fhir-base-test-mindeps-client/pom.xml index 8a888a812eb..2ffa6a33301 100644 --- a/tests/hapi-fhir-base-test-mindeps-client/pom.xml +++ b/tests/hapi-fhir-base-test-mindeps-client/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../../pom.xml diff --git a/tests/hapi-fhir-base-test-mindeps-server/pom.xml b/tests/hapi-fhir-base-test-mindeps-server/pom.xml index dca68e8f350..4a56e107df3 100644 --- a/tests/hapi-fhir-base-test-mindeps-server/pom.xml +++ b/tests/hapi-fhir-base-test-mindeps-server/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.5.1-SNAPSHOT + 6.5.2-SNAPSHOT ../../pom.xml