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.config; 021 022import ca.uhn.fhir.jpa.api.IDaoRegistry; 023import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; 024import ca.uhn.fhir.jpa.config.util.ResourceCountCacheUtil; 025import ca.uhn.fhir.jpa.dao.FulltextSearchSvcImpl; 026import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc; 027import ca.uhn.fhir.jpa.dao.search.HSearchSortHelperImpl; 028import ca.uhn.fhir.jpa.dao.search.IHSearchSortHelper; 029import ca.uhn.fhir.jpa.provider.DaoRegistryResourceSupportedSvc; 030import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; 031import ca.uhn.fhir.jpa.search.IStaleSearchDeletingSvc; 032import ca.uhn.fhir.jpa.search.StaleSearchDeletingSvcImpl; 033import ca.uhn.fhir.jpa.util.ResourceCountCache; 034import ca.uhn.fhir.rest.api.IResourceSupportedSvc; 035import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; 036import org.springframework.beans.factory.annotation.Autowired; 037import org.springframework.context.annotation.Bean; 038import org.springframework.context.annotation.Configuration; 039import org.springframework.context.annotation.Import; 040 041@Configuration 042@Import({JpaConfig.class}) 043public class HapiJpaConfig { 044 045 @Autowired 046 private ISearchParamRegistry mySearchParamRegistry; 047 048 @Bean 049 public IHSearchSortHelper extendedFulltextSortHelper() { 050 return new HSearchSortHelperImpl(mySearchParamRegistry); 051 } 052 053 @Bean 054 public IFulltextSearchSvc fullTextSearchSvc() { 055 return new FulltextSearchSvcImpl(); 056 } 057 058 @Bean 059 public IStaleSearchDeletingSvc staleSearchDeletingSvc() { 060 return new StaleSearchDeletingSvcImpl(); 061 } 062 063 @Bean 064 public DatabaseBackedPagingProvider databaseBackedPagingProvider() { 065 return new DatabaseBackedPagingProvider(); 066 } 067 068 @Bean 069 public IResourceSupportedSvc resourceSupportedSvc(IDaoRegistry theDaoRegistry) { 070 return new DaoRegistryResourceSupportedSvc(theDaoRegistry); 071 } 072 073 @Bean(name = "myResourceCountsCache") 074 public ResourceCountCache resourceCountsCache(IFhirSystemDao<?, ?> theSystemDao) { 075 return ResourceCountCacheUtil.newResourceCountCache(theSystemDao); 076 } 077}