Search in sources :

Example 31 with StructureDefinition

use of org.hl7.fhir.dstu3.model.StructureDefinition in project kindling by HL7.

the class PageProcessor method baseLink.

private String baseLink(StructureDefinition structure, String prefix) throws Exception {
    if (!structure.hasBaseDefinition())
        return "";
    if (structure.getBaseDefinition().startsWith("http://hl7.org/fhir/StructureDefinition/")) {
        String name = structure.getBaseDefinition().substring(40);
        if (definitions.hasResource(name))
            return "<a href=\"" + prefix + name.toLowerCase() + ".html\">" + name + "</a>";
        else if (definitions.hasElementDefn(name))
            return "<a href=\"" + prefix + definitions.getSrcFile(name) + ".html#" + name + "\">" + name + "</a>";
        else {
            StructureDefinition p = definitions.getSnapShotForBase(structure.getBaseDefinition());
            if (p == null)
                return "??" + name;
            else
                return "<a href=\"" + prefix + p.getUserString("path") + "\">" + p.getName() + "</a>";
        }
    } else {
        String[] parts = structure.getBaseDefinition().split("#");
        StructureDefinition profile = new ProfileUtilities(workerContext, null, null).getProfile(structure, parts[0]);
        if (profile != null) {
            if (parts.length == 2) {
                return "<a href=\"" + prefix + profile.getUserData("filename") + "." + parts[1] + ".html\">the structure " + parts[1] + "</a> in <a href=\"" + profile.getUserData("filename") + ".html\">the " + profile.getName() + " profile</a>";
            } else {
                return "<a href=\"" + prefix + profile.getUserData("filename") + ".html\">the " + profile.getName() + " profile</a>";
            }
        } else
            return "<a href=\"" + structure.getBaseDefinition() + "\">" + structure.getBaseDefinition() + "</a>";
    }
}
Also used : StructureDefinition(org.hl7.fhir.r5.model.StructureDefinition) ProfileUtilities(org.hl7.fhir.r5.conformance.ProfileUtilities)

Example 32 with StructureDefinition

use of org.hl7.fhir.dstu3.model.StructureDefinition in project kindling by HL7.

the class PageProcessor method getTerminologyNotes.

private String getTerminologyNotes(StructureDefinition profile, int level) throws FHIRException {
    List<String> txlist = new ArrayList<String>();
    Map<String, ElementDefinitionBindingComponent> txmap = new HashMap<String, ElementDefinitionBindingComponent>();
    for (ElementDefinition ed : profile.getSnapshot().getElement()) {
        if (ed.hasBinding() && !"0".equals(ed.getMax())) {
            String path = ed.getPath();
            if (ed.getType().size() == 1 && ed.getType().get(0).getWorkingCode().equals("Extension"))
                path = path + "<br/>" + ed.getType().get(0).getProfile();
            txlist.add(path);
            txmap.put(path, ed.getBinding());
        }
    }
    if (txlist.isEmpty())
        return "";
    else {
        StringBuilder b = new StringBuilder();
        b.append("<h4>Terminology Bindings</h4>\r\n");
        b.append("<table class=\"list\">\r\n");
        b.append("<tr><td><b>Path</b></td><td><b>Name</b></td><td><b>Conformance</b></td><td><b>ValueSet</b></td></tr>\r\n");
        for (String path : txlist) {
            txItem(level, txmap, b, path);
        }
        b.append("</table>\r\n");
        return b.toString();
    }
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ElementDefinition(org.hl7.fhir.r5.model.ElementDefinition) ElementDefinitionBindingComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent)

Example 33 with StructureDefinition

use of org.hl7.fhir.dstu3.model.StructureDefinition in project kindling by HL7.

the class PageProcessor method generateValueSetUsage.

private String generateValueSetUsage(ValueSet vs, String prefix, boolean addTitle) throws Exception {
    List<String> items = new ArrayList<>();
    if (vs.hasUrl()) {
        for (CodeSystem cs : getCodeSystems().getList()) {
            if (cs != null) {
                if (vs.getUrl().equals(cs.getValueSet())) {
                    String p = cs.getUserString("path");
                    addItem(items, "<li>CodeSystem: This value set is the designated 'entire code system' value set for <a href=\"" + (Utilities.isAbsoluteUrl(p) ? "" : prefix) + p + "\">" + cs.getName() + "</a> " + "</li>\r\n");
                }
            }
        }
    }
    for (ConceptMap cm : getConceptMaps().getList()) {
        String p = cm.getUserString("path");
        if (cm.hasSourceUriType() && cm.getSourceUriType().equals(vs.getUrl())) {
            addItem(items, "<li>ConceptMap: Translation source in <a href=\"" + (Utilities.isAbsoluteUrl(p) ? "" : prefix) + p + "\">" + cm.present() + "</a> " + "</li>\r\n");
        } else if (cm.hasSourceCanonicalType() && (cm.getSourceCanonicalType().getValue().equals(vs.getUrl()) || vs.getUrl().endsWith("/" + cm.getSourceCanonicalType().getValue()))) {
            addItem(items, "<li>ConceptMap: Translation source in <a href=\"" + (Utilities.isAbsoluteUrl(p) ? "" : prefix) + p + "\">" + cm.getName() + "</a> " + "</li>\r\n");
        }
    }
    for (ConceptMap cm : getConceptMaps().getList()) {
        String p = cm.getUserString("path");
        if (cm.hasTargetUriType() && cm.getTargetUriType().equals(vs.getUrl())) {
            addItem(items, "<li>ConceptMap: Translation target in <a href=\"" + (Utilities.isAbsoluteUrl(p) ? "" : prefix) + p + "\">" + cm.present() + "</a> " + "</li>\r\n");
        } else if (cm.hasTargetCanonicalType() && (cm.getTargetCanonicalType().getValue().equals(vs.getUrl()) || vs.getUrl().endsWith("/" + cm.getTargetCanonicalType().getValue()))) {
            addItem(items, "<li>ConceptMap: Translation target ConceptMap <a href=\"" + (Utilities.isAbsoluteUrl(p) ? "" : prefix) + p + "\">" + cm.getName() + "</a> " + "</li>\r\n");
        }
    }
    for (ResourceDefn r : definitions.getBaseResources().values()) {
        scanForUsage(items, vs, r.getRoot(), r.getName().toLowerCase() + "-definitions.html", prefix);
        scanForOperationUsage(items, vs, r, r.getName().toLowerCase() + "-operation-", prefix);
        scanForProfileUsage(items, vs, r, prefix);
    }
    for (ResourceDefn r : definitions.getResources().values()) {
        scanForUsage(items, vs, r.getRoot(), r.getName().toLowerCase() + "-definitions.html", prefix);
        scanForOperationUsage(items, vs, r, r.getName().toLowerCase() + "-operation-", prefix);
        scanForProfileUsage(items, vs, r, prefix);
    }
    for (ElementDefn e : definitions.getInfrastructure().values()) {
        scanForUsage(items, vs, e, definitions.getSrcFile(e.getName()) + "-definitions.html", prefix);
    }
    for (ElementDefn e : definitions.getTypes().values()) {
        if (!definitions.dataTypeIsSharedInfo(e.getName())) {
            scanForUsage(items, vs, e, definitions.getSrcFile(e.getName()) + "-definitions.html", prefix);
        }
    }
    for (StructureDefinition sd : workerContext.getExtensionDefinitions()) {
        scanForUsage(items, vs, sd, sd.getUserString("path"), prefix);
    }
    for (ValueSet vsi : definitions.getValuesets().getList()) {
        String path = (String) vsi.getUserData("path");
        if (vs.hasCompose()) {
            for (ConceptSetComponent t : vs.getCompose().getInclude()) {
                for (UriType uri : t.getValueSet()) {
                    if (uri.getValue().equals(vs.getUrl())) {
                        addItem(items, "<li>ValueSet: Included in <a href=\"" + prefix + path + "\">" + Utilities.escapeXml(vs.present()) + "</a></li>\r\n");
                    }
                }
            }
            for (ConceptSetComponent t : vs.getCompose().getExclude()) {
                for (UriType uri : t.getValueSet()) {
                    if (uri.getValue().equals(vs.getUrl())) {
                        addItem(items, "<li>ValueSet: Excluded from  <a href=\"" + prefix + path + "\">" + Utilities.escapeXml(vs.present()) + "</a></li>\r\n");
                    }
                }
            }
        // for (ConceptSetComponent t : vsi.getCompose().getInclude()) {
        // if (vs.hasCodeSystem() && t.getSystem().equals(vs.getCodeSystem().getSystem()))
        // b.append(" <li>Included in Valueset <a href=\""+prefix+path+"\">"+Utilities.escapeXml(vs.getName())+"</a></li>\r\n");
        // }
        // for (ConceptSetComponent t : vsi.getCompose().getExclude()) {
        // if (vs.hasCodeSystem() && t.getSystem().equals(vs.getCodeSystem().getSystem()))
        // b.append(" <li>Excluded in Valueset <a href=\""+prefix+path+"\">"+Utilities.escapeXml(vs.getName())+"</a></li>\r\n");
        // }
        }
    }
    if (ini.getPropertyNames(vs.getUrl()) != null) {
        for (String n : ini.getPropertyNames(vs.getUrl())) {
            addItem(items, "<li>" + ini.getStringProperty(vs.getUrl(), n) + "</li>\r\n");
        }
    }
    if (items.size() == 0)
        return "<p>\r\nThis value set is not currently used\r\n</p>\r\n";
    else {
        StringBuilder b = new StringBuilder();
        for (String s : items) {
            b.append(" " + s);
        }
        return (addTitle ? "<p>\r\nThis value set is used in the following places:\r\n</p>\r\n" : "") + "<ul>\r\n" + b.toString() + "</ul>\r\n";
    }
}
Also used : ConceptSetComponent(org.hl7.fhir.r5.model.ValueSet.ConceptSetComponent) StructureDefinition(org.hl7.fhir.r5.model.StructureDefinition) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) ArrayList(java.util.ArrayList) ElementDefn(org.hl7.fhir.definitions.model.ElementDefn) ConceptMap(org.hl7.fhir.r5.model.ConceptMap) CodeSystem(org.hl7.fhir.r5.model.CodeSystem) ResourceDefn(org.hl7.fhir.definitions.model.ResourceDefn) ValueSet(org.hl7.fhir.r5.model.ValueSet) UriType(org.hl7.fhir.r5.model.UriType)

Example 34 with StructureDefinition

use of org.hl7.fhir.dstu3.model.StructureDefinition in project kindling by HL7.

the class PageProcessor method genExtensionRow.

private void genExtensionRow(ImplementationGuideDefn ig, StringBuilder s, StructureDefinition ed) throws Exception {
    s.append("<tr>");
    s.append("<td><a href=\"" + ed.getUserString("path") + "\" title=\"" + Utilities.escapeXml(ed.getDescription()) + "\">" + ed.getId() + "</a></td>");
    s.append("<td>" + displayExtensionCardinality(ed) + "</td>");
    s.append("<td>" + determineExtensionType(ed) + "</td>");
    s.append("<td>");
    boolean first = true;
    for (StructureDefinitionContextComponent ec : ed.getContext()) {
        if (first)
            first = false;
        else
            s.append(",<br/> ");
        if (ec.getType() == ExtensionContextType.ELEMENT) {
            String ref = Utilities.oidRoot(ec.getExpression());
            if (ref.startsWith("@"))
                ref = ref.substring(1);
            if (definitions.hasElementDefn(ref))
                s.append("<a href=\"" + definitions.getSrcFile(ref) + ".html#" + Utilities.oidRoot(ec.getExpression()) + "\">" + ec.getExpression() + "</a>");
            else if (definitions.hasResource(ref))
                s.append("<a href=\"" + ref.toLowerCase() + ".html\">" + ec.getExpression() + "</a>");
            else
                s.append(ec.getExpression());
        } else if (ec.getType() == ExtensionContextType.FHIRPATH) {
            s.append(Utilities.escapeXml(ec.getExpression()));
        } else
            throw new Error("Not done yet");
    }
    s.append("</td>");
    String fmm = ToolingExtensions.readStringExtension(ed, ToolingExtensions.EXT_FMM_LEVEL);
    s.append("<td>" + (Utilities.noString(fmm) ? "0" : fmm) + "</td>");
    // s.append("<td><a href=\"extension-"+ed.getId().toLowerCase()+ ".xml.html\">XML</a></td>");
    // s.append("<td><a href=\"extension-"+ed.getId().toLowerCase()+ ".json.html\">JSON</a></td>");
    s.append("</tr>");
}
Also used : StructureDefinitionContextComponent(org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent) FHIRFormatError(org.hl7.fhir.exceptions.FHIRFormatError) TransformerFactoryConfigurationError(javax.xml.transform.TransformerFactoryConfigurationError)

Example 35 with StructureDefinition

use of org.hl7.fhir.dstu3.model.StructureDefinition in project kindling by HL7.

the class PageProcessor method processPageIncludesForBook.

String processPageIncludesForBook(String file, String src, String type, Resource resource, ImplementationGuideDefn ig, WorkGroup wg) throws Exception {
    String workingTitle = null;
    int level = 0;
    boolean even = false;
    List<String> tabs = new ArrayList<String>();
    while (src.contains("<%") || src.contains("[%")) {
        int i1 = src.indexOf("<%");
        int i2 = i1 == -1 ? -1 : src.substring(i1).indexOf("%>") + i1;
        if (i1 == -1) {
            i1 = src.indexOf("[%");
            i2 = i1 == -1 ? -1 : src.substring(i1).indexOf("%]") + i1;
        }
        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 (s2.startsWith("!")) {
            src = s1 + s3;
        } else 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 == 3 && 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 == 3 && 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], genlevel(level)) + 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 + s3;
        else if (com[0].equals("aresheader"))
            src = s1 + s3;
        else if (com[0].equals("othertabs"))
            src = s1 + genOtherTabs(com[1], tabs) + s3;
        else if (com[0].equals("diff")) {
            String p = com[1];
            String pd = p.contains("#") ? p.substring(0, p.indexOf("#")) : p;
            String t = s2.substring(com[0].length() + com[1].length() + 2);
            src = s1 + "<a href=\"" + p + "\">" + t + "</a> <a href=\"http://services.w3.org/htmldiff?doc1=http%3A%2F%2Fhl7.org%2Ffhir%2F2018May%2F" + pd + "&amp;doc2=http%3A%2F%2Fbuild.fhir.org%2F" + pd + "\" no-external=\"true\" style=\"border: 1px solid lightgrey; white-space: nowrap; background-color: #EDFDFE; padding: 2px 2px 2px 2px\">&Delta;B</a>" + s3;
        } else if (com[0].equals("diffx")) {
            String p1 = com[1];
            String pd = p1.contains("#") ? p1.substring(0, p1.indexOf("#")) : p1;
            String p2 = com[2];
            String t = s2.substring(com[0].length() + com[1].length() + 2);
            src = s1 + "<a href=\"" + p1 + "\">" + t + "</a> <a href=\"http://services.w3.org/htmldiff?doc1=http%3A%2F%2Fhl7.org%2Ffhir%2F2018May%2F" + p2 + "&amp;doc2=http%3A%2F%2Fbuild.fhir.org%2F" + pd + "\" no-external=\"true\" style=\"border: 1px solid lightgrey; white-space: nowrap; background-color: #EDFDFE; padding: 2px 2px 2px 2px\">&Delta;B</a>" + s3;
        } else if (com[0].equals("dtmappings"))
            src = s1 + genDataTypeMappings(com[1]) + 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("circular-references"))
            src = s1 + buildCircularReferenceList(com[1].equals("null") ? null : Boolean.valueOf(com[1])) + s3;
        else if (com[0].equals("dtusage"))
            src = s1 + genDataTypeUsage(com[1]) + s3;
        else if (com[0].equals("w5"))
            src = s1 + genW5("true".equals(com[1])) + 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("codetoc"))
            src = s1 + codetoc(com.length > 1 ? com[1] : null) + 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("maponthispage"))
            src = s1 + s3;
        else if (com[0].equals("onthispage"))
            src = s1 + s3;
        else if (com[0].equals("conceptmaplistvs")) {
            ValueSet vs = (ValueSet) resource;
            String ref;
            if (vs == null) {
                ref = "http://hl7.org/fhir/ValueSet/" + Utilities.fileTitle(file);
            } else {
                ref = vs.getUrl();
            }
            src = s1 + conceptmaplist(ref, com[1]) + 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("sidebar"))
            src = s1 + s3;
        else if (com[0].equals("svg"))
            src = s1 + svgs.get(com[1]) + s3;
        else if (com[0].equals("diagram"))
            src = s1 + new SvgGenerator(this, genlevel(level), null, false, file.contains("datatypes"), version).generate(folders.srcDir + com[1], com[2]) + s3;
        else if (com[0].equals("file"))
            src = s1 + /*TextFile.fileToString(folders.srcDir + com[1]+".html")+*/
            s3;
        else if (com[0].equals("settitle")) {
            workingTitle = s2.substring(9).replace("{", "<%").replace("}", "%>");
            src = s1 + s3;
        } else if (com[0].equals("res-ref-list")) {
            src = s1 + genResRefList(com[1]) + s3;
        } else if (com[0].equals("sclist")) {
            src = s1 + genScList(com[1]) + s3;
        } else if (com[0].equals("xcm")) {
            src = s1 + getXcm(com[1]) + s3;
        } else if (com[0].equals("xcmchk")) {
            src = s1 + getXcmChk(com[1]) + s3;
        } else if (com[0].equals("fmm")) {
            src = s1 + getFmm(com[1], false) + s3;
        } else if (com[0].equals("fmmshort")) {
            src = s1 + getFmmShort(com[1]) + s3;
        } else if (com[0].equals("sstatus")) {
            src = s1 + getStandardsStatus(com[1]) + s3;
        } else if (com[0].equals("wg")) {
            src = s1 + getWgLink(file, wg == null && com.length > 0 ? wg(com[1]) : wg) + s3;
        } else if (com[0].equals("wgt")) {
            src = s1 + getWgTitle(wg == null && com.length > 0 ? wg(com[1]) : wg) + s3;
        } else if (com[0].equals("search-link")) {
            src = s1 + searchLink(s2) + s3;
        } else if (com[0].equals("search-footer")) {
            src = s1 + searchFooter(level) + s3;
        } else if (com[0].equals("search-header")) {
            src = s1 + searchHeader(level) + s3;
        } else if (com[0].equals("toc")) {
            src = s1 + generateToc() + s3;
        } else if (com[0].equals("igregistries")) {
            src = s1 + igRegistryList(com[1], com[2]) + s3;
        } else if (com[0].equals("ig.registry")) {
            src = s1 + buildIgRegistry(ig, com[1]) + s3;
        } else if (com[0].equals("dtextras")) {
            src = s1 + produceDataTypeExtras(com[1], true) + s3;
        } else if (com[0].equals("dtextensions")) {
            src = s1 + produceDataTypeExtras(com[1], false) + s3;
        } else if (com[0].equals("resource-table")) {
            src = s1 + genResourceTable(definitions.getResourceByName(com[1]), genlevel(level)) + s3;
        } else if (com[0].equals("profile-diff")) {
            ConstraintStructure p = definitions.findProfile(com[1]);
            src = s1 + generateProfileStructureTable(p, true, com[1] + ".html", com[1], genlevel(level)) + s3;
        } else if (com[0].equals("example")) {
            String[] parts = com[1].split("\\/");
            Example e = findExample(parts[0], parts[1]);
            src = s1 + genExample(e, com.length > 2 ? Integer.parseInt(com[2]) : 0, genlevel(level)) + s3;
        } else if (com[0].equals("extension-diff")) {
            StructureDefinition ed = workerContext.fetchResource(StructureDefinition.class, com[1]);
            src = s1 + generateExtensionTable(ed, "extension-" + com[1], "false", genlevel(level)) + s3;
        } else if (com[0].equals("setlevel")) {
            level = Integer.parseInt(com[1]);
            src = s1 + s3;
        } else if (com[0].equals("r3r4transform")) {
            src = s1 + dtR3R4Transform(com[1]) + s3;
        } else if (com[0].equals("normative-pages")) {
            src = s1 + getNormativeList(genlevel(level), com[1]) + s3;
        } else if (com[0].equals("tx")) {
            src = s1 + produceDataTypeTx(com[1]) + s3;
        } else if (com[0].equals("normative")) {
            src = s1 + s3;
        } else if (com[0].equals("mostlynormative")) {
            src = s1 + s3;
        } else if (com[0].equals("mixednormative")) {
            src = s1 + s3;
        } else if (com[0].equals("pattern-impls")) {
            src = s1 + buildPatternList(com[1]) + s3;
        } else if (com[0].equals("StandardsStatus")) {
            src = s1 + getStandardsStatusNote(genlevel(level), com[1], com[2], com.length == 4 ? com[3] : null) + s3;
        } else if (com[0].equals("diff-analysis")) {
            if ("*".equals(com[1])) {
                updateDiffEngineDefinitions();
                src = s1 + diffEngine.getDiffAsHtml(this) + s3;
            } else {
                StructureDefinition sd = workerContext.fetchTypeDefinition(com[1]);
                if (sd == null)
                    throw new Exception("diff-analysis not found: " + com[1]);
                src = s1 + diffEngine.getDiffAsHtml(this, sd) + s3;
            }
        } else if (com.length != 1)
            throw new Exception("Instruction <%" + s2 + "%> not understood parsing page " + file);
        else if (com[0].equals("header"))
            src = s1 + s3;
        else if (com[0].equals("newheader"))
            src = s1 + s3;
        else if (com[0].equals("newheader1"))
            src = s1 + s3;
        else if (com[0].equals("footer"))
            src = s1 + s3;
        else if (com[0].equals("newfooter"))
            src = s1 + s3;
        else if (com[0].equals("footer1"))
            src = s1 + s3;
        else if (com[0].equals("footer2"))
            src = s1 + s3;
        else if (com[0].equals("footer3"))
            src = s1 + s3;
        else if (com[0].equals("title"))
            src = s1 + (workingTitle == null ? Utilities.escapeXml(name.toUpperCase().substring(0, 1) + name.substring(1)) : workingTitle) + 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("events"))
            src = s1 + getEventsTable(file) + s3;
        else if (com[0].equals("resourcecodes"))
            src = s1 + genResCodes() + s3;
        else if (com[0].equals("enteredInErrorTable"))
            src = s1 + enteredInErrorTable() + s3;
        else if (com[0].equals("datatypecodes"))
            src = s1 + genDTCodes() + s3;
        else // src = s1 + genBindingTable(true) + 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 + s3;
        else if (com[0].equals("conceptmapslist"))
            src = s1 + genConceptMapsTable() + s3;
        else // src = s1 + genBindingTable(false) + s3;
        if (com[0].equals("vsxref"))
            src = s1 + xreferencesForFhir(name) + 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 == null)
                src = s1 + s3;
            else 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("vsexpansion"))
            src = s1 + expandValueSet(Utilities.fileTitle(file), resource == null ? null : (ValueSet) resource, genlevel(level)) + s3;
        else if (com[0].equals("vsexpansionig"))
            src = s1 + expandValueSetIG((ValueSet) resource, true) + 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("txoid"))
            src = s1 + generateOID((CodeSystem) resource) + s3;
        else if (com[0].equals("vsoid"))
            src = s1 + generateOID((ValueSet) resource) + s3;
        else if (com[0].equals("txname"))
            src = s1 + Utilities.fileTitle(file) + s3;
        else if (com[0].equals("vsname"))
            if (resource instanceof CodeSystem)
                src = s1 + ((CodeSystem) resource).present() + s3;
            else
                src = s1 + ((ValueSet) resource).present() + s3;
        else if (com[0].equals("vsnamed"))
            if (resource instanceof CodeSystem)
                src = s1 + ((CodeSystem) resource).getName() + s3;
            else
                src = s1 + ((ValueSet) resource).getName() + s3;
        else if (com[0].equals("vstitle"))
            if (resource instanceof CodeSystem)
                src = s1 + checkTitle(((CodeSystem) resource).getTitle()) + s3;
            else
                src = s1 + checkTitle(((ValueSet) resource).getTitle()) + s3;
        else if (com[0].equals("vsver"))
            if (resource instanceof CodeSystem)
                src = s1 + ((CodeSystem) resource).getVersion() + s3;
            else
                src = s1 + ((ValueSet) resource).getVersion() + s3;
        else if (com[0].equals("vsref")) {
            src = s1 + Utilities.fileTitle((String) resource.getUserData("filename")) + s3;
        } else if (com[0].equals("vsdesc"))
            src = s1 + (resource != null ? Utilities.escapeXml(((ValueSet) resource).getDescription()) : generateVSDesc(Utilities.fileTitle(file))) + s3;
        else if (com[0].equals("txusage"))
            src = s1 + generateValueSetUsage((ValueSet) resource, genlevel(level), true) + s3;
        else if (com[0].equals("vsusage"))
            src = s1 + generateValueSetUsage((ValueSet) resource, genlevel(level), true) + s3;
        else if (com[0].equals("csusage"))
            src = s1 + generateCSUsage((CodeSystem) resource, genlevel(level)) + s3;
        else if (com[0].equals("mappings-table"))
            src = s1 + genMappingsTable() + s3;
        else if (com[0].equals("vssummary"))
            src = s1 + "todo" + s3;
        else if (com[0].equals("compartmentlist"))
            src = s1 + compartmentlist() + s3;
        else if (com[0].equals("comp-title"))
            src = s1 + compTitle(name) + s3;
        else if (com[0].equals("comp-desc"))
            src = s1 + compDesc(name) + s3;
        else if (com[0].equals("comp-uri"))
            src = s1 + compUri(name) + s3;
        else if (com[0].equals("comp-identity"))
            src = s1 + compIdentity(name) + s3;
        else if (com[0].equals("comp-membership"))
            src = s1 + compMembership(name) + s3;
        else if (com[0].equals("comp-resources"))
            src = s1 + compResourceMap(name) + s3;
        else if (com[0].equals("breadcrumb"))
            src = s1 + breadCrumbManager.make(name) + s3;
        else if (com[0].equals("navlist"))
            src = s1 + breadCrumbManager.navlist(name, genlevel(level)) + s3;
        else if (com[0].equals("breadcrumblist")) {
            String crumbTitle = (workingTitle == null ? Utilities.escapeXml(name.toUpperCase().substring(0, 1) + name.substring(1)) : workingTitle);
            src = s1 + ((ig == null || ig.isCore()) ? breadCrumbManager.makelist(name, type, genlevel(level), crumbTitle) : ig.makeList(name, type, genlevel(level), crumbTitle)) + s3;
        } else if (com[0].equals("year"))
            src = s1 + new SimpleDateFormat("yyyy").format(new Date()) + s3;
        else if (com[0].equals("buildId"))
            src = s1 + buildId + s3;
        else if (com[0].equals("level"))
            src = s1 + genlevel(level) + s3;
        else if (com[0].equals("piperesources"))
            src = s1 + pipeResources() + s3;
        else if (com[0].equals("archive"))
            src = s1 + makeArchives() + s3;
        else if (com[0].equals("pub-type"))
            src = s1 + publicationType + s3;
        else if (com[0].equals("pub-notice"))
            src = s1 + publicationNotice + s3;
        else if (com[0].equals("profilelist"))
            src = s1 + genProfilelist() + s3;
        else if (com[0].equals("extensionslist"))
            src = s1 + genExtensionsTable() + s3;
        else if (com[0].equals("igprofileslist"))
            src = s1 + genIGProfilelist() + s3;
        else if (com[0].equals("operationslist"))
            src = s1 + genOperationList() + s3;
        else if (com[0].equals("id_regex"))
            src = s1 + FormatUtilities.ID_REGEX + s3;
        else if (com[0].equals("allparams"))
            src = s1 + allParamlist() + s3;
        else if (com[0].equals("resourcecount"))
            src = s1 + Integer.toString(definitions.getResources().size()) + s3;
        else if (com[0].equals("status-codes"))
            src = s1 + genStatusCodes() + s3;
        else if (com[0].equals("dictionary.name"))
            src = s1 + definitions.getDictionaries().get(name) + s3;
        else // src = s1 + ResourceUtilities.representDataElementCollection(this.workerContext, (Bundle) resource, true, "hspc-QuantitativeLab-dataelements") + s3;
        if (com[0].startsWith("!"))
            src = s1 + s3;
        else if (com[0].equals("identifierlist"))
            src = s1 + genIdentifierList() + s3;
        else if (com[0].equals("allsearchparams"))
            src = s1 + genAllSearchParams() + s3;
        else if (com[0].equals("internalsystemlist"))
            src = s1 + genCSList() + s3;
        else if (com[0].equals("internalsystemlistx"))
            src = s1 + genCSListX() + s3;
        else if (com[0].equals("baseURLn"))
            src = s1 + Utilities.appendForwardSlash(baseURL) + s3;
        else if (com[0].equals("ig.title"))
            src = s1 + ig.getName() + s3;
        else if (com[0].equals("ig.wglink"))
            src = s1 + igLink(ig) + s3;
        else if (com[0].equals("ig.wgt"))
            src = s1 + ig.getCommittee() + s3;
        else if (com[0].equals("ig.fmm"))
            src = s1 + ig.getFmm() + s3;
        else if (com[0].equals("comp-name"))
            src = s1 + compName(name) + s3;
        else if (com[0].equals("ig.ballot"))
            src = s1 + ig.getBallot() + s3;
        else if (com[0].equals("fhir-path"))
            src = s1 + "../" + s3;
        else if (com[0].equals("modifier-list"))
            src = s1 + genModifierList() + s3;
        else if (com[0].equals("missing-element-list"))
            src = s1 + genMeaningWhenMissingList() + s3;
        else if (com[0].equals("wgreport"))
            src = s1 + genWGReport() + s3;
        else if (com[0].equals("r3maps-summary"))
            src = s1 + genR3MapsSummary() + s3;
        else if (com[0].equals("res-list-maturity"))
            src = s1 + buildResListByMaturity() + s3;
        else if (com[0].equals("res-list-security"))
            src = s1 + buildResListBySecurity() + s3;
        else if (com[0].equals("res-list-fmg"))
            src = s1 + buildResListByFMG() + s3;
        else if (com[0].equals("res-list-ballot"))
            src = s1 + buildResListByBallot() + s3;
        else if (com[0].equals("res-list-committee"))
            src = s1 + buildResListByCommittee() + s3;
        else if (com[0].equals("wglist"))
            src = s1 + buildCommitteeList() + s3;
        else if (com[0].equals("best-practice-list"))
            src = s1 + genBestPracticeList() + s3;
        else if (com[0].equals("extension-type-list"))
            src = s1 + genExtensionTypeList() + s3;
        else if (com[0].equals("wildcard-type-list"))
            src = s1 + genWildcardTypeList() + s3;
        else if (com[0].startsWith("GF#"))
            src = s1 + "<a href=\"https://gforge.hl7.org/gf/project/fhir/tracker/?action=TrackerItemEdit&amp;tracker_item_id=" + com[0].substring(3) + "\">" + com[0] + "</a>" + s3;
        else if (com[0].startsWith("GFT#"))
            src = s1 + "<a href=\"https://gforge.hl7.org/gf/project/fhir/tracker/?action=TrackerItemEdit&amp;tracker_item_id=" + com[0].substring(3) + "\">Task</a>" + s3;
        else if (com[0].equals("canonical-resources"))
            src = s1 + listCanonicalResources() + s3;
        else if (com[0].equals("special-search-parameters")) {
            src = s1 + listSpecialParameters() + s3;
        } else if (com[0].equals("patterns-analysis")) {
            src = s1 + patternFinder.generateReport() + s3;
        } else if (com[0].equals("res-type-count")) {
            src = s1 + definitions.getResources().size() + 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 : ArrayList(java.util.ArrayList) 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) StructureDefinition(org.hl7.fhir.r5.model.StructureDefinition) SvgGenerator(org.hl7.fhir.definitions.generators.specification.SvgGenerator) Example(org.hl7.fhir.definitions.model.Example) OperationExample(org.hl7.fhir.definitions.model.Operation.OperationExample) ConstraintStructure(org.hl7.fhir.definitions.model.ConstraintStructure) ValueSet(org.hl7.fhir.r5.model.ValueSet) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

ArrayList (java.util.ArrayList)307 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)241 FHIRException (org.hl7.fhir.exceptions.FHIRException)226 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)158 ElementDefinition (org.hl7.fhir.r5.model.ElementDefinition)144 StructureDefinition (org.hl7.fhir.r4b.model.StructureDefinition)105 ValidationMessage (org.hl7.fhir.utilities.validation.ValidationMessage)98 IOException (java.io.IOException)91 StructureDefinition (org.hl7.fhir.dstu3.model.StructureDefinition)91 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)87 StructureDefinition (org.hl7.fhir.r4.model.StructureDefinition)83 ElementDefinition (org.hl7.fhir.dstu3.model.ElementDefinition)70 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)69 ElementDefinition (org.hl7.fhir.r4b.model.ElementDefinition)67 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)58 ElementDefinition (org.hl7.fhir.r4.model.ElementDefinition)56 TypeRefComponent (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent)50 Piece (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Piece)49 ProfileUtilities (org.hl7.fhir.r5.conformance.ProfileUtilities)46 Cell (org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell)46