Search in sources :

Example 51 with SearchParameter

use of org.hl7.fhir.r4b.model.SearchParameter in project kindling by HL7.

the class PageProcessor method getSearch.

private String getSearch(Profile pack) {
    if (pack.getSearchParameters().size() == 0)
        return "";
    else {
        StringBuilder b = new StringBuilder();
        b.append("<h2>Search Parameters</h2>\r\n");
        b.append("<p>Search parameters defined by this structure. 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>();
        for (SearchParameter t : pack.getSearchParameters()) names.add(t.getName());
        Collections.sort(names);
        for (String name : names) {
            SearchParameter p = null;
            for (SearchParameter t : pack.getSearchParameters()) if (t.getName().equals(name))
                p = t;
            b.append("<tr><td>").append(p.getName()).append("</td><td><a href=\"search.html#").append(p.getType().toCode()).append("\">").append(p.getType().toCode()).append("</a></td><td>").append(Utilities.escapeXml(p.getDescription())).append("</td><td>").append(p.getXpath() == null ? "" : p.getXpath()).append("</td></tr>\r\n");
        }
        b.append("</table>\r\n");
        return b.toString();
    }
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) ArrayList(java.util.ArrayList) SearchParameter(org.hl7.fhir.r5.model.SearchParameter)

Example 52 with SearchParameter

use of org.hl7.fhir.r4b.model.SearchParameter in project kindling by HL7.

the class PageProcessor method presentOthers.

private Object presentOthers(SearchParameterDefn p) {
    if (p.getOtherResources().isEmpty())
        return "";
    StringBuilder b = new StringBuilder();
    b.append("<a href=\"searchparameter-registry.html#" + p.getCommonId() + "\">" + Integer.toString(p.getOtherResources().size()) + " Resources</a>");
    return b.toString();
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Example 53 with SearchParameter

use of org.hl7.fhir.r4b.model.SearchParameter in project kindling by HL7.

the class PageProcessor method genCommonSearchParams.

private void genCommonSearchParams(StringBuilder b, List<SearchParameter> splist) throws Exception {
    List<SearchParameter> list = new ArrayList<SearchParameter>();
    for (SearchParameter sp : splist) {
        if (sp.getBase().size() > 1) {
            boolean found = false;
            for (SearchParameter spt : list) if (spt == sp)
                found = true;
            if (!found)
                list.add(sp);
        }
    }
    Collections.sort(list, new SearchParameterListSorter());
    if (list.size() > 0) {
        b.append("<tr><td colspan=\"5\" style=\"background-color: #dddddd\"><b>Common Search Parameters<a name=\"common\"> </a></b></td></tr>\r\n");
        for (SearchParameter sp : list) {
            b.append("<tr><td>" + sp.getCode() + "<a name=\"" + sp.getId() + "\"> </a>" + makeStandardsStatusRef(ToolingExtensions.getStandardsStatus(sp)) + "</td><td><a href=\"search.html#" + sp.getType().toCode() + "\">" + sp.getType().toCode() + "</a></td><td>" + sp.getId() + "</td><td>" + processMarkdown("allsearchparams", sp.getDescription(), "") + "</td><td>" + Utilities.escapeXml(sp.getExpression()).replace(".", ".&#8203;") + "</td></tr>\r\n");
        }
    }
}
Also used : ArrayList(java.util.ArrayList) SearchParameter(org.hl7.fhir.r5.model.SearchParameter)

Example 54 with SearchParameter

use of org.hl7.fhir.r4b.model.SearchParameter in project kindling by HL7.

the class Publisher method addSearchParams.

private void addSearchParams(Set<String> uris, Bundle bundle, Profile conformancePack) {
    for (SearchParameter sp : conformancePack.getSearchParameters()) {
        if (!uris.contains(sp.getUrl())) {
            bundle.addEntry().setResource(sp).setFullUrl("http://hl7.org/fhir/" + sp.fhirType() + "/" + sp.getId());
            uris.add(sp.getUrl());
        }
    }
}
Also used : SearchParameter(org.hl7.fhir.r5.model.SearchParameter)

Example 55 with SearchParameter

use of org.hl7.fhir.r4b.model.SearchParameter in project kindling by HL7.

the class Publisher method producePackSearchParameter.

private void producePackSearchParameter(ResourceDefn res, Profile pack, SearchParameter sp, SectionTracker st, ImplementationGuideDefn ig) throws Exception {
    String title = sp.getId();
    sp.setUserData("pack", pack.getId());
    String prefix = (ig == null || ig.isCore()) ? "" : ig.getCode() + File.separator;
    int level = (ig == null || ig.isCore()) ? 0 : 1;
    XmlParser comp = new XmlParser();
    FileOutputStream s = new FileOutputStream(page.getFolders().dstDir + prefix + title + ".xml");
    comp.setOutputStyle(OutputStyle.PRETTY).compose(s, sp);
    s.close();
    s = new FileOutputStream(page.getFolders().dstDir + prefix + title + ".canonical.xml");
    comp.setOutputStyle(OutputStyle.CANONICAL).compose(s, sp);
    s.close();
    JsonParser jcomp = new JsonParser();
    s = new FileOutputStream(page.getFolders().dstDir + prefix + title + ".json");
    jcomp.setOutputStyle(OutputStyle.PRETTY).compose(s, sp);
    s.close();
    s = new FileOutputStream(page.getFolders().dstDir + prefix + title + ".canonical.json");
    jcomp.setOutputStyle(OutputStyle.CANONICAL).compose(s, sp);
    s.close();
    String src = TextFile.fileToString(page.getFolders().templateDir + "template-search-parameter.html");
    src = page.processPageIncludes(sp.getId() + ".html", src, "search-parameter:" + (res == null ? "na" : res.getName()) + "/" + pack.getId() + "/" + sp.getId(), null, sp, null, "Search Parameter", ig, res, res == null ? wg("fhir") : res.getWg());
    if (st != null)
        src = insertSectionNumbers(src, st, title + ".html", level, null);
    page.getHTMLChecker().registerFile(prefix + title + ".html", "SearchParameter " + sp.getName(), HTMLLinkChecker.XHTML_TYPE, true);
    TextFile.stringToFile(src, page.getFolders().dstDir + prefix + title + ".html");
    cloneToXhtml(prefix + title, "Search Parameter " + sp.getName(), false, "searchparam-instance", "Search Parameter", res, res == null ? wg("fhir") : res.getWg());
    String json = resource2Json(sp);
    json = "<div class=\"example\">\r\n<p>" + Utilities.escapeXml("SearchParameter " + sp.getName()) + "</p>\r\n<pre class=\"json\">\r\n" + Utilities.escapeXml(json) + "\r\n</pre>\r\n</div>\r\n";
    String html = TextFile.fileToString(page.getFolders().templateDir + "template-example-json.html").replace("<%example%>", json);
    html = page.processPageIncludes(title + ".json.html", html, "search-parameter:" + (res == null ? "wg" : res.getName()) + "/" + pack.getId() + "/" + sp.getId(), null, sp, null, "Search Parameter", ig, res, res == null ? wg("fhir") : res.getWg());
    TextFile.stringToFile(html, page.getFolders().dstDir + prefix + title + ".json.html");
    page.getHTMLChecker().registerExternal(prefix + title + ".json.html");
}
Also used : XmlParser(org.hl7.fhir.r5.formats.XmlParser) FileOutputStream(java.io.FileOutputStream) ContactPoint(org.hl7.fhir.r5.model.ContactPoint) JsonParser(org.hl7.fhir.r5.formats.JsonParser)

Aggregations

SearchParameter (org.hl7.fhir.r5.model.SearchParameter)32 FHIRException (org.hl7.fhir.exceptions.FHIRException)13 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)13 ArrayList (java.util.ArrayList)12 File (java.io.File)9 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)9 SearchParameter (org.hl7.fhir.r4b.model.SearchParameter)9 CodeType (org.hl7.fhir.r5.model.CodeType)9 HashSet (java.util.HashSet)8 FileOutputStream (java.io.FileOutputStream)7 XmlParser (org.hl7.fhir.r5.formats.XmlParser)7 FileNotFoundException (java.io.FileNotFoundException)6 IOException (java.io.IOException)6 SearchParameterDefn (org.hl7.fhir.definitions.model.SearchParameterDefn)6 CanonicalResource (org.hl7.fhir.r5.model.CanonicalResource)6 ContactPoint (org.hl7.fhir.r5.model.ContactPoint)6 ImplementationGuide (org.hl7.fhir.r5.model.ImplementationGuide)6 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)6 ConstraintStructure (org.hl7.fhir.definitions.model.ConstraintStructure)5 Example (org.hl7.fhir.definitions.model.Example)5