use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method generate.
/**
* This generate is optimised for the build tool in that it tracks the source extension.
* But it can be used for any other use.
*
* @param vs
* @param codeSystems
* @throws DefinitionException
* @throws Exception
*/
public void generate(OperationOutcome op) throws DefinitionException {
XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
boolean hasSource = false;
boolean success = true;
for (OperationOutcomeIssueComponent i : op.getIssue()) {
success = success && i.getSeverity() == IssueSeverity.INFORMATION;
hasSource = hasSource || ExtensionHelper.hasExtension(i, ToolingExtensions.EXT_ISSUE_SOURCE);
}
if (success)
x.addTag("p").addText("All OK");
if (op.getIssue().size() > 0) {
XhtmlNode tbl = x.addTag("table");
// on the basis that we'll most likely be rendered using the standard fhir css, but it doesn't really matter
tbl.setAttribute("class", "grid");
XhtmlNode tr = tbl.addTag("tr");
tr.addTag("td").addTag("b").addText("Severity");
tr.addTag("td").addTag("b").addText("Location");
tr.addTag("td").addTag("b").addText("Code");
tr.addTag("td").addTag("b").addText("Details");
tr.addTag("td").addTag("b").addText("Diagnostics");
if (hasSource)
tr.addTag("td").addTag("b").addText("Source");
for (OperationOutcomeIssueComponent i : op.getIssue()) {
tr = tbl.addTag("tr");
tr.addTag("td").addText(i.getSeverity().toString());
XhtmlNode td = tr.addTag("td");
boolean d = false;
for (StringType s : i.getLocation()) {
if (d)
td.addText(", ");
else
d = true;
td.addText(s.getValue());
}
tr.addTag("td").addText(i.getCode().getDisplay());
tr.addTag("td").addText(gen(i.getDetails()));
smartAddText(tr.addTag("td"), i.getDiagnostics());
if (hasSource) {
Extension ext = ExtensionHelper.getExtension(i, ToolingExtensions.EXT_ISSUE_SOURCE);
tr.addTag("td").addText(ext == null ? "" : gen(ext));
}
}
}
inject(op, x, hasSource ? NarrativeStatus.EXTENSIONS : NarrativeStatus.GENERATED);
}
use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeOrder.
protected void composeOrder(Complex parent, String parentType, String name, Order element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Order", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Order", "identifier", element.getIdentifier().get(i), i);
if (element.hasDateElement())
composeDateTime(t, "Order", "date", element.getDateElement(), -1);
if (element.hasSubject())
composeReference(t, "Order", "subject", element.getSubject(), -1);
if (element.hasSource())
composeReference(t, "Order", "source", element.getSource(), -1);
if (element.hasTarget())
composeReference(t, "Order", "target", element.getTarget(), -1);
if (element.hasReason())
composeType(t, "Order", "reason", element.getReason(), -1);
if (element.hasWhen())
composeOrderOrderWhenComponent(t, "Order", "when", element.getWhen(), -1);
for (int i = 0; i < element.getDetail().size(); i++) composeReference(t, "Order", "detail", element.getDetail().get(i), i);
}
use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeQuestionnaireResponse.
protected void composeQuestionnaireResponse(Complex parent, String parentType, String name, QuestionnaireResponse element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "QuestionnaireResponse", name, element, index);
if (element.hasIdentifier())
composeIdentifier(t, "QuestionnaireResponse", "identifier", element.getIdentifier(), -1);
if (element.hasQuestionnaire())
composeReference(t, "QuestionnaireResponse", "questionnaire", element.getQuestionnaire(), -1);
if (element.hasStatusElement())
composeEnum(t, "QuestionnaireResponse", "status", element.getStatusElement(), -1);
if (element.hasSubject())
composeReference(t, "QuestionnaireResponse", "subject", element.getSubject(), -1);
if (element.hasAuthor())
composeReference(t, "QuestionnaireResponse", "author", element.getAuthor(), -1);
if (element.hasAuthoredElement())
composeDateTime(t, "QuestionnaireResponse", "authored", element.getAuthoredElement(), -1);
if (element.hasSource())
composeReference(t, "QuestionnaireResponse", "source", element.getSource(), -1);
if (element.hasEncounter())
composeReference(t, "QuestionnaireResponse", "encounter", element.getEncounter(), -1);
for (int i = 0; i < element.getItem().size(); i++) composeQuestionnaireResponseQuestionnaireResponseItemComponent(t, "QuestionnaireResponse", "item", element.getItem().get(i), i);
}
use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeConceptMap.
protected void composeConceptMap(Complex parent, String parentType, String name, ConceptMap element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "ConceptMap", name, element, index);
if (element.hasUrlElement())
composeUri(t, "ConceptMap", "url", element.getUrlElement(), -1);
if (element.hasIdentifier())
composeIdentifier(t, "ConceptMap", "identifier", element.getIdentifier(), -1);
if (element.hasVersionElement())
composeString(t, "ConceptMap", "version", element.getVersionElement(), -1);
if (element.hasNameElement())
composeString(t, "ConceptMap", "name", element.getNameElement(), -1);
if (element.hasStatusElement())
composeEnum(t, "ConceptMap", "status", element.getStatusElement(), -1);
if (element.hasExperimentalElement())
composeBoolean(t, "ConceptMap", "experimental", element.getExperimentalElement(), -1);
if (element.hasPublisherElement())
composeString(t, "ConceptMap", "publisher", element.getPublisherElement(), -1);
for (int i = 0; i < element.getContact().size(); i++) composeConceptMapConceptMapContactComponent(t, "ConceptMap", "contact", element.getContact().get(i), i);
if (element.hasDateElement())
composeDateTime(t, "ConceptMap", "date", element.getDateElement(), -1);
if (element.hasDescriptionElement())
composeString(t, "ConceptMap", "description", element.getDescriptionElement(), -1);
for (int i = 0; i < element.getUseContext().size(); i++) composeCodeableConcept(t, "ConceptMap", "useContext", element.getUseContext().get(i), i);
if (element.hasRequirementsElement())
composeString(t, "ConceptMap", "requirements", element.getRequirementsElement(), -1);
if (element.hasCopyrightElement())
composeString(t, "ConceptMap", "copyright", element.getCopyrightElement(), -1);
if (element.hasSource())
composeType(t, "ConceptMap", "source", element.getSource(), -1);
if (element.hasTarget())
composeType(t, "ConceptMap", "target", element.getTarget(), -1);
for (int i = 0; i < element.getElement().size(); i++) composeConceptMapSourceElementComponent(t, "ConceptMap", "element", element.getElement().get(i), i);
}
use of org.hl7.fhir.utilities.validation.ValidationMessage.Source in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeAuditEventAuditEventSourceComponent.
protected void composeAuditEventAuditEventSourceComponent(Complex parent, String parentType, String name, AuditEvent.AuditEventSourceComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "source", name, element, index);
if (element.hasSiteElement())
composeString(t, "AuditEvent", "site", element.getSiteElement(), -1);
if (element.hasIdentifier())
composeIdentifier(t, "AuditEvent", "identifier", element.getIdentifier(), -1);
for (int i = 0; i < element.getType().size(); i++) composeCoding(t, "AuditEvent", "type", element.getType().get(i), i);
}
Aggregations