Search in sources :

Example 81 with ResourceDefn

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>&reg; v" + getVersion() + " &copy; <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);
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) ArrayList(java.util.ArrayList) ResourceDefn(org.hl7.fhir.definitions.model.ResourceDefn)

Example 82 with ResourceDefn

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();
    }
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) SearchParameterDefn(org.hl7.fhir.definitions.model.SearchParameterDefn) ArrayList(java.util.ArrayList)

Example 83 with ResourceDefn

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();
}
Also used : WorkGroup(org.hl7.fhir.definitions.model.WorkGroup) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) ResourceDefn(org.hl7.fhir.definitions.model.ResourceDefn)

Example 84 with ResourceDefn

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();
}
Also used : StructureDefinition(org.hl7.fhir.r5.model.StructureDefinition) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) HashMap(java.util.HashMap) TypeRefComponent(org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent) ElementDefinition(org.hl7.fhir.r5.model.ElementDefinition) ImplementationGuideDefn(org.hl7.fhir.definitions.model.ImplementationGuideDefn) ContactPoint(org.hl7.fhir.r5.model.ContactPoint) Profile(org.hl7.fhir.definitions.model.Profile) UriType(org.hl7.fhir.r5.model.UriType)

Example 85 with ResourceDefn

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));
}
Also used : ElementDefn(org.hl7.fhir.definitions.model.ElementDefn) XhtmlComposer(org.hl7.fhir.utilities.xhtml.XhtmlComposer) ResourceDependencyGenerator(org.hl7.fhir.definitions.generators.specification.ResourceDependencyGenerator)

Aggregations

ResourceDefn (org.hl7.fhir.definitions.model.ResourceDefn)75 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)42 ArrayList (java.util.ArrayList)38 FHIRException (org.hl7.fhir.exceptions.FHIRException)36 ElementDefn (org.hl7.fhir.definitions.model.ElementDefn)31 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)28 File (java.io.File)26 FileOutputStream (java.io.FileOutputStream)25 CSFile (org.hl7.fhir.utilities.CSFile)24 XmlParser (org.hl7.fhir.r5.formats.XmlParser)22 FileNotFoundException (java.io.FileNotFoundException)20 IOException (java.io.IOException)20 Example (org.hl7.fhir.definitions.model.Example)20 Profile (org.hl7.fhir.definitions.model.Profile)20 ContactPoint (org.hl7.fhir.r5.model.ContactPoint)18 IniFile (org.hl7.fhir.utilities.IniFile)18 ImplementationGuideDefn (org.hl7.fhir.definitions.model.ImplementationGuideDefn)16 TransformerException (javax.xml.transform.TransformerException)15 TextFile (org.hl7.fhir.utilities.TextFile)15 SearchParameterDefn (org.hl7.fhir.definitions.model.SearchParameterDefn)14