
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.IBatch2DaoSvc; 026import ca.uhn.fhir.jpa.api.svc.IDeleteExpungeSvc; 027import ca.uhn.fhir.jpa.api.svc.IIdHelperService; 028import ca.uhn.fhir.jpa.batch2.Batch2DaoSvcImpl; 029import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc; 030import ca.uhn.fhir.jpa.dao.SearchBuilderFactory; 031import ca.uhn.fhir.jpa.dao.data.IResourceLinkDao; 032import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; 033import ca.uhn.fhir.jpa.dao.expunge.ResourceTableFKProvider; 034import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService; 035import ca.uhn.fhir.jpa.delete.batch2.DeleteExpungeSqlBuilder; 036import ca.uhn.fhir.jpa.delete.batch2.DeleteExpungeSvcImpl; 037import ca.uhn.fhir.jpa.model.config.PartitionSettings; 038import ca.uhn.fhir.jpa.searchparam.MatchUrlService; 039import jakarta.persistence.EntityManager; 040import org.springframework.beans.factory.annotation.Autowired; 041import org.springframework.context.annotation.Bean; 042 043public class Batch2SupportConfig { 044 045 @Bean 046 public IBatch2DaoSvc batch2DaoSvc( 047 IResourceTableDao theResourceTableDao, 048 IResourceLinkDao theResourceLinkDao, 049 MatchUrlService theMatchUrlService, 050 DaoRegistry theDaoRegistry, 051 FhirContext theFhirContext, 052 IHapiTransactionService theTransactionService, 053 PartitionSettings thePartitionSettings, 054 SearchBuilderFactory theSearchBuilderFactory) { 055 return new Batch2DaoSvcImpl( 056 theResourceTableDao, 057 theResourceLinkDao, 058 theMatchUrlService, 059 theDaoRegistry, 060 theFhirContext, 061 theTransactionService, 062 thePartitionSettings, 063 theSearchBuilderFactory); 064 } 065 066 @Bean 067 public IDeleteExpungeSvc deleteExpungeSvc( 068 EntityManager theEntityManager, 069 DeleteExpungeSqlBuilder theDeleteExpungeSqlBuilder, 070 @Autowired(required = false) IFulltextSearchSvc theFullTextSearchSvc) { 071 return new DeleteExpungeSvcImpl(theEntityManager, theDeleteExpungeSqlBuilder, theFullTextSearchSvc); 072 } 073 074 @Bean 075 DeleteExpungeSqlBuilder deleteExpungeSqlBuilder( 076 ResourceTableFKProvider theResourceTableFKProvider, 077 JpaStorageSettings theStorageSettings, 078 IIdHelperService theIdHelper, 079 IResourceLinkDao theResourceLinkDao, 080 PartitionSettings thePartitionSettings) { 081 return new DeleteExpungeSqlBuilder( 082 theResourceTableFKProvider, theStorageSettings, theIdHelper, theResourceLinkDao, thePartitionSettings); 083 } 084}