5555import org .hl7 .fhir .r5 .extensions .ExtensionUtilities ;
5656import org .hl7 .fhir .r5 .fhirpath .FHIRPathEngine ;
5757import org .hl7 .fhir .r5 .formats .XmlParser ;
58- import org .hl7 .fhir .r5 .model .Bundle ;
58+ import org .hl7 .fhir .r5 .model .* ;
5959import org .hl7 .fhir .r5 .model .Bundle .BundleEntryComponent ;
60- import org .hl7 .fhir .r5 .model .CodeSystem ;
61- import org .hl7 .fhir .r5 .model .Constants ;
62- import org .hl7 .fhir .r5 .model .OperationOutcome ;
63- import org .hl7 .fhir .r5 .model .PackageInformation ;
6460import org .hl7 .fhir .r5 .model .Parameters .ParametersParameterComponent ;
65- import org .hl7 .fhir .r5 .model .StructureDefinition ;
66- import org .hl7 .fhir .r5 .model .ValueSet ;
6761import org .hl7 .fhir .r5 .terminologies .client .TerminologyClientContext ;
6862import org .hl7 .fhir .r5 .terminologies .client .TerminologyClientContext .TerminologyClientContextUseCount ;
6963import org .hl7 .fhir .r5 .terminologies .client .TerminologyClientManager ;
@@ -875,7 +869,7 @@ public List<FetchedFile> genQAHtml(String title, List<FetchedFile> files, String
875869 b .append (genStartInternal ());
876870 int id = 0 ;
877871 for (ValidationMessage vm : linkErrors ) {
878- b .append (genDetails (vm , id ));
872+ b .append (genDetails (vm , id , false ));
879873 id ++;
880874 }
881875 b .append (genEnd ());
@@ -890,7 +884,7 @@ public List<FetchedFile> genQAHtml(String title, List<FetchedFile> files, String
890884 else
891885 b .append (startTemplateNoErrors );
892886 for (ValidationMessage vm : filterMessages (f , f .getErrors (), false , filteredMessages )) {
893- b .append (genDetails (vm , id ));
887+ b .append (genDetails (vm , id , true ));
894888 id ++;
895889 }
896890 b .append (genEnd ());
@@ -1175,7 +1169,7 @@ public static List<ValidationMessage> filterMessages(FetchedFile f, List<Validat
11751169
11761170 private final String startTemplateErrors =
11771171 " <tr>\r \n " +
1178- " <td><b>Path</b></td><td><b>Severity</b></td><td><b>Message</b></td>\r \n " +
1172+ " <td><b>Path</b></td><td><b>Severity</b></td><td><b>Message</b></td><td><b>Validating</b></td> \r \n " +
11791173 " </tr>\r \n " ;
11801174
11811175 private final String startTemplateNoErrors =
@@ -1185,43 +1179,43 @@ public static List<ValidationMessage> filterMessages(FetchedFile f, List<Validat
11851179
11861180 private final String detailsTemplate =
11871181 " <tr style=\" background-color: $color$\" >\r \n " +
1188- " <td><b>$path$</b></td><td><b>$level$</b></td><td><b>$msg$</b>$comment$ <span class=\" code-value code-hidden\" style=\" font-size: 8px; color: navy\" >$mid$</span></td>\r \n " +
1182+ " <td><b>$path$</b></td><td><b>$level$</b></td><td><b>$msg$</b>$comment$ <span class=\" code-value code-hidden\" style=\" font-size: 8px; color: navy\" >$mid$</span></td>$ctxt$ \r \n " +
11891183 " </tr>\r \n " ;
11901184
11911185 private final String groupDetailsTemplate =
11921186 " <tr style=\" background-color: $halfcolor$\" >\r \n " +
1193- " <td><a href=\" $xlink$\" >$fpath$</a></td><td><b>$msg$</b>$comment$</td>\r \n " +
1187+ " <td><a href=\" $xlink$\" >$fpath$</a></td><td><b>$msg$</b>$comment$</td>$ctxt$ \r \n " +
11941188 " </tr>\r \n " ;
11951189
11961190
11971191 private final String detailsTemplateTxLink =
11981192 " <tr style=\" background-color: $color$\" >\r \n " +
1199- " <td><b>$path$</b></td><td><b>$level$</b></td><td><b>$msg$</b>$comment$ (from <a href=\" qa-txservers.html#$txsrvr$\" >$txsrvr$</a>, see <a href=\" $tx$\" >log</a>) <span class=\" code-value code-hidden\" style=\" font-size: 8px; color: navy\" >$mid$</span></td>\r \n " +
1193+ " <td><b>$path$</b></td><td><b>$level$</b></td><td><b>$msg$</b>$comment$ (from <a href=\" qa-txservers.html#$txsrvr$\" >$txsrvr$</a>, see <a href=\" $tx$\" >log</a>) <span class=\" code-value code-hidden\" style=\" font-size: 8px; color: navy\" >$mid$</span></td>$ctxt$ \r \n " +
12001194 " </tr>\r \n " ;
12011195
12021196 private final String detailsTemplateTxLinkDiagnostics =
12031197 " <tr style=\" background-color: $color$\" >\r \n " +
1204- " <td><b>$path$</b></td><td><b>$level$</b></td><td><b>$msg$</b>$comment$ (from <a href=\" qa-txservers.html#$txsrvr$\" >$txsrvr$</a>, see <a href=\" $tx$\" >log</a>, or see <a href=\" #$vmid$\" onClick=\" document.getElementById('$vmid$').style.display='block'\" >the servers logic</a>) <span class=\" code-value code-hidden\" style=\" font-size: 8px; color: navy\" >$mid$</span><div id=\" $vmid$\" style=\" display:none\" ><br/><pre>$diags$</pre></div></td>\r \n " +
1198+ " <td><b>$path$</b></td><td><b>$level$</b></td><td><b>$msg$</b>$comment$ (from <a href=\" qa-txservers.html#$txsrvr$\" >$txsrvr$</a>, see <a href=\" $tx$\" >log</a>, or see <a href=\" #$vmid$\" onClick=\" document.getElementById('$vmid$').style.display='block'\" >the servers logic</a>) <span class=\" code-value code-hidden\" style=\" font-size: 8px; color: navy\" >$mid$</span><div id=\" $vmid$\" style=\" display:none\" ><br/><pre>$diags$</pre></div></td>$ctxt$ \r \n " +
12051199 " </tr>\r \n " ;
12061200
12071201 private final String detailsTemplateTxNoLink =
12081202 " <tr style=\" background-color: $color$\" >\r \n " +
1209- " <td><b>$path$</b></td><td><b>$level$</b></td><td><b>$msg$</b>$comment$ (from <a href=\" qa-txservers.html#$txsrvr$\" >$txsrvr$</a>) <span class=\" code-value code-hidden\" style=\" font-size: 8px; color: navy\" >$mid$</span></td>\r \n " +
1203+ " <td><b>$path$</b></td><td><b>$level$</b></td><td><b>$msg$</b>$comment$ (from <a href=\" qa-txservers.html#$txsrvr$\" >$txsrvr$</a>) <span class=\" code-value code-hidden\" style=\" font-size: 8px; color: navy\" >$mid$</span></td>$ctxt$ \r \n " +
12101204 " </tr>\r \n " ;
12111205
12121206 private final String detailsTemplateTxNoLinkDiagnostics =
12131207 " <tr style=\" background-color: $color$\" >\r \n " +
1214- " <td><b>$path$</b></td><td><b>$level$</b></td><td><b>$msg$</b>$comment$ (from <a href=\" qa-txservers.html#$txsrvr$\" >$txsrvr$</a> - see <a href=\" #$vmid$\" onClick=\" document.getElementById('$vmid$').style.display='block'\" >the servers logic</a>) <span class=\" code-value code-hidden\" style=\" font-size: 8px; color: navy\" >$mid$</span><div id=\" $vmid$\" style=\" display:none\" ><br/><pre>$diags$</pre></div></td>\r \n " +
1208+ " <td><b>$path$</b></td><td><b>$level$</b></td><td><b>$msg$</b>$comment$ (from <a href=\" qa-txservers.html#$txsrvr$\" >$txsrvr$</a> - see <a href=\" #$vmid$\" onClick=\" document.getElementById('$vmid$').style.display='block'\" >the servers logic</a>) <span class=\" code-value code-hidden\" style=\" font-size: 8px; color: navy\" >$mid$</span><div id=\" $vmid$\" style=\" display:none\" ><br/><pre>$diags$</pre></div></td>$ctxt$ \r \n " +
12151209 " </tr>\r \n " ;
12161210
12171211 private final String detailsTemplateWithExtraDetails =
12181212 " <tr style=\" background-color: $color$\" >\r \n " +
1219- " <td><b><a href=\" $pathlink$\" >$path$</a></b></td><td><b>$level$</b></td><td><b>$msg$</b>$comment$ <span id=\" s$id$\" class=\" flip\" onclick=\" flip('$id$')\" >Show Reasoning</span><div id=\" $id$\" style=\" display: none\" ><p> </p>$msgdetails$</div> <span class=\" code-value code-hidden\" style=\" font-size: 8px; color: navy\" >$mid$</span></td>\r \n " +
1213+ " <td><b><a href=\" $pathlink$\" >$path$</a></b></td><td><b>$level$</b></td><td><b>$msg$</b>$comment$ <span id=\" s$id$\" class=\" flip\" onclick=\" flip('$id$')\" >Show Reasoning</span><div id=\" $id$\" style=\" display: none\" ><p> </p>$msgdetails$</div> <span class=\" code-value code-hidden\" style=\" font-size: 8px; color: navy\" >$mid$</span></td>$ctxt$ \r \n " +
12201214 " </tr>\r \n " ;
12211215
12221216 private final String detailsTemplateWithLink =
12231217 " <tr style=\" background-color: $color$\" >\r \n " +
1224- " <td><b><a href=\" $pathlink$\" >$path$</a></b></td><td><b>$level$</b></td><td><b>$msg$</b>$comment$ <span class=\" code-value code-hidden\" style=\" font-size: 8px; color: navy\" >$mid$</span></td>\r \n " +
1218+ " <td><b><a href=\" $pathlink$\" >$path$</a></b></td><td><b>$level$</b></td><td><b>$msg$</b>$comment$ <span class=\" code-value code-hidden\" style=\" font-size: 8px; color: navy\" >$mid$</span></td>$ctxt$ \r \n " +
12251219 " </tr>\r \n " ;
12261220
12271221 private final String footerTemplate =
@@ -1722,7 +1716,7 @@ private String genStartTxt(FetchedFile f) {
17221716 return t .render ();
17231717 }
17241718
1725- private String genDetails (ValidationMessage vm , int id ) {
1719+ private String genDetails (ValidationMessage vm , int id , boolean showContext ) {
17261720 String tid = null ;
17271721 if (vm .isSlicingHint () || vm .hasSliceInfo ()) {
17281722 tid = detailsTemplateWithExtraDetails ;
@@ -1771,9 +1765,27 @@ private String genDetails(ValidationMessage vm, int id) {
17711765 t .add ("comment" , vm .getComment () == null ? "" : "<br/><br/><span style=\" display: block; border: 1px grey solid; border-radius: 5px; background-color: #eeeeee; padding: 3px; margin: 3px \" ><i><b>Editor's Comment</b>: " +Utilities .escapeXml (vm .getComment ())+"</i></span>" );
17721766 t .add ("tx" , "qa-tx.html#l" +vm .getTxLink ());
17731767 t .add ("txsrvr" , getServer (vm .getServer ()));
1768+ if (showContext ) {
1769+ t .add ("ctxt" , presentContext (vm .getValidationContext ()));
1770+ }
17741771 return t .render ();
17751772 }
17761773
1774+ private String presentContext (String validationContext ) {
1775+ if (validationContext == null ) {
1776+ return "<td>--</td>" ;
1777+ }
1778+ CanonicalResource res = (CanonicalResource ) context .fetchResource (Resource .class , validationContext );
1779+ if (res == null ) {
1780+ return Utilities .escapeXml (validationContext );
1781+ }
1782+ if (validationContext .startsWith ("http://hl7.org/fhir/StructureDefinition/" )) {
1783+ return "<td><a href=\" " +res .getWebPath ()+"\" >" +Utilities .escapeXml (res .present ())+"</a></td>" ;
1784+ } else {
1785+ return "<td><a href=\" " +res .getWebPath ()+"\" >" +Utilities .escapeXml (res .present ())+"</a></td>" ;
1786+ }
1787+ }
1788+
17771789 private Object genSliceInfo (List <ValidationMessage > sliceInfo ) {
17781790 StringBuilder b = new StringBuilder ();
17791791 b .append ("<table class=\" grid\" >" );
@@ -1868,6 +1880,7 @@ private Object genGroupDetails(FetchedFile f, ValidationMessage vm) {
18681880 t .add ("msg" , vm .getHtml ());
18691881 t .add ("msgdetails" , vm .isSlicingHint () ? vm .getSliceHtml () : vm .getHtml ());
18701882 t .add ("comment" , "" );
1883+ t .add ("ctxt" , presentContext (vm .getValidationContext ()));
18711884 return t .render ();
18721885 }
18731886
0 commit comments