001/* 002 * #%L 003 * HAPI FHIR - Core Library 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.model.api; 021 022import ca.uhn.fhir.context.FhirContext; 023import ca.uhn.fhir.context.FhirVersionEnum; 024import ca.uhn.fhir.context.RuntimeResourceDefinition; 025import ca.uhn.fhir.fhirpath.IFhirPath; 026import ca.uhn.fhir.rest.api.IVersionSpecificBundleFactory; 027import org.hl7.fhir.instance.model.api.IBase; 028import org.hl7.fhir.instance.model.api.IBaseResource; 029import org.hl7.fhir.instance.model.api.IIdType; 030import org.hl7.fhir.instance.model.api.IPrimitiveType; 031 032import java.io.InputStream; 033import java.util.Date; 034 035/** 036 * Each structure version JAR will have an implementation of this interface. 037 * This is used internally by HAPI and subject to change. Do not use this interface 038 * directly in user code. 039 * 040 * See also IFhirVersionServer for the hapi-fhir-server equivalent. 041 */ 042public interface IFhirVersion { 043 044 IFhirPath createFhirPathExecutor(FhirContext theFhirContext); 045 046 IBaseResource generateProfile(RuntimeResourceDefinition theRuntimeResourceDefinition, String theServerBase); 047 048 Class<?> getContainedType(); 049 050 InputStream getFhirVersionPropertiesFile(); 051 052 IPrimitiveType<Date> getLastUpdated(IBaseResource theResource); 053 054 String getPathToSchemaDefinitions(); 055 056 Class<? extends IBase> getResourceReferenceType(); 057 058 FhirVersionEnum getVersion(); 059 060 IVersionSpecificBundleFactory newBundleFactory(FhirContext theContext); 061 062 IBase newCodingDt(); 063 064 IIdType newIdType(); 065 066 /** 067 * Creates a new {@link IIdType} instance for the given version with the given value 068 * 069 * @since 8.0.0 070 */ 071 default IIdType newIdType(String theValue) { 072 IIdType retVal = newIdType(); 073 retVal.setValue(theValue); 074 return retVal; 075 } 076 077 /** 078 * Returns an instance of <code>IFhirVersionServer<code> for this version. 079 * Note that this method may only be called if the <code>hapi-fhir-server</code> 080 * JAR is on the classpath. Otherwise it will result in a {@link ClassNotFoundException} 081 */ 082 Object getServerVersion(); 083}