001/*-
002 * #%L
003 * HAPI FHIR JPA Server
004 * %%
005 * Copyright (C) 2014 - 2024 Smile CDR, Inc.
006 * %%
007 * Licensed under the Apache License, Version 2.0 (the "License");
008 * you may not use this file except in compliance with the License.
009 * You may obtain a copy of the License at
010 *
011 *      http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 * #L%
019 */
020package ca.uhn.fhir.jpa.batch2;
021
022import ca.uhn.fhir.batch2.api.IJobPersistence;
023import ca.uhn.fhir.batch2.config.BaseBatch2Config;
024import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
025import ca.uhn.fhir.jpa.bulk.export.job.BulkExportJobConfig;
026import ca.uhn.fhir.jpa.dao.data.IBatch2JobInstanceRepository;
027import ca.uhn.fhir.jpa.dao.data.IBatch2WorkChunkMetadataViewRepository;
028import ca.uhn.fhir.jpa.dao.data.IBatch2WorkChunkRepository;
029import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService;
030import jakarta.persistence.EntityManager;
031import org.springframework.context.annotation.Bean;
032import org.springframework.context.annotation.Configuration;
033import org.springframework.context.annotation.Import;
034
035@Configuration
036@Import({BulkExportJobConfig.class})
037public class JpaBatch2Config extends BaseBatch2Config {
038
039        @Bean
040        public IJobPersistence batch2JobInstancePersister(
041                        IBatch2JobInstanceRepository theJobInstanceRepository,
042                        IBatch2WorkChunkRepository theWorkChunkRepository,
043                        IBatch2WorkChunkMetadataViewRepository theWorkChunkMetadataViewRepo,
044                        IHapiTransactionService theTransactionService,
045                        EntityManager theEntityManager,
046                        IInterceptorBroadcaster theInterceptorBroadcaster) {
047                return new JpaJobPersistenceImpl(
048                                theJobInstanceRepository,
049                                theWorkChunkRepository,
050                                theWorkChunkMetadataViewRepo,
051                                theTransactionService,
052                                theEntityManager,
053                                theInterceptorBroadcaster);
054        }
055}