001/*-
002 * #%L
003 * HAPI FHIR JPA Server
004 * %%
005 * Copyright (C) 2014 - 2025 Smile CDR, Inc.
006 * %%
007 * Licensed under the Apache License, Version 2.0 (the "License");
008 * you may not use this file except in compliance with the License.
009 * You may obtain a copy of the License at
010 *
011 *      http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 * #L%
019 */
020package ca.uhn.fhir.jpa.config;
021
022import ca.uhn.fhir.context.FhirContext;
023import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
024import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
025import ca.uhn.fhir.jpa.api.svc.IIdHelperService;
026import ca.uhn.fhir.jpa.bulk.export.api.IBulkExportProcessor;
027import ca.uhn.fhir.jpa.bulk.export.svc.BulkExportHelperService;
028import ca.uhn.fhir.jpa.bulk.export.svc.JpaBulkExportProcessor;
029import ca.uhn.fhir.jpa.dao.SearchBuilderFactory;
030import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService;
031import ca.uhn.fhir.jpa.model.dao.JpaPid;
032import ca.uhn.fhir.mdm.svc.MdmExpandersHolder;
033import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
034import jakarta.persistence.EntityManager;
035import org.springframework.context.annotation.Bean;
036import org.springframework.context.annotation.Configuration;
037
038@Configuration
039public class JpaBulkExportConfig {
040        @Bean
041        public IBulkExportProcessor<JpaPid> jpaBulkExportProcessor(
042                        FhirContext theFhirContext,
043                        BulkExportHelperService theBulkExportHelperService,
044                        JpaStorageSettings theJpaStorageSettings,
045                        DaoRegistry theDaoRegistry,
046                        SearchBuilderFactory<JpaPid> theSearchBuilderFactory,
047                        IIdHelperService<JpaPid> theIdHelperService,
048                        EntityManager theEntityManager,
049                        IHapiTransactionService theHapiTransactionService,
050                        ISearchParamRegistry theSearchParamRegistry,
051                        MdmExpandersHolder theMdmExpandersHolder) {
052                return new JpaBulkExportProcessor(
053                                theFhirContext,
054                                theBulkExportHelperService,
055                                theJpaStorageSettings,
056                                theDaoRegistry,
057                                theSearchBuilderFactory,
058                                theIdHelperService,
059                                theEntityManager,
060                                theHapiTransactionService,
061                                theSearchParamRegistry,
062                                theMdmExpandersHolder);
063        }
064
065        @Bean
066        public BulkExportHelperService bulkExportHelperService() {
067                return new BulkExportHelperService();
068        }
069}