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();
}
}
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();
}
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(".", ".​") + "</td></tr>\r\n");
}
}
}
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());
}
}
}
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");
}
Aggregations