本文整理匯總了Java中org.hl7.fhir.instance.model.Narrative類的典型用法代碼示例。如果您正苦於以下問題:Java Narrative類的具體用法?Java Narrative怎麽用?Java Narrative使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Narrative類屬於org.hl7.fhir.instance.model包,在下文中一共展示了Narrative類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: makeNarrative
import org.hl7.fhir.instance.model.Narrative; //導入依賴的package包/類
/**
*
* @param resource
* @return a Narrative object in the FHIR reference implementation
*/
public Narrative makeNarrative(EObject resource, String resourceName) throws MapperException
{
// read a template DOM and fill in its values from the resource
Element tableEl = makeNarrativeDom(resource, resourceName);
if (tableEl != null)
{
// make a generated Narrative
Narrative narrative = new Narrative();
narrative.setStatusSimple(NarrativeStatus.generated);
// convert the filled template DOM to Xhtml, as in the reference implementation, and add it to the Narrative
XhtmlNode node = makeXhtmlNode(tableEl);
narrative.setDiv(node);
return narrative;
}
return null;
}
示例2: makeFeedWithNarratives
import org.hl7.fhir.instance.model.Narrative; //導入依賴的package包/類
/**
*
* @param result
* @param manager
* @return
* @throws MapperException
*/
private AtomFeed makeFeedWithNarratives(EObject result, FHIRSearchManager manager) throws MapperException
{
// convert the result into an instance of the FHIR reference model
EPackage classModel = getMappedStructure(serverName, resourceName).getClassModelRoot();
EcoreReferenceBridge bridge = new EcoreReferenceBridge(classModel);
AtomFeed feed = bridge.getReferenceModelFeed(result);
feed.setTitle(serverName);
// set the narratives of all the resources in the feed
for (Iterator<AtomEntry<?>> it = feed.getEntryList().iterator();it.hasNext();)
{
AtomEntry<?> entry = it.next();
Resource resource = entry.getResource();
Narrative narrative = manager.getNarrative(entry.getId());
if (narrative != null) resource.setText(narrative);
}
return feed;
}
示例3: testNamespaces
import org.hl7.fhir.instance.model.Narrative; //導入依賴的package包/類
@Test
@Ignore
public void testNamespaces() {
Narrative type = new Narrative();
XhtmlNode div = type.getDiv();
div.setValue("<xhtml:div xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">hello</xhtml:div>");
assertEquals("<xhtml:div xmlns:xhtml=\"http://www.w3.org/1999/xhtml\">hello</xhtml:div>", div.getValue());
}
示例4: testPatientCopy
import org.hl7.fhir.instance.model.Narrative; //導入依賴的package包/類
/**
* Ensuring that fields defined in {@link org.hl7.fhir.instance.model.DomainResource} and {@link org.hl7.fhir.instance.model.Resource}
* the {@link org.hl7.fhir.instance.model.DomainResource#copy()} method is called
*/
@Test
public void testPatientCopy() {
Patient p1 = new Patient();
p1.setId("1001");
p1.setText(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL));
Patient copiedPatient = p1.copy();
String copiedPatientID = copiedPatient.getIdElement().getIdPart();
Narrative.NarrativeStatus copiedPatientTextStatus = copiedPatient.getText().getStatus();
assertTrue(copiedPatient instanceof DomainResource); // Just making sure this assumption still holds up, otherwise this test isn't very useful
assertEquals("1001", copiedPatientID);
assertEquals(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL).getStatus(), copiedPatientTextStatus);
}
示例5: getResourceBundle
import org.hl7.fhir.instance.model.Narrative; //導入依賴的package包/類
/**
*
* @param query
* @return
* @throws MapperException
*/
@SuppressWarnings("unchecked")
public EObject getResourceBundle(String resourceName, Hashtable<String,String> ids) throws MapperException
{
Vector<EObject> resources = new Vector<EObject>();
allNarratives = new Hashtable<String,Narrative>() ;
for (Enumeration<String> en = ids.keys();en.hasMoreElements();)
{
String fhir_id = en.nextElement();
EObject resourceObject = getResource(resourceName,fhir_id);
if (resourceObject == null) message("Failed to retrieve resource with id " + fhir_id);
else
{
resources.add(resourceObject);
Narrative nar = makeNarrative(resourceObject,resourceName);
if (nar != null) allNarratives.put(fhir_id, nar);
else message("no narrative for resource " + resourceName);
}
}
// create the top AtomFeed EObject, and add the resources to it
MDLXOReader reader = servlet.getReader(serverName, resourceName);
EObject feedObject = ModelUtil.createModelObject("feed.AtomFeed", reader.classModel());
EClass feedClass = ModelUtil.getNamedClass(reader.classModel(), "feed.AtomFeed");
EStructuralFeature resourceFeature = feedClass.getEStructuralFeature(GenUtil.initialLowerCase(resourceName));
if (resourceFeature == null) throw new MapperException("Cannot find resource feature of AtomFeed object");
Object featureVal = feedObject.eGet(resourceFeature);
if (featureVal instanceof EList<?>)
for (int i = 0; i < resources.size();i++) ((EList<EObject>)featureVal).add(resources.get(i));
else throw new MapperException("resource feature is not a list");
return feedObject;
}
示例6: sendResource
import org.hl7.fhir.instance.model.Narrative; //導入依賴的package包/類
/**
*
* @param resource
* @param response
* @throws Exception
*/
private void sendResource(EObject resource,HttpServletResponse response, FHIRSearchManager manager, String id) throws Exception
{
if (resource != null)
{
EPackage classModel = getMappedStructure(serverName, resourceName).getClassModelRoot();
EcoreReferenceBridge bridge = new EcoreReferenceBridge(classModel);
Resource refModelResource = bridge.makeReferenceModelResource(resource);
Narrative narrative = manager.makeNarrative(resource,resourceName);
if (narrative != null) refModelResource.setText(narrative);
sendResourceResponse(response, refModelResource);
}
else sendErrorResponse(response, ("Found no " + resourceName + " resource with id " + id), statusCode);
}
示例7: testNarrative
import org.hl7.fhir.instance.model.Narrative; //導入依賴的package包/類
@Test
public void testNarrative() {
assertTrue(INarrative.class.isAssignableFrom(Narrative.class));
}
示例8: getNarrative
import org.hl7.fhir.instance.model.Narrative; //導入依賴的package包/類
public Narrative getNarrative(String fhir_id) {return allNarratives.get(fhir_id);}