本文整理汇总了Java中ca.uhn.fhir.rest.client.IGenericClient.read方法的典型用法代码示例。如果您正苦于以下问题:Java IGenericClient.read方法的具体用法?Java IGenericClient.read怎么用?Java IGenericClient.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.uhn.fhir.rest.client.IGenericClient
的用法示例。
在下文中一共展示了IGenericClient.read方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFindConsent
import ca.uhn.fhir.rest.client.IGenericClient; //导入方法依赖的package包/类
/**
* Test method for
* {@link org.iexhub.services.JaxRsConsentRestProvider\#find(@IdParam final
* IdDt id)}.
*/
@Test
public void testFindConsent() {
try {
Logger logger = LoggerFactory.getLogger(ConsentDstu3Test.class);
LoggingInterceptor loggingInterceptor = new LoggingInterceptor();
loggingInterceptor.setLogRequestSummary(true);
loggingInterceptor.setLogRequestBody(true);
loggingInterceptor.setLogger(logger);
IGenericClient client = ctxt.newRestfulGenericClient(serverBaseUrl);
client.registerInterceptor(loggingInterceptor); // Required only for
// logging
Consent retVal = client.read(Consent.class,
/*iExHubDomainOid + "." + consentId*/ /*"2.25.1469220780502"*/ "2.25.1471531116858");
assertTrue("Error - unexpected return value for testFindConsent", retVal != null);
} catch (Exception e) {
fail(e.getMessage());
}
}
示例2: main
import ca.uhn.fhir.rest.client.IGenericClient; //导入方法依赖的package包/类
public static void main(String[] theArgs) {
// Create a client
String serverBaseUrl = "http://fhirtest.uhn.ca/base";
FhirContext ctx = new FhirContext();
IGenericClient client = ctx.newRestfulGenericClient(serverBaseUrl);
// Use the client to read back the new instance using the
// ID we retrieved from the read
Patient patient = client.read(Patient.class, "4529");
// Print the ID of the newly created resource
System.out.println("Found ID: " + patient.getId());
// Change the gender and send an update to the server
patient.setGender(AdministrativeGenderCodesEnum.F);
MethodOutcome outcome = client.update().resource(patient).execute();
System.out.println("Now have ID: " + outcome.getId());
}
示例3: main
import ca.uhn.fhir.rest.client.IGenericClient; //导入方法依赖的package包/类
public static void main(String[] args) {
/*
* This is out ot date - Just keeping
* it in case it's helpful...
*/
final String authUser = "username";
final String authPassword = "password";
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(new AuthScope("10.10.10.10", 8080),
new UsernamePasswordCredentials(authUser, authPassword));
HttpHost myProxy = new HttpHost("10.10.10.10", 8080);
HttpClientBuilder clientBuilder = HttpClientBuilder.create();
clientBuilder
.setProxy(myProxy)
.setProxyAuthenticationStrategy(new ProxyAuthenticationStrategy())
.setDefaultCredentialsProvider(credsProvider)
.disableCookieManagement();
CloseableHttpClient httpClient = clientBuilder.build();
FhirContext ctx = new FhirContext();
String serverBase = "http://spark.furore.com/fhir/";
ctx.getRestfulClientFactory().setHttpClient(httpClient);
IGenericClient client = ctx.newRestfulGenericClient(serverBase);
IdDt id = new IdDt("Patient", "123");
client.read(Patient.class, id);
}
示例4: getResourceTags
import ca.uhn.fhir.rest.client.IGenericClient; //导入方法依赖的package包/类
@SuppressWarnings("unused")
public void getResourceTags() {
// START SNIPPET: getResourceTags
IGenericClient client = new FhirContext().newRestfulGenericClient("http://fhir.healthintersections.com.au/open");
Patient p = client.read(Patient.class, "1");
// Retrieve the list of tags from the resource metadata
TagList tags = ResourceMetadataKeyEnum.TAG_LIST.get(p);
// tags may be null if no tags were read in
if (tags == null) {
System.out.println("No tags!");
} else {
// You may iterate over all the tags
for (Tag next : tags) {
System.out.println(next.getScheme() + " - " + next.getTerm());
}
// You may also get a list of tags matching a given scheme
List<Tag> someTags = tags.getTagsWithScheme("http://hl7.org/fhir/tag");
// Or a specific tag (by scheme and term)
Tag specificTag = tags.getTag("http://hl7.org/fhir/tag", "http://foo");
}
// END SNIPPET: getResourceTags
}