本文整理汇总了Java中ca.uhn.fhir.model.api.BundleEntry.setLinkAlternate方法的典型用法代码示例。如果您正苦于以下问题:Java BundleEntry.setLinkAlternate方法的具体用法?Java BundleEntry.setLinkAlternate怎么用?Java BundleEntry.setLinkAlternate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.uhn.fhir.model.api.BundleEntry
的用法示例。
在下文中一共展示了BundleEntry.setLinkAlternate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEncodeBundle
import ca.uhn.fhir.model.api.BundleEntry; //导入方法依赖的package包/类
@Test
public void testEncodeBundle() throws InterruptedException {
Bundle b = new Bundle();
b.getCategories().addTag("http://hl7.org/fhir/tag", "http://hl7.org/fhir/tag/message", "Message");
InstantDt pub = InstantDt.withCurrentTime();
Thread.sleep(2);
Patient p1 = new Patient();
p1.addName().addFamily("Family1");
p1.getId().setValue("1");
BundleEntry entry = b.addEntry();
entry.setResource(p1);
entry.getSummary().setValueAsString("this is the summary");
Patient p2 = new Patient();
p2.addName().addFamily("Family2");
p2.getId().setValue("2");
entry = b.addEntry();
entry.setLinkAlternate(new StringDt("http://foo/bar"));
entry.setLinkSearch(new StringDt("http://foo/bar/search"));
entry.setResource(p2);
BundleEntry deletedEntry = b.addEntry();
deletedEntry.setDeletedResourceId(new IdDt("Patient/3"));
deletedEntry.setDeleted(InstantDt.withCurrentTime());
String bundleString = ourCtx.newXmlParser().setPrettyPrint(true).encodeBundleToString(b);
ourLog.info(bundleString);
List<String> strings = new ArrayList<String>();
strings.add("<category term=\"http://hl7.org/fhir/tag/message\" label=\"Message\" scheme=\"http://hl7.org/fhir/tag\"/>");
strings.addAll(Arrays.asList("<entry>", "<id>1</id>", "</Patient>", "<summary type=\"xhtml\">", "<div", "</entry>"));
strings.addAll(Arrays.asList("<entry>", "<id>2</id>", "<link rel=\"alternate\" href=\"http://foo/bar\"/>", "<link rel=\"search\" href=\"http://foo/bar/search\"/>", "</entry>"));
strings.addAll(Arrays.asList("<at:deleted-entry", "ref=\"Patient/3", "/>"));
assertThat(bundleString, StringContainsInOrder.stringContainsInOrder(strings));
assertThat(bundleString, not(containsString("at:by")));
}
示例2: testEncodeBundleOldIdForm
import ca.uhn.fhir.model.api.BundleEntry; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Test
public void testEncodeBundleOldIdForm() throws InterruptedException {
Bundle b = new Bundle();
b.getCategories().addTag("http://hl7.org/fhir/tag", "http://hl7.org/fhir/tag/message", "Message");
InstantDt pub = InstantDt.withCurrentTime();
Thread.sleep(2);
Patient p1 = new Patient();
p1.addName().addFamily("Family1");
BundleEntry entry = b.addEntry();
entry.getId().setValue("1");
entry.setResource(p1);
entry.getSummary().setValueAsString("this is the summary");
Patient p2 = new Patient();
p2.addName().addFamily("Family2");
entry = b.addEntry();
entry.getId().setValue("2");
entry.setLinkAlternate(new StringDt("http://foo/bar"));
entry.setLinkSearch(new StringDt("http://foo/bar/search"));
entry.setResource(p2);
BundleEntry deletedEntry = b.addEntry();
deletedEntry.setId(new IdDt("Patient/3"));
deletedEntry.setDeleted(InstantDt.withCurrentTime());
String bundleString = ourCtx.newXmlParser().setPrettyPrint(true).encodeBundleToString(b);
ourLog.info(bundleString);
List<String> strings = new ArrayList<String>();
strings.add("<category term=\"http://hl7.org/fhir/tag/message\" label=\"Message\" scheme=\"http://hl7.org/fhir/tag\"/>");
strings.addAll(Arrays.asList("<entry>", "<id>1</id>", "</Patient>", "<summary type=\"xhtml\">", "<div", "</entry>"));
strings.addAll(Arrays.asList("<entry>", "<id>2</id>", "<link rel=\"alternate\" href=\"http://foo/bar\"/>", "<link rel=\"search\" href=\"http://foo/bar/search\"/>", "</entry>"));
strings.addAll(Arrays.asList("<at:deleted-entry", "ref=\"Patient/3", "/>"));
assertThat(bundleString, StringContainsInOrder.stringContainsInOrder(strings));
assertThat(bundleString, not(containsString("at:by")));
}
示例3: testEncodeBundle
import ca.uhn.fhir.model.api.BundleEntry; //导入方法依赖的package包/类
@Test
public void testEncodeBundle() throws InterruptedException {
Bundle b = new Bundle();
InstantDt pub = InstantDt.withCurrentTime();
Thread.sleep(2);
Patient p1 = new Patient();
p1.addName().addFamily("Family1");
BundleEntry entry = b.addEntry();
entry.getId().setValue("1");
entry.setResource(p1);
entry.getSummary().setValueAsString("this is the summary");
Patient p2 = new Patient();
p2.addName().addFamily("Family2");
entry = b.addEntry();
entry.getId().setValue("2");
entry.setLinkAlternate(new StringDt("http://foo/bar"));
entry.setResource(p2);
BundleEntry deletedEntry = b.addEntry();
deletedEntry.setId(new IdDt("Patient/3"));
InstantDt nowDt = InstantDt.withCurrentTime();
deletedEntry.setDeleted(nowDt);
String bundleString = ourCtx.newJsonParser().setPrettyPrint(true).encodeBundleToString(b);
ourLog.info(bundleString);
List<String> strings = new ArrayList<String>();
strings.addAll(Arrays.asList("\"id\":\"1\""));
strings.addAll(Arrays.asList("this is the summary"));
strings.addAll(Arrays.asList("\"id\":\"2\"", "\"rel\":\"alternate\"", "\"href\":\"http://foo/bar\""));
strings.addAll(Arrays.asList("\"deleted\":\"" + nowDt.getValueAsString() + "\"", "\"id\":\"Patient/3\""));
assertThat(bundleString, StringContainsInOrder.stringContainsInOrder(strings));
b.getEntries().remove(2);
bundleString = ourCtx.newJsonParser().setPrettyPrint(true).encodeBundleToString(b);
assertThat(bundleString, not(containsString("deleted")));
}
示例4: testEncodeBundle
import ca.uhn.fhir.model.api.BundleEntry; //导入方法依赖的package包/类
@Test
public void testEncodeBundle() throws InterruptedException {
Bundle b = new Bundle();
InstantDt pub = InstantDt.withCurrentTime();
Thread.sleep(2);
Patient p1 = new Patient();
p1.addName().addFamily("Family1");
BundleEntry entry = b.addEntry();
entry.getId().setValue("1");
entry.setResource(p1);
entry.getSummary().setValueAsString("this is the summary");
Patient p2 = new Patient();
p2.addName().addFamily("Family2");
entry = b.addEntry();
entry.getId().setValue("2");
entry.setLinkAlternate(new StringDt("http://foo/bar"));
entry.setResource(p2);
BundleEntry deletedEntry = b.addEntry();
deletedEntry.setId(new IdDt("Patient/3"));
InstantDt nowDt = InstantDt.withCurrentTime();
deletedEntry.setDeleted(nowDt);
String bundleString = ourCtx.newJsonParser().setPrettyPrint(true).encodeBundleToString(b);
ourLog.info(bundleString);
List<String> strings = new ArrayList<String>();
strings.addAll(Arrays.asList("\"id\": \"1\""));
strings.addAll(Arrays.asList("this is the summary"));
strings.addAll(Arrays.asList("\"id\": \"2\"", "\"rel\": \"alternate\"", "\"href\": \"http://foo/bar\""));
strings.addAll(Arrays.asList("\"deleted\": \"" + nowDt.getValueAsString() + "\"", "\"id\": \"Patient/3\""));
assertThat(bundleString, StringContainsInOrder.stringContainsInOrder(strings));
b.getEntries().remove(2);
bundleString = ourCtx.newJsonParser().setPrettyPrint(true).encodeBundleToString(b);
assertThat(bundleString, not(containsString("deleted")));
}