Further CapabilityStatement improvements

This commit is contained in:
Vassil Peytchev 2021-11-15 15:48:45 -06:00
parent 9c31554101
commit c3c6653f87
1 changed files with 27 additions and 17 deletions

View File

@ -80,31 +80,41 @@ public class CapabilityStatementRenderer extends ResourceRenderer {
if (hasHistory) if (hasHistory)
tr.th().b().attribute("title", "GET changes for all resources of the type (history interaction on type)").tx("History"); tr.th().b().attribute("title", "GET changes for all resources of the type (history interaction on type)").tx("History");
XhtmlNode profCell = null;
boolean hasProf = false;
boolean hasSupProf = false;
for (CapabilityStatementRestResourceComponent r : rest.getResource()) { for (CapabilityStatementRestResourceComponent r : rest.getResource()) {
tr = t.tr(); tr = t.tr();
tr.td().addText(r.getType()); tr.td().addText(r.getType());
if (r.hasProfile() && r.hasSupportedProfile()) {
XhtmlNode profileNode = tr.td().ah(r.getProfile()).addText(r.getProfile()); //Show profiles
for (CanonicalType sp: r.getSupportedProfile()) { profCell = tr.td();
profileNode.br(); hasProf = r.hasProfile();
profileNode.nbsp().nbsp(); hasSupProf = r.hasSupportedProfile();
profileNode.ah(sp.getValue()).addText(sp.getValue()); if ((!hasProf) && (!hasSupProf)) {
} profCell.nbsp();
}
if (r.hasSupportedProfile()) { else if (hasProf) {
profCell.ah(r.getProfile()).addText(r.getProfile());
if (hasSupProf) {
profCell.br();
profCell.addText("Additional supported profiles:");
for (CanonicalType sp: r.getSupportedProfile()) {
profCell.br();
profCell.nbsp().nbsp();
profCell.ah(sp.getValue()).addText(sp.getValue());
}
} }
} }
if (!r.hasProfile() && r.hasSupportedProfile()) { else { //Case of only supported profiles
boolean first = true; profCell.addText("Supported profiles:");
XhtmlNode profileNode = tr.td();
for (CanonicalType sp: r.getSupportedProfile()) { for (CanonicalType sp: r.getSupportedProfile()) {
if (!first) { profCell.br();
profileNode.br(); profCell.nbsp().nbsp();
} profCell.ah(sp.getValue()).addText(sp.getValue());
profileNode.ah(sp.getValue()).addText(sp.getValue());
} }
} }
//Show capabilities
tr.td().addText(showOp(r, TypeRestfulInteraction.READ)); tr.td().addText(showOp(r, TypeRestfulInteraction.READ));
if (hasVRead) if (hasVRead)
tr.td().addText(showOp(r, TypeRestfulInteraction.VREAD)); tr.td().addText(showOp(r, TypeRestfulInteraction.VREAD));