当前位置: 首页>>代码示例>>Java>>正文


Java BaseRuntimeChildDefinition.getChildByName方法代码示例

本文整理汇总了Java中ca.uhn.fhir.context.BaseRuntimeChildDefinition.getChildByName方法的典型用法代码示例。如果您正苦于以下问题:Java BaseRuntimeChildDefinition.getChildByName方法的具体用法?Java BaseRuntimeChildDefinition.getChildByName怎么用?Java BaseRuntimeChildDefinition.getChildByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ca.uhn.fhir.context.BaseRuntimeChildDefinition的用法示例。


在下文中一共展示了BaseRuntimeChildDefinition.getChildByName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: populatePrimitiveValue

import ca.uhn.fhir.context.BaseRuntimeChildDefinition; //导入方法依赖的package包/类
private static void populatePrimitiveValue(FhirContext theContext, IBaseResource theSubscription, String theChildName, String theValue) {
	RuntimeResourceDefinition def = theContext.getResourceDefinition(theSubscription);
	Validate.isTrue(def.getName().equals("Subscription"), "theResource is not a subscription");
	BaseRuntimeChildDefinition statusChild = def.getChildByName(theChildName);
	List<IBase> entries = statusChild.getAccessor().getValues(theSubscription);
	IPrimitiveType<?> instance;
	if (entries.size() == 0) {
		BaseRuntimeElementDefinition<?> statusElement = statusChild.getChildByName(theChildName);
		instance = (IPrimitiveType<?>) statusElement.newInstance(statusChild.getInstanceConstructorArguments());
		statusChild.getMutator().addValue(theSubscription, instance);
	} else {
		instance = (IPrimitiveType<?>) entries.get(0);
	}

	instance.setValueAsString(theValue);
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:17,代码来源:SubscriptionUtil.java

示例2: readHtmlResponse

import ca.uhn.fhir.context.BaseRuntimeChildDefinition; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private T readHtmlResponse(Reader theResponseReader) {
	RuntimeResourceDefinition resDef = getFhirContext().getResourceDefinition(myReturnType);
	IBaseResource instance = resDef.newInstance();
	BaseRuntimeChildDefinition textChild = resDef.getChildByName("text");
	BaseRuntimeElementCompositeDefinition<?> textElement = (BaseRuntimeElementCompositeDefinition<?>) textChild.getChildByName("text");
	IBase textInstance = textElement.newInstance();
	textChild.getMutator().addValue(instance, textInstance);

	BaseRuntimeChildDefinition divChild = textElement.getChildByName("div");
	BaseRuntimeElementDefinition<?> divElement = divChild.getChildByName("div");
	IPrimitiveType<?> divInstance = (IPrimitiveType<?>) divElement.newInstance();
	try {
		divInstance.setValueAsString(IOUtils.toString(theResponseReader));
	} catch (Exception e) {
		throw new InvalidResponseException(400, "Failed to process HTML response from server: " + e.getMessage(), e);
	}
	divChild.getMutator().addValue(textInstance, divInstance);
	return (T) instance;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:21,代码来源:BaseClient.java

示例3: execute

import ca.uhn.fhir.context.BaseRuntimeChildDefinition; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Object execute() {
	String resourceName;
	String id;
	if (myType != null) {
		resourceName = myContext.getResourceDefinition(myType).getName();
		id = null;
	} else if (myId != null) {
		resourceName = myId.getResourceType();
		id = myId.getIdPart();
	} else {
		resourceName = null;
		id = null;
	}

	BaseHttpClientInvocation invocation = OperationMethodBinding.createOperationInvocation(myContext, resourceName, id, myOperationName, myParameters, myUseHttpGet);

	IClientResponseHandler handler;
	handler = new ResourceResponseHandler(myParameters.getClass(), null);

	Object retVal = invoke(null, handler, invocation);
	if (myContext.getResourceDefinition((IBaseResource)retVal).getName().equals("Parameters")) {
		return retVal;
	} else {
		RuntimeResourceDefinition def = myContext.getResourceDefinition("Parameters");
		IBaseResource parameters = def.newInstance();
		
		BaseRuntimeChildDefinition paramChild = def.getChildByName("parameter");
		BaseRuntimeElementCompositeDefinition<?> paramChildElem = (BaseRuntimeElementCompositeDefinition<?>) paramChild.getChildByName("parameter");
		IBase parameter = paramChildElem.newInstance();
		paramChild.getMutator().addValue(parameters, parameter);

		BaseRuntimeChildDefinition resourceElem = paramChildElem.getChildByName("resource");
		resourceElem.getMutator().addValue(parameter, (IBase) retVal);
		
		return parameters;
	}
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:40,代码来源:GenericClient.java

示例4: getDefinition

import ca.uhn.fhir.context.BaseRuntimeChildDefinition; //导入方法依赖的package包/类
private BaseRuntimeChildDefinition getDefinition(BaseRuntimeElementCompositeDefinition<?> theCurrentDef, List<String> theSubList) {
	BaseRuntimeChildDefinition nextDef = theCurrentDef.getChildByNameOrThrowDataFormatException(theSubList.get(0));

	if (theSubList.size() == 1) {
		return nextDef;
	} else {
		BaseRuntimeElementCompositeDefinition<?> cmp = (BaseRuntimeElementCompositeDefinition<?>) nextDef.getChildByName(theSubList.get(0));
		return getDefinition(cmp, theSubList.subList(1, theSubList.size()));
	}
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:11,代码来源:FhirTerser.java

示例5: addParameterToParameters

import ca.uhn.fhir.context.BaseRuntimeChildDefinition; //导入方法依赖的package包/类
public static void addParameterToParameters(FhirContext theContext, IBaseResource theTargetResource, Object sourceClientArgument, String theName) {
	RuntimeResourceDefinition def = theContext.getResourceDefinition(theTargetResource);
	BaseRuntimeChildDefinition paramChild = def.getChildByName("parameter");
	BaseRuntimeElementCompositeDefinition<?> paramChildElem = (BaseRuntimeElementCompositeDefinition<?>) paramChild.getChildByName("parameter");

	addClientParameter(theContext, sourceClientArgument, theTargetResource, paramChild, paramChildElem, theName);
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:8,代码来源:ParametersUtil.java

示例6: createIssue

import ca.uhn.fhir.context.BaseRuntimeChildDefinition; //导入方法依赖的package包/类
private static IBase createIssue(FhirContext theCtx, IBaseResource theOutcome) {
	RuntimeResourceDefinition ooDef = theCtx.getResourceDefinition(theOutcome);
	BaseRuntimeChildDefinition issueChild = ooDef.getChildByName("issue");
	BaseRuntimeElementCompositeDefinition<?> issueElement = (BaseRuntimeElementCompositeDefinition<?>) issueChild.getChildByName("issue");

	IBase issue = issueElement.newInstance();
	issueChild.getMutator().addValue(theOutcome, issue);
	return issue;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:10,代码来源:OperationOutcomeUtil.java

示例7: populateDetails

import ca.uhn.fhir.context.BaseRuntimeChildDefinition; //导入方法依赖的package包/类
private static void populateDetails(FhirContext theCtx, IBase theIssue, String theSeverity, String theDetails, String theLocation, String theCode) {
	BaseRuntimeElementCompositeDefinition<?> issueElement = (BaseRuntimeElementCompositeDefinition<?>) theCtx.getElementDefinition(theIssue.getClass());
	BaseRuntimeChildDefinition detailsChild;
	detailsChild = issueElement.getChildByName("diagnostics");

	BaseRuntimeChildDefinition codeChild = issueElement.getChildByName("code");
	IPrimitiveType<?> codeElem = (IPrimitiveType<?>) codeChild.getChildByName("code").newInstance(codeChild.getInstanceConstructorArguments());
	codeElem.setValueAsString(theCode);
	codeChild.getMutator().addValue(theIssue, codeElem);

	BaseRuntimeElementDefinition<?> stringDef = detailsChild.getChildByName(detailsChild.getElementName());
	BaseRuntimeChildDefinition severityChild = issueElement.getChildByName("severity");
	BaseRuntimeChildDefinition locationChild = issueElement.getChildByName("location");

	IPrimitiveType<?> severityElem = (IPrimitiveType<?>) severityChild.getChildByName("severity").newInstance(severityChild.getInstanceConstructorArguments());
	severityElem.setValueAsString(theSeverity);
	severityChild.getMutator().addValue(theIssue, severityElem);

	IPrimitiveType<?> string = (IPrimitiveType<?>) stringDef.newInstance();
	string.setValueAsString(theDetails);
	detailsChild.getMutator().setValue(theIssue, string);

	if (isNotBlank(theLocation)) {
		IPrimitiveType<?> locationElem = (IPrimitiveType<?>) locationChild.getChildByName("location").newInstance(locationChild.getInstanceConstructorArguments());
		locationElem.setValueAsString(theLocation);
		locationChild.getMutator().addValue(theIssue, locationElem);
	}
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:29,代码来源:OperationOutcomeUtil.java

示例8: getBundleFromFileDstu2

import ca.uhn.fhir.context.BaseRuntimeChildDefinition; //导入方法依赖的package包/类
private Bundle getBundleFromFileDstu2(Integer limit, File inputFile, FhirContext ctx) throws IOException, UnsupportedEncodingException {

		Bundle bundle = new Bundle();

		ZipInputStream zis = new ZipInputStream(FileUtils.openInputStream(inputFile));
		byte[] buffer = new byte[2048];

		int count = 0;
		while (true) {
			count++;
			if (limit != null && count > limit) {
				break;
			}

			ZipEntry nextEntry = zis.getNextEntry();
			if (nextEntry == null) {
				break;
			}

			int len = 0;
			ByteArrayOutputStream bos = new ByteArrayOutputStream();
			while ((len = zis.read(buffer)) > 0) {
				bos.write(buffer, 0, len);
			}
			byte[] exampleBytes = bos.toByteArray();
			String exampleString = new String(exampleBytes, "UTF-8");

			if (ourLog.isTraceEnabled()) {
				ourLog.trace("Next example: " + exampleString);
			}

			IBaseResource parsed;
			try {
				parsed = ctx.newJsonParser().parseResource(exampleString);
			} catch (DataFormatException e) {
				ourLog.info("FAILED to parse example {}", nextEntry.getName(), e);
				continue;
			}
			ourLog.info("Found example {} - {} - {} chars", nextEntry.getName(), parsed.getClass().getSimpleName(), exampleString.length());

			if (ctx.getResourceDefinition(parsed).getName().equals("Bundle")) {
				BaseRuntimeChildDefinition entryChildDef = ctx.getResourceDefinition(parsed).getChildByName("entry");
				BaseRuntimeElementCompositeDefinition<?> entryDef = (BaseRuntimeElementCompositeDefinition<?>) entryChildDef.getChildByName("entry");

				for (IBase nextEntry1 : entryChildDef.getAccessor().getValues(parsed)) {
					List<IBase> resources = entryDef.getChildByName("resource").getAccessor().getValues(nextEntry1);
					if (resources == null) {
						continue;
					}
					for (IBase nextResource : resources) {
						if (!ctx.getResourceDefinition(parsed).getName().equals("Bundle") && ctx.getResourceDefinition(parsed).getName().equals("SearchParameter")) {
							bundle.addEntry().setRequest(new EntryRequest().setMethod(HTTPVerbEnum.POST)).setResource((IResource) nextResource);
						}
					}
				}
			} else {
				if (ctx.getResourceDefinition(parsed).getName().equals("SearchParameter")) {
					continue;
				}
				bundle.addEntry().setRequest(new EntryRequest().setMethod(HTTPVerbEnum.POST)).setResource((IResource) parsed);
			}
		}
		return bundle;
	}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:65,代码来源:ExampleDataUploader.java


注:本文中的ca.uhn.fhir.context.BaseRuntimeChildDefinition.getChildByName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。