use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method generateSideBar.
private String generateSideBar(String prefix) throws Exception {
if (prevSidebars.containsKey(prefix))
return prevSidebars.get(prefix);
List<String> links = new ArrayList<String>();
StringBuilder s = new StringBuilder();
s.append("<div class=\"sidebar\">\r\n");
s.append("<p><a href=\"http://hl7.org/fhir\" title=\"Fast Healthcare Interoperability Resources - Home Page\"><img border=\"0\" src=\"" + prefix + "flame16.png\" style=\"vertical-align: text-bottom\"/></a> " + "<a href=\"http://hl7.org/fhir\" title=\"Fast Healthcare Interoperability Resources - Home Page\"><b>FHIR</b></a>® v" + getVersion() + " © <a href=\"http://hl7.org\">HL7</a></p>\r\n");
for (Navigation.Category c : navigation.getCategories()) {
if (!"nosidebar".equals(c.getMode())) {
if (c.getLink() != null) {
s.append(" <h2><a href=\"" + prefix + c.getLink() + ".html\">" + c.getName() + "</a></h2>\r\n");
links.add(c.getLink());
} else
s.append(" <h2>" + c.getName() + "</h2>\r\n");
s.append(" <ul>\r\n");
for (Navigation.Entry e : c.getEntries()) {
if (e.getLink() != null) {
links.add(e.getLink());
s.append(" <li><a href=\"" + prefix + e.getLink() + ".html\">" + Utilities.escapeXml(e.getName()) + "</a></li>\r\n");
} else
s.append(" <li>" + e.getName() + "</li>\r\n");
}
if (c.getEntries().size() == 0 && c.getLink().equals("resourcelist")) {
List<String> list = new ArrayList<String>();
list.addAll(definitions.getResources().keySet());
Collections.sort(list);
for (String rn : list) {
// if (!links.contains(rn.toLowerCase())) {
ResourceDefn r = definitions.getResourceByName(rn);
orderedResources.add(r.getName());
s.append(" <li><a href=\"" + prefix + rn.toLowerCase() + ".html\">" + Utilities.escapeXml(r.getName()) + "</a></li>\r\n");
// }
}
}
s.append(" </ul>\r\n");
}
}
// s.append(SIDEBAR_SPACER);
s.append("<p><a href=\"http://gforge.hl7.org/gf/project/fhir/\" title=\"GitHub Commit Hash\">Build " + buildId + "</a> (<a href=\"qa.html\">QA Page</a>)</p><p> <a href=\"http://hl7.org\"><img width=\"42\" height=\"50\" border=\"0\" src=\"" + prefix + "hl7logo.png\"/></a></p>\r\n");
s.append("</div>\r\n");
prevSidebars.put(prefix, s.toString());
return prevSidebars.get(prefix);
}
use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method getAbstractSearch.
private String getAbstractSearch(ResourceDefn resource, String searchAdditions) {
if (resource.getSearchParams().size() == 0)
return "";
else {
StringBuilder b = new StringBuilder();
b.append("<h2>Search Parameters</h2>\r\n");
b.append("<p>Common search parameters defined by this resource. See <a href=\"search.html\">Searching</a> for more information about searching in REST, messaging, and services.</p>\r\n");
b.append("<table class=\"list\">\r\n");
b.append("<tr><td><b>Name</b></td><td><b>Type</b></td><td><b>Description</b></td><td><b>Paths</b></td></tr>\r\n");
List<String> names = new ArrayList<String>();
names.addAll(resource.getSearchParams().keySet());
Collections.sort(names);
for (String name : names) {
SearchParameterDefn p = resource.getSearchParams().get(name);
b.append("<tr><td>").append(p.getCode()).append("</td><td><a href=\"search.html#").append(p.getType()).append("\">").append(p.getType()).append("</a></td><td>").append(Utilities.escapeXml(p.getDescription())).append("</td><td>").append(presentPaths(p.getPaths())).append(p.getType() == SearchType.reference ? p.getTargetTypesAsText() : "").append("</td></tr>\r\n");
}
b.append(searchAdditions);
b.append("</table>\r\n");
return b.toString();
}
}
use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method genWGReport.
private String genWGReport() throws Exception {
StringBuilder b = new StringBuilder();
b.append("<table class=\"grid\">\r\n");
b.append(" <tr><td><b>Resource</b></td><td>FMM</td></tr>\r\n");
for (String n : sorted(definitions.getWorkgroups().keySet())) {
WorkGroup wg = definitions.getWorkgroups().get(n);
b.append(" <tr><td colspan=\"2\"><b>" + n + " (" + wg.getName() + ")</b></td></tr>\r\n");
for (String rn : definitions.sortedResourceNames()) {
ResourceDefn r = definitions.getResourceByName(rn);
if (r.getWg() == wg) {
b.append(" <tr><td><a href=\"" + rn.toLowerCase() + ".html\">" + rn + "</a></td><td>" + r.getFmmLevel() + "</td></tr>\r\n");
}
}
}
b.append("</table>\r\n");
return b.toString();
}
use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method produceRefExtensions.
private String produceRefExtensions(ResourceDefn resource) {
int count = 0;
Map<String, StructureDefinition> map = new HashMap<String, StructureDefinition>();
for (StructureDefinition sd : workerContext.getExtensionDefinitions()) {
boolean refers = false;
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
for (TypeRefComponent tr : ed.getType()) {
for (UriType u : tr.getTargetProfile()) if (u.getValue().endsWith("/" + resource.getName()))
refers = true;
}
if (refers)
map.put(sd.getId(), sd);
}
}
StringBuilder b = new StringBuilder();
for (String s : sorted(map.keySet())) {
StructureDefinition cs = map.get(s);
count++;
b.append(" <tr>\r\n");
String ref = cs.getUserString("path");
b.append(" <td><a href=\"").append(ref).append("\">").append(Utilities.escapeXml(cs.getId())).append("</a></td>\r\n");
b.append(" <td>").append(Utilities.escapeXml(cs.getName())).append("</td>\r\n");
Profile ap = (Profile) cs.getUserData("profile");
if (ap == null)
b.append(" <td></td>\r\n");
else {
ImplementationGuideDefn ig = definitions.getIgs().get(ap.getCategory());
b.append(" <td>for <a href=\"" + ig.getPrefix() + ap.getId().toLowerCase() + ".html\">" + Utilities.escapeXml(ap.getTitle()) + "</a></td>\r\n");
}
b.append(" </tr>\r\n");
}
if (count == 0)
b.append("<tr><td colspan=\"\3\">No Extensions refer to this resource</td></tr>");
map.clear();
for (StructureDefinition sd : workerContext.getExtensionDefinitions()) {
boolean refers = false;
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
for (TypeRefComponent tr : ed.getType()) {
for (UriType u : tr.getTargetProfile()) if (u.getValue().endsWith("/Any") || u.getValue().endsWith("/Resource") || u.getValue().endsWith("/DomainResource"))
refers = true;
}
if (refers)
map.put(sd.getId(), sd);
}
}
b.append("<tr><td colspan=\"\3\">Extensions that refer to Any resource</td></tr>");
for (String s : sorted(map.keySet())) {
StructureDefinition cs = map.get(s);
count++;
b.append(" <tr>\r\n");
String ref = cs.getUserString("path");
b.append(" <td><a href=\"").append(ref).append("\">").append(Utilities.escapeXml(cs.getId())).append("</a></td>\r\n");
b.append(" <td>").append(Utilities.escapeXml(cs.getName())).append("</td>\r\n");
Profile ap = (Profile) cs.getUserData("profile");
if (ap == null)
b.append(" <td></td>\r\n");
else {
ImplementationGuideDefn ig = definitions.getIgs().get(ap.getCategory());
b.append(" <td>for <a href=\"" + ig.getPrefix() + ap.getId() + ".html\">" + Utilities.escapeXml(ap.getTitle()) + "</a></td>\r\n");
}
b.append(" </tr>\r\n");
}
return b.toString();
}
use of org.hl7.fhir.definitions.model.ResourceDefn in project kindling by HL7.
the class PageProcessor method genDependencyGraph.
private String genDependencyGraph(ResourceDefn resource, String prefix) throws Exception {
ElementDefn e = resource.getRoot();
ResourceDependencyGenerator gen = new ResourceDependencyGenerator(folders.dstDir, this, resource.getName() + "-definitions.html", false, resource.getFmmLevel(), resource.getStatus());
return "<p>Dependency Graph for " + resource.getName() + " FMM level " + resource.getFmmLevel() + "</p>" + new XhtmlComposer(XhtmlComposer.HTML).compose(gen.generate(e, prefix));
}
Aggregations