001package ca.uhn.fhir.jpa.config;
002
003import ca.uhn.fhir.context.FhirContext;
004import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
005import ca.uhn.fhir.jpa.dao.ITransactionProcessorVersionAdapter;
006import ca.uhn.fhir.jpa.dao.TransactionProcessorVersionAdapterDstu2;
007import ca.uhn.fhir.jpa.term.TermReadSvcDstu2;
008import ca.uhn.fhir.jpa.term.TermVersionAdapterSvcDstu2;
009import ca.uhn.fhir.jpa.term.api.ITermReadSvc;
010import ca.uhn.fhir.jpa.term.api.ITermVersionAdapterSvc;
011import ca.uhn.fhir.model.dstu2.composite.MetaDt;
012import ca.uhn.fhir.model.dstu2.resource.Bundle;
013import org.springframework.context.annotation.Bean;
014import org.springframework.context.annotation.Configuration;
015import org.springframework.context.annotation.Import;
016import org.springframework.transaction.annotation.EnableTransactionManagement;
017
018/*
019 * #%L
020 * HAPI FHIR JPA Server
021 * %%
022 * Copyright (C) 2014 - 2022 Smile CDR, Inc.
023 * %%
024 * Licensed under the Apache License, Version 2.0 (the "License");
025 * you may not use this file except in compliance with the License.
026 * You may obtain a copy of the License at
027 *
028 * http://www.apache.org/licenses/LICENSE-2.0
029 *
030 * Unless required by applicable law or agreed to in writing, software
031 * distributed under the License is distributed on an "AS IS" BASIS,
032 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
033 * See the License for the specific language governing permissions and
034 * limitations under the License.
035 * #L%
036 */
037
038@Configuration
039@EnableTransactionManagement
040@Import({
041        FhirContextDstu2Config.class,
042        GeneratedDaoAndResourceProviderConfigDstu2.class,
043        JpaConfig.class
044})
045public class JpaDstu2Config {
046        @Bean
047        public ITransactionProcessorVersionAdapter transactionProcessorVersionFacade() {
048                return new TransactionProcessorVersionAdapterDstu2();
049        }
050
051        @Bean
052        public ITermVersionAdapterSvc translationAdaptorVersion() {
053                return new TermVersionAdapterSvcDstu2();
054        }
055
056        @Bean(name = "mySystemDaoDstu2")
057        public IFhirSystemDao<Bundle, MetaDt> systemDaoDstu2() {
058                ca.uhn.fhir.jpa.dao.FhirSystemDaoDstu2 retVal = new ca.uhn.fhir.jpa.dao.FhirSystemDaoDstu2();
059                return retVal;
060        }
061
062        @Bean(name = "mySystemProviderDstu2")
063        public ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2 systemProviderDstu2(FhirContext theFhirContext) {
064                ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2 retVal = new ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2();
065                retVal.setDao(systemDaoDstu2());
066                retVal.setContext(theFhirContext);
067                return retVal;
068        }
069
070        @Bean
071        public ITermReadSvc terminologyService() {
072                return new TermReadSvcDstu2();
073        }
074}