Search in sources :

Example 21 with Base

use of org.hl7.fhir.dstu2016may.model.Base in project kindling by HL7.

the class PageProcessor method expandVS.

public String expandVS(ValueSet vs, String prefix, String base) {
    try {
        ValueSetExpansionOutcome result = workerContext.expandVS(vs, true, true);
        if (result.getError() != null)
            return "<hr/>\r\n" + VS_INC_START + "<!--3-->" + processExpansionError(result.getError()) + VS_INC_END;
        if (result.getValueset() == null)
            return "<hr/>\r\n" + VS_INC_START + "<!--4-->" + processExpansionError("(no error returned)") + VS_INC_END;
        ValueSet exp = result.getValueset();
        if (exp == vs)
            throw new Exception("Expansion cannot be the same instance");
        exp.setCompose(null);
        exp.setText(null);
        exp.setDescription("Value Set Contents (Expansion) for " + vs.present() + " at " + Config.DATE_FORMAT().format(new Date()));
        int i = countContains(exp.getExpansion().getContains());
        IniFile sini = new IniFile(Utilities.path(folders.rootDir, "temp", "stats.ini"));
        sini.setIntegerProperty("valuesets", vs.getId(), i, null);
        sini.save();
        RenderingContext lrc = rc.copy().setLocalPrefix(prefix).setTooCostlyNoteEmpty(TOO_MANY_CODES_TEXT_EMPTY).setTooCostlyNoteNotEmpty(TOO_MANY_CODES_TEXT_NOT_EMPTY);
        RendererFactory.factory(exp, lrc).render(exp);
        return "<hr/>\r\n" + VS_INC_START + "" + new XhtmlComposer(XhtmlComposer.HTML).compose(exp.getText().getDiv()) + VS_INC_END;
    } catch (Exception e) {
        e.printStackTrace();
        return "<hr/>\r\n" + VS_INC_START + "<!--5-->" + processExpansionError(e instanceof NullPointerException ? "NullPointerException" : e.getMessage()) + " " + Utilities.escapeXml(stack(e)) + VS_INC_END;
    }
}
Also used : RenderingContext(org.hl7.fhir.r5.renderers.utils.RenderingContext) IniFile(org.hl7.fhir.utilities.IniFile) XhtmlComposer(org.hl7.fhir.utilities.xhtml.XhtmlComposer) ValueSetExpansionOutcome(org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome) ValueSet(org.hl7.fhir.r5.model.ValueSet) 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) ContactPoint(org.hl7.fhir.r5.model.ContactPoint)

Example 22 with Base

use of org.hl7.fhir.dstu2016may.model.Base in project kindling by HL7.

the class PageProcessor method pdHeader.

private String pdHeader(String mode) {
    StringBuilder b = new StringBuilder();
    b.append("<ul class=\"nav nav-tabs\">");
    b.append(makeHeaderTab("Parameter Definition", "parameterdefinition.html", mode == null || "base".equals(mode)));
    b.append(makeHeaderTab("Examples", "parameterdefinition-examples.html", mode == null || "examples".equals(mode)));
    b.append(makeHeaderTab("Detailed Descriptions", "parameterdefinition-definitions.html", mode == null || "definitions".equals(mode)));
    b.append(makeHeaderTab("Mappings", "parameterdefinition-mappings.html", mode == null || "mappings".equals(mode)));
    b.append("</ul>\r\n");
    return b.toString();
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Example 23 with Base

use of org.hl7.fhir.dstu2016may.model.Base in project kindling by HL7.

the class PageProcessor method dtHeader.

private String dtHeader(String mode) {
    StringBuilder b = new StringBuilder();
    b.append("<ul class=\"nav nav-tabs\">");
    b.append(makeHeaderTab("Data Types", "datatypes.html", mode == null || "base".equals(mode)));
    b.append(makeHeaderTab("Examples", "datatypes-examples.html", mode == null || "examples".equals(mode)));
    b.append(makeHeaderTab("Detailed Descriptions", "datatypes-definitions.html", mode == null || "definitions".equals(mode)));
    b.append(makeHeaderTab("Mappings", "datatypes-mappings.html", mode == null || "mappings".equals(mode)));
    b.append(makeHeaderTab("Profiles and Extensions", "datatypes-extras.html", mode == null || "extras".equals(mode)));
    b.append(makeHeaderTab("R3 Conversions", "datatypes-version-maps.html", mode == null || "conversions".equals(mode)));
    b.append("</ul>\r\n");
    return b.toString();
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Example 24 with Base

use of org.hl7.fhir.dstu2016may.model.Base in project kindling by HL7.

the class PageProcessor method genOperationInner.

public void genOperationInner(String n, String id, boolean mixed, StandardsStatus resStatus, String prefix, String np, StringBuilder b, Operation op, boolean header) throws Exception {
    if (header)
        b.append("<h3>").append(Utilities.escapeXml(op.getTitle())).append("<a name=\"").append(op.getName()).append("\"> </a></h3>\r\n");
    if (mixed)
        b.append(opStandardsStatusNotice(n, op.getStandardsStatus(), resStatus, np, prefix) + "\r\n");
    b.append(processMarkdown(n, op.getDoco(), prefix, true) + "\r\n");
    b.append("<p>The official URL for this operation definition is</p>\r\n<pre> http://hl7.org/fhir/OperationDefinition/" + n + "-" + op.getName() + "</pre>\r\n");
    b.append("<p><a href=\"operation-" + id + "-" + op.getName().toLowerCase() + ".html\">Formal Definition</a> (as a <a href=\"" + prefix + "operationdefinition.html\">OperationDefinition</a>).</p>\r\n");
    if (op.isSystem())
        b.append("<p>URL: [base]/$").append(op.getName()).append("</p>\r\n");
    if (op.isType())
        b.append("<p>URL: [base]/").append(checkWrap(n)).append("/$").append(op.getName()).append("</p>\r\n");
    if (op.isInstance())
        b.append("<p>URL: [base]/").append(checkWrap(n)).append("/[id]/$").append(op.getName()).append("</p>\r\n");
    if (op.getIdempotent())
        b.append("<p>This is an idempotent operation</p>\r\n");
    else
        b.append("<p>This is <b>not</b> an idempotent operation</p>\r\n");
    if (!op.getParameters().isEmpty()) {
        b.append("<table class=\"grid\">\r\n");
        if (hasParameters(op.getParameters(), "In")) {
            genParameterHeader(b, "In");
            for (OperationParameter p : op.getParameters()) genOperationParameter(n, "In", "", b, op, p, prefix);
        }
        if (hasParameters(op.getParameters(), "Out")) {
            genParameterHeader(b, "Out");
            for (OperationParameter p : op.getParameters()) genOperationParameter(n, "Out", "", b, op, p, prefix);
        }
        b.append("</table>\r\n");
    }
    b.append(processMarkdown(n, op.getFooter(), prefix)).append("\r\n");
    if (op.getExamples().size() > 0) {
        b.append("<a name=\"examples\"> </a>\r\n<h4>Examples</h4>\r\n");
        boolean needsHr = false;
        boolean hasHr = false;
        for (OperationExample ex : op.getExamples()) if (!ex.isResponse()) {
            needsHr = true;
            renderExample(b, ex, "Request");
        }
        for (OperationExample ex : op.getExamples()) if (ex.isResponse()) {
            if (needsHr && !hasHr) {
                hasHr = true;
                b.append("<hr/>\r\n");
            }
            renderExample(b, ex, "Response");
        }
    }
    if (!Utilities.noString(op.getFooter2())) {
        b.append(processMarkdown(n, op.getFooter2(), prefix)).append("\r\n");
        boolean needsHr = false;
        boolean hasHr = false;
        if (op.getExamples2().size() > 0) {
            for (OperationExample ex : op.getExamples2()) if (!ex.isResponse()) {
                needsHr = true;
                renderExample(b, ex, "Request");
            }
            for (OperationExample ex : op.getExamples2()) if (ex.isResponse()) {
                if (needsHr && !hasHr) {
                    hasHr = true;
                    b.append("<hr/>\r\n");
                }
                renderExample(b, ex, "Response");
            }
        }
    }
    b.append("<p>&nbsp;</p>");
}
Also used : OperationExample(org.hl7.fhir.definitions.model.Operation.OperationExample) OperationParameter(org.hl7.fhir.definitions.model.OperationParameter)

Example 25 with Base

use of org.hl7.fhir.dstu2016may.model.Base in project kindling by HL7.

the class PageProcessor method adHeader.

private String adHeader(String mode) {
    StringBuilder b = new StringBuilder();
    b.append("<ul class=\"nav nav-tabs\">");
    b.append(makeHeaderTab("Action Definition", "actiondefinition.html", mode == null || "base".equals(mode)));
    b.append(makeHeaderTab("Examples", "actiondefinition-examples.html", mode == null || "examples".equals(mode)));
    b.append(makeHeaderTab("Detailed Descriptions", "actiondefinition-definitions.html", mode == null || "definitions".equals(mode)));
    b.append(makeHeaderTab("Mappings", "actiondefinition-mappings.html", mode == null || "mappings".equals(mode)));
    b.append("</ul>\r\n");
    return b.toString();
}
Also used : CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Aggregations

ArrayList (java.util.ArrayList)324 FHIRException (org.hl7.fhir.exceptions.FHIRException)177 Base (org.hl7.fhir.r4b.model.Base)87 Base (org.hl7.fhir.r5.model.Base)87 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)76 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)70 ValidationMessage (org.hl7.fhir.utilities.validation.ValidationMessage)66 PathEngineException (org.hl7.fhir.exceptions.PathEngineException)64 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)55 NotImplementedException (org.apache.commons.lang3.NotImplementedException)47 Base (org.hl7.fhir.dstu2016may.model.Base)47 UcumException (org.fhir.ucum.UcumException)43 ElementDefinition (org.hl7.fhir.r5.model.ElementDefinition)41 Base (org.hl7.fhir.dstu2.model.Base)40 BigDecimal (java.math.BigDecimal)39 IOException (java.io.IOException)37 ParserBase (org.hl7.fhir.dstu2016may.metamodel.ParserBase)34 FileOutputStream (java.io.FileOutputStream)29 ElementDefinition (org.hl7.fhir.dstu3.model.ElementDefinition)28 StructureDefinition (org.hl7.fhir.dstu3.model.StructureDefinition)28