Search in sources :

Example 61 with ImplementationGuideDefn

use of org.hl7.fhir.definitions.model.ImplementationGuideDefn in project kindling by HL7.

the class Publisher method determineLink.

private String determineLink(String path, String rn, String id) throws Exception {
    ResourceDefn r = page.getDefinitions().getResourceByName(rn);
    Example e = r.getExampleById(id);
    if (e == null)
        for (ImplementationGuideDefn ig : page.getDefinitions().getIgs().values()) {
            e = ig.getExample(rn, id);
            if (e != null)
                break;
        }
    if (e == null) {
        page.getValidationErrors().add(new ValidationMessage(Source.Publisher, IssueType.NOTFOUND, path, "The reference to " + rn + "/" + id + " could not be resolved", IssueSeverity.WARNING));
        return "#null";
    } else
        return e.getTitle() + ".html";
}
Also used : ValidationMessage(org.hl7.fhir.utilities.validation.ValidationMessage) Example(org.hl7.fhir.definitions.model.Example) ImplementationGuideDefn(org.hl7.fhir.definitions.model.ImplementationGuideDefn) ResourceDefn(org.hl7.fhir.definitions.model.ResourceDefn)

Example 62 with ImplementationGuideDefn

use of org.hl7.fhir.definitions.model.ImplementationGuideDefn in project kindling by HL7.

the class PageProcessor method processPageIncludesForPrinting.

String processPageIncludesForPrinting(String file, String src, Resource resource, ImplementationGuideDefn ig) throws Exception {
    boolean even = false;
    List<String> tabs = new ArrayList<String>();
    while (src.contains("<%") || src.contains("[%")) {
        int i1 = src.indexOf("<%");
        int i2 = src.indexOf("%>");
        if (i1 == -1) {
            i1 = src.indexOf("[%");
            i2 = src.indexOf("%]");
        }
        String s1 = src.substring(0, i1);
        String s2 = src.substring(i1 + 2, i2).trim();
        String s3 = src.substring(i2 + 2);
        String name = file.substring(0, file.indexOf("."));
        String[] com = s2.split(" ");
        if (com.length == 3 && com[0].equals("edt")) {
            if (tabs != null)
                tabs.add("tabs-" + com[1]);
            src = s1 + orgDT(com[1], xmlForDt(com[1], com[2]), treeForDt(com[1]), umlForDt(com[1], com[2]), umlForDt(com[1], com[2] + "b"), profileRef(com[1]), tsForDt(com[1]), jsonForDt(com[1], com[2]), ttlForDt(com[1], com[2]), diffForDt(com[1], com[2])) + s3;
        } else if (com.length == 2 && com[0].equals("dt")) {
            if (tabs != null)
                tabs.add("tabs-" + com[1]);
            src = s1 + xmlForDt(com[1], null) + tsForDt(com[1]) + s3;
        } else if (com.length == 2 && com[0].equals("adt")) {
            if (tabs != null)
                tabs.add("tabs-" + com[1]);
            src = s1 + xmlForDt(com[1], null) + tsForDt(com[1]) + s3;
        } else if (com.length == 2 && com[0].equals("dt.constraints"))
            src = s1 + genConstraints(com[1], "") + s3;
        else if (com.length == 2 && com[0].equals("dt.restrictions"))
            src = s1 + genRestrictions(com[1]) + s3;
        else if (com.length == 2 && com[0].equals("dictionary"))
            src = s1 + dictForDt(com[1]) + s3;
        else if (Utilities.existsInList(com[0], "pageheader", "dtheader", "atheader", "mdtheader", "edheader", "mmheader", "drheader", "elheader", "belheader", "extheader", "resourcesheader", "formatsheader", "narrheader", "refheader", "extrasheader", "profilesheader", "txheader", "txheader0", "fmtheader", "igheader", "cmpheader", "atomheader", "dictheader", "ctheader", "adheader", "pdheader", "tdheader", "cdheader", "diheader", "statheader", "ordistheader", "ucheader", "rrheader"))
            src = s1 + s3;
        else if (com[0].equals("resheader"))
            src = s1 + resHeader(name, "Document", com.length > 1 ? com[1] : null) + s3;
        else if (com[0].equals("aresheader"))
            src = s1 + abstractResHeader(name, "Document", com.length > 1 ? com[1] : null) + s3;
        else if (com[0].equals("codelist"))
            src = s1 + codelist((CodeSystem) resource, com.length > 1 ? com[1] : null, false, true, file) + s3;
        else if (com[0].equals("codelist-nh"))
            src = s1 + codelist((CodeSystem) resource, com.length > 1 ? com[1] : null, false, false, file) + s3;
        else if (com[0].equals("linkcodelist"))
            src = s1 + codelist((CodeSystem) resource, com.length > 1 ? com[1] : null, true, false, file) + s3;
        else if (com[0].equals("sct-vs-list"))
            src = s1 + getSnomedCTVsList() + s3;
        else if (com[0].equals("sct-concept-list"))
            src = s1 + getSnomedCTConceptList() + s3;
        else if (com[0].equals("codetoc"))
            src = s1 + codetoc(com.length > 1 ? com[1] : null) + s3;
        else if (com[0].equals("res-category")) {
            src = s1 + resCategory(s2.substring(com[0].length() + 1)) + s3;
            even = false;
        } else if (com[0].equals("res-item")) {
            even = !even;
            src = s1 + resItem(com[1], even) + s3;
        } else if (com[0].equals("resdesc")) {
            src = s1 + resDesc(com[1]) + s3;
        } else if (com[0].equals("rescat")) {
            src = s1 + resCat(com.length == 1 ? null : s2.substring(7)) + s3;
        } else if (com[0].equals("w5"))
            src = s1 + genW5("true".equals(com[1])) + s3;
        else if (com[0].equals("vs-warning"))
            src = s1 + vsWarning((ValueSet) resource) + s3;
        else if (com[0].equals("res-status-special"))
            src = s1 + vsSpecialStatus((DomainResource) resource) + s3;
        else if (com[0].equals("file")) {
            if (new File(folders.templateDir + com[1] + ".html").exists()) {
                src = s1 + TextFile.fileToString(folders.templateDir + com[1] + ".html") + s3;
            } else {
                src = s1 + TextFile.fileToString(folders.srcDir + com[1] + ".html") + s3;
            }
        } else if (com[0].equals("conceptmaplistvs")) {
            throw new Error("Fix this");
        // BindingSpecification bs = definitions.getBindingByName(Utilities.fileTitle(file));
        // String ref;
        // if (bs == null) {
        // ref = "http://hl7.org/fhir/ValueSet/"+Utilities.fileTitle(file);
        // } else {
        // ref = bs.getReference();
        // if (ref.startsWith("valueset-"))
        // ref = ref.substring(9);
        // ref = "http://hl7.org/fhir/ValueSet/"+ref;
        // }
        // src = s1 + conceptmaplist(ref, com[1]) + s3;
        } else if (com[0].equals("dtmappings"))
            src = s1 + genDataTypeMappings(com[1]) + s3;
        else if (com[0].equals("dtusage"))
            src = s1 + genDataTypeUsage(com[1]) + s3;
        else if (com[0].equals("othertabs"))
            src = s1 + genOtherTabs(com[1], tabs) + s3;
        else if (com[0].equals("toc"))
            src = s1 + generateToc() + s3;
        else if (com.length != 1)
            throw new Exception("Instruction <%" + s2 + "%> not understood parsing page " + file);
        else if (com[0].equals("newheader"))
            src = s1 + TextFile.fileToString(folders.srcDir + "newheader.html") + s3;
        else if (com[0].equals("newheader1"))
            src = s1 + TextFile.fileToString(folders.srcDir + "newheader1.html") + s3;
        else if (com[0].equals("footer"))
            src = s1 + TextFile.fileToString(folders.srcDir + "footer.html") + s3;
        else if (com[0].equals("newfooter"))
            src = s1 + TextFile.fileToString(folders.srcDir + "newfooter.html") + s3;
        else if (com[0].equals("footer1"))
            src = s1 + TextFile.fileToString(folders.srcDir + "footer1.html") + s3;
        else if (com[0].equals("footer2"))
            src = s1 + TextFile.fileToString(folders.srcDir + "footer2.html") + s3;
        else if (com[0].equals("footer3"))
            src = s1 + TextFile.fileToString(folders.srcDir + "footer3.html") + s3;
        else if (com[0].equals("title"))
            src = s1 + Utilities.escapeXml(name.toUpperCase().substring(0, 1) + name.substring(1)) + s3;
        else if (com[0].equals("xtitle"))
            src = s1 + Utilities.escapeXml(name.toUpperCase().substring(0, 1) + name.substring(1)) + s3;
        else if (com[0].equals("name"))
            src = s1 + name + s3;
        else if (com[0].equals("version"))
            src = s1 + ini.getStringProperty("FHIR", "version") + s3;
        else if (com[0].equals("gendate"))
            src = s1 + Config.DATE_FORMAT().format(new Date()) + s3;
        else if (com[0].equals("maindiv"))
            src = s1 + s3;
        else if (com[0].equals("/maindiv"))
            src = s1 + s3;
        else if (com[0].equals("enteredInErrorTable"))
            src = s1 + enteredInErrorTable() + s3;
        else if (com[0].equals("events"))
            src = s1 + getEventsTable(file) + s3;
        else if (com[0].equals("resourcecodes"))
            src = s1 + genResCodes() + s3;
        else if (com[0].equals("datatypecodes"))
            src = s1 + genDTCodes() + s3;
        else // src = s1 + genBindingTable(false) + s3;
        if (com[0].equals("codeslist"))
            src = s1 + genCodeSystemsTable() + s3;
        else if (com[0].equals("valuesetslist"))
            src = s1 + genValueSetsTable(ig) + s3;
        else if (com[0].equals("igvaluesetslist"))
            src = s1 + genIGValueSetsTable() + s3;
        else if (com[0].equals("namespacelist"))
            src = s1 + genNSList() + s3;
        else if (com[0].equals("resimplall"))
            src = s1 + genResImplList() + s3;
        else if (com[0].equals("txurl"))
            src = s1 + "http://hl7.org/fhir/" + Utilities.fileTitle(file) + s3;
        else if (com[0].equals("vstxurl"))
            src = s1 + "http://hl7.org/fhir/ValueSet/" + Utilities.fileTitle(file) + s3;
        else if (com[0].equals("csurl")) {
            if (resource instanceof CodeSystem)
                src = s1 + ((CodeSystem) resource).getUrl() + s3;
            else
                src = s1 + ((ValueSet) resource).getUrl() + s3;
        } else if (com[0].equals("vsurl")) {
            if (resource instanceof CodeSystem)
                src = s1 + ((CodeSystem) resource).getUrl() + s3;
            else
                src = s1 + ((ValueSet) resource).getUrl() + s3;
        } else if (com[0].equals("txdef"))
            src = s1 + generateCodeDefinition(Utilities.fileTitle(file)) + s3;
        else if (com[0].equals("vsxref"))
            src = s1 + xreferencesForFhir(name) + s3;
        else if (com[0].equals("vsdef"))
            if (resource instanceof CodeSystem)
                src = s1 + Utilities.escapeXml(((CodeSystem) resource).getDescription()) + s3;
            else
                src = s1 + Utilities.escapeXml(((ValueSet) resource).getDescription()) + s3;
        else if (com[0].equals("txusage"))
            src = s1 + generateValueSetUsage((ValueSet) resource, genlevel(0), true) + s3;
        else if (com[0].equals("vsusage"))
            src = s1 + generateValueSetUsage((ValueSet) resource, genlevel(0), true) + s3;
        else if (com[0].equals("csusage"))
            src = s1 + generateCSUsage((CodeSystem) resource, genlevel(0)) + s3;
        else if (com[0].equals("vssummary"))
            src = s1 + "todo" + s3;
        else if (com[0].equals("piperesources"))
            src = s1 + pipeResources() + s3;
        else if (com[0].equals("pub-type"))
            src = s1 + publicationType + s3;
        else // src = s1 + expandValueSet(Utilities.fileTitle(file), resource == null ? null : (ValueSet) resource) + s3;
        if (com[0].equals("vsexpansionig"))
            src = s1 + expandValueSetIG((ValueSet) resource, true) + s3;
        else if (com[0].equals("pub-notice"))
            src = s1 + publicationNotice + s3;
        else if (com[0].startsWith("!"))
            src = s1 + s3;
        else if (macros.containsKey(com[0])) {
            src = s1 + macros.get(com[0]) + s3;
        } else
            throw new Exception("Instruction <%" + s2 + "%> not understood parsing page " + file);
    }
    return src;
}
Also used : DomainResource(org.hl7.fhir.r5.model.DomainResource) ArrayList(java.util.ArrayList) FHIRFormatError(org.hl7.fhir.exceptions.FHIRFormatError) TransformerFactoryConfigurationError(javax.xml.transform.TransformerFactoryConfigurationError) CodeSystem(org.hl7.fhir.r5.model.CodeSystem) ContactPoint(org.hl7.fhir.r5.model.ContactPoint) UcumException(org.fhir.ucum.UcumException) TransformerException(javax.xml.transform.TransformerException) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) IOException(java.io.IOException) FHIRException(org.hl7.fhir.exceptions.FHIRException) URISyntaxException(java.net.URISyntaxException) PathEngineException(org.hl7.fhir.exceptions.PathEngineException) DefinitionException(org.hl7.fhir.exceptions.DefinitionException) FileNotFoundException(java.io.FileNotFoundException) NotImplementedException(org.apache.commons.lang3.NotImplementedException) Date(java.util.Date) IniFile(org.hl7.fhir.utilities.IniFile) File(java.io.File) CSFile(org.hl7.fhir.utilities.CSFile) TextFile(org.hl7.fhir.utilities.TextFile) ValueSet(org.hl7.fhir.r5.model.ValueSet)

Example 63 with ImplementationGuideDefn

use of org.hl7.fhir.definitions.model.ImplementationGuideDefn in project kindling by HL7.

the class Publisher method generateIGValueSetsPart2.

private void generateIGValueSetsPart2(ImplementationGuideDefn ig) throws Exception {
    for (Resource ae : page.getIgResources().values()) {
        if (ae instanceof ValueSet) {
            ValueSet vs = (ValueSet) ae;
            String name = Utilities.fileTitle((String) ae.getUserData("path"));
            String title = vs.getName();
            if (vs.getText() == null || vs.getText().getDiv() == null || vs.getText().getDiv().allChildrenAreText() && (Utilities.noString(vs.getText().getDiv().allText()) || !vs.getText().getDiv().allText().matches(".*\\w.*"))) {
                RenderingContext lrc = page.getRc().copy().setLocalPrefix("").setTooCostlyNoteEmpty(PageProcessor.TOO_MANY_CODES_TEXT_EMPTY).setTooCostlyNoteNotEmpty(PageProcessor.TOO_MANY_CODES_TEXT_NOT_EMPTY);
                RendererFactory.factory(vs, lrc).render(vs);
            }
            page.getVsValidator().validate(page.getValidationErrors(), name, vs, true, false);
            // todo - what should the Oids be
            addToResourceFeed(vs, valueSetsFeed, null);
            String sf = page.processPageIncludes(title + ".html", TextFile.fileToString(page.getFolders().templateDir + "template-vs-ig.html"), "valueSet", null, name + ".html", vs, null, "Value Set", null, null, wg("vocab"));
            sf = addSectionNumbers(title + ".html", "template-valueset", sf, "??", 0, null, ig);
            TextFile.stringToFile(sf, page.getFolders().dstDir + name + ".html");
            String src = page.processPageIncludesForBook(title + ".html", TextFile.fileToString(page.getFolders().templateDir + "template-vs-ig-book.html"), "valueSet", vs, null, null);
            cachePage(name + ".html", src, "Value Set " + title, false);
            page.setId(null);
            IParser json = new JsonParser().setOutputStyle(OutputStyle.PRETTY);
            FileOutputStream s = new FileOutputStream(page.getFolders().dstDir + name + ".json");
            json.compose(s, vs);
            s.close();
            json = new JsonParser().setOutputStyle(OutputStyle.CANONICAL);
            s = new FileOutputStream(page.getFolders().dstDir + name + ".canonical.json");
            json.compose(s, vs);
            s.close();
            IParser xml = new XmlParser().setOutputStyle(OutputStyle.PRETTY);
            s = new FileOutputStream(page.getFolders().dstDir + name + ".xml");
            xml.compose(s, vs);
            s.close();
            xml = new XmlParser().setOutputStyle(OutputStyle.CANONICAL);
            s = new FileOutputStream(page.getFolders().dstDir + name + ".canonical.xml");
            xml.compose(s, vs);
            s.close();
            cloneToXhtml(name, "Definition for Value Set" + vs.getName(), false, "valueset-instance", "Value Set", null, wg("vocab"));
            jsonToXhtml(name, "Definition for Value Set" + vs.getName(), resource2Json(vs), "valueset-instance", "Value Set", null, wg("vocab"));
            ttlToXhtml(name, "Definition for Value Set" + vs.getName(), resource2Ttl(vs), "valueset-instance", "Value Set", null, wg("vocab"));
        }
    }
}
Also used : RenderingContext(org.hl7.fhir.r5.renderers.utils.RenderingContext) XmlParser(org.hl7.fhir.r5.formats.XmlParser) FileOutputStream(java.io.FileOutputStream) Resource(org.hl7.fhir.r5.model.Resource) DomainResource(org.hl7.fhir.r5.model.DomainResource) CanonicalResource(org.hl7.fhir.r5.model.CanonicalResource) ValueSet(org.hl7.fhir.r5.model.ValueSet) IParser(org.hl7.fhir.r5.formats.IParser) JsonParser(org.hl7.fhir.r5.formats.JsonParser)

Example 64 with ImplementationGuideDefn

use of org.hl7.fhir.definitions.model.ImplementationGuideDefn in project kindling by HL7.

the class Publisher method produceOperation.

private void produceOperation(ImplementationGuideDefn ig, String name, String id, ResourceDefn resource, Operation op, SectionTracker st) throws Exception {
    OperationDefinition opd = new ProfileGenerator(page.getDefinitions(), page.getWorkerContext(), page, page.getGenDate(), page.getVersion(), dataElements, fpUsages, page.getFolders().rootDir, page.getUml(), page.getRc()).generate(name, id, resource.getName(), op, resource);
    String dir = ig == null ? "" : ig.getCode() + File.separator;
    FileOutputStream s = new FileOutputStream(page.getFolders().dstDir + dir + "operation-" + name + ".xml");
    new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(s, opd);
    s.close();
    s = new FileOutputStream(page.getFolders().dstDir + dir + "operation-" + name + ".canonical.xml");
    new XmlParser().setOutputStyle(OutputStyle.CANONICAL).compose(s, opd);
    s.close();
    cloneToXhtml(dir + "operation-" + name + "", "Operation Definition", true, "resource-instance:OperationDefinition", "Operation definition", resource, resource.getWg());
    s = new FileOutputStream(page.getFolders().dstDir + dir + "operation-" + name + ".json");
    new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(s, opd);
    s.close();
    s = new FileOutputStream(page.getFolders().dstDir + dir + "operation-" + name + ".canonical.json");
    new JsonParser().setOutputStyle(OutputStyle.CANONICAL).compose(s, opd);
    s.close();
    jsonToXhtml(dir + "operation-" + name, "Operation Definition", resource2Json(opd), "resource-instance:OperationDefinition", "Operation definition", resource, resource.getWg());
    s = new FileOutputStream(page.getFolders().dstDir + dir + "operation-" + name + ".ttl");
    new RdfParser().setOutputStyle(OutputStyle.PRETTY).compose(s, opd);
    s.close();
    ttlToXhtml(dir + "operation-" + name, "Operation Definition", resource2Ttl(opd), "resource-instance:OperationDefinition", "Operation definition", resource, resource.getWg());
    Utilities.copyFile(new CSFile(page.getFolders().dstDir + dir + "operation-" + name + ".xml"), new CSFile(page.getFolders().dstDir + "examples" + File.separator + "operation-" + name + ".xml"));
    if (buildFlags.get("all")) {
        addToResourceFeed(opd, page.getResourceBundle(), name);
        page.getWorkerContext().cacheResource(opd);
    }
    // now we create a page for the operation
    String fnp = resource.getName().toLowerCase() + "-operation-" + op.getName().toLowerCase() + ".html";
    String src = TextFile.fileToString(page.getFolders().templateDir + "template-operation.html");
    src = page.processPageIncludes(fnp, src, "res-Operations", null, "operation-" + name + ".html", op.getResource(), null, "Operation Definition", op, ig, resource, resource.getWg());
    TextFile.stringToFile(insertSectionNumbers(src, st, fnp, 0, null), page.getFolders().dstDir + fnp);
    page.getHTMLChecker().registerFile(fnp, "Operation " + op.getName() + " for " + resource.getName(), HTMLLinkChecker.XHTML_TYPE, true);
    // now, we create an html page from the narrative
    String html = TextFile.fileToString(page.getFolders().templateDir + "template-example.html").replace("<%example%>", new XhtmlComposer(XhtmlComposer.HTML).compose(opd.getText().getDiv()));
    html = page.processPageIncludes(dir + "operation-" + name + ".html", html, "resource-instance:OperationDefinition", null, null, null, "Operation Definition", ig, resource, resource.getWg());
    TextFile.stringToFile(html, page.getFolders().dstDir + dir + "operation-" + name + ".html");
    page.getHTMLChecker().registerFile(dir + "operation-" + name + ".html", "Operation " + op.getName(), HTMLLinkChecker.XHTML_TYPE, true);
// head =
// "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\r\n<head>\r\n <title>"+Utilities.escapeXml(e.getDescription())+"</title>\r\n <link rel=\"Stylesheet\" href=\"fhir.css\" type=\"text/css\" media=\"screen\"/>\r\n"+
// "</head>\r\n<body>\r\n<p>&nbsp;</p>\r\n<p>"+Utilities.escapeXml(e.getDescription())+"</p>\r\n"+
// "<p><a href=\""+n+".xml.html\">XML</a> <a href=\""+n+".json.html\">JSON</a></p>\r\n";
// tail = "\r\n</body>\r\n</html>\r\n";
// TextFile.stringToFile(head+narrative+tail, page.getFolders().dstDir + n +
// ".html");
}
Also used : XmlParser(org.hl7.fhir.r5.formats.XmlParser) ProfileGenerator(org.hl7.fhir.definitions.generators.specification.ProfileGenerator) FileOutputStream(java.io.FileOutputStream) XhtmlComposer(org.hl7.fhir.utilities.xhtml.XhtmlComposer) CSFile(org.hl7.fhir.utilities.CSFile) OperationDefinition(org.hl7.fhir.r5.model.OperationDefinition) JsonParser(org.hl7.fhir.r5.formats.JsonParser) RdfParser(org.hl7.fhir.r5.formats.RdfParser)

Example 65 with ImplementationGuideDefn

use of org.hl7.fhir.definitions.model.ImplementationGuideDefn 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

ImplementationGuideDefn (org.hl7.fhir.definitions.model.ImplementationGuideDefn)34 FHIRException (org.hl7.fhir.exceptions.FHIRException)25 FileNotFoundException (java.io.FileNotFoundException)22 IOException (java.io.IOException)22 TransformerException (javax.xml.transform.TransformerException)21 CSFile (org.hl7.fhir.utilities.CSFile)21 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)19 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)18 ContactPoint (org.hl7.fhir.r5.model.ContactPoint)17 File (java.io.File)16 ArrayList (java.util.ArrayList)16 Profile (org.hl7.fhir.definitions.model.Profile)16 ValueSet (org.hl7.fhir.r5.model.ValueSet)15 IniFile (org.hl7.fhir.utilities.IniFile)15 TextFile (org.hl7.fhir.utilities.TextFile)15 Example (org.hl7.fhir.definitions.model.Example)14 UnsupportedEncodingException (java.io.UnsupportedEncodingException)11 URISyntaxException (java.net.URISyntaxException)11 HashMap (java.util.HashMap)10 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)10