當前位置: 首頁>>代碼示例>>Java>>正文


Java BundleEntry.setLinkAlternate方法代碼示例

本文整理匯總了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")));

}
 
開發者ID:gajen0981,項目名稱:FHIR-Server,代碼行數:40,代碼來源:XmlParserTest.java

示例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")));

}
 
開發者ID:gajen0981,項目名稱:FHIR-Server,代碼行數:41,代碼來源:XmlParserTest.java

示例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")));

}
 
開發者ID:gajen0981,項目名稱:FHIR-Server,代碼行數:42,代碼來源:JsonParserTest.java

示例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")));

}
 
開發者ID:jamesagnew,項目名稱:hapi-fhir,代碼行數:42,代碼來源:JsonParserTest.java


注:本文中的ca.uhn.fhir.model.api.BundleEntry.setLinkAlternate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。