use of org.hl7.fhir.definitions.model.ElementDefn in project kindling by HL7.
the class Publisher method produceCoverageWarnings.
private void produceCoverageWarnings() throws Exception {
for (ElementDefn e : page.getDefinitions().getTypes().values()) produceCoverageWarning("", e);
for (String s : page.getDefinitions().sortedResourceNames()) {
ResourceDefn e = page.getDefinitions().getResourceByName(s);
produceCoverageWarning("", e.getRoot());
}
}
use of org.hl7.fhir.definitions.model.ElementDefn in project kindling by HL7.
the class PageProcessor method genStatusCodes.
private String genStatusCodes() throws Exception {
StringBuilder b = new StringBuilder();
b.append("<table border=\"1\">\r\n");
int colcount = 0;
for (ArrayList<String> row : definitions.getStatusCodes().values()) {
int rc = 0;
for (int i = 0; i < row.size(); i++) if (!Utilities.noString(row.get(i)))
rc = i;
if (rc > colcount)
colcount = rc;
}
// b.append("<tr>");
// b.append("<td>Path</td>");
// for (int i = 0; i < colcount; i++)
// b.append("<td>c").append(Integer.toString(i + 1)).append("</td>");
// b.append("</tr>\r\n");
List<String> names = new ArrayList<String>();
for (String n : definitions.getStatusCodes().keySet()) names.add(n);
Collections.sort(names);
ArrayList<String> row = definitions.getStatusCodes().get("@code");
b.append("<tr>");
b.append("<td><b>code</b></td>");
for (int i = 0; i < colcount; i++) b.append("<td><b><a href=\"codesystem-resource-status.html#resource-status-" + row.get(i) + "\">").append(row.get(i)).append("</a></b></td>");
b.append("</tr>\r\n");
row = definitions.getStatusCodes().get("@codes");
b.append("<tr>");
b.append("<td><b>stated codes</b></td>");
for (int i = 0; i < colcount; i++) b.append("<td>").append(i < row.size() ? row.get(i) : "").append("</td>");
b.append("</tr>\r\n");
b.append("<tr>");
b.append("<td>actual codes</td>");
for (int i = 0; i < colcount; i++) {
Set<String> codeset = new HashSet<String>();
for (String n : names) {
if (!n.startsWith("@")) {
row = definitions.getStatusCodes().get(n);
String c = row.get(i);
if (!Utilities.noString(c)) {
codeset.add(c);
}
}
}
b.append("<td>").append(separated(codeset, ", ")).append("</td>");
}
b.append("</tr>\r\n");
row = definitions.getStatusCodes().get("@issues");
b.append("<tr>");
b.append("<td><b>Issues?</b></td>");
for (int i = 0; i < colcount; i++) {
String s = i < row.size() ? row.get(i) : "";
b.append("<td").append(Utilities.noString(s) ? "" : " style=\"background-color: #ffcccc\"").append(">").append(s).append("</td>");
}
b.append("</tr>\r\n");
for (String n : names) {
if (!n.startsWith("@")) {
b.append("<tr>");
ElementDefn ed = getElementDefn(n);
if (ed == null || !ed.isModifier())
b.append("<td>").append(linkToPath(n)).append("</td>");
else
b.append("<td><b>").append(linkToPath(n)).append("</b></td>");
row = definitions.getStatusCodes().get(n);
for (int i = 0; i < colcount; i++) b.append("<td>").append(i < row.size() ? row.get(i) : "").append("</td>");
b.append("</tr>\r\n");
}
}
b.append("</table>\r\n");
CodeSystem cs = getCodeSystems().get("http://hl7.org/fhir/resource-status");
row = definitions.getStatusCodes().get("@code");
for (int i = 0; i < colcount; i++) {
String code = row.get(i);
String definition = CodeSystemUtilities.getCodeDefinition(cs, code);
Set<String> dset = new HashSet<String>();
for (String n : names) {
if (!n.startsWith("@")) {
ArrayList<String> rowN = definitions.getStatusCodes().get(n);
String c = rowN.get(i);
String d = getDefinition(n, c);
if (!Utilities.noString(d))
dset.add(d);
}
}
b.append("<hr/>\r\n");
b.append("<h4>").append(code).append("</h4>\r\n");
b.append("<p>").append(Utilities.escapeXml(definition)).append("</p>\r\n");
b.append("<p>Definitions for matching codes:</p>\r\n");
b.append("<ul>\r\n");
for (String s : sorted(dset)) b.append("<li>").append(Utilities.escapeXml(s)).append("</li>\r\n");
b.append("</ul>\r\n");
}
return b.toString();
}
use of org.hl7.fhir.definitions.model.ElementDefn in project kindling by HL7.
the class PageProcessor method genResRefList.
private String genResRefList(String n) throws Exception {
ResourceDefn e = definitions.getResourceByName(n);
StringBuilder b = new StringBuilder();
b.append("<ul>\r\n");
for (ElementDefn c : e.getRoot().getElements()) genResRefItem(b, n.toLowerCase(), n, c);
b.append("</ul>\r\n");
return b.toString();
}
use of org.hl7.fhir.definitions.model.ElementDefn in project kindling by HL7.
the class PageProcessor method listAllbackboneClasses.
private void listAllbackboneClasses(List<String> classes, ElementDefn e, String path) {
for (ElementDefn c : e.getElements()) {
if (c.getElements().size() > 0) {
String p = path + "." + c.getName();
String n = Utilities.capitalize(c.getName());
if (c.hasStatedType())
n = c.getStatedType();
classes.add(p + ":" + n);
listAllbackboneClasses(classes, c, p);
}
}
}
use of org.hl7.fhir.definitions.model.ElementDefn in project kindling by HL7.
the class PageProcessor method getElementDefn.
private ElementDefn getElementDefn(String n) throws Exception {
String[] path = n.split("\\.");
ElementDefn ed = definitions.getElementDefn(path[0]);
for (int i = 1; i < path.length; i++) {
if (ed == null)
return null;
ed = ed.getElementByName(definitions, path[i], true, false);
}
return ed;
}
Aggregations