use of org.hl7.fhir.dstu3.model.DomainResource in project org.hl7.fhir.core by hapifhir.
the class NarrativeGeneratorTests method process.
private void process(InputStream stream) throws FileNotFoundException, IOException, XmlPullParserException, EOperationOutcome, FHIRException {
XmlParser p = new XmlParser();
DomainResource r = (DomainResource) p.parse(stream);
RendererFactory.factory(r, rc).render(r);
FileOutputStream s = new FileOutputStream(TestingUtilities.tempFile("gen", "gen.xml"));
new XmlParser().compose(s, r, true);
s.close();
}
use of org.hl7.fhir.dstu3.model.DomainResource in project org.hl7.fhir.core by hapifhir.
the class ResourceRoundTripTests method test.
@Test
public void test() throws IOException, FHIRException, EOperationOutcome {
DomainResource res = (DomainResource) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "unicode.xml"));
RenderingContext rc = new RenderingContext(TestingUtilities.getSharedWorkerContext(), null, null, "http://hl7.org/fhir", "", null, ResourceRendererMode.END_USER);
RendererFactory.factory(res, rc).render(res);
IOUtils.copy(TestingUtilities.loadTestResourceStream("r5", "unicode.xml"), new FileOutputStream(TestingUtilities.tempFile("gen", "unicode.xml")));
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(TestingUtilities.tempFile("gen", "unicode.out.xml")), res);
}
use of org.hl7.fhir.dstu3.model.DomainResource in project org.hl7.fhir.core by hapifhir.
the class ArgonautConverter method buildNarrative.
private void buildNarrative(DomainResource resource, Element child) {
if (!Utilities.noString(child.getTextContent())) {
XhtmlNode div = new XhtmlNode(NodeType.Element, "div");
String s = child.getTextContent().trim();
if (Utilities.noString(s))
div.addText("No Narrative provided in the source CDA document");
else
div.addText(s);
resource.setText(new Narrative().setStatus(NarrativeStatus.ADDITIONAL).setDiv(div));
}
}
use of org.hl7.fhir.dstu3.model.DomainResource in project org.hl7.fhir.core by hapifhir.
the class CCDAConverter method addItemToList.
protected ListEntryComponent addItemToList(ListResource list, DomainResource ai) throws Exception {
list.getContained().add(ai);
String n = nextRef();
ai.setId(n);
ListEntryComponent item = new ListResource.ListEntryComponent();
list.getEntry().add(item);
item.setItem(Factory.makeReference("#" + n));
return item;
}
use of org.hl7.fhir.dstu3.model.DomainResource in project org.hl7.fhir.core by hapifhir.
the class DomainResource method copyValues.
public void copyValues(DomainResource dst) {
super.copyValues(dst);
dst.text = text == null ? null : text.copy();
if (contained != null) {
dst.contained = new ArrayList<Resource>();
for (Resource i : contained) dst.contained.add(i.copy());
}
;
if (extension != null) {
dst.extension = new ArrayList<Extension>();
for (Extension i : extension) dst.extension.add(i.copy());
}
;
if (modifierExtension != null) {
dst.modifierExtension = new ArrayList<Extension>();
for (Extension i : modifierExtension) dst.modifierExtension.add(i.copy());
}
;
}
Aggregations