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


Java AtomEntry.setPublished方法代码示例

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


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

示例1: buildBundle

import org.hl7.fhir.instance.model.AtomEntry; //导入方法依赖的package包/类
public static AtomFeed buildBundle(List<Patient> patientList, String fhirBase) {
	DateAndTime now = new DateAndTime(new Date());
	AtomFeed feed = new AtomFeed();
	feed.setTitle("Patient matches");
	feed.setId("urn:uuid:"+CDAUUID.generateUUIDString());
	feed.setTotalResults(patientList.size());
	feed.setUpdated(now);
	feed.setAuthorName("PDS");
	
	List<AtomEntry<? extends Resource>> list = feed.getEntryList();
	for (Patient patient : patientList) {
		String nhsNo = patient.getIdentifier().get(0).getValueSimple();
		AtomEntry entry = new AtomEntry();
		entry.setResource(patient);
		entry.setTitle("PDS Patient match: " + nhsNo);
		entry.setId(fhirBase + "Patient/" + nhsNo);
		// FHIR requires an updated date for the resource - we don't get this back from PDS simple trace...
		// TODO: Establish what we should use for the last updated date
		entry.setUpdated(now);
		// We also don't get an author back from a simple trace...
		// TODO: Establish what we should use for the author
		entry.setPublished(now);
		entry.setAuthorName("PDS");
		list.add(entry);
	}
	
	return feed;
}
 
开发者ID:nhs-ciao,项目名称:ciao-pds-fhir,代码行数:29,代码来源:PatientResultBundle.java

示例2: parseEntry

import org.hl7.fhir.instance.model.AtomEntry; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private <T extends Resource> AtomEntry<T> parseEntry(JsonObject json) throws Exception {
  AtomEntry<T> res = new AtomEntry<T>();
  if (json.has("title") && !json.get("title").isJsonNull())
    res.setTitle(json.get("title").getAsString());
  if (json.has("id") && !json.get("id").isJsonNull())
    res.setId(json.get("id").getAsString());
  if (json.has("updated") && !json.get("updated").isJsonNull())
    res.setUpdated(new DateAndTime(json.get("updated").getAsString()));
  if (json.has("published") && !json.get("published").isJsonNull())
    res.setPublished(new DateAndTime(json.get("published").getAsString()));
  if (json.has("link") && !json.get("link").isJsonNull()) {
    JsonArray array = json.getAsJsonArray("link");
    for (int i = 0; i < array.size(); i++) {
      parseLink(res.getLinks(), array.get(i).getAsJsonObject());
    }
  }
  if (json.has("author") && !json.get("author").isJsonNull()) {
    JsonObject author = json.getAsJsonArray("author").get(0).getAsJsonObject();
    if (author.has("name") && !author.get("name").isJsonNull())
      res.setAuthorName(author.get("name").getAsString());
    if (author.has("uri") && !author.get("uri").isJsonNull())
      res.setAuthorUri(author.get("uri").getAsString());
  }
  if (json.has("category") && !json.get("category").isJsonNull()) {
    for (JsonElement t : json.getAsJsonArray("category")) {
      JsonObject cat = t.getAsJsonObject();
    if (cat.has("term") && cat.has("scheme") && !cat.get("term").isJsonNull() && !cat.get("scheme").isJsonNull())
      res.getTags().add(new AtomCategory(cat.get("scheme").getAsString(), cat.get("term").getAsString(), cat.has("label") ? cat.get("label").getAsString() : null));
    }
  }
  if (json.has("summary") && !json.get("summary").isJsonNull())
    res.setSummary(new XhtmlParser().parse(json.get("summary").getAsString(), "div").getChildNodes().get(0));
  if (json.has("content") && !json.get("content").isJsonNull())
    res.setResource((T)new JsonParser().parse(json.getAsJsonObject("content")));//TODO Architecture needs to be refactor to prevent this unsafe cast and better support generics
  return res;
}
 
开发者ID:cqframework,项目名称:ProfileGenerator,代码行数:38,代码来源:JsonParserBase.java

示例3: parseEntry

import org.hl7.fhir.instance.model.AtomEntry; //导入方法依赖的package包/类
private AtomEntry parseEntry(JSONObject json) throws Exception {
  AtomEntry res = new AtomEntry();
  if (json.has("title"))
    res.setTitle(json.getString("title"));
  if (json.has("id"))
    res.setId(json.getString("id"));
  if (json.has("updated"))
    res.setUpdated(xmlToDate(json.getString("updated")));
  if (json.has("published"))
    res.setPublished(xmlToDate(json.getString("published")));
  if (json.has("links")) {
    JSONArray array = json.getJSONArray("links");
    for (int i = 0; i < array.length(); i++) {
      parseLink(res.getLinks(), array.getJSONObject(i));
    }
  }
  if (json.has("authors")) {
    JSONObject author = json.getJSONArray("authors").getJSONObject(0);
    if (author.has("name"))
      res.setAuthorName(author.getString("name"));
    if (author.has("uri"))
      res.setAuthorUri(author.getString("uri"));
  }
  if (json.has("categories")) {
    JSONObject cat = json.getJSONArray("categories").getJSONObject(0);
    if (cat.has("term") && cat.has("scheme") && cat.getString("scheme").equals("http://hl7.org/fhir/tag"))
      res.getTags().put(cat.getString("term"), cat.has("label") ? cat.getString("label") : null);
  }
  if (json.has("summary"))
    res.setSummary(new XhtmlParser().parse(json.getString("summary"), "div").getChildNodes().get(0));
  if (json.has("content"))
    res.setResource(new JsonParser().parse(json.getJSONObject("content")));
  return res;
}
 
开发者ID:niquola,项目名称:fhir,代码行数:35,代码来源:AtomParser.java

示例4: parseEntry

import org.hl7.fhir.instance.model.AtomEntry; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private <T extends Resource> AtomEntry<T> parseEntry(XmlPullParser xpp) throws Exception {
  AtomEntry<T> res = new AtomEntry<T>();
  
  xpp.next();    
  int eventType = nextNoWhitespace(xpp);
  while (eventType != XmlPullParser.END_TAG) {
    if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) {
      res.setTitle(parseString(xpp));
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("id"))
      res.setId(parseString(xpp));
    else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("link")) {
      res.getLinks().put(xpp.getAttributeValue(null, "rel"), xpp.getAttributeValue(null, "href"));
      skipEmptyElement(xpp);
    } else if(eventType == XmlPullParser.START_TAG && xpp.getName().equals("updated"))
      res.setUpdated(parseDate(xpp));
    else if(eventType == XmlPullParser.START_TAG && xpp.getName().equals("published"))
      res.setPublished(parseDate(xpp));
    else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("category")) {
      res.getTags().add(new AtomCategory(xpp.getAttributeValue(null, "scheme"), xpp.getAttributeValue(null, "term"), xpp.getAttributeValue(null, "label")));
      skipEmptyElement(xpp);
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("author")) {
      xpp.next();
      eventType = nextNoWhitespace(xpp);
      while (eventType != XmlPullParser.END_TAG) {
        if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) {
          res.setAuthorName(parseString(xpp));
        } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uri"))
          res.setAuthorUri(parseString(xpp));
        else
          throw new Exception("Bad Xml parsing entry.author");
        eventType = nextNoWhitespace(xpp);
      }
      xpp.next();
    }
    else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("content")) {
      xpp.next();
      nextNoWhitespace(xpp);
      XmlParser p = new XmlParser();
      p.setAllowUnknownContent(this.isAllowUnknownContent());
      res.setResource((T)p.parse(xpp));//TODO Refactor architecture to eliminate this unsafe cast and better support generics
      xpp.next();
      nextNoWhitespace(xpp);
      if (xpp.getName().equals("content")){
      	xpp.next();
      }
      
    } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("summary")) {
      xpp.next();
      nextNoWhitespace(xpp);
      res.setSummary(new XhtmlParser().parseHtmlNode(xpp));
      xpp.next();
      nextNoWhitespace(xpp);
      if(xpp.getName().equals("summary")) {
      	xpp.next();
      }
    } else
      throw new Exception("Bad Xml parsing entry");
    eventType = nextNoWhitespace(xpp);
  }

  xpp.next();
  return res;  
}
 
开发者ID:cqframework,项目名称:ProfileGenerator,代码行数:65,代码来源:XmlParserBase.java


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