From e9a855d3f65f1fa81cc3f5a2b4033b7cde2a5523 Mon Sep 17 00:00:00 2001 From: Ken Stevens Date: Fri, 30 Sep 2022 13:18:48 -0400 Subject: [PATCH] remove spring batch (#4064) * remove spring batch it compiles expect test failures * fix test transaction manager bean name (wow that was quite the hunt the wumpus!) * fix test and fix build * fix test and fix build * fix test * remove spring batch schema initialization * bump hapi version * fix schema migrator * bump to PRE-10 * merge master * change logs Co-authored-by: Ken Stevens --- azure-pipelines.yml | 2 - hapi-deployable-pom/pom.xml | 2 +- hapi-fhir-android/pom.xml | 2 +- hapi-fhir-base/pom.xml | 2 +- hapi-fhir-batch/pom.xml | 2 +- .../jpa/batch/api/IBatchJobSubmitter.java | 43 ---- .../fhir/jpa/batch/config/BatchConstants.java | 112 ----------- .../config/NonPersistedBatchConfigurer.java | 76 -------- .../jpa/batch/svc/BatchJobSubmitterImpl.java | 67 ------- .../uhn/fhir/jpa/batch/BaseBatchR4Test.java | 12 -- .../fhir/jpa/batch/config/BatchJobConfig.java | 54 ------ .../jpa/batch/config/SampleItemReader.java | 15 -- .../fhir/jpa/batch/config/SampleTasklet.java | 14 -- .../jpa/batch/config/TestBatchConfig.java | 36 ---- .../uhn/fhir/jpa/batch/svc/BatchSvcTest.java | 24 --- .../src/test/resources/logback-test.xml | 78 -------- hapi-fhir-bom/pom.xml | 4 +- hapi-fhir-checkstyle/pom.xml | 2 +- hapi-fhir-cli/hapi-fhir-cli-api/pom.xml | 2 +- hapi-fhir-cli/hapi-fhir-cli-app/pom.xml | 2 +- hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml | 2 +- hapi-fhir-cli/pom.xml | 2 +- hapi-fhir-client-okhttp/pom.xml | 2 +- hapi-fhir-client/pom.xml | 2 +- hapi-fhir-converter/pom.xml | 2 +- hapi-fhir-dist/pom.xml | 2 +- hapi-fhir-docs/pom.xml | 2 +- .../6_2_0/3546-remove-spring-batch.yaml | 3 + hapi-fhir-jacoco/pom.xml | 2 +- hapi-fhir-jaxrsserver-base/pom.xml | 2 +- hapi-fhir-jpa/pom.xml | 2 +- hapi-fhir-jpaserver-base/pom.xml | 2 +- .../uhn/fhir/jpa/batch/BatchJobsConfig.java | 68 ------- .../fhir/jpa/batch/CommonBatchJobConfig.java | 39 ---- .../GoldenResourceAnnotatingProcessor.java | 168 ---------------- .../job/BulkExportJobParametersBuilder.java | 73 ------- .../GroupBulkExportJobParametersBuilder.java | 35 ---- ...BulkDataExportJobSchedulingHelperImpl.java | 4 - .../bulk/imprt/svc/BulkDataImportSvcImpl.java | 5 +- .../fhir/jpa/config/BatchJobRegisterer.java | 61 ------ .../ca/uhn/fhir/jpa/config/HapiJpaConfig.java | 7 - .../ca/uhn/fhir/jpa/config/JpaConfig.java | 12 +- .../jpa/term/TermDeferredStorageSvcImpl.java | 4 +- hapi-fhir-jpaserver-cql/pom.xml | 2 +- .../pom.xml | 2 +- hapi-fhir-jpaserver-mdm/pom.xml | 2 +- .../jpa/mdm/config/BaseTestMdmConfig.java | 9 - .../jpa/mdm/provider/BaseProviderR4Test.java | 3 - hapi-fhir-jpaserver-model/pom.xml | 2 +- hapi-fhir-jpaserver-searchparam/pom.xml | 2 +- hapi-fhir-jpaserver-subscription/pom.xml | 2 +- hapi-fhir-jpaserver-test-dstu2/pom.xml | 2 +- hapi-fhir-jpaserver-test-dstu3/pom.xml | 2 +- .../FhirResourceDaoDstu3CodeSystemTest.java | 4 +- .../ResourceProviderDstu3CodeSystemTest.java | 2 +- hapi-fhir-jpaserver-test-r4/pom.xml | 2 +- .../bulk/imprt/svc/BulkDataImportR4Test.java | 2 +- .../jpa/dao/expunge/DeleteExpungeDaoTest.java | 3 - .../r4/FhirResourceDaoR4CodeSystemTest.java | 4 +- .../jpa/dao/r4/FhirResourceDaoR4Test.java | 2 +- .../jpa/provider/r4/SystemProviderR4Test.java | 3 - .../fhir/jpa/stresstest/StressTestR4Test.java | 3 - .../term/TermCodeSystemStorageSvcTest.java | 2 +- .../TerminologyLoaderSvcLoincJpaTest.java | 11 +- ...erminologySvcImplCurrentVersionR4Test.java | 2 +- .../jpa/term/TerminologySvcImplR4Test.java | 2 +- .../term/job/TermCodeSystemDeleteJobTest.java | 2 +- .../TermCodeSystemVersionDeleteJobTest.java | 2 +- hapi-fhir-jpaserver-test-r5/pom.xml | 2 +- .../r5/FhirResourceDaoR5CodeSystemTest.java | 4 +- hapi-fhir-jpaserver-test-utilities/pom.xml | 2 +- .../uhn/fhir/jpa/test/BaseJpaDstu3Test.java | 4 - .../ca/uhn/fhir/jpa/test/BaseJpaR4Test.java | 5 +- .../ca/uhn/fhir/jpa/test/BaseJpaTest.java | 20 -- .../fhir/jpa/test/config/TestJPAConfig.java | 13 +- .../jpa/term/job/DynamicJobFlowSandbox.java | 123 ------------ hapi-fhir-jpaserver-uhnfhirtest/pom.xml | 2 +- hapi-fhir-server-mdm/pom.xml | 2 +- hapi-fhir-server-openapi/pom.xml | 2 +- hapi-fhir-server/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../hapi-fhir-spring-boot-samples/pom.xml | 2 +- .../hapi-fhir-spring-boot-starter/pom.xml | 2 +- hapi-fhir-spring-boot/pom.xml | 2 +- hapi-fhir-sql-migrate/pom.xml | 2 +- .../tasks/SchemaInitializationProvider.java | 7 +- .../fhir/jpa/migrate/tasks/api/Builder.java | 11 +- .../api/ISchemaInitializationProvider.java | 4 + hapi-fhir-storage-batch2-jobs/pom.xml | 2 +- .../jobs/importpull/BulkImportPullConfig.java | 4 +- .../TermCodeSystemJobConfig.java | 12 +- hapi-fhir-storage-batch2/pom.xml | 2 +- hapi-fhir-storage-mdm/pom.xml | 2 +- hapi-fhir-storage-test-utilities/pom.xml | 2 +- hapi-fhir-storage/pom.xml | 2 +- .../api/pid/HomogeneousResourcePidList.java | 4 +- .../jpa/api/pid/MixedResourcePidList.java | 4 +- .../provider/BulkDataExportProvider.java | 2 +- .../jpa/dao/BaseTransactionProcessor.java | 4 - hapi-fhir-structures-dstu2.1/pom.xml | 2 +- hapi-fhir-structures-dstu2/pom.xml | 2 +- hapi-fhir-structures-dstu3/pom.xml | 2 +- hapi-fhir-structures-hl7org-dstu2/pom.xml | 2 +- hapi-fhir-structures-r4/pom.xml | 2 +- hapi-fhir-structures-r5/pom.xml | 2 +- hapi-fhir-test-utilities/pom.xml | 2 +- .../fhir/test/utilities/BatchJobHelper.java | 183 ------------------ hapi-fhir-testpage-overlay/pom.xml | 2 +- .../pom.xml | 2 +- hapi-fhir-validation-resources-dstu2/pom.xml | 2 +- hapi-fhir-validation-resources-dstu3/pom.xml | 2 +- hapi-fhir-validation-resources-r4/pom.xml | 2 +- hapi-fhir-validation-resources-r5/pom.xml | 2 +- hapi-fhir-validation/pom.xml | 2 +- hapi-tinder-plugin/pom.xml | 16 +- hapi-tinder-test/pom.xml | 2 +- pom.xml | 4 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- 123 files changed, 138 insertions(+), 1486 deletions(-) delete mode 100644 hapi-fhir-batch/src/main/java/ca/uhn/fhir/jpa/batch/api/IBatchJobSubmitter.java delete mode 100644 hapi-fhir-batch/src/main/java/ca/uhn/fhir/jpa/batch/config/BatchConstants.java delete mode 100644 hapi-fhir-batch/src/main/java/ca/uhn/fhir/jpa/batch/config/NonPersistedBatchConfigurer.java delete mode 100644 hapi-fhir-batch/src/main/java/ca/uhn/fhir/jpa/batch/svc/BatchJobSubmitterImpl.java delete mode 100644 hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/BaseBatchR4Test.java delete mode 100644 hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/config/BatchJobConfig.java delete mode 100644 hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/config/SampleItemReader.java delete mode 100644 hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/config/SampleTasklet.java delete mode 100644 hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/config/TestBatchConfig.java delete mode 100644 hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/svc/BatchSvcTest.java delete mode 100644 hapi-fhir-batch/src/test/resources/logback-test.xml create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_2_0/3546-remove-spring-batch.yaml delete mode 100644 hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch/BatchJobsConfig.java delete mode 100644 hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch/CommonBatchJobConfig.java delete mode 100644 hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch/processor/GoldenResourceAnnotatingProcessor.java delete mode 100644 hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/export/job/BulkExportJobParametersBuilder.java delete mode 100644 hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/export/job/GroupBulkExportJobParametersBuilder.java delete mode 100644 hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BatchJobRegisterer.java delete mode 100644 hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/term/job/DynamicJobFlowSandbox.java delete mode 100644 hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/BatchJobHelper.java diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e73f7686952..0660fb8843c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -36,8 +36,6 @@ stages: module: hapi-fhir-android - name: hapi_fhir_base module: hapi-fhir-base - - name: hapi_fhir_batch - module: hapi-fhir-batch - name: hapi_fhir_checkstyle module: hapi-fhir-checkstyle - name: hapi_fhir_cli_api diff --git a/hapi-deployable-pom/pom.xml b/hapi-deployable-pom/pom.xml index 1a97b3723ee..a82f5712346 100644 --- a/hapi-deployable-pom/pom.xml +++ b/hapi-deployable-pom/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml index 0260c045e74..e1f57b1972c 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.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml index 58a23a2134c..3c9420a9734 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.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-batch/pom.xml b/hapi-fhir-batch/pom.xml index cbe1da82fdf..99d8532e074 100644 --- a/hapi-fhir-batch/pom.xml +++ b/hapi-fhir-batch/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-batch/src/main/java/ca/uhn/fhir/jpa/batch/api/IBatchJobSubmitter.java b/hapi-fhir-batch/src/main/java/ca/uhn/fhir/jpa/batch/api/IBatchJobSubmitter.java deleted file mode 100644 index efc95c6f5b2..00000000000 --- a/hapi-fhir-batch/src/main/java/ca/uhn/fhir/jpa/batch/api/IBatchJobSubmitter.java +++ /dev/null @@ -1,43 +0,0 @@ -package ca.uhn.fhir.jpa.batch.api; - -/*- - * #%L - * HAPI FHIR JPA Server - Batch Task Processor - * %% - * Copyright (C) 2014 - 2022 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% - */ - -import org.springframework.batch.core.Job; -import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.JobParameters; -import org.springframework.batch.core.JobParametersInvalidException; - -/** - * @deprecated use IJobCoordinator instead - */ -@Deprecated -public interface IBatchJobSubmitter { - - /** - * Given a {@link Job} and a {@link JobParameters}, execute the job with the given parameters. - * - * @param theJob the job to run. - * @param theJobParameters A collection of key-value pairs that are used to parameterize the job. - * @return A {@link JobExecution} representing the job. - * @throws JobParametersInvalidException If validation on the parameters fails. - */ - JobExecution runJob(Job theJob, JobParameters theJobParameters) throws JobParametersInvalidException; -} diff --git a/hapi-fhir-batch/src/main/java/ca/uhn/fhir/jpa/batch/config/BatchConstants.java b/hapi-fhir-batch/src/main/java/ca/uhn/fhir/jpa/batch/config/BatchConstants.java deleted file mode 100644 index 422f0553f33..00000000000 --- a/hapi-fhir-batch/src/main/java/ca/uhn/fhir/jpa/batch/config/BatchConstants.java +++ /dev/null @@ -1,112 +0,0 @@ -package ca.uhn.fhir.jpa.batch.config; - -/*- - * #%L - * HAPI FHIR JPA Server - Batch Task Processor - * %% - * Copyright (C) 2014 - 2022 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% - */ - -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public final class BatchConstants { - public static final String JOB_PARAM_REQUEST_LIST = "url-list"; - public static final String JOB_PARAM_BATCH_SIZE = "batch-size"; - public static final String JOB_PARAM_START_TIME = "start-time"; - public static final String CURRENT_URL_INDEX = "current.url-index"; - public static final String CURRENT_THRESHOLD_HIGH = "current.threshold-high"; - public static final String JOB_UUID_PARAMETER = "jobUUID"; - public static final String JOB_LAUNCHING_TASK_EXECUTOR = "jobLaunchingTaskExecutor"; - public static final String BULK_EXPORT_JOB_NAME = "bulkExportJob"; - public static final String GROUP_BULK_EXPORT_JOB_NAME = "groupBulkExportJob"; - public static final String PATIENT_BULK_EXPORT_JOB_NAME = "patientBulkExportJob"; - public static final String BULK_EXPORT_GENERATE_RESOURCE_FILES_STEP = "bulkExportGenerateResourceFilesStep"; - public static final String BULK_IMPORT_JOB_NAME = "bulkImportJob"; - public static final String BULK_IMPORT_PROCESSING_STEP = "bulkImportProcessingStep"; - /** - * Delete Expunge - */ - public static final String DELETE_EXPUNGE_JOB_NAME = "deleteExpungeJob"; - /** - * MDM Clear - */ - public static final String MDM_CLEAR_JOB_NAME = "mdmClearJob"; - - /** - * TermCodeSystem delete - */ - public static final String TERM_CODE_SYSTEM_DELETE_JOB_NAME = "termCodeSystemDeleteJob"; - - /** - * TermCodeSystemVersion delete - */ - public static final String TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME = "termCodeSystemVersionDeleteJob"; - - /** - * Both: TermCodeSystem delete and TermCodeSystemVersion delete - */ - public static final String JOB_PARAM_CODE_SYSTEM_VERSION_ID = "termCodeSystemVersionPid"; - - - public static final String BULK_EXPORT_READ_CHUNK_PARAMETER = "readChunkSize"; - public static final String BULK_EXPORT_GROUP_ID_PARAMETER = "groupId"; - /** - * Job Parameters - */ - public static final String READ_CHUNK_PARAMETER = "readChunkSize"; - public static final String EXPAND_MDM_PARAMETER = "expandMdm"; - public static final String GROUP_ID_PARAMETER = "groupId"; - public static final String JOB_RESOURCE_TYPES_PARAMETER = "resourceTypes"; - public static final String JOB_DESCRIPTION = "jobDescription"; - public static final String JOB_SINCE_PARAMETER = "since"; - public static final String JOB_TYPE_FILTERS = "filters"; - public static final String JOB_COLLECTION_ENTITY_ID = "bulkExportCollectionEntityId"; - - /** - * Job Execution Context - */ - public static final String JOB_EXECUTION_RESOURCE_TYPE = "resourceType"; - - public static final List PATIENT_BULK_EXPORT_FORWARD_REFERENCE_RESOURCE_TYPES = List.of("Practitioner", "Organization"); - - /** - * This Set contains the step names across all job types that are appropriate for - * someone to look at the write count for that given step in order to determine the - * number of processed records. - *

- * This is provided since a job might have multiple steps that the same data passes - * through, so you can't just sum up the total of all of them. - *

- * For any given batch job type, there should only be one step name in this set - */ - public static Set RECORD_PROCESSING_STEP_NAMES; - - static { - HashSet recordProcessingStepNames = new HashSet<>(); - recordProcessingStepNames.add(BatchConstants.BULK_IMPORT_PROCESSING_STEP); - recordProcessingStepNames.add(BatchConstants.BULK_EXPORT_GENERATE_RESOURCE_FILES_STEP); - BatchConstants.RECORD_PROCESSING_STEP_NAMES = Collections.unmodifiableSet(recordProcessingStepNames); - } - - /** - * v * Non instantiable - */ - private BatchConstants() { - } -} diff --git a/hapi-fhir-batch/src/main/java/ca/uhn/fhir/jpa/batch/config/NonPersistedBatchConfigurer.java b/hapi-fhir-batch/src/main/java/ca/uhn/fhir/jpa/batch/config/NonPersistedBatchConfigurer.java deleted file mode 100644 index 4b3c0e8ee07..00000000000 --- a/hapi-fhir-batch/src/main/java/ca/uhn/fhir/jpa/batch/config/NonPersistedBatchConfigurer.java +++ /dev/null @@ -1,76 +0,0 @@ -package ca.uhn.fhir.jpa.batch.config; - -/*- - * #%L - * HAPI FHIR JPA Server - Batch Task Processor - * %% - * Copyright (C) 2014 - 2022 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% - */ - -import org.springframework.batch.core.configuration.annotation.DefaultBatchConfigurer; -import org.springframework.batch.core.explore.JobExplorer; -import org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean; -import org.springframework.batch.core.launch.JobLauncher; -import org.springframework.batch.core.launch.support.SimpleJobLauncher; -import org.springframework.batch.core.repository.JobRepository; -import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.core.task.TaskExecutor; -import org.springframework.transaction.PlatformTransactionManager; - - -public class NonPersistedBatchConfigurer extends DefaultBatchConfigurer { - @Autowired - @Qualifier("hapiTransactionManager") - private PlatformTransactionManager myHapiPlatformTransactionManager; - - @Autowired - @Qualifier(BatchConstants.JOB_LAUNCHING_TASK_EXECUTOR) - private TaskExecutor myTaskExecutor; - - private MapJobRepositoryFactoryBean myJobRepositoryFactory; - - @Override - public PlatformTransactionManager getTransactionManager() { - return myHapiPlatformTransactionManager; - } - - @Override - protected JobRepository createJobRepository() throws Exception { - MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean(); - factory.setTransactionManager(this.getTransactionManager()); - factory.afterPropertiesSet(); - myJobRepositoryFactory = factory; - return factory.getObject(); - } - - @Override - public JobExplorer createJobExplorer() throws Exception { - MapJobExplorerFactoryBean jobExplorerFactoryBean = new MapJobExplorerFactoryBean(myJobRepositoryFactory); - jobExplorerFactoryBean.afterPropertiesSet(); - return jobExplorerFactoryBean.getObject(); - } - - @Override - protected JobLauncher createJobLauncher() throws Exception { - SimpleJobLauncher launcher = new SimpleJobLauncher(); - launcher.setTaskExecutor(myTaskExecutor); - launcher.setJobRepository(getJobRepository()); - launcher.afterPropertiesSet(); - return launcher; - } -} diff --git a/hapi-fhir-batch/src/main/java/ca/uhn/fhir/jpa/batch/svc/BatchJobSubmitterImpl.java b/hapi-fhir-batch/src/main/java/ca/uhn/fhir/jpa/batch/svc/BatchJobSubmitterImpl.java deleted file mode 100644 index 4618d9838d9..00000000000 --- a/hapi-fhir-batch/src/main/java/ca/uhn/fhir/jpa/batch/svc/BatchJobSubmitterImpl.java +++ /dev/null @@ -1,67 +0,0 @@ -package ca.uhn.fhir.jpa.batch.svc; - -/*- - * #%L - * HAPI FHIR JPA Server - Batch Task Processor - * %% - * Copyright (C) 2014 - 2022 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% - */ - -import ca.uhn.fhir.jpa.batch.api.IBatchJobSubmitter; -import org.slf4j.Logger; -import org.springframework.batch.core.Job; -import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.JobParameters; -import org.springframework.batch.core.JobParametersInvalidException; -import org.springframework.batch.core.launch.JobLauncher; -import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; -import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException; -import org.springframework.batch.core.repository.JobRepository; -import org.springframework.batch.core.repository.JobRestartException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; - -import static org.slf4j.LoggerFactory.getLogger; - -/** - * @deprecated we are in the process of converting to batch2 - */ -@Deprecated -public class BatchJobSubmitterImpl implements IBatchJobSubmitter { - - private static final Logger ourLog = getLogger(BatchJobSubmitterImpl.class); - - @Autowired - private JobLauncher myJobLauncher; - - @Autowired - private JobRepository myJobRepository; - - @Override - @Transactional(propagation = Propagation.NOT_SUPPORTED) - public JobExecution runJob(Job theJob, JobParameters theJobParameters) throws JobParametersInvalidException { - try { - return myJobLauncher.run(theJob, theJobParameters); - } catch (JobExecutionAlreadyRunningException | JobRestartException | JobInstanceAlreadyCompleteException e) { - ourLog.warn("Job {} was already running, ignoring the call to start: {}", theJob.getName(), e.toString()); - return myJobRepository.getLastJobExecution(theJob.getName(), theJobParameters); - } catch (JobParametersInvalidException e) { - ourLog.error("Job Parameters passed to this job were invalid: {}", e.getMessage()); - throw e; - } - } -} diff --git a/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/BaseBatchR4Test.java b/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/BaseBatchR4Test.java deleted file mode 100644 index 4cfcd848d43..00000000000 --- a/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/BaseBatchR4Test.java +++ /dev/null @@ -1,12 +0,0 @@ -package ca.uhn.fhir.jpa.batch; - -import ca.uhn.fhir.jpa.batch.config.BatchJobConfig; -import ca.uhn.fhir.jpa.batch.config.TestBatchConfig; -import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit.jupiter.SpringExtension; - -@ExtendWith(SpringExtension.class) -@ContextConfiguration(classes = {BatchJobConfig.class, TestBatchConfig.class}) -abstract public class BaseBatchR4Test { -} diff --git a/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/config/BatchJobConfig.java b/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/config/BatchJobConfig.java deleted file mode 100644 index 23502a0dce2..00000000000 --- a/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/config/BatchJobConfig.java +++ /dev/null @@ -1,54 +0,0 @@ -package ca.uhn.fhir.jpa.batch.config; - -import org.springframework.batch.core.Job; -import org.springframework.batch.core.Step; -import org.springframework.batch.core.configuration.annotation.JobBuilderFactory; -import org.springframework.batch.core.configuration.annotation.StepBuilderFactory; -import org.springframework.batch.core.configuration.annotation.StepScope; -import org.springframework.batch.core.step.tasklet.Tasklet; -import org.springframework.batch.item.ItemWriter; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class BatchJobConfig { - - @Autowired - private JobBuilderFactory myJobBuilderFactory; - - @Autowired - private StepBuilderFactory myStepBuilderFactory; - - - @Bean - public Job testJob() { - return myJobBuilderFactory.get("testJob") - .start(testStep()) - .build(); - } - - @Bean - public Step testStep() { - return myStepBuilderFactory.get("testStep") - .tasklet(sampleTasklet()) - .build(); - } - - @Bean - @StepScope - public Tasklet sampleTasklet() { - return new SampleTasklet(); - } - - @Bean - @StepScope - public SampleItemReader reader() { - return new SampleItemReader(); - } - - @Bean - public ItemWriter simpleWriter() { - return theList -> theList.forEach(System.out::println); - } -} diff --git a/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/config/SampleItemReader.java b/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/config/SampleItemReader.java deleted file mode 100644 index 2fe3a648d41..00000000000 --- a/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/config/SampleItemReader.java +++ /dev/null @@ -1,15 +0,0 @@ -package ca.uhn.fhir.jpa.batch.config; - -import org.springframework.batch.item.ItemReader; -import org.springframework.batch.item.NonTransientResourceException; -import org.springframework.batch.item.ParseException; -import org.springframework.batch.item.UnexpectedInputException; - -public class SampleItemReader implements ItemReader { - - - @Override - public String read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { - return "zoop"; - } -} diff --git a/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/config/SampleTasklet.java b/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/config/SampleTasklet.java deleted file mode 100644 index c577e3f6821..00000000000 --- a/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/config/SampleTasklet.java +++ /dev/null @@ -1,14 +0,0 @@ -package ca.uhn.fhir.jpa.batch.config; - -import org.springframework.batch.core.StepContribution; -import org.springframework.batch.core.scope.context.ChunkContext; -import org.springframework.batch.core.step.tasklet.Tasklet; -import org.springframework.batch.repeat.RepeatStatus; - -public class SampleTasklet implements Tasklet { - @Override - public RepeatStatus execute(StepContribution theStepContribution, ChunkContext theChunkContext) throws Exception { - System.out.println("woo"); - return RepeatStatus.FINISHED; - } -} diff --git a/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/config/TestBatchConfig.java b/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/config/TestBatchConfig.java deleted file mode 100644 index 62e56a3b7a4..00000000000 --- a/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/config/TestBatchConfig.java +++ /dev/null @@ -1,36 +0,0 @@ -package ca.uhn.fhir.jpa.batch.config; - -import org.springframework.batch.core.configuration.annotation.BatchConfigurer; -import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; -import org.springframework.batch.support.transaction.ResourcelessTransactionManager; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.task.TaskExecutor; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import org.springframework.transaction.PlatformTransactionManager; - -@Configuration -@EnableBatchProcessing -public class TestBatchConfig { - - @Bean - public PlatformTransactionManager hapiTransactionManager() { - return new ResourcelessTransactionManager(); - } - - @Bean - public TaskExecutor jobLaunchingTaskExecutor() { - ThreadPoolTaskExecutor asyncTaskExecutor = new ThreadPoolTaskExecutor(); - asyncTaskExecutor.setCorePoolSize(5); - asyncTaskExecutor.setMaxPoolSize(10); - asyncTaskExecutor.setQueueCapacity(500); - asyncTaskExecutor.setThreadNamePrefix("JobLauncher-"); - asyncTaskExecutor.initialize(); - return asyncTaskExecutor; - } - - @Bean - public BatchConfigurer batchConfigurer() { - return new NonPersistedBatchConfigurer(); - } -} diff --git a/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/svc/BatchSvcTest.java b/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/svc/BatchSvcTest.java deleted file mode 100644 index 8c16f646200..00000000000 --- a/hapi-fhir-batch/src/test/java/ca/uhn/fhir/jpa/batch/svc/BatchSvcTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package ca.uhn.fhir.jpa.batch.svc; - -import ca.uhn.fhir.jpa.batch.BaseBatchR4Test; -import org.junit.jupiter.api.Test; -import org.springframework.batch.core.Job; -import org.springframework.batch.core.JobParameters; -import org.springframework.batch.core.JobParametersInvalidException; -import org.springframework.batch.core.launch.JobLauncher; -import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; -import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException; -import org.springframework.batch.core.repository.JobRestartException; -import org.springframework.beans.factory.annotation.Autowired; - -public class BatchSvcTest extends BaseBatchR4Test { - @Autowired - protected JobLauncher myJobLauncher; - @Autowired - protected Job myJob; - - @Test - public void testApplicationContextLoads() throws JobParametersInvalidException, JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException, InterruptedException { - myJobLauncher.run(myJob, new JobParameters()); - } -} diff --git a/hapi-fhir-batch/src/test/resources/logback-test.xml b/hapi-fhir-batch/src/test/resources/logback-test.xml deleted file mode 100644 index 90a11833d3b..00000000000 --- a/hapi-fhir-batch/src/test/resources/logback-test.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - INFO - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} [%file:%line] %msg%n - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - INFO - - ${smile.basedir}/log/batch-troubleshooting.log - - ${smile.basedir}/log/batch-troubleshooting.log.%i.gz - 1 - 9 - - - 5MB - - - %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n${log.stackfilter.pattern} - - - - - - - - - - - - - diff --git a/hapi-fhir-bom/pom.xml b/hapi-fhir-bom/pom.xml index 0b0a6d77a6d..5126b04e7a0 100644 --- a/hapi-fhir-bom/pom.xml +++ b/hapi-fhir-bom/pom.xml @@ -3,14 +3,14 @@ 4.0.0 ca.uhn.hapi.fhir hapi-fhir-bom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT pom HAPI FHIR BOM ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-checkstyle/pom.xml b/hapi-fhir-checkstyle/pom.xml index ea7aee400e7..9df1eae5777 100644 --- a/hapi-fhir-checkstyle/pom.xml +++ b/hapi-fhir-checkstyle/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml index fb45fbc1b70..8407d86fb28 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml index 91ba94e305e..4e250fbac08 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir-cli - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml index 2714bdfd072..550c7c6678e 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../../hapi-deployable-pom diff --git a/hapi-fhir-cli/pom.xml b/hapi-fhir-cli/pom.xml index 83f4afa4699..1690196dd12 100644 --- a/hapi-fhir-cli/pom.xml +++ b/hapi-fhir-cli/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-client-okhttp/pom.xml b/hapi-fhir-client-okhttp/pom.xml index b72b3ce213b..9d8e5e3a695 100644 --- a/hapi-fhir-client-okhttp/pom.xml +++ b/hapi-fhir-client-okhttp/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-client/pom.xml b/hapi-fhir-client/pom.xml index 85b85d794cb..1fee912180c 100644 --- a/hapi-fhir-client/pom.xml +++ b/hapi-fhir-client/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-converter/pom.xml b/hapi-fhir-converter/pom.xml index c53ca6ed6a1..ea802d27905 100644 --- a/hapi-fhir-converter/pom.xml +++ b/hapi-fhir-converter/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-dist/pom.xml b/hapi-fhir-dist/pom.xml index b1872f3e8ce..73da5a28685 100644 --- a/hapi-fhir-dist/pom.xml +++ b/hapi-fhir-dist/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-docs/pom.xml b/hapi-fhir-docs/pom.xml index e16df854417..4fd6bd9e5ac 100644 --- a/hapi-fhir-docs/pom.xml +++ b/hapi-fhir-docs/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_2_0/3546-remove-spring-batch.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_2_0/3546-remove-spring-batch.yaml new file mode 100644 index 00000000000..9d1b1c6e85b --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_2_0/3546-remove-spring-batch.yaml @@ -0,0 +1,3 @@ +--- +type: change +title: "All Spring Batch dependencies and services have been removed. Async processing has fully migrated to Batch 2." diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml index 9f76519b162..9942399a74c 100644 --- a/hapi-fhir-jacoco/pom.xml +++ b/hapi-fhir-jacoco/pom.xml @@ -11,7 +11,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jaxrsserver-base/pom.xml b/hapi-fhir-jaxrsserver-base/pom.xml index 9d96478f3eb..32d3ecddda9 100644 --- a/hapi-fhir-jaxrsserver-base/pom.xml +++ b/hapi-fhir-jaxrsserver-base/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpa/pom.xml b/hapi-fhir-jpa/pom.xml index 2d135e44305..a647efee66e 100644 --- a/hapi-fhir-jpa/pom.xml +++ b/hapi-fhir-jpa/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml 4.0.0 diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml index 50f8c35044e..5e787bbd833 100644 --- a/hapi-fhir-jpaserver-base/pom.xml +++ b/hapi-fhir-jpaserver-base/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch/BatchJobsConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch/BatchJobsConfig.java deleted file mode 100644 index 5e0398d9b00..00000000000 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch/BatchJobsConfig.java +++ /dev/null @@ -1,68 +0,0 @@ -package ca.uhn.fhir.jpa.batch; - -/*- - * #%L - * HAPI FHIR JPA Server - * %% - * Copyright (C) 2014 - 2022 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% - */ - -import ca.uhn.fhir.jpa.batch.api.IBatchJobSubmitter; -import ca.uhn.fhir.jpa.batch.svc.BatchJobSubmitterImpl; -import ca.uhn.fhir.jpa.config.BatchJobRegisterer; -import org.springframework.batch.core.configuration.JobRegistry; -import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; -import org.springframework.batch.core.explore.JobExplorer; -import org.springframework.batch.core.launch.JobLauncher; -import org.springframework.batch.core.launch.support.SimpleJobOperator; -import org.springframework.batch.core.repository.JobRepository; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; - -@Configuration -@EnableBatchProcessing -@Import({ - CommonBatchJobConfig.class - // When you define a new batch job, add it here. -}) -@Deprecated -/** - * @deprecated Use Batch2JobsConfig - */ -public class BatchJobsConfig { - @Bean - public IBatchJobSubmitter batchJobSubmitter() { - return new BatchJobSubmitterImpl(); - } - - @Bean - public BatchJobRegisterer batchJobRegisterer() { - return new BatchJobRegisterer(); - } - - @Bean - public SimpleJobOperator jobOperator(JobExplorer theJobExplorer, JobRepository theJobRepository, JobRegistry theJobRegistry, JobLauncher theJobLauncher) { - SimpleJobOperator jobOperator = new SimpleJobOperator(); - - jobOperator.setJobExplorer(theJobExplorer); - jobOperator.setJobRepository(theJobRepository); - jobOperator.setJobRegistry(theJobRegistry); - jobOperator.setJobLauncher(theJobLauncher); - - return jobOperator; - } -} diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch/CommonBatchJobConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch/CommonBatchJobConfig.java deleted file mode 100644 index 857c41f51ff..00000000000 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch/CommonBatchJobConfig.java +++ /dev/null @@ -1,39 +0,0 @@ -package ca.uhn.fhir.jpa.batch; - -/*- - * #%L - * HAPI FHIR JPA Server - * %% - * Copyright (C) 2014 - 2022 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% - */ - -import ca.uhn.fhir.jpa.batch.processor.GoldenResourceAnnotatingProcessor; -import org.springframework.batch.core.configuration.annotation.StepScope; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -@Deprecated -public class CommonBatchJobConfig { - public static final int MINUTES_IN_FUTURE_TO_PROCESS_FROM = 1; - - @Bean - @StepScope - public GoldenResourceAnnotatingProcessor goldenResourceAnnotatingProcessor() { - return new GoldenResourceAnnotatingProcessor(); - } - -} diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch/processor/GoldenResourceAnnotatingProcessor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch/processor/GoldenResourceAnnotatingProcessor.java deleted file mode 100644 index bf1dd6d11d8..00000000000 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch/processor/GoldenResourceAnnotatingProcessor.java +++ /dev/null @@ -1,168 +0,0 @@ -package ca.uhn.fhir.jpa.batch.processor; - -/*- - * #%L - * HAPI FHIR JPA Server - * %% - * Copyright (C) 2014 - 2022 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% - */ - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.context.RuntimeSearchParam; -import ca.uhn.fhir.fhirpath.IFhirPath; -import ca.uhn.fhir.i18n.Msg; -import ca.uhn.fhir.jpa.batch.config.BatchConstants; -import ca.uhn.fhir.jpa.batch.log.Logs; -import ca.uhn.fhir.jpa.dao.mdm.MdmExpansionCacheSvc; -import ca.uhn.fhir.util.ExtensionUtil; -import ca.uhn.fhir.util.HapiExtensions; -import ca.uhn.fhir.util.SearchParameterUtil; -import org.apache.commons.lang3.StringUtils; -import org.hl7.fhir.instance.model.api.IBaseExtension; -import org.hl7.fhir.instance.model.api.IBaseReference; -import org.hl7.fhir.instance.model.api.IBaseResource; -import org.slf4j.Logger; -import org.springframework.batch.item.ItemProcessor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; - -import javax.annotation.Nonnull; -import java.util.List; -import java.util.Optional; - -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.PATIENT_BULK_EXPORT_FORWARD_REFERENCE_RESOURCE_TYPES; - -/** - * Reusable Item Processor which attaches an extension to any outgoing resource. This extension will contain a resource - * reference to the golden resource patient of the given resources' patient. (e.g. Observation.subject, Immunization.patient, etc) - */ -@Deprecated -public class GoldenResourceAnnotatingProcessor implements ItemProcessor, List> { - private static final Logger ourLog = Logs.getBatchTroubleshootingLog(); - - - @Value("#{stepExecutionContext['resourceType']}") - private String myResourceType; - - @Autowired - private FhirContext myContext; - - @Autowired - private MdmExpansionCacheSvc myMdmExpansionCacheSvc; - - @Value("#{jobParameters['" + BatchConstants.EXPAND_MDM_PARAMETER + "'] ?: false}") - private boolean myMdmEnabled; - - - private RuntimeSearchParam myRuntimeSearchParam; - - private String myPatientFhirPath; - - private IFhirPath myFhirPath; - - private void populateRuntimeSearchParam() { - Optional oPatientSearchParam= SearchParameterUtil.getOnlyPatientSearchParamForResourceType(myContext, myResourceType); - if (!oPatientSearchParam.isPresent()) { - String errorMessage = String.format("[%s] has no search parameters that are for patients, so it is invalid for Group Bulk Export!", myResourceType); - throw new IllegalArgumentException(Msg.code(1279) + errorMessage); - } else { - myRuntimeSearchParam = oPatientSearchParam.get(); - } - } - - @Override - public List process(@Nonnull List theIBaseResources) throws Exception { - if (shouldAnnotateResource()) { - lazyLoadSearchParamsAndFhirPath(); - theIBaseResources.forEach(this::annotateBackwardsReferences); - } - return theIBaseResources; - } - - private void lazyLoadSearchParamsAndFhirPath() { - if (myRuntimeSearchParam == null) { - populateRuntimeSearchParam(); - } - if (myPatientFhirPath == null) { - populatePatientFhirPath(); - } - } - - /** - * If the resource is added via a forward-reference from a patient, e.g. Patient.managingOrganization, we have no way to fetch the patient at this point in time. - * This is a shortcoming of including the forward reference types in a Group/Patient bulk export. - * - * @return true if the resource should be annotated with the golden resource patient reference - */ - private boolean shouldAnnotateResource() { - return myMdmEnabled && !PATIENT_BULK_EXPORT_FORWARD_REFERENCE_RESOURCE_TYPES.contains(myResourceType); - } - - private void annotateBackwardsReferences(IBaseResource iBaseResource) { - Optional patientReference = getPatientReference(iBaseResource); - if (patientReference.isPresent()) { - addGoldenResourceExtension(iBaseResource, patientReference.get()); - } else { - ourLog.error("Failed to find the patient reference information for resource {}. This is a bug, " + - "as all resources which can be exported via Group Bulk Export must reference a patient.", iBaseResource); - } - } - - private Optional getPatientReference(IBaseResource iBaseResource) { - if (myResourceType.equalsIgnoreCase("Patient")) { - return Optional.of(iBaseResource.getIdElement().getIdPart()); - } else { - Optional optionalReference = getFhirParser().evaluateFirst(iBaseResource, myPatientFhirPath, IBaseReference.class); - if (optionalReference.isPresent()) { - return optionalReference.map(theIBaseReference -> theIBaseReference.getReferenceElement().getIdPart()); - } else { - return Optional.empty(); - } - } - } - - private void addGoldenResourceExtension(IBaseResource iBaseResource, String sourceResourceId) { - String goldenResourceId = myMdmExpansionCacheSvc.getGoldenResourceId(sourceResourceId); - IBaseExtension extension = ExtensionUtil.getOrCreateExtension(iBaseResource, HapiExtensions.ASSOCIATED_GOLDEN_RESOURCE_EXTENSION_URL); - if (!StringUtils.isBlank(goldenResourceId)) { - ExtensionUtil.setExtension(myContext, extension, "reference", prefixPatient(goldenResourceId)); - } - } - - private String prefixPatient(String theResourceId) { - return "Patient/" + theResourceId; - } - - private IFhirPath getFhirParser() { - if (myFhirPath == null) { - myFhirPath = myContext.newFhirPath(); - } - return myFhirPath; - } - - private String populatePatientFhirPath() { - if (myPatientFhirPath == null) { - myPatientFhirPath = myRuntimeSearchParam.getPath(); - // GGG: Yes this is a stupid hack, but by default this runtime search param will return stuff like - // Observation.subject.where(resolve() is Patient) which unfortunately our FHIRpath evaluator doesn't play nicely with - // our FHIRPath evaluator. - if (myPatientFhirPath.contains(".where")) { - myPatientFhirPath = myPatientFhirPath.substring(0, myPatientFhirPath.indexOf(".where")); - } - } - return myPatientFhirPath; - } -} diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/export/job/BulkExportJobParametersBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/export/job/BulkExportJobParametersBuilder.java deleted file mode 100644 index 524a5437e9b..00000000000 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/export/job/BulkExportJobParametersBuilder.java +++ /dev/null @@ -1,73 +0,0 @@ -package ca.uhn.fhir.jpa.bulk.export.job; - -/*- - * #%L - * HAPI FHIR JPA Server - * %% - * Copyright (C) 2014 - 2022 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% - */ - -import ca.uhn.fhir.rest.api.server.bulk.BulkDataExportOptions; -import ca.uhn.fhir.rest.api.Constants; -import org.springframework.batch.core.JobParametersBuilder; - -import java.util.Date; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * This builder is a helper so you don't have to go lookup what job parameters are required for a bulk export job. - * - */ -public class BulkExportJobParametersBuilder extends JobParametersBuilder { - - public BulkExportJobParametersBuilder setResourceTypes(List resourceTypes) { - String resourceTypesString = resourceTypes.stream().collect(Collectors.joining(",")); - this.addString("resourceTypes", resourceTypesString); - return this; - } - - public BulkExportJobParametersBuilder setSince(Date theSince) { - this.addDate("since", theSince); - return this; - } - - public BulkExportJobParametersBuilder setOutputFormat(String theOutputFormat) { - //TODO eventually we will support more types. - theOutputFormat = Constants.CT_FHIR_NDJSON; - this.addString("outputFormat", theOutputFormat); - return this; - } - - public BulkExportJobParametersBuilder setFilters(Set theFilters) { - this.addString("filters", theFilters.stream().collect(Collectors.joining(","))); - return this; - } - - public BulkExportJobParametersBuilder setJobUUID(String theJobUUID) { - this.addString("jobUUID", theJobUUID); - return this; - } - public BulkExportJobParametersBuilder setReadChunkSize(Long theReadChunkSize) { - this.addLong("readChunkSize", theReadChunkSize); - return this; - } - public BulkExportJobParametersBuilder setExportStyle(BulkDataExportOptions.ExportStyle theExportStyle) { - this.addString("exportStyle", theExportStyle.name()); - return this; - } -} diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/export/job/GroupBulkExportJobParametersBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/export/job/GroupBulkExportJobParametersBuilder.java deleted file mode 100644 index 5c72838cf1f..00000000000 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/export/job/GroupBulkExportJobParametersBuilder.java +++ /dev/null @@ -1,35 +0,0 @@ -package ca.uhn.fhir.jpa.bulk.export.job; - -/*- - * #%L - * HAPI FHIR JPA Server - * %% - * Copyright (C) 2014 - 2022 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% - */ - -import ca.uhn.fhir.jpa.batch.config.BatchConstants; - -public class GroupBulkExportJobParametersBuilder extends BulkExportJobParametersBuilder { - public GroupBulkExportJobParametersBuilder setGroupId(String theGroupId) { - this.addString(BatchConstants.GROUP_ID_PARAMETER, theGroupId); - return this; - } - - public GroupBulkExportJobParametersBuilder setMdm(boolean theMdm) { - this.addString(BatchConstants.EXPAND_MDM_PARAMETER, String.valueOf(theMdm)); - return this; - } -} 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 88f37fabc27..1aca977da08 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 @@ -25,7 +25,6 @@ import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; -import ca.uhn.fhir.jpa.batch.api.IBatchJobSubmitter; import ca.uhn.fhir.jpa.bulk.export.api.IBulkDataExportJobSchedulingHelper; import ca.uhn.fhir.jpa.dao.data.IBulkExportCollectionDao; import ca.uhn.fhir.jpa.dao.data.IBulkExportCollectionFileDao; @@ -62,9 +61,6 @@ public class BulkDataExportJobSchedulingHelperImpl implements IBulkDataExportJob @Autowired private DaoRegistry myDaoRegistry; - @Autowired - private IBatchJobSubmitter myJobSubmitter; - @Autowired private IBulkExportCollectionDao myBulkExportCollectionDao; 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 52ff0ae45f8..2b6b97a7875 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 @@ -24,7 +24,6 @@ import ca.uhn.fhir.batch2.api.IJobCoordinator; import ca.uhn.fhir.batch2.importpull.models.Batch2BulkImportPullJobParameters; import ca.uhn.fhir.batch2.model.JobInstanceStartRequest; import ca.uhn.fhir.jpa.api.config.DaoConfig; -import ca.uhn.fhir.jpa.batch.config.BatchConstants; import ca.uhn.fhir.jpa.batch.log.Logs; import ca.uhn.fhir.jpa.bulk.imprt.api.IBulkDataImportSvc; import ca.uhn.fhir.jpa.bulk.imprt.model.ActivateJobResult; @@ -61,6 +60,8 @@ import java.util.Optional; import java.util.UUID; import java.util.concurrent.Semaphore; +import static ca.uhn.fhir.batch2.jobs.importpull.BulkImportPullConfig.BULK_IMPORT_JOB_NAME; + public class BulkDataImportSvcImpl implements IBulkDataImportSvc { private static final Logger ourLog = LoggerFactory.getLogger(BulkDataImportSvcImpl.class); private final Semaphore myRunningJobSemaphore = new Semaphore(1); @@ -285,7 +286,7 @@ public class BulkDataImportSvcImpl implements IBulkDataImportSvc { jobParameters.setBatchSize(batchSize); JobInstanceStartRequest request = new JobInstanceStartRequest(); - request.setJobDefinitionId(BatchConstants.BULK_IMPORT_JOB_NAME); + request.setJobDefinitionId(BULK_IMPORT_JOB_NAME); request.setParameters(jobParameters); ourLog.info("Submitting bulk import with bijob id {} to job scheduler", biJobId); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BatchJobRegisterer.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BatchJobRegisterer.java deleted file mode 100644 index e571f6bd1ee..00000000000 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BatchJobRegisterer.java +++ /dev/null @@ -1,61 +0,0 @@ -package ca.uhn.fhir.jpa.config; - -/*- - * #%L - * HAPI FHIR JPA Server - * %% - * Copyright (C) 2014 - 2022 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% - */ - -import org.springframework.batch.core.Job; -import org.springframework.batch.core.configuration.DuplicateJobException; -import org.springframework.batch.core.configuration.JobFactory; -import org.springframework.batch.core.configuration.JobRegistry; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; - -import javax.annotation.PostConstruct; -import java.util.Map; - -public class BatchJobRegisterer { - - @Autowired - private ApplicationContext myApplicationContext; - - - @PostConstruct - public void start() throws DuplicateJobException { - - Map batchJobs = myApplicationContext.getBeansOfType(Job.class); - JobRegistry jobRegistry = myApplicationContext.getBean(JobRegistry.class); - - for (Map.Entry next : batchJobs.entrySet()) { - jobRegistry.register(new JobFactory() { - @Override - public Job createJob() { - return next.getValue(); - } - - @Override - public String getJobName() { - return next.getKey(); - } - }); - } - - } - -} diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiJpaConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiJpaConfig.java index 257aeef5902..a2c61eef0e9 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiJpaConfig.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/HapiJpaConfig.java @@ -22,7 +22,6 @@ package ca.uhn.fhir.jpa.config; import ca.uhn.fhir.jpa.api.IDaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; -import ca.uhn.fhir.jpa.batch.config.NonPersistedBatchConfigurer; import ca.uhn.fhir.jpa.config.util.ResourceCountCacheUtil; import ca.uhn.fhir.jpa.config.util.ValidationSupportConfigUtil; import ca.uhn.fhir.jpa.dao.FulltextSearchSvcImpl; @@ -40,7 +39,6 @@ import ca.uhn.fhir.mdm.dao.IMdmLinkDao; import ca.uhn.fhir.rest.api.IResourceSupportedSvc; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import org.hl7.fhir.common.hapi.validation.support.CachingValidationSupport; -import org.springframework.batch.core.configuration.annotation.BatchConfigurer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -75,11 +73,6 @@ public class HapiJpaConfig { return ValidationSupportConfigUtil.newCachingValidationSupport(theJpaValidationSupportChain); } - @Bean - public BatchConfigurer batchConfigurer() { - return new NonPersistedBatchConfigurer(); - } - @Bean public DatabaseBackedPagingProvider databaseBackedPagingProvider() { return new DatabaseBackedPagingProvider(); 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 9fa3d938236..2379c9ce019 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 @@ -10,8 +10,6 @@ import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.model.ExpungeOptions; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; -import ca.uhn.fhir.jpa.batch.BatchJobsConfig; -import ca.uhn.fhir.jpa.batch.config.BatchConstants; import ca.uhn.fhir.jpa.binary.interceptor.BinaryStorageInterceptor; import ca.uhn.fhir.jpa.binary.provider.BinaryAccessProvider; import ca.uhn.fhir.jpa.bulk.export.api.IBulkDataExportJobSchedulingHelper; @@ -74,7 +72,6 @@ import ca.uhn.fhir.jpa.search.PersistedJpaSearchFirstPageBundleProvider; import ca.uhn.fhir.jpa.search.SearchStrategyFactory; import ca.uhn.fhir.jpa.search.SynchronousSearchSvcImpl; import ca.uhn.fhir.jpa.search.builder.QueryStack; -import ca.uhn.fhir.jpa.search.builder.tasks.SearchTask; import ca.uhn.fhir.jpa.search.builder.predicate.ComboNonUniqueSearchParameterPredicateBuilder; import ca.uhn.fhir.jpa.search.builder.predicate.ComboUniqueSearchParameterPredicateBuilder; import ca.uhn.fhir.jpa.search.builder.predicate.CoordsPredicateBuilder; @@ -96,6 +93,7 @@ import ca.uhn.fhir.jpa.search.builder.sql.GeneratedSql; import ca.uhn.fhir.jpa.search.builder.sql.SearchQueryBuilder; import ca.uhn.fhir.jpa.search.builder.sql.SearchQueryExecutor; import ca.uhn.fhir.jpa.search.builder.sql.SqlObjectFactory; +import ca.uhn.fhir.jpa.search.builder.tasks.SearchTask; import ca.uhn.fhir.jpa.search.cache.DatabaseSearchCacheSvcImpl; import ca.uhn.fhir.jpa.search.cache.DatabaseSearchResultCacheSvcImpl; import ca.uhn.fhir.jpa.search.cache.ISearchCacheSvc; @@ -126,7 +124,6 @@ import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationInterce import ca.uhn.fhir.rest.server.interceptor.ResponseTerminologyTranslationSvc; import ca.uhn.fhir.rest.server.interceptor.consent.IConsentContextServices; import ca.uhn.fhir.rest.server.interceptor.partition.RequestTenantPartitionInterceptor; -import ca.uhn.fhir.util.ThreadPoolUtil; import org.hl7.fhir.common.hapi.validation.support.UnknownCodeSystemWarningValidationSupport; import org.hl7.fhir.utilities.graphql.IGraphQLStorageServices; import org.hl7.fhir.utilities.npm.PackageClient; @@ -138,7 +135,6 @@ import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Scope; import org.springframework.core.task.AsyncTaskExecutor; -import org.springframework.core.task.TaskExecutor; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.scheduling.TaskScheduler; import org.springframework.scheduling.concurrent.ConcurrentTaskScheduler; @@ -172,7 +168,6 @@ import java.util.Date; @EnableJpaRepositories(basePackages = "ca.uhn.fhir.jpa.dao.data") @Import({ BeanPostProcessorConfig.class, - BatchJobsConfig.class, TermCodeSystemConfig.class, SearchParamConfig.class, ValidationSupportConfig.class, @@ -325,11 +320,6 @@ public class JpaConfig { return retVal; } - @Bean(name = BatchConstants.JOB_LAUNCHING_TASK_EXECUTOR) - public TaskExecutor jobLaunchingTaskExecutor() { - return ThreadPoolUtil.newThreadPool(0, 10, "job-launcher-"); - } - @Bean public IResourceReindexingSvc resourceReindexingSvc() { return new ResourceReindexingSvcImpl(); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermDeferredStorageSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermDeferredStorageSvcImpl.java index 21b03eb94c6..5f4fbdf770d 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermDeferredStorageSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermDeferredStorageSvcImpl.java @@ -70,8 +70,8 @@ import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_DELETE_JOB_NAME; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; +import static ca.uhn.fhir.batch2.jobs.termcodesystem.TermCodeSystemJobConfig.TERM_CODE_SYSTEM_DELETE_JOB_NAME; +import static ca.uhn.fhir.batch2.jobs.termcodesystem.TermCodeSystemJobConfig.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; public class TermDeferredStorageSvcImpl implements ITermDeferredStorageSvc { diff --git a/hapi-fhir-jpaserver-cql/pom.xml b/hapi-fhir-jpaserver-cql/pom.xml index 1d904495dc2..03260cbd686 100644 --- a/hapi-fhir-jpaserver-cql/pom.xml +++ b/hapi-fhir-jpaserver-cql/pom.xml @@ -7,7 +7,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml b/hapi-fhir-jpaserver-elastic-test-utilities/pom.xml index 0bae13cc31a..bdfc41cec2f 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.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-mdm/pom.xml b/hapi-fhir-jpaserver-mdm/pom.xml index a266dc31be7..f368321f9be 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.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/config/BaseTestMdmConfig.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/config/BaseTestMdmConfig.java index dd3ba492900..0ed4ad464ef 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/config/BaseTestMdmConfig.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/config/BaseTestMdmConfig.java @@ -1,15 +1,11 @@ package ca.uhn.fhir.jpa.mdm.config; -import ca.uhn.fhir.jpa.entity.MdmLink; -import ca.uhn.fhir.jpa.mdm.dao.JpaMdmLinkImplFactory; import ca.uhn.fhir.jpa.mdm.helper.MdmLinkHelper; import ca.uhn.fhir.mdm.api.IMdmSettings; import ca.uhn.fhir.mdm.rules.config.MdmRuleValidator; import ca.uhn.fhir.mdm.rules.config.MdmSettings; -import ca.uhn.fhir.test.utilities.BatchJobHelper; import com.google.common.base.Charsets; import org.apache.commons.io.IOUtils; -import org.springframework.batch.core.explore.JobExplorer; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -43,9 +39,4 @@ public abstract class BaseTestMdmConfig { MdmLinkHelper mdmLinkHelper() { return new MdmLinkHelper(); } - - @Bean - BatchJobHelper batchJobHelper(JobExplorer theJobExplorer) { - return new BatchJobHelper(theJobExplorer); - } } 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 2af442dc8d6..12c4bae52a4 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 @@ -10,7 +10,6 @@ import ca.uhn.fhir.mdm.provider.MdmControllerHelper; import ca.uhn.fhir.mdm.provider.MdmProviderDstu3Plus; import ca.uhn.fhir.mdm.rules.config.MdmSettings; import ca.uhn.fhir.mdm.util.MessageHelper; -import ca.uhn.fhir.test.utilities.BatchJobHelper; import com.google.common.base.Charsets; import org.apache.commons.io.IOUtils; import org.hl7.fhir.instance.model.api.IPrimitiveType; @@ -39,8 +38,6 @@ public abstract class BaseProviderR4Test extends BaseMdmR4Test { @Autowired private MdmControllerHelper myMdmHelper; @Autowired - BatchJobHelper myBatchJobHelper; - @Autowired Batch2JobHelper myBatch2JobHelper; @Autowired MessageHelper myMessageHelper; diff --git a/hapi-fhir-jpaserver-model/pom.xml b/hapi-fhir-jpaserver-model/pom.xml index 4c54ebeb7e8..f1987cdca32 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.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-searchparam/pom.xml b/hapi-fhir-jpaserver-searchparam/pom.xml index 8bf7d3b8759..5237763e86b 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.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-subscription/pom.xml b/hapi-fhir-jpaserver-subscription/pom.xml index b8921d788cd..afa84021c78 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.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-dstu2/pom.xml b/hapi-fhir-jpaserver-test-dstu2/pom.xml index 344d9cfafcf..b8922d0605e 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.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-dstu3/pom.xml b/hapi-fhir-jpaserver-test-dstu3/pom.xml index 1d996adbaf6..2d1591b1394 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.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3CodeSystemTest.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3CodeSystemTest.java index 99404cac716..06625ba96f4 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3CodeSystemTest.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3CodeSystemTest.java @@ -13,8 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired; import java.nio.charset.StandardCharsets; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_DELETE_JOB_NAME; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; +import static ca.uhn.fhir.batch2.jobs.termcodesystem.TermCodeSystemJobConfig.TERM_CODE_SYSTEM_DELETE_JOB_NAME; +import static ca.uhn.fhir.batch2.jobs.termcodesystem.TermCodeSystemJobConfig.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; diff --git a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3CodeSystemTest.java b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3CodeSystemTest.java index a50aead4ca8..c82e7becacc 100644 --- a/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3CodeSystemTest.java +++ b/hapi-fhir-jpaserver-test-dstu3/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3CodeSystemTest.java @@ -27,7 +27,7 @@ import org.springframework.transaction.annotation.Transactional; import java.io.IOException; import java.util.stream.Collectors; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_DELETE_JOB_NAME; +import static ca.uhn.fhir.batch2.jobs.termcodesystem.TermCodeSystemJobConfig.TERM_CODE_SYSTEM_DELETE_JOB_NAME; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; diff --git a/hapi-fhir-jpaserver-test-r4/pom.xml b/hapi-fhir-jpaserver-test-r4/pom.xml index ccbb99373b0..f0e6bfca781 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.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/imprt/svc/BulkDataImportR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/imprt/svc/BulkDataImportR4Test.java index a5e53ab3f3e..57838c6a5b7 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/imprt/svc/BulkDataImportR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/bulk/imprt/svc/BulkDataImportR4Test.java @@ -51,7 +51,7 @@ import java.util.Optional; import java.util.stream.Collectors; import static ca.uhn.fhir.batch2.config.BaseBatch2Config.CHANNEL_NAME; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.BULK_IMPORT_JOB_NAME; +import static ca.uhn.fhir.batch2.jobs.importpull.BulkImportPullConfig.BULK_IMPORT_JOB_NAME; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/expunge/DeleteExpungeDaoTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/expunge/DeleteExpungeDaoTest.java index 42577ee41b2..d5047790990 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/expunge/DeleteExpungeDaoTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/expunge/DeleteExpungeDaoTest.java @@ -10,7 +10,6 @@ import ca.uhn.fhir.jpa.partition.SystemRequestDetails; import ca.uhn.fhir.jpa.test.BaseJpaR4Test; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException; -import ca.uhn.fhir.test.utilities.BatchJobHelper; import ca.uhn.fhir.util.BundleBuilder; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.r4.model.Bundle; @@ -34,8 +33,6 @@ import static org.mockito.Mockito.when; class DeleteExpungeDaoTest extends BaseJpaR4Test { @Autowired DaoConfig myDaoConfig; - @Autowired - BatchJobHelper myBatchJobHelper; @BeforeEach public void before() { diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4CodeSystemTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4CodeSystemTest.java index 5259687ecee..00d99540050 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4CodeSystemTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4CodeSystemTest.java @@ -14,8 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired; import java.nio.charset.StandardCharsets; import java.util.List; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_DELETE_JOB_NAME; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; +import static ca.uhn.fhir.batch2.jobs.termcodesystem.TermCodeSystemJobConfig.TERM_CODE_SYSTEM_DELETE_JOB_NAME; +import static ca.uhn.fhir.batch2.jobs.termcodesystem.TermCodeSystemJobConfig.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java index fa2079f2474..ccd58c2e02c 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java @@ -130,7 +130,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; +import static ca.uhn.fhir.batch2.jobs.termcodesystem.TermCodeSystemJobConfig.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; import static org.apache.commons.lang3.StringUtils.countMatches; import static org.apache.commons.lang3.StringUtils.defaultString; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/SystemProviderR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/SystemProviderR4Test.java index 45c8f85de09..663333cf530 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/SystemProviderR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/provider/r4/SystemProviderR4Test.java @@ -39,7 +39,6 @@ import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor; import ca.uhn.fhir.rest.server.interceptor.auth.AuthorizedList; import ca.uhn.fhir.rest.server.interceptor.auth.SearchNarrowingInterceptor; import ca.uhn.fhir.rest.server.provider.ProviderConstants; -import ca.uhn.fhir.test.utilities.BatchJobHelper; import ca.uhn.fhir.test.utilities.JettyUtil; import ca.uhn.fhir.util.BundleBuilder; import ca.uhn.fhir.util.BundleUtil; @@ -119,8 +118,6 @@ public class SystemProviderR4Test extends BaseJpaR4Test { @Autowired private DeleteExpungeProvider myDeleteExpungeProvider; - @Autowired - private BatchJobHelper myBatchJobHelper; @SuppressWarnings("deprecation") @AfterEach diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/stresstest/StressTestR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/stresstest/StressTestR4Test.java index c709d602c79..51effda296d 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/stresstest/StressTestR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/stresstest/StressTestR4Test.java @@ -16,7 +16,6 @@ import ca.uhn.fhir.rest.param.TokenOrListParam; import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException; import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor; import ca.uhn.fhir.rest.server.provider.ProviderConstants; -import ca.uhn.fhir.test.utilities.BatchJobHelper; import ca.uhn.fhir.util.StopWatch; import com.google.common.base.Charsets; import com.google.common.collect.Lists; @@ -90,8 +89,6 @@ public class StressTestR4Test extends BaseResourceProviderR4Test { @Autowired private DatabaseBackedPagingProvider myPagingProvider; private int myPreviousMaxPageSize; - @Autowired - private BatchJobHelper myBatchJobHelper; @Override @AfterEach diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TermCodeSystemStorageSvcTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TermCodeSystemStorageSvcTest.java index 9a55c75fc4d..612d3bcb667 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TermCodeSystemStorageSvcTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TermCodeSystemStorageSvcTest.java @@ -14,7 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired; import java.util.ArrayList; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; +import static ca.uhn.fhir.batch2.jobs.termcodesystem.TermCodeSystemJobConfig.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologyLoaderSvcLoincJpaTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologyLoaderSvcLoincJpaTest.java index 8020f1fbe51..1a2453a0d9f 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologyLoaderSvcLoincJpaTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologyLoaderSvcLoincJpaTest.java @@ -5,21 +5,16 @@ import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.test.BaseJpaR4Test; import ca.uhn.fhir.rest.api.server.IBundleProvider; -import ca.uhn.fhir.test.utilities.BatchJobHelper; import org.hl7.fhir.r4.model.CodeSystem; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; import java.io.IOException; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; public class TerminologyLoaderSvcLoincJpaTest extends BaseJpaR4Test { - @Autowired - private BatchJobHelper myBatchJobHelper; private TermLoaderSvcImpl mySvc; private ZipCollectionBuilder myFiles; @@ -64,7 +59,8 @@ public class TerminologyLoaderSvcLoincJpaTest extends BaseJpaR4Test { mySvc.loadLoinc(myFiles.getFiles(), mySrd); myTerminologyDeferredStorageSvc.saveAllDeferred(); - myBatchJobHelper.awaitAllBulkJobCompletions(false, TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME); + // WIP KHS find equivalent of this in batch2 +// myBatchJobHelper.awaitAllBulkJobCompletions(false, TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME); runInTransaction(() -> { assertEquals(1, myTermCodeSystemDao.count()); @@ -90,7 +86,8 @@ public class TerminologyLoaderSvcLoincJpaTest extends BaseJpaR4Test { TermTestUtil.addLoincMandatoryFilesWithPropertiesFileToZip(myFiles, "v268_loincupload.properties"); mySvc.loadLoinc(myFiles.getFiles(), mySrd); myTerminologyDeferredStorageSvc.saveAllDeferred(); - myBatchJobHelper.awaitAllBulkJobCompletions(false, TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME); + // WIP KHS find equivalent of this in batch2 +// myBatchJobHelper.awaitAllBulkJobCompletions(false, TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME); runInTransaction(() -> { assertEquals(1, myTermCodeSystemDao.count()); diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplCurrentVersionR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplCurrentVersionR4Test.java index 9519c226e5c..26a385c62ef 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplCurrentVersionR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplCurrentVersionR4Test.java @@ -51,7 +51,7 @@ import java.util.Properties; import java.util.Set; import java.util.stream.Collectors; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; +import static ca.uhn.fhir.batch2.jobs.termcodesystem.TermCodeSystemJobConfig.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; import static ca.uhn.fhir.jpa.term.loinc.LoincUploadPropertiesEnum.LOINC_ANSWERLIST_DUPLICATE_FILE_DEFAULT; import static ca.uhn.fhir.jpa.term.loinc.LoincUploadPropertiesEnum.LOINC_ANSWERLIST_FILE_DEFAULT; import static ca.uhn.fhir.jpa.term.loinc.LoincUploadPropertiesEnum.LOINC_ANSWERLIST_LINK_DUPLICATE_FILE_DEFAULT; diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplR4Test.java index e9596618e04..0d0e452ec58 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcImplR4Test.java @@ -32,7 +32,7 @@ import java.util.List; import java.util.Optional; import java.util.Set; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; +import static ca.uhn.fhir.batch2.jobs.termcodesystem.TermCodeSystemJobConfig.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/job/TermCodeSystemDeleteJobTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/job/TermCodeSystemDeleteJobTest.java index ef18d94e8f3..1a7dc4c0c55 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/job/TermCodeSystemDeleteJobTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/job/TermCodeSystemDeleteJobTest.java @@ -45,7 +45,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.Properties; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_DELETE_JOB_NAME; +import static ca.uhn.fhir.batch2.jobs.termcodesystem.TermCodeSystemJobConfig.TERM_CODE_SYSTEM_DELETE_JOB_NAME; import static ca.uhn.fhir.jpa.term.loinc.LoincUploadPropertiesEnum.LOINC_ANSWERLIST_DUPLICATE_FILE_DEFAULT; import static ca.uhn.fhir.jpa.term.loinc.LoincUploadPropertiesEnum.LOINC_ANSWERLIST_FILE_DEFAULT; import static ca.uhn.fhir.jpa.term.loinc.LoincUploadPropertiesEnum.LOINC_ANSWERLIST_LINK_DUPLICATE_FILE_DEFAULT; diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/job/TermCodeSystemVersionDeleteJobTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/job/TermCodeSystemVersionDeleteJobTest.java index 1d57fe3639c..a69a472f6b1 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/job/TermCodeSystemVersionDeleteJobTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/term/job/TermCodeSystemVersionDeleteJobTest.java @@ -47,7 +47,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.Properties; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; +import static ca.uhn.fhir.batch2.jobs.termcodesystem.TermCodeSystemJobConfig.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; import static ca.uhn.fhir.jpa.term.loinc.LoincUploadPropertiesEnum.LOINC_ANSWERLIST_DUPLICATE_FILE_DEFAULT; import static ca.uhn.fhir.jpa.term.loinc.LoincUploadPropertiesEnum.LOINC_ANSWERLIST_FILE_DEFAULT; import static ca.uhn.fhir.jpa.term.loinc.LoincUploadPropertiesEnum.LOINC_ANSWERLIST_LINK_DUPLICATE_FILE_DEFAULT; diff --git a/hapi-fhir-jpaserver-test-r5/pom.xml b/hapi-fhir-jpaserver-test-r5/pom.xml index e498bc324aa..19507333a55 100644 --- a/hapi-fhir-jpaserver-test-r5/pom.xml +++ b/hapi-fhir-jpaserver-test-r5/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoR5CodeSystemTest.java b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoR5CodeSystemTest.java index 3b007e95836..860447bf7de 100644 --- a/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoR5CodeSystemTest.java +++ b/hapi-fhir-jpaserver-test-r5/src/test/java/ca/uhn/fhir/jpa/dao/r5/FhirResourceDaoR5CodeSystemTest.java @@ -11,8 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired; import java.util.List; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_DELETE_JOB_NAME; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; +import static ca.uhn.fhir.batch2.jobs.termcodesystem.TermCodeSystemJobConfig.TERM_CODE_SYSTEM_DELETE_JOB_NAME; +import static ca.uhn.fhir.batch2.jobs.termcodesystem.TermCodeSystemJobConfig.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; diff --git a/hapi-fhir-jpaserver-test-utilities/pom.xml b/hapi-fhir-jpaserver-test-utilities/pom.xml index b5f0ecafb72..ec4570b4fb4 100644 --- a/hapi-fhir-jpaserver-test-utilities/pom.xml +++ b/hapi-fhir-jpaserver-test-utilities/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaDstu3Test.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaDstu3Test.java index d2e5802da87..05982bfe945 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaDstu3Test.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaDstu3Test.java @@ -32,7 +32,6 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoSubscription; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoValueSet; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc; -import ca.uhn.fhir.jpa.batch.api.IBatchJobSubmitter; import ca.uhn.fhir.jpa.bulk.export.api.IBulkDataExportJobSchedulingHelper; import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc; import ca.uhn.fhir.jpa.dao.data.IResourceIndexedComboStringUniqueDao; @@ -141,9 +140,6 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest { private static IValidationSupport ourJpaValidationSupportChainDstu3; private static IFhirResourceDaoValueSet ourValueSetDao; - - @Autowired - protected IBatchJobSubmitter myBatchJobSubmitter; @Autowired protected ITermDeferredStorageSvc myTerminologyDeferredStorageSvc; @Autowired diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaR4Test.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaR4Test.java index 5b741c08db2..2d37b7bbf8d 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaR4Test.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaR4Test.java @@ -35,9 +35,8 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoValueSet; import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.api.svc.IIdHelperService; import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc; -import ca.uhn.fhir.jpa.batch.api.IBatchJobSubmitter; -import ca.uhn.fhir.jpa.binary.provider.BinaryAccessProvider; import ca.uhn.fhir.jpa.binary.interceptor.BinaryStorageInterceptor; +import ca.uhn.fhir.jpa.binary.provider.BinaryAccessProvider; import ca.uhn.fhir.jpa.bulk.export.api.IBulkDataExportJobSchedulingHelper; import ca.uhn.fhir.jpa.bulk.export.provider.BulkDataExportProvider; import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc; @@ -517,8 +516,6 @@ public abstract class BaseJpaR4Test extends BaseJpaTest implements ITestDataBuil @Autowired protected IIdHelperService myIdHelperService; @Autowired - protected IBatchJobSubmitter myBatchJobSubmitter; - @Autowired protected ValidationSettings myValidationSettings; @Autowired protected IMdmLinkJpaRepository myMdmLinkDao; diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaTest.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaTest.java index 73d8702e5af..f54fee6308e 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaTest.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/BaseJpaTest.java @@ -75,7 +75,6 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException; import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import ca.uhn.fhir.test.BaseTest; -import ca.uhn.fhir.test.utilities.BatchJobHelper; import ca.uhn.fhir.test.utilities.LoggingExtension; import ca.uhn.fhir.test.utilities.ProxyUtil; import ca.uhn.fhir.test.utilities.UnregisterScheduledProcessor; @@ -102,10 +101,6 @@ import org.junit.jupiter.api.extension.RegisterExtension; import org.mockito.Answers; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.springframework.batch.core.repository.dao.JobExecutionDao; -import org.springframework.batch.core.repository.dao.JobInstanceDao; -import org.springframework.batch.core.repository.dao.MapJobExecutionDao; -import org.springframework.batch.core.repository.dao.MapJobInstanceDao; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.orm.jpa.JpaTransactionManager; @@ -202,8 +197,6 @@ public abstract class BaseJpaTest extends BaseTest { @Autowired(required = false) protected IFulltextSearchSvc myFulltestSearchSvc; @Autowired(required = false) - protected BatchJobHelper myBatchJobHelper; - @Autowired(required = false) protected Batch2JobHelper myBatch2JobHelper; @Autowired protected ITermConceptDao myTermConceptDao; @@ -230,24 +223,11 @@ public abstract class BaseJpaTest extends BaseTest { private IResourceHistoryTableDao myResourceHistoryTableDao; @Autowired private IForcedIdDao myForcedIdDao; - @Autowired(required = false) - private JobExecutionDao myMapJobExecutionDao; - @Autowired(required = false) - private JobInstanceDao myMapJobInstanceDao; protected T loadResourceFromClasspath(Class type, String resourceName) throws IOException { return ClasspathUtil.loadResource(myFhirContext, type, resourceName); } - @AfterEach - public void afterEnsureNoStaleBatchJobs() { - if (myMapJobInstanceDao != null) { - myBatchJobHelper.ensureNoRunningJobs(); - ProxyUtil.getSingletonTarget(myMapJobExecutionDao, MapJobExecutionDao.class).clear(); - ProxyUtil.getSingletonTarget(myMapJobInstanceDao, MapJobInstanceDao.class).clear(); - } - } - @AfterEach public void afterPerformCleanup() { BaseHapiFhirDao.setDisableIncrementOnUpdateForUnitTest(false); diff --git a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/config/TestJPAConfig.java b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/config/TestJPAConfig.java index 2f28181cc25..0fcfdc21d2c 100644 --- a/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/config/TestJPAConfig.java +++ b/hapi-fhir-jpaserver-test-utilities/src/main/java/ca/uhn/fhir/jpa/test/config/TestJPAConfig.java @@ -37,8 +37,6 @@ import ca.uhn.fhir.jpa.subscription.submit.config.SubscriptionSubmitterConfig; import ca.uhn.fhir.jpa.test.Batch2JobHelper; import ca.uhn.fhir.jpa.test.util.StoppableSubscriptionDeliveringRestHookSubscriber; import ca.uhn.fhir.jpa.test.util.SubscriptionTestUtil; -import ca.uhn.fhir.test.utilities.BatchJobHelper; -import org.springframework.batch.core.explore.JobExplorer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -79,13 +77,9 @@ public class TestJPAConfig { return config; } - /* - Please do not rename this bean to "transactionManager()" as this will conflict with the transactionManager - provided by Spring Batch. - */ @Bean @Primary - public JpaTransactionManager hapiTransactionManager(EntityManagerFactory entityManagerFactory) { + public JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) { JpaTransactionManager retVal = new JpaTransactionManager(); retVal.setEntityManagerFactory(entityManagerFactory); return retVal; @@ -103,11 +97,6 @@ public class TestJPAConfig { return new StoppableSubscriptionDeliveringRestHookSubscriber(); } - @Bean - public BatchJobHelper batchJobHelper(JobExplorer theJobExplorer) { - return new BatchJobHelper(theJobExplorer); - } - @Bean public Batch2JobHelper batch2JobHelper(IJobMaintenanceService theJobMaintenanceService, IJobCoordinator theJobCoordinator, IJobPersistence theJobPersistence) { return new Batch2JobHelper(theJobMaintenanceService, theJobCoordinator, theJobPersistence); diff --git a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/term/job/DynamicJobFlowSandbox.java b/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/term/job/DynamicJobFlowSandbox.java deleted file mode 100644 index 5f21b5a31db..00000000000 --- a/hapi-fhir-jpaserver-test-utilities/src/test/java/ca/uhn/fhir/jpa/term/job/DynamicJobFlowSandbox.java +++ /dev/null @@ -1,123 +0,0 @@ -package ca.uhn.fhir.jpa.term.job; - -/* - * #%L - * HAPI FHIR JPA Server - * %% - * Copyright (C) 2014 - 2021 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% - */ - -import com.google.common.collect.Lists; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.batch.core.Job; -import org.springframework.batch.core.Step; -import org.springframework.batch.core.configuration.annotation.JobBuilderFactory; -import org.springframework.batch.core.configuration.annotation.StepBuilderFactory; -import org.springframework.batch.core.job.builder.FlowBuilder; -import org.springframework.batch.core.job.builder.SimpleJobBuilder; -import org.springframework.batch.core.job.flow.Flow; -import org.springframework.batch.core.job.flow.support.SimpleFlow; -import org.springframework.batch.repeat.RepeatStatus; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; - -import java.util.List; -import java.util.stream.Collectors; - -/** - * Not intended to ever run. Used as a sandbox for "interesting" jobs - */ -public class DynamicJobFlowSandbox { - protected static final Logger ourLog = LoggerFactory.getLogger(DynamicJobFlowSandbox.class); - - - @Autowired - private JobBuilderFactory myJobBuilderFactory; - - @Autowired - private StepBuilderFactory myStepBuilderFactory; - - private List versionPidList = Lists.newArrayList(3L, 5L); - - @Bean - public Job testJob() { - SimpleJobBuilder jobBuilder = myJobBuilderFactory.get("job") - .start(stepPreFlow()); - - // add a flow for each Pid - List flowForEachPidList = versionPidList.stream().map(this::getFlowForPid).collect(Collectors.toList()); - flowForEachPidList.forEach( flowForPid -> jobBuilder.on("COMPLETED").to(flowForPid) ); - - return jobBuilder.next(stepPostFlow()).build(); - } - - - private Flow getFlowForPid(Long theLong) { - return new FlowBuilder("flow-for-Pid-" + theLong) - .start(flowStep1(theLong)) - .next(fllowStep2(theLong)) - .build(); - } - - - - public Step flowStep1(long theLong) { - String name = "flow-step-1-for-Pid-" + theLong; - return myStepBuilderFactory.get(name) - .tasklet((contribution, chunkContext) -> { - ourLog.info("\n\n" + name + " executed\n\n"); - return RepeatStatus.FINISHED; - }) - .build(); - } - - - public Step fllowStep2(long theLong) { - String name = "flow-step-2-for-Pid-" + theLong; - return myStepBuilderFactory.get(name) - .tasklet((contribution, chunkContext) -> { - ourLog.info("\n\n" + name + " executed\n\n"); - return RepeatStatus.FINISHED; - }) - .build(); - } - - - public Step stepPreFlow() { - return myStepBuilderFactory.get("step-pre-flow") - .tasklet((contribution, chunkContext) -> { - ourLog.info("\n\nstep-pre-flow executed\n\n"); - return RepeatStatus.FINISHED; - }) - .build(); - } - - - public Step stepPostFlow() { - return myStepBuilderFactory.get("step-post-flow") - .tasklet((contribution, chunkContext) -> { - ourLog.info("\n\nstep-post-flow executed\n\n"); - return RepeatStatus.FINISHED; - }) - .build(); - } - - -} - - - diff --git a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml index 78d937f5a81..934cb40294d 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml +++ b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-server-mdm/pom.xml b/hapi-fhir-server-mdm/pom.xml index 0f2e431ee06..552ad409f2b 100644 --- a/hapi-fhir-server-mdm/pom.xml +++ b/hapi-fhir-server-mdm/pom.xml @@ -7,7 +7,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-server-openapi/pom.xml b/hapi-fhir-server-openapi/pom.xml index 54894db35d9..c7e8806e59c 100644 --- a/hapi-fhir-server-openapi/pom.xml +++ b/hapi-fhir-server-openapi/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-server/pom.xml b/hapi-fhir-server/pom.xml index 7c943c63ed1..5f6c7c4302f 100644 --- a/hapi-fhir-server/pom.xml +++ b/hapi-fhir-server/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml index a35785c6f08..fa32ec5c422 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml index c28b6411ea5..3c5f8adf19e 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT hapi-fhir-spring-boot-sample-client-apache diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml index bc3b598ff59..bc367ed7a11 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT hapi-fhir-spring-boot-sample-client-okhttp diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml index 870d7247288..404c372a997 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT hapi-fhir-spring-boot-sample-server-jersey diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml index bb270e7e27d..12545b42954 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT hapi-fhir-spring-boot-samples diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml index 4c29f75de8d..d7e90402d0b 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/pom.xml b/hapi-fhir-spring-boot/pom.xml index 860186d00cf..8c9c659b1d1 100644 --- a/hapi-fhir-spring-boot/pom.xml +++ b/hapi-fhir-spring-boot/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-sql-migrate/pom.xml b/hapi-fhir-sql-migrate/pom.xml index e1d8a98e41b..1b399984689 100644 --- a/hapi-fhir-sql-migrate/pom.xml +++ b/hapi-fhir-sql-migrate/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-sql-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/SchemaInitializationProvider.java b/hapi-fhir-sql-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/SchemaInitializationProvider.java index 72475716e84..e626add64ef 100644 --- a/hapi-fhir-sql-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/SchemaInitializationProvider.java +++ b/hapi-fhir-sql-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/SchemaInitializationProvider.java @@ -20,8 +20,8 @@ package ca.uhn.fhir.jpa.migrate.tasks; * #L% */ -import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.context.ConfigurationException; +import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.jpa.migrate.DriverTypeEnum; import ca.uhn.fhir.jpa.migrate.tasks.api.ISchemaInitializationProvider; import com.google.common.base.Charsets; @@ -32,6 +32,7 @@ import javax.annotation.Nonnull; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import static org.apache.commons.lang3.StringUtils.isBlank; @@ -57,6 +58,10 @@ public class SchemaInitializationProvider implements ISchemaInitializationProvid @Override public List getSqlStatements(DriverTypeEnum theDriverType) { + if (!isEnabled()) { + return Collections.emptyList(); + } + List retval = new ArrayList<>(); String initScript = mySchemaFileClassPath + "/" + getInitScript(theDriverType); diff --git a/hapi-fhir-sql-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/Builder.java b/hapi-fhir-sql-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/Builder.java index 8239c481746..82c6ee85b91 100644 --- a/hapi-fhir-sql-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/Builder.java +++ b/hapi-fhir-sql-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/Builder.java @@ -92,17 +92,18 @@ public class Builder { return task; } - public Builder initializeSchema(String theVersion, ISchemaInitializationProvider theSchemaInitializationProvider) { - mySink.addTask(new InitializeSchemaTask(myRelease, theVersion, theSchemaInitializationProvider)); - return this; + public InitializeSchemaTask initializeSchema(String theVersion, ISchemaInitializationProvider theSchemaInitializationProvider) { + InitializeSchemaTask task = new InitializeSchemaTask(myRelease, theVersion, theSchemaInitializationProvider); + mySink.addTask(task); + return task; } @SuppressWarnings("unused") - public Builder initializeSchema(String theVersion, String theSchemaName, ISchemaInitializationProvider theSchemaInitializationProvider) { + public InitializeSchemaTask initializeSchema(String theVersion, String theSchemaName, ISchemaInitializationProvider theSchemaInitializationProvider) { InitializeSchemaTask task = new InitializeSchemaTask(myRelease, theVersion, theSchemaInitializationProvider); task.setDescription("Initialize " + theSchemaName + " schema"); mySink.addTask(task); - return this; + return task; } public Builder executeRawSql(String theVersion, DriverTypeEnum theDriver, @Language("SQL") String theSql) { diff --git a/hapi-fhir-sql-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/ISchemaInitializationProvider.java b/hapi-fhir-sql-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/ISchemaInitializationProvider.java index dc5ff01569a..a98bbfb4e46 100644 --- a/hapi-fhir-sql-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/ISchemaInitializationProvider.java +++ b/hapi-fhir-sql-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/ISchemaInitializationProvider.java @@ -35,4 +35,8 @@ public interface ISchemaInitializationProvider { ISchemaInitializationProvider setSchemaDescription(String theSchemaDescription); boolean canInitializeSchema(); + + default boolean isEnabled() { + return true; + } } diff --git a/hapi-fhir-storage-batch2-jobs/pom.xml b/hapi-fhir-storage-batch2-jobs/pom.xml index f2449b56376..8d10e6960d2 100644 --- a/hapi-fhir-storage-batch2-jobs/pom.xml +++ b/hapi-fhir-storage-batch2-jobs/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml 4.0.0 diff --git a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/importpull/BulkImportPullConfig.java b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/importpull/BulkImportPullConfig.java index 2d3d4f208ee..7e4cc653d51 100644 --- a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/importpull/BulkImportPullConfig.java +++ b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/importpull/BulkImportPullConfig.java @@ -26,7 +26,6 @@ import ca.uhn.fhir.batch2.importpull.models.BulkImportRecord; import ca.uhn.fhir.batch2.model.JobDefinition; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; -import ca.uhn.fhir.jpa.batch.config.BatchConstants; import ca.uhn.fhir.jpa.bulk.imprt.api.IBulkDataImportSvc; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -34,6 +33,7 @@ import org.springframework.context.annotation.Configuration; @Configuration public class BulkImportPullConfig { + public static final String BULK_IMPORT_JOB_NAME = "bulkImportJob"; @Autowired private FhirContext myFhirContext; @@ -48,7 +48,7 @@ public class BulkImportPullConfig { public JobDefinition bulkImportPullJobDefinition() { return JobDefinition .newBuilder() - .setJobDefinitionId(BatchConstants.BULK_IMPORT_JOB_NAME) + .setJobDefinitionId(BULK_IMPORT_JOB_NAME) .setJobDescription("Performs bulk import pull job") .setJobDefinitionVersion(1) .gatedExecution() diff --git a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/termcodesystem/TermCodeSystemJobConfig.java b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/termcodesystem/TermCodeSystemJobConfig.java index 55828dea433..76c315ef5ff 100644 --- a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/termcodesystem/TermCodeSystemJobConfig.java +++ b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/termcodesystem/TermCodeSystemJobConfig.java @@ -40,11 +40,19 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_DELETE_JOB_NAME; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME; @Configuration public class TermCodeSystemJobConfig { + /** + * TermCodeSystem delete + */ + public static final String TERM_CODE_SYSTEM_DELETE_JOB_NAME = "termCodeSystemDeleteJob"; + + /** + * TermCodeSystemVersion delete + */ + public static final String TERM_CODE_SYSTEM_VERSION_DELETE_JOB_NAME = "termCodeSystemVersionDeleteJob"; + @Autowired private ITermCodeSystemDeleteJobSvc myITermCodeSystemSvc; diff --git a/hapi-fhir-storage-batch2/pom.xml b/hapi-fhir-storage-batch2/pom.xml index 2ec6f9bab2b..b0ae1577775 100644 --- a/hapi-fhir-storage-batch2/pom.xml +++ b/hapi-fhir-storage-batch2/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-storage-mdm/pom.xml b/hapi-fhir-storage-mdm/pom.xml index 10e2422a900..343189a858e 100644 --- a/hapi-fhir-storage-mdm/pom.xml +++ b/hapi-fhir-storage-mdm/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml 4.0.0 diff --git a/hapi-fhir-storage-test-utilities/pom.xml b/hapi-fhir-storage-test-utilities/pom.xml index bc5b86fc22e..5c8d1a6eb81 100644 --- a/hapi-fhir-storage-test-utilities/pom.xml +++ b/hapi-fhir-storage-test-utilities/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml 4.0.0 diff --git a/hapi-fhir-storage/pom.xml b/hapi-fhir-storage/pom.xml index 764fda79217..9e41bdb1275 100644 --- a/hapi-fhir-storage/pom.xml +++ b/hapi-fhir-storage/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/HomogeneousResourcePidList.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/HomogeneousResourcePidList.java index c358b83c726..24db9fc166b 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/HomogeneousResourcePidList.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/HomogeneousResourcePidList.java @@ -21,8 +21,8 @@ package ca.uhn.fhir.jpa.api.pid; */ import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; -import io.micrometer.core.lang.NonNull; +import javax.annotation.Nonnull; import java.util.Collection; import java.util.Date; @@ -30,7 +30,7 @@ import java.util.Date; * A resource pid list where all pids have the same resource type */ public class HomogeneousResourcePidList extends BaseResourcePidList { - @NonNull + @Nonnull final String myResourceType; public HomogeneousResourcePidList(String theResourceType, Collection theIds, Date theLastDate) { diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/MixedResourcePidList.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/MixedResourcePidList.java index 6f4d9cdc3f0..696204126b1 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/MixedResourcePidList.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/api/pid/MixedResourcePidList.java @@ -21,8 +21,8 @@ package ca.uhn.fhir.jpa.api.pid; */ import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; -import io.micrometer.core.lang.NonNull; +import javax.annotation.Nonnull; import java.util.Collection; import java.util.Date; import java.util.List; @@ -31,7 +31,7 @@ import java.util.List; * A resource pid list where the pids can have different resource types */ public class MixedResourcePidList extends BaseResourcePidList { - @NonNull + @Nonnull final List myResourceTypes; public MixedResourcePidList(List theResourceTypes, Collection theIds, Date theLastDate) { diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/bulk/export/provider/BulkDataExportProvider.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/bulk/export/provider/BulkDataExportProvider.java index 052e3b1045b..0e226f77eba 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/bulk/export/provider/BulkDataExportProvider.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/bulk/export/provider/BulkDataExportProvider.java @@ -75,13 +75,13 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; -import static ca.uhn.fhir.jpa.batch.config.BatchConstants.PATIENT_BULK_EXPORT_FORWARD_REFERENCE_RESOURCE_TYPES; import static org.apache.commons.lang3.StringUtils.isEmpty; import static org.slf4j.LoggerFactory.getLogger; public class BulkDataExportProvider { public static final String FARM_TO_TABLE_TYPE_FILTER_REGEX = "(?:,)(?=[A-Z][a-z]+\\?)"; + public static final List PATIENT_BULK_EXPORT_FORWARD_REFERENCE_RESOURCE_TYPES = List.of("Practitioner", "Organization"); private static final Logger ourLog = getLogger(BulkDataExportProvider.class); @Autowired diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java index d3e428967b2..1c55ed1ab10 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java @@ -56,7 +56,6 @@ import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.PatchTypeEnum; import ca.uhn.fhir.rest.api.PreferReturnEnum; -import ca.uhn.fhir.rest.api.RestOperationTypeEnum; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.storage.DeferredInterceptorBroadcasts; import ca.uhn.fhir.rest.api.server.storage.TransactionDetails; @@ -69,7 +68,6 @@ import ca.uhn.fhir.rest.server.exceptions.MethodNotAllowedException; import ca.uhn.fhir.rest.server.exceptions.NotModifiedException; import ca.uhn.fhir.rest.server.exceptions.PayloadTooLargeException; import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException; -import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor; import ca.uhn.fhir.rest.server.method.BaseMethodBinding; import ca.uhn.fhir.rest.server.method.BaseResourceReturningMethodBinding; import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; @@ -81,7 +79,6 @@ import ca.uhn.fhir.util.ElementUtil; import ca.uhn.fhir.util.FhirTerser; import ca.uhn.fhir.util.ResourceReferenceInfo; import ca.uhn.fhir.util.StopWatch; -import ca.uhn.fhir.util.ThreadPoolUtil; import ca.uhn.fhir.util.UrlUtil; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ArrayListMultimap; @@ -102,7 +99,6 @@ import org.hl7.fhir.instance.model.api.IPrimitiveType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.task.SyncTaskExecutor; import org.springframework.core.task.TaskExecutor; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.TransactionDefinition; diff --git a/hapi-fhir-structures-dstu2.1/pom.xml b/hapi-fhir-structures-dstu2.1/pom.xml index de3770f18c9..bc27fc8fa45 100644 --- a/hapi-fhir-structures-dstu2.1/pom.xml +++ b/hapi-fhir-structures-dstu2.1/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml index c9dcead5715..b3475bdf7e5 100644 --- a/hapi-fhir-structures-dstu2/pom.xml +++ b/hapi-fhir-structures-dstu2/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-dstu3/pom.xml b/hapi-fhir-structures-dstu3/pom.xml index a67ee055f0b..0bd46010812 100644 --- a/hapi-fhir-structures-dstu3/pom.xml +++ b/hapi-fhir-structures-dstu3/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-hl7org-dstu2/pom.xml b/hapi-fhir-structures-hl7org-dstu2/pom.xml index 636f9d5848e..a7ecbd30b07 100644 --- a/hapi-fhir-structures-hl7org-dstu2/pom.xml +++ b/hapi-fhir-structures-hl7org-dstu2/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r4/pom.xml b/hapi-fhir-structures-r4/pom.xml index 20c366da3a1..57d3a2a8f47 100644 --- a/hapi-fhir-structures-r4/pom.xml +++ b/hapi-fhir-structures-r4/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r5/pom.xml b/hapi-fhir-structures-r5/pom.xml index 0e67d32424a..73ff997043f 100644 --- a/hapi-fhir-structures-r5/pom.xml +++ b/hapi-fhir-structures-r5/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-test-utilities/pom.xml b/hapi-fhir-test-utilities/pom.xml index 4326ae45304..580a415026e 100644 --- a/hapi-fhir-test-utilities/pom.xml +++ b/hapi-fhir-test-utilities/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/BatchJobHelper.java b/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/BatchJobHelper.java deleted file mode 100644 index d14f2ff19a1..00000000000 --- a/hapi-fhir-test-utilities/src/main/java/ca/uhn/fhir/test/utilities/BatchJobHelper.java +++ /dev/null @@ -1,183 +0,0 @@ -package ca.uhn.fhir.test.utilities; - -/*- - * #%L - * HAPI FHIR Test Utilities - * %% - * Copyright (C) 2014 - 2022 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% - */ - -import org.awaitility.core.ConditionTimeoutException; -import org.hamcrest.Matchers; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.batch.core.BatchStatus; -import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.JobInstance; -import org.springframework.batch.core.StepExecution; -import org.springframework.batch.core.explore.JobExplorer; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -import static org.awaitility.Awaitility.await; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; -import static org.junit.jupiter.api.Assertions.fail; - -public class BatchJobHelper { - private static final Logger ourLog = LoggerFactory.getLogger(BatchJobHelper.class); - private final JobExplorer myJobExplorer; - - public BatchJobHelper(JobExplorer theJobExplorer) { - myJobExplorer = theJobExplorer; - } - - - public List awaitAllBulkJobCompletions(String... theJobNames) { - return awaitAllBulkJobCompletions(true, theJobNames); - } - - /** - * Await and report for job completions - * - * @param theFailIfNotJobsFound indicate if must fail in case no matching jobs are found - * @param theJobNames The job names to match - * @return the matched JobExecution(s) - */ - public List awaitAllBulkJobCompletions(boolean theFailIfNotJobsFound, String... theJobNames) { - assert theJobNames.length > 0; - - if (theFailIfNotJobsFound) { - await() - .alias("Wait for jobs to exist named: " + Arrays.asList(theJobNames)) - .until(() -> getJobInstances(theJobNames), not(empty())); - } - List matchingJobInstances = getJobInstances(theJobNames); - - if (theFailIfNotJobsFound) { - if (matchingJobInstances.isEmpty()) { - List wantNames = Arrays.asList(theJobNames); - List haveNames = myJobExplorer.getJobNames(); - fail("There are no jobs running - Want names " + wantNames + " and have names " + haveNames); - } - } - List matchingExecutions = matchingJobInstances.stream().flatMap(jobInstance -> myJobExplorer.getJobExecutions(jobInstance).stream()).collect(Collectors.toList()); - awaitJobCompletions(matchingExecutions); - - // Return the final state - matchingExecutions = matchingJobInstances.stream().flatMap(jobInstance -> myJobExplorer.getJobExecutions(jobInstance).stream()).collect(Collectors.toList()); - return matchingExecutions; - } - - private List getJobInstances(String[] theJobNames) { - List matchingJobInstances = new ArrayList<>(); - for (String nextName : theJobNames) { - matchingJobInstances.addAll(myJobExplorer.findJobInstancesByJobName(nextName, 0, 100)); - } - return matchingJobInstances; - } - - public JobExecution awaitJobExecution(Long theJobExecutionId) { - JobExecution jobExecution = myJobExplorer.getJobExecution(theJobExecutionId); - awaitJobCompletion(jobExecution); - return myJobExplorer.getJobExecution(theJobExecutionId); - } - - protected void awaitJobCompletions(Collection theJobs) { - // This intermittently fails for unknown reasons, so I've added a bunch - // of extra junk here to improve what we output when it fails - for (JobExecution jobExecution : theJobs) { - try { - awaitJobCompletion(jobExecution); - } catch (ConditionTimeoutException e) { - StringBuilder msg = new StringBuilder(); - msg.append("Failed waiting for job to complete.\n"); - msg.append("Error: ").append(e).append("\n"); - msg.append("Statuses:"); - for (JobExecution next : theJobs) { - JobExecution execution = myJobExplorer.getJobExecution(next.getId()); - msg.append("\n * Execution ") - .append(execution.getId()) - .append(" has status ") - .append(execution.getStatus()); - } - fail(msg.toString()); - } - } - } - - public void awaitJobCompletion(JobExecution theJobExecution) { - await() - .atMost(120, TimeUnit.SECONDS).until(() -> { - JobExecution jobExecution = myJobExplorer.getJobExecution(theJobExecution.getId()); - ourLog.info("JobExecution {} currently has status: {}- Failures if any: {}", theJobExecution.getId(), jobExecution.getStatus(), jobExecution.getFailureExceptions()); - return jobExecution.getStatus(); - }, Matchers.oneOf( - // JM: Adding ABANDONED status because given the description, it s similar to FAILURE, and we need to avoid tests failing because - // of wait timeouts caused by unmatched statuses. Also adding STOPPED because tests were found where this wait timed out - // with jobs keeping that status during the whole wait - // KHS: Adding UNKNOWN - BatchStatus.COMPLETED, - BatchStatus.FAILED, - BatchStatus.ABANDONED, - BatchStatus.STOPPED, - BatchStatus.UNKNOWN - )); - } - - public int getReadCount(Long theJobExecutionId) { - StepExecution stepExecution = getStepExecution(theJobExecutionId); - return stepExecution.getReadCount(); - } - - public int getWriteCount(Long theJobExecutionId) { - StepExecution stepExecution = getStepExecution(theJobExecutionId); - return stepExecution.getWriteCount(); - } - - private StepExecution getStepExecution(Long theJobExecutionId) { - JobExecution jobExecution = myJobExplorer.getJobExecution(theJobExecutionId); - Collection stepExecutions = jobExecution.getStepExecutions(); - assertThat(stepExecutions, hasSize(1)); - return stepExecutions.iterator().next(); - } - - public void ensureNoRunningJobs() { - for (String nextJobName : myJobExplorer.getJobNames()) { - List instances = myJobExplorer.getJobInstances(nextJobName, 0, 10000); - for (JobInstance nextInstance : instances) { - List executions = myJobExplorer.getJobExecutions(nextInstance); - for (JobExecution nextExecution : executions) { - ourLog.info("Have job execution {} in status: {}", nextExecution.getId(), nextExecution.getStatus()); - try { - await().until(() -> myJobExplorer.getJobExecution(nextExecution.getId()).getStatus(), oneOf(BatchStatus.STOPPED, BatchStatus.ABANDONED, BatchStatus.FAILED, BatchStatus.COMPLETED)); - } catch (ConditionTimeoutException e) { - JobExecution execution = myJobExplorer.getJobExecution(nextExecution.getId()); - fail("Execution " + execution + "\n" + - "Instance: " + nextInstance + "\n" + - "Job: " + nextJobName); - } - - } - } - } - } -} diff --git a/hapi-fhir-testpage-overlay/pom.xml b/hapi-fhir-testpage-overlay/pom.xml index a123f9a5d3d..c5714f267e8 100644 --- a/hapi-fhir-testpage-overlay/pom.xml +++ b/hapi-fhir-testpage-overlay/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-validation-resources-dstu2.1/pom.xml b/hapi-fhir-validation-resources-dstu2.1/pom.xml index 9fae6fc9452..25dca05c7bb 100644 --- a/hapi-fhir-validation-resources-dstu2.1/pom.xml +++ b/hapi-fhir-validation-resources-dstu2.1/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-dstu2/pom.xml b/hapi-fhir-validation-resources-dstu2/pom.xml index 8199b3f7c03..a65d36d0a9c 100644 --- a/hapi-fhir-validation-resources-dstu2/pom.xml +++ b/hapi-fhir-validation-resources-dstu2/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-dstu3/pom.xml b/hapi-fhir-validation-resources-dstu3/pom.xml index 8f5598ba569..4d6db7e093d 100644 --- a/hapi-fhir-validation-resources-dstu3/pom.xml +++ b/hapi-fhir-validation-resources-dstu3/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-r4/pom.xml b/hapi-fhir-validation-resources-r4/pom.xml index 3c157ff3719..d32d7861017 100644 --- a/hapi-fhir-validation-resources-r4/pom.xml +++ b/hapi-fhir-validation-resources-r4/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-r5/pom.xml b/hapi-fhir-validation-resources-r5/pom.xml index 3e6e06f9587..d8869cc21e6 100644 --- a/hapi-fhir-validation-resources-r5/pom.xml +++ b/hapi-fhir-validation-resources-r5/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation/pom.xml b/hapi-fhir-validation/pom.xml index 2e7d22a506f..7c45a203499 100644 --- a/hapi-fhir-validation/pom.xml +++ b/hapi-fhir-validation/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-tinder-plugin/pom.xml b/hapi-tinder-plugin/pom.xml index 8e3ca89a9a1..b51ae3247f9 100644 --- a/hapi-tinder-plugin/pom.xml +++ b/hapi-tinder-plugin/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../pom.xml @@ -58,37 +58,37 @@ ca.uhn.hapi.fhir hapi-fhir-structures-dstu3 - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-structures-hl7org-dstu2 - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-structures-r4 - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-structures-r5 - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-validation-resources-dstu2 - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-validation-resources-dstu3 - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-validation-resources-r4 - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT org.apache.velocity diff --git a/hapi-tinder-test/pom.xml b/hapi-tinder-test/pom.xml index 7b4413f5d9f..fc693ae0bee 100644 --- a/hapi-tinder-test/pom.xml +++ b/hapi-tinder-test/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 3eb95f4aa3b..c8518c9e15b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir pom - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT HAPI-FHIR An open-source implementation of the FHIR specification in Java. https://hapifhir.io @@ -2024,7 +2024,7 @@ ca.uhn.hapi.fhir hapi-fhir-checkstyle - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT diff --git a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml index 60bea7b0462..c704a575e39 100644 --- a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml +++ b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../../pom.xml diff --git a/tests/hapi-fhir-base-test-mindeps-client/pom.xml b/tests/hapi-fhir-base-test-mindeps-client/pom.xml index 8d0832c3fee..d2767de9b39 100644 --- a/tests/hapi-fhir-base-test-mindeps-client/pom.xml +++ b/tests/hapi-fhir-base-test-mindeps-client/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../../pom.xml diff --git a/tests/hapi-fhir-base-test-mindeps-server/pom.xml b/tests/hapi-fhir-base-test-mindeps-server/pom.xml index ba6ae11c1b4..560d4bf86e2 100644 --- a/tests/hapi-fhir-base-test-mindeps-server/pom.xml +++ b/tests/hapi-fhir-base-test-mindeps-server/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 6.2.0-PRE9-SNAPSHOT + 6.2.0-PRE10-SNAPSHOT ../../pom.xml