本文整理汇总了Java中org.hl7.fhir.instance.model.api.IBaseResource.getStructureFhirVersionEnum方法的典型用法代码示例。如果您正苦于以下问题:Java IBaseResource.getStructureFhirVersionEnum方法的具体用法?Java IBaseResource.getStructureFhirVersionEnum怎么用?Java IBaseResource.getStructureFhirVersionEnum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hl7.fhir.instance.model.api.IBaseResource
的用法示例。
在下文中一共展示了IBaseResource.getStructureFhirVersionEnum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RuntimeResourceDefinition
import org.hl7.fhir.instance.model.api.IBaseResource; //导入方法依赖的package包/类
public RuntimeResourceDefinition(FhirContext theContext, String theResourceName, Class<? extends IBaseResource> theClass, ResourceDef theResourceAnnotation, boolean theStandardType, Map<Class<? extends IBase>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
super(theResourceName, theClass, theStandardType, theContext, theClassToElementDefinitions);
myContext = theContext;
myResourceProfile = theResourceAnnotation.profile();
myId = theResourceAnnotation.id();
IBaseResource instance;
try {
instance = theClass.newInstance();
} catch (Exception e) {
throw new ConfigurationException(myContext.getLocalizer().getMessage(getClass(), "nonInstantiableType", theClass.getName(), e.toString()), e);
}
myStructureVersion = instance.getStructureFhirVersionEnum();
if (myStructureVersion != theContext.getVersion().getVersion()) {
throw new ConfigurationException(myContext.getLocalizer().getMessage(getClass(), "typeWrongVersion", theContext.getVersion().getVersion(), theClass.getName(), myStructureVersion));
}
}
示例2: outgoingResponse
import org.hl7.fhir.instance.model.api.IBaseResource; //导入方法依赖的package包/类
@Override
public boolean outgoingResponse(RequestDetails theRequestDetails, ResponseDetails theResponseDetails, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws AuthenticationException {
String[] formatParams = theRequestDetails.getParameters().get(Constants.PARAM_FORMAT);
String accept = null;
if (formatParams != null && formatParams.length > 0) {
accept = formatParams[0];
}
if (isBlank(accept)) {
accept = defaultString(theServletRequest.getHeader(Constants.HEADER_ACCEPT));
}
StringTokenizer tok = new StringTokenizer(accept, ";");
String wantVersionString = null;
while (tok.hasMoreTokens()) {
String next = tok.nextToken().trim();
if (next.startsWith("fhirVersion=")) {
wantVersionString = next.substring("fhirVersion=".length()).trim();
break;
}
}
FhirVersionEnum wantVersion = null;
if (isNotBlank(wantVersionString)) {
wantVersion = FhirVersionEnum.forVersionString(wantVersionString);
}
IBaseResource responseResource = theResponseDetails.getResponseResource();
FhirVersionEnum haveVersion = responseResource.getStructureFhirVersionEnum();
IBaseResource converted = null;
try {
if (wantVersion == FhirVersionEnum.R4 && haveVersion == FhirVersionEnum.DSTU3) {
converted = myVersionConvertor_30_40.convertResource(toDstu3(responseResource));
} else if (wantVersion == FhirVersionEnum.DSTU3 && haveVersion == FhirVersionEnum.R4) {
converted = myVersionConvertor_30_40.convertResource(toR4(responseResource));
} else if (wantVersion == FhirVersionEnum.DSTU2 && haveVersion == FhirVersionEnum.R4) {
converted = myVersionConvertor_10_40.convertResource(toR4(responseResource));
} else if (wantVersion == FhirVersionEnum.R4 && haveVersion == FhirVersionEnum.DSTU2) {
converted = myVersionConvertor_10_40.convertResource(toDstu2(responseResource));
} else if (wantVersion == FhirVersionEnum.DSTU2 && haveVersion == FhirVersionEnum.DSTU3) {
converted = myVersionConvertor_10_30.convertResource(toDstu3(responseResource));
} else if (wantVersion == FhirVersionEnum.DSTU3 && haveVersion == FhirVersionEnum.DSTU2) {
converted = myVersionConvertor_10_30.convertResource(toDstu2(responseResource));
}
} catch (FHIRException e) {
throw new InternalErrorException(e);
}
if (converted != null) {
theResponseDetails.setResponseResource(converted);
}
return true;
}