use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method getExampleByRef.
private Example getExampleByRef(String bundle) throws Exception {
String[] parts = bundle.split("\\/");
ResourceDefn r = definitions.getResourceByName(parts[0]);
for (Example e : r.getExamples()) {
if (e.getId().equals(parts[1]))
return e;
}
throw new Exception("unable to resolve " + bundle);
}
use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method jsonToXhtml.
public void jsonToXhtml(String src, String dst, String name, String description, int level, String json, String pageType, String crumbTitle, ImplementationGuideDefn ig, ResourceDefn rd, WorkGroup wg) throws Exception {
String n = new File(dst).getName();
n = n.substring(0, n.length() - 10);
json = "<div class=\"example\">\r\n<p>" + Utilities.escapeXml(description) + "</p>\r\n<pre class=\"json\">\r\n" + Utilities.escapeXml(json) + "\r\n</pre>\r\n</div>\r\n";
String html = ("<%setlevel " + Integer.toString(level) + "%>" + TextFile.fileToString(folders.srcDir + "template-example-json.html")).replace("<%example%>", json);
html = processPageIncludes(n + ".json.html", html, pageType, null, null, null, crumbTitle, ig, rd, wg);
TextFile.stringToFile(html, dst);
htmlchecker.registerExternal(dst);
}
use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method genDataTypeUsage.
private String genDataTypeUsage(String tn) {
StringBuilder b = new StringBuilder();
for (ElementDefn e : definitions.getTypes().values()) {
if (usesType(e, tn)) {
b.append(", <a href=\"").append(definitions.getSrcFile(e.getName()) + ".html#" + e.getName()).append("\">").append(e.getName()).append("</a>");
}
}
List<String> resources = new ArrayList<String>();
for (ResourceDefn e : definitions.getResources().values()) {
if (usesType(e.getRoot(), tn)) {
resources.add(e.getName());
}
}
for (ResourceDefn e : definitions.getBaseResources().values()) {
if (usesType(e.getRoot(), tn)) {
resources.add(e.getName());
}
}
Collections.sort(resources);
for (String n : resources) b.append(", <a href=\"").append(definitions.getSrcFile(n) + ".html#" + n.toLowerCase()).append("\">").append(n).append("</a>");
if (b.toString().length() < 2)
return "(not used as yet)";
String s = b.toString().substring(2);
int i = s.lastIndexOf(", ");
if (i > 1)
s = s.substring(0, i) + " and" + s.substring(i + 1);
return s;
}
use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method buildResListByMaturity.
private String buildResListByMaturity() throws FHIRException {
List<String> res = new ArrayList<String>();
for (ResourceDefn rd : definitions.getBaseResources().values()) res.add(rd.getFmmLevel() + ":" + rd.getName());
for (ResourceDefn rd : definitions.getResources().values()) res.add(rd.getFmmLevel() + ":" + rd.getName());
Collections.sort(res);
StringBuilder b = new StringBuilder();
for (int i = 5; i >= 0; i--) {
b.append("<p><b>Level ");
b.append(i);
b.append("</b></p>\r\n<ul style=\"width: 90%; -moz-column-count: 4; -moz-column-gap: 10px; -webkit-column-count: 4; -webkit-column-gap: 10px; column-count: 4; column-gap: 10px\">\r\n");
for (String rn : res) {
if (rn.startsWith(Integer.toString(i))) {
String r = rn.substring(2);
ResourceDefn rd = definitions.getResourceByName(r);
if (rd.getNormativePackage() != null || rd.getNormativeVersion() != null)
b.append(" <li><a title=\"[%resdesc " + r + "%]\" href=\"" + r.toLowerCase() + ".html\">" + r + "</a> <a href=\"versions.html#std-process\" title=\"Normative Content\" class=\"normative-flag\">N</a></li>\r\n");
else
b.append(" <li><a title=\"[%resdesc " + r + "%]\" href=\"" + r.toLowerCase() + ".html\">" + r + "</a></li>\r\n");
}
}
b.append("</ul>\r\n");
}
return b.toString();
}
use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method buildCircularReferenceList.
private void buildCircularReferenceList(StringBuilder b, String s, ElementDefn t, ResourceDefn rd, Boolean hierarchy) {
if (t.getHierarchy() == hierarchy)
for (TypeRef tr : t.getTypes()) {
if (tr.getName().equals("Reference") || tr.getName().equals("canonical"))
for (String p : tr.getParams()) {
if (s.equals(p)) {
b.append("<li><a href=\"" + s.toLowerCase() + "-definitions.html#" + t.getPath() + "\">");
b.append(t.getPath());
b.append("</a>");
boolean first = true;
for (String spn : sorted(rd.getSearchParams().keySet())) {
SearchParameterDefn sp = rd.getSearchParams().get(spn);
if (pointsAtElement(sp, t)) {
if (first) {
b.append(" (");
first = false;
} else
b.append(",");
b.append(sp.getCode());
}
}
if (!first)
b.append(")");
b.append("</li>");
}
}
}
for (ElementDefn e : t.getElements()) buildCircularReferenceList(b, s, e, rd, hierarchy);
}
Aggregations