001/*- 002 * #%L 003 * HAPI FHIR JPA Server 004 * %% 005 * Copyright (C) 2014 - 2023 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.dao.IFulltextSearchSvc; 029import ca.uhn.fhir.jpa.dao.data.IResourceLinkDao; 030import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; 031import ca.uhn.fhir.jpa.dao.expunge.ResourceTableFKProvider; 032import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService; 033import ca.uhn.fhir.jpa.delete.batch2.DeleteExpungeSqlBuilder; 034import ca.uhn.fhir.jpa.delete.batch2.DeleteExpungeSvcImpl; 035import ca.uhn.fhir.jpa.reindex.Batch2DaoSvcImpl; 036import ca.uhn.fhir.jpa.searchparam.MatchUrlService; 037import org.springframework.beans.factory.annotation.Autowired; 038import org.springframework.context.annotation.Bean; 039 040import javax.persistence.EntityManager; 041 042public class Batch2SupportConfig { 043 044 @Bean 045 public IBatch2DaoSvc batch2DaoSvc( 046 IResourceTableDao theResourceTableDao, 047 MatchUrlService theMatchUrlService, 048 DaoRegistry theDaoRegistry, 049 FhirContext theFhirContext, 050 IHapiTransactionService theTransactionService, 051 JpaStorageSettings theJpaStorageSettings) { 052 return new Batch2DaoSvcImpl( 053 theResourceTableDao, 054 theMatchUrlService, 055 theDaoRegistry, 056 theFhirContext, 057 theTransactionService, 058 theJpaStorageSettings); 059 } 060 061 @Bean 062 public IDeleteExpungeSvc deleteExpungeSvc( 063 EntityManager theEntityManager, 064 DeleteExpungeSqlBuilder theDeleteExpungeSqlBuilder, 065 @Autowired(required = false) IFulltextSearchSvc theFullTextSearchSvc) { 066 return new DeleteExpungeSvcImpl(theEntityManager, theDeleteExpungeSqlBuilder, theFullTextSearchSvc); 067 } 068 069 @Bean 070 DeleteExpungeSqlBuilder deleteExpungeSqlBuilder( 071 ResourceTableFKProvider theResourceTableFKProvider, 072 JpaStorageSettings theStorageSettings, 073 IIdHelperService theIdHelper, 074 IResourceLinkDao theResourceLinkDao) { 075 return new DeleteExpungeSqlBuilder( 076 theResourceTableFKProvider, theStorageSettings, theIdHelper, theResourceLinkDao); 077 } 078}