use of org.hl7.fhir.r5.utils.EOperationOutcome in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method generate.
public boolean generate(ResourceContext rcontext, ImplementationGuide ig) throws EOperationOutcome, FHIRException, IOException {
XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
x.h2().addText(ig.getName());
x.para().tx("The official URL for this implementation guide is: ");
x.pre().tx(ig.getUrl());
addMarkdown(x, ig.getDescription());
inject(ig, x, NarrativeStatus.GENERATED);
return true;
}
use of org.hl7.fhir.r5.utils.EOperationOutcome in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method generate.
public boolean generate(Bundle b, boolean evenIfAlreadyHasNarrative) throws EOperationOutcome, FHIRException, IOException {
boolean res = false;
this.bundle = b;
for (BundleEntryComponent be : b.getEntry()) {
if (be.hasResource() && be.getResource() instanceof DomainResource) {
DomainResource dr = (DomainResource) be.getResource();
if (evenIfAlreadyHasNarrative || !dr.getText().hasDiv())
res = generate(new ResourceContext(b, dr), dr) || res;
}
}
return res;
}
use of org.hl7.fhir.r5.utils.EOperationOutcome in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method generate.
public boolean generate(ResourceContext rcontext, ImplementationGuide ig) throws EOperationOutcome, FHIRException, IOException {
XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
x.h2().addText(ig.getName());
x.para().tx("The official URL for this implementation guide is: ");
x.pre().tx(ig.getUrl());
addMarkdown(x, ig.getDescription());
inject(ig, x, NarrativeStatus.GENERATED);
return true;
}
use of org.hl7.fhir.r5.utils.EOperationOutcome in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method genOpParam.
private void genOpParam(ResourceContext rcontext, XhtmlNode tbl, String path, OperationDefinitionParameterComponent p) throws EOperationOutcome, FHIRException, IOException {
XhtmlNode tr;
tr = tbl.tr();
tr.td().addText(p.getUse().toString());
tr.td().addText(path + p.getName());
tr.td().addText(Integer.toString(p.getMin()) + ".." + p.getMax());
XhtmlNode td = tr.td();
StructureDefinition sd = context.fetchTypeDefinition(p.getType());
if (sd == null)
td.tx(p.hasType() ? p.getType() : "");
else if (sd.getAbstract() && p.hasExtension(ToolingExtensions.EXT_ALLOWED_TYPE)) {
boolean first = true;
for (Extension ex : p.getExtensionsByUrl(ToolingExtensions.EXT_ALLOWED_TYPE)) {
if (first)
first = false;
else
td.tx(" | ");
String s = ex.getValue().primitiveValue();
StructureDefinition sdt = context.fetchTypeDefinition(s);
if (sdt == null)
td.tx(p.hasType() ? p.getType() : "");
else
td.ah(sdt.getUserString("path")).tx(s);
}
} else
td.ah(sd.getUserString("path")).tx(p.hasType() ? p.getType() : "");
if (p.hasSearchType()) {
td.br();
td.tx("(");
td.ah(corePath == null ? "search.html#" + p.getSearchType().toCode() : Utilities.pathURL(corePath, "search.html#" + p.getSearchType().toCode())).tx(p.getSearchType().toCode());
td.tx(")");
}
td = tr.td();
if (p.hasBinding() && p.getBinding().hasValueSet()) {
AddVsRef(rcontext, p.getBinding().getValueSet(), td);
td.tx(" (" + p.getBinding().getStrength().getDisplay() + ")");
}
addMarkdown(tr.td(), p.getDocumentation());
if (!p.hasType()) {
for (OperationDefinitionParameterComponent pp : p.getPart()) {
genOpParam(rcontext, tbl, path + p.getName() + ".", pp);
}
}
}
use of org.hl7.fhir.r5.utils.EOperationOutcome in project org.hl7.fhir.core by hapifhir.
the class ProfileUtilitiesTests method testMapping.
/**
* check that mapping resolution is working
*
* @param context2
* @
* @throws EOperationOutcome
*/
private void testMapping() throws EOperationOutcome, Exception {
StructureDefinition focus = new StructureDefinition();
StructureDefinition base = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/Patient").copy();
focus.setUrl(Utilities.makeUuidUrn());
focus.setBase(base.getUrl());
ElementDefinition id = focus.getDifferential().addElement();
id.setPath("Patient.identifier");
id.addMapping().setIdentity("rim").setMap("test");
List<ValidationMessage> messages = new ArrayList<ValidationMessage>();
new ProfileUtilities(context, messages, null).generateSnapshot(base, focus, focus.getUrl(), "Simple Test");
boolean ok = base.getSnapshot().getElement().size() == focus.getSnapshot().getElement().size();
for (int i = 0; i < base.getSnapshot().getElement().size(); i++) {
if (ok) {
ElementDefinition b = base.getSnapshot().getElement().get(i);
ElementDefinition f = focus.getSnapshot().getElement().get(i);
if (!f.hasBase() || !b.getPath().equals(f.getBase().getPath()))
ok = false;
else {
f.setBase(null);
if (f.getPath().equals("Patient.identifier")) {
ok = f.getMapping().size() > b.getMapping().size();
if (ok) {
f.getMapping().clear();
b.getMapping().clear();
}
}
ok = ok && Base.compareDeep(b, f, true);
}
}
}
if (!ok) {
compareXml(base, focus);
throw new FHIRException("Snap shot generation mapping changes failed");
} else
System.out.println("Snap shot generation mapping changes test passed");
}
Aggregations