本文整理汇总了Java中ca.uhn.fhir.model.api.BundleEntry类的典型用法代码示例。如果您正苦于以下问题:Java BundleEntry类的具体用法?Java BundleEntry怎么用?Java BundleEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BundleEntry类属于ca.uhn.fhir.model.api包,在下文中一共展示了BundleEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEncodeBundleCategory
import ca.uhn.fhir.model.api.BundleEntry; //导入依赖的package包/类
@Test
public void testEncodeBundleCategory() {
Bundle b = new Bundle();
BundleEntry e = b.addEntry();
e.setResource(new Patient());
e.addCategory("scheme", "term", "label");
String val = ourCtx.newXmlParser().setPrettyPrint(true).encodeBundleToString(b);
ourLog.info(val);
assertThat(val, StringContains.containsString("<category term=\"term\" label=\"label\" scheme=\"scheme\"/>"));
b = ourCtx.newXmlParser().parseBundle(val);
assertEquals(1, b.getEntries().size());
assertEquals(1, b.getEntries().get(0).getCategories().size());
assertEquals("term", b.getEntries().get(0).getCategories().get(0).getTerm());
assertEquals("label", b.getEntries().get(0).getCategories().get(0).getLabel());
assertEquals("scheme", b.getEntries().get(0).getCategories().get(0).getScheme());
assertNull(b.getEntries().get(0).getResource());
}
示例2: testEncodeBundleCategory
import ca.uhn.fhir.model.api.BundleEntry; //导入依赖的package包/类
@Test
public void testEncodeBundleCategory() {
Bundle b = new Bundle();
BundleEntry e = b.addEntry();
e.setResource(new Patient());
b.addCategory("scheme", "term", "label");
String val = new FhirContext().newJsonParser().setPrettyPrint(false).encodeBundleToString(b);
ourLog.info(val);
assertThat(val, StringContains.containsString("\"category\":[{\"term\":\"term\",\"label\":\"label\",\"scheme\":\"scheme\"}]"));
assertThat(val, not(containsString("text")));
b = new FhirContext().newJsonParser().parseBundle(val);
assertEquals(1, b.getEntries().size());
assertEquals(1, b.getCategories().size());
assertEquals("term", b.getCategories().get(0).getTerm());
assertEquals("label", b.getCategories().get(0).getLabel());
assertEquals("scheme", b.getCategories().get(0).getScheme());
assertNull(b.getEntries().get(0).getResource());
}
示例3: testEncodeBundleEntryCategory
import ca.uhn.fhir.model.api.BundleEntry; //导入依赖的package包/类
@Test
public void testEncodeBundleEntryCategory() {
Bundle b = new Bundle();
BundleEntry e = b.addEntry();
e.setResource(new Patient());
e.addCategory("scheme", "term", "label");
String val = ourCtx.newJsonParser().setPrettyPrint(false).encodeBundleToString(b);
ourLog.info(val);
assertThat(val, StringContains.containsString("\"category\":[{\"term\":\"term\",\"label\":\"label\",\"scheme\":\"scheme\"}]"));
b = ourCtx.newJsonParser().parseBundle(val);
assertEquals(1, b.getEntries().size());
assertEquals(1, b.getEntries().get(0).getCategories().size());
assertEquals("term", b.getEntries().get(0).getCategories().get(0).getTerm());
assertEquals("label", b.getEntries().get(0).getCategories().get(0).getLabel());
assertEquals("scheme", b.getEntries().get(0).getCategories().get(0).getScheme());
assertNull(b.getEntries().get(0).getResource());
}
示例4: testSearchReturnsProfile
import ca.uhn.fhir.model.api.BundleEntry; //导入依赖的package包/类
@Test
public void testSearchReturnsProfile() throws Exception {
ourServlet.setAddProfileTag(AddProfileTagEnum.ONLY_FOR_CUSTOM);
ourReturnExtended=true;
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_id=aaa");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = ourCtx.newXmlParser().parseBundle(responseContent);
assertEquals(1, bundle.getEntries().size());
BundleEntry entry = bundle.getEntries().get(0);
List<Tag> profileTags = entry.getCategories().getTagsWithScheme(Tag.HL7_ORG_PROFILE_TAG);
assertEquals(1, profileTags.size());
assertEquals("http://foo/profiles/Profile", profileTags.get(0).getTerm());
Patient p = (Patient) bundle.getEntries().get(0).getResource();
assertEquals("idaaa", p.getNameFirstRep().getFamilyAsSingleString());
}
示例5: testSearchReturnsNoProfileForNormalType
import ca.uhn.fhir.model.api.BundleEntry; //导入依赖的package包/类
@Test
public void testSearchReturnsNoProfileForNormalType() throws Exception {
ourServlet.setAddProfileTag(AddProfileTagEnum.ONLY_FOR_CUSTOM);
ourReturnExtended=false;
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_id=aaa");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = ourCtx.newXmlParser().parseBundle(responseContent);
assertEquals(1, bundle.getEntries().size());
BundleEntry entry = bundle.getEntries().get(0);
List<Tag> profileTags = entry.getCategories().getTagsWithScheme(Tag.HL7_ORG_PROFILE_TAG);
assertEquals(0, profileTags.size());
}
示例6: testSearchReturnsNoProfileForExtendedType
import ca.uhn.fhir.model.api.BundleEntry; //导入依赖的package包/类
@Test
public void testSearchReturnsNoProfileForExtendedType() throws Exception {
ourServlet.setAddProfileTag(AddProfileTagEnum.NEVER);
ourReturnExtended=true;
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_id=aaa");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = ourCtx.newXmlParser().parseBundle(responseContent);
assertEquals(1, bundle.getEntries().size());
BundleEntry entry = bundle.getEntries().get(0);
List<Tag> profileTags = entry.getCategories().getTagsWithScheme(Tag.HL7_ORG_PROFILE_TAG);
assertEquals(0, profileTags.size());
}
示例7: testSearchReturnsProfileForNormalType
import ca.uhn.fhir.model.api.BundleEntry; //导入依赖的package包/类
@Test
public void testSearchReturnsProfileForNormalType() throws Exception {
ourServlet.setAddProfileTag(AddProfileTagEnum.ALWAYS);
ourReturnExtended=false;
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_id=aaa");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = ourCtx.newXmlParser().parseBundle(responseContent);
assertEquals(1, bundle.getEntries().size());
BundleEntry entry = bundle.getEntries().get(0);
List<Tag> profileTags = entry.getCategories().getTagsWithScheme(Tag.HL7_ORG_PROFILE_TAG);
assertEquals(1, profileTags.size());
assertEquals("http://hl7.org/fhir/profiles/Patient", profileTags.get(0).getTerm());
Patient p = (Patient) bundle.getEntries().get(0).getResource();
assertEquals("idaaa", p.getNameFirstRep().getFamilyAsSingleString());
}
示例8: testSearchReturnVersionedReferenceInResponse
import ca.uhn.fhir.model.api.BundleEntry; //导入依赖的package包/类
@Test
public void testSearchReturnVersionedReferenceInResponse() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=findPatientWithVersion");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
List<BundleEntry> entries = ourCtx.newXmlParser().parseBundle(responseContent).getEntries();
assertEquals(2, entries.size());
Patient p = (Patient) entries.get(0).getResource();
assertEquals(0, p.getContained().getContainedResources().size());
assertEquals("22", p.getId().getIdPart());
assertEquals("33", p.getId().getVersionIdPart());
assertEquals("44", p.getManagingOrganization().getReference().getIdPart());
assertEquals(null, p.getManagingOrganization().getReference().getVersionIdPart());
}
示例9: testSearchWithValue
import ca.uhn.fhir.model.api.BundleEntry; //导入依赖的package包/类
@Test
public void testSearchWithValue() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?" + Patient.SP_PROVIDER + "=123");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
List<BundleEntry> entries = ourCtx.newXmlParser().parseBundle(responseContent).getEntries();
assertEquals(1, entries.size());
Patient p = (Patient) entries.get(0).getResource();
assertEquals("0123", p.getName().get(0).getFamilyFirstRep().getValue());
assertEquals("1", p.getName().get(1).getFamilyFirstRep().getValue());
assertEquals("2", p.getName().get(2).getFamilyFirstRep().getValue());
}
示例10: testSearchWithValueAndChain
import ca.uhn.fhir.model.api.BundleEntry; //导入依赖的package包/类
@Test
public void testSearchWithValueAndChain() throws Exception {
{
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?" + Patient.SP_PROVIDER + ".name=123");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
List<BundleEntry> entries = ourCtx.newXmlParser().parseBundle(responseContent).getEntries();
assertEquals(1, entries.size());
Patient p = (Patient) entries.get(0).getResource();
assertEquals("0123", p.getName().get(0).getFamilyFirstRep().getValue());
assertEquals("1", p.getName().get(1).getFamilyFirstRep().getValue());
assertEquals("2name", p.getName().get(2).getFamilyFirstRep().getValue());
}
}
示例11: testSearchWithValueAndTypeAndChain
import ca.uhn.fhir.model.api.BundleEntry; //导入依赖的package包/类
@Test
public void testSearchWithValueAndTypeAndChain() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?" + Patient.SP_PROVIDER + ":Organization.name=123");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
List<BundleEntry> entries = ourCtx.newXmlParser().parseBundle(responseContent).getEntries();
assertEquals(1, entries.size());
Patient p = (Patient) entries.get(0).getResource();
assertEquals("0123", p.getName().get(0).getFamilyFirstRep().getValue());
assertEquals("1Organization", p.getName().get(1).getFamilyFirstRep().getValue());
assertEquals("2name", p.getName().get(2).getFamilyFirstRep().getValue());
}
示例12: testSearchWithDateValue
import ca.uhn.fhir.model.api.BundleEntry; //导入依赖的package包/类
@Test
public void testSearchWithDateValue() throws Exception {
{
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Observation?" + Observation.SP_NAME_VALUE_DATE + "=" + URLEncoder.encode("foo\\$bar$2001-01-01", "UTF-8"));
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
assertEquals(200, status.getStatusLine().getStatusCode());
List<BundleEntry> entries = ourCtx.newXmlParser().parseBundle(responseContent).getEntries();
assertEquals(1, entries.size());
Observation o = (Observation) entries.get(0).getResource();
assertEquals("foo$bar", o.getName().getText().getValue());
assertEquals("2001-01-01", ((DateTimeDt) o.getApplies()).getValueAsString().substring(0, 10));
}
}
示例13: testSearchWithIncludes
import ca.uhn.fhir.model.api.BundleEntry; //导入依赖的package包/类
@Test
public void testSearchWithIncludes() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?withIncludes=include1&_include=include2&_include=include3");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
ourLog.info("Response was:\n{}", responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
Bundle bundle = ourCtx.newXmlParser().parseBundle(responseContent);
BundleEntry entry0 = bundle.getEntries().get(0);
Patient patient = (Patient) entry0.getResource();
assertEquals("include1", patient.getCommunication().get(0).getText().getValue());
assertEquals("include2", patient.getAddress().get(0).getLine().get(0).getValue());
assertEquals("include3", patient.getAddress().get(1).getLine().get(0).getValue());
}
示例14: testEncodeBundleEntryAuthor
import ca.uhn.fhir.model.api.BundleEntry; //导入依赖的package包/类
@Test
public void testEncodeBundleEntryAuthor() {
Bundle b = new Bundle();
BundleEntry e = b.addEntry();
e.getAuthorName().setValue("The Author");
e.setResource(new Patient());
String val = ourCtx.newXmlParser().setPrettyPrint(true).encodeBundleToString(b);
ourLog.info(val);
assertThat(val, StringContains.containsString("<name>The Author</name>"));
b = ourCtx.newXmlParser().parseBundle(val);
assertEquals(1, b.getEntries().size());
assertEquals("The Author", b.getEntries().get(0).getAuthorName().getValue());
}
示例15: testEncodeBundleCategory
import ca.uhn.fhir.model.api.BundleEntry; //导入依赖的package包/类
@Test
public void testEncodeBundleCategory() {
Bundle b = new Bundle();
BundleEntry e = b.addEntry();
e.setResource(new Patient());
b.addCategory("scheme", "term", "label");
String val = ourCtx.newJsonParser().setPrettyPrint(false).encodeBundleToString(b);
ourLog.info(val);
assertThat(val, StringContains.containsString("\"category\":[{\"term\":\"term\",\"label\":\"label\",\"scheme\":\"scheme\"}]"));
assertThat(val, not(containsString("text")));
b = ourCtx.newJsonParser().parseBundle(val);
assertEquals(1, b.getEntries().size());
assertEquals(1, b.getCategories().size());
assertEquals("term", b.getCategories().get(0).getTerm());
assertEquals("label", b.getCategories().get(0).getLabel());
assertEquals("scheme", b.getCategories().get(0).getScheme());
assertNull(b.getEntries().get(0).getResource());
}