From 6d58df0f44d093e7a8b42903f7fbcb07c5c83673 Mon Sep 17 00:00:00 2001
From: James Agnew
Date: Sun, 3 Dec 2023 11:15:37 -0500
Subject: [PATCH] Jakarta/Javax Servlet Migration (#5429)
* Servlet migrsation changes
* Apply spotless
* Work on migration
* Start working on JPA migration
* Test fixes
* Test fixes
* Test fixes
* Work
* Work on servlet migration
* Work on migration
* Work on fixes
* Imports fix
* Work on tests
* Test fix
* All tests passing
* Work on migration
* Schema generator
* Refactor ID strategy
* Some test fixes
* Test fixes
* API additions
* Work on websockets
* Test fixe
* Version bump
* Work on migration
* All tests have passed!
* Work on test fixes
* Fixes
* Work on fixes
* CDR fix
* Work on migration
* Fixes
* Spotless
* Disable onetoone ban
* Adjust migratyions
* Transaction service fix
* Add tinyint to migrator
* Work
* Migration
* Compile fix
* Add license
* Test fix
* Test fix
* Cleanup
* Cleanup attempt
* Test fix
* Reslve fixmes
* Remove legacy lastn implementation
* Test cleanup
* Cleanup
* Remove dead import
* Bad import setups
* Review comments
* Review fixes
* Build fix
* Test fix
* Spotless
* Account for CR changes
* Compile fixes
* Rollback one change
* Test tweak
* License header
* Test fix
* Test fix part 2:
* Clean up tx isolation
* Spotless
* Spotless apply
* Drop min SQL Server level
* Attempted test fix
* Test fix
* Test fix
* Test fix
* Bump hibernate
* Test fix
* Test fixes
* Test fixes
* Test fixes
* Test cleanup
* One more test fix
* Test fix
* Try to fix test
* Clean up expunge
* Test fix
* Remove unneeded task
* Spotless
* Bump compiler plugin
* Spotless
* Compile fix
* Add license headers
* License header
* Test fixes
* Bump animal sniffer
* Spotless
* Bump Jetty version
* Test fix and version bump
* Cleanup
---------
Co-authored-by: Tadgh
---
.mvn/wrapper/MavenWrapperDownloader.java | 13 +-
hapi-deployable-pom/pom.xml | 11 +-
hapi-fhir-android/pom.xml | 8 +-
hapi-fhir-base/pom.xml | 17 +-
.../context/support/LookupCodeRequest.java | 19 +
.../ca/uhn/fhir/interceptor/api/Pointcut.java | 54 +-
.../ca/uhn/fhir/model/api/BaseElement.java | 6 +-
.../ca/uhn/fhir/model/api/IFhirVersion.java | 9 +-
.../narrative2/NarrativeTemplateManifest.java | 11 +-
.../uhn/fhir/rest/annotation/Operation.java | 4 +-
.../ca/uhn/fhir/rest/annotation/Read.java | 5 +-
.../uhn/fhir/rest/annotation/Transaction.java | 5 +-
.../rest/annotation/TransactionParam.java | 5 +-
.../ca/uhn/fhir/rest/annotation/Validate.java | 5 +-
.../fhir/rest/gclient/TokenClientParam.java | 4 +-
.../uhn/fhir/rest/param/ParamPrefixEnum.java | 4 +-
.../java/ca/uhn/fhir/util/AttachmentUtil.java | 6 +-
.../java/ca/uhn/fhir/util/rdf/RDFUtil.java | 3 +-
.../schematron/SchematronBaseValidator.java | 9 +-
.../ca/uhn/fhir/i18n/HapiLocalizerTest.java | 10 +-
.../api/ResourceMetadataKeyEnumTest.java | 3 +-
.../java/ca/uhn/fhir/model/api/TagTest.java | 5 +-
.../rest/api/CacheControlDirectiveTest.java | 4 +-
.../uhn/fhir/rest/api/EncodingEnumTest.java | 2 +-
.../uhn/fhir/rest/api/MethodOutcomeTest.java | 3 +-
.../ca/uhn/fhir/rest/param/DateParamTest.java | 4 +-
.../fhir/rest/param/QualifierDetailsTest.java | 3 +-
.../uhn/fhir/rest/param/StringParamTest.java | 12 +-
.../BaseServerResponseExceptionTest.java | 2 +-
.../ca/uhn/fhir/util/DateRangeUtilTest.java | 5 +-
.../java/ca/uhn/fhir/util/LogUtilTest.java | 6 +-
.../ca/uhn/fhir/util/ReflectionUtilTest.java | 12 +-
.../validation/ResultSeverityEnumTest.java | 4 +-
hapi-fhir-bom/pom.xml | 4 +-
hapi-fhir-checkstyle/pom.xml | 4 +-
.../src/checkstyle/hapi-base-checkstyle.xml | 7 +
hapi-fhir-cli/hapi-fhir-cli-api/pom.xml | 74 +-
.../ca/uhn/fhir/cli/BulkImportCommand.java | 12 +-
.../fhir/cli/ReindexTerminologyCommand.java | 3 +-
.../fhir/cli/WebsocketSubscribeCommand.java | 47 +-
...mandIT.java => BulkImportCommandTest.java} | 19 +-
.../HapiClearMigrationLockCommandTest.java | 9 +-
.../HapiFlywayMigrateDatabaseCommandTest.java | 3 +-
.../fhir/cli/HeaderPassthroughOptionTest.java | 39 +-
hapi-fhir-cli/hapi-fhir-cli-app/pom.xml | 2 +-
hapi-fhir-cli/pom.xml | 2 +-
hapi-fhir-client-okhttp/pom.xml | 7 +-
.../okhttp/GenericOkHttpClientDstu2Test.java | 869 ++++++++---------
hapi-fhir-client/pom.xml | 2 +-
.../rest/client/apache/ApacheHttpClient.java | 16 +-
.../client/apache/ApacheHttpResponse.java | 16 +-
.../rest/client/apache/BaseHttpClient.java | 4 +-
.../client/apache/GZipContentInterceptor.java | 4 +-
.../interceptor/BasicAuthInterceptor.java | 4 +-
.../client/interceptor/CookieInterceptor.java | 4 +-
.../rest/client/method/BaseMethodBinding.java | 40 +-
.../BaseOutcomeReturningMethodBinding.java | 4 +-
...indingWithResourceIdButNoResourceBody.java | 7 +-
.../client/method/ConditionalParamBinder.java | 4 +-
.../client/method/DeleteMethodBinding.java | 5 +-
.../client/method/HistoryMethodBinding.java | 4 +-
.../rest/client/method/NullParameter.java | 4 +-
.../client/method/OperationMethodBinding.java | 8 +-
.../client/method/PatchMethodBinding.java | 11 +-
.../rest/client/method/RawParamsParmeter.java | 4 +-
.../rest/client/method/ReadMethodBinding.java | 13 +-
.../rest/client/method/SearchParameter.java | 61 +-
.../client/method/TransactionParameter.java | 8 +-
hapi-fhir-converter/pom.xml | 38 +-
.../VersionedApiConverterInterceptor.java | 4 +-
...ersionedApiConverterInterceptorR4Test.java | 53 +-
hapi-fhir-dist/pom.xml | 16 +-
hapi-fhir-docs/pom.xml | 10 +-
.../fhir/docs/AuthorizationInterceptors.java | 9 +-
.../AuthorizingTesterUiClientFactory.java | 3 +-
.../ca/uhn/hapi/fhir/docs/BalpExample.java | 2 +-
.../fhir/docs/ClientTransactionExamples.java | 8 +-
.../java/ca/uhn/hapi/fhir/docs/Copier.java | 6 +-
.../ca/uhn/hapi/fhir/docs/Dstu2Examples.java | 2 +-
.../hapi/fhir/docs/ExampleRestfulClient.java | 3 +-
.../hapi/fhir/docs/ExampleRestfulServlet.java | 4 +-
.../uhn/hapi/fhir/docs/ExtensionsDstu3.java | 9 +-
.../uhn/hapi/fhir/docs/FhirContextIntro.java | 6 +-
.../ca/uhn/hapi/fhir/docs/FhirDataModel.java | 12 +-
.../fhir/docs/JaxRsConformanceProvider.java | 10 +-
.../fhir/docs/JaxRsPatientRestProvider.java | 22 +-
.../uhn/hapi/fhir/docs/PartitionExamples.java | 2 +-
.../fhir/docs/RequestCounterInterceptor.java | 5 +-
.../docs/RequestExceptionInterceptor.java | 4 +-
.../RestfulPatientResourceProviderMore.java | 63 +-
.../hapi/fhir/docs/SecurityInterceptors.java | 5 +-
.../hapi/fhir/docs/ServerETagExamples.java | 5 +-
.../uhn/hapi/fhir/docs/ServerOperations.java | 10 +-
.../uhn/hapi/fhir/docs/ServletExamples.java | 4 +-
.../uhn/hapi/fhir/docs/ValidatorExamples.java | 2 +-
.../hapi/fhir/changelog/7_0_0/changes.yaml | 25 +
.../fhir/docs/server_jpa/database_support.md | 25 +-
hapi-fhir-jacoco/pom.xml | 2 +-
hapi-fhir-jaxrsserver-base/pom.xml | 27 +-
.../fhir/jaxrs/client/JaxRsHttpClient.java | 14 +-
.../fhir/jaxrs/client/JaxRsHttpRequest.java | 8 +-
.../fhir/jaxrs/client/JaxRsHttpResponse.java | 6 +-
.../client/JaxRsRestfulClientFactory.java | 6 +-
.../server/AbstractJaxRsBundleProvider.java | 16 +-
.../AbstractJaxRsConformanceProvider.java | 12 +-
.../server/AbstractJaxRsPageProvider.java | 12 +-
.../jaxrs/server/AbstractJaxRsProvider.java | 12 +-
.../server/AbstractJaxRsResourceProvider.java | 15 +-
.../JaxRsExceptionInterceptor.java | 8 +-
.../interceptor/JaxRsResponseException.java | 3 +-
.../fhir/jaxrs/server/util/JaxRsRequest.java | 4 +-
.../fhir/jaxrs/server/util/JaxRsResponse.java | 4 +-
.../client/GenericJaxRsClientDstu2Test.java | 915 ++++++++---------
.../client/GenericJaxRsClientDstu3Test.java | 916 ++++++++----------
.../client/JaxRsRestfulClientFactoryTest.java | 4 +-
.../ca/uhn/fhir/jaxrs/client/MyFilter.java | 8 +-
...xRsConformanceProviderDstu2Hl7OrgTest.java | 6 +-
...ctJaxRsConformanceProviderDstu2_1Test.java | 8 +-
...ractJaxRsConformanceProviderDstu3Test.java | 6 +-
...bstractJaxRsConformanceProviderR4Test.java | 6 +-
.../AbstractJaxRsConformanceProviderTest.java | 6 +-
.../server/AbstractJaxRsProviderTest.java | 8 +-
...bstractJaxRsResourceProviderDstu3Test.java | 4 +-
.../AbstractJaxRsResourceProviderTest.java | 4 +-
.../JaxRsExceptionInterceptorTest.java | 43 +-
.../JaxRsResponseExceptionTest.java | 10 +-
.../TestJaxRsConformanceRestProvider.java | 8 +-
...TestJaxRsConformanceRestProviderDstu3.java | 14 +-
.../test/TestJaxRsMockPageProvider.java | 9 +-
.../test/TestJaxRsMockPageProviderDstu3.java | 8 +-
.../TestJaxRsMockPatientRestProvider.java | 54 +-
...xRsMockPatientRestProviderDstu2Hl7Org.java | 10 +-
...stJaxRsMockPatientRestProviderDstu2_1.java | 47 +-
...TestJaxRsMockPatientRestProviderDstu3.java | 10 +-
.../TestJaxRsMockPatientRestProviderR4.java | 47 +-
.../server/util/JaxRsRequestDstu3Test.java | 6 +-
.../jaxrs/server/util/JaxRsRequestTest.java | 7 +-
.../server/util/JaxRsResponseDstu3Test.java | 2 +-
.../jaxrs/server/util/JaxRsResponseTest.java | 2 +-
hapi-fhir-jpa/pom.xml | 12 +-
...ocalContainerEntityManagerFactoryBean.java | 9 +-
.../jpa/sched/BaseSchedulerServiceImpl.java | 2 +-
.../util/DerbyTenSevenHapiFhirDialect.java | 33 +-
.../jpa/util}/ISequenceValueMassager.java | 10 +-
hapi-fhir-jpaserver-base/pom.xml | 191 ++--
.../uhn/fhir/jpa/batch2/JpaBatch2Config.java | 3 +-
.../jpa/batch2/JpaJobPersistenceImpl.java | 7 +-
.../DatabaseBlobBinaryStorageSvcImpl.java | 6 +-
...BulkDataExportJobSchedulingHelperImpl.java | 2 +-
.../export/svc/JpaBulkExportProcessor.java | 2 +-
.../bulk/imprt/svc/BulkDataImportSvcImpl.java | 2 +-
.../fhir/jpa/config/Batch2SupportConfig.java | 3 +-
.../fhir/jpa/config/EnversAuditConfig.java | 3 +-
.../config/HapiFhirHibernateJpaDialect.java | 2 +-
.../ca/uhn/fhir/jpa/config/JpaConfig.java | 12 +-
.../util/HapiEntityManagerFactoryUtil.java | 66 +-
.../ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java | 20 +-
.../fhir/jpa/dao/BaseHapiFhirResourceDao.java | 17 +-
.../fhir/jpa/dao/BaseHapiFhirSystemDao.java | 18 +-
.../uhn/fhir/jpa/dao/FhirSystemDaoDstu2.java | 2 +-
.../fhir/jpa/dao/FulltextSearchSvcImpl.java | 6 +-
.../ca/uhn/fhir/jpa/dao/HistoryBuilder.java | 51 +-
...JpaPersistedResourceValidationSupport.java | 2 +-
.../jpa/dao/JpaResourceDaoCodeSystem.java | 2 +-
.../jpa/dao/JpaResourceDaoComposition.java | 2 +-
.../fhir/jpa/dao/JpaResourceDaoEncounter.java | 2 +-
.../jpa/dao/JpaResourceDaoObservation.java | 73 +-
.../fhir/jpa/dao/JpaResourceDaoPatient.java | 2 +-
.../dao/ObservationLastNIndexPersistSvc.java | 260 -----
.../fhir/jpa/dao/TransactionProcessor.java | 36 +-
.../dao/data/IResourceHistoryTableDao.java | 10 +-
.../data/custom/IResourceTableDaoImpl.java | 4 +-
.../jpa/dao/dstu3/FhirSystemDaoDstu3.java | 2 +-
.../dao/expunge/ExpungeEverythingService.java | 75 +-
.../dao/index/DaoSearchParamSynchronizer.java | 18 +-
.../fhir/jpa/dao/index/IdHelperService.java | 36 +-
...rchParamWithInlineReferencesExtractor.java | 6 +-
.../fhir/jpa/dao/mdm/MdmLinkDaoJpaImpl.java | 64 +-
.../fhir/jpa/dao/mdm/MdmMetricSvcJpaImpl.java | 8 +-
.../uhn/fhir/jpa/dao/r4/FhirSystemDaoR4.java | 2 +-
.../fhir/jpa/dao/r4b/FhirSystemDaoR4B.java | 2 +-
.../uhn/fhir/jpa/dao/r5/FhirSystemDaoR5.java | 2 +-
.../uhn/fhir/jpa/dao/search/PathContext.java | 74 ++
.../delete/DeleteConflictFinderService.java | 8 +-
.../delete/batch2/DeleteExpungeSvcImpl.java | 2 +-
.../jpa/entity/Batch2JobInstanceEntity.java | 26 +-
.../jpa/entity/Batch2WorkChunkEntity.java | 32 +-
.../entity/BulkExportCollectionEntity.java | 26 +-
.../BulkExportCollectionFileEntity.java | 22 +-
.../fhir/jpa/entity/BulkExportJobEntity.java | 28 +-
.../fhir/jpa/entity/BulkImportJobEntity.java | 26 +-
.../jpa/entity/BulkImportJobFileEntity.java | 24 +-
.../jpa/entity/HapiFhirEnversRevision.java | 14 +-
.../java/ca/uhn/fhir/jpa/entity/MdmLink.java | 38 +-
.../uhn/fhir/jpa/entity/PartitionEntity.java | 11 +-
.../jpa/entity/ResourceReindexJobEntity.java | 18 +-
.../fhir/jpa/entity/ResourceSearchView.java | 16 +-
.../java/ca/uhn/fhir/jpa/entity/Search.java | 43 +-
.../ca/uhn/fhir/jpa/entity/SearchInclude.java | 23 +-
.../ca/uhn/fhir/jpa/entity/SearchResult.java | 2 +-
.../fhir/jpa/entity/SubscriptionTable.java | 2 +-
.../uhn/fhir/jpa/entity/TermCodeSystem.java | 2 +-
.../jpa/entity/TermCodeSystemVersion.java | 30 +-
.../ca/uhn/fhir/jpa/entity/TermConcept.java | 38 +-
.../jpa/entity/TermConceptDesignation.java | 24 +-
.../uhn/fhir/jpa/entity/TermConceptMap.java | 2 +-
.../fhir/jpa/entity/TermConceptMapGroup.java | 2 +-
.../entity/TermConceptMapGroupElement.java | 2 +-
.../TermConceptMapGroupElementTarget.java | 2 +-
.../entity/TermConceptParentChildLink.java | 31 +-
.../fhir/jpa/entity/TermConceptProperty.java | 32 +-
.../ca/uhn/fhir/jpa/entity/TermValueSet.java | 38 +-
.../fhir/jpa/entity/TermValueSetConcept.java | 30 +-
.../TermValueSetConceptDesignation.java | 14 +-
.../jpa/entity/TermValueSetConceptView.java | 8 +-
.../entity/TermValueSetConceptViewOracle.java | 8 +-
.../tasks/HapiFhirJpaMigrationTasks.java | 4 +
.../fhir/jpa/packages/JpaPackageCache.java | 28 +-
.../jpa/packages/PackageInstallerSvcImpl.java | 2 +-
.../jpa/partition/PartitionLookupSvcImpl.java | 2 +-
.../BaseJpaResourceProviderCodeSystem.java | 2 +-
.../BaseJpaResourceProviderComposition.java | 2 +-
.../BaseJpaResourceProviderConceptMap.java | 3 +-
.../BaseJpaResourceProviderEncounter.java | 4 +-
...BaseJpaResourceProviderEncounterDstu2.java | 4 +-
.../BaseJpaResourceProviderObservation.java | 4 +-
.../BaseJpaResourceProviderPatient.java | 4 +-
.../jpa/provider/BaseJpaSystemProvider.java | 2 +-
.../provider/JpaConformanceProviderDstu2.java | 2 +-
.../jpa/provider/ProcessMessageProvider.java | 3 +-
.../provider/TerminologyUploaderProvider.java | 6 +-
.../provider/ValueSetOperationProvider.java | 2 +-
.../ValueSetOperationProviderDstu2.java | 2 +-
.../dstu3/JpaConformanceProviderDstu3.java | 2 +-
.../r4/MemberMatchR4ResourceProvider.java | 2 +-
.../HapiHSearchAnalysisConfigurers.java | 58 +-
.../search/PersistedJpaBundleProvider.java | 4 +-
.../fhir/jpa/search/ResourceSearchUrlSvc.java | 2 +-
.../jpa/search/SynchronousSearchSvcImpl.java | 2 +-
.../jpa/search/builder/SearchBuilder.java | 25 +-
.../BaseQuantityPredicateBuilder.java | 2 +-
.../builder/sql/SearchQueryBuilder.java | 13 +-
.../builder/sql/SearchQueryExecutor.java | 21 +-
.../jpa/search/builder/tasks/SearchTask.java | 2 -
.../cache/DatabaseSearchCacheSvcImpl.java | 2 +-
.../lastn/ElasticsearchRestClientFactory.java | 15 +-
.../search/lastn/ElasticsearchSvcImpl.java | 790 +--------------
.../jpa/search/lastn/IElasticsearchSvc.java | 57 --
.../reindex/ResourceReindexingSvcImpl.java | 10 +-
.../jpa/search/warm/CacheWarmingSvcImpl.java | 2 +-
.../term/TermCodeSystemStorageSvcImpl.java | 6 +-
.../term/TermConceptClientMappingSvcImpl.java | 18 +-
.../ca/uhn/fhir/jpa/term/TermReadSvcImpl.java | 12 +-
.../jpa/util/PersistenceContextProvider.java | 4 +-
.../fhir/jpa/util/QueryParameterUtils.java | 6 +-
.../jpa/util/ScrollableResultsIterator.java | 2 +-
.../validation/JpaValidationSupportChain.java | 5 +-
.../index/DaoSearchParamSynchronizerTest.java | 2 +-
.../pom.xml | 42 +-
.../config/ElasticsearchWithPrefixConfig.java | 34 +-
.../jpa/dao/r4/ElasticsearchPrefixTest.java | 20 +-
.../FhirResourceDaoR4SearchLastNAsyncIT.java | 17 +-
.../r4/FhirResourceDaoR4SearchLastNIT.java | 58 +-
...LastNUsingExtendedHSearchIndexAsyncIT.java | 27 -
...earchLastNUsingExtendedHSearchIndexIT.java | 60 --
...esourceDaoR4SearchWithElasticSearchIT.java | 2 +-
.../fhir/jpa/dao/r4/HSearchSandboxTest.java | 2 +-
...bservationIndexedSearchParamLastNR4IT.java | 474 ---------
.../TokenAutocompleteElasticsearchIT.java | 2 +-
...lasticsearchSvcMultipleObservationsIT.java | 511 ----------
...tNElasticsearchSvcSingleObservationIT.java | 262 -----
.../search/lastn/LastNTestDataGenerator.java | 144 ---
hapi-fhir-jpaserver-hfql/pom.xml | 6 +-
.../fql/jdbc/RemoteHfqlExecutionResult.java | 2 +-
.../jpa/fql/provider/HfqlRestProvider.java | 4 +-
hapi-fhir-jpaserver-ips/pom.xml | 6 +-
.../uhn/fhir/jpa/ips/api/SectionRegistry.java | 2 +-
hapi-fhir-jpaserver-mdm/pom.xml | 6 +-
.../mdm/broker/MdmQueueConsumerLoader.java | 3 +-
.../jpa/mdm/svc/MdmControllerSvcImpl.java | 8 +-
.../fhir/jpa/mdm/dao/MdmMetricSvcJpaIT.java | 3 +-
.../fhir/jpa/mdm/helper/BaseMdmHelper.java | 2 +-
.../MdmSearchExpandingInterceptorIT.java | 2 +-
.../interceptor/MdmStorageInterceptorIT.java | 6 +-
.../jpa/mdm/provider/BaseProviderR4Test.java | 2 +
.../mdm/provider/MdmOperationPointcutsIT.java | 19 +-
.../MdmProviderCrossPartitionR4Test.java | 3 +-
.../fhir/jpa/mdm/svc/MdmMatchLinkSvcTest.java | 1 -
.../clear/MdmLinkSlowDeletionSandboxIT.java | 6 +-
hapi-fhir-jpaserver-model/pom.xml | 8 +-
.../dialect/HapiFhirCockroachDialect.java | 42 +
.../model/dialect/HapiFhirDerbyDialect.java | 42 +
.../jpa/model/dialect/HapiFhirH2Dialect.java | 45 +-
.../model/dialect/HapiFhirMariaDBDialect.java | 42 +
.../model/dialect/HapiFhirMySQLDialect.java | 42 +
.../model/dialect/HapiFhirOracleDialect.java | 42 +
.../dialect/HapiFhirPostgres94Dialect.java | 14 +-
.../dialect/HapiFhirPostgresDialect.java | 38 +
.../dialect/HapiFhirSQLServerDialect.java | 42 +
.../dialect/HapiSequenceStyleGenerator.java | 29 +-
.../entity/AuditableBasePartitionable.java | 6 +-
.../jpa/model/entity/BaseHasResource.java | 14 +-
.../jpa/model/entity/BasePartitionable.java | 7 +-
.../jpa/model/entity/BaseResourceIndex.java | 2 +-
.../BaseResourceIndexedSearchParam.java | 10 +-
...aseResourceIndexedSearchParamQuantity.java | 5 +-
.../ca/uhn/fhir/jpa/model/entity/BaseTag.java | 9 +-
.../jpa/model/entity/BinaryStorageEntity.java | 15 +-
.../uhn/fhir/jpa/model/entity/ForcedId.java | 28 +-
.../jpa/model/entity/NpmPackageEntity.java | 24 +-
.../model/entity/NpmPackageVersionEntity.java | 37 +-
.../NpmPackageVersionResourceEntity.java | 36 +-
.../entity/PartitionablePartitionId.java | 4 +-
...sistedResourceModifiedMessageEntityPK.java | 5 +-
.../ResourceHistoryProvenanceEntity.java | 23 +-
.../model/entity/ResourceHistoryTable.java | 7 +-
.../jpa/model/entity/ResourceHistoryTag.java | 27 +-
.../ResourceIndexedComboStringUnique.java | 3 +-
.../ResourceIndexedComboTokenNonUnique.java | 25 +-
.../ResourceIndexedSearchParamCoords.java | 27 +-
.../ResourceIndexedSearchParamDate.java | 32 +-
.../ResourceIndexedSearchParamNumber.java | 31 +-
.../ResourceIndexedSearchParamQuantity.java | 26 +-
...eIndexedSearchParamQuantityNormalized.java | 26 +-
.../ResourceIndexedSearchParamString.java | 25 +-
.../ResourceIndexedSearchParamToken.java | 32 +-
.../entity/ResourceIndexedSearchParamUri.java | 27 +-
.../fhir/jpa/model/entity/ResourceLink.java | 30 +-
.../model/entity/ResourceModifiedEntity.java | 13 +-
.../model/entity/ResourceSearchUrlEntity.java | 15 +-
.../fhir/jpa/model/entity/ResourceTable.java | 38 +-
.../fhir/jpa/model/entity/ResourceTag.java | 27 +-
.../entity/SearchParamPresentEntity.java | 2 +-
.../jpa/model/entity/StorageSettings.java | 2 +-
.../fhir/jpa/model/entity/TagDefinition.java | 29 +-
.../uhn/fhir/jpa/model/util/JpaConstants.java | 1 -
hapi-fhir-jpaserver-searchparam/pom.xml | 10 +-
.../model/ReadPartitionIdRequestDetails.java | 2 +-
.../fhir/jpa/cache/IResourceChangeEvent.java | 2 +-
.../jpa/cache/IResourceChangeListener.java | 2 +-
.../cache/IResourceChangeListenerCache.java | 2 +-
...IResourceChangeListenerCacheRefresher.java | 2 +-
.../IResourceChangeListenerRegistry.java | 2 +-
.../fhir/jpa/cache/IResourceVersionSvc.java | 2 +-
.../fhir/jpa/cache/ResourceChangeEvent.java | 2 +-
.../cache/ResourceChangeListenerCache.java | 2 +-
.../ResourceChangeListenerCacheFactory.java | 2 +-
...ourceChangeListenerCacheRefresherImpl.java | 2 +-
.../ResourceChangeListenerRegistryImpl.java | 2 +-
...urceChangeListenerRegistryInterceptor.java | 5 +-
.../fhir/jpa/cache/ResourceChangeResult.java | 2 +-
.../jpa/cache/ResourcePersistentIdMap.java | 2 +-
.../fhir/jpa/cache/ResourceVersionCache.java | 2 +-
.../fhir/jpa/cache/ResourceVersionMap.java | 2 +-
.../partition/IRequestPartitionHelperSvc.java | 2 +-
.../fhir/jpa/searchparam/MatchUrlService.java | 2 +-
.../jpa/searchparam/ResourceMetaParams.java | 2 +-
.../fhir/jpa/searchparam/ResourceSearch.java | 2 +-
.../jpa/searchparam/SearchParamConstants.java | 2 +-
.../jpa/searchparam/SearchParameterMap.java | 2 +-
.../config/NicknameServiceConfig.java | 2 +-
.../searchparam/config/SearchParamConfig.java | 2 +-
.../extractor/BaseSearchParamExtractor.java | 4 +-
.../CrossPartitionReferenceDetails.java | 2 +-
.../extractor/GeopointNormalizer.java | 2 +-
.../extractor/IResourceLinkResolver.java | 2 +-
.../extractor/ISearchParamExtractor.java | 2 +-
.../extractor/LogicalReferenceHelper.java | 2 +-
.../jpa/searchparam/extractor/PathAndRef.java | 2 +-
.../ResourceIndexedSearchParamComposite.java | 2 +-
.../ResourceIndexedSearchParams.java | 2 +-
.../extractor/SearchParamExtractorDstu2.java | 2 +-
.../extractor/SearchParamExtractorDstu3.java | 4 +-
.../extractor/SearchParamExtractorR4.java | 4 +-
.../extractor/SearchParamExtractorR4B.java | 4 +-
.../extractor/SearchParamExtractorR5.java | 4 +-
.../SearchParamExtractorService.java | 2 +-
.../StringTrimmingTrimmerMatcher.java | 2 +-
.../AuthorizationSearchParamMatcher.java | 2 +-
.../matcher/InMemoryMatchResult.java | 2 +-
.../matcher/InMemoryResourceMatcher.java | 2 +-
.../matcher/IndexedSearchParamExtractor.java | 2 +-
.../matcher/SearchParamMatcher.java | 2 +-
.../nickname/NicknameInterceptor.java | 2 +-
.../SearchableHashMapResourceProvider.java | 2 +-
.../registry/ISearchParamProvider.java | 2 +-
.../ISearchParamRegistryController.java | 2 +-
.../registry/JpaSearchParamCache.java | 2 +-
.../registry/ReadOnlySearchParamCache.java | 2 +-
.../registry/RuntimeSearchParamCache.java | 2 +-
.../registry/SearchParamRegistryImpl.java | 6 +-
.../SearchParameterCanonicalizer.java | 2 +-
.../fhir/jpa/searchparam/retry/Retrier.java | 2 +-
.../searchparam/util/Dstu3DistanceHelper.java | 2 +-
.../jpa/searchparam/util/JpaParamUtil.java | 2 +-
.../util/LastNParameterHelper.java | 2 +-
.../util/RuntimeSearchParamHelper.java | 2 +-
.../util/SearchParameterHelper.java | 2 +-
.../jpa/searchparam/util/SourceParam.java | 2 +-
hapi-fhir-jpaserver-subscription/pom.xml | 13 +-
.../match/deliver/email/EmailDetails.java | 4 +-
.../SubscriptionWebsocketHandler.java | 4 +-
.../MatchingQueueSubscriberLoader.java | 3 +-
.../match/registry/SubscriptionRegistry.java | 2 +-
.../SubscriptionSubmitInterceptorLoader.java | 2 +-
.../SubscriptionTriggeringSvcImpl.java | 2 +-
...castingSubscribableChannelWrapperTest.java | 2 +-
...aseSubscriptionDeliverySubscriberTest.java | 4 +-
.../module/SubscriptionTestConfig.java | 2 +-
...kingQueueSubscribableChannelDstu3Test.java | 6 +-
hapi-fhir-jpaserver-test-dstu2/pom.xml | 2 +-
.../jpa/dao/dstu2/BaseJpaDstu2SystemTest.java | 6 +-
.../fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java | 2 +-
.../FhirResourceDaoDstu2SearchFtTest.java | 2 +-
.../FhirResourceDaoDstu2SearchNoFtTest.java | 2 +-
.../jpa/provider/SubscriptionsDstu2Test.java | 14 +-
.../jpa/provider/SystemProviderDstu2Test.java | 4 +-
...temProviderTransactionSearchDstu2Test.java | 4 +-
.../resthook/RestHookTestDstu2Test.java | 4 +-
...rRegisteredToStorageSettingsDstu2Test.java | 4 +-
hapi-fhir-jpaserver-test-dstu3/pom.xml | 2 +-
.../jpa/dao/dstu3/BaseJpaDstu3SystemTest.java | 6 +-
.../FhirResourceDaoDstu3SearchFtTest.java | 2 +-
.../FhirResourceDaoDstu3SearchNoFtTest.java | 2 +-
.../jpa/dao/dstu3/FhirSystemDaoDstu3Test.java | 2 +-
.../jpa/packages/IgInstallerDstu3Test.java | 37 +-
.../uhn/fhir/jpa/packages/NpmDstu3Test.java | 65 +-
.../dstu3/SubscriptionsDstu3Test.java | 14 +-
...temProviderTransactionSearchDstu3Test.java | 4 +-
.../resthook/RestHookTestDstu3Test.java | 6 +-
...rRegisteredToStorageSettingsDstu3Test.java | 4 +-
.../SubscriptionTriggeringDstu3Test.java | 6 +-
hapi-fhir-jpaserver-test-r4/pom.xml | 13 +-
.../jpa/batch2/Batch2JobMaintenanceIT.java | 2 +-
.../binstore/BinaryAccessProviderTest.java | 6 +-
.../bulk/imprt2/ConsumeFilesStepR4Test.java | 4 +-
.../uhn/fhir/jpa/dao/BaseHapiFhirDaoTest.java | 18 +-
.../jpa/dao/BaseHapiFhirResourceDaoTest.java | 4 +-
.../jpa/dao/TransactionProcessorTest.java | 4 +-
.../expunge/ResourceTableFKProviderTest.java | 6 +-
.../fhir/jpa/dao/r4/BaseJpaR4SystemTest.java | 4 +-
.../r4/FhirResourceDaoR4QueryCountTest.java | 19 +-
.../dao/r4/FhirResourceDaoR4SearchFtTest.java | 2 +-
.../r4/FhirResourceDaoR4SearchNoFtTest.java | 33 +-
.../FhirResourceDaoR4SearchOptimizedTest.java | 18 +-
.../r4/FhirResourceDaoR4SearchSqlTest.java | 6 +-
.../dao/r4/FhirResourceDaoR4UpdateTest.java | 2 +-
.../fhir/jpa/dao/r4/FhirSystemDaoR4Test.java | 2 +-
.../jpa/dao/r4/PartitioningSqlR4Test.java | 38 +-
.../fhir/jpa/delete/job/ReindexJobTest.java | 9 +-
...adingDeleteInterceptorMultiThreadTest.java | 4 +-
.../ForceOffsetSearchModeInterceptorTest.java | 8 +-
.../PartitioningInterceptorR4Test.java | 2 +-
.../PatientIdPartitionInterceptorTest.java | 6 +-
.../ca/uhn/fhir/jpa/packages/NpmR4Test.java | 44 +-
.../fhir/jpa/packages/NpmSearchR4Test.java | 4 +-
.../packages/loader/PackageLoaderSvcIT.java | 37 +-
...rtitionedSubscriptionTriggeringR4Test.java | 2 +-
.../jpa/provider/r4/EmptyIndexesR4Test.java | 4 +-
.../provider/r4/MultitenantServerR4Test.java | 2 +-
...minologyServiceResourceProviderR4Test.java | 2 +-
...sourceProviderCustomSearchParamR4Test.java | 8 +-
.../r4/ResourceProviderInterceptorR4Test.java | 2 +-
...oviderOnlySomeResourcesProvidedR4Test.java | 4 +-
...sourceProviderR4RemoteTerminologyTest.java | 2 +-
.../provider/r4/ResourceProviderR4Test.java | 12 +-
...rceProviderR4ValueSetNoVerCSNoVerTest.java | 8 +-
.../jpa/provider/r4/SubscriptionsR4Test.java | 14 +-
.../jpa/provider/r4/SystemProviderR4Test.java | 4 +-
...SystemProviderTransactionSearchR4Test.java | 4 +-
.../stresstest/GiantTransactionPerfTest.java | 29 +-
.../subscription/BaseSubscriptionsR4Test.java | 2 +-
...tivatesPreExistingSubscriptionsR4Test.java | 6 +-
...ptorRegisteredToStorageSettingsR4Test.java | 4 +-
.../uhn/fhir/jpa/term/ITermReadSvcTest.java | 4 +-
...erminologySvcImplCurrentVersionR4Test.java | 4 +-
.../ReindexTerminologyHSearchR4Test.java | 2 +-
hapi-fhir-jpaserver-test-r4b/pom.xml | 2 +-
.../uhn/fhir/jpa/dao/r4b/BaseJpaR4BTest.java | 2 +-
.../BaseSubscriptionsR4BTest.java | 2 +-
hapi-fhir-jpaserver-test-r5/pom.xml | 2 +-
.../ca/uhn/fhir/jpa/dao/r5/BaseJpaR5Test.java | 2 +-
.../r5/FhirSystemDaoTransactionR5Test.java | 2 +-
.../subscription/BaseSubscriptionsR5Test.java | 8 +-
hapi-fhir-jpaserver-test-utilities/pom.xml | 50 +-
.../HapiEmbeddedDatabasesExtension.java | 23 +-
...nterceptorReadPartitionsBasedOnScopes.java | 2 +-
.../uhn/fhir/jpa/packages/FakeNpmServlet.java | 6 +-
.../CodeSystemLookupWithPropertiesUtil.java | 19 +
.../r4/BaseResourceProviderR4Test.java | 4 +-
.../jpa/subscription/NotificationServlet.java | 9 +-
.../subscription/SocketImplementation.java | 18 +-
.../uhn/fhir/jpa/test/BaseJpaDstu3Test.java | 2 +-
.../ca/uhn/fhir/jpa/test/BaseJpaR4Test.java | 42 +-
.../ca/uhn/fhir/jpa/test/BaseJpaTest.java | 2 +-
.../BaseValueSetHSearchExpansionR4Test.java | 2 +-
.../fhir/jpa/test/config/TestDstu2Config.java | 9 +-
.../fhir/jpa/test/config/TestDstu3Config.java | 9 +-
.../test/config/TestHSearchAddInConfig.java | 2 +-
.../jpa/test/config/TestHapiJpaConfig.java | 19 +
.../fhir/jpa/test/config/TestJPAConfig.java | 2 +-
.../fhir/jpa/test/config/TestR4BConfig.java | 9 +-
.../fhir/jpa/test/config/TestR4Config.java | 76 +-
.../fhir/jpa/test/config/TestR5Config.java | 11 +-
.../jpa/util/WebsocketSubscriptionClient.java | 26 +-
.../jpa/config/DispatcherServletConfig.java | 2 +-
.../HapiFhirHibernateJpaDialectTest.java | 4 +-
.../jpa/dao/index/ResourceVersionSvcTest.java | 10 +-
.../jpa/embedded/HapiSchemaMigrationTest.java | 4 +
...lIT.java => SchedulerServiceImplTest.java} | 6 +-
.../SearchQueryBuilderDialectMySqlTest.java | 3 +-
...SearchQueryBuilderDialectPostgresTest.java | 7 +-
...earchQueryBuilderDialectSqlServerTest.java | 18 +-
.../builder/sql/SearchQueryBuilderTest.java | 110 +--
.../jpa/term/LoincFullLoadR4SandboxIT.java | 8 +-
hapi-fhir-jpaserver-uhnfhirtest/pom.xml | 70 +-
.../ca/uhn/fhirtest/TestRestfulServer.java | 8 +-
.../FhirTestBalpAuditContextServices.java | 3 +-
.../uhn/fhirtest/config/FhirTesterConfig.java | 3 +-
.../uhn/fhirtest/config/TestAuditConfig.java | 10 +-
.../uhn/fhirtest/config/TestDstu2Config.java | 8 +-
.../uhn/fhirtest/config/TestDstu3Config.java | 8 +-
.../ca/uhn/fhirtest/config/TestR4BConfig.java | 8 +-
.../ca/uhn/fhirtest/config/TestR4Config.java | 8 +-
.../ca/uhn/fhirtest/config/TestR5Config.java | 8 +-
.../interceptor/AnalyticsInterceptor.java | 2 +-
.../fhirtest/joke/HolyFooCowInterceptor.java | 5 +-
.../migrate/FhirTestAutoMigrator.java | 2 +-
.../mvc/SubscriptionPlaygroundController.java | 2 +-
.../java/ca/uhn/fhirtest/UhnFhirTestApp.java | 4 +-
hapi-fhir-server-cds-hooks/pom.xml | 2 +-
.../json/CdsServiceRequestContextJson.java | 3 +
.../cdshooks/svc/CdsHooksContextBooter.java | 2 +-
.../cdshooks/svc/CdsServiceRegistryImpl.java | 2 +-
hapi-fhir-server-mdm/pom.xml | 2 +-
.../fhir/mdm/provider/MdmProviderLoader.java | 3 +-
hapi-fhir-server-openapi/pom.xml | 17 +-
.../fhir/rest/openapi/OpenApiInterceptor.java | 10 +-
.../rest/openapi/OpenApiInterceptorTest.java | 23 +-
hapi-fhir-server/pom.xml | 6 +-
.../rest/api/server/IRestfulResponse.java | 2 +-
.../fhir/rest/api/server/RequestDetails.java | 9 +-
.../server/storage/TransactionDetails.java | 11 +-
.../server/ApacheProxyAddressStrategy.java | 4 +-
.../HardcodedServerAddressStrategy.java | 5 +-
.../rest/server/IServerAddressStrategy.java | 4 +-
.../server/IServerConformanceProvider.java | 3 +-
.../IncomingRequestAddressStrategy.java | 5 +-
.../uhn/fhir/rest/server/ResourceBinding.java | 21 +-
.../uhn/fhir/rest/server/RestfulServer.java | 18 +-
.../fhir/rest/server/RestfulServerUtils.java | 41 +-
.../rest/server/ServletRequestTracing.java | 4 +-
.../BanUnsupportedHttpMethodsInterceptor.java | 4 +-
.../server/interceptor/CorsInterceptor.java | 4 +-
.../ExceptionHandlingInterceptor.java | 6 +-
.../interceptor/IServerInterceptor.java | 10 +-
.../interceptor/InterceptorAdapter.java | 6 +-
.../interceptor/LoggingInterceptor.java | 6 +-
.../RequestValidatingInterceptor.java | 4 +-
.../ResponseHighlighterInterceptor.java | 6 +-
.../SearchPreferHandlingInterceptor.java | 4 +-
.../ServeMediaResourceRawInterceptor.java | 4 +-
.../VerboseLoggingInterceptor.java | 4 +-
.../auth/SearchNarrowingInterceptor.java | 4 +-
.../BaseOutcomeReturningMethodBinding.java | 8 +-
...indingWithResourceIdButNoResourceBody.java | 6 +-
.../BaseResourceReturningMethodBinding.java | 4 +-
.../server/method/GraphQLMethodBinding.java | 4 +-
.../fhir/rest/server/method/MethodUtil.java | 34 +-
.../rest/server/method/SearchParameter.java | 64 +-
.../rest/server/method/SortParameter.java | 8 +-
.../server/method/SummaryEnumParameter.java | 5 +-
.../ServerCapabilityStatementProvider.java | 4 +-
.../server/servlet/ServletRequestDetails.java | 4 +-
.../servlet/ServletRestfulResponse.java | 4 +-
.../servlet/ServletSubRequestDetails.java | 5 +-
.../server/util/ITestingUiClientFactory.java | 3 +-
.../IncomingRequestAddressStrategyTest.java | 2 +-
.../rest/server/SimpleBundleProviderTest.java | 2 +-
.../server/interceptor/ConfigLoaderTest.java | 4 +-
.../method/ConformanceMethodBindingTest.java | 2 +-
.../server/method/MethodMatchEnumTest.java | 2 +-
.../servlet/ServletRequestDetailsTest.java | 2 +-
.../servlet/ServletRestfulResponseTest.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 | 6 +-
.../autoconfigure/FhirAutoConfiguration.java | 4 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../pom.xml | 2 +-
.../provider/PatientResourceProvider.java | 4 +-
...pleJerseyRestfulServerApplicationTest.java | 12 +-
.../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 | 4 +-
.../uhn/fhir/jpa/migrate/DriverTypeEnum.java | 14 +-
.../ca/uhn/fhir/jpa/migrate/JdbcUtils.java | 19 +-
.../migrate/entity/HapiMigrationEntity.java | 10 +-
.../jpa/migrate/taskdef/ColumnTypeEnum.java | 8 +-
.../ColumnTypeToDriverTypeToSqlType.java | 14 +-
.../jpa/migrate/taskdef/AddColumnTest.java | 2 +-
hapi-fhir-storage-batch2-jobs/pom.xml | 6 +-
.../jobs/export/BulkDataExportProvider.java | 2 +-
.../jobs/imprt/BulkDataImportProvider.java | 2 +-
.../jobs/imprt/BulkImportFileServlet.java | 6 +-
.../jobs/imprt/BulkImportJobParameters.java | 8 +-
.../fhir/batch2/jobs/BaseR4ServerTest.java | 4 +-
.../imprt/BulkDataImportProviderTest.java | 2 +-
.../pom.xml | 2 +-
.../test/support/TestJobParameters.java | 2 +-
hapi-fhir-storage-batch2/pom.xml | 20 +-
.../coordinator/JobCoordinatorImpl.java | 4 +-
.../JobParameterJsonValidator.java | 8 +-
.../jobs/parameters/PartitionedUrl.java | 3 +-
.../uhn/fhir/batch2/model/JobDefinition.java | 6 +-
.../batch2/coordinator/TestJobParameters.java | 2 +-
.../JobMaintenanceServiceImplTest.java | 4 +-
hapi-fhir-storage-cr/pom.xml | 28 +-
.../fhir/cr/dstu3/BaseCrDstu3TestServer.java | 4 +-
.../ca/uhn/fhir/cr/r4/BaseCrR4TestServer.java | 4 +-
hapi-fhir-storage-mdm/pom.xml | 2 +-
.../MdmSubmitterInterceptorLoader.java | 3 +-
.../batch2/clear/MdmClearJobParameters.java | 2 +-
hapi-fhir-storage-test-utilities/pom.xml | 2 +-
hapi-fhir-storage/pom.xml | 8 +-
.../cache/BaseResourceCacheSynchronizer.java | 4 +-
.../fhir/jpa/api/dao/IFhirResourceDao.java | 2 +-
.../api/dao/IFhirResourceDaoComposition.java | 3 +-
.../api/dao/IFhirResourceDaoEncounter.java | 3 +-
.../api/dao/IFhirResourceDaoObservation.java | 3 +-
.../jpa/api/dao/IFhirResourceDaoPatient.java | 3 +-
.../binary/provider/BinaryAccessProvider.java | 4 +-
.../ca/uhn/fhir/jpa/dao/ISearchBuilder.java | 2 +-
.../dao/expunge/PartitionAwareSupplier.java | 6 +-
.../jpa/dao/tx/HapiTransactionService.java | 29 +-
.../SearchBuilderLoadIncludesParameters.java | 2 +-
.../fhir/jpa/provider/BaseJpaProvider.java | 2 +-
.../jpa/provider/BaseJpaResourceProvider.java | 4 +-
.../provider/BaseStorageSystemProvider.java | 2 -
.../impl/LinkedBlockingChannelFactory.java | 2 +-
.../CircularQueueCaptureQueriesListener.java | 36 +-
.../java/ca/uhn/fhir/jpa/util/SqlQuery.java | 3 +
...ncMemoryQueueBackedFhirClientBalpSink.java | 2 +-
.../balp/BalpAuditCaptureInterceptor.java | 20 +-
.../balp/IBalpAuditContextServices.java | 2 +-
.../balp/BalpAuditCaptureInterceptorTest.java | 17 +-
hapi-fhir-structures-dstu2.1/pom.xml | 69 +-
.../server/ServerConformanceProvider.java | 8 +-
.../rest/server/CreateBinaryDstu2_1Test.java | 172 ----
.../fhir/rest/server/CreateDstu2_1Test.java | 283 ------
.../rest/server/CustomTypeServerDstu2_1.java | 59 +-
.../server/DeleteConditionalDstu2_1Test.java | 132 ---
.../server/FormatParameterDstu2_1Test.java | 255 -----
.../MetadataConformanceDstu2_1Test.java | 191 ----
.../server/OperationServerDstu2_1Test.java | 786 ---------------
...ServerWithSearchParamTypesDstu2_1Test.java | 514 ----------
.../fhir/rest/server/PatchDstu2_1Test.java | 188 ----
.../uhn/fhir/rest/server/ReadDstu2_1Test.java | 122 ---
.../server/SearchCountParamDstu2_1Test.java | 184 ----
.../fhir/rest/server/SearchDstu2_1Test.java | 142 ---
.../server/SearchHasParamDstu2_1Test.java | 121 ---
.../rest/server/SearchPostDstu2_1Test.java | 260 -----
.../rest/server/SearchSortDstu2_1Test.java | 132 ---
.../SearchWithGenericListDstu2_1Test.java | 57 +-
.../server/SearchWithIncludesDstu2_1Test.java | 135 ---
...hWithServerAddressStrategyDstu2_1Test.java | 172 ----
.../server/ServerExceptionDstu2_1Test.java | 137 ---
.../server/ServerMimetypeDstu2_1Test.java | 422 --------
.../ServerUsingOldTypesDstu2_1Test.java | 2 +-
...nclassifiedServerExceptionDstu2_1Test.java | 108 ---
.../fhir/rest/server/UpdateDstu2_1Test.java | 195 ----
.../fhir/rest/server/ValidateDstu2_1Test.java | 327 -------
hapi-fhir-structures-dstu2/pom.xml | 50 +-
.../dstu2/ServerConformanceProvider.java | 4 +-
...tThymeleafNarrativeGeneratorDstu2Test.java | 2 +-
.../apache/ApacheClientIntegrationTest.java | 57 +-
.../uhn/fhir/rest/server/BinaryDstu2Test.java | 70 +-
.../rest/server/BundleTypeInResponseTest.java | 49 +-
.../rest/server/CompartmentDstu2Test.java | 63 +-
.../rest/server/CreateConditionalTest.java | 66 +-
.../uhn/fhir/rest/server/DeleteDstu2Test.java | 52 +-
.../uhn/fhir/rest/server/ETagServerTest.java | 64 +-
.../IncludeAndRevincludeParameterTest.java | 53 +-
.../fhir/rest/server/IncludeDstu2Test.java | 70 +-
.../OperationDuplicateServerDstu2Test.java | 56 +-
.../rest/server/OperationServerDstu2Test.java | 114 +--
...onServerWithSearchParamTypesDstu2Test.java | 68 +-
.../rest/server/PatientResourceProvider.java | 2 +-
.../uhn/fhir/rest/server/ReadDstu2Test.java | 66 +-
...archBundleProviderWithNoSizeDstu2Test.java | 4 +-
.../server/SearchCountParamDstu2Test.java | 62 +-
.../uhn/fhir/rest/server/SearchDstu2Test.java | 111 +--
...rchReturningProfiledResourceDstu2Test.java | 75 +-
.../server/SearchWithDstu2BundleTest.java | 51 +-
.../SearchWithGenericListDstu2Test.java | 57 +-
.../ServerConformanceProviderDstu2Test.java | 18 +-
.../rest/server/ServerFeaturesDstu2Test.java | 99 +-
.../rest/server/ServerSearchDstu2Test.java | 66 +-
.../rest/server/SummaryParamDstu2Test.java | 71 +-
...ransactionWithBundleResourceParamTest.java | 4 +-
...ithVersionlessBundleResourceParamTest.java | 4 +-
.../uhn/fhir/rest/server/UpdateDstu2Test.java | 57 +-
.../fhir/rest/server/ValidateDstu2Test.java | 54 +-
.../InterceptorUserDataMapDstu2Test.java | 59 +-
.../LoggingInterceptorDstu2Test.java | 114 +--
.../ServerActionInterceptorTest.java | 136 ++-
hapi-fhir-structures-dstu3/pom.xml | 52 +-
.../ServerCapabilityStatementProvider.java | 4 +-
.../context/ContextScanningDstu3Test.java | 42 +-
...tThymeleafNarrativeGeneratorDstu3Test.java | 2 +-
.../rest/server/CreateBinaryDstu3Test.java | 53 +-
.../uhn/fhir/rest/server/CreateDstu3Test.java | 67 +-
.../rest/server/CustomTypeServerDstu3.java | 52 +-
.../server/DeleteConditionalDstu3Test.java | 67 +-
.../rest/server/FormatParameterDstu3Test.java | 86 +-
.../rest/server/InterceptorDstu3Test.java | 80 +-
.../MetadataCapabilityStatementDstu3Test.java | 73 +-
.../server/MetadataConformanceDstu3Test.java | 68 +-
.../rest/server/OperationServerDstu3Test.java | 96 +-
...onServerWithSearchParamTypesDstu3Test.java | 70 +-
.../rest/server/PatchServerDstu3Test.java | 63 +-
...archBundleProviderWithNoSizeDstu3Test.java | 4 +-
.../server/SearchCountParamDstu3Test.java | 62 +-
.../server/SearchDefaultMethodDstu3Test.java | 58 +-
.../uhn/fhir/rest/server/SearchDstu3Test.java | 71 +-
.../rest/server/SearchHasParamDstu3Test.java | 48 +-
.../fhir/rest/server/SearchPostDstu3Test.java | 68 +-
.../fhir/rest/server/SearchSortDstu3Test.java | 48 +-
.../SearchWithGenericListDstu3Test.java | 58 +-
.../server/SearchWithIncludesDstu3Test.java | 50 +-
...rchWithServerAddressStrategyDstu3Test.java | 85 +-
.../rest/server/ServerExceptionDstu3Test.java | 66 +-
.../rest/server/ServerMimetypeDstu3Test.java | 77 +-
.../server/ServerUsingOldTypesDstu3Test.java | 2 +-
.../UnclassifiedServerExceptionDstu3Test.java | 49 +-
.../fhir/rest/server/ValidateDstu3Test.java | 61 +-
...pprtedHttpMethodsInterceptorDstu3Test.java | 61 +-
.../interceptor/CorsInterceptorDstu3Test.java | 4 +-
.../AuthorizationInterceptorDstu3Test.java | 67 +-
.../rest/server/PatientResourceProvider.java | 2 +-
...rCapabilityStatementProviderDstu3Test.java | 18 +-
hapi-fhir-structures-hl7org-dstu2/pom.xml | 69 +-
.../server/ServerConformanceProvider.java | 4 +-
.../rest/server/BinaryHl7OrgDstu2Test.java | 59 +-
.../BundleTypeInResponseHl7OrgTest.java | 52 +-
.../server/CreateConditionalHl7OrgTest.java | 66 +-
.../server/DeleteConditionalHl7OrgTest.java | 60 +-
...cludeAndRevincludeParameterHl7OrgTest.java | 56 +-
.../rest/server/IncludeHl7OrgDstu2Test.java | 77 +-
...erationDuplicateServerHl7OrgDstu2Test.java | 58 +-
.../server/OperationServerHl7OrgTest.java | 80 +-
.../rest/server/PreferHl7OrgDstu2Test.java | 62 +-
.../fhir/rest/server/ReadHl7OrgDstu2Test.java | 63 +-
.../rest/server/SearchHl7OrgDstu2Test.java | 59 +-
.../SearchWithGenericListHl7OrgDstu2Test.java | 57 +-
.../SearchWithHl7OrgDstu2BundleTest.java | 63 +-
...verConformanceProviderHl7OrgDstu2Test.java | 8 +-
...ithBundleResourceParamHl7OrgDstu2Test.java | 4 +-
.../UpdateConditionalHl7OrgDstu2Test.java | 66 +-
.../rest/server/ValidateHl7OrgDstu2Test.java | 59 +-
hapi-fhir-structures-r4/pom.xml | 69 +-
...stomThymeleafNarrativeGeneratorR4Test.java | 5 +-
...aultThymeleafNarrativeGeneratorR4Test.java | 2 +-
.../ca/uhn/fhir/parser/RDFParserTest.java | 3 +
.../fhir/rest/client/ClientHeadersR4Test.java | 10 +-
.../rest/client/ClientIntegrationTest.java | 53 +-
...ompressOutgoingContentInterceptorTest.java | 54 +-
.../uhn/fhir/rest/client/HttpProxyTest.java | 10 +-
.../rest/client/LoggingInterceptorTest.java | 43 +-
.../fhir/rest/param/DateRangeParamR4Test.java | 80 +-
.../fhir/rest/server/BaseR4ServerTest.java | 51 +-
.../fhir/rest/server/BinaryServerR4Test.java | 73 +-
.../CapabilityStatementCacheR4Test.java | 2 +-
.../ca/uhn/fhir/rest/server/CreateR4Test.java | 92 +-
.../rest/server/DeleteConditionalR4Test.java | 52 +-
.../fhir/rest/server/ETagServerR4Test.java | 70 +-
.../fhir/rest/server/ElementsParamR4Test.java | 91 +-
.../uhn/fhir/rest/server/HistoryR4Test.java | 71 +-
.../ca/uhn/fhir/rest/server/IncludeTest.java | 70 +-
.../fhir/rest/server/LastNProviderTest.java | 5 +-
.../fhir/rest/server/MultitenancyR4Test.java | 73 +-
.../server/OperationGenericServer2R4Test.java | 90 +-
.../server/OperationGenericServerR4Test.java | 59 +-
.../rest/server/OperationServerR4Test.java | 4 +-
.../ca/uhn/fhir/rest/server/PagingTest.java | 2 +-
.../server/PagingUsingNamedPagesR4Test.java | 78 +-
.../rest/server/PatientResourceProvider.java | 2 +-
.../fhir/rest/server/PlainProviderR4Test.java | 74 +-
.../ca/uhn/fhir/rest/server/PreferTest.java | 69 +-
...onseCodeModifyingResourceProviderTest.java | 2 +-
.../fhir/rest/server/RestfulServerTest.java | 4 +-
.../SearchBundleProviderWithNoSizeR4Test.java | 48 +-
.../rest/server/SearchHasParamR4Test.java | 49 +-
.../ca/uhn/fhir/rest/server/SearchR4Test.java | 6 +
.../rest/server/SearchSearchServerR4Test.java | 113 +--
.../fhir/rest/server/SearchSortR4Test.java | 52 +-
.../rest/server/ServerConcurrencyTest.java | 8 +-
.../server/ServerInvalidDefinitionR4Test.java | 21 +-
.../server/ServerMethodSelectionR4Test.java | 18 +-
.../rest/server/ServerMimetypeR4Test.java | 96 +-
.../fhir/rest/server/SummaryParamR4Test.java | 69 +-
.../interceptor/ConsentInterceptorTest.java | 9 +-
.../ExceptionHandlingInterceptorTest.java | 4 +-
.../ExceptionInterceptorMethodTest.java | 61 +-
.../interceptor/InjectionAttackTest.java | 69 +-
.../InterceptorThrowingExceptionR4Test.java | 68 +-
...> ResponseHighlighterInterceptorTest.java} | 181 ++--
.../ServeMediaResourceRawInterceptorTest.java | 73 +-
...eHighlightingInterceptorExceptionTest.java | 53 +-
.../test/resources/junit-platform.properties | 2 +
hapi-fhir-structures-r4b/pom.xml | 63 +-
.../rest/server/PatientResourceProvider.java | 2 +-
.../uhn/fhir/rest/server/SearchR4BTest.java | 48 +-
...verCapabilityStatementProviderR4BTest.java | 6 +-
hapi-fhir-structures-r5/pom.xml | 63 +-
.../rest/server/PatientResourceProvider.java | 2 +-
.../ca/uhn/fhir/rest/server/SearchR5Test.java | 48 +-
...rverCapabilityStatementProviderR5Test.java | 6 +-
hapi-fhir-test-utilities/pom.xml | 49 +-
.../test/utilities/BaseRestServerHelper.java | 6 +-
.../test/utilities/HttpClientExtension.java | 25 +-
.../test/utilities/RestServerDstu3Helper.java | 2 +-
.../test/utilities/RestServerR4Helper.java | 17 +-
.../docker/DockerRequiredCondition.java | 30 +-
.../jpa/JpaModelScannerAndVerifier.java | 53 +-
.../server/BaseJettyServerExtension.java | 62 +-
.../server/HttpServletExtension.java | 2 +-
.../utilities/server/MockServletUtil.java | 2 +-
.../server/RequestCaptureServlet.java | 113 +++
.../server/RestfulServerExtension.java | 17 +-
hapi-fhir-testpage-overlay/pom.xml | 33 +-
.../java/ca/uhn/fhir/to/BaseController.java | 4 +-
.../main/java/ca/uhn/fhir/to/Controller.java | 4 +-
.../ca/uhn/fhir/to/FhirTesterMvcConfig.java | 6 +-
.../java/ca/uhn/fhir/to/TesterConfig.java | 4 +-
.../to/client/BearerTokenClientFactory.java | 3 +-
.../ca/uhn/fhir/to/model/HomeRequest.java | 11 +-
.../uhn/fhir/to/mvc/ToBindingInitializer.java | 6 -
.../uhn/fhir/jpa/test/FhirServerConfig.java | 2 +-
.../ca/uhn/fhir/jpa/test/OverlayTestApp.java | 17 +-
.../java/ca/uhn/fhir/jpa/test/WebTest.java | 33 +-
.../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-r4b/pom.xml | 2 +-
hapi-fhir-validation-resources-r5/pom.xml | 2 +-
hapi-fhir-validation/pom.xml | 59 +-
.../rest/server/PatientResourceProvider.java | 2 +-
...RequestValidatingInterceptorDstu3Test.java | 84 +-
...esponseValidatingInterceptorDstu3Test.java | 86 +-
...rverCapabilityStatementProviderR4Test.java | 4 +-
.../auth/AuthorizationInterceptorR4Test.java | 797 ++++++++-------
...rminologyServiceValidationSupportTest.java | 2 +-
...logyServiceValidationSupportDstu3Test.java | 2 +-
hapi-tinder-plugin/pom.xml | 26 +-
.../tinder/ddl/DdlGeneratorHibernate61.java | 214 ++++
.../uhn/fhir/tinder/ddl/GenerateDdlMojo.java | 128 +++
.../resources/vm/jpa_resource_provider.vm | 4 +-
hapi-tinder-test/pom.xml | 2 +-
.../src/test/java/test/TestAntTask.java | 7 +-
.../FhirInstanceValidatorTest.java | 2 -
.../ResourceValidatorDstu3FeatureTest.java | 7 +-
.../karaf/r4/R4JsonParserTest.java | 1 -
pom.xml | 278 +++---
.../pom.xml | 13 +-
.../example/ExtendedOrganizationResource.kt | 8 +-
.../ExtendedOrganizationResourceTest.kt | 2 +-
.../pom.xml | 4 +-
.../pom.xml | 17 +-
.../ca/uhn/fhir/testmindeps/ReadTest.java | 50 +-
876 files changed, 9407 insertions(+), 17801 deletions(-)
rename hapi-fhir-cli/hapi-fhir-cli-api/src/test/java/ca/uhn/fhir/cli/{BulkImportCommandIT.java => BulkImportCommandTest.java} (94%)
rename {hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect => hapi-fhir-jpa/src/main/java/ca/uhn/fhir/jpa/util}/ISequenceValueMassager.java (87%)
delete mode 100644 hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/ObservationLastNIndexPersistSvc.java
delete mode 100644 hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNUsingExtendedHSearchIndexAsyncIT.java
delete mode 100644 hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNUsingExtendedHSearchIndexIT.java
delete mode 100644 hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/PersistObservationIndexedSearchParamLastNR4IT.java
delete mode 100644 hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/lastn/LastNElasticsearchSvcMultipleObservationsIT.java
delete mode 100644 hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/lastn/LastNElasticsearchSvcSingleObservationIT.java
delete mode 100644 hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/lastn/LastNTestDataGenerator.java
create mode 100644 hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirCockroachDialect.java
create mode 100644 hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirDerbyDialect.java
create mode 100644 hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirMariaDBDialect.java
create mode 100644 hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirMySQLDialect.java
create mode 100644 hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirOracleDialect.java
create mode 100644 hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirPostgresDialect.java
create mode 100644 hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirSQLServerDialect.java
rename hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/sched/{SchedulerServiceImplIT.java => SchedulerServiceImplTest.java} (97%)
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/CreateBinaryDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/CreateDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/DeleteConditionalDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/FormatParameterDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/MetadataConformanceDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/OperationServerDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/PatchDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ReadDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchCountParamDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchHasParamDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchPostDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchSortDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchWithIncludesDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/SearchWithServerAddressStrategyDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ServerExceptionDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ServerMimetypeDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/UnclassifiedServerExceptionDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/UpdateDstu2_1Test.java
delete mode 100644 hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/server/ValidateDstu2_1Test.java
rename hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/interceptor/{ResponseHighlightingInterceptorTest.java => ResponseHighlighterInterceptorTest.java} (89%)
create mode 100644 hapi-fhir-structures-r4/src/test/resources/junit-platform.properties
create mode 100644 hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/server/RequestCaptureServlet.java
create mode 100644 hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/ddl/DdlGeneratorHibernate61.java
create mode 100644 hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/ddl/GenerateDdlMojo.java
diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java
index b901097f2db..7881deef30b 100644
--- a/.mvn/wrapper/MavenWrapperDownloader.java
+++ b/.mvn/wrapper/MavenWrapperDownloader.java
@@ -13,9 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import java.net.*;
-import java.io.*;
-import java.nio.channels.*;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.Authenticator;
+import java.net.PasswordAuthentication;
+import java.net.URL;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
import java.util.Properties;
public class MavenWrapperDownloader {
diff --git a/hapi-deployable-pom/pom.xml b/hapi-deployable-pom/pom.xml
index 7828ab2b979..09f8ce921e9 100644
--- a/hapi-deployable-pom/pom.xml
+++ b/hapi-deployable-pom/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhir
hapi-fhir
- 6.11.4-SNAPSHOT
+ 6.11.5-SNAPSHOT
../pom.xml
@@ -45,7 +45,6 @@
false
false
false
- false
true
true
2
@@ -103,14 +102,6 @@
net.bytebuddy
byte-buddy
-
- javax.xml.bind
- jaxb-api
-
-
- com.sun.xml.bind
- jaxb-impl
-
.*\.txt$
diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml
index c80236908a1..32004a48b33 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.11.4-SNAPSHOT
+ 6.11.5-SNAPSHOT
../hapi-deployable-pom/pom.xml
@@ -131,12 +131,6 @@
org.jacoco
jacoco-maven-plugin
-
- ${basedir}/target/classes
-
-
- ${basedir}/src/main/java
-
true
diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml
index ddb95cf5e41..7b126077940 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.11.4-SNAPSHOT
+ 6.11.5-SNAPSHOT
../hapi-deployable-pom/pom.xml
@@ -52,19 +52,13 @@
- com.helger
- ph-schematron
+ com.helger.schematron
+ ph-schematron-api
true
-
-
- org.glassfish.jaxb
- jaxb-core
-
-
- com.helger
- ph-commons
+ com.helger.schematron
+ ph-schematron-xslt
true
@@ -221,7 +215,6 @@
org.apache.maven.plugins
maven-checkstyle-plugin
- ${maven_checkstyle_version}
${maven.multiModuleProjectDirectory}/hapi-fhir-checkstyle/src/checkstyle/hapi-base-checkstyle.xml
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/LookupCodeRequest.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/LookupCodeRequest.java
index dc7074bba25..8c3bdcaa640 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/LookupCodeRequest.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/LookupCodeRequest.java
@@ -1,3 +1,22 @@
+/*-
+ * #%L
+ * HAPI FHIR - Core Library
+ * %%
+ * Copyright (C) 2014 - 2023 Smile CDR, Inc.
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
package ca.uhn.fhir.context.support;
import java.util.Collection;
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Pointcut.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Pointcut.java
index 64b7267f63f..a87023924be 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Pointcut.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/api/Pointcut.java
@@ -158,10 +158,10 @@ public enum Pointcut implements IPointcut {
* Hooks may accept the following parameters:
*
*
- * javax.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
+ * jakarta.servlet.http.HttpServletRequest - The servlet request, when running in a servlet environment
*
*
- * javax.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
+ * jakarta.servlet.http.HttpServletResponse - The servlet response, when running in a servlet environment
*
*
*
@@ -171,7 +171,7 @@ public enum Pointcut implements IPointcut {
* no further processing will occur and no further interceptors will be called.
*/
SERVER_INCOMING_REQUEST_PRE_PROCESSED(
- boolean.class, "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse"),
+ boolean.class, "jakarta.servlet.http.HttpServletRequest", "jakarta.servlet.http.HttpServletResponse"),
/**
*
@@ -268,8 +268,8 @@ public enum Pointcut implements IPointcut {
boolean.class,
"ca.uhn.fhir.rest.api.server.RequestDetails",
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
- "javax.servlet.http.HttpServletRequest",
- "javax.servlet.http.HttpServletResponse"),
+ "jakarta.servlet.http.HttpServletRequest",
+ "jakarta.servlet.http.HttpServletResponse"),
/**
* Server Hook:
@@ -291,10 +291,10 @@ public enum Pointcut implements IPointcut {
* only be populated when operating in a RestfulServer implementation. It is provided as a convenience.
*
*
@@ -313,8 +313,8 @@ public enum Pointcut implements IPointcut {
boolean.class,
"ca.uhn.fhir.rest.api.server.RequestDetails",
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
- "javax.servlet.http.HttpServletRequest",
- "javax.servlet.http.HttpServletResponse"),
+ "jakarta.servlet.http.HttpServletRequest",
+ "jakarta.servlet.http.HttpServletResponse"),
/**
* Server Hook:
@@ -416,10 +416,10 @@ public enum Pointcut implements IPointcut {
* {@link NullPointerException} in the case of a bug being triggered.
*
*
@@ -434,8 +434,8 @@ public enum Pointcut implements IPointcut {
"ca.uhn.fhir.rest.api.server.RequestDetails",
"ca.uhn.fhir.rest.server.servlet.ServletRequestDetails",
"java.lang.Throwable",
- "javax.servlet.http.HttpServletRequest",
- "javax.servlet.http.HttpServletResponse"),
+ "jakarta.servlet.http.HttpServletRequest",
+ "jakarta.servlet.http.HttpServletResponse"),
/**
* Server Hook:
@@ -463,10 +463,10 @@ public enum Pointcut implements IPointcut {
* ca.uhn.fhir.rest.api.server.ResponseDetails - This object contains details about the response, including the contents. Hook methods may modify this object to change or replace the response.
*
*
- * This is useful if you want to include an {@link javax.servlet.http.HttpServletResponse}
+ * This is useful if you want to include an {@link jakarta.servlet.http.HttpServletResponse}
* in your method parameters and create a response yourself directly from your
* @Operation
method.
*
@@ -134,7 +134,7 @@ public @interface Operation {
* always the right choice), the framework will not attempt to parse the request body,
* but will instead delegate it to the
- * This is useful if you want to include an {@link javax.servlet.http.HttpServletRequest}
+ * This is useful if you want to include an {@link jakarta.servlet.http.HttpServletRequest}
* in your method parameters and parse the request yourself.
*
*/
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/Read.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/Read.java
index 4276229f630..aedd0656b36 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/Read.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/annotation/Read.java
@@ -23,7 +23,10 @@ import ca.uhn.fhir.rest.client.api.IBasicClient;
import ca.uhn.fhir.rest.client.api.IRestfulClient;
import org.hl7.fhir.instance.model.api.IBaseResource;
-import java.lang.annotation.*;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
* RESTful method annotation to be used for the FHIR
org.codehaus.mojo
build-helper-maven-plugin
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaBatch2Config.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaBatch2Config.java
index c4803afcf86..6105c06bf17 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaBatch2Config.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaBatch2Config.java
@@ -25,13 +25,12 @@ import ca.uhn.fhir.jpa.bulk.export.job.BulkExportJobConfig;
import ca.uhn.fhir.jpa.dao.data.IBatch2JobInstanceRepository;
import ca.uhn.fhir.jpa.dao.data.IBatch2WorkChunkRepository;
import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService;
+import jakarta.persistence.EntityManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;
-import javax.persistence.EntityManager;
-
@Configuration
@Import({BulkExportJobConfig.class})
public class JpaBatch2Config extends BaseBatch2Config {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaJobPersistenceImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaJobPersistenceImpl.java
index 12bf7d12cec..d44374083cc 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaJobPersistenceImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaJobPersistenceImpl.java
@@ -42,6 +42,9 @@ import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.LockModeType;
+import jakarta.persistence.Query;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
@@ -66,9 +69,6 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import javax.persistence.EntityManager;
-import javax.persistence.LockModeType;
-import javax.persistence.Query;
import static ca.uhn.fhir.batch2.coordinator.WorkChunkProcessor.MAX_CHUNK_ERROR_COUNT;
import static ca.uhn.fhir.jpa.entity.Batch2WorkChunkEntity.ERROR_MSG_MAX_LENGTH;
@@ -296,7 +296,6 @@ public class JpaJobPersistenceImpl implements IJobPersistence {
}
@Override
- @Transactional(propagation = Propagation.REQUIRES_NEW)
public WorkChunkStatusEnum onWorkChunkError(WorkChunkErrorEvent theParameters) {
String chunkId = theParameters.getChunkId();
String errorMessage = truncateErrorMessage(theParameters.getErrorMsg());
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 58936143305..f4d906f52c6 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
@@ -28,6 +28,9 @@ import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import com.google.common.hash.HashingInputStream;
import com.google.common.io.ByteStreams;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.input.CountingInputStream;
import org.hibernate.LobHelper;
@@ -45,9 +48,6 @@ import java.sql.SQLException;
import java.util.Date;
import java.util.Optional;
import javax.annotation.Nonnull;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
@Transactional
public class DatabaseBlobBinaryStorageSvcImpl extends BaseBinaryStorageSvcImpl {
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 5d352926733..74e01095381 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
@@ -34,6 +34,7 @@ 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 jakarta.annotation.PostConstruct;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.hl7.fhir.instance.model.api.IBaseBinary;
@@ -55,7 +56,6 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nonnull;
-import javax.annotation.PostConstruct;
import static org.slf4j.LoggerFactory.getLogger;
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 8245fdaf066..ab3c79551ce 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
@@ -58,6 +58,7 @@ import ca.uhn.fhir.util.ExtensionUtil;
import ca.uhn.fhir.util.HapiExtensions;
import ca.uhn.fhir.util.Logs;
import ca.uhn.fhir.util.SearchParameterUtil;
+import jakarta.persistence.EntityManager;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.IBaseExtension;
import org.hl7.fhir.instance.model.api.IBaseReference;
@@ -79,7 +80,6 @@ import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
-import javax.persistence.EntityManager;
import static ca.uhn.fhir.rest.api.Constants.PARAM_HAS;
import static ca.uhn.fhir.rest.api.Constants.PARAM_ID;
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 301d7739466..9d9b5e9248e 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
@@ -40,6 +40,7 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.util.Logs;
import ca.uhn.fhir.util.ValidateUtil;
import com.apicatalog.jsonld.StringUtils;
+import jakarta.annotation.PostConstruct;
import org.apache.commons.lang3.time.DateUtils;
import org.quartz.JobExecutionContext;
import org.slf4j.Logger;
@@ -59,7 +60,6 @@ import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.Semaphore;
import javax.annotation.Nonnull;
-import javax.annotation.PostConstruct;
import static ca.uhn.fhir.batch2.jobs.importpull.BulkImportPullConfig.BULK_IMPORT_JOB_NAME;
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 16cda3e728c..3c3f228adff 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
@@ -34,11 +34,10 @@ import ca.uhn.fhir.jpa.delete.batch2.DeleteExpungeSqlBuilder;
import ca.uhn.fhir.jpa.delete.batch2.DeleteExpungeSvcImpl;
import ca.uhn.fhir.jpa.reindex.Batch2DaoSvcImpl;
import ca.uhn.fhir.jpa.searchparam.MatchUrlService;
+import jakarta.persistence.EntityManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
-import javax.persistence.EntityManager;
-
public class Batch2SupportConfig {
@Bean
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/EnversAuditConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/EnversAuditConfig.java
index 18fd08f7a28..be5702b2e89 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/EnversAuditConfig.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/EnversAuditConfig.java
@@ -20,13 +20,12 @@ package ca.uhn.fhir.jpa.config;
* #L%
*/
+import jakarta.persistence.EntityManagerFactory;
import org.hibernate.envers.AuditReader;
import org.hibernate.envers.AuditReaderFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import javax.persistence.EntityManagerFactory;
-
@Configuration
public class EnversAuditConfig {
private final EntityManagerFactory myEntityManagerFactory;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiFhirHibernateJpaDialect.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiFhirHibernateJpaDialect.java
index 463e3a471cb..3043fe69b81 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiFhirHibernateJpaDialect.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiFhirHibernateJpaDialect.java
@@ -27,6 +27,7 @@ import ca.uhn.fhir.jpa.model.entity.ResourceSearchUrlEntity;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException;
import ca.uhn.fhir.system.HapiSystemProperties;
+import jakarta.persistence.PersistenceException;
import org.hibernate.HibernateException;
import org.hibernate.PessimisticLockException;
import org.hibernate.exception.ConstraintViolationException;
@@ -36,7 +37,6 @@ import org.springframework.dao.DataAccessException;
import org.springframework.orm.jpa.vendor.HibernateJpaDialect;
import javax.annotation.Nonnull;
-import javax.persistence.PersistenceException;
import static org.apache.commons.lang3.StringUtils.defaultString;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
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 50ec76efa26..9d752b6694c 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
@@ -51,7 +51,6 @@ import ca.uhn.fhir.jpa.dao.IJpaStorageResourceParser;
import ca.uhn.fhir.jpa.dao.ISearchBuilder;
import ca.uhn.fhir.jpa.dao.JpaStorageResourceParser;
import ca.uhn.fhir.jpa.dao.MatchResourceUrlService;
-import ca.uhn.fhir.jpa.dao.ObservationLastNIndexPersistSvc;
import ca.uhn.fhir.jpa.dao.SearchBuilderFactory;
import ca.uhn.fhir.jpa.dao.TransactionProcessor;
import ca.uhn.fhir.jpa.dao.data.IResourceModifiedDao;
@@ -223,7 +222,6 @@ public class JpaConfig {
public static final String PERSISTED_JPA_BUNDLE_PROVIDER_BY_SEARCH = "PersistedJpaBundleProvider_BySearch";
public static final String PERSISTED_JPA_SEARCH_FIRST_PAGE_BUNDLE_PROVIDER =
"PersistedJpaSearchFirstPageBundleProvider";
- public static final String SEARCH_BUILDER = "SearchBuilder";
public static final String HISTORY_BUILDER = "HistoryBuilder";
private static final String HAPI_DEFAULT_SCHEDULER_GROUP = "HAPI";
@@ -564,7 +562,8 @@ public class JpaConfig {
@Bean(name = PERSISTED_JPA_BUNDLE_PROVIDER_BY_SEARCH)
@Scope("prototype")
- public PersistedJpaBundleProvider newPersistedJpaBundleProvider(RequestDetails theRequest, Search theSearch) {
+ public PersistedJpaBundleProvider newPersistedJpaBundleProviderBySearch(
+ RequestDetails theRequest, Search theSearch) {
return new PersistedJpaBundleProvider(theRequest, theSearch);
}
@@ -694,7 +693,7 @@ public class JpaConfig {
@Bean(name = HISTORY_BUILDER)
@Scope("prototype")
- public HistoryBuilder newPersistedJpaSearchFirstPageBundleProvider(
+ public HistoryBuilder newHistoryBuilder(
@Nullable String theResourceType,
@Nullable Long theResourceId,
@Nullable Date theRangeStartInclusive,
@@ -832,11 +831,6 @@ public class JpaConfig {
return new TermReindexingSvcImpl();
}
- @Bean
- public ObservationLastNIndexPersistSvc baseObservationLastNIndexpersistSvc() {
- return new ObservationLastNIndexPersistSvc();
- }
-
@Bean
@Scope("prototype")
public PersistenceContextProvider persistenceContextProvider() {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/util/HapiEntityManagerFactoryUtil.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/util/HapiEntityManagerFactoryUtil.java
index f3c0a72e75f..1a28f92db97 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/util/HapiEntityManagerFactoryUtil.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/util/HapiEntityManagerFactoryUtil.java
@@ -20,30 +20,88 @@
package ca.uhn.fhir.jpa.config.util;
import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.config.HapiFhirHibernateJpaDialect;
import ca.uhn.fhir.jpa.config.HapiFhirLocalContainerEntityManagerFactoryBean;
+import ca.uhn.fhir.jpa.util.ISequenceValueMassager;
+import ca.uhn.fhir.util.ReflectionUtil;
+import jakarta.persistence.spi.PersistenceUnitInfo;
+import org.hibernate.boot.registry.BootstrapServiceRegistry;
+import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.jpa.HibernatePersistenceProvider;
+import org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl;
+import org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor;
+import org.hibernate.jpa.boot.spi.EntityManagerFactoryBuilder;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import java.util.Map;
+
public final class HapiEntityManagerFactoryUtil {
private HapiEntityManagerFactoryUtil() {}
+
/**
* This method provides a partially completed entity manager
* factory with HAPI FHIR customizations
*/
public static LocalContainerEntityManagerFactoryBean newEntityManagerFactory(
- ConfigurableListableBeanFactory myConfigurableListableBeanFactory, FhirContext theFhirContext) {
+ ConfigurableListableBeanFactory myConfigurableListableBeanFactory,
+ FhirContext theFhirContext,
+ JpaStorageSettings theStorageSettings) {
LocalContainerEntityManagerFactoryBean retVal =
new HapiFhirLocalContainerEntityManagerFactoryBean(myConfigurableListableBeanFactory);
- configureEntityManagerFactory(retVal, theFhirContext);
+ configureEntityManagerFactory(retVal, theFhirContext, theStorageSettings);
return retVal;
}
public static void configureEntityManagerFactory(
- LocalContainerEntityManagerFactoryBean theFactory, FhirContext theFhirContext) {
+ LocalContainerEntityManagerFactoryBean theFactory,
+ FhirContext theFhirContext,
+ JpaStorageSettings theStorageSettings) {
theFactory.setJpaDialect(new HapiFhirHibernateJpaDialect(theFhirContext.getLocalizer()));
theFactory.setPackagesToScan("ca.uhn.fhir.jpa.model.entity", "ca.uhn.fhir.jpa.entity");
- theFactory.setPersistenceProvider(new HibernatePersistenceProvider());
+ theFactory.setPersistenceProvider(new MyHibernatePersistenceProvider(theStorageSettings));
+ }
+
+ private static class MyHibernatePersistenceProvider extends HibernatePersistenceProvider {
+
+ private final JpaStorageSettings myStorageSettings;
+
+ public MyHibernatePersistenceProvider(JpaStorageSettings theStorageSettings) {
+ myStorageSettings = theStorageSettings;
+ }
+
+ /**
+ * @see MyEntityManagerFactoryBuilderImpl for an explanation of why we do this
+ */
+ @Override
+ protected EntityManagerFactoryBuilder getEntityManagerFactoryBuilder(
+ PersistenceUnitInfo info, Map, ?> integration) {
+ return new MyEntityManagerFactoryBuilderImpl(info, integration);
+ }
+
+ /**
+ * This class extends the default hibernate EntityManagerFactoryBuilder in order to
+ * register a custom service (the {@link ISequenceValueMassager}, which is used in
+ * {@link ca.uhn.fhir.jpa.model.dialect.HapiSequenceStyleGenerator}.
+ *
+ * In Hibernate 5 we didn't need to do this, since we could just register
+ * the service with Spring and Hibernate would ask Spring for it. This no longer
+ * seems to work in Hibernate 6, so we now have to manually register it.
+ */
+ private class MyEntityManagerFactoryBuilderImpl extends EntityManagerFactoryBuilderImpl {
+ public MyEntityManagerFactoryBuilderImpl(PersistenceUnitInfo theInfo, Map, ?> theIntegration) {
+ super(new PersistenceUnitInfoDescriptor(theInfo), (Map) theIntegration);
+ }
+
+ @Override
+ protected StandardServiceRegistryBuilder getStandardServiceRegistryBuilder(BootstrapServiceRegistry bsr) {
+ StandardServiceRegistryBuilder retVal = super.getStandardServiceRegistryBuilder(bsr);
+ ISequenceValueMassager sequenceValueMassager =
+ ReflectionUtil.newInstance(myStorageSettings.getSequenceValueMassagerClass());
+ retVal.addService(ISequenceValueMassager.class, sequenceValueMassager);
+ return retVal;
+ }
+ }
}
}
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 13dfc7b25f0..af3d76dead1 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
@@ -107,6 +107,16 @@ import com.google.common.collect.Sets;
import com.google.common.hash.HashCode;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hashing;
+import jakarta.annotation.PostConstruct;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.NoResultException;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
+import jakarta.persistence.TypedQuery;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
@@ -151,16 +161,6 @@ import java.util.StringTokenizer;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import javax.annotation.PostConstruct;
-import javax.persistence.EntityManager;
-import javax.persistence.NoResultException;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
import javax.xml.stream.events.Characters;
import javax.xml.stream.events.XMLEvent;
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 ba1a21a0eea..4d58d571ca7 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
@@ -118,6 +118,11 @@ import ca.uhn.fhir.validation.ValidationOptions;
import ca.uhn.fhir.validation.ValidationResult;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Streams;
+import jakarta.annotation.PostConstruct;
+import jakarta.persistence.LockModeType;
+import jakarta.persistence.NoResultException;
+import jakarta.persistence.TypedQuery;
+import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IBaseCoding;
@@ -129,7 +134,6 @@ import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.r4.model.Parameters;
import org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Required;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Slice;
import org.springframework.transaction.PlatformTransactionManager;
@@ -155,11 +159,6 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import javax.annotation.PostConstruct;
-import javax.persistence.LockModeType;
-import javax.persistence.NoResultException;
-import javax.persistence.TypedQuery;
-import javax.servlet.http.HttpServletResponse;
import static java.util.Objects.isNull;
import static org.apache.commons.lang3.StringUtils.isBlank;
@@ -1224,7 +1223,6 @@ public abstract class BaseHapiFhirResourceDao extends B
}
@SuppressWarnings("unchecked")
- @Required
public void setResourceType(Class extends IBaseResource> theTableType) {
myResourceType = (Class) theTableType;
}
@@ -1657,8 +1655,11 @@ public abstract class BaseHapiFhirResourceDao extends B
CURRENTLY_REINDEXING.put(theResource, Boolean.TRUE);
}
+ SystemRequestDetails request = new SystemRequestDetails();
+ request.getUserData().put(JpaConstants.SKIP_REINDEX_ON_UPDATE, Boolean.TRUE);
+
updateEntity(
- null, theResource, theEntity, theEntity.getDeleted(), true, false, transactionDetails, true, false);
+ request, theResource, theEntity, theEntity.getDeleted(), true, false, transactionDetails, true, false);
if (theResource != null) {
CURRENTLY_REINDEXING.put(theResource, null);
}
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 6696a3b0e52..961992748e1 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
@@ -48,6 +48,15 @@ import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId;
import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException;
import ca.uhn.fhir.util.StopWatch;
import com.google.common.annotations.VisibleForTesting;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
+import jakarta.persistence.TypedQuery;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.JoinType;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
@@ -61,15 +70,6 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.JoinType;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
public abstract class BaseHapiFhirSystemDao extends BaseStorageDao
implements IFhirSystemDao {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu2.java
index b9ab01c5c6a..76e6279ddd2 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu2.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirSystemDaoDstu2.java
@@ -23,11 +23,11 @@ import ca.uhn.fhir.jpa.model.entity.TagDefinition;
import ca.uhn.fhir.model.dstu2.composite.MetaDt;
import ca.uhn.fhir.model.dstu2.resource.Bundle;
import ca.uhn.fhir.rest.api.server.RequestDetails;
+import jakarta.persistence.TypedQuery;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import java.util.Collection;
import java.util.List;
-import javax.persistence.TypedQuery;
public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao {
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 346b1063e3d..80bd0e9a7f1 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
@@ -53,6 +53,9 @@ import ca.uhn.fhir.rest.server.util.CompositeInterceptorBroadcaster;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import com.google.common.collect.Ordering;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
import org.hibernate.search.backend.elasticsearch.ElasticsearchExtension;
import org.hibernate.search.engine.search.predicate.dsl.PredicateFinalStep;
import org.hibernate.search.engine.search.predicate.dsl.SearchPredicateFactory;
@@ -79,9 +82,6 @@ import java.util.Spliterators;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;
import javax.annotation.Nonnull;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
import static ca.uhn.fhir.rest.server.BasePagingProvider.DEFAULT_MAX_PAGE_SIZE;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/HistoryBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/HistoryBuilder.java
index 445e9d8860b..30a181df720 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/HistoryBuilder.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/HistoryBuilder.java
@@ -32,6 +32,17 @@ import ca.uhn.fhir.rest.param.HistorySearchStyleEnum;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.Multimaps;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
+import jakarta.persistence.TypedQuery;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Expression;
+import jakarta.persistence.criteria.JoinType;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
+import jakarta.persistence.criteria.Subquery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -43,17 +54,6 @@ import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Expression;
-import javax.persistence.criteria.JoinType;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-import javax.persistence.criteria.Subquery;
import static ca.uhn.fhir.jpa.util.QueryParameterUtils.toPredicateArray;
@@ -177,18 +177,13 @@ public class HistoryBuilder {
if (!thePartitionId.isAllPartitions()) {
if (thePartitionId.isDefaultPartition()) {
- predicates.add(theCriteriaBuilder.isNull(
- theFrom.get("myPartitionIdValue").as(Integer.class)));
+ predicates.add(theCriteriaBuilder.isNull(theFrom.get("myPartitionIdValue")));
} else if (thePartitionId.hasDefaultPartitionId()) {
predicates.add(theCriteriaBuilder.or(
- theCriteriaBuilder.isNull(
- theFrom.get("myPartitionIdValue").as(Integer.class)),
- theFrom.get("myPartitionIdValue")
- .as(Integer.class)
- .in(thePartitionId.getPartitionIdsWithoutDefault())));
+ theCriteriaBuilder.isNull(theFrom.get("myPartitionIdValue")),
+ theFrom.get("myPartitionIdValue").in(thePartitionId.getPartitionIdsWithoutDefault())));
} else {
- predicates.add(
- theFrom.get("myPartitionIdValue").as(Integer.class).in(thePartitionId.getPartitionIds()));
+ predicates.add(theFrom.get("myPartitionIdValue").in(thePartitionId.getPartitionIds()));
}
}
@@ -205,13 +200,12 @@ public class HistoryBuilder {
if (HistorySearchStyleEnum.AT == theHistorySearchStyle && myResourceId != null) {
addPredicateForAtQueryParameter(theCriteriaBuilder, theQuery, theFrom, predicates);
} else {
- predicates.add(theCriteriaBuilder.greaterThanOrEqualTo(
- theFrom.get("myUpdated").as(Date.class), myRangeStartInclusive));
+ predicates.add(
+ theCriteriaBuilder.greaterThanOrEqualTo(theFrom.get("myUpdated"), myRangeStartInclusive));
}
}
if (myRangeEndInclusive != null) {
- predicates.add(theCriteriaBuilder.lessThanOrEqualTo(
- theFrom.get("myUpdated").as(Date.class), myRangeEndInclusive));
+ predicates.add(theCriteriaBuilder.lessThanOrEqualTo(theFrom.get("myUpdated"), myRangeEndInclusive));
}
if (predicates.size() > 0) {
@@ -226,20 +220,19 @@ public class HistoryBuilder {
List thePredicates) {
Subquery pastDateSubQuery = theQuery.subquery(Date.class);
Root subQueryResourceHistory = pastDateSubQuery.from(ResourceHistoryTable.class);
- Expression myUpdatedMostRecent =
- theCriteriaBuilder.max(subQueryResourceHistory.get("myUpdated")).as(Date.class);
- Expression myUpdatedMostRecentOrDefault =
+ Expression myUpdatedMostRecent = theCriteriaBuilder.max(subQueryResourceHistory.get("myUpdated"));
+ Expression myUpdatedMostRecentOrDefault =
theCriteriaBuilder.coalesce(myUpdatedMostRecent, theCriteriaBuilder.literal(myRangeStartInclusive));
pastDateSubQuery
.select(myUpdatedMostRecentOrDefault)
.where(
theCriteriaBuilder.lessThanOrEqualTo(
- subQueryResourceHistory.get("myUpdated").as(Date.class), myRangeStartInclusive),
+ subQueryResourceHistory.get("myUpdated"), myRangeStartInclusive),
theCriteriaBuilder.equal(subQueryResourceHistory.get("myResourceId"), myResourceId));
Predicate updatedDatePredicate =
- theCriteriaBuilder.greaterThanOrEqualTo(theFrom.get("myUpdated").as(Date.class), pastDateSubQuery);
+ theCriteriaBuilder.greaterThanOrEqualTo(theFrom.get("myUpdated"), pastDateSubQuery);
thePredicates.add(updatedDatePredicate);
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaPersistedResourceValidationSupport.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaPersistedResourceValidationSupport.java
index 78b1eed3f6d..d3c32df28f8 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaPersistedResourceValidationSupport.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaPersistedResourceValidationSupport.java
@@ -36,6 +36,7 @@ import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.param.UriParam;
import ca.uhn.fhir.sl.cache.Cache;
import ca.uhn.fhir.sl.cache.CacheFactory;
+import jakarta.annotation.PostConstruct;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IBaseResource;
@@ -58,7 +59,6 @@ import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import javax.annotation.Nullable;
-import javax.annotation.PostConstruct;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.hl7.fhir.common.hapi.validation.support.ValidationConstants.LOINC_LOW;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoCodeSystem.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoCodeSystem.java
index 12a4f01a947..1a51e09e493 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoCodeSystem.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoCodeSystem.java
@@ -42,6 +42,7 @@ import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.util.FhirTerser;
import ca.uhn.hapi.converters.canonical.VersionCanonicalizer;
+import jakarta.annotation.PostConstruct;
import org.apache.commons.collections4.CollectionUtils;
import org.hl7.fhir.common.hapi.validation.support.CommonCodeSystemsTerminologyService;
import org.hl7.fhir.instance.model.api.IBaseCoding;
@@ -59,7 +60,6 @@ import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
-import javax.annotation.PostConstruct;
import static ca.uhn.fhir.util.DatatypeUtil.toStringValue;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoComposition.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoComposition.java
index 1ff023172a6..22b7da2f025 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoComposition.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoComposition.java
@@ -27,12 +27,12 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.param.DateRangeParam;
import ca.uhn.fhir.rest.param.StringParam;
+import jakarta.servlet.http.HttpServletRequest;
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 java.util.Collections;
-import javax.servlet.http.HttpServletRequest;
public class JpaResourceDaoComposition extends BaseHapiFhirResourceDao
implements IFhirResourceDaoComposition {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoEncounter.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoEncounter.java
index 9c365a43b7d..6e35f2e0341 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoEncounter.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoEncounter.java
@@ -27,12 +27,12 @@ import ca.uhn.fhir.rest.api.SortSpec;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.param.DateRangeParam;
import ca.uhn.fhir.rest.param.StringParam;
+import jakarta.servlet.http.HttpServletRequest;
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 java.util.Collections;
-import javax.servlet.http.HttpServletRequest;
public class JpaResourceDaoEncounter extends BaseHapiFhirResourceDao
implements IFhirResourceDaoEncounter {
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 6181c2dedfc..b81db1c490c 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
@@ -22,9 +22,7 @@ package ca.uhn.fhir.jpa.dao;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoObservation;
-import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource;
import ca.uhn.fhir.jpa.model.dao.JpaPid;
-import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.model.api.IQueryParameterType;
@@ -34,22 +32,20 @@ import ca.uhn.fhir.rest.api.SortOrderEnum;
import ca.uhn.fhir.rest.api.SortSpec;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails;
-import ca.uhn.fhir.rest.api.server.storage.TransactionDetails;
import ca.uhn.fhir.rest.param.ReferenceOrListParam;
import ca.uhn.fhir.rest.param.ReferenceParam;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
+import jakarta.servlet.http.HttpServletResponse;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.Observation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.support.TransactionTemplate;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
import java.util.TreeMap;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import javax.servlet.http.HttpServletResponse;
public class JpaResourceDaoObservation extends BaseHapiFhirResourceDao
implements IFhirResourceDaoObservation {
@@ -57,9 +53,6 @@ public class JpaResourceDaoObservation extends BaseHapi
@PersistenceContext(type = PersistenceContextType.TRANSACTION)
protected EntityManager myEntityManager;
- @Autowired
- ObservationLastNIndexPersistSvc myObservationLastNIndexPersistSvc;
-
@Autowired
private IRequestPartitionHelperSvc myRequestPartitionHelperService;
@@ -98,64 +91,6 @@ public class JpaResourceDaoObservation extends BaseHapi
return Observation.SP_PATIENT;
}
- @Override
- public ResourceTable updateEntity(
- RequestDetails theRequest,
- IBaseResource theResource,
- IBasePersistedResource theEntity,
- Date theDeletedTimestampOrNull,
- boolean thePerformIndexing,
- boolean theUpdateVersion,
- TransactionDetails theTransactionDetails,
- boolean theForceUpdate,
- boolean theCreateNewHistoryEntry) {
- return updateObservationEntity(
- theRequest,
- theResource,
- theEntity,
- theDeletedTimestampOrNull,
- thePerformIndexing,
- theUpdateVersion,
- theTransactionDetails,
- theForceUpdate,
- theCreateNewHistoryEntry);
- }
-
- protected ResourceTable updateObservationEntity(
- RequestDetails theRequest,
- IBaseResource theResource,
- IBasePersistedResource theEntity,
- Date theDeletedTimestampOrNull,
- boolean thePerformIndexing,
- boolean theUpdateVersion,
- TransactionDetails theTransactionDetails,
- boolean theForceUpdate,
- boolean theCreateNewHistoryEntry) {
- ResourceTable retVal = super.updateEntity(
- theRequest,
- theResource,
- theEntity,
- theDeletedTimestampOrNull,
- thePerformIndexing,
- theUpdateVersion,
- theTransactionDetails,
- theForceUpdate,
- theCreateNewHistoryEntry);
-
- if (getStorageSettings().isLastNEnabled()) {
- if (!retVal.isUnchangedInCurrentOperation()) {
- if (retVal.getDeleted() == null) {
- // Update indexes here for LastN operation.
- myObservationLastNIndexPersistSvc.indexObservation(theResource);
- } else {
- myObservationLastNIndexPersistSvc.deleteObservationIndex(theEntity);
- }
- }
- }
-
- return retVal;
- }
-
protected void updateSearchParamsForLastn(
SearchParameterMap theSearchParameterMap, RequestDetails theRequestDetails) {
if (!isPagingProviderDatabaseBacked(theRequestDetails)) {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoPatient.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoPatient.java
index 0a1a4540614..e94702fad0b 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoPatient.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoPatient.java
@@ -36,6 +36,7 @@ import ca.uhn.fhir.rest.param.DateRangeParam;
import ca.uhn.fhir.rest.param.StringAndListParam;
import ca.uhn.fhir.rest.param.TokenOrListParam;
import ca.uhn.fhir.rest.param.TokenParam;
+import jakarta.servlet.http.HttpServletRequest;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
@@ -47,7 +48,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Collections;
-import javax.servlet.http.HttpServletRequest;
public class JpaResourceDaoPatient extends BaseHapiFhirResourceDao
implements IFhirResourceDaoPatient {
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
deleted file mode 100644
index fa8b6fb3274..00000000000
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/ObservationLastNIndexPersistSvc.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*-
- * #%L
- * HAPI FHIR JPA Server
- * %%
- * Copyright (C) 2014 - 2023 Smile CDR, Inc.
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
- */
-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.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;
-import ca.uhn.fhir.jpa.search.lastn.IElasticsearchSvc;
-import ca.uhn.fhir.jpa.search.lastn.json.CodeJson;
-import ca.uhn.fhir.jpa.search.lastn.json.ObservationJson;
-import ca.uhn.fhir.jpa.searchparam.extractor.ISearchParamExtractor;
-import ca.uhn.fhir.jpa.searchparam.extractor.PathAndRef;
-import ca.uhn.fhir.parser.IParser;
-import org.hl7.fhir.instance.model.api.IBase;
-import org.hl7.fhir.instance.model.api.IBaseResource;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.UUID;
-
-public class ObservationLastNIndexPersistSvc {
-
- @Autowired
- private ISearchParamExtractor mySearchParameterExtractor;
-
- @Autowired(required = false)
- private IElasticsearchSvc myElasticsearchSvc;
-
- @Autowired
- private JpaStorageSettings myConfig;
-
- @Autowired
- private FhirContext myContext;
-
- public void indexObservation(IBaseResource theResource) {
-
- if (myElasticsearchSvc == null) {
- // Elasticsearch is not enabled and therefore no index needs to be updated.
- return;
- }
-
- List subjectReferenceElement =
- mySearchParameterExtractor.extractValues("Observation.subject", theResource);
- String subjectId = subjectReferenceElement.stream()
- .map(refElement ->
- mySearchParameterExtractor.extractReferenceLinkFromResource(refElement, "Observation.subject"))
- .filter(Objects::nonNull)
- .map(PathAndRef::getRef)
- .filter(Objects::nonNull)
- .map(subjectRef -> subjectRef.getReferenceElement().getValue())
- .filter(Objects::nonNull)
- .findFirst()
- .orElse(null);
-
- Date effectiveDtm = null;
- List effectiveDateElement =
- mySearchParameterExtractor.extractValues("Observation.effective", theResource);
- if (effectiveDateElement.size() > 0) {
- effectiveDtm = mySearchParameterExtractor.extractDateFromResource(
- effectiveDateElement.get(0), "Observation.effective");
- }
-
- List observationCodeCodeableConcepts =
- mySearchParameterExtractor.extractValues("Observation.code", theResource);
-
- // Only index for lastn if Observation has a code
- if (observationCodeCodeableConcepts.size() == 0) {
- return;
- }
-
- List observationCategoryCodeableConcepts =
- mySearchParameterExtractor.extractValues("Observation.category", theResource);
-
- createOrUpdateIndexedObservation(
- theResource,
- effectiveDtm,
- subjectId,
- observationCodeCodeableConcepts,
- observationCategoryCodeableConcepts);
- }
-
- private void createOrUpdateIndexedObservation(
- IBaseResource theResource,
- Date theEffectiveDtm,
- String theSubjectId,
- List theObservationCodeCodeableConcepts,
- List theObservationCategoryCodeableConcepts) {
- String resourcePID = theResource.getIdElement().getIdPart();
-
- // Determine if an index already exists for Observation:
- ObservationJson indexedObservation = null;
- if (resourcePID != null) {
- indexedObservation = myElasticsearchSvc.getObservationDocument(resourcePID);
- }
- if (indexedObservation == null) {
- indexedObservation = new ObservationJson();
- }
-
- indexedObservation.setEffectiveDtm(theEffectiveDtm);
- indexedObservation.setIdentifier(resourcePID);
- if (myConfig.isStoreResourceInHSearchIndex()) {
- indexedObservation.setResource(encodeResource(theResource));
- }
- indexedObservation.setSubject(theSubjectId);
-
- addCodeToObservationIndex(theObservationCodeCodeableConcepts, indexedObservation);
-
- addCategoriesToObservationIndex(theObservationCategoryCodeableConcepts, indexedObservation);
-
- myElasticsearchSvc.createOrUpdateObservationIndex(resourcePID, indexedObservation);
- }
-
- private String encodeResource(IBaseResource theResource) {
- IParser parser = myContext.newJsonParser();
- return parser.encodeResourceToString(theResource);
- }
-
- private void addCodeToObservationIndex(
- List theObservationCodeCodeableConcepts, ObservationJson theIndexedObservation) {
- // Determine if a Normalized ID was created previously for Observation Code
- String existingObservationCodeNormalizedId =
- getCodeCodeableConceptId(theObservationCodeCodeableConcepts.get(0));
-
- // Create/update normalized Observation Code index record
- CodeJson codeableConceptField =
- getCodeCodeableConcept(theObservationCodeCodeableConcepts.get(0), existingObservationCodeNormalizedId);
-
- myElasticsearchSvc.createOrUpdateObservationCodeIndex(
- codeableConceptField.getCodeableConceptId(), codeableConceptField);
-
- theIndexedObservation.setCode(codeableConceptField);
- }
-
- private void addCategoriesToObservationIndex(
- List observationCategoryCodeableConcepts, ObservationJson indexedObservation) {
- // Build CodeableConcept entities for Observation.Category
- List categoryCodeableConceptEntities = new ArrayList<>();
- for (IBase categoryCodeableConcept : observationCategoryCodeableConcepts) {
- // Build CodeableConcept entities for each category CodeableConcept
- categoryCodeableConceptEntities.add(getCategoryCodeableConceptEntities(categoryCodeableConcept));
- }
- indexedObservation.setCategories(categoryCodeableConceptEntities);
- }
-
- private CodeJson getCategoryCodeableConceptEntities(IBase theValue) {
- String text = mySearchParameterExtractor.getDisplayTextFromCodeableConcept(theValue);
- CodeJson categoryCodeableConcept = new CodeJson();
- categoryCodeableConcept.setCodeableConceptText(text);
-
- List codings = mySearchParameterExtractor.getCodingsFromCodeableConcept(theValue);
- for (IBase nextCoding : codings) {
- addCategoryCoding(nextCoding, categoryCodeableConcept);
- }
- return categoryCodeableConcept;
- }
-
- private CodeJson getCodeCodeableConcept(IBase theValue, String observationCodeNormalizedId) {
- String text = mySearchParameterExtractor.getDisplayTextFromCodeableConcept(theValue);
- CodeJson codeCodeableConcept = new CodeJson();
- codeCodeableConcept.setCodeableConceptText(text);
- codeCodeableConcept.setCodeableConceptId(observationCodeNormalizedId);
-
- List codings = mySearchParameterExtractor.getCodingsFromCodeableConcept(theValue);
- for (IBase nextCoding : codings) {
- addCodeCoding(nextCoding, codeCodeableConcept);
- }
-
- return codeCodeableConcept;
- }
-
- private String getCodeCodeableConceptId(IBase theValue) {
- List codings = mySearchParameterExtractor.getCodingsFromCodeableConcept(theValue);
- Optional codeCodeableConceptIdOptional = Optional.empty();
-
- for (IBase nextCoding : codings) {
- ResourceIndexedSearchParamToken param = mySearchParameterExtractor.createSearchParamForCoding(
- "Observation",
- new RuntimeSearchParam(null, null, "code", null, null, null, null, null, null, null),
- nextCoding);
- if (param != null) {
- String system = param.getSystem();
- String code = param.getValue();
- String text = mySearchParameterExtractor.getDisplayTextForCoding(nextCoding);
-
- String codeSystemHash = String.valueOf(CodeSystemHash.hashCodeSystem(system, code));
- CodeJson codeCodeableConceptDocument =
- myElasticsearchSvc.getObservationCodeDocument(codeSystemHash, text);
- if (codeCodeableConceptDocument != null) {
- codeCodeableConceptIdOptional = Optional.of(codeCodeableConceptDocument.getCodeableConceptId());
- break;
- }
- }
- }
-
- return codeCodeableConceptIdOptional.orElse(UUID.randomUUID().toString());
- }
-
- private void addCategoryCoding(IBase theValue, CodeJson theCategoryCodeableConcept) {
- ResourceIndexedSearchParamToken param = mySearchParameterExtractor.createSearchParamForCoding(
- "Observation",
- new RuntimeSearchParam(null, null, "category", null, null, null, null, null, null, null),
- theValue);
- if (param != null) {
- String system = param.getSystem();
- String code = param.getValue();
- String text = mySearchParameterExtractor.getDisplayTextForCoding(theValue);
- theCategoryCodeableConcept.addCoding(system, code, text);
- }
- }
-
- private void addCodeCoding(IBase theValue, CodeJson theObservationCode) {
- ResourceIndexedSearchParamToken param = mySearchParameterExtractor.createSearchParamForCoding(
- "Observation",
- new RuntimeSearchParam(null, null, "code", null, null, null, null, null, null, null),
- theValue);
- if (param != null) {
- String system = param.getSystem();
- String code = param.getValue();
- String text = mySearchParameterExtractor.getDisplayTextForCoding(theValue);
- theObservationCode.addCoding(system, code, text);
- }
- }
-
- public void deleteObservationIndex(IBasePersistedResource theEntity) {
- if (myElasticsearchSvc == null) {
- // Elasticsearch is not enabled and therefore no index needs to be updated.
- return;
- }
-
- ObservationJson deletedObservationLastNEntity =
- myElasticsearchSvc.getObservationDocument(theEntity.getIdDt().getIdPart());
- if (deletedObservationLastNEntity != null) {
- myElasticsearchSvc.deleteObservationDocument(deletedObservationLastNEntity.getIdentifier());
- }
- }
-}
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 16d58ec0be6..437677f99c5 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
@@ -44,6 +44,16 @@ import ca.uhn.fhir.util.StopWatch;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
+import jakarta.persistence.PersistenceException;
+import jakarta.persistence.Tuple;
+import jakarta.persistence.TypedQuery;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
import org.apache.commons.lang3.Validate;
import org.hibernate.internal.SessionImpl;
import org.hl7.fhir.instance.model.api.IBase;
@@ -65,16 +75,6 @@ import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import javax.persistence.PersistenceException;
-import javax.persistence.Tuple;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
import static ca.uhn.fhir.util.UrlUtil.determineResourceTypeInResourceUrl;
import static org.apache.commons.lang3.StringUtils.countMatches;
@@ -367,29 +367,25 @@ public class TransactionProcessor extends BaseTransactionProcessor {
CriteriaBuilder cb = myEntityManager.getCriteriaBuilder();
CriteriaQuery cq = cb.createTupleQuery();
Root from = cq.from(ResourceIndexedSearchParamToken.class);
- cq.multiselect(
- from.get("myResourcePid").as(Long.class),
- from.get(theIndexColumnName).as(Long.class));
+ cq.multiselect(from.get("myResourcePid"), from.get(theIndexColumnName));
Predicate masterPredicate;
if (theHashesForIndexColumn.size() == 1) {
masterPredicate = cb.equal(
- from.get(theIndexColumnName).as(Long.class),
+ from.get(theIndexColumnName),
theHashesForIndexColumn.iterator().next());
} else {
- masterPredicate = from.get(theIndexColumnName).as(Long.class).in(theHashesForIndexColumn);
+ masterPredicate = from.get(theIndexColumnName).in(theHashesForIndexColumn);
}
if (myPartitionSettings.isPartitioningEnabled()
&& !myPartitionSettings.isIncludePartitionInSearchHashes()) {
if (theRequestPartitionId.isDefaultPartition()) {
- Predicate partitionIdCriteria =
- cb.isNull(from.get("myPartitionIdValue").as(Integer.class));
+ Predicate partitionIdCriteria = cb.isNull(from.get("myPartitionIdValue"));
masterPredicate = cb.and(partitionIdCriteria, masterPredicate);
} else if (!theRequestPartitionId.isAllPartitions()) {
- Predicate partitionIdCriteria = from.get("myPartitionIdValue")
- .as(Integer.class)
- .in(theRequestPartitionId.getPartitionIds());
+ Predicate partitionIdCriteria =
+ from.get("myPartitionIdValue").in(theRequestPartitionId.getPartitionIds());
masterPredicate = cb.and(partitionIdCriteria, masterPredicate);
}
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/IResourceHistoryTableDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/IResourceHistoryTableDao.java
index bd65315bf30..b74a1b757f2 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/IResourceHistoryTableDao.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/IResourceHistoryTableDao.java
@@ -44,30 +44,30 @@ public interface IResourceHistoryTableDao extends JpaRepository :dontWantVersion")
Slice findForResourceId(
Pageable thePage, @Param("resId") Long theId, @Param("dontWantVersion") Long theDontWantVersion);
@Query(
- "SELECT t FROM ResourceHistoryTable t LEFT OUTER JOIN FETCH t.myProvenance WHERE t.myResourceId = :resId AND t.myResourceVersion != :dontWantVersion")
+ "SELECT t FROM ResourceHistoryTable t LEFT OUTER JOIN FETCH t.myProvenance WHERE t.myResourceId = :resId AND t.myResourceVersion <> :dontWantVersion")
Slice findForResourceIdAndReturnEntitiesAndFetchProvenance(
Pageable thePage, @Param("resId") Long theId, @Param("dontWantVersion") Long theDontWantVersion);
@Query("" + "SELECT v.myId FROM ResourceHistoryTable v "
+ "LEFT OUTER JOIN ResourceTable t ON (v.myResourceId = t.myId) "
- + "WHERE v.myResourceVersion != t.myVersion AND "
+ + "WHERE v.myResourceVersion <> t.myVersion AND "
+ "t.myId = :resId")
Slice findIdsOfPreviousVersionsOfResourceId(Pageable thePage, @Param("resId") Long theResourceId);
@Query("" + "SELECT v.myId FROM ResourceHistoryTable v "
+ "LEFT OUTER JOIN ResourceTable t ON (v.myResourceId = t.myId) "
- + "WHERE v.myResourceVersion != t.myVersion AND "
+ + "WHERE v.myResourceVersion <> t.myVersion AND "
+ "t.myResourceType = :restype")
Slice findIdsOfPreviousVersionsOfResources(Pageable thePage, @Param("restype") String theResourceName);
@Query("" + "SELECT v.myId FROM ResourceHistoryTable v "
+ "LEFT OUTER JOIN ResourceTable t ON (v.myResourceId = t.myId) "
- + "WHERE v.myResourceVersion != t.myVersion")
+ + "WHERE v.myResourceVersion <> t.myVersion")
Slice findIdsOfPreviousVersionsOfResources(Pageable thePage);
@Modifying
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/custom/IResourceTableDaoImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/custom/IResourceTableDaoImpl.java
index a8d86d69e43..208e8c78d1e 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/custom/IResourceTableDaoImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/custom/IResourceTableDaoImpl.java
@@ -19,12 +19,12 @@
*/
package ca.uhn.fhir.jpa.dao.data.custom;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
import org.springframework.stereotype.Component;
import java.util.Collection;
import java.util.List;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
@Component
/**
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3.java
index ced37678fdf..2865edc0c9b 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3.java
@@ -23,13 +23,13 @@ import ca.uhn.fhir.jpa.dao.BaseHapiFhirSystemDao;
import ca.uhn.fhir.jpa.dao.JpaResourceDao;
import ca.uhn.fhir.jpa.model.entity.TagDefinition;
import ca.uhn.fhir.rest.api.server.RequestDetails;
+import jakarta.persistence.TypedQuery;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.Meta;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import java.util.Collection;
import java.util.List;
-import javax.persistence.TypedQuery;
public class FhirSystemDaoDstu3 extends BaseHapiFhirSystemDao {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeEverythingService.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeEverythingService.java
index 34f247edce7..9c192fa58e8 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeEverythingService.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/ExpungeEverythingService.java
@@ -78,6 +78,16 @@ import ca.uhn.fhir.rest.server.provider.ProviderConstants;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.rest.server.util.CompositeInterceptorBroadcaster;
import ca.uhn.fhir.util.StopWatch;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
+import jakarta.persistence.Query;
+import jakarta.persistence.TypedQuery;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.metamodel.EntityType;
+import jakarta.persistence.metamodel.Metamodel;
+import jakarta.persistence.metamodel.SingularAttribute;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -85,14 +95,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import java.util.List;
+import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nullable;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
@Service
public class ExpungeEverythingService implements IExpungeEverythingService {
@@ -229,6 +234,7 @@ public class ExpungeEverythingService implements IExpungeEverythingService {
expungeEverythingByTypeWithoutPurging(theRequest, ResourceHistoryTable.class, requestPartitionId));
counter.addAndGet(
expungeEverythingByTypeWithoutPurging(theRequest, ResourceSearchUrlEntity.class, requestPartitionId));
+
int counterBefore = counter.get();
counter.addAndGet(expungeEverythingByTypeWithoutPurging(theRequest, ResourceTable.class, requestPartitionId));
counter.addAndGet(expungeEverythingByTypeWithoutPurging(theRequest, PartitionEntity.class, requestPartitionId));
@@ -257,8 +263,10 @@ public class ExpungeEverythingService implements IExpungeEverythingService {
myMemoryCacheService.invalidateAllCaches();
}
- private int expungeEverythingByTypeWithoutPurging(
- RequestDetails theRequest, Class> theEntityType, RequestPartitionId theRequestPartitionId) {
+ private int expungeEverythingByTypeWithoutPurging(
+ RequestDetails theRequest, Class theEntityType, RequestPartitionId theRequestPartitionId) {
+ HapiTransactionService.noTransactionAllowed();
+
int outcome = 0;
while (true) {
StopWatch sw = new StopWatch();
@@ -268,16 +276,49 @@ public class ExpungeEverythingService implements IExpungeEverythingService {
.withPropagation(Propagation.REQUIRES_NEW)
.withRequestPartitionId(theRequestPartitionId)
.execute(() -> {
- CriteriaBuilder cb = myEntityManager.getCriteriaBuilder();
- CriteriaQuery> cq = cb.createQuery(theEntityType);
- cq.from(theEntityType);
- TypedQuery> query = myEntityManager.createQuery(cq);
- query.setMaxResults(1000);
- List> results = query.getResultList();
- for (Object result : results) {
- myEntityManager.remove(result);
+
+ /*
+ * This method uses a nice efficient mechanism where we figure out the PID datatype
+ * and load only the PIDs and delete by PID for all resource types except ResourceTable.
+ * We delete ResourceTable using the entitymanager so that Hibernate Search knows to
+ * delete the corresponding records it manages in ElasticSearch. See
+ * FhirResourceDaoR4SearchWithElasticSearchIT for a test that fails without the
+ * block below.
+ */
+ if (ResourceTable.class.equals(theEntityType)) {
+ CriteriaBuilder cb = myEntityManager.getCriteriaBuilder();
+ CriteriaQuery> cq = cb.createQuery(theEntityType);
+ cq.from(theEntityType);
+ TypedQuery> query = myEntityManager.createQuery(cq);
+ query.setMaxResults(800);
+ List> results = query.getResultList();
+ for (Object result : results) {
+ myEntityManager.remove(result);
+ }
+ return results.size();
}
- return results.size();
+
+ Metamodel metamodel = myEntityManager.getMetamodel();
+ EntityType entity = metamodel.entity(theEntityType);
+ Set> singularAttributes = entity.getSingularAttributes();
+ String idProperty = null;
+ for (SingularAttribute super T, ?> singularAttribute : singularAttributes) {
+ if (singularAttribute.isId()) {
+ idProperty = singularAttribute.getName();
+ break;
+ }
+ }
+
+ Query nativeQuery = myEntityManager.createQuery(
+ "SELECT " + idProperty + " FROM " + theEntityType.getSimpleName());
+ nativeQuery.setMaxResults(800);
+ List pids = nativeQuery.getResultList();
+
+ nativeQuery = myEntityManager.createQuery("DELETE FROM " + theEntityType.getSimpleName()
+ + " WHERE " + idProperty + " IN (:pids)");
+ nativeQuery.setParameter("pids", pids);
+ nativeQuery.executeUpdate();
+ return pids.size();
});
outcome += count;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoSearchParamSynchronizer.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoSearchParamSynchronizer.java
index 458f5a428d5..fb6dda60d86 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoSearchParamSynchronizer.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoSearchParamSynchronizer.java
@@ -24,18 +24,22 @@ import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.searchparam.extractor.ResourceIndexedSearchParams;
import ca.uhn.fhir.jpa.util.AddRemoveCount;
import com.google.common.annotations.VisibleForTesting;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
@Service
public class DaoSearchParamSynchronizer {
+ private static final Logger ourLog = LoggerFactory.getLogger(DaoSearchParamSynchronizer.class);
+
@PersistenceContext(type = PersistenceContextType.TRANSACTION)
protected EntityManager myEntityManager;
@@ -89,9 +93,13 @@ public class DaoSearchParamSynchronizer {
tryToReuseIndexEntities(paramsToRemove, paramsToAdd);
for (T next : paramsToRemove) {
+ if (!myEntityManager.contains(next)) {
+ // If a resource is created and deleted in the same transaction, we can end up
+ // in a state where we're deleting entities that don't actually exist. Hibernate
+ // 6 is stricter about this, so we skip here.
+ continue;
+ }
myEntityManager.remove(next);
- theEntity.getParamsQuantity().remove(next);
- theEntity.getParamsQuantityNormalized().remove(next);
}
for (T next : paramsToAdd) {
myEntityManager.merge(next);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IdHelperService.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IdHelperService.java
index cee2c8bfd08..e23720ad33d 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IdHelperService.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/IdHelperService.java
@@ -42,6 +42,15 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.MultimapBuilder;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
+import jakarta.persistence.Tuple;
+import jakarta.persistence.TypedQuery;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IAnyResource;
@@ -66,15 +75,6 @@ import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import javax.persistence.Tuple;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
import static ca.uhn.fhir.jpa.search.builder.predicate.BaseJoiningPredicateBuilder.replaceDefaultPartitionIdIfNonNull;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
@@ -377,10 +377,7 @@ public class IdHelperService implements IIdHelperService {
* Only PG, and MSSql support INCLUDE COLUMNS.
* @see AddIndexTask.generateSql
*/
- criteriaQuery.multiselect(
- from.get("myId").as(Long.class),
- from.get("myResourceType").as(String.class),
- from.get("myFhirId").as(String.class));
+ criteriaQuery.multiselect(from.get("myId"), from.get("myResourceType"), from.get("myFhirId"));
// one create one clause per id.
List predicates = new ArrayList<>(theIds.size());
@@ -389,11 +386,11 @@ public class IdHelperService implements IIdHelperService {
List andPredicates = new ArrayList<>(3);
if (isNotBlank(next.getResourceType())) {
- Predicate typeCriteria = cb.equal(from.get("myResourceType").as(String.class), next.getResourceType());
+ Predicate typeCriteria = cb.equal(from.get("myResourceType"), next.getResourceType());
andPredicates.add(typeCriteria);
}
- Predicate idCriteria = cb.equal(from.get("myFhirId").as(String.class), next.getIdPart());
+ Predicate idCriteria = cb.equal(from.get("myFhirId"), next.getIdPart());
andPredicates.add(idCriteria);
getOptionalPartitionPredicate(theRequestPartitionId, cb, from).ifPresent(andPredicates::add);
predicates.add(cb.and(andPredicates.toArray(EMPTY_PREDICATE_ARRAY)));
@@ -431,19 +428,16 @@ public class IdHelperService implements IIdHelperService {
if (myPartitionSettings.isAllowUnqualifiedCrossPartitionReference()) {
return Optional.empty();
} else if (theRequestPartitionId.isDefaultPartition() && myPartitionSettings.getDefaultPartitionId() == null) {
- Predicate partitionIdCriteria =
- cb.isNull(from.get("myPartitionIdValue").as(Integer.class));
+ Predicate partitionIdCriteria = cb.isNull(from.get("myPartitionIdValue"));
return Optional.of(partitionIdCriteria);
} else if (!theRequestPartitionId.isAllPartitions()) {
List partitionIds = theRequestPartitionId.getPartitionIds();
partitionIds = replaceDefaultPartitionIdIfNonNull(myPartitionSettings, partitionIds);
if (partitionIds.size() > 1) {
- Predicate partitionIdCriteria =
- from.get("myPartitionIdValue").as(Integer.class).in(partitionIds);
+ Predicate partitionIdCriteria = from.get("myPartitionIdValue").in(partitionIds);
return Optional.of(partitionIdCriteria);
} else if (partitionIds.size() == 1) {
- Predicate partitionIdCriteria =
- cb.equal(from.get("myPartitionIdValue").as(Integer.class), partitionIds.get(0));
+ Predicate partitionIdCriteria = cb.equal(from.get("myPartitionIdValue"), partitionIds.get(0));
return Optional.of(partitionIdCriteria);
}
}
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 c77d2e206ce..24b04c5e508 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
@@ -40,6 +40,9 @@ import ca.uhn.fhir.rest.api.server.storage.TransactionDetails;
import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import com.google.common.annotations.VisibleForTesting;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
@@ -49,9 +52,6 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
@Service
@Lazy
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/mdm/MdmLinkDaoJpaImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/mdm/MdmLinkDaoJpaImpl.java
index 2206f36f829..b915187a6f6 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/mdm/MdmLinkDaoJpaImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/mdm/MdmLinkDaoJpaImpl.java
@@ -38,6 +38,16 @@ import ca.uhn.fhir.mdm.dao.IMdmLinkDao;
import ca.uhn.fhir.mdm.model.MdmPidTuple;
import ca.uhn.fhir.rest.api.SortOrderEnum;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.TypedQuery;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Expression;
+import jakarta.persistence.criteria.Order;
+import jakarta.persistence.criteria.Path;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
+import jakarta.validation.constraints.NotNull;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.ObjectUtils;
@@ -65,16 +75,6 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Expression;
-import javax.persistence.criteria.Order;
-import javax.persistence.criteria.Path;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-import javax.validation.constraints.NotNull;
import static ca.uhn.fhir.mdm.api.params.MdmQuerySearchParameters.GOLDEN_RESOURCE_NAME;
import static ca.uhn.fhir.mdm.api.params.MdmQuerySearchParameters.GOLDEN_RESOURCE_PID_NAME;
@@ -88,10 +88,10 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao {
private static final Logger ourLog = LoggerFactory.getLogger(MdmLinkDaoJpaImpl.class);
@Autowired
- IMdmLinkJpaRepository myMdmLinkDao;
+ protected EntityManager myEntityManager;
@Autowired
- protected EntityManager myEntityManager;
+ IMdmLinkJpaRepository myMdmLinkDao;
@Autowired
private IIdHelperService myIdHelperService;
@@ -247,6 +247,8 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao {
@Override
public Page search(MdmQuerySearchParameters theParams) {
+ Long totalResults = countTotalResults(theParams);
+
CriteriaBuilder criteriaBuilder = myEntityManager.getCriteriaBuilder();
CriteriaQuery criteriaQuery = criteriaBuilder.createQuery(MdmLink.class);
Root from = criteriaQuery.from(MdmLink.class);
@@ -258,14 +260,9 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao {
if (!orderList.isEmpty()) {
criteriaQuery.orderBy(orderList);
}
- TypedQuery typedQuery = myEntityManager.createQuery(criteriaQuery.where(finalQuery));
- CriteriaQuery countQuery = criteriaBuilder.createQuery(Long.class);
- countQuery.select(criteriaBuilder.count(countQuery.from(MdmLink.class))).where(finalQuery);
-
- Long totalResults = myEntityManager.createQuery(countQuery).getSingleResult();
MdmPageRequest pageRequest = theParams.getPageRequest();
-
+ TypedQuery typedQuery = myEntityManager.createQuery(criteriaQuery.where(finalQuery));
List result = typedQuery
.setFirstResult(pageRequest.getOffset())
.setMaxResults(pageRequest.getCount())
@@ -274,13 +271,26 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao {
return new PageImpl<>(result, PageRequest.of(pageRequest.getPage(), pageRequest.getCount()), totalResults);
}
+ private Long countTotalResults(MdmQuerySearchParameters theParams) {
+ CriteriaBuilder criteriaBuilder = myEntityManager.getCriteriaBuilder();
+ CriteriaQuery countQuery = criteriaBuilder.createQuery(Long.class);
+ Root from = countQuery.from(MdmLink.class);
+
+ List andPredicates = buildPredicates(theParams, criteriaBuilder, from);
+ Predicate finalQuery = criteriaBuilder.and(andPredicates.toArray(new Predicate[0]));
+
+ countQuery.select(criteriaBuilder.count(from)).where(finalQuery);
+
+ return myEntityManager.createQuery(countQuery).getSingleResult();
+ }
+
@NotNull
private List buildPredicates(
MdmQuerySearchParameters theParams, CriteriaBuilder criteriaBuilder, Root from) {
List andPredicates = new ArrayList<>();
if (theParams.getGoldenResourceId() != null) {
Predicate goldenResourcePredicate = criteriaBuilder.equal(
- from.get(GOLDEN_RESOURCE_PID_NAME).as(Long.class),
+ from.get(GOLDEN_RESOURCE_PID_NAME),
(myIdHelperService.getPidOrThrowException(
RequestPartitionId.allPartitions(), theParams.getGoldenResourceId()))
.getId());
@@ -288,33 +298,31 @@ public class MdmLinkDaoJpaImpl implements IMdmLinkDao {
}
if (theParams.getSourceId() != null) {
Predicate sourceIdPredicate = criteriaBuilder.equal(
- from.get(SOURCE_PID_NAME).as(Long.class),
+ from.get(SOURCE_PID_NAME),
(myIdHelperService.getPidOrThrowException(
RequestPartitionId.allPartitions(), theParams.getSourceId()))
.getId());
andPredicates.add(sourceIdPredicate);
}
if (theParams.getMatchResult() != null) {
- Predicate matchResultPredicate = criteriaBuilder.equal(
- from.get(MATCH_RESULT_NAME).as(MdmMatchResultEnum.class), theParams.getMatchResult());
+ Predicate matchResultPredicate =
+ criteriaBuilder.equal(from.get(MATCH_RESULT_NAME), theParams.getMatchResult());
andPredicates.add(matchResultPredicate);
}
if (theParams.getLinkSource() != null) {
- Predicate linkSourcePredicate = criteriaBuilder.equal(
- from.get(LINK_SOURCE_NAME).as(MdmLinkSourceEnum.class), theParams.getLinkSource());
+ Predicate linkSourcePredicate =
+ criteriaBuilder.equal(from.get(LINK_SOURCE_NAME), theParams.getLinkSource());
andPredicates.add(linkSourcePredicate);
}
if (!CollectionUtils.isEmpty(theParams.getPartitionIds())) {
- Expression exp =
- from.get(PARTITION_ID_NAME).get(PARTITION_ID_NAME).as(Integer.class);
+ Expression exp = from.get(PARTITION_ID_NAME).get(PARTITION_ID_NAME);
Predicate linkSourcePredicate = exp.in(theParams.getPartitionIds());
andPredicates.add(linkSourcePredicate);
}
if (theParams.getResourceType() != null) {
Predicate resourceTypePredicate = criteriaBuilder.equal(
- from.get(GOLDEN_RESOURCE_NAME).get(RESOURCE_TYPE_NAME).as(String.class),
- theParams.getResourceType());
+ from.get(GOLDEN_RESOURCE_NAME).get(RESOURCE_TYPE_NAME), theParams.getResourceType());
andPredicates.add(resourceTypePredicate);
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/mdm/MdmMetricSvcJpaImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/mdm/MdmMetricSvcJpaImpl.java
index db20645a928..3bc7bd5ecfb 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/mdm/MdmMetricSvcJpaImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/mdm/MdmMetricSvcJpaImpl.java
@@ -29,15 +29,15 @@ import ca.uhn.fhir.mdm.model.MdmLinkMetrics;
import ca.uhn.fhir.mdm.model.MdmLinkScoreMetrics;
import ca.uhn.fhir.mdm.model.MdmMetrics;
import ca.uhn.fhir.mdm.model.MdmResourceMetrics;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.EntityManagerFactory;
+import jakarta.persistence.Query;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Query;
public class MdmMetricSvcJpaImpl extends BaseMdmMetricSvc {
@@ -128,7 +128,7 @@ public class MdmMetricSvcJpaImpl extends BaseMdmMetricSvc {
int length = row.length;
for (int i = 0; i < length; i++) {
// if there's nothing in the db, these values will all be null
- BigInteger bi = row[i] != null ? (BigInteger) row[i] : BigInteger.valueOf(0);
+ Number bi = row[i] != null ? (Number) row[i] : BigInteger.valueOf(0);
double bucket = getBucket(i);
if (i == 0) {
metrics.addScore(NULL_VALUE, bi.longValue());
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4.java
index 74bbcf58162..2ed5f0c2cca 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4.java
@@ -23,13 +23,13 @@ import ca.uhn.fhir.jpa.dao.BaseHapiFhirSystemDao;
import ca.uhn.fhir.jpa.dao.JpaResourceDao;
import ca.uhn.fhir.jpa.model.entity.TagDefinition;
import ca.uhn.fhir.rest.api.server.RequestDetails;
+import jakarta.persistence.TypedQuery;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Meta;
import java.util.Collection;
import java.util.List;
-import javax.persistence.TypedQuery;
public class FhirSystemDaoR4 extends BaseHapiFhirSystemDao {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4b/FhirSystemDaoR4B.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4b/FhirSystemDaoR4B.java
index 8867aa89d13..b950fe13981 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4b/FhirSystemDaoR4B.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4b/FhirSystemDaoR4B.java
@@ -23,13 +23,13 @@ import ca.uhn.fhir.jpa.dao.BaseHapiFhirSystemDao;
import ca.uhn.fhir.jpa.dao.JpaResourceDao;
import ca.uhn.fhir.jpa.model.entity.TagDefinition;
import ca.uhn.fhir.rest.api.server.RequestDetails;
+import jakarta.persistence.TypedQuery;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.r4b.model.Bundle;
import org.hl7.fhir.r4b.model.Meta;
import java.util.Collection;
import java.util.List;
-import javax.persistence.TypedQuery;
public class FhirSystemDaoR4B extends BaseHapiFhirSystemDao {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirSystemDaoR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirSystemDaoR5.java
index 5925f9ee531..b1af9191e57 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirSystemDaoR5.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r5/FhirSystemDaoR5.java
@@ -23,13 +23,13 @@ import ca.uhn.fhir.jpa.dao.BaseHapiFhirSystemDao;
import ca.uhn.fhir.jpa.dao.JpaResourceDao;
import ca.uhn.fhir.jpa.model.entity.TagDefinition;
import ca.uhn.fhir.rest.api.server.RequestDetails;
+import jakarta.persistence.TypedQuery;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.r5.model.Bundle;
import org.hl7.fhir.r5.model.Meta;
import java.util.Collection;
import java.util.List;
-import javax.persistence.TypedQuery;
public class FhirSystemDaoR5 extends BaseHapiFhirSystemDao {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/PathContext.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/PathContext.java
index eb87d87dcfd..f059361e7c6 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/PathContext.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/PathContext.java
@@ -19,6 +19,7 @@
*/
package ca.uhn.fhir.jpa.dao.search;
+import org.hibernate.search.engine.search.predicate.SearchPredicate;
import org.hibernate.search.engine.search.predicate.dsl.*;
import org.hibernate.search.util.common.annotation.Incubating;
@@ -108,80 +109,153 @@ class PathContext implements SearchPredicateFactory {
// implement SearchPredicateFactory
+ @Override
public MatchAllPredicateOptionsStep> matchAll() {
return myPredicateFactory.matchAll();
}
+ @Override
+ public MatchNonePredicateFinalStep matchNone() {
+ return myPredicateFactory.matchNone();
+ }
+
+ @Override
public MatchIdPredicateMatchingStep> id() {
return myPredicateFactory.id();
}
+ @Override
public BooleanPredicateClausesStep> bool() {
return myPredicateFactory.bool();
}
+ @Override
public PredicateFinalStep bool(Consumer super BooleanPredicateClausesStep>> clauseContributor) {
return myPredicateFactory.bool(clauseContributor);
}
+ @Override
+ public SimpleBooleanPredicateClausesStep> and() {
+ return myPredicateFactory.and();
+ }
+
+ @Override
+ public SimpleBooleanPredicateOptionsStep> and(
+ SearchPredicate theSearchPredicate, SearchPredicate... theSearchPredicates) {
+ return myPredicateFactory.and(theSearchPredicate, theSearchPredicates);
+ }
+
+ @Override
+ public SimpleBooleanPredicateOptionsStep> and(
+ PredicateFinalStep thePredicateFinalStep, PredicateFinalStep... thePredicateFinalSteps) {
+ return myPredicateFactory.and(thePredicateFinalStep, thePredicateFinalSteps);
+ }
+
+ @Override
+ public SimpleBooleanPredicateClausesStep> or() {
+ return myPredicateFactory.or();
+ }
+
+ @Override
+ public SimpleBooleanPredicateOptionsStep> or(
+ SearchPredicate theSearchPredicate, SearchPredicate... theSearchPredicates) {
+ return myPredicateFactory.or(theSearchPredicate, theSearchPredicates);
+ }
+
+ @Override
+ public SimpleBooleanPredicateOptionsStep> or(
+ PredicateFinalStep thePredicateFinalStep, PredicateFinalStep... thePredicateFinalSteps) {
+ return myPredicateFactory.or(thePredicateFinalStep, thePredicateFinalSteps);
+ }
+
+ @Override
+ public NotPredicateFinalStep not(SearchPredicate theSearchPredicate) {
+ return myPredicateFactory.not(theSearchPredicate);
+ }
+
+ @Override
+ public NotPredicateFinalStep not(PredicateFinalStep thePredicateFinalStep) {
+ return myPredicateFactory.not(thePredicateFinalStep);
+ }
+
+ @Override
public MatchPredicateFieldStep> match() {
return myPredicateFactory.match();
}
+ @Override
public RangePredicateFieldStep> range() {
return myPredicateFactory.range();
}
+ @Override
public PhrasePredicateFieldStep> phrase() {
return myPredicateFactory.phrase();
}
+ @Override
public WildcardPredicateFieldStep> wildcard() {
return myPredicateFactory.wildcard();
}
+ @Override
public RegexpPredicateFieldStep> regexp() {
return myPredicateFactory.regexp();
}
+ @Override
public TermsPredicateFieldStep> terms() {
return myPredicateFactory.terms();
}
+ @Override
public NestedPredicateFieldStep> nested() {
return myPredicateFactory.nested();
}
+ @Override
+ public NestedPredicateClausesStep> nested(String theObjectFieldPath) {
+ return myPredicateFactory.nested(theObjectFieldPath);
+ }
+
+ @Override
public SimpleQueryStringPredicateFieldStep> simpleQueryString() {
return myPredicateFactory.simpleQueryString();
}
+ @Override
public ExistsPredicateFieldStep> exists() {
return myPredicateFactory.exists();
}
+ @Override
public SpatialPredicateInitialStep spatial() {
return myPredicateFactory.spatial();
}
+ @Override
@Incubating
public NamedPredicateOptionsStep named(String path) {
return myPredicateFactory.named(path);
}
+ @Override
public T extension(SearchPredicateFactoryExtension extension) {
return myPredicateFactory.extension(extension);
}
+ @Override
public SearchPredicateFactoryExtensionIfSupportedStep extension() {
return myPredicateFactory.extension();
}
+ @Override
@Incubating
public SearchPredicateFactory withRoot(String objectFieldPath) {
return myPredicateFactory.withRoot(objectFieldPath);
}
+ @Override
@Incubating
public String toAbsolutePath(String relativeFieldPath) {
return myPredicateFactory.toAbsolutePath(relativeFieldPath);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/DeleteConflictFinderService.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/DeleteConflictFinderService.java
index 1e52953446b..33a1932a48c 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/DeleteConflictFinderService.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/DeleteConflictFinderService.java
@@ -21,13 +21,13 @@ package ca.uhn.fhir.jpa.delete;
import ca.uhn.fhir.jpa.model.entity.ResourceLink;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
+import jakarta.persistence.TypedQuery;
import org.springframework.stereotype.Service;
import java.util.List;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import javax.persistence.TypedQuery;
@Service
public class DeleteConflictFinderService {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/batch2/DeleteExpungeSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/batch2/DeleteExpungeSvcImpl.java
index 9e7e7ff4474..9aee0268557 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/batch2/DeleteExpungeSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/batch2/DeleteExpungeSvcImpl.java
@@ -23,13 +23,13 @@ import ca.uhn.fhir.jpa.api.svc.IDeleteExpungeSvc;
import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc;
import ca.uhn.fhir.jpa.model.dao.JpaPid;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
+import jakarta.persistence.EntityManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.stream.Collectors;
-import javax.persistence.EntityManager;
public class DeleteExpungeSvcImpl implements IDeleteExpungeSvc {
private static final Logger ourLog = LoggerFactory.getLogger(DeleteExpungeSvcImpl.class);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Batch2JobInstanceEntity.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Batch2JobInstanceEntity.java
index dd9205a8f30..311f201d141 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Batch2JobInstanceEntity.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Batch2JobInstanceEntity.java
@@ -21,24 +21,24 @@ package ca.uhn.fhir.jpa.entity;
import ca.uhn.fhir.batch2.model.JobDefinition;
import ca.uhn.fhir.batch2.model.StatusEnum;
+import jakarta.persistence.Basic;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.Lob;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.Version;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.io.Serializable;
import java.util.Date;
-import javax.persistence.Basic;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.Lob;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Version;
import static ca.uhn.fhir.batch2.model.JobDefinition.ID_MAX_LENGTH;
import static ca.uhn.fhir.jpa.entity.Batch2WorkChunkEntity.ERROR_MSG_MAX_LENGTH;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Batch2WorkChunkEntity.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Batch2WorkChunkEntity.java
index e65c8814faa..159be9b503f 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Batch2WorkChunkEntity.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Batch2WorkChunkEntity.java
@@ -20,27 +20,27 @@
package ca.uhn.fhir.jpa.entity;
import ca.uhn.fhir.batch2.model.WorkChunkStatusEnum;
+import jakarta.persistence.Basic;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.Lob;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.Version;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.io.Serializable;
import java.util.Date;
-import javax.persistence.Basic;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
-import javax.persistence.ForeignKey;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.Lob;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Version;
import static ca.uhn.fhir.batch2.model.JobDefinition.ID_MAX_LENGTH;
import static ca.uhn.fhir.jpa.entity.Batch2JobInstanceEntity.STATUS_MAX_LENGTH;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkExportCollectionEntity.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkExportCollectionEntity.java
index 7903eab9004..f564688c247 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkExportCollectionEntity.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkExportCollectionEntity.java
@@ -20,23 +20,23 @@
package ca.uhn.fhir.jpa.entity;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Version;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Version;
/*
* These classes are no longer needed.
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkExportCollectionFileEntity.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkExportCollectionFileEntity.java
index 96ee1f1f8cc..0dcf6851d52 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkExportCollectionFileEntity.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkExportCollectionFileEntity.java
@@ -20,19 +20,19 @@
package ca.uhn.fhir.jpa.entity;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import java.io.Serializable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
/*
* These classes are no longer needed.
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkExportJobEntity.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkExportJobEntity.java
index a9bf341724a..8d70aeecbcd 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkExportJobEntity.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkExportJobEntity.java
@@ -19,6 +19,20 @@
*/
package ca.uhn.fhir.jpa.entity;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hl7.fhir.r5.model.InstantType;
@@ -27,20 +41,6 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.OneToMany;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.UniqueConstraint;
-import javax.persistence.Version;
import static ca.uhn.fhir.rest.api.Constants.UUID_LENGTH;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkImportJobEntity.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkImportJobEntity.java
index f3151ea2ba4..7fff537777f 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkImportJobEntity.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkImportJobEntity.java
@@ -22,22 +22,22 @@ package ca.uhn.fhir.jpa.entity;
import ca.uhn.fhir.jpa.bulk.imprt.model.BulkImportJobJson;
import ca.uhn.fhir.jpa.bulk.imprt.model.BulkImportJobStatusEnum;
import ca.uhn.fhir.jpa.bulk.imprt.model.JobFileRowProcessingModeEnum;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
import java.io.Serializable;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.UniqueConstraint;
-import javax.persistence.Version;
import static ca.uhn.fhir.rest.api.Constants.UUID_LENGTH;
import static org.apache.commons.lang3.StringUtils.left;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkImportJobFileEntity.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkImportJobFileEntity.java
index 11a2998989f..00ee7169465 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkImportJobFileEntity.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BulkImportJobFileEntity.java
@@ -20,21 +20,21 @@
package ca.uhn.fhir.jpa.entity;
import ca.uhn.fhir.jpa.bulk.imprt.model.BulkImportJobFileJson;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.Lob;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import java.io.Serializable;
import java.nio.charset.StandardCharsets;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.Lob;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
import static org.apache.commons.lang3.StringUtils.left;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/HapiFhirEnversRevision.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/HapiFhirEnversRevision.java
index 9daa452e844..03417a1c66a 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/HapiFhirEnversRevision.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/HapiFhirEnversRevision.java
@@ -19,6 +19,13 @@
*/
package ca.uhn.fhir.jpa.entity;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.hibernate.envers.RevisionEntity;
import org.hibernate.envers.RevisionNumber;
@@ -26,13 +33,6 @@ import org.hibernate.envers.RevisionTimestamp;
import java.io.Serializable;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
/**
* This class exists strictly to override the default names used to generate Hibernate Envers revision table.
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/MdmLink.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/MdmLink.java
index 4363bde74c5..3294240982c 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/MdmLink.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/MdmLink.java
@@ -26,29 +26,31 @@ import ca.uhn.fhir.mdm.api.IMdmLink;
import ca.uhn.fhir.mdm.api.MdmLinkSourceEnum;
import ca.uhn.fhir.mdm.api.MdmMatchResultEnum;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.UniqueConstraint;
import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.envers.AuditTable;
import org.hibernate.envers.Audited;
import org.hibernate.envers.NotAudited;
+import org.hibernate.type.SqlTypes;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.UniqueConstraint;
@Entity
@Table(
@@ -139,10 +141,12 @@ public class MdmLink extends AuditableBasePartitionable implements IMdmLink {
}
protected void init700() {
+ /* ************************************************
+ * Start of 6.10 migrations
+ *********************************************** */
+
Builder version = forVersion(VersionEnum.V7_0_0);
// new indices on MdmLink
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/JpaPackageCache.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/JpaPackageCache.java
index 67af3c9a49d..8f8b0e4fe89 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/JpaPackageCache.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/JpaPackageCache.java
@@ -50,6 +50,15 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.util.BinaryUtil;
import ca.uhn.fhir.util.ResourceUtil;
import ca.uhn.fhir.util.StringUtil;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.TypedQuery;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Join;
+import jakarta.persistence.criteria.JoinType;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
import org.apache.commons.collections4.comparators.ReverseComparator;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.exceptions.FHIRException;
@@ -85,15 +94,6 @@ import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.JoinType;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
import static ca.uhn.fhir.jpa.util.QueryParameterUtils.toPredicateArray;
import static ca.uhn.fhir.util.StringUtil.toUtf8String;
@@ -788,25 +788,23 @@ public class JpaPackageCache extends BasePackageCacheManager implements IHapiPac
Join resources =
theRoot.join("myResources", JoinType.LEFT);
- predicates.add(theCb.equal(
- resources.get("myCanonicalUrl").as(String.class), thePackageSearchSpec.getResourceUrl()));
+ predicates.add(theCb.equal(resources.get("myCanonicalUrl"), thePackageSearchSpec.getResourceUrl()));
}
if (isNotBlank(thePackageSearchSpec.getDescription())) {
String searchTerm = "%" + thePackageSearchSpec.getDescription() + "%";
searchTerm = StringUtil.normalizeStringForSearchIndexing(searchTerm);
- predicates.add(theCb.like(theRoot.get("myDescriptionUpper").as(String.class), searchTerm));
+ predicates.add(theCb.like(theRoot.get("myDescriptionUpper"), searchTerm));
}
if (isNotBlank(thePackageSearchSpec.getFhirVersion())) {
if (!thePackageSearchSpec.getFhirVersion().matches("([0-9]+\\.)+[0-9]+")) {
FhirVersionEnum versionEnum = FhirVersionEnum.forVersionString(thePackageSearchSpec.getFhirVersion());
if (versionEnum != null) {
- predicates.add(theCb.equal(theRoot.get("myFhirVersion").as(FhirVersionEnum.class), versionEnum));
+ predicates.add(theCb.equal(theRoot.get("myFhirVersion").as(String.class), versionEnum.name()));
}
} else {
- predicates.add(theCb.like(
- theRoot.get("myFhirVersionId").as(String.class), thePackageSearchSpec.getFhirVersion() + "%"));
+ predicates.add(theCb.like(theRoot.get("myFhirVersionId"), thePackageSearchSpec.getFhirVersion() + "%"));
}
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/PackageInstallerSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/PackageInstallerSvcImpl.java
index 6b09789cca6..b38552017dd 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/PackageInstallerSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/PackageInstallerSvcImpl.java
@@ -50,6 +50,7 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException;
import ca.uhn.fhir.util.FhirTerser;
import ca.uhn.fhir.util.SearchParameterUtil;
import com.google.common.annotations.VisibleForTesting;
+import jakarta.annotation.PostConstruct;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseResource;
@@ -69,7 +70,6 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
-import javax.annotation.PostConstruct;
import static ca.uhn.fhir.jpa.packages.util.PackageUtils.DEFAULT_INSTALL_TYPES;
import static ca.uhn.fhir.util.SearchParameterUtil.getBaseAsStrings;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/partition/PartitionLookupSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/partition/PartitionLookupSvcImpl.java
index 60c04157046..655af28fcbc 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/partition/PartitionLookupSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/partition/PartitionLookupSvcImpl.java
@@ -36,6 +36,7 @@ import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.util.ICallable;
+import jakarta.annotation.PostConstruct;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,7 +51,6 @@ import java.util.concurrent.ThreadLocalRandom;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
-import javax.annotation.PostConstruct;
import static org.apache.commons.lang3.StringUtils.isBlank;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderCodeSystem.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderCodeSystem.java
index 85b88f5f0bc..671649edb29 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderCodeSystem.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderCodeSystem.java
@@ -32,6 +32,7 @@ import ca.uhn.fhir.rest.annotation.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
+import jakarta.servlet.http.HttpServletRequest;
import org.hl7.fhir.instance.model.api.IBaseCoding;
import org.hl7.fhir.instance.model.api.IBaseDatatype;
import org.hl7.fhir.instance.model.api.IBaseParameters;
@@ -43,7 +44,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Optional;
import java.util.function.Supplier;
-import javax.servlet.http.HttpServletRequest;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderComposition.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderComposition.java
index 42eb7b187ce..7e733249f96 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderComposition.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderComposition.java
@@ -44,7 +44,7 @@ public abstract class BaseJpaResourceProviderComposition
*/
@Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType = BundleTypeEnum.SEARCHSET)
public IBundleProvider EncounterInstanceEverything(
- javax.servlet.http.HttpServletRequest theServletRequest,
+ jakarta.servlet.http.HttpServletRequest theServletRequest,
@IdParam IIdType theId,
@Description(
formalDefinition =
@@ -76,7 +76,7 @@ public abstract class BaseJpaResourceProviderEncounter
*/
@Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType = BundleTypeEnum.SEARCHSET)
public IBundleProvider EncounterTypeEverything(
- javax.servlet.http.HttpServletRequest theServletRequest,
+ jakarta.servlet.http.HttpServletRequest theServletRequest,
@Description(
formalDefinition =
"Results from this method are returned across multiple pages. This parameter controls the size of those pages.")
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderEncounterDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderEncounterDstu2.java
index ef78d56c9e3..92d43b2ce75 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderEncounterDstu2.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderEncounterDstu2.java
@@ -40,7 +40,7 @@ public abstract class BaseJpaResourceProviderEncounterDstu2 extends BaseJpaResou
*/
@Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType = BundleTypeEnum.SEARCHSET)
public IBundleProvider EncounterInstanceEverything(
- javax.servlet.http.HttpServletRequest theServletRequest,
+ jakarta.servlet.http.HttpServletRequest theServletRequest,
@IdParam ca.uhn.fhir.model.primitive.IdDt theId,
@Description(
formalDefinition =
@@ -74,7 +74,7 @@ public abstract class BaseJpaResourceProviderEncounterDstu2 extends BaseJpaResou
*/
@Operation(name = JpaConstants.OPERATION_EVERYTHING, idempotent = true, bundleType = BundleTypeEnum.SEARCHSET)
public IBundleProvider EncounterTypeEverything(
- javax.servlet.http.HttpServletRequest theServletRequest,
+ jakarta.servlet.http.HttpServletRequest theServletRequest,
@Description(
formalDefinition =
"Results from this method are returned across multiple pages. This parameter controls the size of those pages.")
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderObservation.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderObservation.java
index da112acefe2..f74a8e684d1 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderObservation.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaResourceProviderObservation.java
@@ -45,8 +45,8 @@ public abstract class BaseJpaResourceProviderObservation ex
idempotent = true,
bundleType = BundleTypeEnum.SEARCHSET)
public IBundleProvider patientInstanceEverything(
- javax.servlet.http.HttpServletRequest theServletRequest,
+ jakarta.servlet.http.HttpServletRequest theServletRequest,
@IdParam IIdType theId,
@Description(
shortDefinition =
@@ -143,7 +143,7 @@ public abstract class BaseJpaResourceProviderPatient ex
idempotent = true,
bundleType = BundleTypeEnum.SEARCHSET)
public IBundleProvider patientTypeEverything(
- javax.servlet.http.HttpServletRequest theServletRequest,
+ jakarta.servlet.http.HttpServletRequest theServletRequest,
@Description(
shortDefinition =
"Results from this method are returned across multiple pages. This parameter controls the size of those pages.")
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaSystemProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaSystemProvider.java
index 4e5b15d8eab..d264abdca15 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaSystemProvider.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/BaseJpaSystemProvider.java
@@ -35,6 +35,7 @@ import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
import ca.uhn.fhir.util.ParametersUtil;
import ca.uhn.fhir.util.StopWatch;
+import jakarta.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.hl7.fhir.instance.model.api.IBaseParameters;
import org.slf4j.Logger;
@@ -42,7 +43,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Date;
-import javax.servlet.http.HttpServletRequest;
public abstract class BaseJpaSystemProvider extends BaseStorageSystemProvider
implements IJpaSystemProvider {
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 dd06075d423..5cf700a423b 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
@@ -44,12 +44,12 @@ import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.provider.dstu2.ServerConformanceProvider;
import ca.uhn.fhir.util.CoverageIgnore;
import ca.uhn.fhir.util.ExtensionConstants;
+import jakarta.servlet.http.HttpServletRequest;
import org.hl7.fhir.dstu2.model.Subscription;
import java.util.Collections;
import java.util.List;
import java.util.Map;
-import javax.servlet.http.HttpServletRequest;
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/ProcessMessageProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/ProcessMessageProvider.java
index 803254ea8bb..695544c4555 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/ProcessMessageProvider.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/ProcessMessageProvider.java
@@ -25,11 +25,10 @@ import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.rest.annotation.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam;
import ca.uhn.fhir.rest.api.server.RequestDetails;
+import jakarta.servlet.http.HttpServletRequest;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.springframework.beans.factory.annotation.Autowired;
-import javax.servlet.http.HttpServletRequest;
-
import static ca.uhn.fhir.jpa.provider.BaseJpaProvider.endRequest;
import static ca.uhn.fhir.jpa.provider.BaseJpaProvider.startRequest;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/TerminologyUploaderProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/TerminologyUploaderProvider.java
index 85928273a71..88dc83093ec 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/TerminologyUploaderProvider.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/TerminologyUploaderProvider.java
@@ -40,6 +40,7 @@ import ca.uhn.fhir.util.ValidateUtil;
import com.google.common.base.Charsets;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
+import jakarta.servlet.http.HttpServletRequest;
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_40;
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
@@ -60,7 +61,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nonnull;
-import javax.servlet.http.HttpServletRequest;
import static org.apache.commons.lang3.StringUtils.*;
@@ -446,6 +446,10 @@ public class TerminologyUploaderProvider extends BaseJpaProvider {
return retVal;
}
+ public void setTerminologyLoaderSvc(ITermLoaderSvc theTermLoaderSvc) {
+ myTerminologyLoaderSvc = theTermLoaderSvc;
+ }
+
public static class FileBackedFileDescriptor implements ITermLoaderSvc.FileDescriptor {
private final File myNextFile;
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 2bb327cf9c7..ba41fc11e68 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
@@ -39,6 +39,7 @@ 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 jakarta.servlet.http.HttpServletRequest;
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;
@@ -53,7 +54,6 @@ import org.springframework.beans.factory.annotation.Qualifier;
import java.util.Optional;
import java.util.function.Supplier;
-import javax.servlet.http.HttpServletRequest;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/ValueSetOperationProviderDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/ValueSetOperationProviderDstu2.java
index 0480f0290d2..5659c8129c4 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/ValueSetOperationProviderDstu2.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/ValueSetOperationProviderDstu2.java
@@ -27,6 +27,7 @@ import ca.uhn.fhir.rest.annotation.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.util.FhirTerser;
+import jakarta.servlet.http.HttpServletRequest;
import org.hl7.fhir.instance.model.api.IBaseCoding;
import org.hl7.fhir.instance.model.api.IBaseParameters;
import org.hl7.fhir.instance.model.api.IBaseResource;
@@ -35,7 +36,6 @@ import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
-import javax.servlet.http.HttpServletRequest;
import static ca.uhn.fhir.jpa.provider.BaseJpaResourceProviderCodeSystem.applyVersionToSystem;
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 2d971de810c..35a78056874 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
@@ -31,6 +31,7 @@ import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import ca.uhn.fhir.util.CoverageIgnore;
import ca.uhn.fhir.util.ExtensionConstants;
+import jakarta.servlet.http.HttpServletRequest;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.CapabilityStatement;
import org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent;
@@ -49,7 +50,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
-import javax.servlet.http.HttpServletRequest;
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
import static org.apache.commons.lang3.StringUtils.isBlank;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatchR4ResourceProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatchR4ResourceProvider.java
index 4d09f9fed84..6ad2956d88d 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatchR4ResourceProvider.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/MemberMatchR4ResourceProvider.java
@@ -58,7 +58,7 @@ public class MemberMatchR4ResourceProvider {
idempotent = false,
returnParameters = {@OperationParam(name = "MemberIdentifier", typeName = "string")})
public Parameters patientMemberMatch(
- javax.servlet.http.HttpServletRequest theServletRequest,
+ jakarta.servlet.http.HttpServletRequest theServletRequest,
@Description(shortDefinition = "The target of the operation. Contain member Patient demographics.")
@OperationParam(name = Constants.PARAM_MEMBER_PATIENT, min = 1, max = 1)
Patient theMemberPatient,
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/HapiHSearchAnalysisConfigurers.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/HapiHSearchAnalysisConfigurers.java
index a280d7e8293..b17cff10ace 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/HapiHSearchAnalysisConfigurers.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/HapiHSearchAnalysisConfigurers.java
@@ -60,68 +60,68 @@ public class HapiHSearchAnalysisConfigurers {
theLuceneCtx
.analyzer("autocompleteEdgeAnalyzer")
.custom()
- .tokenizer(PatternTokenizerFactory.class)
- .param("pattern", "(.*)")
- .param("group", "1")
- .tokenFilter(LowerCaseFilterFactory.class)
- .tokenFilter(StopFilterFactory.class)
- .tokenFilter(EdgeNGramFilterFactory.class)
+ .tokenizer(PatternTokenizerFactory.NAME)
+ .param(PatternTokenizerFactory.PATTERN, "(.*)")
+ .param(PatternTokenizerFactory.GROUP, "1")
+ .tokenFilter(LowerCaseFilterFactory.NAME)
+ .tokenFilter(StopFilterFactory.NAME)
+ .tokenFilter(EdgeNGramFilterFactory.NAME)
.param("minGramSize", "3")
.param("maxGramSize", "50");
theLuceneCtx
.analyzer("autocompletePhoneticAnalyzer")
.custom()
- .tokenizer(StandardTokenizerFactory.class)
- .tokenFilter(StopFilterFactory.class)
- .tokenFilter(PhoneticFilterFactory.class)
- .param("encoder", "DoubleMetaphone")
- .tokenFilter(SnowballPorterFilterFactory.class)
+ .tokenizer(StandardTokenizerFactory.NAME)
+ .tokenFilter(StopFilterFactory.NAME)
+ .tokenFilter(PhoneticFilterFactory.NAME)
+ .param(PhoneticFilterFactory.ENCODER, "DoubleMetaphone")
+ .tokenFilter(SnowballPorterFilterFactory.NAME)
.param("language", "English");
theLuceneCtx
.analyzer("autocompleteNGramAnalyzer")
.custom()
- .tokenizer(StandardTokenizerFactory.class)
- .tokenFilter(WordDelimiterGraphFilterFactory.class)
- .tokenFilter(LowerCaseFilterFactory.class)
- .tokenFilter(NGramFilterFactory.class)
+ .tokenizer(StandardTokenizerFactory.NAME)
+ .tokenFilter(WordDelimiterGraphFilterFactory.NAME)
+ .tokenFilter(LowerCaseFilterFactory.NAME)
+ .tokenFilter(NGramFilterFactory.NAME)
.param("minGramSize", "3")
.param("maxGramSize", "20");
theLuceneCtx
.analyzer("autocompleteWordEdgeAnalyzer")
.custom()
- .tokenizer(StandardTokenizerFactory.class)
- .tokenFilter(LowerCaseFilterFactory.class)
- .tokenFilter(StopFilterFactory.class)
- .tokenFilter(EdgeNGramFilterFactory.class)
+ .tokenizer(StandardTokenizerFactory.NAME)
+ .tokenFilter(LowerCaseFilterFactory.NAME)
+ .tokenFilter(StopFilterFactory.NAME)
+ .tokenFilter(EdgeNGramFilterFactory.NAME)
.param("minGramSize", "3")
.param("maxGramSize", "20");
theLuceneCtx
.analyzer(STANDARD_ANALYZER)
.custom()
- .tokenizer(StandardTokenizerFactory.class)
- .tokenFilter(LowerCaseFilterFactory.class)
- .tokenFilter(ASCIIFoldingFilterFactory.class);
+ .tokenizer(StandardTokenizerFactory.NAME)
+ .tokenFilter(LowerCaseFilterFactory.NAME)
+ .tokenFilter(ASCIIFoldingFilterFactory.NAME);
theLuceneCtx
.analyzer(NORM_STRING_ANALYZER)
.custom()
- .tokenizer(KeywordTokenizerFactory.class)
- .tokenFilter(LowerCaseFilterFactory.class)
- .tokenFilter(ASCIIFoldingFilterFactory.class);
+ .tokenizer(KeywordTokenizerFactory.NAME)
+ .tokenFilter(LowerCaseFilterFactory.NAME)
+ .tokenFilter(ASCIIFoldingFilterFactory.NAME);
- theLuceneCtx.analyzer(EXACT_ANALYZER).custom().tokenizer(KeywordTokenizerFactory.class);
+ theLuceneCtx.analyzer(EXACT_ANALYZER).custom().tokenizer(KeywordTokenizerFactory.NAME);
- theLuceneCtx.analyzer("conceptParentPidsAnalyzer").custom().tokenizer(WhitespaceTokenizerFactory.class);
+ theLuceneCtx.analyzer("conceptParentPidsAnalyzer").custom().tokenizer(WhitespaceTokenizerFactory.NAME);
theLuceneCtx
.normalizer(LOWERCASE_ASCIIFOLDING_NORMALIZER)
.custom()
- .tokenFilter(LowerCaseFilterFactory.class)
- .tokenFilter(ASCIIFoldingFilterFactory.class);
+ .tokenFilter(LowerCaseFilterFactory.NAME)
+ .tokenFilter(ASCIIFoldingFilterFactory.NAME);
}
}
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 51a994e7afa..b25435b6751 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
@@ -58,6 +58,8 @@ import ca.uhn.fhir.rest.server.method.ResponsePage;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.rest.server.util.CompositeInterceptorBroadcaster;
import com.google.common.annotations.VisibleForTesting;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -70,8 +72,6 @@ import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import javax.annotation.Nonnull;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
public class PersistedJpaBundleProvider implements IBundleProvider {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/ResourceSearchUrlSvc.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/ResourceSearchUrlSvc.java
index ee380067c7e..47512f96648 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/ResourceSearchUrlSvc.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/ResourceSearchUrlSvc.java
@@ -26,13 +26,13 @@ import ca.uhn.fhir.jpa.model.dao.JpaPid;
import ca.uhn.fhir.jpa.model.entity.ResourceSearchUrlEntity;
import ca.uhn.fhir.jpa.searchparam.MatchUrlService;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
+import jakarta.persistence.EntityManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
-import javax.persistence.EntityManager;
/**
* This service ensures uniqueness of resources during create or create-on-update by storing the resource searchUrl.
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 89f77e51b14..8d2a9367820 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
@@ -47,6 +47,7 @@ import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.interceptor.ServerInterceptorUtil;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.rest.server.util.CompositeInterceptorBroadcaster;
+import jakarta.persistence.EntityManager;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.springframework.beans.factory.annotation.Autowired;
@@ -55,7 +56,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
-import javax.persistence.EntityManager;
import static ca.uhn.fhir.jpa.util.SearchParameterMapCalculator.isWantCount;
import static ca.uhn.fhir.jpa.util.SearchParameterMapCalculator.isWantOnlyCount;
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 88f5f75a87e..bc40f4c3c19 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
@@ -95,6 +95,13 @@ import ca.uhn.fhir.util.StringUtil;
import ca.uhn.fhir.util.UrlUtil;
import com.google.common.collect.Streams;
import com.healthmarketscience.sqlbuilder.Condition;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
+import jakarta.persistence.Query;
+import jakarta.persistence.Tuple;
+import jakarta.persistence.TypedQuery;
+import jakarta.persistence.criteria.CriteriaBuilder;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.math.NumberUtils;
@@ -121,13 +128,6 @@ import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import javax.persistence.Query;
-import javax.persistence.Tuple;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaBuilder;
import static ca.uhn.fhir.jpa.model.util.JpaConstants.UNDESIRED_RESOURCE_LINKAGES_FOR_EVERYTHING_ON_PATIENT_INSTANCE;
import static ca.uhn.fhir.jpa.search.builder.QueryStack.LOCATION_POSITION;
@@ -495,15 +495,8 @@ public class SearchBuilder implements ISearchBuilder {
myRequestPartitionId, myResourceName, String.valueOf(lastNResourceId)))
.collect(Collectors.toList());
} else {
- if (myIElasticsearchSvc == null) {
- throw new InvalidRequestException(Msg.code(2033)
- + "LastN operation is not enabled on this service, can not process this request");
- }
- // use the dedicated observation ES/Lucene index to support lastN query
- return myIElasticsearchSvc.executeLastN(myParams, myContext, theMaximumResults).stream()
- .map(lastnResourceId -> myIdHelperService.resolveResourcePersistentIds(
- myRequestPartitionId, myResourceName, lastnResourceId))
- .collect(Collectors.toList());
+ throw new InvalidRequestException(
+ Msg.code(2033) + "LastN operation is not enabled on this service, can not process this request");
}
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BaseQuantityPredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BaseQuantityPredicateBuilder.java
index 78b7f115ab6..4f427431418 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BaseQuantityPredicateBuilder.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BaseQuantityPredicateBuilder.java
@@ -33,10 +33,10 @@ import com.healthmarketscience.sqlbuilder.ComboCondition;
import com.healthmarketscience.sqlbuilder.Condition;
import com.healthmarketscience.sqlbuilder.dbspec.basic.DbColumn;
import com.healthmarketscience.sqlbuilder.dbspec.basic.DbTable;
+import jakarta.persistence.criteria.CriteriaBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import java.math.BigDecimal;
-import javax.persistence.criteria.CriteriaBuilder;
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
import static org.apache.commons.lang3.StringUtils.isBlank;
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 e840bdec9d3..3a310e5c4d7 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
@@ -64,7 +64,9 @@ import com.healthmarketscience.sqlbuilder.dbspec.basic.DbTable;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.dialect.pagination.AbstractLimitHandler;
-import org.hibernate.engine.spi.RowSelection;
+import org.hibernate.query.internal.QueryOptionsImpl;
+import org.hibernate.query.spi.Limit;
+import org.hibernate.query.spi.QueryOptions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -501,10 +503,11 @@ public class SearchQueryBuilder {
maxResultsToFetch = defaultIfNull(maxResultsToFetch, 10000);
AbstractLimitHandler limitHandler = (AbstractLimitHandler) myDialect.getLimitHandler();
- RowSelection selection = new RowSelection();
+ Limit selection = new Limit();
selection.setFirstRow(offset);
selection.setMaxRows(maxResultsToFetch);
- sql = limitHandler.processSql(sql, selection);
+ QueryOptions queryOptions = new QueryOptionsImpl();
+ sql = limitHandler.processSql(sql, selection, queryOptions);
int startOfQueryParameterIndex = 0;
@@ -517,14 +520,14 @@ public class SearchQueryBuilder {
if (sql.contains("top(?)")) {
bindVariables.add(0, maxResultsToFetch);
}
- if (sql.contains("offset 0 rows fetch next ? rows only")) {
+ if (sql.contains("offset 0 rows fetch first ? rows only")) {
bindVariables.add(maxResultsToFetch);
}
if (sql.contains("offset ? rows fetch next ? rows only")) {
bindVariables.add(theOffset);
bindVariables.add(maxResultsToFetch);
}
- if (offset != null && sql.contains("__row__")) {
+ if (offset != null && sql.contains("rownumber_")) {
bindVariables.add(theOffset + 1);
bindVariables.add(theOffset + maxResultsToFetch + 1);
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryExecutor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryExecutor.java
index 8f8d4600ee5..d1edddeda4f 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryExecutor.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryExecutor.java
@@ -25,6 +25,11 @@ import ca.uhn.fhir.jpa.search.builder.ISearchQueryExecutor;
import ca.uhn.fhir.jpa.util.ScrollableResultsIterator;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.util.IoUtil;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.FlushModeType;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
+import jakarta.persistence.Query;
import org.apache.commons.lang3.Validate;
import org.hibernate.CacheMode;
import org.hibernate.ScrollMode;
@@ -33,11 +38,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
-import javax.persistence.EntityManager;
-import javax.persistence.FlushModeType;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import javax.persistence.Query;
+import java.util.Objects;
public class SearchQueryExecutor implements ISearchQueryExecutor {
@@ -51,7 +52,7 @@ public class SearchQueryExecutor implements ISearchQueryExecutor {
private EntityManager myEntityManager;
private boolean myQueryInitialized;
- private ScrollableResultsIterator myResultSet;
+ private ScrollableResultsIterator myResultSet;
private Long myNext;
/**
@@ -144,7 +145,13 @@ public class SearchQueryExecutor implements ISearchQueryExecutor {
if (myResultSet == null || !myResultSet.hasNext()) {
myNext = NO_MORE;
} else {
- Number next = myResultSet.next();
+ Object nextRow = Objects.requireNonNull(myResultSet.next());
+ Number next;
+ if (nextRow instanceof Number) {
+ next = (Number) nextRow;
+ } else {
+ next = (Number) ((Object[]) nextRow)[0];
+ }
myNext = next.longValue();
}
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 9396f7d9542..700d409e216 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
@@ -57,7 +57,6 @@ import co.elastic.apm.api.Transaction;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.hl7.fhir.instance.model.api.IBaseResource;
-import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import java.io.IOException;
@@ -447,7 +446,6 @@ public class SearchTask implements Callable {
myTxService
.withRequest(myRequest)
.withRequestPartitionId(myRequestPartitionId)
- .withIsolation(Isolation.READ_COMMITTED)
.execute(() -> doSearch());
mySearchRuntimeDetails.setSearchStatus(mySearch.getStatus());
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 0f666f60505..1e886ca9c1b 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
@@ -33,6 +33,7 @@ import ca.uhn.fhir.jpa.entity.Search;
import ca.uhn.fhir.jpa.model.search.SearchStatusEnum;
import ca.uhn.fhir.system.HapiSystemProperties;
import com.google.common.annotations.VisibleForTesting;
+import jakarta.persistence.EntityManager;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.time.DateUtils;
import org.hibernate.Session;
@@ -53,7 +54,6 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Stream;
import javax.annotation.Nonnull;
-import javax.persistence.EntityManager;
public class DatabaseSearchCacheSvcImpl implements ISearchCacheSvc {
/*
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/ElasticsearchRestClientFactory.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/ElasticsearchRestClientFactory.java
index a5c8481b8a5..564d39bf804 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/ElasticsearchRestClientFactory.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/ElasticsearchRestClientFactory.java
@@ -21,6 +21,10 @@ package ca.uhn.fhir.jpa.search.lastn;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.i18n.Msg;
+import co.elastic.clients.elasticsearch.ElasticsearchClient;
+import co.elastic.clients.json.jackson.JacksonJsonpMapper;
+import co.elastic.clients.transport.ElasticsearchTransport;
+import co.elastic.clients.transport.rest_client.RestClientTransport;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.Header;
import org.apache.http.HttpHost;
@@ -32,7 +36,6 @@ import org.apache.http.message.BasicHeader;
import org.elasticsearch.client.Node;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
-import org.elasticsearch.client.RestHighLevelClient;
import java.util.Arrays;
import java.util.List;
@@ -41,7 +44,7 @@ import javax.annotation.Nullable;
public class ElasticsearchRestClientFactory {
- public static RestHighLevelClient createElasticsearchHighLevelRestClient(
+ public static ElasticsearchClient createElasticsearchHighLevelRestClient(
String protocol, String hosts, @Nullable String theUsername, @Nullable String thePassword) {
if (hosts.contains("://")) {
@@ -78,6 +81,12 @@ public class ElasticsearchRestClientFactory {
Header[] defaultHeaders = new Header[] {new BasicHeader("Content-Type", "application/json")};
clientBuilder.setDefaultHeaders(defaultHeaders);
- return new RestHighLevelClient(clientBuilder);
+ RestClient restClient = clientBuilder.build();
+
+ // Create the transport with a Jackson mapper
+ ElasticsearchTransport transport = new RestClientTransport(restClient, new JacksonJsonpMapper());
+
+ // And create the API client
+ return new ElasticsearchClient(transport);
}
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/ElasticsearchSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/ElasticsearchSvcImpl.java
index 1479b017cd8..f9d344277d4 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/ElasticsearchSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/ElasticsearchSvcImpl.java
@@ -23,108 +23,41 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.jpa.dao.TolerantJsonParser;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
-import ca.uhn.fhir.jpa.model.util.CodeSystemHash;
-import ca.uhn.fhir.jpa.search.lastn.json.CodeJson;
import ca.uhn.fhir.jpa.search.lastn.json.ObservationJson;
-import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
-import ca.uhn.fhir.jpa.searchparam.util.LastNParameterHelper;
-import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.parser.IParser;
import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId;
-import ca.uhn.fhir.rest.param.DateParam;
-import ca.uhn.fhir.rest.param.ParamPrefixEnum;
-import ca.uhn.fhir.rest.param.ReferenceParam;
-import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import co.elastic.clients.elasticsearch.ElasticsearchClient;
+import co.elastic.clients.elasticsearch._types.FieldValue;
+import co.elastic.clients.elasticsearch.core.SearchRequest;
+import co.elastic.clients.elasticsearch.core.SearchResponse;
+import co.elastic.clients.elasticsearch.core.search.Hit;
+import co.elastic.clients.elasticsearch.indices.ExistsRequest;
import com.google.common.annotations.VisibleForTesting;
-import org.apache.commons.lang3.Validate;
-import org.elasticsearch.action.DocWriteResponse;
-import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
-import org.elasticsearch.action.index.IndexRequest;
-import org.elasticsearch.action.index.IndexResponse;
-import org.elasticsearch.action.search.SearchRequest;
-import org.elasticsearch.action.search.SearchResponse;
-import org.elasticsearch.client.RequestOptions;
-import org.elasticsearch.client.RestHighLevelClient;
-import org.elasticsearch.client.indices.CreateIndexRequest;
-import org.elasticsearch.client.indices.CreateIndexResponse;
-import org.elasticsearch.client.indices.GetIndexRequest;
-import org.elasticsearch.index.query.BoolQueryBuilder;
-import org.elasticsearch.index.query.MatchQueryBuilder;
-import org.elasticsearch.index.query.QueryBuilders;
-import org.elasticsearch.index.query.RangeQueryBuilder;
-import org.elasticsearch.index.reindex.DeleteByQueryRequest;
-import org.elasticsearch.search.SearchHit;
-import org.elasticsearch.search.SearchHits;
-import org.elasticsearch.search.aggregations.AggregationBuilder;
-import org.elasticsearch.search.aggregations.AggregationBuilders;
-import org.elasticsearch.search.aggregations.Aggregations;
-import org.elasticsearch.search.aggregations.BucketOrder;
-import org.elasticsearch.search.aggregations.bucket.composite.CompositeAggregationBuilder;
-import org.elasticsearch.search.aggregations.bucket.composite.CompositeValuesSourceBuilder;
-import org.elasticsearch.search.aggregations.bucket.composite.ParsedComposite;
-import org.elasticsearch.search.aggregations.bucket.composite.TermsValuesSourceBuilder;
-import org.elasticsearch.search.aggregations.bucket.terms.ParsedTerms;
-import org.elasticsearch.search.aggregations.bucket.terms.Terms;
-import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
-import org.elasticsearch.search.aggregations.metrics.ParsedTopHits;
-import org.elasticsearch.search.builder.SearchSourceBuilder;
-import org.elasticsearch.search.sort.SortOrder;
-import org.elasticsearch.xcontent.XContentType;
import org.hl7.fhir.instance.model.api.IBaseResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Arrays;
+import java.io.StringReader;
import java.util.Collection;
import java.util.List;
-import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
-import static org.apache.commons.lang3.StringUtils.isBlank;
-
public class ElasticsearchSvcImpl implements IElasticsearchSvc {
- private static final Logger ourLog = LoggerFactory.getLogger(ElasticsearchSvcImpl.class);
-
// Index Constants
public static final String OBSERVATION_INDEX = "observation_index";
public static final String OBSERVATION_CODE_INDEX = "code_index";
- public static final String OBSERVATION_DOCUMENT_TYPE =
- "ca.uhn.fhir.jpa.model.entity.ObservationIndexedSearchParamLastNEntity";
- public static final String CODE_DOCUMENT_TYPE =
- "ca.uhn.fhir.jpa.model.entity.ObservationIndexedCodeCodeableConceptEntity";
public static final String OBSERVATION_INDEX_SCHEMA_FILE = "ObservationIndexSchema.json";
public static final String OBSERVATION_CODE_INDEX_SCHEMA_FILE = "ObservationCodeIndexSchema.json";
// Aggregation Constants
- private static final String GROUP_BY_SUBJECT = "group_by_subject";
- private static final String GROUP_BY_SYSTEM = "group_by_system";
- private static final String GROUP_BY_CODE = "group_by_code";
- private static final String MOST_RECENT_EFFECTIVE = "most_recent_effective";
// Observation index document element names
private static final String OBSERVATION_IDENTIFIER_FIELD_NAME = "identifier";
- private static final String OBSERVATION_SUBJECT_FIELD_NAME = "subject";
- private static final String OBSERVATION_CODEVALUE_FIELD_NAME = "codeconceptcodingcode";
- private static final String OBSERVATION_CODESYSTEM_FIELD_NAME = "codeconceptcodingsystem";
- private static final String OBSERVATION_CODEHASH_FIELD_NAME = "codeconceptcodingcode_system_hash";
- private static final String OBSERVATION_CODEDISPLAY_FIELD_NAME = "codeconceptcodingdisplay";
- private static final String OBSERVATION_CODE_TEXT_FIELD_NAME = "codeconcepttext";
- private static final String OBSERVATION_EFFECTIVEDTM_FIELD_NAME = "effectivedtm";
- private static final String OBSERVATION_CATEGORYHASH_FIELD_NAME = "categoryconceptcodingcode_system_hash";
- private static final String OBSERVATION_CATEGORYVALUE_FIELD_NAME = "categoryconceptcodingcode";
- private static final String OBSERVATION_CATEGORYSYSTEM_FIELD_NAME = "categoryconceptcodingsystem";
- private static final String OBSERVATION_CATEGORYDISPLAY_FIELD_NAME = "categoryconceptcodingdisplay";
- private static final String OBSERVATION_CATEGORYTEXT_FIELD_NAME = "categoryconcepttext";
// Code index document element names
private static final String CODE_HASH = "codingcode_system_hash";
@@ -132,12 +65,7 @@ public class ElasticsearchSvcImpl implements IElasticsearchSvc {
private static final String OBSERVATION_RESOURCE_NAME = "Observation";
- private final RestHighLevelClient myRestHighLevelClient;
-
- private final ObjectMapper objectMapper = new ObjectMapper();
-
- @Autowired
- private PartitionSettings myPartitionSettings;
+ private final ElasticsearchClient myRestHighLevelClient;
@Autowired
private FhirContext myContext;
@@ -150,11 +78,11 @@ public class ElasticsearchSvcImpl implements IElasticsearchSvc {
@Nullable String theUsername,
@Nullable String thePassword) {
this(theProtocol, theHostname, theUsername, thePassword);
- this.myPartitionSettings = thePartitionSetings;
}
public ElasticsearchSvcImpl(
String theProtocol, String theHostname, @Nullable String theUsername, @Nullable String thePassword) {
+
myRestHighLevelClient = ElasticsearchRestClientFactory.createElasticsearchHighLevelRestClient(
theProtocol, theHostname, theUsername, thePassword);
@@ -200,648 +128,30 @@ public class ElasticsearchSvcImpl implements IElasticsearchSvc {
}
private boolean createIndex(String theIndexName, String theMapping) throws IOException {
- CreateIndexRequest request = new CreateIndexRequest(theIndexName);
- request.source(theMapping, XContentType.JSON);
- CreateIndexResponse createIndexResponse =
- myRestHighLevelClient.indices().create(request, RequestOptions.DEFAULT);
- return createIndexResponse.isAcknowledged();
+ return myRestHighLevelClient
+ .indices()
+ .create(cir -> cir.index(theIndexName).withJson(new StringReader(theMapping)))
+ .acknowledged();
}
private boolean indexExists(String theIndexName) throws IOException {
- GetIndexRequest request = new GetIndexRequest(theIndexName);
- return myRestHighLevelClient.indices().exists(request, RequestOptions.DEFAULT);
- }
-
- @Override
- public List executeLastN(
- SearchParameterMap theSearchParameterMap, FhirContext theFhirContext, Integer theMaxResultsToFetch) {
- Validate.isTrue(
- !myPartitionSettings.isPartitioningEnabled(),
- "$lastn is not currently supported on partitioned servers");
-
- String[] topHitsInclude = {OBSERVATION_IDENTIFIER_FIELD_NAME};
- return buildAndExecuteSearch(
- theSearchParameterMap,
- theFhirContext,
- topHitsInclude,
- ObservationJson::getIdentifier,
- theMaxResultsToFetch);
- }
-
- private List buildAndExecuteSearch(
- SearchParameterMap theSearchParameterMap,
- FhirContext theFhirContext,
- String[] topHitsInclude,
- Function setValue,
- Integer theMaxResultsToFetch) {
- String patientParamName = LastNParameterHelper.getPatientParamName(theFhirContext);
- String subjectParamName = LastNParameterHelper.getSubjectParamName(theFhirContext);
- List searchResults = new ArrayList<>();
- if (theSearchParameterMap.containsKey(patientParamName)
- || theSearchParameterMap.containsKey(subjectParamName)) {
- for (String subject :
- getSubjectReferenceCriteria(patientParamName, subjectParamName, theSearchParameterMap)) {
- if (theMaxResultsToFetch != null && searchResults.size() >= theMaxResultsToFetch) {
- break;
- }
- SearchRequest myLastNRequest = buildObservationsSearchRequest(
- subject,
- theSearchParameterMap,
- theFhirContext,
- createObservationSubjectAggregationBuilder(
- getMaxParameter(theSearchParameterMap), topHitsInclude));
- ourLog.debug("ElasticSearch query: {}", myLastNRequest.source().toString());
- try {
- SearchResponse lastnResponse = executeSearchRequest(myLastNRequest);
- searchResults.addAll(buildObservationList(
- lastnResponse, setValue, theSearchParameterMap, theFhirContext, theMaxResultsToFetch));
- } catch (IOException theE) {
- throw new InvalidRequestException(Msg.code(1178) + "Unable to execute LastN request", theE);
- }
- }
- } else {
- SearchRequest myLastNRequest = buildObservationsSearchRequest(
- theSearchParameterMap,
- theFhirContext,
- createObservationCodeAggregationBuilder(getMaxParameter(theSearchParameterMap), topHitsInclude));
- ourLog.debug("ElasticSearch query: {}", myLastNRequest.source().toString());
- try {
- SearchResponse lastnResponse = executeSearchRequest(myLastNRequest);
- searchResults.addAll(buildObservationList(
- lastnResponse, setValue, theSearchParameterMap, theFhirContext, theMaxResultsToFetch));
- } catch (IOException theE) {
- throw new InvalidRequestException(Msg.code(1179) + "Unable to execute LastN request", theE);
- }
- }
- return searchResults;
- }
-
- private int getMaxParameter(SearchParameterMap theSearchParameterMap) {
- if (theSearchParameterMap.getLastNMax() == null) {
- return 1;
- } else {
- return theSearchParameterMap.getLastNMax();
- }
- }
-
- private List getSubjectReferenceCriteria(
- String thePatientParamName, String theSubjectParamName, SearchParameterMap theSearchParameterMap) {
- List subjectReferenceCriteria = new ArrayList<>();
-
- List> patientParams = new ArrayList<>();
- if (theSearchParameterMap.get(thePatientParamName) != null) {
- patientParams.addAll(theSearchParameterMap.get(thePatientParamName));
- }
- if (theSearchParameterMap.get(theSubjectParamName) != null) {
- patientParams.addAll(theSearchParameterMap.get(theSubjectParamName));
- }
- for (List extends IQueryParameterType> nextSubjectList : patientParams) {
- subjectReferenceCriteria.addAll(getReferenceValues(nextSubjectList));
- }
- return subjectReferenceCriteria;
- }
-
- private List getReferenceValues(List extends IQueryParameterType> referenceParams) {
- List referenceList = new ArrayList<>();
-
- for (IQueryParameterType nextOr : referenceParams) {
-
- if (nextOr instanceof ReferenceParam) {
- ReferenceParam ref = (ReferenceParam) nextOr;
- if (isBlank(ref.getChain())) {
- referenceList.add(ref.getValue());
- }
- } else {
- throw new IllegalArgumentException(
- Msg.code(1180) + "Invalid token type (expecting ReferenceParam): " + nextOr.getClass());
- }
- }
- return referenceList;
- }
-
- private CompositeAggregationBuilder createObservationSubjectAggregationBuilder(
- Integer theMaxNumberObservationsPerCode, String[] theTopHitsInclude) {
- CompositeValuesSourceBuilder> subjectValuesBuilder =
- new TermsValuesSourceBuilder(OBSERVATION_SUBJECT_FIELD_NAME).field(OBSERVATION_SUBJECT_FIELD_NAME);
- List> compositeAggSubjectSources = new ArrayList<>();
- compositeAggSubjectSources.add(subjectValuesBuilder);
- CompositeAggregationBuilder compositeAggregationSubjectBuilder =
- new CompositeAggregationBuilder(GROUP_BY_SUBJECT, compositeAggSubjectSources);
- compositeAggregationSubjectBuilder.subAggregation(
- createObservationCodeAggregationBuilder(theMaxNumberObservationsPerCode, theTopHitsInclude));
- compositeAggregationSubjectBuilder.size(10000);
-
- return compositeAggregationSubjectBuilder;
- }
-
- private TermsAggregationBuilder createObservationCodeAggregationBuilder(
- int theMaxNumberObservationsPerCode, String[] theTopHitsInclude) {
- TermsAggregationBuilder observationCodeCodeAggregationBuilder =
- new TermsAggregationBuilder(GROUP_BY_CODE).field(OBSERVATION_CODEVALUE_FIELD_NAME);
- observationCodeCodeAggregationBuilder.order(BucketOrder.key(true));
- // Top Hits Aggregation
- observationCodeCodeAggregationBuilder.subAggregation(AggregationBuilders.topHits(MOST_RECENT_EFFECTIVE)
- .sort(OBSERVATION_EFFECTIVEDTM_FIELD_NAME, SortOrder.DESC)
- .fetchSource(theTopHitsInclude, null)
- .size(theMaxNumberObservationsPerCode));
- observationCodeCodeAggregationBuilder.size(10000);
- TermsAggregationBuilder observationCodeSystemAggregationBuilder =
- new TermsAggregationBuilder(GROUP_BY_SYSTEM).field(OBSERVATION_CODESYSTEM_FIELD_NAME);
- observationCodeSystemAggregationBuilder.order(BucketOrder.key(true));
- observationCodeSystemAggregationBuilder.subAggregation(observationCodeCodeAggregationBuilder);
- return observationCodeSystemAggregationBuilder;
- }
-
- private SearchResponse executeSearchRequest(SearchRequest searchRequest) throws IOException {
- return myRestHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
- }
-
- private List buildObservationList(
- SearchResponse theSearchResponse,
- Function setValue,
- SearchParameterMap theSearchParameterMap,
- FhirContext theFhirContext,
- Integer theMaxResultsToFetch)
- throws IOException {
- List theObservationList = new ArrayList<>();
- if (theSearchParameterMap.containsKey(LastNParameterHelper.getPatientParamName(theFhirContext))
- || theSearchParameterMap.containsKey(LastNParameterHelper.getSubjectParamName(theFhirContext))) {
- for (ParsedComposite.ParsedBucket subjectBucket : getSubjectBuckets(theSearchResponse)) {
- if (theMaxResultsToFetch != null && theObservationList.size() >= theMaxResultsToFetch) {
- break;
- }
- for (Terms.Bucket observationCodeBucket : getObservationCodeBuckets(subjectBucket)) {
- if (theMaxResultsToFetch != null && theObservationList.size() >= theMaxResultsToFetch) {
- break;
- }
- for (SearchHit lastNMatch : getLastNMatches(observationCodeBucket)) {
- if (theMaxResultsToFetch != null && theObservationList.size() >= theMaxResultsToFetch) {
- break;
- }
- String indexedObservation = lastNMatch.getSourceAsString();
- ObservationJson observationJson =
- objectMapper.readValue(indexedObservation, ObservationJson.class);
- theObservationList.add(setValue.apply(observationJson));
- }
- }
- }
- } else {
- for (Terms.Bucket observationCodeBucket : getObservationCodeBuckets(theSearchResponse)) {
- if (theMaxResultsToFetch != null && theObservationList.size() >= theMaxResultsToFetch) {
- break;
- }
- for (SearchHit lastNMatch : getLastNMatches(observationCodeBucket)) {
- if (theMaxResultsToFetch != null && theObservationList.size() >= theMaxResultsToFetch) {
- break;
- }
- String indexedObservation = lastNMatch.getSourceAsString();
- ObservationJson observationJson = objectMapper.readValue(indexedObservation, ObservationJson.class);
- theObservationList.add(setValue.apply(observationJson));
- }
- }
- }
-
- return theObservationList;
- }
-
- private List getSubjectBuckets(SearchResponse theSearchResponse) {
- Aggregations responseAggregations = theSearchResponse.getAggregations();
- ParsedComposite aggregatedSubjects = responseAggregations.get(GROUP_BY_SUBJECT);
- return aggregatedSubjects.getBuckets();
- }
-
- private List extends Terms.Bucket> getObservationCodeBuckets(SearchResponse theSearchResponse) {
- Aggregations responseAggregations = theSearchResponse.getAggregations();
- return getObservationCodeBuckets(responseAggregations);
- }
-
- private List extends Terms.Bucket> getObservationCodeBuckets(ParsedComposite.ParsedBucket theSubjectBucket) {
- Aggregations observationCodeSystemAggregations = theSubjectBucket.getAggregations();
- return getObservationCodeBuckets(observationCodeSystemAggregations);
- }
-
- private List extends Terms.Bucket> getObservationCodeBuckets(Aggregations theObservationCodeSystemAggregations) {
- List retVal = new ArrayList<>();
- ParsedTerms aggregatedObservationCodeSystems = theObservationCodeSystemAggregations.get(GROUP_BY_SYSTEM);
- for (Terms.Bucket observationCodeSystem : aggregatedObservationCodeSystems.getBuckets()) {
- Aggregations observationCodeCodeAggregations = observationCodeSystem.getAggregations();
- ParsedTerms aggregatedObservationCodeCodes = observationCodeCodeAggregations.get(GROUP_BY_CODE);
- retVal.addAll(aggregatedObservationCodeCodes.getBuckets());
- }
- return retVal;
- }
-
- private SearchHit[] getLastNMatches(Terms.Bucket theObservationCodeBucket) {
- Aggregations topHitObservationCodes = theObservationCodeBucket.getAggregations();
- ParsedTopHits parsedTopHits = topHitObservationCodes.get(MOST_RECENT_EFFECTIVE);
- return parsedTopHits.getHits().getHits();
- }
-
- private SearchRequest buildObservationsSearchRequest(
- SearchParameterMap theSearchParameterMap,
- FhirContext theFhirContext,
- AggregationBuilder theAggregationBuilder) {
- SearchRequest searchRequest = new SearchRequest(OBSERVATION_INDEX);
- SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
- // Query
- if (!searchParamsHaveLastNCriteria(theSearchParameterMap, theFhirContext)) {
- searchSourceBuilder.query(QueryBuilders.matchAllQuery());
- } else {
- BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
- addCategoriesCriteria(boolQueryBuilder, theSearchParameterMap, theFhirContext);
- addObservationCodeCriteria(boolQueryBuilder, theSearchParameterMap, theFhirContext);
- addDateCriteria(boolQueryBuilder, theSearchParameterMap, theFhirContext);
- searchSourceBuilder.query(boolQueryBuilder);
- }
- searchSourceBuilder.size(0);
-
- // Aggregation by order codes
- searchSourceBuilder.aggregation(theAggregationBuilder);
- searchRequest.source(searchSourceBuilder);
-
- return searchRequest;
- }
-
- private SearchRequest buildObservationsSearchRequest(
- String theSubjectParam,
- SearchParameterMap theSearchParameterMap,
- FhirContext theFhirContext,
- AggregationBuilder theAggregationBuilder) {
- SearchRequest searchRequest = new SearchRequest(OBSERVATION_INDEX);
- SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
- // Query
- BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
- boolQueryBuilder.must(QueryBuilders.termQuery(OBSERVATION_SUBJECT_FIELD_NAME, theSubjectParam));
- addCategoriesCriteria(boolQueryBuilder, theSearchParameterMap, theFhirContext);
- addObservationCodeCriteria(boolQueryBuilder, theSearchParameterMap, theFhirContext);
- addDateCriteria(boolQueryBuilder, theSearchParameterMap, theFhirContext);
- searchSourceBuilder.query(boolQueryBuilder);
- searchSourceBuilder.size(0);
-
- // Aggregation by order codes
- searchSourceBuilder.aggregation(theAggregationBuilder);
- searchRequest.source(searchSourceBuilder);
-
- return searchRequest;
- }
-
- private Boolean searchParamsHaveLastNCriteria(
- SearchParameterMap theSearchParameterMap, FhirContext theFhirContext) {
- return theSearchParameterMap != null
- && (theSearchParameterMap.containsKey(LastNParameterHelper.getPatientParamName(theFhirContext))
- || theSearchParameterMap.containsKey(LastNParameterHelper.getSubjectParamName(theFhirContext))
- || theSearchParameterMap.containsKey(LastNParameterHelper.getCategoryParamName(theFhirContext))
- || theSearchParameterMap.containsKey(LastNParameterHelper.getCodeParamName(theFhirContext)));
- }
-
- private void addCategoriesCriteria(
- BoolQueryBuilder theBoolQueryBuilder,
- SearchParameterMap theSearchParameterMap,
- FhirContext theFhirContext) {
- String categoryParamName = LastNParameterHelper.getCategoryParamName(theFhirContext);
- if (theSearchParameterMap.containsKey(categoryParamName)) {
- ArrayList codeSystemHashList = new ArrayList<>();
- ArrayList codeOnlyList = new ArrayList<>();
- ArrayList systemOnlyList = new ArrayList<>();
- ArrayList textOnlyList = new ArrayList<>();
- List> andOrParams = theSearchParameterMap.get(categoryParamName);
- for (List extends IQueryParameterType> nextAnd : andOrParams) {
- codeSystemHashList.addAll(getCodingCodeSystemValues(nextAnd));
- codeOnlyList.addAll(getCodingCodeOnlyValues(nextAnd));
- systemOnlyList.addAll(getCodingSystemOnlyValues(nextAnd));
- textOnlyList.addAll(getCodingTextOnlyValues(nextAnd));
- }
- if (codeSystemHashList.size() > 0) {
- theBoolQueryBuilder.must(
- QueryBuilders.termsQuery(OBSERVATION_CATEGORYHASH_FIELD_NAME, codeSystemHashList));
- }
- if (codeOnlyList.size() > 0) {
- theBoolQueryBuilder.must(QueryBuilders.termsQuery(OBSERVATION_CATEGORYVALUE_FIELD_NAME, codeOnlyList));
- }
- if (systemOnlyList.size() > 0) {
- theBoolQueryBuilder.must(
- QueryBuilders.termsQuery(OBSERVATION_CATEGORYSYSTEM_FIELD_NAME, systemOnlyList));
- }
- if (textOnlyList.size() > 0) {
- BoolQueryBuilder myTextBoolQueryBuilder = QueryBuilders.boolQuery();
- for (String textOnlyParam : textOnlyList) {
- myTextBoolQueryBuilder.should(QueryBuilders.matchPhrasePrefixQuery(
- OBSERVATION_CATEGORYDISPLAY_FIELD_NAME, textOnlyParam));
- myTextBoolQueryBuilder.should(
- QueryBuilders.matchPhrasePrefixQuery(OBSERVATION_CATEGORYTEXT_FIELD_NAME, textOnlyParam));
- }
- theBoolQueryBuilder.must(myTextBoolQueryBuilder);
- }
- }
- }
-
- private List getCodingCodeSystemValues(List extends IQueryParameterType> codeParams) {
- ArrayList codeSystemHashList = new ArrayList<>();
- for (IQueryParameterType nextOr : codeParams) {
- if (nextOr instanceof TokenParam) {
- TokenParam ref = (TokenParam) nextOr;
- if (ref.getSystem() != null && ref.getValue() != null) {
- codeSystemHashList.add(
- String.valueOf(CodeSystemHash.hashCodeSystem(ref.getSystem(), ref.getValue())));
- }
- } else {
- throw new IllegalArgumentException(
- Msg.code(1181) + "Invalid token type (expecting TokenParam): " + nextOr.getClass());
- }
- }
- return codeSystemHashList;
- }
-
- private List getCodingCodeOnlyValues(List extends IQueryParameterType> codeParams) {
- ArrayList codeOnlyList = new ArrayList<>();
- for (IQueryParameterType nextOr : codeParams) {
-
- if (nextOr instanceof TokenParam) {
- TokenParam ref = (TokenParam) nextOr;
- if (ref.getValue() != null && ref.getSystem() == null && !ref.isText()) {
- codeOnlyList.add(ref.getValue());
- }
- } else {
- throw new IllegalArgumentException(
- Msg.code(1182) + "Invalid token type (expecting TokenParam): " + nextOr.getClass());
- }
- }
- return codeOnlyList;
- }
-
- private List getCodingSystemOnlyValues(List extends IQueryParameterType> codeParams) {
- ArrayList systemOnlyList = new ArrayList<>();
- for (IQueryParameterType nextOr : codeParams) {
-
- if (nextOr instanceof TokenParam) {
- TokenParam ref = (TokenParam) nextOr;
- if (ref.getValue() == null && ref.getSystem() != null) {
- systemOnlyList.add(ref.getSystem());
- }
- } else {
- throw new IllegalArgumentException(
- Msg.code(1183) + "Invalid token type (expecting TokenParam): " + nextOr.getClass());
- }
- }
- return systemOnlyList;
- }
-
- private List getCodingTextOnlyValues(List extends IQueryParameterType> codeParams) {
- ArrayList textOnlyList = new ArrayList<>();
- for (IQueryParameterType nextOr : codeParams) {
-
- if (nextOr instanceof TokenParam) {
- TokenParam ref = (TokenParam) nextOr;
- if (ref.isText() && ref.getValue() != null) {
- textOnlyList.add(ref.getValue());
- }
- } else {
- throw new IllegalArgumentException(
- Msg.code(1184) + "Invalid token type (expecting TokenParam): " + nextOr.getClass());
- }
- }
- return textOnlyList;
- }
-
- private void addObservationCodeCriteria(
- BoolQueryBuilder theBoolQueryBuilder,
- SearchParameterMap theSearchParameterMap,
- FhirContext theFhirContext) {
- String codeParamName = LastNParameterHelper.getCodeParamName(theFhirContext);
- if (theSearchParameterMap.containsKey(codeParamName)) {
- ArrayList codeSystemHashList = new ArrayList<>();
- ArrayList codeOnlyList = new ArrayList<>();
- ArrayList systemOnlyList = new ArrayList<>();
- ArrayList textOnlyList = new ArrayList<>();
- List> andOrParams = theSearchParameterMap.get(codeParamName);
- for (List extends IQueryParameterType> nextAnd : andOrParams) {
- codeSystemHashList.addAll(getCodingCodeSystemValues(nextAnd));
- codeOnlyList.addAll(getCodingCodeOnlyValues(nextAnd));
- systemOnlyList.addAll(getCodingSystemOnlyValues(nextAnd));
- textOnlyList.addAll(getCodingTextOnlyValues(nextAnd));
- }
- if (codeSystemHashList.size() > 0) {
- theBoolQueryBuilder.must(QueryBuilders.termsQuery(OBSERVATION_CODEHASH_FIELD_NAME, codeSystemHashList));
- }
- if (codeOnlyList.size() > 0) {
- theBoolQueryBuilder.must(QueryBuilders.termsQuery(OBSERVATION_CODEVALUE_FIELD_NAME, codeOnlyList));
- }
- if (systemOnlyList.size() > 0) {
- theBoolQueryBuilder.must(QueryBuilders.termsQuery(OBSERVATION_CODESYSTEM_FIELD_NAME, systemOnlyList));
- }
- if (textOnlyList.size() > 0) {
- BoolQueryBuilder myTextBoolQueryBuilder = QueryBuilders.boolQuery();
- for (String textOnlyParam : textOnlyList) {
- myTextBoolQueryBuilder.should(
- QueryBuilders.matchPhrasePrefixQuery(OBSERVATION_CODEDISPLAY_FIELD_NAME, textOnlyParam));
- myTextBoolQueryBuilder.should(
- QueryBuilders.matchPhrasePrefixQuery(OBSERVATION_CODE_TEXT_FIELD_NAME, textOnlyParam));
- }
- theBoolQueryBuilder.must(myTextBoolQueryBuilder);
- }
- }
- }
-
- private void addDateCriteria(
- BoolQueryBuilder theBoolQueryBuilder,
- SearchParameterMap theSearchParameterMap,
- FhirContext theFhirContext) {
- String dateParamName = LastNParameterHelper.getEffectiveParamName(theFhirContext);
- if (theSearchParameterMap.containsKey(dateParamName)) {
- List> andOrParams = theSearchParameterMap.get(dateParamName);
- for (List extends IQueryParameterType> nextAnd : andOrParams) {
- BoolQueryBuilder myDateBoolQueryBuilder = new BoolQueryBuilder();
- for (IQueryParameterType nextOr : nextAnd) {
- if (nextOr instanceof DateParam) {
- DateParam myDate = (DateParam) nextOr;
- createDateCriteria(myDate, myDateBoolQueryBuilder);
- }
- }
- theBoolQueryBuilder.must(myDateBoolQueryBuilder);
- }
- }
- }
-
- private void createDateCriteria(DateParam theDate, BoolQueryBuilder theBoolQueryBuilder) {
- Long dateInstant = theDate.getValue().getTime();
- RangeQueryBuilder myRangeQueryBuilder = new RangeQueryBuilder(OBSERVATION_EFFECTIVEDTM_FIELD_NAME);
-
- ParamPrefixEnum prefix = theDate.getPrefix();
- if (prefix == ParamPrefixEnum.GREATERTHAN || prefix == ParamPrefixEnum.STARTS_AFTER) {
- theBoolQueryBuilder.should(myRangeQueryBuilder.gt(dateInstant));
- } else if (prefix == ParamPrefixEnum.LESSTHAN || prefix == ParamPrefixEnum.ENDS_BEFORE) {
- theBoolQueryBuilder.should(myRangeQueryBuilder.lt(dateInstant));
- } else if (prefix == ParamPrefixEnum.LESSTHAN_OR_EQUALS) {
- theBoolQueryBuilder.should(myRangeQueryBuilder.lte(dateInstant));
- } else if (prefix == ParamPrefixEnum.GREATERTHAN_OR_EQUALS) {
- theBoolQueryBuilder.should(myRangeQueryBuilder.gte(dateInstant));
- } else {
- theBoolQueryBuilder.should(new MatchQueryBuilder(OBSERVATION_EFFECTIVEDTM_FIELD_NAME, dateInstant));
- }
- }
-
- @VisibleForTesting
- public List executeLastNWithAllFieldsForTest(
- SearchParameterMap theSearchParameterMap, FhirContext theFhirContext) {
- return buildAndExecuteSearch(theSearchParameterMap, theFhirContext, null, t -> t, 100);
- }
-
- @VisibleForTesting
- List queryAllIndexedObservationCodesForTest() throws IOException {
- SearchRequest codeSearchRequest = new SearchRequest(OBSERVATION_CODE_INDEX);
- SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
- // Query
- searchSourceBuilder.query(QueryBuilders.matchAllQuery());
- searchSourceBuilder.size(1000);
- codeSearchRequest.source(searchSourceBuilder);
- SearchResponse codeSearchResponse = executeSearchRequest(codeSearchRequest);
- return buildCodeResult(codeSearchResponse);
- }
-
- private List buildCodeResult(SearchResponse theSearchResponse) throws JsonProcessingException {
- SearchHits codeHits = theSearchResponse.getHits();
- List codes = new ArrayList<>();
- for (SearchHit codeHit : codeHits) {
- CodeJson code = objectMapper.readValue(codeHit.getSourceAsString(), CodeJson.class);
- codes.add(code);
- }
- return codes;
- }
-
- @Override
- public ObservationJson getObservationDocument(String theDocumentID) {
- if (theDocumentID == null) {
- throw new InvalidRequestException(
- Msg.code(1185) + "Require non-null document ID for observation document query");
- }
- SearchRequest theSearchRequest = buildSingleObservationSearchRequest(theDocumentID);
- ObservationJson observationDocumentJson = null;
- try {
- SearchResponse observationDocumentResponse = executeSearchRequest(theSearchRequest);
- SearchHit[] observationDocumentHits =
- observationDocumentResponse.getHits().getHits();
- if (observationDocumentHits.length > 0) {
- // There should be no more than one hit for the identifier
- String observationDocument = observationDocumentHits[0].getSourceAsString();
- observationDocumentJson = objectMapper.readValue(observationDocument, ObservationJson.class);
- }
-
- } catch (IOException theE) {
- throw new InvalidRequestException(
- Msg.code(1186) + "Unable to execute observation document query for ID " + theDocumentID, theE);
- }
-
- return observationDocumentJson;
- }
-
- private SearchRequest buildSingleObservationSearchRequest(String theObservationIdentifier) {
- SearchRequest searchRequest = new SearchRequest(OBSERVATION_INDEX);
- SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
- BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
- boolQueryBuilder.must(QueryBuilders.termQuery(OBSERVATION_IDENTIFIER_FIELD_NAME, theObservationIdentifier));
- searchSourceBuilder.query(boolQueryBuilder);
- searchSourceBuilder.size(1);
-
- searchRequest.source(searchSourceBuilder);
-
- return searchRequest;
- }
-
- @Override
- public CodeJson getObservationCodeDocument(String theCodeSystemHash, String theText) {
- if (theCodeSystemHash == null && theText == null) {
- throw new InvalidRequestException(Msg.code(1187)
- + "Require a non-null code system hash value or display value for observation code document query");
- }
- SearchRequest theSearchRequest = buildSingleObservationCodeSearchRequest(theCodeSystemHash, theText);
- CodeJson observationCodeDocumentJson = null;
- try {
- SearchResponse observationCodeDocumentResponse = executeSearchRequest(theSearchRequest);
- SearchHit[] observationCodeDocumentHits =
- observationCodeDocumentResponse.getHits().getHits();
- if (observationCodeDocumentHits.length > 0) {
- // There should be no more than one hit for the code lookup.
- String observationCodeDocument = observationCodeDocumentHits[0].getSourceAsString();
- observationCodeDocumentJson = objectMapper.readValue(observationCodeDocument, CodeJson.class);
- }
-
- } catch (IOException theE) {
- throw new InvalidRequestException(
- Msg.code(1188) + "Unable to execute observation code document query hash code or display", theE);
- }
-
- return observationCodeDocumentJson;
- }
-
- private SearchRequest buildSingleObservationCodeSearchRequest(String theCodeSystemHash, String theText) {
- SearchRequest searchRequest = new SearchRequest(OBSERVATION_CODE_INDEX);
- SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
- BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
- if (theCodeSystemHash != null) {
- boolQueryBuilder.must(QueryBuilders.termQuery(CODE_HASH, theCodeSystemHash));
- } else {
- boolQueryBuilder.must(QueryBuilders.matchPhraseQuery(CODE_TEXT, theText));
- }
-
- searchSourceBuilder.query(boolQueryBuilder);
- searchSourceBuilder.size(1);
-
- searchRequest.source(searchSourceBuilder);
-
- return searchRequest;
- }
-
- @Override
- public Boolean createOrUpdateObservationIndex(String theDocumentId, ObservationJson theObservationDocument) {
- try {
- String documentToIndex = objectMapper.writeValueAsString(theObservationDocument);
- return performIndex(
- OBSERVATION_INDEX, theDocumentId, documentToIndex, ElasticsearchSvcImpl.OBSERVATION_DOCUMENT_TYPE);
- } catch (IOException theE) {
- throw new InvalidRequestException(
- Msg.code(1189) + "Unable to persist Observation document " + theDocumentId);
- }
- }
-
- @Override
- public Boolean createOrUpdateObservationCodeIndex(
- String theCodeableConceptID, CodeJson theObservationCodeDocument) {
- try {
- String documentToIndex = objectMapper.writeValueAsString(theObservationCodeDocument);
- return performIndex(
- OBSERVATION_CODE_INDEX,
- theCodeableConceptID,
- documentToIndex,
- ElasticsearchSvcImpl.CODE_DOCUMENT_TYPE);
- } catch (IOException theE) {
- throw new InvalidRequestException(
- Msg.code(1190) + "Unable to persist Observation Code document " + theCodeableConceptID);
- }
- }
-
- private boolean performIndex(
- String theIndexName, String theDocumentId, String theIndexDocument, String theDocumentType)
- throws IOException {
- IndexResponse indexResponse = myRestHighLevelClient.index(
- createIndexRequest(theIndexName, theDocumentId, theIndexDocument, theDocumentType),
- RequestOptions.DEFAULT);
-
- return (indexResponse.getResult() == DocWriteResponse.Result.CREATED)
- || (indexResponse.getResult() == DocWriteResponse.Result.UPDATED);
+ ExistsRequest request = new ExistsRequest.Builder().index(theIndexName).build();
+ return myRestHighLevelClient.indices().exists(request).value();
}
@Override
public void close() throws IOException {
- myRestHighLevelClient.close();
+ // nothing
}
@Override
public List getObservationResources(Collection extends IResourcePersistentId> thePids) {
SearchRequest searchRequest = buildObservationResourceSearchRequest(thePids);
try {
- SearchResponse observationDocumentResponse = executeSearchRequest(searchRequest);
- SearchHit[] observationDocumentHits =
- observationDocumentResponse.getHits().getHits();
+ SearchResponse observationDocumentResponse =
+ myRestHighLevelClient.search(searchRequest, ObservationJson.class);
+ List> observationDocumentHits =
+ observationDocumentResponse.hits().hits();
IParser parser = TolerantJsonParser.createWithLenientErrorHandling(myContext, null);
Class extends IBaseResource> resourceType =
myContext.getResourceDefinition(OBSERVATION_RESOURCE_NAME).getImplementingClass();
@@ -849,8 +159,8 @@ public class ElasticsearchSvcImpl implements IElasticsearchSvc {
* @see ca.uhn.fhir.jpa.dao.BaseHapiFhirDao#toResource(Class, IBaseResourceEntity, Collection, boolean) for
* details about parsing raw json to BaseResource
*/
- return Arrays.stream(observationDocumentHits)
- .map(this::parseObservationJson)
+ return observationDocumentHits.stream()
+ .map(Hit::source)
.map(observationJson -> parser.parseResource(resourceType, observationJson.getResource()))
.collect(Collectors.toList());
} catch (IOException theE) {
@@ -859,55 +169,23 @@ public class ElasticsearchSvcImpl implements IElasticsearchSvc {
}
}
- private ObservationJson parseObservationJson(SearchHit theSearchHit) {
- try {
- return objectMapper.readValue(theSearchHit.getSourceAsString(), ObservationJson.class);
- } catch (JsonProcessingException exp) {
- throw new InvalidRequestException(Msg.code(2004) + "Unable to parse the observation resource json", exp);
- }
- }
-
private SearchRequest buildObservationResourceSearchRequest(Collection extends IResourcePersistentId> thePids) {
- SearchRequest searchRequest = new SearchRequest(OBSERVATION_INDEX);
- SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
- // Query
- BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
- List pidParams = thePids.stream().map(Object::toString).collect(Collectors.toList());
- boolQueryBuilder.must(QueryBuilders.termsQuery(OBSERVATION_IDENTIFIER_FIELD_NAME, pidParams));
- searchSourceBuilder.query(boolQueryBuilder);
- searchSourceBuilder.size(thePids.size());
- searchRequest.source(searchSourceBuilder);
- return searchRequest;
- }
+ List values = thePids.stream()
+ .map(Object::toString)
+ .map(v -> FieldValue.of(v))
+ .collect(Collectors.toList());
- private IndexRequest createIndexRequest(
- String theIndexName, String theDocumentId, String theObservationDocument, String theDocumentType) {
- IndexRequest request = new IndexRequest(theIndexName);
- request.id(theDocumentId);
- request.source(theObservationDocument, XContentType.JSON);
- return request;
- }
-
- @Override
- public void deleteObservationDocument(String theDocumentId) {
- DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(OBSERVATION_INDEX);
- deleteByQueryRequest.setQuery(QueryBuilders.termQuery(OBSERVATION_IDENTIFIER_FIELD_NAME, theDocumentId));
- try {
- myRestHighLevelClient.deleteByQuery(deleteByQueryRequest, RequestOptions.DEFAULT);
- } catch (IOException theE) {
- throw new InvalidRequestException(Msg.code(1191) + "Unable to delete Observation " + theDocumentId);
- }
- }
-
- @VisibleForTesting
- public void deleteAllDocumentsForTest(String theIndexName) throws IOException {
- DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(theIndexName);
- deleteByQueryRequest.setQuery(QueryBuilders.matchAllQuery());
- myRestHighLevelClient.deleteByQuery(deleteByQueryRequest, RequestOptions.DEFAULT);
+ return SearchRequest.of(sr -> sr.index(OBSERVATION_INDEX)
+ .query(qb -> qb.bool(bb -> bb.must(bbm -> {
+ bbm.terms(terms ->
+ terms.field(OBSERVATION_IDENTIFIER_FIELD_NAME).terms(termsb -> termsb.value(values)));
+ return bbm;
+ })))
+ .size(thePids.size()));
}
@VisibleForTesting
public void refreshIndex(String theIndexName) throws IOException {
- myRestHighLevelClient.indices().refresh(new RefreshRequest(theIndexName), RequestOptions.DEFAULT);
+ myRestHighLevelClient.indices().refresh(fn -> fn.index(theIndexName));
}
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/IElasticsearchSvc.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/IElasticsearchSvc.java
index c6f8209fe0f..1ddf74ac6c0 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/IElasticsearchSvc.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/lastn/IElasticsearchSvc.java
@@ -19,10 +19,6 @@
*/
package ca.uhn.fhir.jpa.search.lastn;
-import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.jpa.search.lastn.json.CodeJson;
-import ca.uhn.fhir.jpa.search.lastn.json.ObservationJson;
-import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId;
import org.hl7.fhir.instance.model.api.IBaseResource;
@@ -32,59 +28,6 @@ import java.util.List;
public interface IElasticsearchSvc {
- /**
- * Returns identifiers for the last most recent N observations that meet the specified criteria.
- *
- * @param theSearchParameterMap SearchParameterMap containing search parameters used for filtering the last N observations. Supported parameters include Subject, Patient, Code, Category and Max (the parameter used to determine N).
- * @param theFhirContext Current FhirContext.
- * @param theMaxResultsToFetch The maximum number of results to return for the purpose of paging.
- * @return
- */
- List executeLastN(
- SearchParameterMap theSearchParameterMap, FhirContext theFhirContext, Integer theMaxResultsToFetch);
-
- /**
- * Returns index document for a single Observation
- *
- * @param theDocumentID Identifier of Observation resource.
- * @return
- */
- ObservationJson getObservationDocument(String theDocumentID);
-
- /**
- * Returns index document for a single Observation Code that either has a coding that matches a specified Code value and system or that has a specified text value.
- *
- * @param theCodeSystemHash A hash string constructed from a Code value and Code system used to match to an Observation Code.
- * @param theText A text value used to match to an Observation Code.
- * @return
- */
- CodeJson getObservationCodeDocument(String theCodeSystemHash, String theText);
-
- /**
- * Creates or updates index for an Observation Resource.
- *
- * @param theDocumentId Identifier for Observation resource.
- * @param theObservationDocument Indexing document for Observation.
- * @return True if Observation indexed successfully.
- */
- Boolean createOrUpdateObservationIndex(String theDocumentId, ObservationJson theObservationDocument);
-
- /**
- * Creates or updates index for an Observation Code.
- *
- * @param theCodeableConceptID Identifier for Observation resource.
- * @param theObservationCodeDocument Indexing document for Observation.
- * @return True if Observation Code indexed successfully.
- */
- Boolean createOrUpdateObservationCodeIndex(String theCodeableConceptID, CodeJson theObservationCodeDocument);
-
- /**
- * Deletes index for an Observation Resource.
- *
- * @param theDocumentId Identifier for Observation resource.
- */
- void deleteObservationDocument(String theDocumentId);
-
/**
* Invoked when shutting down.
*/
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 064e193bfad..ad429000749 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
@@ -39,6 +39,11 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.util.StopWatch;
import com.google.common.annotations.VisibleForTesting;
+import jakarta.annotation.PostConstruct;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
+import jakarta.persistence.Query;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.apache.commons.lang3.time.DateUtils;
@@ -70,11 +75,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
-import javax.annotation.PostConstruct;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import javax.persistence.Query;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
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 1cbc2a5e69f..0e2305703b7 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
@@ -34,6 +34,7 @@ import ca.uhn.fhir.jpa.model.sched.ScheduledJobDefinition;
import ca.uhn.fhir.jpa.searchparam.MatchUrlService;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.util.UrlUtil;
+import jakarta.annotation.PostConstruct;
import org.apache.commons.lang3.time.DateUtils;
import org.quartz.JobExecutionContext;
import org.slf4j.Logger;
@@ -47,7 +48,6 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import javax.annotation.PostConstruct;
@Component
public class CacheWarmingSvcImpl implements ICacheWarmingSvc, IHasScheduledJobs {
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 fe35f7c8d4d..e8f2c66b6c3 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
@@ -53,6 +53,9 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.util.ObjectUtil;
import ca.uhn.fhir.util.ValidateUtil;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.CodeSystem;
@@ -82,9 +85,6 @@ import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
import static ca.uhn.fhir.jpa.api.dao.IDao.RESOURCE_PID_KEY;
import static org.apache.commons.lang3.StringUtils.isBlank;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermConceptClientMappingSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermConceptClientMappingSvcImpl.java
index de3a7809bb1..63c6d2bc328 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermConceptClientMappingSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermConceptClientMappingSvcImpl.java
@@ -37,6 +37,15 @@ import ca.uhn.fhir.jpa.term.api.ITermConceptClientMappingSvc;
import ca.uhn.fhir.jpa.util.MemoryCacheService;
import ca.uhn.fhir.jpa.util.ScrollableResultsIterator;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
+import jakarta.persistence.TypedQuery;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.CriteriaQuery;
+import jakarta.persistence.criteria.Join;
+import jakarta.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.Root;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
@@ -54,15 +63,6 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
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 9372b9b03b9..0869b8e47f0 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
@@ -91,6 +91,11 @@ import ca.uhn.hapi.converters.canonical.VersionCanonicalizer;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Stopwatch;
import com.google.common.collect.ArrayListMultimap;
+import jakarta.annotation.PostConstruct;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.NonUniqueResultException;
+import jakarta.persistence.PersistenceContext;
+import jakarta.persistence.PersistenceContextType;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.ObjectUtils;
@@ -171,11 +176,6 @@ import java.util.function.Consumer;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import javax.annotation.PostConstruct;
-import javax.persistence.EntityManager;
-import javax.persistence.NonUniqueResultException;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
import static ca.uhn.fhir.jpa.entity.TermConceptPropertyBinder.CONCEPT_PROPERTY_PREFIX_NAME;
import static ca.uhn.fhir.jpa.term.api.ITermLoaderSvc.LOINC_URI;
@@ -665,7 +665,7 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs {
}
private boolean isOracleDialect() {
- return myHibernatePropertiesProvider.getDialect() instanceof org.hibernate.dialect.Oracle12cDialect;
+ return myHibernatePropertiesProvider.getDialect() instanceof org.hibernate.dialect.OracleDialect;
}
private void expandConcepts(
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/PersistenceContextProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/PersistenceContextProvider.java
index fec6c6290c1..18771e6ef27 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/PersistenceContextProvider.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/PersistenceContextProvider.java
@@ -19,8 +19,8 @@
*/
package ca.uhn.fhir.jpa.util;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
+import jakarta.persistence.EntityManager;
+import jakarta.persistence.PersistenceContext;
/**
* Utility class that provides a proxied entityManager. It can be directly injected or
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/QueryParameterUtils.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/QueryParameterUtils.java
index 545935497c8..2da96d1c54f 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/QueryParameterUtils.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/QueryParameterUtils.java
@@ -37,6 +37,9 @@ import com.healthmarketscience.sqlbuilder.ComboCondition;
import com.healthmarketscience.sqlbuilder.Condition;
import com.healthmarketscience.sqlbuilder.InCondition;
import com.healthmarketscience.sqlbuilder.dbspec.basic.DbColumn;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.From;
+import jakarta.persistence.criteria.Predicate;
import org.apache.commons.collections4.BidiMap;
import org.apache.commons.collections4.bidimap.DualHashBidiMap;
import org.apache.commons.collections4.bidimap.UnmodifiableBidiMap;
@@ -53,9 +56,6 @@ import java.util.Objects;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.From;
-import javax.persistence.criteria.Predicate;
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/ScrollableResultsIterator.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/ScrollableResultsIterator.java
index b201778ebc8..a79a7834e9b 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/ScrollableResultsIterator.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/ScrollableResultsIterator.java
@@ -39,7 +39,7 @@ public class ScrollableResultsIterator extends BaseIterator
if (myNext == null) {
if (myScroll.next()) {
hasNext = true;
- myNext = (T) myScroll.get(0);
+ myNext = (T) myScroll.get();
} else {
hasNext = false;
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/validation/JpaValidationSupportChain.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/validation/JpaValidationSupportChain.java
index 8f88c3a88ec..5c8274fcda4 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/validation/JpaValidationSupportChain.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/validation/JpaValidationSupportChain.java
@@ -24,6 +24,8 @@ import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.jpa.packages.NpmJpaValidationSupport;
import ca.uhn.fhir.jpa.term.api.ITermConceptMappingSvc;
import ca.uhn.fhir.jpa.term.api.ITermReadSvc;
+import jakarta.annotation.PostConstruct;
+import jakarta.annotation.PreDestroy;
import org.hl7.fhir.common.hapi.validation.support.CommonCodeSystemsTerminologyService;
import org.hl7.fhir.common.hapi.validation.support.InMemoryTerminologyServerValidationSupport;
import org.hl7.fhir.common.hapi.validation.support.SnapshotGeneratingValidationSupport;
@@ -32,9 +34,6 @@ import org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-
public class JpaValidationSupportChain extends ValidationSupportChain {
private final FhirContext myFhirContext;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/index/DaoSearchParamSynchronizerTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/index/DaoSearchParamSynchronizerTest.java
index 672a023b65e..848f407b512 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/index/DaoSearchParamSynchronizerTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/index/DaoSearchParamSynchronizerTest.java
@@ -12,7 +12,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
-import javax.persistence.EntityManager;
+import jakarta.persistence.EntityManager;
import java.math.BigDecimal;
import java.util.List;
diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml b/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml
index 6fcd53ab9ab..672c17c1096 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.11.4-SNAPSHOT
+ 6.11.5-SNAPSHOT
../hapi-deployable-pom/pom.xml
@@ -71,38 +71,6 @@
org.apache.derby
derby
-
- org.eclipse.jetty
- jetty-servlets
-
-
- org.eclipse.jetty
- jetty-servlet
-
-
- org.eclipse.jetty
- jetty-server
-
-
- org.eclipse.jetty
- jetty-util
-
-
- org.eclipse.jetty
- jetty-webapp
-
-
- org.eclipse.jetty.websocket
- websocket-jetty-api
-
-
- org.eclipse.jetty.websocket
- websocket-core-client
-
-
- org.eclipse.jetty.websocket
- websocket-jetty-server
-
org.springframework.boot
spring-boot-test
@@ -161,12 +129,12 @@
mockito-core
- com.helger
- ph-schematron
+ com.helger.schematron
+ ph-schematron-api
- com.helger
- ph-commons
+ com.helger.schematron
+ ph-schematron-xslt
org.testcontainers
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 7d93aa506e4..d882b4ed076 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
@@ -3,6 +3,7 @@ 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.JpaStorageSettings;
+import ca.uhn.fhir.jpa.config.util.HapiEntityManagerFactoryUtil;
import ca.uhn.fhir.jpa.dao.r4.ElasticsearchPrefixTest;
import ca.uhn.fhir.jpa.model.dialect.HapiFhirH2Dialect;
import ca.uhn.fhir.jpa.search.HapiHSearchAnalysisConfigurers;
@@ -11,14 +12,12 @@ import ca.uhn.fhir.jpa.search.lastn.ElasticsearchRestClientFactory;
import ca.uhn.fhir.jpa.test.config.BlockLargeNumbersOfParamsListener;
import ca.uhn.fhir.jpa.test.config.TestHSearchAddInConfig;
import ca.uhn.fhir.jpa.util.CurrentThreadCaptureQueriesListener;
+import co.elastic.clients.elasticsearch.ElasticsearchClient;
+import co.elastic.clients.elasticsearch.indices.PutTemplateResponse;
+import co.elastic.clients.json.JsonData;
import net.ttddyy.dsproxy.listener.logging.SLF4JLogLevel;
import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder;
import org.apache.commons.dbcp2.BasicDataSource;
-import org.elasticsearch.action.support.master.AcknowledgedResponse;
-import org.elasticsearch.client.RequestOptions;
-import org.elasticsearch.client.RestHighLevelClient;
-import org.elasticsearch.client.indices.PutIndexTemplateRequest;
-import org.elasticsearch.common.settings.Settings;
import org.hibernate.jpa.HibernatePersistenceProvider;
import org.hibernate.search.backend.elasticsearch.cfg.ElasticsearchBackendSettings;
import org.hibernate.search.backend.elasticsearch.cfg.ElasticsearchIndexSettings;
@@ -36,7 +35,7 @@ import org.testcontainers.elasticsearch.ElasticsearchContainer;
import javax.sql.DataSource;
import java.io.IOException;
-import java.util.Arrays;
+import java.util.Map;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
@@ -65,11 +64,9 @@ public class ElasticsearchWithPrefixConfig {
}
@Bean
- public LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory theConfigurableListableBeanFactory) {
- LocalContainerEntityManagerFactoryBean retVal = new HapiFhirLocalContainerEntityManagerFactoryBean(theConfigurableListableBeanFactory);
- retVal.setJpaDialect(new HapiFhirHibernateJpaDialect(fhirContext().getLocalizer()));
- retVal.setPackagesToScan("ca.uhn.fhir.jpa.model.entity", "ca.uhn.fhir.jpa.entity");
- retVal.setPersistenceProvider(new HibernatePersistenceProvider());
+ public LocalContainerEntityManagerFactoryBean entityManagerFactory(ConfigurableListableBeanFactory theConfigurableListableBeanFactory, FhirContext theFhirContext, JpaStorageSettings theStorageSettings) {
+ LocalContainerEntityManagerFactoryBean retVal = HapiEntityManagerFactoryUtil.newEntityManagerFactory(theConfigurableListableBeanFactory, theFhirContext, theStorageSettings);
+
retVal.setPersistenceUnitName("PU_HapiFhirJpaR4");
retVal.setDataSource(dataSource());
retVal.setJpaProperties(jpaProperties());
@@ -126,14 +123,15 @@ public class ElasticsearchWithPrefixConfig {
//This tells elasticsearch to use our custom index naming strategy.
extraProperties.put(BackendSettings.backendKey(ElasticsearchBackendSettings.LAYOUT_STRATEGY), IndexNamePrefixLayoutStrategy.class.getName());
- PutIndexTemplateRequest ngramTemplate = new PutIndexTemplateRequest("ngram-template")
- .patterns(Arrays.asList("*resourcetable-*", "*termconcept-*"))
- .settings(Settings.builder().put("index.max_ngram_diff", 50));
-
try {
- RestHighLevelClient elasticsearchHighLevelRestClient = ElasticsearchRestClientFactory.createElasticsearchHighLevelRestClient("http", host + ":" + httpPort, "", "");
- AcknowledgedResponse acknowledgedResponse = elasticsearchHighLevelRestClient.indices().putTemplate(ngramTemplate, RequestOptions.DEFAULT);
- assert acknowledgedResponse.isAcknowledged();
+ ElasticsearchClient elasticsearchHighLevelRestClient = ElasticsearchRestClientFactory.createElasticsearchHighLevelRestClient("http", host + ":" + httpPort, "", "");
+ PutTemplateResponse acknowledgedResponse = elasticsearchHighLevelRestClient
+ .indices()
+ .putTemplate(b -> b
+ .name("ngram-template")
+ .indexPatterns("*resourcetable-*", "*termconcept-*")
+ .settings(Map.of("index.max_ngram_diff", JsonData.of(50))));
+ assert acknowledgedResponse.acknowledged();
} catch (IOException theE) {
theE.printStackTrace();
throw new ConfigurationException("Couldn't connect to the elasticsearch server to create necessary templates. Ensure the Elasticsearch user has permissions to create templates.");
diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/ElasticsearchPrefixTest.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/ElasticsearchPrefixTest.java
index 2f85e652a52..f9bc8977988 100644
--- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/ElasticsearchPrefixTest.java
+++ b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/ElasticsearchPrefixTest.java
@@ -3,11 +3,10 @@ package ca.uhn.fhir.jpa.dao.r4;
import ca.uhn.fhir.jpa.config.ElasticsearchWithPrefixConfig;
import ca.uhn.fhir.jpa.search.lastn.ElasticsearchRestClientFactory;
import ca.uhn.fhir.test.utilities.docker.RequiresDocker;
-import org.apache.http.util.EntityUtils;
-import org.elasticsearch.client.Request;
-import org.elasticsearch.client.Response;
-import org.elasticsearch.client.RestClient;
-import org.elasticsearch.client.RestHighLevelClient;
+import co.elastic.clients.elasticsearch.ElasticsearchClient;
+import co.elastic.clients.elasticsearch.cat.IndicesResponse;
+import co.elastic.clients.elasticsearch.cat.indices.IndicesRecord;
+import co.elastic.clients.elasticsearch.indices.GetIndexResponse;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -17,6 +16,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.testcontainers.elasticsearch.ElasticsearchContainer;
import java.io.IOException;
+import java.util.stream.Collectors;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
@@ -36,13 +36,15 @@ public class ElasticsearchPrefixTest {
@Test
public void test() throws IOException {
//Given
- RestHighLevelClient elasticsearchHighLevelRestClient = ElasticsearchRestClientFactory.createElasticsearchHighLevelRestClient(
+ ElasticsearchClient elasticsearchHighLevelRestClient = ElasticsearchRestClientFactory.createElasticsearchHighLevelRestClient(
"http", elasticsearchContainer.getHost() + ":" + elasticsearchContainer.getMappedPort(9200), "", "");
//When
- RestClient lowLevelClient = elasticsearchHighLevelRestClient.getLowLevelClient();
- Response get = lowLevelClient.performRequest(new Request("GET", "/_cat/indices"));
- String catIndexes = EntityUtils.toString(get.getEntity());
+ IndicesResponse indicesResponse = elasticsearchHighLevelRestClient
+ .cat()
+ .indices();
+
+ String catIndexes = indicesResponse.valueBody().stream().map(IndicesRecord::index).collect(Collectors.joining(","));
//Then
assertThat(catIndexes, containsString(ELASTIC_PREFIX + "-resourcetable-000001"));
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 22274d942d3..355925c596c 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
@@ -38,6 +38,17 @@ public class FhirResourceDaoR4SearchLastNAsyncIT extends BaseR4SearchLastN {
@Autowired
private ISearchDao mySearchDao;
+ @BeforeEach
+ public void enableAdvancedHSearchIndexing() {
+ myStorageSettings.setLastNEnabled(true);
+ myStorageSettings.setAdvancedHSearchIndexing(true);
+ }
+
+ @AfterEach
+ public void disableAdvancedHSearchIndex() {
+ myStorageSettings.setAdvancedHSearchIndexing(new JpaStorageSettings().isAdvancedHSearchIndexing());
+ }
+
@Override
@BeforeEach
public void before() throws Exception {
@@ -123,7 +134,7 @@ public class FhirResourceDaoR4SearchLastNAsyncIT extends BaseR4SearchLastN {
// The first chunked query should have a full complement of PIDs
StringBuilder firstQueryPattern = new StringBuilder(".*RES_ID in \\('[0-9]+'");
for (int pidIndex = 1; pidIndex < 50; pidIndex++) {
- firstQueryPattern.append(" , '[0-9]+'");
+ firstQueryPattern.append(",'[0-9]+'");
}
firstQueryPattern.append("\\).*");
assertThat(queries.get(4), matchesPattern(firstQueryPattern.toString()));
@@ -131,10 +142,10 @@ public class FhirResourceDaoR4SearchLastNAsyncIT extends BaseR4SearchLastN {
// the second chunked query should be padded with "-1".
StringBuilder secondQueryPattern = new StringBuilder(".*RES_ID in \\('[0-9]+'");
for (int pidIndex = 1; pidIndex < 25; pidIndex++) {
- secondQueryPattern.append(" , '[0-9]+'");
+ secondQueryPattern.append(",'[0-9]+'");
}
for (int pidIndex = 0; pidIndex < 25; pidIndex++) {
- secondQueryPattern.append(" , '-1'");
+ secondQueryPattern.append(",'-1'");
}
secondQueryPattern.append("\\).*");
assertThat(queries.get(5), matchesPattern(secondQueryPattern.toString()));
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 f9307f1cfb2..33dbef51e44 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,10 +1,11 @@
package ca.uhn.fhir.jpa.dao.r4;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
-import ca.uhn.fhir.jpa.model.dao.JpaPid;
+import ca.uhn.fhir.jpa.dao.IHSearchEventListener;
import ca.uhn.fhir.jpa.search.builder.SearchBuilder;
import ca.uhn.fhir.jpa.search.lastn.ElasticsearchSvcImpl;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
+import ca.uhn.fhir.jpa.test.util.TestHSearchEventDispatcher;
import ca.uhn.fhir.rest.param.ReferenceParam;
import ca.uhn.fhir.rest.param.TokenParam;
import org.hl7.fhir.instance.model.api.IIdType;
@@ -14,7 +15,11 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.ArgumentCaptor;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.io.IOException;
@@ -25,26 +30,37 @@ import java.util.UUID;
import java.util.stream.Collectors;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.matchesPattern;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@ExtendWith(SpringExtension.class)
public class FhirResourceDaoR4SearchLastNIT extends BaseR4SearchLastN {
+ private static final Logger ourLog = LoggerFactory.getLogger(FhirResourceDaoR4SearchLastNIT.class);
+
@BeforeEach
public void enableAdvancedHSearchIndexing() {
myStorageSettings.setLastNEnabled(true);
+ myStorageSettings.setAdvancedHSearchIndexing(true);
+ myHSearchEventDispatcher.register(mySearchEventListener);
+ ourLog.info("enableAdvancedHSearchIndexing finished. lastn {} advancedHSearchIndexing {}", myStorageSettings.isLastNEnabled(), myStorageSettings.isAdvancedHSearchIndexing());
}
@AfterEach
public void reset() {
SearchBuilder.setMaxPageSize50ForTest(false);
myStorageSettings.setStoreResourceInHSearchIndex(new JpaStorageSettings().isStoreResourceInHSearchIndex());
+ myStorageSettings.setAdvancedHSearchIndexing(new JpaStorageSettings().isAdvancedHSearchIndexing());
}
+ @Autowired
+ private TestHSearchEventDispatcher myHSearchEventDispatcher;
+
+ @Mock
+ private IHSearchEventListener mySearchEventListener;
+
+
+
@Test
public void testLastNChunking() {
@@ -76,28 +92,22 @@ public class FhirResourceDaoR4SearchLastNIT extends BaseR4SearchLastN {
.getSelectQueriesForCurrentThread()
.stream()
.map(t -> t.getSql(true, false))
- .collect(Collectors.toList());
+ .toList();
// Two chunked queries executed by the QueryIterator (in current thread) and two chunked queries to retrieve resources by PID.
assertEquals(4, queries.size());
// The first and third chunked queries should have a full complement of PIDs
StringBuilder firstQueryPattern = new StringBuilder(".*RES_ID IN \\('[0-9]+'");
- for (int pidIndex = 1; pidIndex < 50; pidIndex++) {
- firstQueryPattern.append(",'[0-9]+'");
- }
+ firstQueryPattern.append(",'[0-9]+'".repeat(49));
firstQueryPattern.append("\\).*");
assertThat(queries.get(0).toUpperCase().replaceAll(" , ", ","), matchesPattern(firstQueryPattern.toString()));
assertThat(queries.get(2).toUpperCase().replaceAll(" , ", ","), matchesPattern(firstQueryPattern.toString()));
// the second and fourth chunked queries should be padded with "-1".
StringBuilder secondQueryPattern = new StringBuilder(".*RES_ID IN \\('[0-9]+'");
- for (int pidIndex = 1; pidIndex < 25; pidIndex++) {
- secondQueryPattern.append(",'[0-9]+'");
- }
- for (int pidIndex = 0; pidIndex < 25; pidIndex++) {
- secondQueryPattern.append(",'-1'");
- }
+ secondQueryPattern.append(",'[0-9]+'".repeat(24));
+ secondQueryPattern.append(",'-1'".repeat(25));
secondQueryPattern.append("\\).*");
assertThat(queries.get(1).toUpperCase().replaceAll(" , ", ","), matchesPattern(secondQueryPattern.toString()));
assertThat(queries.get(3).toUpperCase().replaceAll(" , ", ","), matchesPattern(secondQueryPattern.toString()));
@@ -134,18 +144,12 @@ public class FhirResourceDaoR4SearchLastNIT extends BaseR4SearchLastN {
}
+ /**
+ * We pull the resources from Hibernate Search when LastN uses Hibernate Search
+ * Override the test verification to validate only one search was performed
+ */
void verifyResourcesLoadedFromElastic(List theObservationIds, List theResults) {
- List expectedArgumentPids = JpaPid.fromLongList(
- theObservationIds.stream().map(IIdType::getIdPartAsLong).collect(Collectors.toList())
- );
- ArgumentCaptor> actualPids = ArgumentCaptor.forClass(List.class);
- verify(myElasticsearchSvc, times(1)).getObservationResources(actualPids.capture());
- assertThat(actualPids.getValue(), is(expectedArgumentPids));
-
- List expectedObservationList = theObservationIds.stream()
- .map(id -> id.toUnqualifiedVersionless().getValue()).collect(Collectors.toList());
- assertEquals(expectedObservationList, theResults);
-
+ Mockito.verify(mySearchEventListener, Mockito.times(1))
+ .hsearchEvent(IHSearchEventListener.HSearchEventType.SEARCH);
}
-
}
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
deleted file mode 100644
index 0e547dca1f7..00000000000
--- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNUsingExtendedHSearchIndexAsyncIT.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package ca.uhn.fhir.jpa.dao.r4;
-
-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;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-/**
- * Run entire @see {@link FhirResourceDaoR4SearchLastNAsyncIT} test suite this time
- * using Extended HSearch index as search target
- */
-@ExtendWith(SpringExtension.class)
-public class FhirResourceDaoR4SearchLastNUsingExtendedHSearchIndexAsyncIT extends FhirResourceDaoR4SearchLastNAsyncIT {
-
- @BeforeEach
- public void enableAdvancedHSearchIndexing() {
- myStorageSettings.setLastNEnabled(true);
- myStorageSettings.setAdvancedHSearchIndexing(true);
- }
-
- @AfterEach
- public void disableAdvancedHSearchIndex() {
- 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
deleted file mode 100644
index 057ed57e48e..00000000000
--- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchLastNUsingExtendedHSearchIndexIT.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package ca.uhn.fhir.jpa.dao.r4;
-
-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;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-import java.util.List;
-
-/**
- * Run entire @see {@link FhirResourceDaoR4SearchLastNIT} test suite this time
- * using Extended HSearch index as search target.
- *
- * The other implementation is obsolete, and we can merge these someday.
- */
-@ExtendWith(SpringExtension.class)
-public class FhirResourceDaoR4SearchLastNUsingExtendedHSearchIndexIT extends FhirResourceDaoR4SearchLastNIT {
- private static final Logger ourLog = LoggerFactory.getLogger(FhirResourceDaoR4SearchLastNUsingExtendedHSearchIndexIT.class);
-
- @Autowired
- private TestHSearchEventDispatcher myHSearchEventDispatcher;
-
- @Mock
- private IHSearchEventListener mySearchEventListener;
-
-
- @BeforeEach
- public void enableAdvancedHSearchIndexing() {
- myStorageSettings.setLastNEnabled(true);
- myStorageSettings.setAdvancedHSearchIndexing(true);
- myHSearchEventDispatcher.register(mySearchEventListener);
- ourLog.info("enableAdvancedHSearchIndexing finished. lastn {} advancedHSearchIndexing {}", myStorageSettings.isLastNEnabled(), myStorageSettings.isAdvancedHSearchIndexing());
-
- }
-
- @AfterEach
- public void disableAdvancedHSearchIndex() {
- myStorageSettings.setAdvancedHSearchIndexing(new JpaStorageSettings().isAdvancedHSearchIndexing());
- }
-
- /**
- * We pull the resources from Hibernate Search when LastN uses Hibernate Search
- * Override the test verification to validate only one search was performed
- */
- @Override
- void verifyResourcesLoadedFromElastic(List theObservationIds, List theResults) {
- Mockito.verify(mySearchEventListener, Mockito.times(1))
- .hsearchEvent(IHSearchEventListener.HSearchEventType.SEARCH);
- }
-
-}
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 16f6a63cc19..b24e2b46ab8 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
@@ -104,7 +104,7 @@ import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
import javax.annotation.Nonnull;
-import javax.persistence.EntityManager;
+import jakarta.persistence.EntityManager;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
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 452217fe751..77d3a743f65 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
@@ -42,7 +42,7 @@ import org.springframework.test.context.ContextHierarchy;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.transaction.PlatformTransactionManager;
-import javax.persistence.EntityManager;
+import jakarta.persistence.EntityManager;
import java.util.Collections;
import java.util.List;
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
deleted file mode 100644
index 8d9d0d8c15e..00000000000
--- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/dao/r4/PersistObservationIndexedSearchParamLastNR4IT.java
+++ /dev/null
@@ -1,474 +0,0 @@
-package ca.uhn.fhir.jpa.dao.r4;
-
-import ca.uhn.fhir.context.FhirContext;
-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;
-import ca.uhn.fhir.jpa.model.entity.ResourceTable;
-import ca.uhn.fhir.jpa.search.lastn.ElasticsearchSvcImpl;
-import ca.uhn.fhir.jpa.search.lastn.json.CodeJson;
-import ca.uhn.fhir.jpa.search.lastn.json.ObservationJson;
-import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
-import ca.uhn.fhir.parser.IParser;
-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.TokenAndListParam;
-import ca.uhn.fhir.rest.param.TokenOrListParam;
-import ca.uhn.fhir.rest.param.TokenParam;
-import ca.uhn.fhir.test.utilities.docker.RequiresDocker;
-import com.google.common.base.Charsets;
-import org.apache.commons.io.IOUtils;
-import org.hl7.fhir.r4.model.Bundle;
-import org.hl7.fhir.r4.model.CodeableConcept;
-import org.hl7.fhir.r4.model.Coding;
-import org.hl7.fhir.r4.model.DateTimeType;
-import org.hl7.fhir.r4.model.IdType;
-import org.hl7.fhir.r4.model.Meta;
-import org.hl7.fhir.r4.model.Observation;
-import org.hl7.fhir.r4.model.Reference;
-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.api.extension.ExtendWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import javax.persistence.PersistenceContextType;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-
-@ExtendWith(SpringExtension.class)
-@RequiresDocker
-@ContextConfiguration(classes = TestR4ConfigWithElasticHSearch.class)
-@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
-public class PersistObservationIndexedSearchParamLastNR4IT {
-
- private final String SINGLE_SUBJECT_ID = "4567";
- private final String SINGLE_OBSERVATION_PID = "123";
- private final Date SINGLE_EFFECTIVEDTM = new Date();
- private final String SINGLE_OBSERVATION_CODE_TEXT = "Test Codeable Concept Field for Code";
- private final String CATEGORYFIRSTCODINGSYSTEM = "http://mycodes.org/fhir/observation-category";
- private final String FIRSTCATEGORYFIRSTCODINGCODE = "test-heart-rate";
- private final String CODEFIRSTCODINGSYSTEM = "http://mycodes.org/fhir/observation-code";
- private final String CODEFIRSTCODINGCODE = "test-code";
- @PersistenceContext(type = PersistenceContextType.TRANSACTION)
- protected EntityManager myEntityManager;
- @Autowired
- protected FhirContext myFhirCtx;
- @Autowired
- ObservationLastNIndexPersistSvc testObservationPersist;
- @Autowired
- private ElasticsearchSvcImpl elasticsearchSvc;
- @Autowired
- private IFhirSystemDao myDao;
- @Autowired
- private JpaStorageSettings myStorageSettings;
- private ReferenceAndListParam multiSubjectParams = null;
-
- @BeforeEach
- public void before() throws IOException {
- myStorageSettings.setLastNEnabled(true);
-
- elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_INDEX);
- elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX);
- elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_INDEX);
- elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX);
-
- }
-
- @AfterEach
- public void afterDisableLastN() {
- myStorageSettings.setLastNEnabled(new JpaStorageSettings().isLastNEnabled());
- }
-
- @Order(0)
- @Test
- public void testDeleteObservation() throws IOException {
- indexMultipleObservations();
- SearchParameterMap searchParameterMap = new SearchParameterMap();
- searchParameterMap.setLastNMax(100);
- List observationDocuments = elasticsearchSvc.executeLastNWithAllFieldsForTest(searchParameterMap, myFhirCtx);
- assertEquals(100, observationDocuments.size());
- // Check that fifth observation for fifth patient has been indexed.
- ObservationJson observation = elasticsearchSvc.getObservationDocument("55");
- assertNotNull(observation);
-
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_SUBJECT, multiSubjectParams);
- searchParameterMap.setLastNMax(10);
- List observationIdsOnly = elasticsearchSvc.executeLastN(searchParameterMap, myFhirCtx, 200);
- assertEquals(100, observationIdsOnly.size());
- assertTrue(observationIdsOnly.contains("55"));
-
- // Delete fifth observation for fifth patient.
- ResourceTable entity = new ResourceTable();
- entity.setId(55L);
- entity.setResourceType("Observation");
- entity.setVersionForUnitTest(0L);
-
- testObservationPersist.deleteObservationIndex(entity);
- elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_INDEX);
-
- // Confirm that observation was deleted.
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.setLastNMax(100);
- observationDocuments = elasticsearchSvc.executeLastNWithAllFieldsForTest(searchParameterMap, myFhirCtx);
- assertEquals(99, observationDocuments.size());
- observation = elasticsearchSvc.getObservationDocument("55");
- assertNull(observation);
-
- observationIdsOnly = elasticsearchSvc.executeLastN(searchParameterMap, myFhirCtx, 200);
- assertEquals(99, observationIdsOnly.size());
- assertTrue(!observationIdsOnly.contains("55"));
-
- }
-
-
-
- private void indexSingleObservation() throws IOException {
-
- Observation myObservation = new Observation();
- IdType observationID = new IdType("Observation", SINGLE_OBSERVATION_PID, "1");
- myObservation.setId(observationID);
- Reference subjectId = new Reference(SINGLE_SUBJECT_ID);
- myObservation.setSubject(subjectId);
- myObservation.setEffective(new DateTimeType(SINGLE_EFFECTIVEDTM));
-
- myObservation.setCategory(getCategoryCode());
-
- myObservation.setCode(getObservationCode());
-
- testObservationPersist.indexObservation(myObservation);
-
- elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_INDEX);
- elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX);
-
- }
-
- private List getCategoryCode() {
- // Add three CodeableConcepts for category
- List categoryConcepts = new ArrayList<>();
- // Create three codings and first category CodeableConcept
- List category = new ArrayList<>();
- CodeableConcept categoryCodeableConcept1 = new CodeableConcept().setText("Test Codeable Concept Field for first category");
- category.add(new Coding(CATEGORYFIRSTCODINGSYSTEM, FIRSTCATEGORYFIRSTCODINGCODE, "test-heart-rate display"));
- category.add(new Coding("http://myalternatecodes.org/fhir/observation-category", "test-alt-heart-rate", "test-alt-heart-rate display"));
- category.add(new Coding("http://mysecondaltcodes.org/fhir/observation-category", "test-2nd-alt-heart-rate", "test-2nd-alt-heart-rate display"));
- categoryCodeableConcept1.setCoding(category);
- categoryConcepts.add(categoryCodeableConcept1);
- // Create three codings and second category CodeableConcept
- List category2 = new ArrayList<>();
- CodeableConcept categoryCodeableConcept2 = new CodeableConcept().setText("Test Codeable Concept Field for for second category");
- category2.add(new Coding(CATEGORYFIRSTCODINGSYSTEM, "test-vital-signs", "test-vital-signs display"));
- category2.add(new Coding("http://myalternatecodes.org/fhir/observation-category", "test-alt-vitals", "test-alt-vitals display"));
- category2.add(new Coding("http://mysecondaltcodes.org/fhir/observation-category", "test-2nd-alt-vitals", "test-2nd-alt-vitals display"));
- categoryCodeableConcept2.setCoding(category2);
- categoryConcepts.add(categoryCodeableConcept2);
- // Create three codings and third category CodeableConcept
- List category3 = new ArrayList<>();
- CodeableConcept categoryCodeableConcept3 = new CodeableConcept().setText("Test Codeable Concept Field for third category");
- category3.add(new Coding(CATEGORYFIRSTCODINGSYSTEM, "test-vitals-panel", "test-vitals-panel display"));
- category3.add(new Coding("http://myalternatecodes.org/fhir/observation-category", "test-alt-vitals-panel", "test-alt-vitals-panel display"));
- category3.add(new Coding("http://mysecondaltcodes.org/fhir/observation-category", "test-2nd-alt-vitals-panel", "test-2nd-alt-vitals-panel display"));
- categoryCodeableConcept3.setCoding(category3);
- categoryConcepts.add(categoryCodeableConcept3);
- return categoryConcepts;
- }
-
- private CodeableConcept getObservationCode() {
- // Create CodeableConcept for Code with three codings.
- CodeableConcept codeableConceptField = new CodeableConcept().setText(SINGLE_OBSERVATION_CODE_TEXT);
- codeableConceptField.addCoding(new Coding(CODEFIRSTCODINGSYSTEM, CODEFIRSTCODINGCODE, "test-code display"));
- return codeableConceptField;
- }
-
- @Order(1)
- @Test
- public void testSampleBundleInTransaction() throws IOException {
- FhirContext myFhirCtx = FhirContext.forR4Cached();
-
- PathMatchingResourcePatternResolver provider = new PathMatchingResourcePatternResolver();
- final Resource[] bundleResources = provider.getResources("lastntestbundle.json");
- assertEquals(1, bundleResources.length);
-
- AtomicInteger index = new AtomicInteger();
-
- Arrays.stream(bundleResources).forEach(
- resource -> {
- index.incrementAndGet();
-
- InputStream resIs = null;
- String nextBundleString;
- try {
- resIs = resource.getInputStream();
- nextBundleString = IOUtils.toString(resIs, Charsets.UTF_8);
- } catch (IOException e) {
- return;
- } finally {
- try {
- if (resIs != null) {
- resIs.close();
- }
- } catch (final IOException ioe) {
- // ignore
- }
- }
-
- IParser parser = myFhirCtx.newJsonParser();
- Bundle bundle = parser.parseResource(Bundle.class, nextBundleString);
-
- myDao.transaction(null, bundle);
-
- }
- );
-
- elasticsearchSvc.refreshIndex("*");
-
- SearchParameterMap searchParameterMap = new SearchParameterMap();
-
- // execute Observation ID search - Composite Aggregation
- searchParameterMap.setLastNMax(1);
- List observationIdsOnly = elasticsearchSvc.executeLastN(searchParameterMap, myFhirCtx, 200);
-
- assertEquals(20, observationIdsOnly.size());
-
- searchParameterMap.setLastNMax(3);
- observationIdsOnly = elasticsearchSvc.executeLastN(searchParameterMap, myFhirCtx, 200);
-
- assertEquals(38, observationIdsOnly.size());
-
- }
-
- @Order(2)
- @Test
- public void testIndexObservationMultiple() throws IOException {
- indexMultipleObservations();
- SearchParameterMap searchParameterMap = new SearchParameterMap();
- searchParameterMap.setLastNMax(100);
- List observationDocuments = elasticsearchSvc.executeLastNWithAllFieldsForTest(searchParameterMap, myFhirCtx);
- assertEquals(100, observationDocuments.size());
-
- // Check that all observations were indexed.
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_SUBJECT, multiSubjectParams);
-
- searchParameterMap.setLastNMax(10);
-
- List observationIdsOnly = elasticsearchSvc.executeLastN(searchParameterMap, myFhirCtx, 200);
- assertEquals(100, observationIdsOnly.size());
-
- // Filter the results by category code.
- TokenParam categoryParam = new TokenParam(CATEGORYFIRSTCODINGSYSTEM, FIRSTCATEGORYFIRSTCODINGCODE);
- searchParameterMap.add(Observation.SP_CATEGORY, new TokenAndListParam().addAnd(new TokenOrListParam().addOr(categoryParam)));
-
-
- observationIdsOnly = elasticsearchSvc.executeLastN(searchParameterMap, myFhirCtx, 100);
-
- assertEquals(50, observationIdsOnly.size());
-
- }
-
- private void indexMultipleObservations() throws IOException {
-
- // Create two CodeableConcept values each for a Code with three codings.
- CodeableConcept codeableConceptField1 = new CodeableConcept().setText("Test Codeable Concept Field for First Code");
- codeableConceptField1.addCoding(new Coding(CODEFIRSTCODINGSYSTEM, "test-code-1", "test-code-1 display"));
- codeableConceptField1.addCoding(new Coding("http://myalternatecodes.org/fhir/observation-code", "test-alt-code-1", "test-alt-code-1 display"));
- codeableConceptField1.addCoding(new Coding("http://mysecondaltcodes.org/fhir/observation-code", "test-second-alt-code-1", "test-second-alt-code-1 display"));
-
- CodeableConcept codeableConceptField2 = new CodeableConcept().setText("Test Codeable Concept Field for Second Code");
- codeableConceptField2.addCoding(new Coding(CODEFIRSTCODINGSYSTEM, "test-code-2", "test-code-2 display"));
- codeableConceptField2.addCoding(new Coding("http://myalternatecodes.org/fhir/observation-code", "test-alt-code-2", "test-alt-code-2 display"));
- codeableConceptField2.addCoding(new Coding("http://mysecondaltcodes.org/fhir/observation-code", "test-second-alt-code-2", "test-second-alt-code-2 display"));
-
- // Create two CodeableConcept entities for category, each with three codings.
- List category1 = new ArrayList<>();
- // Create three codings and first category CodeableConcept
- category1.add(new Coding(CATEGORYFIRSTCODINGSYSTEM, FIRSTCATEGORYFIRSTCODINGCODE, "test-heart-rate display"));
- category1.add(new Coding("http://myalternatecodes.org/fhir/observation-category", "test-alt-heart-rate", "test-alt-heart-rate display"));
- category1.add(new Coding("http://mysecondaltcodes.org/fhir/observation-category", "test-2nd-alt-heart-rate", "test-2nd-alt-heart-rate display"));
- List categoryConcepts1 = new ArrayList<>();
- CodeableConcept categoryCodeableConcept1 = new CodeableConcept().setText("Test Codeable Concept Field for first category");
- categoryCodeableConcept1.setCoding(category1);
- categoryConcepts1.add(categoryCodeableConcept1);
- // Create three codings and second category CodeableConcept
- List category2 = new ArrayList<>();
- category2.add(new Coding(CATEGORYFIRSTCODINGSYSTEM, "test-vital-signs", "test-vital-signs display"));
- category2.add(new Coding("http://myalternatecodes.org/fhir/observation-category", "test-alt-vitals", "test-alt-vitals display"));
- category2.add(new Coding("http://mysecondaltcodes.org/fhir/observation-category", "test-2nd-alt-vitals", "test-2nd-alt-vitals display"));
- List categoryConcepts2 = new ArrayList<>();
- CodeableConcept categoryCodeableConcept2 = new CodeableConcept().setText("Test Codeable Concept Field for second category");
- categoryCodeableConcept2.setCoding(category2);
- categoryConcepts2.add(categoryCodeableConcept2);
-
- ReferenceOrListParam subjectParams = new ReferenceOrListParam();
- for (int patientCount = 0; patientCount < 10; patientCount++) {
-
- String subjectId = String.valueOf(patientCount);
-
- ReferenceParam subjectParam = new ReferenceParam("Patient", "", subjectId);
- subjectParams.addOr(subjectParam);
-
- for (int entryCount = 0; entryCount < 10; entryCount++) {
-
- Observation observation = new Observation();
- IdType observationId = new IdType("Observation", String.valueOf(entryCount + patientCount * 10), "1");
- observation.setId(observationId);
- Reference subject = new Reference(subjectId);
- observation.setSubject(subject);
-
- if (entryCount % 2 == 1) {
- observation.setCategory(categoryConcepts1);
- observation.setCode(codeableConceptField1);
- } else {
- observation.setCategory(categoryConcepts2);
- observation.setCode(codeableConceptField2);
- }
-
- Calendar observationDate = new GregorianCalendar();
- observationDate.add(Calendar.HOUR, -10 + entryCount);
- Date effectiveDtm = observationDate.getTime();
- observation.setEffective(new DateTimeType(effectiveDtm));
-
- testObservationPersist.indexObservation(observation);
- }
-
- }
-
- multiSubjectParams = new ReferenceAndListParam().addAnd(subjectParams);
-
- elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_INDEX);
- elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX);
-
- }
-
- @Order(3)
- @Test
- public void testIndexObservationSingle() throws IOException {
- indexSingleObservation();
- SearchParameterMap searchParameterMap = new SearchParameterMap();
- searchParameterMap.setLastNMax(10);
- List persistedObservationEntities = elasticsearchSvc.executeLastNWithAllFieldsForTest(searchParameterMap, myFhirCtx);
- assertEquals(1, persistedObservationEntities.size());
- ObservationJson persistedObservationEntity = persistedObservationEntities.get(0);
- assertEquals(SINGLE_SUBJECT_ID, persistedObservationEntity.getSubject());
- assertEquals(SINGLE_OBSERVATION_PID, persistedObservationEntity.getIdentifier());
- assertEquals(SINGLE_EFFECTIVEDTM, persistedObservationEntity.getEffectiveDtm());
-
- String observationCodeNormalizedId = persistedObservationEntity.getCode_concept_id();
-
- // List persistedObservationCodes = elasticsearchSvc.queryAllIndexedObservationCodesForTest();
- // assertEquals(1, persistedObservationCodes.size());
-
- // Check that we can retrieve code by hash value.
- String codeSystemHash = persistedObservationEntity.getCode_coding_code_system_hash();
- CodeJson persistedObservationCode = elasticsearchSvc.getObservationCodeDocument(codeSystemHash, null);
- assertNotNull(persistedObservationCode);
- assertEquals(observationCodeNormalizedId, persistedObservationCode.getCodeableConceptId());
- assertEquals(SINGLE_OBSERVATION_CODE_TEXT, persistedObservationCode.getCodeableConceptText());
-
- // Also confirm that we can retrieve code by text value.
- persistedObservationCode = elasticsearchSvc.getObservationCodeDocument(null, SINGLE_OBSERVATION_CODE_TEXT);
- assertNotNull(persistedObservationCode);
-
- searchParameterMap = new SearchParameterMap();
- ReferenceParam subjectParam = new ReferenceParam("Patient", "", SINGLE_SUBJECT_ID);
- searchParameterMap.add(Observation.SP_SUBJECT, new ReferenceAndListParam().addAnd(new ReferenceOrListParam().addOr(subjectParam)));
- TokenParam categoryParam = new TokenParam(CATEGORYFIRSTCODINGSYSTEM, FIRSTCATEGORYFIRSTCODINGCODE);
- searchParameterMap.add(Observation.SP_CATEGORY, new TokenAndListParam().addAnd(new TokenOrListParam().addOr(categoryParam)));
- TokenParam codeParam = new TokenParam(CODEFIRSTCODINGSYSTEM, CODEFIRSTCODINGCODE);
- searchParameterMap.add(Observation.SP_CODE, new TokenAndListParam().addAnd(new TokenOrListParam().addOr(codeParam)));
- searchParameterMap.setLastNMax(3);
-
- List observationIdsOnly = elasticsearchSvc.executeLastN(searchParameterMap, myFhirCtx, 100);
-
- assertEquals(1, observationIdsOnly.size());
- assertEquals(SINGLE_OBSERVATION_PID, observationIdsOnly.get(0));
- }
-
- @Order(4)
- @Test
- public void testUpdateObservation() throws IOException {
- indexSingleObservation();
- SearchParameterMap searchParameterMap = new SearchParameterMap();
- searchParameterMap.setLastNMax(10);
- ObservationJson observationIndexEntity = elasticsearchSvc.executeLastNWithAllFieldsForTest(searchParameterMap, myFhirCtx).get(0);
- assertEquals(SINGLE_OBSERVATION_PID, observationIndexEntity.getIdentifier());
- assertEquals(SINGLE_SUBJECT_ID, observationIndexEntity.getSubject());
- assertEquals(SINGLE_EFFECTIVEDTM, observationIndexEntity.getEffectiveDtm());
-
- searchParameterMap = new SearchParameterMap();
- ReferenceParam subjectParam = new ReferenceParam("Patient", "", SINGLE_SUBJECT_ID);
- searchParameterMap.add(Observation.SP_SUBJECT, new ReferenceAndListParam().addAnd(new ReferenceOrListParam().addOr(subjectParam)));
- TokenParam categoryParam = new TokenParam(CATEGORYFIRSTCODINGSYSTEM, FIRSTCATEGORYFIRSTCODINGCODE);
- searchParameterMap.add(Observation.SP_CATEGORY, new TokenAndListParam().addAnd(new TokenOrListParam().addOr(categoryParam)));
- TokenParam codeParam = new TokenParam(CODEFIRSTCODINGSYSTEM, CODEFIRSTCODINGCODE);
- searchParameterMap.add(Observation.SP_CODE, new TokenAndListParam().addAnd(new TokenOrListParam().addOr(codeParam)));
- searchParameterMap.setLastNMax(10);
-
- List observationIdsOnly = elasticsearchSvc.executeLastN(searchParameterMap, myFhirCtx, 200);
- assertEquals(1, observationIdsOnly.size());
- assertTrue(observationIdsOnly.contains(SINGLE_OBSERVATION_PID));
-
- // Update the Observation with a new Subject and effective date:
- Observation updatedObservation = new Observation();
- IdType observationId = new IdType("Observation", observationIndexEntity.getIdentifier(), "2");
- updatedObservation.setId(observationId);
- Reference subjectId = new Reference("1234");
- updatedObservation.setSubject(subjectId);
- DateTimeType newEffectiveDtm = new DateTimeType(new Date());
- updatedObservation.setEffective(newEffectiveDtm);
- updatedObservation.setCategory(getCategoryCode());
- updatedObservation.setCode(getObservationCode());
-
- testObservationPersist.indexObservation(updatedObservation);
- elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_INDEX);
-
- ObservationJson updatedObservationEntity = elasticsearchSvc.getObservationDocument(SINGLE_OBSERVATION_PID);
- assertEquals("1234", updatedObservationEntity.getSubject());
- assertEquals(newEffectiveDtm.getValue(), updatedObservationEntity.getEffectiveDtm());
-
- // Repeat earlier Elasticsearch query. This time, should return no matches.
- observationIdsOnly = elasticsearchSvc.executeLastN(searchParameterMap, myFhirCtx, 200);
- assertEquals(0, observationIdsOnly.size());
-
- // Try again with the new patient ID.
- searchParameterMap = new SearchParameterMap();
- subjectParam = new ReferenceParam("Patient", "", "1234");
- searchParameterMap.add(Observation.SP_SUBJECT, new ReferenceAndListParam().addAnd(new ReferenceOrListParam().addOr(subjectParam)));
- searchParameterMap.add(Observation.SP_CATEGORY, new TokenAndListParam().addAnd(new TokenOrListParam().addOr(categoryParam)));
- searchParameterMap.add(Observation.SP_CODE, new TokenAndListParam().addAnd(new TokenOrListParam().addOr(codeParam)));
- searchParameterMap.setLastNMax(10);
- observationIdsOnly = elasticsearchSvc.executeLastN(searchParameterMap, myFhirCtx, 200);
-
- // Should see the observation returned now.
- assertEquals(1, observationIdsOnly.size());
- assertTrue(observationIdsOnly.contains(SINGLE_OBSERVATION_PID));
-
- }
-
-
-}
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 bb9573636b7..6e25869547a 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
@@ -38,7 +38,7 @@ import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.support.TransactionTemplate;
import javax.annotation.Nonnull;
-import javax.persistence.EntityManager;
+import jakarta.persistence.EntityManager;
import java.util.List;
import java.util.Objects;
diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/lastn/LastNElasticsearchSvcMultipleObservationsIT.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/lastn/LastNElasticsearchSvcMultipleObservationsIT.java
deleted file mode 100644
index bd32380e149..00000000000
--- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/lastn/LastNElasticsearchSvcMultipleObservationsIT.java
+++ /dev/null
@@ -1,511 +0,0 @@
-package ca.uhn.fhir.jpa.search.lastn;
-
-import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.jpa.model.config.PartitionSettings;
-import ca.uhn.fhir.jpa.search.lastn.json.CodeJson;
-import ca.uhn.fhir.jpa.search.lastn.json.ObservationJson;
-import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
-import ca.uhn.fhir.jpa.test.config.TestElasticsearchContainerHelper;
-import ca.uhn.fhir.rest.param.DateAndListParam;
-import ca.uhn.fhir.rest.param.DateOrListParam;
-import ca.uhn.fhir.rest.param.DateParam;
-import ca.uhn.fhir.rest.param.ParamPrefixEnum;
-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.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.test.utilities.docker.RequiresDocker;
-import org.hl7.fhir.r4.model.Observation;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-import org.testcontainers.elasticsearch.ElasticsearchContainer;
-import org.testcontainers.junit.jupiter.Container;
-import org.testcontainers.junit.jupiter.Testcontainers;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.TEST_BASELINE_TIMESTAMP;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-@ExtendWith({SpringExtension.class})
-@RequiresDocker
-@Testcontainers
-public class LastNElasticsearchSvcMultipleObservationsIT {
-
- @Container
- public static ElasticsearchContainer elasticsearchContainer = TestElasticsearchContainerHelper.getEmbeddedElasticSearch();
- private static boolean indexLoaded = false;
- private final Map>> createdPatientObservationMap = new HashMap<>();
- private final FhirContext myFhirContext = FhirContext.forR4Cached();
- private ElasticsearchSvcImpl elasticsearchSvc;
-
- @BeforeEach
- public void before() throws IOException {
- PartitionSettings partitionSettings = new PartitionSettings();
- partitionSettings.setPartitioningEnabled(false);
- elasticsearchSvc = new ElasticsearchSvcImpl(partitionSettings, "http", elasticsearchContainer.getHost() + ":" + elasticsearchContainer.getMappedPort(9200), null, null);
-
- if (!indexLoaded) {
- createMultiplePatientsAndObservations();
- indexLoaded = true;
- }
- }
-
- @AfterEach
- public void after() throws IOException {
- elasticsearchSvc.close();
- }
-
- @Test
- public void testLastNAllPatientsQuery() {
-
- // execute Observation ID search (Composite Aggregation) last 3 observations for each patient
- SearchParameterMap searchParameterMap = new SearchParameterMap();
- IntStream.range(0, 10).forEach(index -> {
- ReferenceParam subjectParam = new ReferenceParam("Patient", "", String.valueOf(index));
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
- });
- searchParameterMap.setLastNMax(3);
-
- List observations = elasticsearchSvc.executeLastNWithAllFieldsForTest(searchParameterMap, myFhirContext);
-
- assertEquals(60, observations.size());
-
- // Observation documents should be grouped by subject, then by observation code, and then sorted by effective date/time
- // within each observation code. Verify the grouping by creating a nested Map.
- Map>> queriedPatientObservationMap = new HashMap<>();
- ObservationJson previousObservationJson = null;
- for (ObservationJson observationJson : observations) {
- assertNotNull(observationJson.getIdentifier());
- assertNotNull(observationJson.getSubject());
- assertNotNull(observationJson.getCode_concept_id());
- assertNotNull(observationJson.getEffectiveDtm());
- if (previousObservationJson == null) {
- ArrayList observationDates = new ArrayList<>();
- observationDates.add(observationJson.getEffectiveDtm());
- Map> codeObservationMap = new HashMap<>();
- codeObservationMap.put(observationJson.getCode_concept_id(), observationDates);
- queriedPatientObservationMap.put(observationJson.getSubject(), codeObservationMap);
- } else if (observationJson.getSubject().equals(previousObservationJson.getSubject())) {
- if (observationJson.getCode_concept_id().equals(previousObservationJson.getCode_concept_id())) {
- queriedPatientObservationMap.get(observationJson.getSubject()).get(observationJson.getCode_concept_id()).
- add(observationJson.getEffectiveDtm());
- } else {
- Map> codeObservationDateMap = queriedPatientObservationMap.get(observationJson.getSubject());
- // Ensure that code concept was not already retrieved out of order for this subject/patient.
- assertFalse(codeObservationDateMap.containsKey(observationJson.getCode_concept_id()));
- ArrayList observationDates = new ArrayList<>();
- observationDates.add(observationJson.getEffectiveDtm());
- codeObservationDateMap.put(observationJson.getCode_concept_id(), observationDates);
- }
- } else {
- // Ensure that subject/patient was not already retrieved out of order
- assertFalse(queriedPatientObservationMap.containsKey(observationJson.getSubject()));
- ArrayList observationDates = new ArrayList<>();
- observationDates.add(observationJson.getEffectiveDtm());
- Map> codeObservationMap = new HashMap<>();
- codeObservationMap.put(observationJson.getCode_concept_id(), observationDates);
- queriedPatientObservationMap.put(observationJson.getSubject(), codeObservationMap);
- }
- previousObservationJson = observationJson;
- }
-
- // Finally check that only the most recent effective date/time values were returned and in the correct order.
- for (String subjectId : queriedPatientObservationMap.keySet()) {
- Map> queriedObservationCodeMap = queriedPatientObservationMap.get(subjectId);
- Map> createdObservationCodeMap = createdPatientObservationMap.get(subjectId);
- for (String observationCode : queriedObservationCodeMap.keySet()) {
- List queriedObservationDates = queriedObservationCodeMap.get(observationCode);
- List createdObservationDates = createdObservationCodeMap.get(observationCode);
- for (int dateIdx = 0; dateIdx < queriedObservationDates.size(); dateIdx++) {
- assertEquals(createdObservationDates.get(dateIdx), queriedObservationDates.get(dateIdx));
- }
- }
- }
-
- }
-
- @Test
- public void testLastNMultiPatientMultiCodeHashMultiCategoryHash() {
- // Multiple Subject references
- SearchParameterMap searchParameterMap = new SearchParameterMap();
- ReferenceParam subjectParam1 = new ReferenceParam("Patient", "", "3");
- ReferenceParam subjectParam2 = new ReferenceParam("Patient", "", "5");
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam1, subjectParam2));
- TokenParam categoryParam1 = new TokenParam("http://mycodes.org/fhir/observation-category", "test-heart-rate");
- TokenParam categoryParam2 = new TokenParam("http://mycodes.org/fhir/observation-category", "test-vital-signs");
- searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(categoryParam1, categoryParam2));
- TokenParam codeParam1 = new TokenParam("http://mycodes.org/fhir/observation-code", "test-code-1");
- TokenParam codeParam2 = new TokenParam("http://mycodes.org/fhir/observation-code", "test-code-2");
- searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(codeParam1, codeParam2));
- searchParameterMap.setLastNMax(100);
-
- List observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
-
- assertEquals(20, observations.size());
-
- // Repeat with multiple Patient parameter
- searchParameterMap = new SearchParameterMap();
- ReferenceParam patientParam1 = new ReferenceParam("Patient", "", "8");
- ReferenceParam patientParam2 = new ReferenceParam("Patient", "", "6");
- searchParameterMap.add(Observation.SP_PATIENT, buildReferenceAndListParam(patientParam1, patientParam2));
- searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(categoryParam1, categoryParam2));
- searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(codeParam1, codeParam2));
- searchParameterMap.setLastNMax(100);
-
- observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
-
- assertEquals(20, observations.size());
-
- }
-
- private ReferenceAndListParam buildReferenceAndListParam(ReferenceParam... theReference) {
- ReferenceOrListParam myReferenceOrListParam = new ReferenceOrListParam();
- for (ReferenceParam referenceParam : theReference) {
- myReferenceOrListParam.addOr(referenceParam);
- }
- return new ReferenceAndListParam().addAnd(myReferenceOrListParam);
- }
-
- private TokenAndListParam buildTokenAndListParam(TokenParam... theToken) {
- TokenOrListParam myTokenOrListParam = new TokenOrListParam();
- for (TokenParam tokenParam : theToken) {
- myTokenOrListParam.addOr(tokenParam);
- }
- return new TokenAndListParam().addAnd(myTokenOrListParam);
- }
-
- @Test
- public void testLastNCodeCodeOnlyCategoryCodeOnly() {
- // Include subject
- SearchParameterMap searchParameterMap = new SearchParameterMap();
- ReferenceParam subjectParam = new ReferenceParam("Patient", "", "3");
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
- TokenParam categoryParam = new TokenParam(null, "test-heart-rate");
- searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(categoryParam));
- TokenParam codeParam = new TokenParam(null, "test-code-1");
- searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(codeParam));
- searchParameterMap.setLastNMax(100);
-
- List observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
-
- assertEquals(5, observations.size());
-
- }
-
- @Test
- public void testLastNCodeSystemOnlyCategorySystemOnly() {
- // Include subject and patient
- SearchParameterMap searchParameterMap = new SearchParameterMap();
- ReferenceParam subjectParam = new ReferenceParam("Patient", "", "3");
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
- TokenParam categoryParam = new TokenParam("http://mycodes.org/fhir/observation-category", null);
- searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(categoryParam));
- TokenParam codeParam = new TokenParam("http://mycodes.org/fhir/observation-code", null);
- searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(codeParam));
- searchParameterMap.setLastNMax(100);
-
- List observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
-
- assertEquals(10, observations.size());
- }
-
- @Test
- public void testLastNCodeCodeTextCategoryTextOnly() {
- SearchParameterMap searchParameterMap = new SearchParameterMap();
- ReferenceParam subjectParam = new ReferenceParam("Patient", "", "3");
-
- // Check case match
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
- TokenParam categoryParam = new TokenParam("Heart");
- categoryParam.setModifier(TokenParamModifier.TEXT);
- searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(categoryParam));
- TokenParam codeParam = new TokenParam("Code1");
- codeParam.setModifier(TokenParamModifier.TEXT);
- searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(codeParam));
- searchParameterMap.setLastNMax(100);
-
- List observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
-
- assertEquals(5, observations.size());
-
- // Check case not match
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
- categoryParam = new TokenParam("heart");
- categoryParam.setModifier(TokenParamModifier.TEXT);
- searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(categoryParam));
- codeParam = new TokenParam("code1");
- codeParam.setModifier(TokenParamModifier.TEXT);
- searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(codeParam));
- searchParameterMap.setLastNMax(100);
-
- observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
-
- assertEquals(5, observations.size());
-
- // Check hyphenated strings
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
- categoryParam = new TokenParam("heart-rate");
- categoryParam.setModifier(TokenParamModifier.TEXT);
- searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(categoryParam));
- codeParam = new TokenParam("code1");
- codeParam.setModifier(TokenParamModifier.TEXT);
- searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(codeParam));
- searchParameterMap.setLastNMax(100);
-
- observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
-
- assertEquals(5, observations.size());
-
- // Check partial strings
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
- categoryParam = new TokenParam("hear");
- categoryParam.setModifier(TokenParamModifier.TEXT);
- searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(categoryParam));
- codeParam = new TokenParam("1-obs");
- codeParam.setModifier(TokenParamModifier.TEXT);
- searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(codeParam));
- searchParameterMap.setLastNMax(100);
-
- observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
-
- assertEquals(5, observations.size());
-
- }
-
- @Test
- public void testLastNNoMatchQueries() {
-
- ReferenceParam validPatientParam = new ReferenceParam("Patient", "", "9");
- TokenParam validCategoryCodeParam = new TokenParam("http://mycodes.org/fhir/observation-category", "test-heart-rate");
- TokenParam validObservationCodeParam = new TokenParam("http://mycodes.org/fhir/observation-code", "test-code-1");
- DateParam validDateParam = new DateParam(ParamPrefixEnum.EQUAL, new Date(TEST_BASELINE_TIMESTAMP - (9 * 3600 * 1000)));
-
- // Ensure that valid parameters are indeed valid
- SearchParameterMap searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_PATIENT, buildReferenceAndListParam(validPatientParam));
- searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(validCategoryCodeParam));
- searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(validObservationCodeParam));
- searchParameterMap.add(Observation.SP_DATE, validDateParam);
- searchParameterMap.setLastNMax(100);
-
- List observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
- assertEquals(1, observations.size());
-
- // Invalid Patient
- searchParameterMap = new SearchParameterMap();
- ReferenceParam patientParam = new ReferenceParam("Patient", "", "10");
- searchParameterMap.add(Observation.SP_PATIENT, buildReferenceAndListParam(patientParam));
- searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(validCategoryCodeParam));
- searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(validObservationCodeParam));
- searchParameterMap.add(Observation.SP_DATE, validDateParam);
- searchParameterMap.setLastNMax(100);
-
- observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
- assertEquals(0, observations.size());
-
- // Invalid subject
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(patientParam));
- searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(validCategoryCodeParam));
- searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(validObservationCodeParam));
- searchParameterMap.add(Observation.SP_DATE, validDateParam);
- searchParameterMap.setLastNMax(100);
-
- observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
- assertEquals(0, observations.size());
-
- // Invalid observation code
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(validPatientParam));
- searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(validCategoryCodeParam));
- TokenParam codeParam = new TokenParam("http://mycodes.org/fhir/observation-code", "test-code-999");
- searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(codeParam));
- searchParameterMap.add(Observation.SP_DATE, validDateParam);
- searchParameterMap.setLastNMax(100);
-
- observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
- assertEquals(0, observations.size());
-
- // Invalid category code
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(validPatientParam));
- TokenParam categoryParam = new TokenParam("http://mycodes.org/fhir/observation-category", "test-not-a-category");
- searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(categoryParam));
- searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(validObservationCodeParam));
- searchParameterMap.add(Observation.SP_DATE, validDateParam);
- searchParameterMap.setLastNMax(100);
-
- observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
- assertEquals(0, observations.size());
-
- // Invalid date
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(validPatientParam));
- searchParameterMap.add(Observation.SP_CATEGORY, buildTokenAndListParam(validCategoryCodeParam));
- searchParameterMap.add(Observation.SP_CODE, buildTokenAndListParam(validObservationCodeParam));
- searchParameterMap.add(Observation.SP_DATE, new DateParam(ParamPrefixEnum.GREATERTHAN, TEST_BASELINE_TIMESTAMP));
- searchParameterMap.setLastNMax(100);
- observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
- assertEquals(0, observations.size());
-
- }
-
- @Test
- public void testLastNEffectiveDates() {
- Date highDate = new Date(TEST_BASELINE_TIMESTAMP - (3600 * 1000));
- Date lowDate = new Date(TEST_BASELINE_TIMESTAMP - (10 * 3600 * 1000));
-
- SearchParameterMap searchParameterMap = new SearchParameterMap();
- ReferenceParam subjectParam = new ReferenceParam("Patient", "", "3");
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
- DateParam dateParam = new DateParam(ParamPrefixEnum.EQUAL, lowDate);
- searchParameterMap.add(Observation.SP_DATE, dateParam);
- searchParameterMap.setLastNMax(100);
- List observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
- assertEquals(1, observations.size());
-
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
- dateParam = new DateParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, lowDate);
- searchParameterMap.add(Observation.SP_DATE, dateParam);
- searchParameterMap.setLastNMax(100);
- observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
- assertEquals(10, observations.size());
-
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
- dateParam = new DateParam(ParamPrefixEnum.GREATERTHAN, lowDate);
- searchParameterMap.add(Observation.SP_DATE, dateParam);
- searchParameterMap.setLastNMax(100);
- observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
- assertEquals(9, observations.size());
-
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
- dateParam = new DateParam(ParamPrefixEnum.STARTS_AFTER, lowDate);
- searchParameterMap.add(Observation.SP_DATE, dateParam);
- searchParameterMap.setLastNMax(100);
- observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
- assertEquals(9, observations.size());
-
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
- dateParam = new DateParam(ParamPrefixEnum.LESSTHAN_OR_EQUALS, highDate);
- searchParameterMap.add(Observation.SP_DATE, dateParam);
- searchParameterMap.setLastNMax(100);
- observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
- assertEquals(10, observations.size());
-
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
- dateParam = new DateParam(ParamPrefixEnum.LESSTHAN, highDate);
- searchParameterMap.add(Observation.SP_DATE, dateParam);
- searchParameterMap.setLastNMax(100);
- observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
- assertEquals(9, observations.size());
-
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
- dateParam = new DateParam(ParamPrefixEnum.ENDS_BEFORE, highDate);
- searchParameterMap.add(Observation.SP_DATE, dateParam);
- searchParameterMap.setLastNMax(100);
- observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
- assertEquals(9, observations.size());
-
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
- DateParam startDateParam = new DateParam(ParamPrefixEnum.GREATERTHAN, new Date(TEST_BASELINE_TIMESTAMP - (4 * 3600 * 1000)));
- DateAndListParam dateAndListParam = new DateAndListParam();
- dateAndListParam.addAnd(new DateOrListParam().addOr(startDateParam));
- dateParam = new DateParam(ParamPrefixEnum.LESSTHAN_OR_EQUALS, highDate);
- dateAndListParam.addAnd(new DateOrListParam().addOr(dateParam));
- searchParameterMap.add(Observation.SP_DATE, dateAndListParam);
- searchParameterMap.setLastNMax(100);
- observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
- assertEquals(3, observations.size());
-
- searchParameterMap = new SearchParameterMap();
- searchParameterMap.add(Observation.SP_SUBJECT, buildReferenceAndListParam(subjectParam));
- startDateParam = new DateParam(ParamPrefixEnum.GREATERTHAN, new Date(TEST_BASELINE_TIMESTAMP - (4 * 3600 * 1000)));
- searchParameterMap.add(Observation.SP_DATE, startDateParam);
- dateParam = new DateParam(ParamPrefixEnum.LESSTHAN, lowDate);
- searchParameterMap.add(Observation.SP_DATE, dateParam);
- searchParameterMap.setLastNMax(100);
- observations = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
- assertEquals(0, observations.size());
-
- }
-
- private void createMultiplePatientsAndObservations() throws IOException {
- List patientIds = IntStream.range(0, 10).boxed().collect(Collectors.toList());
- List observations = LastNTestDataGenerator.createMultipleObservationJson(patientIds);
-
- observations.forEach(observation -> {
- CodeJson codeJson = observation.getCode();
- assertTrue(elasticsearchSvc.createOrUpdateObservationCodeIndex(codeJson.getCodeableConceptId(), codeJson));
- assertTrue(elasticsearchSvc.createOrUpdateObservationIndex(observation.getIdentifier(), observation));
-
- String subject = observation.getSubject();
- if (createdPatientObservationMap.containsKey(subject)) {
- Map> observationCodeMap = createdPatientObservationMap.get(subject);
- if (observationCodeMap.containsKey(observation.getCode_concept_id())) {
- List observationDates = observationCodeMap.get(observation.getCode_concept_id());
- observationDates.add(observation.getEffectiveDtm());
- observationDates.sort(Collections.reverseOrder());
- } else {
- ArrayList observationDates = new ArrayList<>();
- observationDates.add(observation.getEffectiveDtm());
- observationCodeMap.put(observation.getCode_concept_id(), observationDates);
- }
- } else {
- ArrayList observationDates = new ArrayList<>();
- observationDates.add(observation.getEffectiveDtm());
- Map> codeObservationMap = new HashMap<>();
- codeObservationMap.put(observation.getCode_concept_id(), observationDates);
- createdPatientObservationMap.put(subject, codeObservationMap);
- }
- });
-
- elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_INDEX);
- elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX);
-
- }
-
- @Test
- public void testLastNNoParamsQuery() {
- SearchParameterMap searchParameterMap = new SearchParameterMap();
- searchParameterMap.setLastNMax(1);
- List observations = elasticsearchSvc.executeLastNWithAllFieldsForTest(searchParameterMap, myFhirContext);
-
- assertEquals(2, observations.size());
-
- String observationCode1 = observations.get(0).getCode_coding_code_system_hash();
- String observationCode2 = observations.get(1).getCode_coding_code_system_hash();
-
- assertNotEquals(observationCode1, observationCode2);
-
- }
-
-}
diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/lastn/LastNElasticsearchSvcSingleObservationIT.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/lastn/LastNElasticsearchSvcSingleObservationIT.java
deleted file mode 100644
index 962241e227b..00000000000
--- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/lastn/LastNElasticsearchSvcSingleObservationIT.java
+++ /dev/null
@@ -1,262 +0,0 @@
-package ca.uhn.fhir.jpa.search.lastn;
-
-import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.jpa.model.config.PartitionSettings;
-import ca.uhn.fhir.jpa.model.util.CodeSystemHash;
-import ca.uhn.fhir.jpa.search.lastn.json.CodeJson;
-import ca.uhn.fhir.jpa.search.lastn.json.ObservationJson;
-import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
-import ca.uhn.fhir.jpa.test.config.TestElasticsearchContainerHelper;
-import ca.uhn.fhir.model.dstu2.resource.Observation;
-import ca.uhn.fhir.rest.param.DateParam;
-import ca.uhn.fhir.rest.param.ParamPrefixEnum;
-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.TokenAndListParam;
-import ca.uhn.fhir.rest.param.TokenOrListParam;
-import ca.uhn.fhir.rest.param.TokenParam;
-import ca.uhn.fhir.test.utilities.docker.RequiresDocker;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.springframework.test.context.junit.jupiter.SpringExtension;
-import org.testcontainers.elasticsearch.ElasticsearchContainer;
-import org.testcontainers.junit.jupiter.Container;
-import org.testcontainers.junit.jupiter.Testcontainers;
-
-import java.io.IOException;
-import java.util.Date;
-import java.util.List;
-
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.CATEGORYFIRSTCODINGSYSTEM;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.CATEGORYSECONDCODINGSYSTEM;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.CATEGORYTHIRDCODINGSYSTEM;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.CODEFIRSTCODINGCODE;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.CODEFIRSTCODINGDISPLAY;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.CODEFIRSTCODINGSYSTEM;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.FIRSTCATEGORYFIRSTCODINGCODE;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.FIRSTCATEGORYFIRSTCODINGDISPLAY;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.FIRSTCATEGORYSECONDCODINGCODE;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.FIRSTCATEGORYSECONDCODINGDISPLAY;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.FIRSTCATEGORYTEXT;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.FIRSTCATEGORYTHIRDCODINGCODE;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.FIRSTCATEGORYTHIRDCODINGDISPLAY;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.OBSERVATIONSINGLECODEID;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.OBSERVATION_CODE_CONCEPT_TEXT_1;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.SECONDCATEGORYFIRSTCODINGCODE;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.SECONDCATEGORYFIRSTCODINGDISPLAY;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.SECONDCATEGORYSECONDCODINGCODE;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.SECONDCATEGORYSECONDCODINGDISPLAY;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.SECONDCATEGORYTEXT;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.SECONDCATEGORYTHIRDCODINGCODE;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.SECONDCATEGORYTHIRDCODINGDISPLAY;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.SINGLE_OBSERVATION_RESOURCE_PID;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.SINGLE_OBSERVATION_SUBJECT_ID;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.TEST_BASELINE_TIMESTAMP;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.THIRDCATEGORYFIRSTCODINGCODE;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.THIRDCATEGORYFIRSTCODINGDISPLAY;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.THIRDCATEGORYSECONDCODINGCODE;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.THIRDCATEGORYSECONDCODINGDISPLAY;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.THIRDCATEGORYTEXT;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.THIRDCATEGORYTHIRDCODINGCODE;
-import static ca.uhn.fhir.jpa.search.lastn.LastNTestDataGenerator.THIRDCATEGORYTHIRDCODINGDISPLAY;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-@ExtendWith(SpringExtension.class)
-@RequiresDocker
-@Testcontainers
-public class LastNElasticsearchSvcSingleObservationIT {
-
- private final FhirContext myFhirContext = FhirContext.forR4Cached();
-
- ElasticsearchSvcImpl elasticsearchSvc;
-
- @Container
- public static ElasticsearchContainer elasticsearchContainer = TestElasticsearchContainerHelper.getEmbeddedElasticSearch();
-
-
- @BeforeEach
- public void before() {
- PartitionSettings partitionSettings = new PartitionSettings();
- partitionSettings.setPartitioningEnabled(false);
- elasticsearchSvc = new ElasticsearchSvcImpl(partitionSettings, "http", elasticsearchContainer.getHost() + ":" + elasticsearchContainer.getMappedPort(9200), "", "");
- }
-
- @AfterEach
- public void after() throws IOException {
- elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_INDEX);
- elasticsearchSvc.deleteAllDocumentsForTest(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX);
- elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_INDEX);
- elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX);
- }
-
- @Test
- public void testSingleObservationQuery() throws IOException {
-
- // Create test observation
- ObservationJson indexedObservation = LastNTestDataGenerator.createSingleObservationJson();
- assertTrue(elasticsearchSvc.createOrUpdateObservationIndex(SINGLE_OBSERVATION_RESOURCE_PID, indexedObservation));
- assertTrue(elasticsearchSvc.createOrUpdateObservationCodeIndex(OBSERVATIONSINGLECODEID, indexedObservation.getCode()));
-
- elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_INDEX);
- elasticsearchSvc.refreshIndex(ElasticsearchSvcImpl.OBSERVATION_CODE_INDEX);
-
- SearchParameterMap searchParameterMap = new SearchParameterMap();
- ReferenceParam subjectParam = new ReferenceParam("Patient", "", SINGLE_OBSERVATION_SUBJECT_ID);
- searchParameterMap.add(Observation.SP_SUBJECT, new ReferenceAndListParam().addAnd(new ReferenceOrListParam().addOr(subjectParam)));
- TokenParam categoryParam = new TokenParam(CATEGORYFIRSTCODINGSYSTEM, FIRSTCATEGORYFIRSTCODINGCODE);
- searchParameterMap.add(Observation.SP_CATEGORY, new TokenAndListParam().addAnd(new TokenOrListParam().addOr(categoryParam)));
- TokenParam codeParam = new TokenParam(CODEFIRSTCODINGSYSTEM, CODEFIRSTCODINGCODE);
- searchParameterMap.add(Observation.SP_CODE, new TokenAndListParam().addAnd(new TokenOrListParam().addOr(codeParam)));
- searchParameterMap.add(Observation.SP_DATE, new DateParam(ParamPrefixEnum.EQUAL, new Date(TEST_BASELINE_TIMESTAMP)));
-
- searchParameterMap.setLastNMax(3);
-
- // execute Observation ID search
- List observationIdsOnly = elasticsearchSvc.executeLastN(searchParameterMap, myFhirContext, 100);
-
- assertEquals(1, observationIdsOnly.size());
- assertEquals(SINGLE_OBSERVATION_RESOURCE_PID, observationIdsOnly.get(0));
-
- // execute Observation search for all search fields
- List observations = elasticsearchSvc.executeLastNWithAllFieldsForTest(searchParameterMap, myFhirContext);
-
- validateFullObservationSearch(observations);
- }
-
- private void validateFullObservationSearch(List observations) throws IOException {
-
- assertEquals(1, observations.size());
- ObservationJson observation = observations.get(0);
- assertEquals(SINGLE_OBSERVATION_RESOURCE_PID, observation.getIdentifier());
-
- assertEquals(SINGLE_OBSERVATION_SUBJECT_ID, observation.getSubject());
- assertEquals(SINGLE_OBSERVATION_RESOURCE_PID, observation.getIdentifier());
- assertEquals(new Date(TEST_BASELINE_TIMESTAMP), observation.getEffectiveDtm());
- assertEquals(OBSERVATIONSINGLECODEID, observation.getCode_concept_id());
-
- List category_concept_text_values = observation.getCategory_concept_text();
- assertEquals(3, category_concept_text_values.size());
- assertEquals(FIRSTCATEGORYTEXT, category_concept_text_values.get(0));
- assertEquals(SECONDCATEGORYTEXT, category_concept_text_values.get(1));
- assertEquals(THIRDCATEGORYTEXT, category_concept_text_values.get(2));
-
- List> category_codings_systems = observation.getCategory_coding_system();
- assertEquals(3, category_codings_systems.size());
- List category_coding_systems = category_codings_systems.get(0);
- assertEquals(3, category_coding_systems.size());
- assertEquals(CATEGORYFIRSTCODINGSYSTEM, category_coding_systems.get(0));
- assertEquals(CATEGORYSECONDCODINGSYSTEM, category_coding_systems.get(1));
- assertEquals(CATEGORYTHIRDCODINGSYSTEM, category_coding_systems.get(2));
- category_coding_systems = category_codings_systems.get(1);
- assertEquals(3, category_coding_systems.size());
- assertEquals(CATEGORYFIRSTCODINGSYSTEM, category_coding_systems.get(0));
- assertEquals(CATEGORYSECONDCODINGSYSTEM, category_coding_systems.get(1));
- assertEquals(CATEGORYTHIRDCODINGSYSTEM, category_coding_systems.get(2));
- category_coding_systems = category_codings_systems.get(2);
- assertEquals(3, category_coding_systems.size());
- assertEquals(CATEGORYFIRSTCODINGSYSTEM, category_coding_systems.get(0));
- assertEquals(CATEGORYSECONDCODINGSYSTEM, category_coding_systems.get(1));
- assertEquals(CATEGORYTHIRDCODINGSYSTEM, category_coding_systems.get(2));
-
- List> category_codings_codes = observation.getCategory_coding_code();
- assertEquals(3, category_codings_codes.size());
- List category_coding_codes = category_codings_codes.get(0);
- assertEquals(3, category_coding_codes.size());
- assertEquals(FIRSTCATEGORYFIRSTCODINGCODE, category_coding_codes.get(0));
- assertEquals(FIRSTCATEGORYSECONDCODINGCODE, category_coding_codes.get(1));
- assertEquals(FIRSTCATEGORYTHIRDCODINGCODE, category_coding_codes.get(2));
- category_coding_codes = category_codings_codes.get(1);
- assertEquals(3, category_coding_codes.size());
- assertEquals(SECONDCATEGORYFIRSTCODINGCODE, category_coding_codes.get(0));
- assertEquals(SECONDCATEGORYSECONDCODINGCODE, category_coding_codes.get(1));
- assertEquals(SECONDCATEGORYTHIRDCODINGCODE, category_coding_codes.get(2));
- category_coding_codes = category_codings_codes.get(2);
- assertEquals(3, category_coding_codes.size());
- assertEquals(THIRDCATEGORYFIRSTCODINGCODE, category_coding_codes.get(0));
- assertEquals(THIRDCATEGORYSECONDCODINGCODE, category_coding_codes.get(1));
- assertEquals(THIRDCATEGORYTHIRDCODINGCODE, category_coding_codes.get(2));
-
- List> category_codings_displays = observation.getCategory_coding_display();
- assertEquals(3, category_codings_displays.size());
- List category_coding_displays = category_codings_displays.get(0);
- assertEquals(FIRSTCATEGORYFIRSTCODINGDISPLAY, category_coding_displays.get(0));
- assertEquals(FIRSTCATEGORYSECONDCODINGDISPLAY, category_coding_displays.get(1));
- assertEquals(FIRSTCATEGORYTHIRDCODINGDISPLAY, category_coding_displays.get(2));
- category_coding_displays = category_codings_displays.get(1);
- assertEquals(3, category_coding_displays.size());
- assertEquals(SECONDCATEGORYFIRSTCODINGDISPLAY, category_coding_displays.get(0));
- assertEquals(SECONDCATEGORYSECONDCODINGDISPLAY, category_coding_displays.get(1));
- assertEquals(SECONDCATEGORYTHIRDCODINGDISPLAY, category_coding_displays.get(2));
- category_coding_displays = category_codings_displays.get(2);
- assertEquals(3, category_coding_displays.size());
- assertEquals(THIRDCATEGORYFIRSTCODINGDISPLAY, category_coding_displays.get(0));
- assertEquals(THIRDCATEGORYSECONDCODINGDISPLAY, category_coding_displays.get(1));
- assertEquals(THIRDCATEGORYTHIRDCODINGDISPLAY, category_coding_displays.get(2));
-
- List> category_codings_code_system_hashes = observation.getCategory_coding_code_system_hash();
- assertEquals(3, category_codings_code_system_hashes.size());
- List category_coding_code_system_hashes = category_codings_code_system_hashes.get(0);
- assertEquals(String.valueOf(CodeSystemHash.hashCodeSystem(CATEGORYFIRSTCODINGSYSTEM, FIRSTCATEGORYFIRSTCODINGCODE)), category_coding_code_system_hashes.get(0));
- assertEquals(String.valueOf(CodeSystemHash.hashCodeSystem(CATEGORYSECONDCODINGSYSTEM, FIRSTCATEGORYSECONDCODINGCODE)), category_coding_code_system_hashes.get(1));
- assertEquals(String.valueOf(CodeSystemHash.hashCodeSystem(CATEGORYTHIRDCODINGSYSTEM, FIRSTCATEGORYTHIRDCODINGCODE)), category_coding_code_system_hashes.get(2));
- category_coding_code_system_hashes = category_codings_code_system_hashes.get(1);
- assertEquals(3, category_coding_code_system_hashes.size());
- assertEquals(String.valueOf(CodeSystemHash.hashCodeSystem(CATEGORYFIRSTCODINGSYSTEM, SECONDCATEGORYFIRSTCODINGCODE)), category_coding_code_system_hashes.get(0));
- assertEquals(String.valueOf(CodeSystemHash.hashCodeSystem(CATEGORYSECONDCODINGSYSTEM, SECONDCATEGORYSECONDCODINGCODE)), category_coding_code_system_hashes.get(1));
- assertEquals(String.valueOf(CodeSystemHash.hashCodeSystem(CATEGORYTHIRDCODINGSYSTEM, SECONDCATEGORYTHIRDCODINGCODE)), category_coding_code_system_hashes.get(2));
- category_coding_code_system_hashes = category_codings_code_system_hashes.get(2);
- assertEquals(3, category_coding_code_system_hashes.size());
- assertEquals(String.valueOf(CodeSystemHash.hashCodeSystem(CATEGORYFIRSTCODINGSYSTEM, THIRDCATEGORYFIRSTCODINGCODE)), category_coding_code_system_hashes.get(0));
- assertEquals(String.valueOf(CodeSystemHash.hashCodeSystem(CATEGORYSECONDCODINGSYSTEM, THIRDCATEGORYSECONDCODINGCODE)), category_coding_code_system_hashes.get(1));
- assertEquals(String.valueOf(CodeSystemHash.hashCodeSystem(CATEGORYTHIRDCODINGSYSTEM, THIRDCATEGORYTHIRDCODINGCODE)), category_coding_code_system_hashes.get(2));
-
- String code_concept_text_values = observation.getCode_concept_text();
- assertEquals(OBSERVATION_CODE_CONCEPT_TEXT_1, code_concept_text_values);
-
- String code_coding_systems = observation.getCode_coding_system();
- assertEquals(CODEFIRSTCODINGSYSTEM, code_coding_systems);
-
- String code_coding_codes = observation.getCode_coding_code();
- assertEquals(CODEFIRSTCODINGCODE, code_coding_codes);
-
- String code_coding_display = observation.getCode_coding_display();
- assertEquals(CODEFIRSTCODINGDISPLAY, code_coding_display);
-
- String code_coding_code_system_hash = observation.getCode_coding_code_system_hash();
- assertEquals(String.valueOf(CodeSystemHash.hashCodeSystem(CODEFIRSTCODINGSYSTEM, CODEFIRSTCODINGCODE)), code_coding_code_system_hash);
-
- // Retrieve all Observation codes
- List codes = elasticsearchSvc.queryAllIndexedObservationCodesForTest();
- assertEquals(1, codes.size());
- CodeJson persistedObservationCode = codes.get(0);
-
- String persistedCodeConceptID = persistedObservationCode.getCodeableConceptId();
- assertEquals(OBSERVATIONSINGLECODEID, persistedCodeConceptID);
- String persistedCodeConceptText = persistedObservationCode.getCodeableConceptText();
- assertEquals(OBSERVATION_CODE_CONCEPT_TEXT_1, persistedCodeConceptText);
-
- List persistedCodeCodingSystems = persistedObservationCode.getCoding_system();
- assertEquals(1, persistedCodeCodingSystems.size());
- assertEquals(CODEFIRSTCODINGSYSTEM, persistedCodeCodingSystems.get(0));
-
- List persistedCodeCodingCodes = persistedObservationCode.getCoding_code();
- assertEquals(1, persistedCodeCodingCodes.size());
- assertEquals(CODEFIRSTCODINGCODE, persistedCodeCodingCodes.get(0));
-
- List persistedCodeCodingDisplays = persistedObservationCode.getCoding_display();
- assertEquals(1, persistedCodeCodingDisplays.size());
- assertEquals(CODEFIRSTCODINGDISPLAY, persistedCodeCodingDisplays.get(0));
-
- List persistedCodeCodingCodeSystemHashes = persistedObservationCode.getCoding_code_system_hash();
- assertEquals(1, persistedCodeCodingCodeSystemHashes.size());
- assertEquals(String.valueOf(CodeSystemHash.hashCodeSystem(CODEFIRSTCODINGSYSTEM, CODEFIRSTCODINGCODE)), persistedCodeCodingCodeSystemHashes.get(0));
-
-
- }
-
-}
-
diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/lastn/LastNTestDataGenerator.java b/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/lastn/LastNTestDataGenerator.java
deleted file mode 100644
index ca7b3172d1b..00000000000
--- a/hapi-fhir-jpaserver-elastic-test-utilities/src/test/java/ca/uhn/fhir/jpa/search/lastn/LastNTestDataGenerator.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package ca.uhn.fhir.jpa.search.lastn;
-
-import ca.uhn.fhir.jpa.search.lastn.json.CodeJson;
-import ca.uhn.fhir.jpa.search.lastn.json.ObservationJson;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-
-public class LastNTestDataGenerator {
-
- public static final long TEST_BASELINE_TIMESTAMP = new Date().toInstant().toEpochMilli();
-
- public static final String SINGLE_OBSERVATION_RESOURCE_PID = "123";
- public static final String SINGLE_OBSERVATION_SUBJECT_ID = "Patient/4567";
-
- public static final String FIRSTCATEGORYTEXT = "Test Codeable Concept Field for first category";
- public static final String CATEGORYFIRSTCODINGSYSTEM = "http://mycodes.org/fhir/observation-category";
- public static final String CATEGORYSECONDCODINGSYSTEM = "http://myalternatecodes.org/fhir/observation-category";
- public static final String CATEGORYTHIRDCODINGSYSTEM = "http://mysecondaltcodes.org/fhir/observation-category";
- public static final String FIRSTCATEGORYFIRSTCODINGCODE = "test-heart-rate";
- public static final String FIRSTCATEGORYFIRSTCODINGDISPLAY = "Test Heart Rate";
- public static final String FIRSTCATEGORYSECONDCODINGCODE = "test-alt-heart-rate";
- public static final String FIRSTCATEGORYSECONDCODINGDISPLAY = "Test HeartRate";
- public static final String FIRSTCATEGORYTHIRDCODINGCODE = "test-2nd-alt-heart-rate";
- public static final String FIRSTCATEGORYTHIRDCODINGDISPLAY = "Test Heart-Rate";
- public static final String SECONDCATEGORYTEXT = "Test Codeable Concept Field for for second category";
- public static final String SECONDCATEGORYFIRSTCODINGCODE = "test-vital-signs";
- public static final String SECONDCATEGORYFIRSTCODINGDISPLAY = "Test Vital Signs";
- public static final String SECONDCATEGORYSECONDCODINGCODE = "test-alt-vitals";
- public static final String SECONDCATEGORYSECONDCODINGDISPLAY = "Test Vital-Signs";
- public static final String SECONDCATEGORYTHIRDCODINGCODE = "test-2nd-alt-vitals";
- public static final String SECONDCATEGORYTHIRDCODINGDISPLAY = "Test Vitals";
- public static final String THIRDCATEGORYTEXT = "Test Codeable Concept Field for third category";
- public static final String THIRDCATEGORYFIRSTCODINGCODE = "test-vital-panel";
- public static final String THIRDCATEGORYFIRSTCODINGDISPLAY = "test-vitals-panel display";
- public static final String THIRDCATEGORYSECONDCODINGCODE = "test-alt-vitals-panel";
- public static final String THIRDCATEGORYSECONDCODINGDISPLAY = "test-alt-vitals display";
- public static final String THIRDCATEGORYTHIRDCODINGCODE = "test-2nd-alt-vitals-panel";
- public static final String THIRDCATEGORYTHIRDCODINGDISPLAY = "test-2nd-alt-vitals-panel display";
- public static final String OBSERVATIONSINGLECODEID = UUID.randomUUID().toString();
- public static final String OBSERVATION_CODE_CONCEPT_TEXT_1 = "Test Codeable Concept Field for First Code";
- public static final String OBSERVATION_CODE_CONCEPT_TEXT_2 = "Test Codeable Concept Field for Second Code";
- public static final String CODEFIRSTCODINGSYSTEM = "http://mycodes.org/fhir/observation-code";
- public static final String CODEFIRSTCODINGCODE = "test-code-1";
- public static final String CODEFIRSTCODINGDISPLAY = "1-Observation Code1";
- public static final String CODE_SECOND_CODING_SYSTEM = "http://mycodes.org/fhir/observation-code";
- public static final String CODE_SECOND_CODING_CODE = "test-code-2";
- public static final String CODE_SECOND_CODING_DISPLAY = "2-Observation Code2";
-
- public static ObservationJson createSingleObservationJson() {
- ObservationJson indexedObservation = new ObservationJson();
- indexedObservation.setIdentifier(SINGLE_OBSERVATION_RESOURCE_PID);
- indexedObservation.setSubject(SINGLE_OBSERVATION_SUBJECT_ID);
- indexedObservation.setEffectiveDtm(new Date(TEST_BASELINE_TIMESTAMP));
-
- indexedObservation.setCategories(createCategoryCodeableConcepts());
-
- // Create CodeableConcept for Code
- CodeJson codeableConceptField = new CodeJson();
- codeableConceptField.setCodeableConceptId(OBSERVATIONSINGLECODEID);
- codeableConceptField.setCodeableConceptText(OBSERVATION_CODE_CONCEPT_TEXT_1);
- codeableConceptField.addCoding(CODEFIRSTCODINGSYSTEM, CODEFIRSTCODINGCODE, CODEFIRSTCODINGDISPLAY);
-
- indexedObservation.setCode(codeableConceptField);
-
- return indexedObservation;
- }
-
- private static List createCategoryCodeableConcepts() {
- CodeJson categoryCodeableConcept1 = new CodeJson();
- categoryCodeableConcept1.setCodeableConceptText(FIRSTCATEGORYTEXT);
- categoryCodeableConcept1.addCoding(CATEGORYFIRSTCODINGSYSTEM, FIRSTCATEGORYFIRSTCODINGCODE, FIRSTCATEGORYFIRSTCODINGDISPLAY);
- categoryCodeableConcept1.addCoding(CATEGORYSECONDCODINGSYSTEM, FIRSTCATEGORYSECONDCODINGCODE, FIRSTCATEGORYSECONDCODINGDISPLAY);
- categoryCodeableConcept1.addCoding(CATEGORYTHIRDCODINGSYSTEM, FIRSTCATEGORYTHIRDCODINGCODE, FIRSTCATEGORYTHIRDCODINGDISPLAY);
-
- CodeJson categoryCodeableConcept2 = new CodeJson();
- categoryCodeableConcept2.setCodeableConceptText(SECONDCATEGORYTEXT);
- categoryCodeableConcept2.addCoding(CATEGORYFIRSTCODINGSYSTEM, SECONDCATEGORYFIRSTCODINGCODE, SECONDCATEGORYFIRSTCODINGDISPLAY);
- categoryCodeableConcept2.addCoding(CATEGORYSECONDCODINGSYSTEM, SECONDCATEGORYSECONDCODINGCODE, SECONDCATEGORYSECONDCODINGDISPLAY);
- categoryCodeableConcept2.addCoding(CATEGORYTHIRDCODINGSYSTEM, SECONDCATEGORYTHIRDCODINGCODE, SECONDCATEGORYTHIRDCODINGDISPLAY);
-
- CodeJson categoryCodeableConcept3 = new CodeJson();
- categoryCodeableConcept3.setCodeableConceptText(THIRDCATEGORYTEXT);
- categoryCodeableConcept3.addCoding(CATEGORYFIRSTCODINGSYSTEM, THIRDCATEGORYFIRSTCODINGCODE, THIRDCATEGORYFIRSTCODINGDISPLAY);
- categoryCodeableConcept3.addCoding(CATEGORYSECONDCODINGSYSTEM, THIRDCATEGORYSECONDCODINGCODE, THIRDCATEGORYSECONDCODINGDISPLAY);
- categoryCodeableConcept3.addCoding(CATEGORYTHIRDCODINGSYSTEM, THIRDCATEGORYTHIRDCODINGCODE, THIRDCATEGORYTHIRDCODINGDISPLAY);
-
- return Arrays.asList(categoryCodeableConcept1, categoryCodeableConcept2, categoryCodeableConcept3);
- }
-
- public static List createMultipleObservationJson(List thePatientIds) {
-
- // CodeableConcept 1 - with 3 codings
- String codeableConceptId1 = UUID.randomUUID().toString();
- CodeJson codeJson1 = new CodeJson();
- codeJson1.setCodeableConceptId(codeableConceptId1);
- codeJson1.setCodeableConceptText(OBSERVATION_CODE_CONCEPT_TEXT_1);
- codeJson1.addCoding(CODEFIRSTCODINGSYSTEM, CODEFIRSTCODINGCODE, CODEFIRSTCODINGDISPLAY);
-
- // CodeableConcept 2 - with 3 codings
- String codeableConceptId2 = UUID.randomUUID().toString();
- CodeJson codeJson2 = new CodeJson();
- codeJson2.setCodeableConceptId(codeableConceptId2);
- codeJson2.setCodeableConceptText(OBSERVATION_CODE_CONCEPT_TEXT_2);
- codeJson2.addCoding(CODE_SECOND_CODING_SYSTEM, CODE_SECOND_CODING_CODE, CODE_SECOND_CODING_DISPLAY);
-
- List categoryCodeableConcepts = createCategoryCodeableConcepts();
- // CategoryCodeableConcept 1 - with 3 codings
- List categoryConcepts1 = Collections.singletonList(categoryCodeableConcepts.get(0));
-
- // CateogryCodeableConcept 2 - with 3 codings
- List categoryConcepts2 = Collections.singletonList(categoryCodeableConcepts.get(1));
-
- // Pair CodeableConcept 1 + CategoryCodeableConcept 1 for odd numbered observation
- // Pair CodeableConcept 2 + CategoryCodeableConcept 2 for even numbered observation
-
- // For each patient - create 10 observations
- return thePatientIds.stream()
- .flatMap(patientId -> IntStream.range(0, 10)
- .mapToObj(index -> {
- ObservationJson observationJson = new ObservationJson();
- String identifier = String.valueOf((index + patientId * 10L));
- observationJson.setIdentifier(identifier);
- observationJson.setSubject(String.valueOf(patientId));
- if (index % 2 == 1) {
- observationJson.setCategories(categoryConcepts1);
- observationJson.setCode(codeJson1);
- } else {
- observationJson.setCategories(categoryConcepts2);
- observationJson.setCode(codeJson2);
- }
- Date effectiveDtm = new Date(TEST_BASELINE_TIMESTAMP - ((10L - index) * 3600L * 1000L));
- observationJson.setEffectiveDtm(effectiveDtm);
- return observationJson;
- }))
- .collect(Collectors.toList());
- }
-
-}
diff --git a/hapi-fhir-jpaserver-hfql/pom.xml b/hapi-fhir-jpaserver-hfql/pom.xml
index 1d71e2ac1e7..736c8753f00 100644
--- a/hapi-fhir-jpaserver-hfql/pom.xml
+++ b/hapi-fhir-jpaserver-hfql/pom.xml
@@ -3,7 +3,7 @@
ca.uhn.hapi.fhir
hapi-deployable-pom
- 6.11.4-SNAPSHOT
+ 6.11.5-SNAPSHOT
../hapi-deployable-pom/pom.xml
@@ -20,8 +20,8 @@
- javax.servlet
- javax.servlet-api
+ jakarta.servlet
+ jakarta.servlet-api
provided
diff --git a/hapi-fhir-jpaserver-hfql/src/main/java/ca/uhn/fhir/jpa/fql/jdbc/RemoteHfqlExecutionResult.java b/hapi-fhir-jpaserver-hfql/src/main/java/ca/uhn/fhir/jpa/fql/jdbc/RemoteHfqlExecutionResult.java
index 5b2c65b31b7..9fee362d699 100644
--- a/hapi-fhir-jpaserver-hfql/src/main/java/ca/uhn/fhir/jpa/fql/jdbc/RemoteHfqlExecutionResult.java
+++ b/hapi-fhir-jpaserver-hfql/src/main/java/ca/uhn/fhir/jpa/fql/jdbc/RemoteHfqlExecutionResult.java
@@ -32,6 +32,7 @@ import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.util.IoUtil;
import ca.uhn.fhir.util.JsonUtil;
import ca.uhn.fhir.util.ValidateUtil;
+import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVRecord;
import org.apache.commons.lang3.Validate;
@@ -56,7 +57,6 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import javax.servlet.http.HttpServletResponse;
import static ca.uhn.fhir.jpa.fql.util.HfqlConstants.PROTOCOL_VERSION;
import static org.apache.commons.lang3.StringUtils.defaultIfBlank;
diff --git a/hapi-fhir-jpaserver-hfql/src/main/java/ca/uhn/fhir/jpa/fql/provider/HfqlRestProvider.java b/hapi-fhir-jpaserver-hfql/src/main/java/ca/uhn/fhir/jpa/fql/provider/HfqlRestProvider.java
index adb3d2d8335..805707e3621 100644
--- a/hapi-fhir-jpaserver-hfql/src/main/java/ca/uhn/fhir/jpa/fql/provider/HfqlRestProvider.java
+++ b/hapi-fhir-jpaserver-hfql/src/main/java/ca/uhn/fhir/jpa/fql/provider/HfqlRestProvider.java
@@ -30,6 +30,8 @@ import ca.uhn.fhir.util.DatatypeUtil;
import ca.uhn.fhir.util.JsonUtil;
import ca.uhn.fhir.util.ValidateUtil;
import ca.uhn.fhir.util.VersionUtil;
+import jakarta.servlet.ServletOutputStream;
+import jakarta.servlet.http.HttpServletResponse;
import org.apache.commons.csv.CSVPrinter;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,8 +39,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import java.io.IOException;
import java.io.OutputStreamWriter;
import javax.annotation.Nullable;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletResponse;
import static ca.uhn.fhir.jpa.fql.jdbc.HfqlRestClient.CSV_FORMAT;
import static ca.uhn.fhir.rest.api.Constants.CHARSET_UTF8_CTSUFFIX;
diff --git a/hapi-fhir-jpaserver-ips/pom.xml b/hapi-fhir-jpaserver-ips/pom.xml
index 5c28e18021a..2f75ba5a60f 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.11.4-SNAPSHOT
+ 6.11.5-SNAPSHOT
../hapi-deployable-pom/pom.xml
@@ -21,8 +21,8 @@
- javax.servlet
- javax.servlet-api
+ jakarta.servlet
+ jakarta.servlet-api
provided
diff --git a/hapi-fhir-jpaserver-ips/src/main/java/ca/uhn/fhir/jpa/ips/api/SectionRegistry.java b/hapi-fhir-jpaserver-ips/src/main/java/ca/uhn/fhir/jpa/ips/api/SectionRegistry.java
index a085d1b6ea3..fa16b55e2fc 100644
--- a/hapi-fhir-jpaserver-ips/src/main/java/ca/uhn/fhir/jpa/ips/api/SectionRegistry.java
+++ b/hapi-fhir-jpaserver-ips/src/main/java/ca/uhn/fhir/jpa/ips/api/SectionRegistry.java
@@ -19,6 +19,7 @@
*/
package ca.uhn.fhir.jpa.ips.api;
+import jakarta.annotation.PostConstruct;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
@@ -36,7 +37,6 @@ import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import javax.annotation.Nullable;
-import javax.annotation.PostConstruct;
/**
* This class is the registry for sections for the IPS document. It can be extended
diff --git a/hapi-fhir-jpaserver-mdm/pom.xml b/hapi-fhir-jpaserver-mdm/pom.xml
index 2fb8fa175ad..dd2a1fba351 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.11.4-SNAPSHOT
+ 6.11.5-SNAPSHOT
../hapi-deployable-pom/pom.xml
@@ -61,8 +61,8 @@
test
- javax.servlet
- javax.servlet-api
+ jakarta.servlet
+ jakarta.servlet-api
test
diff --git a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/broker/MdmQueueConsumerLoader.java b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/broker/MdmQueueConsumerLoader.java
index 1acf874d65d..23ca40079fd 100644
--- a/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/broker/MdmQueueConsumerLoader.java
+++ b/hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/broker/MdmQueueConsumerLoader.java
@@ -26,11 +26,10 @@ import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage;
import ca.uhn.fhir.mdm.api.IMdmSettings;
import ca.uhn.fhir.mdm.log.Logs;
import com.google.common.annotations.VisibleForTesting;
+import jakarta.annotation.PreDestroy;
import org.slf4j.Logger;
import org.springframework.stereotype.Service;
-import javax.annotation.PreDestroy;
-
@Service
public class MdmQueueConsumerLoader {
private static final Logger ourLog = Logs.getMdmTroubleshootingLog();
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 6ea10e08c9f..a9ddf8b322a 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
@@ -28,6 +28,7 @@ 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.batch.models.Batch2JobStartResponse;
+import ca.uhn.fhir.jpa.dao.tx.HapiTransactionService;
import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc;
import ca.uhn.fhir.mdm.api.IGoldenResourceMergerSvc;
import ca.uhn.fhir.mdm.api.IMdmControllerSvc;
@@ -103,6 +104,9 @@ public class MdmControllerSvcImpl implements IMdmControllerSvc {
@Autowired
IInterceptorBroadcaster myInterceptorBroadcaster;
+ @Autowired
+ private HapiTransactionService myTxService;
+
public MdmControllerSvcImpl() {}
@Override
@@ -194,7 +198,9 @@ public class MdmControllerSvcImpl implements IMdmControllerSvc {
@Override
public List queryLinkHistory(
MdmHistorySearchParameters theMdmHistorySearchParameters, RequestDetails theRequestDetails) {
- return myMdmLinkQuerySvc.queryLinkHistory(theMdmHistorySearchParameters);
+ return myTxService
+ .withRequest(theRequestDetails)
+ .execute(() -> myMdmLinkQuerySvc.queryLinkHistory(theMdmHistorySearchParameters));
}
@Override
diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/dao/MdmMetricSvcJpaIT.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/dao/MdmMetricSvcJpaIT.java
index 77a186cc549..7953cc7316a 100644
--- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/dao/MdmMetricSvcJpaIT.java
+++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/dao/MdmMetricSvcJpaIT.java
@@ -19,6 +19,7 @@ import ca.uhn.fhir.mdm.model.MdmMetrics;
import ca.uhn.fhir.mdm.util.MdmResourceUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import jakarta.persistence.EntityManagerFactory;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.BeforeEach;
@@ -30,7 +31,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
-import javax.persistence.EntityManagerFactory;
import java.util.List;
import static org.junit.jupiter.api.Assertions.fail;
@@ -78,6 +78,7 @@ public class MdmMetricSvcJpaIT extends BaseMdmR4Test implements IMdmMetricSvcTes
@Autowired
private IMdmMetricSvc mySvc;
+ @Override
@BeforeEach
public void before() throws Exception {
super.before();
diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/helper/BaseMdmHelper.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/helper/BaseMdmHelper.java
index dd185421e9f..4a4089ef08e 100644
--- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/helper/BaseMdmHelper.java
+++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/helper/BaseMdmHelper.java
@@ -19,7 +19,7 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import java.util.function.Supplier;
import static org.awaitility.Awaitility.await;
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 31125dd941c..5b1150bc1ca 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
@@ -30,7 +30,7 @@ import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmStorageInterceptorIT.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmStorageInterceptorIT.java
index f7e8615c22d..953a7574618 100644
--- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmStorageInterceptorIT.java
+++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmStorageInterceptorIT.java
@@ -172,8 +172,12 @@ public class MdmStorageInterceptorIT extends BaseMdmR4Test {
assertLinksMatchResult(MdmMatchResultEnum.MATCH, MdmMatchResultEnum.POSSIBLE_MATCH, MdmMatchResultEnum.POSSIBLE_MATCH);
+ logAllTokenIndexes();
+
// When
- myPatientDao.delete(paulPatient.getIdElement());
+ myPatientDao.delete(paulPatient.getIdElement(), new SystemRequestDetails());
+
+ logAllTokenIndexes();
// Then
List resources = myPatientDao.search(new SearchParameterMap(), SystemRequestDetails.forAllPartitions()).getAllResources();
diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseProviderR4Test.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseProviderR4Test.java
index 5fa7ce7d19d..8b46fe10d87 100644
--- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseProviderR4Test.java
+++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/BaseProviderR4Test.java
@@ -54,8 +54,10 @@ public abstract class BaseProviderR4Test extends BaseMdmR4Test {
myMdmResourceMatcherSvc.setMdmRulesJson(myMdmSettings.getMdmRules());
}
+ @Override
@BeforeEach
public void before() throws Exception {
+ super.before();
myMdmProvider = new MdmProviderDstu3Plus(myFhirContext,
myMdmControllerSvc,
myMdmHelper,
diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/MdmOperationPointcutsIT.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/MdmOperationPointcutsIT.java
index e9f69df9592..76d6b6d065f 100644
--- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/MdmOperationPointcutsIT.java
+++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/MdmOperationPointcutsIT.java
@@ -7,6 +7,7 @@ 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.batch.models.Batch2JobStartResponse;
+import ca.uhn.fhir.jpa.dao.expunge.ExpungeEverythingService;
import ca.uhn.fhir.jpa.entity.MdmLink;
import ca.uhn.fhir.jpa.mdm.helper.MdmLinkHelper;
import ca.uhn.fhir.jpa.mdm.helper.testmodels.MDMState;
@@ -14,6 +15,7 @@ import ca.uhn.fhir.jpa.model.dao.JpaPid;
import ca.uhn.fhir.mdm.api.IMdmSubmitSvc;
import ca.uhn.fhir.mdm.api.MdmLinkSourceEnum;
import ca.uhn.fhir.mdm.api.MdmMatchResultEnum;
+import ca.uhn.fhir.mdm.interceptor.MdmStorageInterceptor;
import ca.uhn.fhir.mdm.model.mdmevents.MdmClearEvent;
import ca.uhn.fhir.mdm.model.mdmevents.MdmHistoryEvent;
import ca.uhn.fhir.mdm.model.mdmevents.MdmLinkEvent;
@@ -119,10 +121,18 @@ public class MdmOperationPointcutsIT extends BaseProviderR4Test {
@SpyBean
private IMdmSubmitSvc myMdmSubmitSvc;
+
private MdmLinkHistoryProviderDstu3Plus myLinkHistoryProvider;
private final List myInterceptors = new ArrayList<>();
+ @Override
+ @AfterEach
+ public void afterPurgeDatabase() {
+ super.afterPurgeDatabase();
+ }
+
+ @Override
@BeforeEach
public void before() throws Exception {
super.before();
@@ -134,6 +144,7 @@ public class MdmOperationPointcutsIT extends BaseProviderR4Test {
);
}
+ @Override
@AfterEach
public void after() throws IOException {
super.after();
@@ -141,8 +152,6 @@ public class MdmOperationPointcutsIT extends BaseProviderR4Test {
myInterceptors.clear();
}
- @Nested
- class MdmProviderDstu3PlusTest {
@Test
public void mergeGoldenResources_withInterceptor_firesHook() {
// setup
@@ -521,7 +530,7 @@ public class MdmOperationPointcutsIT extends BaseProviderR4Test {
}
}
}
- }
+
private String createUrl(String theResourceType, StringType theCriteria) {
String url = theResourceType;
@@ -531,8 +540,6 @@ public class MdmOperationPointcutsIT extends BaseProviderR4Test {
return url;
}
- @Nested
- class MdmLinkHistoryProviderDstu3PlusTest {
@ParameterizedTest
@EnumSource(LinkHistoryParameters.class)
@@ -597,6 +604,6 @@ public class MdmOperationPointcutsIT extends BaseProviderR4Test {
assertTrue(called.get());
assertFalse(retval.isEmpty());
}
- }
+
}
diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/MdmProviderCrossPartitionR4Test.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/MdmProviderCrossPartitionR4Test.java
index 8a899634fda..90001543085 100644
--- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/MdmProviderCrossPartitionR4Test.java
+++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/provider/MdmProviderCrossPartitionR4Test.java
@@ -37,7 +37,8 @@ public class MdmProviderCrossPartitionR4Test extends BaseProviderR4Test{
private static final String PARTITION_GOLDEN_RESOURCE = "PARTITION-GOLDEN";
- @BeforeEach
+ @Override
+ @BeforeEach
public void before() throws Exception {
super.before();
diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmMatchLinkSvcTest.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmMatchLinkSvcTest.java
index 967ccf4969c..57b19c41294 100644
--- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmMatchLinkSvcTest.java
+++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmMatchLinkSvcTest.java
@@ -119,7 +119,6 @@ public class MdmMatchLinkSvcTest {
assertLinksMatchVector((Long) null);
}
- @Test
@RepeatedTest(20)
public void testUpdatingAResourceToMatchACurrentlyUnmatchedResource_resultsInUpdatedLinksForBoth() {
// setup
diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/mdm/batch2/clear/MdmLinkSlowDeletionSandboxIT.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/mdm/batch2/clear/MdmLinkSlowDeletionSandboxIT.java
index da5734f574a..5cba1958901 100644
--- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/mdm/batch2/clear/MdmLinkSlowDeletionSandboxIT.java
+++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/mdm/batch2/clear/MdmLinkSlowDeletionSandboxIT.java
@@ -9,7 +9,7 @@ import ca.uhn.fhir.mdm.api.MdmMatchResultEnum;
import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
import ca.uhn.fhir.util.StopWatch;
import org.apache.commons.dbcp2.BasicDataSource;
-import org.hibernate.dialect.PostgreSQL9Dialect;
+import org.hibernate.dialect.PostgreSQLDialect;
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.Disabled;
@@ -115,9 +115,7 @@ public class MdmLinkSlowDeletionSandboxIT extends BaseJpaR4Test {
@Override
public String getHibernateDialect() {
- return PostgreSQL9Dialect.class.getName();
-
-// return Oracle12cDialect.class.getName();
+ return PostgreSQLDialect.class.getName();
}
@Override
diff --git a/hapi-fhir-jpaserver-model/pom.xml b/hapi-fhir-jpaserver-model/pom.xml
index e161b491e6b..8860e76228d 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.11.4-SNAPSHOT
+ 6.11.5-SNAPSHOT
../hapi-deployable-pom/pom.xml
@@ -81,19 +81,19 @@
${project.version}
- org.hibernate
+ org.hibernate.orm
hibernate-core
org.hibernate.search
- hibernate-search-mapper-orm
+ hibernate-search-mapper-orm-orm6
org.hibernate.search
hibernate-search-backend-elasticsearch
- org.hibernate
+ org.hibernate.orm
hibernate-envers
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirCockroachDialect.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirCockroachDialect.java
new file mode 100644
index 00000000000..e38ff5d7878
--- /dev/null
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirCockroachDialect.java
@@ -0,0 +1,42 @@
+/*-
+ * #%L
+ * HAPI FHIR JPA Model
+ * %%
+ * Copyright (C) 2014 - 2023 Smile CDR, Inc.
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+package ca.uhn.fhir.jpa.model.dialect;
+
+import org.hibernate.dialect.CockroachDialect;
+import org.hibernate.dialect.DatabaseVersion;
+
+/**
+ * Dialect for CockroachDB database.
+ * Minimum version: 21.1
+ */
+public class HapiFhirCockroachDialect extends CockroachDialect {
+
+ public HapiFhirCockroachDialect() {
+ super(DatabaseVersion.make(21, 1));
+ }
+
+ /**
+ * @see HapiFhirH2Dialect#supportsColumnCheck() for an explanation of why we disable this
+ */
+ @Override
+ public boolean supportsColumnCheck() {
+ return false;
+ }
+}
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirDerbyDialect.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirDerbyDialect.java
new file mode 100644
index 00000000000..b4e8f589f30
--- /dev/null
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirDerbyDialect.java
@@ -0,0 +1,42 @@
+/*-
+ * #%L
+ * HAPI FHIR JPA Model
+ * %%
+ * Copyright (C) 2014 - 2023 Smile CDR, Inc.
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+package ca.uhn.fhir.jpa.model.dialect;
+
+import org.hibernate.dialect.DatabaseVersion;
+import org.hibernate.dialect.DerbyDialect;
+
+/**
+ * Dialect for Oracle database.
+ * Minimum version: 10.14.2
+ */
+public class HapiFhirDerbyDialect extends DerbyDialect {
+
+ public HapiFhirDerbyDialect() {
+ super(DatabaseVersion.make(10, 14, 2));
+ }
+
+ /**
+ * @see HapiFhirH2Dialect#supportsColumnCheck() for an explanation of why we disable this
+ */
+ @Override
+ public boolean supportsColumnCheck() {
+ return false;
+ }
+}
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirH2Dialect.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirH2Dialect.java
index 074bf229726..5cdf1eaad26 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirH2Dialect.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirH2Dialect.java
@@ -19,12 +19,13 @@
*/
package ca.uhn.fhir.jpa.model.dialect;
+import ca.uhn.fhir.jpa.model.entity.ResourceTable;
+import org.hibernate.dialect.DatabaseVersion;
import org.hibernate.dialect.H2Dialect;
-import java.sql.Types;
-
/**
- * HAPI FHIR dialect for H2 database
+ * Dialect for H2 database.
+ * Minimum version: 2.2.220
*/
public class HapiFhirH2Dialect extends H2Dialect {
@@ -32,25 +33,33 @@ public class HapiFhirH2Dialect extends H2Dialect {
* Constructor
*/
public HapiFhirH2Dialect() {
- super();
-
- /*
- * These mappings are already defined in the super() constructor, but they
- * will only happen if the dialect can connect to the database and
- * determine that it's a recent enough version of H2 to support this. This
- * means that the Maven plugin that does schema generation doesn't add it.
- * So this dialect forces the use of the right defs.
- */
- registerColumnType(Types.LONGVARCHAR, "character varying");
- registerColumnType(Types.BINARY, "binary($l)");
+ super(DatabaseVersion.make(2, 2, 220));
}
/**
- * Workaround until this bug is fixed:
- * https://hibernate.atlassian.net/browse/HHH-15002
+ * As of Hibernate 6, generated schemas include a column level check constraint that enforces valid values
+ * for columns that back an Enum type. For example, the column definition for {@link ResourceTable#getFhirVersion()}
+ * would look like:
+ *
+ * RES_VERSION varchar(7) check (RES_VERSION in ('DSTU2','DSTU2_HL7ORG','DSTU2_1','DSTU3','R4','R4B','R5')),
+ *
+ *
+ * This is a nice addition since it enforces the values that the Enum allows, but it's problematic for us because these
+ * constraints are invisible to the JDBC metadata API on most databases, which means that our schema migration
+ * checker isn't able to catch problems if we add a value to an Enum and don't add a corresponding database
+ * migration. Rather than risk having inconsistent behaviour between annotated and migrated schemas, we just
+ * disable these checks on all of our dialects.
+ *
+ * See this discussion from the author of SchemaCrawler discussing this limitation:
+ * https://stackoverflow.com/questions/63346650/schemacrawler-java-api-retrieve-check-column-constraints .
+ * With this change in place, the definition above becomes simply:
+ *
+ * RES_VERSION varchar(7),
+ *
+ *
*/
@Override
- public String toBooleanValueString(boolean bool) {
- return bool ? "true" : "false";
+ public boolean supportsColumnCheck() {
+ return false;
}
}
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirMariaDBDialect.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirMariaDBDialect.java
new file mode 100644
index 00000000000..0a121b8f3f5
--- /dev/null
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirMariaDBDialect.java
@@ -0,0 +1,42 @@
+/*-
+ * #%L
+ * HAPI FHIR JPA Model
+ * %%
+ * Copyright (C) 2014 - 2023 Smile CDR, Inc.
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+package ca.uhn.fhir.jpa.model.dialect;
+
+import org.hibernate.dialect.DatabaseVersion;
+import org.hibernate.dialect.MariaDBDialect;
+
+/**
+ * Dialect for MySQL database.
+ * Minimum version: 10.11.5
+ */
+public class HapiFhirMariaDBDialect extends MariaDBDialect {
+
+ public HapiFhirMariaDBDialect() {
+ super(DatabaseVersion.make(10, 11, 5));
+ }
+
+ /**
+ * @see HapiFhirH2Dialect#supportsColumnCheck() for an explanation of why we disable this
+ */
+ @Override
+ public boolean supportsColumnCheck() {
+ return false;
+ }
+}
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirMySQLDialect.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirMySQLDialect.java
new file mode 100644
index 00000000000..8bdbf26ba4c
--- /dev/null
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirMySQLDialect.java
@@ -0,0 +1,42 @@
+/*-
+ * #%L
+ * HAPI FHIR JPA Model
+ * %%
+ * Copyright (C) 2014 - 2023 Smile CDR, Inc.
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+package ca.uhn.fhir.jpa.model.dialect;
+
+import org.hibernate.dialect.DatabaseVersion;
+import org.hibernate.dialect.MySQLDialect;
+
+/**
+ * Dialect for MySQL database.
+ * Minimum version: 5.7
+ */
+public class HapiFhirMySQLDialect extends MySQLDialect {
+
+ public HapiFhirMySQLDialect() {
+ super(DatabaseVersion.make(5, 7));
+ }
+
+ /**
+ * @see HapiFhirH2Dialect#supportsColumnCheck() for an explanation of why we disable this
+ */
+ @Override
+ public boolean supportsColumnCheck() {
+ return false;
+ }
+}
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirOracleDialect.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirOracleDialect.java
new file mode 100644
index 00000000000..ec1095e3765
--- /dev/null
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirOracleDialect.java
@@ -0,0 +1,42 @@
+/*-
+ * #%L
+ * HAPI FHIR JPA Model
+ * %%
+ * Copyright (C) 2014 - 2023 Smile CDR, Inc.
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+package ca.uhn.fhir.jpa.model.dialect;
+
+import org.hibernate.dialect.DatabaseVersion;
+import org.hibernate.dialect.OracleDialect;
+
+/**
+ * Dialect for Oracle database.
+ * Minimum version: 12.2 (Oracle 12c R2)
+ */
+public class HapiFhirOracleDialect extends OracleDialect {
+
+ public HapiFhirOracleDialect() {
+ super(DatabaseVersion.make(12, 2));
+ }
+
+ /**
+ * @see HapiFhirH2Dialect#supportsColumnCheck() for an explanation of why we disable this
+ */
+ @Override
+ public boolean supportsColumnCheck() {
+ return false;
+ }
+}
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirPostgres94Dialect.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirPostgres94Dialect.java
index 57f42b5322a..da3a48025ad 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirPostgres94Dialect.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirPostgres94Dialect.java
@@ -19,17 +19,21 @@
*/
package ca.uhn.fhir.jpa.model.dialect;
-import org.hibernate.dialect.PostgreSQL94Dialect;
-
-import java.sql.Types;
+import org.hibernate.dialect.PostgreSQLDialect;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This dialect is recommended when using HAPI FHIR JPA on Postgresql database.
+ *
+ * @deprecated Use {@link HapiFhirPostgresDialect} instead
*/
-public class HapiFhirPostgres94Dialect extends PostgreSQL94Dialect {
+public class HapiFhirPostgres94Dialect extends PostgreSQLDialect {
+ private static final Logger ourLog = LoggerFactory.getLogger(HapiFhirPostgres94Dialect.class);
public HapiFhirPostgres94Dialect() {
super();
- registerColumnType(Types.CLOB, "oid");
+ ourLog.warn("The " + getClass() + " dialect is deprecated and will be removed in a future release. Use "
+ + HapiFhirPostgresDialect.class.getName() + " instead");
}
}
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirPostgresDialect.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirPostgresDialect.java
new file mode 100644
index 00000000000..c0a3435b7a1
--- /dev/null
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirPostgresDialect.java
@@ -0,0 +1,38 @@
+/*-
+ * #%L
+ * HAPI FHIR JPA Model
+ * %%
+ * Copyright (C) 2014 - 2023 Smile CDR, Inc.
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+package ca.uhn.fhir.jpa.model.dialect;
+
+import org.hibernate.dialect.DatabaseVersion;
+import org.hibernate.dialect.PostgreSQLDialect;
+
+public class HapiFhirPostgresDialect extends PostgreSQLDialect {
+
+ public HapiFhirPostgresDialect() {
+ super(DatabaseVersion.make(10, 0, 0));
+ }
+
+ /**
+ * @see HapiFhirH2Dialect#supportsColumnCheck() for an explanation of why we disable this
+ */
+ @Override
+ public boolean supportsColumnCheck() {
+ return false;
+ }
+}
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirSQLServerDialect.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirSQLServerDialect.java
new file mode 100644
index 00000000000..606d91b4dea
--- /dev/null
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/dialect/HapiFhirSQLServerDialect.java
@@ -0,0 +1,42 @@
+/*-
+ * #%L
+ * HAPI FHIR JPA Model
+ * %%
+ * Copyright (C) 2014 - 2023 Smile CDR, Inc.
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+package ca.uhn.fhir.jpa.model.dialect;
+
+import org.hibernate.dialect.DatabaseVersion;
+import org.hibernate.dialect.SQLServerDialect;
+
+/**
+ * Dialect for MS SQL Server database.
+ * Minimum version: 12.0 (SQL Server 2014 and Azure SQL Database)
+ */
+public class HapiFhirSQLServerDialect extends SQLServerDialect {
+
+ public HapiFhirSQLServerDialect() {
+ super(DatabaseVersion.make(11));
+ }
+
+ /**
+ * @see HapiFhirH2Dialect#supportsColumnCheck() for an explanation of why we disable this
+ */
+ @Override
+ public boolean supportsColumnCheck() {
+ return false;
+ }
+}
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 9e373c05e5d..cbdaa8a8aac 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,16 +20,19 @@
package ca.uhn.fhir.jpa.model.dialect;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
-import ca.uhn.fhir.util.ReflectionUtil;
+import ca.uhn.fhir.jpa.util.ISequenceValueMassager;
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.ExportableProducer;
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.id.BulkInsertionCapableIdentifierGenerator;
import org.hibernate.id.IdentifierGenerator;
+import org.hibernate.id.OptimizableGenerator;
import org.hibernate.id.PersistentIdentifierGenerator;
+import org.hibernate.id.enhanced.Optimizer;
import org.hibernate.id.enhanced.SequenceStyleGenerator;
import org.hibernate.id.enhanced.StandardOptimizerDescriptor;
import org.hibernate.service.ServiceRegistry;
@@ -45,7 +48,8 @@ import java.util.Properties;
*/
@SuppressWarnings("unused")
public class HapiSequenceStyleGenerator
- implements IdentifierGenerator, PersistentIdentifierGenerator, BulkInsertionCapableIdentifierGenerator {
+ implements PersistentIdentifierGenerator, BulkInsertionCapableIdentifierGenerator, ExportableProducer {
+ public static final String ID_MASSAGER_TYPE_KEY = "hapi_fhir.sequence_generator_massager";
private final SequenceStyleGenerator myGen = new SequenceStyleGenerator();
@Autowired
@@ -68,7 +72,7 @@ public class HapiSequenceStyleGenerator
@Override
public Serializable generate(SharedSessionContractImplementor theSession, Object theObject)
throws HibernateException {
- Long retVal = myIdMassager.generate(myGeneratorName);
+ Long retVal = myIdMassager != null ? myIdMassager.generate(myGeneratorName) : null;
if (retVal == null) {
Long next = (Long) myGen.generate(theSession, theObject);
retVal = myIdMassager.massage(myGeneratorName, next);
@@ -80,10 +84,9 @@ public class HapiSequenceStyleGenerator
public void configure(Type theType, Properties theParams, ServiceRegistry theServiceRegistry)
throws MappingException {
- // Instantiate the ID massager
- // StorageSettings should only be null when running in the DDL generation maven plugin
- if (myStorageSettings != null) {
- myIdMassager = ReflectionUtil.newInstance(myStorageSettings.getSequenceValueMassagerClass());
+ myIdMassager = theServiceRegistry.getService(ISequenceValueMassager.class);
+ if (myIdMassager == null) {
+ myIdMassager = new ISequenceValueMassager.NoopSequenceValueMassager();
}
// Create a HAPI FHIR sequence style generator
@@ -91,9 +94,10 @@ public class HapiSequenceStyleGenerator
Validate.notBlank(myGeneratorName, "No generator name found");
Properties props = new Properties(theParams);
- props.put(SequenceStyleGenerator.OPT_PARAM, StandardOptimizerDescriptor.POOLED.getExternalName());
- props.put(SequenceStyleGenerator.INITIAL_PARAM, "1");
- props.put(SequenceStyleGenerator.INCREMENT_PARAM, "50");
+ props.put(OptimizableGenerator.OPT_PARAM, StandardOptimizerDescriptor.POOLED.getExternalName());
+ props.put(OptimizableGenerator.INITIAL_PARAM, "1");
+ props.put(OptimizableGenerator.INCREMENT_PARAM, "50");
+ props.put(GENERATOR_NAME, myGeneratorName);
myGen.configure(theType, props, theServiceRegistry);
@@ -114,4 +118,9 @@ public class HapiSequenceStyleGenerator
public boolean supportsJdbcBatchInserts() {
return myGen.supportsJdbcBatchInserts();
}
+
+ @Override
+ public Optimizer getOptimizer() {
+ return myGen.getOptimizer();
+ }
}
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/AuditableBasePartitionable.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/AuditableBasePartitionable.java
index 473235d6e8d..8601fba3c21 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/AuditableBasePartitionable.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/AuditableBasePartitionable.java
@@ -20,14 +20,14 @@ package ca.uhn.fhir.jpa.model.entity;
* #L%
*/
+import jakarta.persistence.Column;
+import jakarta.persistence.Embedded;
+import jakarta.persistence.MappedSuperclass;
import org.hibernate.envers.Audited;
import org.hibernate.envers.NotAudited;
import java.io.Serializable;
import javax.annotation.Nullable;
-import javax.persistence.Column;
-import javax.persistence.Embedded;
-import javax.persistence.MappedSuperclass;
/**
* This is a copy of (@link {@link BasePartitionable} used ONLY for entities that are audited by Hibernate Envers.
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseHasResource.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseHasResource.java
index 245abc493d9..646742cac02 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseHasResource.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseHasResource.java
@@ -23,17 +23,17 @@ import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource;
import ca.uhn.fhir.jpa.model.dao.JpaPid;
import ca.uhn.fhir.model.primitive.InstantDt;
+import jakarta.persistence.Column;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.MappedSuperclass;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.Transient;
import org.hibernate.annotations.OptimisticLock;
import java.util.Collection;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.MappedSuperclass;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
@MappedSuperclass
public abstract class BaseHasResource extends BasePartitionable
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BasePartitionable.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BasePartitionable.java
index 0c3fe7ceed0..60f1d7962e5 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BasePartitionable.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BasePartitionable.java
@@ -19,11 +19,12 @@
*/
package ca.uhn.fhir.jpa.model.entity;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embedded;
+import jakarta.persistence.MappedSuperclass;
+
import java.io.Serializable;
import javax.annotation.Nullable;
-import javax.persistence.Column;
-import javax.persistence.Embedded;
-import javax.persistence.MappedSuperclass;
/**
* This is the base class for entities with partitioning that does NOT include Hibernate Envers logging.
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndex.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndex.java
index 9107f06862a..54a99aa9ccb 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndex.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndex.java
@@ -19,10 +19,10 @@
*/
package ca.uhn.fhir.jpa.model.entity;
+import jakarta.persistence.MappedSuperclass;
import org.apache.commons.lang3.ObjectUtils;
import java.io.Serializable;
-import javax.persistence.MappedSuperclass;
@MappedSuperclass
public abstract class BaseResourceIndex extends BasePartitionable implements Serializable {
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 bdb31c75c8d..edcd363081a 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
@@ -31,17 +31,17 @@ import com.google.common.hash.HashCode;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hasher;
import com.google.common.hash.Hashing;
+import jakarta.persistence.Column;
+import jakarta.persistence.MappedSuperclass;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.Transient;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.FullTextField;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField;
import java.util.Date;
import java.util.List;
-import javax.persistence.Column;
-import javax.persistence.MappedSuperclass;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
@MappedSuperclass
public abstract class BaseResourceIndexedSearchParam extends BaseResourceIndex {
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndexedSearchParamQuantity.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndexedSearchParamQuantity.java
index ac1d27332b0..3850a31c010 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndexedSearchParamQuantity.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseResourceIndexedSearchParamQuantity.java
@@ -21,12 +21,11 @@ package ca.uhn.fhir.jpa.model.entity;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
+import jakarta.persistence.Column;
+import jakarta.persistence.MappedSuperclass;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.FullTextField;
-import javax.persistence.Column;
-import javax.persistence.MappedSuperclass;
-
@MappedSuperclass
public abstract class BaseResourceIndexedSearchParamQuantity extends BaseResourceIndexedSearchParam {
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseTag.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseTag.java
index bc4405d2d1a..27db242c506 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseTag.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BaseTag.java
@@ -19,11 +19,12 @@
*/
package ca.uhn.fhir.jpa.model.entity;
+import jakarta.persistence.Column;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.MappedSuperclass;
+
import java.io.Serializable;
-import javax.persistence.Column;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.MappedSuperclass;
@MappedSuperclass
public abstract class BaseTag extends BasePartitionable implements Serializable {
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BinaryStorageEntity.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BinaryStorageEntity.java
index d44d8e446f5..f2f9742b607 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BinaryStorageEntity.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/BinaryStorageEntity.java
@@ -19,15 +19,16 @@
*/
package ca.uhn.fhir.jpa.model.entity;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.Lob;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+
import java.sql.Blob;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Lob;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
@Entity
@Table(name = "HFJ_BINARY_STORAGE_BLOB")
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ForcedId.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ForcedId.java
index c0aab1eb5b7..c77c5bf87ba 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ForcedId.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ForcedId.java
@@ -19,24 +19,23 @@
*/
package ca.uhn.fhir.jpa.model.entity;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.annotations.ColumnDefault;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.UniqueConstraint;
-
@Entity()
@Table(
name = ForcedId.HFJ_FORCED_ID,
@@ -44,6 +43,7 @@ import javax.persistence.UniqueConstraint;
@UniqueConstraint(
name = "IDX_FORCEDID_RESID",
columnNames = {"RESOURCE_PID"}),
+
/*
* This index is called IDX_FORCEDID_TYPE_FID and guarantees
* uniqueness of RESOURCE_TYPE,FORCED_ID. This doesn't make sense
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/NpmPackageEntity.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/NpmPackageEntity.java
index 0c637ff84d5..acc24f6db0f 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/NpmPackageEntity.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/NpmPackageEntity.java
@@ -19,23 +19,23 @@
*/
package ca.uhn.fhir.jpa.model.entity;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.util.Date;
import java.util.List;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.UniqueConstraint;
-import javax.persistence.Version;
@Entity()
@Table(
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/NpmPackageVersionEntity.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/NpmPackageVersionEntity.java
index 00eee555884..a102576c0f9 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/NpmPackageVersionEntity.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/NpmPackageVersionEntity.java
@@ -21,29 +21,28 @@ package ca.uhn.fhir.jpa.model.entity;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.util.StringUtil;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.Version;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
import java.util.List;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Version;
@Entity()
@Table(
@@ -77,7 +76,7 @@ public class NpmPackageVersionEntity {
@JoinColumn(name = "PACKAGE_PID", nullable = false, foreignKey = @ForeignKey(name = "FK_NPM_PKV_PKG"))
private NpmPackageEntity myPackage;
- @OneToOne
+ @ManyToOne
@JoinColumn(
name = "BINARY_RES_ID",
referencedColumnName = "RES_ID",
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/NpmPackageVersionResourceEntity.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/NpmPackageVersionResourceEntity.java
index d9d9f0d8b5a..04428a7ceda 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/NpmPackageVersionResourceEntity.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/NpmPackageVersionResourceEntity.java
@@ -20,32 +20,30 @@
package ca.uhn.fhir.jpa.model.entity;
import ca.uhn.fhir.context.FhirVersionEnum;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.Version;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Version;
@Entity()
@Table(
name = "NPM_PACKAGE_VER_RES",
- uniqueConstraints = {},
indexes = {
@Index(name = "IDX_PACKVERRES_URL", columnList = "CANONICAL_URL"),
@Index(name = "FK_NPM_PACKVERRES_PACKVER", columnList = "PACKVER_PID"),
@@ -67,7 +65,7 @@ public class NpmPackageVersionResourceEntity {
nullable = false)
private NpmPackageVersionEntity myPackageVersion;
- @OneToOne
+ @ManyToOne
@JoinColumn(
name = "BINARY_RES_ID",
referencedColumnName = "RES_ID",
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/PartitionablePartitionId.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/PartitionablePartitionId.java
index 30c8660c1f7..e1a9026e9f7 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/PartitionablePartitionId.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/PartitionablePartitionId.java
@@ -21,14 +21,14 @@ package ca.uhn.fhir.jpa.model.entity;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embeddable;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.time.LocalDate;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
@Embeddable
public class PartitionablePartitionId implements Cloneable {
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/PersistedResourceModifiedMessageEntityPK.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/PersistedResourceModifiedMessageEntityPK.java
index 4cf7fa42516..a0fbf87d22a 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/PersistedResourceModifiedMessageEntityPK.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/PersistedResourceModifiedMessageEntityPK.java
@@ -20,10 +20,11 @@ package ca.uhn.fhir.jpa.model.entity;
* #L%
*/
+import jakarta.persistence.Column;
+import jakarta.persistence.Embeddable;
+
import java.io.Serializable;
import java.util.Objects;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
@Embeddable
public class PersistedResourceModifiedMessageEntityPK implements IPersistedResourceModifiedMessagePK, Serializable {
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceHistoryProvenanceEntity.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceHistoryProvenanceEntity.java
index 754ab9b613c..66fd55a9a85 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceHistoryProvenanceEntity.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceHistoryProvenanceEntity.java
@@ -20,21 +20,20 @@
package ca.uhn.fhir.jpa.model.entity;
import ca.uhn.fhir.rest.api.Constants;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.MapsId;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.Table;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.ForeignKey;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.MapsId;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-
import static ca.uhn.fhir.jpa.model.entity.ResourceHistoryTable.SOURCE_URI_LENGTH;
@Table(
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceHistoryTable.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceHistoryTable.java
index ce53e3bb841..7e951765439 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceHistoryTable.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceHistoryTable.java
@@ -20,17 +20,18 @@
package ca.uhn.fhir.jpa.model.entity;
import ca.uhn.fhir.jpa.model.dao.JpaPid;
-import ca.uhn.fhir.jpa.model.util.JpaConstants;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.api.Constants;
+import jakarta.persistence.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
+import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.annotations.OptimisticLock;
+import org.hibernate.type.SqlTypes;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
-import javax.persistence.*;
@Entity
@Table(
@@ -91,7 +92,7 @@ public class ResourceHistoryTable extends BaseHasResource implements Serializabl
private byte[] myResource;
@Column(name = "RES_TEXT_VC", length = RES_TEXT_VC_MAX_LENGTH, nullable = true)
- @org.hibernate.annotations.Type(type = JpaConstants.ORG_HIBERNATE_TYPE_TEXT_TYPE)
+ @JdbcTypeCode(SqlTypes.LONG32VARCHAR)
@OptimisticLock(excluded = true)
private String myResourceTextVc;
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceHistoryTag.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceHistoryTag.java
index 21eb200e8aa..d77cf7c5538 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceHistoryTag.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceHistoryTag.java
@@ -19,20 +19,21 @@
*/
package ca.uhn.fhir.jpa.model.entity;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embeddable;
+import jakarta.persistence.Entity;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
+
import java.io.Serializable;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-import javax.persistence.Entity;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.UniqueConstraint;
@Embeddable
@Entity
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedComboStringUnique.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedComboStringUnique.java
index 1b386c23afb..898efaba2bc 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedComboStringUnique.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedComboStringUnique.java
@@ -19,6 +19,7 @@
*/
package ca.uhn.fhir.jpa.model.entity;
+import jakarta.persistence.*;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.builder.CompareToBuilder;
import org.apache.commons.lang3.builder.EqualsBuilder;
@@ -27,8 +28,6 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hl7.fhir.instance.model.api.IIdType;
-import javax.persistence.*;
-
@Entity()
@Table(
name = "HFJ_IDX_CMP_STRING_UNIQ",
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedComboTokenNonUnique.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedComboTokenNonUnique.java
index d4f96c2f7d0..75d6947c870 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedComboTokenNonUnique.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedComboTokenNonUnique.java
@@ -21,25 +21,24 @@ package ca.uhn.fhir.jpa.model.entity;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Transient;
import org.apache.commons.lang3.builder.CompareToBuilder;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.hl7.fhir.instance.model.api.IIdType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-
import static ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParam.hash;
@Entity
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamCoords.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamCoords.java
index dbad03ccc81..505b36de92e 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamCoords.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamCoords.java
@@ -21,25 +21,24 @@ package ca.uhn.fhir.jpa.model.entity;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.model.api.IQueryParameterType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embeddable;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
@Embeddable
@Entity
@Table(
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamDate.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamDate.java
index 01fcab6f275..4afac4201df 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamDate.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamDate.java
@@ -26,6 +26,22 @@ import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.rest.param.DateParam;
import ca.uhn.fhir.rest.param.DateRangeParam;
import ca.uhn.fhir.util.DateUtils;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embeddable;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.Transient;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
@@ -37,22 +53,6 @@ import org.hl7.fhir.r4.model.DateTimeType;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
@Embeddable
@Entity
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamNumber.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamNumber.java
index e98508339ce..60c327ab767 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamNumber.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamNumber.java
@@ -22,27 +22,29 @@ package ca.uhn.fhir.jpa.model.entity;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.rest.param.NumberParam;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embeddable;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
+import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.ScaledNumberField;
+import org.hibernate.type.SqlTypes;
import java.math.BigDecimal;
import java.util.Objects;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
@Embeddable
@Entity
@@ -57,8 +59,9 @@ public class ResourceIndexedSearchParamNumber extends BaseResourceIndexedSearchP
private static final long serialVersionUID = 1L;
- @Column(name = "SP_VALUE", nullable = true)
+ @Column(name = "SP_VALUE", nullable = true, precision = 19, scale = 2)
@ScaledNumberField
+ @JdbcTypeCode(SqlTypes.DECIMAL)
public BigDecimal myValue;
@Id
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamQuantity.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamQuantity.java
index 80841720449..7b988a19224 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamQuantity.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamQuantity.java
@@ -22,6 +22,19 @@ package ca.uhn.fhir.jpa.model.entity;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.rest.param.QuantityParam;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embeddable;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@@ -29,19 +42,6 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.ScaledNumb
import java.math.BigDecimal;
import java.util.Objects;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
import static org.apache.commons.lang3.StringUtils.defaultString;
import static org.apache.commons.lang3.StringUtils.isBlank;
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamQuantityNormalized.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamQuantityNormalized.java
index 2a7ca219558..7ba74219b4f 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamQuantityNormalized.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamQuantityNormalized.java
@@ -23,6 +23,19 @@ import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.util.UcumServiceUtil;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.rest.param.QuantityParam;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embeddable;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@@ -31,19 +44,6 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.ScaledNumb
import java.math.BigDecimal;
import java.util.Objects;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
import static org.apache.commons.lang3.StringUtils.defaultString;
import static org.apache.commons.lang3.StringUtils.isBlank;
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 870c367a418..b5320e48cb0 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
@@ -25,24 +25,23 @@ import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.rest.param.StringParam;
import ca.uhn.fhir.util.StringUtil;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embeddable;
+import jakarta.persistence.Entity;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-import javax.persistence.Entity;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
import static org.apache.commons.lang3.StringUtils.defaultString;
// @formatter:off
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamToken.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamToken.java
index 098f167a909..d8c44831239 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamToken.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamToken.java
@@ -24,6 +24,20 @@ import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.param.TokenParam;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embeddable;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.PrePersist;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
@@ -31,21 +45,6 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.FullTextField;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.PrePersist;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
import static org.apache.commons.lang3.StringUtils.defaultString;
import static org.apache.commons.lang3.StringUtils.trim;
@@ -299,6 +298,7 @@ public class ResourceIndexedSearchParamToken extends BaseResourceIndexedSearchPa
@Override
public String toString() {
ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
+ b.append("id", getId());
if (getPartitionId() != null) {
b.append("partitionId", getPartitionId().getPartitionId());
}
@@ -424,11 +424,11 @@ public class ResourceIndexedSearchParamToken extends BaseResourceIndexedSearchPa
return this;
}
- @PrePersist
/**
* We truncate the fields at the last moment because the tables have limited size.
* We don't truncate earlier in the flow because the index hashes MUST be calculated on the full string.
*/
+ @PrePersist
public void truncateFieldsForDB() {
mySystem = StringUtils.truncate(mySystem, MAX_LENGTH);
myValue = StringUtils.truncate(myValue, MAX_LENGTH);
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamUri.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamUri.java
index f2a2d8fe33c..aac0e778d12 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamUri.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceIndexedSearchParamUri.java
@@ -23,26 +23,25 @@ import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.rest.param.UriParam;
+import jakarta.persistence.Column;
+import jakarta.persistence.Embeddable;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.FullTextField;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-
import static org.apache.commons.lang3.StringUtils.defaultString;
@Embeddable
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceLink.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceLink.java
index 8877dd90dbb..24ced82e9c4 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceLink.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceLink.java
@@ -19,6 +19,21 @@
*/
package ca.uhn.fhir.jpa.model.entity;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+import jakarta.persistence.Transient;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
@@ -27,21 +42,6 @@ import org.hl7.fhir.instance.model.api.IIdType;
import java.util.Date;
import javax.annotation.Nullable;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
@Entity
@Table(
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceModifiedEntity.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceModifiedEntity.java
index 11ec35ff436..c7529a45270 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceModifiedEntity.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceModifiedEntity.java
@@ -20,14 +20,15 @@ package ca.uhn.fhir.jpa.model.entity;
* #L%
*/
+import jakarta.persistence.Column;
+import jakarta.persistence.EmbeddedId;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+
import java.io.Serializable;
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
/**
* This class describes how a resourceModifiedMessage is stored for later processing in the event where
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceSearchUrlEntity.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceSearchUrlEntity.java
index 681d20222f8..33b99846d2f 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceSearchUrlEntity.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceSearchUrlEntity.java
@@ -19,14 +19,15 @@
*/
package ca.uhn.fhir.jpa.model.entity;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.Table;
+import jakarta.persistence.Temporal;
+import jakarta.persistence.TemporalType;
+
import java.util.Date;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
@Entity
@Table(
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceTable.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceTable.java
index bf1ca3b56ac..f51159ec306 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceTable.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceTable.java
@@ -28,6 +28,24 @@ import ca.uhn.fhir.jpa.model.search.SearchParamTextPropertyBinder;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.api.Constants;
import com.google.common.annotations.VisibleForTesting;
+import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.NamedEntityGraph;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.OneToOne;
+import jakarta.persistence.PostPersist;
+import jakarta.persistence.PrePersist;
+import jakarta.persistence.PreUpdate;
+import jakarta.persistence.Table;
+import jakarta.persistence.Transient;
+import jakarta.persistence.UniqueConstraint;
+import jakarta.persistence.Version;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.Session;
@@ -57,24 +75,6 @@ import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.NamedEntityGraph;
-import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
-import javax.persistence.PostPersist;
-import javax.persistence.PrePersist;
-import javax.persistence.PreUpdate;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-import javax.persistence.UniqueConstraint;
-import javax.persistence.Version;
import static ca.uhn.fhir.jpa.model.entity.ResourceTable.IDX_RES_TYPE_FHIR_ID;
@@ -148,7 +148,7 @@ public class ResourceTable extends BaseHasResource implements Serializable, IBas
private boolean myHasLinks;
@Id
- @GenericGenerator(name = "SEQ_RESOURCE_ID", strategy = "ca.uhn.fhir.jpa.model.dialect.HapiSequenceStyleGenerator")
+ @GenericGenerator(name = "SEQ_RESOURCE_ID", type = ca.uhn.fhir.jpa.model.dialect.HapiSequenceStyleGenerator.class)
@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_RESOURCE_ID")
@Column(name = "RES_ID")
@GenericField(projectable = Projectable.YES)
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceTag.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceTag.java
index ba7f24a91ae..6c50caca82c 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceTag.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceTag.java
@@ -19,25 +19,24 @@
*/
package ca.uhn.fhir.jpa.model.entity;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.ForeignKey;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinColumn;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.UniqueConstraint;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.ForeignKey;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.UniqueConstraint;
-
@Entity
@Table(
name = "HFJ_RES_TAG",
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/SearchParamPresentEntity.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/SearchParamPresentEntity.java
index b4ceebd9235..cd23d54ffe1 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/SearchParamPresentEntity.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/SearchParamPresentEntity.java
@@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.model.entity;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
+import jakarta.persistence.*;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
@@ -28,7 +29,6 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.io.Serializable;
-import javax.persistence.*;
@Entity
@Table(
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/StorageSettings.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/StorageSettings.java
index cf543b41520..fcb5c355d0e 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/StorageSettings.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/StorageSettings.java
@@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.model.entity;
import ca.uhn.fhir.context.ParserOptions;
import ca.uhn.fhir.i18n.Msg;
-import ca.uhn.fhir.jpa.model.dialect.ISequenceValueMassager;
+import ca.uhn.fhir.jpa.util.ISequenceValueMassager;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc;
import ca.uhn.fhir.util.HapiExtensions;
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/TagDefinition.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/TagDefinition.java
index 111c1c83e04..5f4ae0260b7 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/TagDefinition.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/TagDefinition.java
@@ -19,27 +19,29 @@
*/
package ca.uhn.fhir.jpa.model.entity;
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.EnumType;
+import jakarta.persistence.Enumerated;
+import jakarta.persistence.FetchType;
+import jakarta.persistence.GeneratedValue;
+import jakarta.persistence.GenerationType;
+import jakarta.persistence.Id;
+import jakarta.persistence.Index;
+import jakarta.persistence.OneToMany;
+import jakarta.persistence.SequenceGenerator;
+import jakarta.persistence.Table;
+import jakarta.persistence.Transient;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
+import org.hibernate.annotations.JdbcTypeCode;
+import org.hibernate.type.SqlTypes;
import java.io.Serializable;
import java.util.Collection;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.OneToMany;
-import javax.persistence.SequenceGenerator;
-import javax.persistence.Table;
-import javax.persistence.Transient;
@Entity
@Table(
@@ -82,6 +84,7 @@ public class TagDefinition implements Serializable {
@Column(name = "TAG_TYPE", nullable = false)
@Enumerated(EnumType.ORDINAL)
+ @JdbcTypeCode(SqlTypes.INTEGER)
private TagTypeEnum myTagType;
@Column(name = "TAG_VERSION", length = 30)
diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/util/JpaConstants.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/util/JpaConstants.java
index 333a962df0d..60fc4b7b68d 100644
--- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/util/JpaConstants.java
+++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/util/JpaConstants.java
@@ -294,7 +294,6 @@ public class JpaConstants {
*/
public static final String SUMMARY_OPERATION_URL = "http://hl7.org/fhir/uv/ips/OperationDefinition/summary";
- public static final String ORG_HIBERNATE_TYPE_TEXT_TYPE = "org.hibernate.type.TextType";
public static final String BULK_META_EXTENSION_EXPORT_IDENTIFIER =
"https://hapifhir.org/NamingSystem/bulk-export-identifier";
public static final String BULK_META_EXTENSION_JOB_ID = "https://hapifhir.org/NamingSystem/bulk-export-job-id";
diff --git a/hapi-fhir-jpaserver-searchparam/pom.xml b/hapi-fhir-jpaserver-searchparam/pom.xml
index 051a3069018..7668f21ed10 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.11.4-SNAPSHOT
+ 6.11.5-SNAPSHOT
../hapi-deployable-pom/pom.xml
@@ -13,7 +13,7 @@
hapi-fhir-jpaserver-searchparam
jar
- HAPI FHIR Search Parameters
+ HAPI FHIR JPA - Search Parameters
@@ -125,7 +125,7 @@
org.hibernate.search
- hibernate-search-mapper-orm
+ hibernate-search-mapper-orm-orm6
org.jscience
@@ -160,8 +160,8 @@
test
- javax.servlet
- javax.servlet-api
+ jakarta.servlet
+ jakarta.servlet-api
test
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/interceptor/model/ReadPartitionIdRequestDetails.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/interceptor/model/ReadPartitionIdRequestDetails.java
index 4f80dd9bbc2..c7884f8ad60 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/interceptor/model/ReadPartitionIdRequestDetails.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/interceptor/model/ReadPartitionIdRequestDetails.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeEvent.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeEvent.java
index 2ab2483c29f..8490bcabd03 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeEvent.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeEvent.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeListener.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeListener.java
index 0f6b2a61a44..3e6c8b5e96d 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeListener.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeListener.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeListenerCache.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeListenerCache.java
index a3c7cddcea9..d44b20ce2d3 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeListenerCache.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeListenerCache.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeListenerCacheRefresher.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeListenerCacheRefresher.java
index 5cba0d76dd0..7afd92d97e0 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeListenerCacheRefresher.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeListenerCacheRefresher.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeListenerRegistry.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeListenerRegistry.java
index fa6ba39cf72..e2144a84ddf 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeListenerRegistry.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceChangeListenerRegistry.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceVersionSvc.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceVersionSvc.java
index 56c554c1ab8..d7297b2e453 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceVersionSvc.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/IResourceVersionSvc.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeEvent.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeEvent.java
index 47c39e0262a..2193b4c7f54 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeEvent.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeEvent.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerCache.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerCache.java
index 1efec3226db..a3eb41953ed 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerCache.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerCache.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerCacheFactory.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerCacheFactory.java
index 92e8f725db1..4f412bd5a6d 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerCacheFactory.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerCacheFactory.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerCacheRefresherImpl.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerCacheRefresherImpl.java
index 131b5a6851d..09cf5b1de53 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerCacheRefresherImpl.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerCacheRefresherImpl.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerRegistryImpl.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerRegistryImpl.java
index 8b30b1af72d..bdd8ab4d164 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerRegistryImpl.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerRegistryImpl.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerRegistryInterceptor.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerRegistryInterceptor.java
index feec3df43ae..eba4a21f3ca 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerRegistryInterceptor.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeListenerRegistryInterceptor.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
@@ -23,6 +23,7 @@ import ca.uhn.fhir.IHapiBootOrder;
import ca.uhn.fhir.interceptor.api.Hook;
import ca.uhn.fhir.interceptor.api.IInterceptorService;
import ca.uhn.fhir.interceptor.api.Pointcut;
+import jakarta.annotation.PreDestroy;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.ContextRefreshedEvent;
@@ -30,8 +31,6 @@ import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service;
-import javax.annotation.PreDestroy;
-
/**
* This interceptor watches all resource changes on the server and compares them to the {@link IResourceChangeListenerCache}
* entries. If the resource matches the resource type and search parameter map of that entry, then the corresponding cache
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeResult.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeResult.java
index c5ca4cffa6d..ca30c7decc1 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeResult.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceChangeResult.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourcePersistentIdMap.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourcePersistentIdMap.java
index 071dc8f1f20..ac01d8c0b54 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourcePersistentIdMap.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourcePersistentIdMap.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceVersionCache.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceVersionCache.java
index 6b54a10a5ab..ec741ff7ab2 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceVersionCache.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceVersionCache.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceVersionMap.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceVersionMap.java
index 81b7b4f580f..225db5831c1 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceVersionMap.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/cache/ResourceVersionMap.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/partition/IRequestPartitionHelperSvc.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/partition/IRequestPartitionHelperSvc.java
index ea03d2cb32d..c2bfd3a67f1 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/partition/IRequestPartitionHelperSvc.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/partition/IRequestPartitionHelperSvc.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/MatchUrlService.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/MatchUrlService.java
index f1d5a4a66b3..fcc2cc5e89b 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/MatchUrlService.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/MatchUrlService.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/ResourceMetaParams.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/ResourceMetaParams.java
index 0114fba0b7a..78e0b475351 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/ResourceMetaParams.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/ResourceMetaParams.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/ResourceSearch.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/ResourceSearch.java
index e37924741bf..9801b1468b1 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/ResourceSearch.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/ResourceSearch.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParamConstants.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParamConstants.java
index 9478efdab78..4aa0a28bbc0 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParamConstants.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParamConstants.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParameterMap.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParameterMap.java
index 0d5784a5818..c3d1ffa1ae1 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParameterMap.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParameterMap.java
@@ -1,6 +1,6 @@
/*
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/config/NicknameServiceConfig.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/config/NicknameServiceConfig.java
index 8aca1889e20..4ac537f3c2f 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/config/NicknameServiceConfig.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/config/NicknameServiceConfig.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/config/SearchParamConfig.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/config/SearchParamConfig.java
index f1522621382..aa6c5233b40 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/config/SearchParamConfig.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/config/SearchParamConfig.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
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 8ed714eb385..fdaf1eeafa1 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
@@ -1,6 +1,6 @@
/*
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
@@ -49,6 +49,7 @@ import ca.uhn.fhir.util.UrlUtil;
import ca.uhn.fhir.util.bundle.BundleEntryParts;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Sets;
+import jakarta.annotation.PostConstruct;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
@@ -82,7 +83,6 @@ import java.util.TreeSet;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import javax.annotation.PostConstruct;
import javax.measure.quantity.Quantity;
import javax.measure.unit.NonSI;
import javax.measure.unit.Unit;
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/CrossPartitionReferenceDetails.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/CrossPartitionReferenceDetails.java
index e7f9c352a24..643d26cef7b 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/CrossPartitionReferenceDetails.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/CrossPartitionReferenceDetails.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/GeopointNormalizer.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/GeopointNormalizer.java
index 4d691e07b56..d5bc0957fab 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/GeopointNormalizer.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/GeopointNormalizer.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/IResourceLinkResolver.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/IResourceLinkResolver.java
index dee9d778828..fad69f1ffef 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/IResourceLinkResolver.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/IResourceLinkResolver.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/ISearchParamExtractor.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/ISearchParamExtractor.java
index fe137364848..29e3eb7b2e2 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/ISearchParamExtractor.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/ISearchParamExtractor.java
@@ -1,6 +1,6 @@
/*
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
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 db6bf9bff5e..63f5e14f47d 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
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/PathAndRef.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/PathAndRef.java
index a649c0601e1..027fb363c57 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/PathAndRef.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/PathAndRef.java
@@ -1,6 +1,6 @@
/*
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/ResourceIndexedSearchParamComposite.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/ResourceIndexedSearchParamComposite.java
index dfd41f27635..2ca11dd124f 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/ResourceIndexedSearchParamComposite.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/ResourceIndexedSearchParamComposite.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
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 3af3d4c2986..29b0baeef31 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
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
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 66d1bb1a047..983638e9e31 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
@@ -1,6 +1,6 @@
/*
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
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 a7e94c3ef19..f1e87737f5b 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
@@ -1,6 +1,6 @@
/*
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
@@ -24,6 +24,7 @@ import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import com.google.common.annotations.VisibleForTesting;
+import jakarta.annotation.PostConstruct;
import org.hl7.fhir.dstu3.context.IWorkerContext;
import org.hl7.fhir.dstu3.hapi.ctx.HapiWorkerContext;
import org.hl7.fhir.dstu3.model.Base;
@@ -32,7 +33,6 @@ import org.hl7.fhir.instance.model.api.IBase;
import java.util.ArrayList;
import java.util.List;
-import javax.annotation.PostConstruct;
public class SearchParamExtractorDstu3 extends BaseSearchParamExtractor implements ISearchParamExtractor {
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 6b22d38b625..bc82a49e0ca 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
@@ -1,6 +1,6 @@
/*
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
@@ -26,6 +26,7 @@ import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.sl.cache.Cache;
import ca.uhn.fhir.sl.cache.CacheFactory;
import com.google.common.annotations.VisibleForTesting;
+import jakarta.annotation.PostConstruct;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.PathEngineException;
import org.hl7.fhir.instance.model.api.IBase;
@@ -46,7 +47,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
-import javax.annotation.PostConstruct;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
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 6ff518529a4..4add6601f1f 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
@@ -1,6 +1,6 @@
/*
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
@@ -26,6 +26,7 @@ import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.sl.cache.Cache;
import ca.uhn.fhir.sl.cache.CacheFactory;
import com.google.common.annotations.VisibleForTesting;
+import jakarta.annotation.PostConstruct;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.PathEngineException;
import org.hl7.fhir.instance.model.api.IBase;
@@ -46,7 +47,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
-import javax.annotation.PostConstruct;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
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 05ae9608475..44625b53a97 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
@@ -1,6 +1,6 @@
/*
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
@@ -25,6 +25,7 @@ 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;
+import jakarta.annotation.PostConstruct;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.PathEngineException;
import org.hl7.fhir.instance.model.api.IBase;
@@ -45,7 +46,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
-import javax.annotation.PostConstruct;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
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 01e288499c4..b8fddf42ea2 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
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/StringTrimmingTrimmerMatcher.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/StringTrimmingTrimmerMatcher.java
index f091bdf3c1d..cc40da8191e 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/StringTrimmingTrimmerMatcher.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/StringTrimmingTrimmerMatcher.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/AuthorizationSearchParamMatcher.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/AuthorizationSearchParamMatcher.java
index 25366064cfd..b8fb38ebaca 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/AuthorizationSearchParamMatcher.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/AuthorizationSearchParamMatcher.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryMatchResult.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryMatchResult.java
index 06cc6c57715..c7cf4e0fe07 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryMatchResult.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/InMemoryMatchResult.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
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 829b369867e..4b3c145fb36 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
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/IndexedSearchParamExtractor.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/IndexedSearchParamExtractor.java
index 3deafea8642..64767055e00 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/IndexedSearchParamExtractor.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/IndexedSearchParamExtractor.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/SearchParamMatcher.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/SearchParamMatcher.java
index 75367cca4bc..1f73d8bf1e0 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/SearchParamMatcher.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/matcher/SearchParamMatcher.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/nickname/NicknameInterceptor.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/nickname/NicknameInterceptor.java
index 3dcf5fec1e4..11081c200c7 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/nickname/NicknameInterceptor.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/nickname/NicknameInterceptor.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/provider/SearchableHashMapResourceProvider.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/provider/SearchableHashMapResourceProvider.java
index 41aed01c271..b5f8b513d94 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/provider/SearchableHashMapResourceProvider.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/provider/SearchableHashMapResourceProvider.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/ISearchParamProvider.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/ISearchParamProvider.java
index ac050c36b9c..de4fb681c85 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/ISearchParamProvider.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/ISearchParamProvider.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/ISearchParamRegistryController.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/ISearchParamRegistryController.java
index 35c9d14c4c2..c113b118b20 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/ISearchParamRegistryController.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/ISearchParamRegistryController.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/JpaSearchParamCache.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/JpaSearchParamCache.java
index d1866bfcb3a..b6d88cafefc 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/JpaSearchParamCache.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/JpaSearchParamCache.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/ReadOnlySearchParamCache.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/ReadOnlySearchParamCache.java
index a9c86f1fa8a..7bacb9317ae 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/ReadOnlySearchParamCache.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/ReadOnlySearchParamCache.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/RuntimeSearchParamCache.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/RuntimeSearchParamCache.java
index f0d4b49d379..939a654c860 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/RuntimeSearchParamCache.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/RuntimeSearchParamCache.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
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 d8bd1b6b55d..1fb3fa28831 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
@@ -1,6 +1,6 @@
/*
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
@@ -42,6 +42,8 @@ import ca.uhn.fhir.util.SearchParameterUtil;
import ca.uhn.fhir.util.StopWatch;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Sets;
+import jakarta.annotation.PostConstruct;
+import jakarta.annotation.PreDestroy;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.hl7.fhir.instance.model.api.IBaseResource;
@@ -59,8 +61,6 @@ import java.util.Optional;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
import static org.apache.commons.lang3.StringUtils.isBlank;
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/SearchParameterCanonicalizer.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/SearchParameterCanonicalizer.java
index f8b086965ca..cb2aa5ae87d 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/SearchParameterCanonicalizer.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/registry/SearchParameterCanonicalizer.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/retry/Retrier.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/retry/Retrier.java
index 9e6d8b204e9..40016c6c5ce 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/retry/Retrier.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/retry/Retrier.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/Dstu3DistanceHelper.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/Dstu3DistanceHelper.java
index a1041a1b738..77514845a41 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/Dstu3DistanceHelper.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/Dstu3DistanceHelper.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/JpaParamUtil.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/JpaParamUtil.java
index f7713bb924d..66bdb32cd8e 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/JpaParamUtil.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/JpaParamUtil.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/LastNParameterHelper.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/LastNParameterHelper.java
index caff223b6ea..4b86a7228af 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/LastNParameterHelper.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/LastNParameterHelper.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/RuntimeSearchParamHelper.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/RuntimeSearchParamHelper.java
index 5601d73a6e7..312079b585a 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/RuntimeSearchParamHelper.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/RuntimeSearchParamHelper.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/SearchParameterHelper.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/SearchParameterHelper.java
index ea566709e54..55e80e9d3ef 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/SearchParameterHelper.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/SearchParameterHelper.java
@@ -1,6 +1,6 @@
/*-
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/SourceParam.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/SourceParam.java
index 4ec77935492..7b183ff7657 100644
--- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/SourceParam.java
+++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/util/SourceParam.java
@@ -1,6 +1,6 @@
/*
* #%L
- * HAPI FHIR Search Parameters
+ * HAPI FHIR JPA - Search Parameters
* %%
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
diff --git a/hapi-fhir-jpaserver-subscription/pom.xml b/hapi-fhir-jpaserver-subscription/pom.xml
index 9b119ecea50..03f4d2159b5 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.11.4-SNAPSHOT
+ 6.11.5-SNAPSHOT
../hapi-deployable-pom/pom.xml
@@ -55,7 +55,7 @@
org.thymeleaf
- thymeleaf-spring5
+ thymeleaf-spring6
org.springframework
@@ -66,8 +66,8 @@
spring-context-support
- javax.servlet
- javax.servlet-api
+ jakarta.servlet
+ jakarta.servlet-api
provided
@@ -93,11 +93,6 @@
jetty-server
test
-
- org.eclipse.jetty
- jetty-servlet
- test
-
org.springframework.boot
spring-boot-starter-test
diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/deliver/email/EmailDetails.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/deliver/email/EmailDetails.java
index 40fd11b611c..f7ceb37b2ec 100644
--- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/deliver/email/EmailDetails.java
+++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/deliver/email/EmailDetails.java
@@ -26,8 +26,8 @@ import org.hl7.fhir.instance.model.api.IIdType;
import org.simplejavamail.api.email.Email;
import org.simplejavamail.email.EmailBuilder;
import org.thymeleaf.context.Context;
-import org.thymeleaf.spring5.SpringTemplateEngine;
-import org.thymeleaf.spring5.dialect.SpringStandardDialect;
+import org.thymeleaf.spring6.SpringTemplateEngine;
+import org.thymeleaf.spring6.dialect.SpringStandardDialect;
import org.thymeleaf.templatemode.TemplateMode;
import org.thymeleaf.templateresolver.StringTemplateResolver;
diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/deliver/websocket/SubscriptionWebsocketHandler.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/deliver/websocket/SubscriptionWebsocketHandler.java
index 706d01ee16d..982ba3d9082 100644
--- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/deliver/websocket/SubscriptionWebsocketHandler.java
+++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/deliver/websocket/SubscriptionWebsocketHandler.java
@@ -24,6 +24,8 @@ import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelRegi
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelWithHandlers;
import ca.uhn.fhir.jpa.subscription.match.registry.ActiveSubscription;
import ca.uhn.fhir.jpa.subscription.model.ResourceDeliveryMessage;
+import jakarta.annotation.PostConstruct;
+import jakarta.annotation.PreDestroy;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.IdType;
import org.slf4j.Logger;
@@ -39,8 +41,6 @@ import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;
import java.io.IOException;
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
public class SubscriptionWebsocketHandler extends TextWebSocketHandler implements WebSocketHandler {
private static Logger ourLog = LoggerFactory.getLogger(SubscriptionWebsocketHandler.class);
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 b16b1874cd3..14fade327b2 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
@@ -27,6 +27,7 @@ import ca.uhn.fhir.jpa.subscription.channel.api.IChannelReceiver;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelFactory;
import ca.uhn.fhir.jpa.topic.SubscriptionTopicMatchingSubscriber;
import ca.uhn.fhir.jpa.topic.SubscriptionTopicRegisteringSubscriber;
+import jakarta.annotation.PreDestroy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -34,8 +35,6 @@ import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
-import javax.annotation.PreDestroy;
-
import static ca.uhn.fhir.jpa.subscription.match.matcher.subscriber.SubscriptionMatchingSubscriber.SUBSCRIPTION_MATCHING_CHANNEL_NAME;
public class MatchingQueueSubscriberLoader {
diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionRegistry.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionRegistry.java
index e791afa51e8..1a7742b13e4 100644
--- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionRegistry.java
+++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/match/registry/SubscriptionRegistry.java
@@ -27,6 +27,7 @@ import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionChannelRegi
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscription;
import ca.uhn.fhir.jpa.subscription.model.ChannelRetryConfiguration;
import ca.uhn.fhir.util.HapiExtensions;
+import jakarta.annotation.PreDestroy;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
@@ -39,7 +40,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
-import javax.annotation.PreDestroy;
/**
* Cache of active subscriptions. When a new subscription is added to the cache, a new Spring Channel is created
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 2f72cb60509..c905a4960b6 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
@@ -23,13 +23,13 @@ import ca.uhn.fhir.interceptor.api.IInterceptorService;
import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.topic.SubscriptionTopicValidatingInterceptor;
import com.google.common.annotations.VisibleForTesting;
+import jakarta.annotation.PostConstruct;
import org.hl7.fhir.dstu2.model.Subscription;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Set;
-import javax.annotation.PostConstruct;
public class SubscriptionSubmitInterceptorLoader {
private static final Logger ourLog = LoggerFactory.getLogger(SubscriptionSubmitInterceptorLoader.class);
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 55563d08c71..c32a2fadb6d 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
@@ -52,6 +52,7 @@ import ca.uhn.fhir.util.StopWatch;
import ca.uhn.fhir.util.UrlUtil;
import ca.uhn.fhir.util.ValidateUtil;
import com.google.common.collect.Lists;
+import jakarta.annotation.PostConstruct;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
@@ -80,7 +81,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import javax.annotation.Nullable;
-import javax.annotation.PostConstruct;
import static ca.uhn.fhir.rest.server.provider.ProviderConstants.SUBSCRIPTION_TRIGGERING_PARAM_RESOURCE_ID;
import static java.util.Objects.isNull;
diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/channel/subscription/BroadcastingSubscribableChannelWrapperTest.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/channel/subscription/BroadcastingSubscribableChannelWrapperTest.java
index 4c29d2b86ad..f78878cb75f 100644
--- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/channel/subscription/BroadcastingSubscribableChannelWrapperTest.java
+++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/channel/subscription/BroadcastingSubscribableChannelWrapperTest.java
@@ -27,7 +27,7 @@ class BroadcastingSubscribableChannelWrapperTest {
try {
svc.send(new ResourceModifiedJsonMessage(new ResourceModifiedMessage()));
} catch (MessageDeliveryException e) {
- assertThat(e.getMessage(), containsString("Channel has zero subscribers"));
+ assertThat(e.getCause().getMessage(), containsString("Channel has zero subscribers"));
}
}
diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/match/deliver/BaseSubscriptionDeliverySubscriberTest.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/match/deliver/BaseSubscriptionDeliverySubscriberTest.java
index 16789be59d3..5153c161776 100644
--- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/match/deliver/BaseSubscriptionDeliverySubscriberTest.java
+++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/match/deliver/BaseSubscriptionDeliverySubscriberTest.java
@@ -79,7 +79,7 @@ public class BaseSubscriptionDeliverySubscriberTest {
private SubscriptionDeliveringRestHookSubscriber mySubscriber;
private SubscriptionDeliveringMessageSubscriber myMessageSubscriber;
private SubscriptionDeliveringEmailSubscriber myEmailSubscriber;
- private final FhirContext myCtx = FhirContext.forR4();
+ private final FhirContext myCtx = FhirContext.forR4Cached();
@Mock
private IInterceptorBroadcaster myInterceptorBroadcaster;
@@ -187,7 +187,7 @@ public class BaseSubscriptionDeliverySubscriberTest {
mySubscriber.handleMessage(new ResourceDeliveryJsonMessage(payload));
fail();
} catch (MessagingException e) {
- assertEquals(Msg.code(2) + "Failure handling subscription payload for subscription: Subscription/123; nested exception is ca.uhn.fhir.rest.server.exceptions.InternalErrorException: FOO", e.getMessage());
+ assertEquals(Msg.code(2) + "Failure handling subscription payload for subscription: Subscription/123", e.getMessage());
}
verify(myGenericClient, times(1)).update();
diff --git a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/SubscriptionTestConfig.java b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/SubscriptionTestConfig.java
index e46ba54cf6f..0912e517285 100644
--- a/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/SubscriptionTestConfig.java
+++ b/hapi-fhir-jpaserver-subscription/src/test/java/ca/uhn/fhir/jpa/subscription/module/SubscriptionTestConfig.java
@@ -46,7 +46,7 @@ public class SubscriptionTestConfig {
private IChannelNamer myChannelNamer;
@Primary
- @Bean(autowire = Autowire.BY_NAME, name = "myJpaValidationSupportChain")
+ @Bean(name = "myJpaValidationSupportChain")
public IValidationSupport validationSupportChainR4() {
return myFhirContext.getValidationSupport();
}
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 b081bbdb37f..c1d003c11c7 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
@@ -32,8 +32,8 @@ import ca.uhn.test.concurrency.IPointcutLatch;
import ca.uhn.test.concurrency.PointcutLatch;
import com.google.common.collect.Lists;
import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.hl7.fhir.dstu3.model.CodeableConcept;
import org.hl7.fhir.dstu3.model.Coding;
import org.hl7.fhir.dstu3.model.IdType;
@@ -51,7 +51,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.SubscribableChannel;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
diff --git a/hapi-fhir-jpaserver-test-dstu2/pom.xml b/hapi-fhir-jpaserver-test-dstu2/pom.xml
index 177675ad5a5..773adc6b312 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.11.4-SNAPSHOT
+ 6.11.5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2SystemTest.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2SystemTest.java
index ae3d1ff799a..599a774b85f 100644
--- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2SystemTest.java
+++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2SystemTest.java
@@ -6,9 +6,9 @@ import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import org.junit.jupiter.api.BeforeEach;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.ServletConfig;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import static org.mockito.Mockito.mock;
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 15aa0f38c91..108a573859f 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
@@ -72,7 +72,7 @@ import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
-import javax.persistence.EntityManager;
+import jakarta.persistence.EntityManager;
import java.util.ArrayList;
import java.util.List;
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 57c472b280d..e5c828100a2 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
@@ -17,7 +17,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import java.util.List;
import static org.hamcrest.MatcherAssert.assertThat;
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 12bfe63c89d..13537d4a6a0 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
@@ -82,7 +82,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
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 a428d1fb818..3bbca30528c 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
@@ -8,8 +8,8 @@ import ca.uhn.fhir.model.dstu2.valueset.SubscriptionStatusEnum;
import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import org.eclipse.jetty.websocket.api.Session;
-import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
+import org.eclipse.jetty.websocket.api.annotations.OnWebSocketOpen;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
@@ -190,7 +190,7 @@ public class SubscriptionsDstu2Test extends BaseResourceProviderDstu2Test {
/**
* Basic Echo Client Socket
*/
- @WebSocket(maxTextMessageSize = 64 * 1024)
+ @WebSocket()
public class SimpleEchoSocket extends BaseSocket {
@SuppressWarnings("unused")
@@ -200,14 +200,14 @@ public class SubscriptionsDstu2Test extends BaseResourceProviderDstu2Test {
mySubsId = theSubsId;
}
- @OnWebSocketConnect
+ @OnWebSocketOpen
public void onConnect(Session session) {
ourLog.info("Got connect: {}", session);
this.session = session;
try {
String sending = "bind " + mySubsId;
ourLog.info("Sending: {}", sending);
- session.getRemote().sendString(sending);
+ session.sendText(sending, null);
} catch (Throwable t) {
ourLog.error("Failure", t);
}
@@ -229,7 +229,7 @@ public class SubscriptionsDstu2Test extends BaseResourceProviderDstu2Test {
/**
* Basic Echo Client Socket
*/
- @WebSocket(maxTextMessageSize = 64 * 1024)
+ @WebSocket()
public class DynamicEchoSocket extends BaseSocket {
private List myReceived = new ArrayList();
@@ -243,14 +243,14 @@ public class SubscriptionsDstu2Test extends BaseResourceProviderDstu2Test {
myEncoding = theEncoding;
}
- @OnWebSocketConnect
+ @OnWebSocketOpen
public void onConnect(Session session) {
ourLog.info("Got connect: {}", session);
this.session = session;
try {
String sending = "bind " + myCriteria;
ourLog.info("Sending: {}", sending);
- session.getRemote().sendString(sending);
+ session.sendText(sending, null);
} catch (Throwable t) {
ourLog.error("Failure", t);
}
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 615309cca5a..1771c4de9d3 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
@@ -37,8 +37,8 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.hl7.fhir.r4.model.IdType;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
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 1a3509cd3f4..6e53d143310 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
@@ -18,8 +18,8 @@ import ca.uhn.fhir.rest.client.interceptor.SimpleRequestHeaderInterceptor;
import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.test.utilities.JettyUtil;
import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
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 429a6cc69db..563b2627355 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
@@ -24,8 +24,8 @@ import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.test.utilities.JettyUtil;
import com.google.common.collect.Lists;
import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.jupiter.api.AfterAll;
diff --git a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToStorageSettingsDstu2Test.java b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToStorageSettingsDstu2Test.java
index 6f993478058..454743f20d2 100644
--- a/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToStorageSettingsDstu2Test.java
+++ b/hapi-fhir-jpaserver-test-dstu2/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToStorageSettingsDstu2Test.java
@@ -23,8 +23,8 @@ import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.test.utilities.JettyUtil;
import com.google.common.collect.Lists;
import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
diff --git a/hapi-fhir-jpaserver-test-dstu3/pom.xml b/hapi-fhir-jpaserver-test-dstu3/pom.xml
index 83dde3e9706..3af365157a4 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.11.4-SNAPSHOT
+ 6.11.5-SNAPSHOT
../hapi-deployable-pom/pom.xml
diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3SystemTest.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3SystemTest.java
index f9835681abc..65f79eba0d0 100644
--- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3SystemTest.java
+++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3SystemTest.java
@@ -7,9 +7,9 @@ import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import org.junit.jupiter.api.BeforeEach;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.ServletConfig;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import static org.mockito.Mockito.mock;
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 a20b849cacf..04c59ac49b9 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
@@ -22,7 +22,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
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 db98eb767bd..83123192373 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
@@ -106,7 +106,7 @@ import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
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 7cda01d5905..2da47c1baed 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
@@ -2350,7 +2350,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
try {
mySystemDao.transaction(mySrd, b);
} catch (ResourceVersionConflictException e) {
- assertEquals(Msg.code(550) + Msg.code(550) + Msg.code(989) + "Trying to update Patient/P1/_history/2 but this is not the current version", e.getMessage());
+ assertEquals(Msg.code(550) + Msg.code(989) + "Trying to update Patient/P1/_history/2 but this is not the current version", e.getMessage());
}
b = new Bundle();
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 37e0a8ad6b8..e6c00f876bb 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
@@ -10,9 +10,10 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.test.utilities.JettyUtil;
import ca.uhn.fhir.test.utilities.ProxyUtil;
+import ca.uhn.fhir.test.utilities.server.HttpServletExtension;
import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.ee10.servlet.ServletHandler;
+import org.eclipse.jetty.ee10.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;
@@ -21,6 +22,7 @@ import org.hl7.fhir.utilities.npm.PackageServer;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -47,36 +49,29 @@ public class IgInstallerDstu3Test extends BaseJpaDstu3Test {
@Autowired
@Qualifier(PackageUtils.LOADER_WITH_CACHE)
private IHapiPackageCacheManager myPackageCacheManager;
- private Server myServer;
- private FakeNpmServlet myFakeNpmServlet;
@Autowired
private INpmPackageVersionDao myPackageVersionDao;
- private int myPort;
+ private FakeNpmServlet myFakeNpmServlet = new FakeNpmServlet();
+ @RegisterExtension
+ public HttpServletExtension myServer = new HttpServletExtension()
+ .withServlet(myFakeNpmServlet);
+
+
@Override
@BeforeEach
public void before() throws Exception {
super.before();
JpaPackageCache jpaPackageCache = ProxyUtil.getSingletonTarget(myPackageCacheManager, JpaPackageCache.class);
-
- myServer = new Server(0);
- ServletHandler proxyHandler = new ServletHandler();
- myFakeNpmServlet = new FakeNpmServlet();
- ServletHolder servletHolder = new ServletHolder(myFakeNpmServlet);
- proxyHandler.addServletWithMapping(servletHolder, "/*");
- myServer.setHandler(proxyHandler);
- myServer.start();
-
- myPort = JettyUtil.getPortForStartedServer(myServer);
+
jpaPackageCache.getPackageServers().clear();
- jpaPackageCache.addPackageServer(new PackageServer("http://localhost:" + myPort));
+ jpaPackageCache.addPackageServer(new PackageServer(myServer.getBaseUrl()));
myFakeNpmServlet.getResponses().clear();
}
@AfterEach
public void after() throws Exception {
- JettyUtil.closeServer(myServer);
myStorageSettings.setAllowExternalReferences(new JpaStorageSettings().isAllowExternalReferences());
}
@@ -156,7 +151,7 @@ public class IgInstallerDstu3Test extends BaseJpaDstu3Test {
igInstaller.install(new PackageInstallationSpec()
.setName("nictiz.fhir.nl.stu3.questionnaires")
.setVersion("1.0.2")
- .setPackageUrl("http://localhost:" + myPort + "/foo.tgz")
+ .setPackageUrl(myServer.getBaseUrl() + "/foo.tgz")
);
runInTransaction(() -> {
@@ -240,7 +235,7 @@ public class IgInstallerDstu3Test extends BaseJpaDstu3Test {
igInstaller.install(new PackageInstallationSpec()
.setName("blah")
.setVersion("1.0.2")
- .setPackageUrl("http://localhost:" + myPort + "/foo.tgz")
+ .setPackageUrl(myServer.getBaseUrl() + "/foo.tgz")
);
fail();
} catch (InvalidRequestException e) {
@@ -255,11 +250,11 @@ public class IgInstallerDstu3Test extends BaseJpaDstu3Test {
igInstaller.install(new PackageInstallationSpec()
.setName("blah")
.setVersion("1.0.2")
- .setPackageUrl("http://localhost:" + myPort + "/foo.tgz")
+ .setPackageUrl(myServer.getBaseUrl() + "/foo.tgz")
);
fail();
} catch (ResourceNotFoundException e) {
- assertEquals(Msg.code(1303) + "Received HTTP 404 from URL: http://localhost:" + myPort + "/foo.tgz", e.getMessage());
+ assertEquals(Msg.code(1303) + "Received HTTP 404 from URL: " + myServer.getBaseUrl() + "/foo.tgz", e.getMessage());
}
}
diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/packages/NpmDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/packages/NpmDstu3Test.java
index bee28e90161..0f293238783 100644
--- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/packages/NpmDstu3Test.java
+++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/packages/NpmDstu3Test.java
@@ -1,35 +1,24 @@
package ca.uhn.fhir.jpa.packages;
import ca.uhn.fhir.jpa.test.BaseJpaDstu3Test;
-import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.api.ValidationModeEnum;
-import ca.uhn.fhir.test.utilities.JettyUtil;
import ca.uhn.fhir.test.utilities.ProxyUtil;
+import ca.uhn.fhir.test.utilities.server.HttpServletExtension;
import ca.uhn.fhir.util.ClasspathUtil;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
import org.hl7.fhir.dstu3.model.CodeSystem;
import org.hl7.fhir.dstu3.model.Condition;
import org.hl7.fhir.dstu3.model.OperationOutcome;
import org.hl7.fhir.dstu3.model.StructureDefinition;
import org.hl7.fhir.dstu3.model.ValueSet;
import org.hl7.fhir.utilities.npm.PackageServer;
-import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -44,43 +33,34 @@ public class NpmDstu3Test extends BaseJpaDstu3Test {
@Autowired
private NpmJpaValidationSupport myNpmJpaValidationSupport;
- private Server myServer;
- private final Map myResponses = new HashMap<>();
+ private ca.uhn.fhir.jpa.packages.FakeNpmServlet myFakeNpmServlet = new ca.uhn.fhir.jpa.packages.FakeNpmServlet();
+ @RegisterExtension
+ public HttpServletExtension myServer = new HttpServletExtension()
+ .withServlet(myFakeNpmServlet);
+ @Override
@BeforeEach
public void before() throws Exception {
+ super.before();
JpaPackageCache jpaPackageCache = ProxyUtil.getSingletonTarget(myPackageCacheManager, JpaPackageCache.class);
- myServer = new Server(0);
- ServletHandler proxyHandler = new ServletHandler();
- FakeNpmServlet fakeNpmServlet = new FakeNpmServlet();
- ServletHolder servletHolder = new ServletHolder(fakeNpmServlet);
- proxyHandler.addServletWithMapping(servletHolder, "/*");
- myServer.setHandler(proxyHandler);
- myServer.start();
-
- int port = JettyUtil.getPortForStartedServer(myServer);
jpaPackageCache.getPackageServers().clear();
- jpaPackageCache.addPackageServer(new PackageServer("http://localhost:" + port));
+ jpaPackageCache.addPackageServer(new PackageServer(myServer.getBaseUrl()));
- myResponses.clear();
+ myFakeNpmServlet.getResponses().clear();
}
- @AfterEach
- public void after() throws Exception {
- JettyUtil.closeServer(myServer);
- }
@Test
public void installDstu3Package() throws Exception {
byte[] bytes = ClasspathUtil.loadResourceAsByteArray("/packages/basisprofil.de.tar.gz");
- myResponses.put("/basisprofil.de/0.2.40", bytes);
+ myFakeNpmServlet.getResponses().put("/basisprofil.de/0.2.40", bytes);
PackageInstallationSpec spec = new PackageInstallationSpec().setName("basisprofil.de").setVersion("0.2.40").setInstallMode(PackageInstallationSpec.InstallModeEnum.STORE_ONLY);
igInstaller.install(spec);
// Be sure no further communication with the server
- JettyUtil.closeServer(myServer);
+ myServer.stopServer();
StructureDefinition sd = (StructureDefinition) myNpmJpaValidationSupport.fetchStructureDefinition("http://fhir.de/StructureDefinition/condition-de-basis/0.2");
assertEquals("http://fhir.de/StructureDefinition/condition-de-basis/0.2", sd.getUrl());
@@ -104,25 +84,4 @@ public class NpmDstu3Test extends BaseJpaDstu3Test {
containsString("Condition.subject: minimum required = 1, but only found 0 (from http://fhir.de/StructureDefinition/condition-de-basis/0.2"));
}
-
- private class FakeNpmServlet extends HttpServlet {
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
- String requestUrl = req.getRequestURI();
- if (myResponses.containsKey(requestUrl)) {
- ourLog.info("Responding to request: {}", requestUrl);
-
- resp.setStatus(200);
- resp.setHeader(Constants.HEADER_CONTENT_TYPE, "application/gzip");
- resp.getOutputStream().write(myResponses.get(requestUrl));
- resp.getOutputStream().close();
- } else {
- ourLog.warn("Unknown request: {}", requestUrl);
-
- resp.sendError(404);
- }
-
- }
- }
}
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 95c777537f6..c716da163e4 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
@@ -5,8 +5,8 @@ import ca.uhn.fhir.jpa.util.SubscriptionsRequireManualActivationInterceptorDstu3
import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import org.eclipse.jetty.websocket.api.Session;
-import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
+import org.eclipse.jetty.websocket.api.annotations.OnWebSocketOpen;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
import org.hl7.fhir.dstu3.model.Subscription;
import org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType;
@@ -179,7 +179,7 @@ public class SubscriptionsDstu3Test extends BaseResourceProviderDstu3Test {
/**
* Basic Echo Client Socket
*/
- @WebSocket(maxTextMessageSize = 64 * 1024)
+ @WebSocket
public class DynamicEchoSocket extends BaseSocket {
private String myCriteria;
@@ -193,14 +193,14 @@ public class SubscriptionsDstu3Test extends BaseResourceProviderDstu3Test {
myEncoding = theEncoding;
}
- @OnWebSocketConnect
+ @OnWebSocketOpen
public void onConnect(Session session) {
ourLog.info("Got connect: {}", session);
this.session = session;
try {
String sending = "bind " + myCriteria;
ourLog.info("Sending: {}", sending);
- session.getRemote().sendString(sending);
+ session.sendText(sending, null);
} catch (Throwable t) {
ourLog.error("Failure", t);
}
@@ -227,7 +227,7 @@ public class SubscriptionsDstu3Test extends BaseResourceProviderDstu3Test {
/**
* Basic Echo Client Socket
*/
- @WebSocket(maxTextMessageSize = 64 * 1024)
+ @WebSocket
public class SimpleEchoSocket extends BaseSocket {
@SuppressWarnings("unused")
@@ -237,14 +237,14 @@ public class SubscriptionsDstu3Test extends BaseResourceProviderDstu3Test {
mySubsId = theSubsId;
}
- @OnWebSocketConnect
+ @OnWebSocketOpen
public void onConnect(Session session) {
ourLog.info("Got connect: {}", session);
this.session = session;
try {
String sending = "bind " + mySubsId;
ourLog.info("Sending: {}", sending);
- session.getRemote().sendString(sending);
+ session.sendText(sending, null);
} catch (Throwable t) {
ourLog.error("Failure", t);
}
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 75f5a7301d7..93e904b44a7 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
@@ -16,8 +16,8 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.hl7.fhir.dstu3.model.Binary;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
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 43e66e09e3b..730cb5c13fb 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
@@ -26,8 +26,8 @@ import ca.uhn.fhir.util.HapiExtensions;
import ca.uhn.fhir.util.MetaUtil;
import com.google.common.collect.Lists;
import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.hl7.fhir.dstu3.model.BooleanType;
import org.hl7.fhir.dstu3.model.CodeableConcept;
import org.hl7.fhir.dstu3.model.Coding;
@@ -52,7 +52,7 @@ import org.junit.jupiter.params.provider.ValueSource;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Nonnull;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToStorageSettingsDstu3Test.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToStorageSettingsDstu3Test.java
index a4d4f22eff2..83a439228fc 100644
--- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToStorageSettingsDstu3Test.java
+++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/subscription/resthook/RestHookTestWithInterceptorRegisteredToStorageSettingsDstu3Test.java
@@ -15,8 +15,8 @@ import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.test.utilities.JettyUtil;
import com.google.common.collect.Lists;
import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.hl7.fhir.dstu3.model.CodeableConcept;
import org.hl7.fhir.dstu3.model.Coding;
import org.hl7.fhir.dstu3.model.IdType;
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 16961762a24..29eab34b330 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
@@ -23,8 +23,8 @@ import ca.uhn.fhir.test.utilities.JettyUtil;
import ca.uhn.fhir.test.utilities.ProxyUtil;
import com.google.common.collect.Lists;
import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
+import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
+import org.eclipse.jetty.ee10.servlet.ServletHolder;
import org.hl7.fhir.dstu3.model.CodeableConcept;
import org.hl7.fhir.dstu3.model.Coding;
import org.hl7.fhir.dstu3.model.IdType;
@@ -48,7 +48,7 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.springframework.beans.factory.annotation.Autowired;
-import javax.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletRequest;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
diff --git a/hapi-fhir-jpaserver-test-r4/pom.xml b/hapi-fhir-jpaserver-test-r4/pom.xml
index 79a1bddbeaa..f284432c58c 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.11.4-SNAPSHOT
+ 6.11.5-SNAPSHOT
../hapi-deployable-pom/pom.xml
@@ -55,7 +55,12 @@
javax.json-api
test
-
+
+ jakarta.servlet
+ jakarta.servlet-api
+ test
+
+
@@ -78,10 +83,6 @@
-