Search in sources :

Example 1 with WildcardInformation

use of org.hl7.fhir.r5.utils.TypesUtilities.WildcardInformation in project kindling by HL7.

the class PageProcessor method genWildcardTypeList.

private String genWildcardTypeList() {
    StringBuilder b = new StringBuilder();
    TypeClassification tc = null;
    boolean first = true;
    for (WildcardInformation wi : TypesUtilities.wildcards(version.toCode())) {
        if (tc != wi.getClassification()) {
            if (first)
                first = false;
            else
                b.append("</ul>\r\n");
            tc = wi.getClassification();
            b.append("<b>" + Utilities.pluralize(tc.toDisplay(), 2) + "</b>\r\n");
            b.append("<ul class=\"dense\">\r\n");
        }
        b.append("<li><a href=\"");
        b.append(definitions.getSrcFile(wi.getTypeName()) + ".html#" + wi.getTypeName());
        b.append("\">");
        b.append(wi.getTypeName());
        b.append("</a></li>\r\n");
    }
    b.append("</ul>\r\n");
    return b.toString();
}
Also used : WildcardInformation(org.hl7.fhir.r5.utils.TypesUtilities.WildcardInformation) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder) TypeClassification(org.hl7.fhir.r5.utils.TypesUtilities.TypeClassification)

Example 2 with WildcardInformation

use of org.hl7.fhir.r5.utils.TypesUtilities.WildcardInformation in project kindling by HL7.

the class PageProcessor method genExtensionTypeList.

private String genExtensionTypeList() {
    StringBuilder b = new StringBuilder();
    for (WildcardInformation wi : TypesUtilities.wildcards(version.toCode())) {
        b.append("<li>value");
        b.append(Utilities.capitalize(wi.getTypeName()));
        b.append(": <a href=\"");
        b.append(definitions.getSrcFile(wi.getTypeName()) + ".html#" + wi.getTypeName());
        b.append("\">");
        b.append(wi.getTypeName());
        b.append("</a>");
        if (!Utilities.noString(wi.getComment())) {
            b.append(" " + wi.getComment());
        }
        b.append("</li>");
    }
    return b.toString();
}
Also used : WildcardInformation(org.hl7.fhir.r5.utils.TypesUtilities.WildcardInformation) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Example 3 with WildcardInformation

use of org.hl7.fhir.r5.utils.TypesUtilities.WildcardInformation in project kindling by HL7.

the class JsonSpecGenerator method generateCoreElem.

private void generateCoreElem(ElementDefn elem, int indent, String rootName, String pathName, boolean backbone, boolean last) throws Exception {
    // base pattern: "name" : "value" // optionality documentation
    int width = 0;
    // If this is an unrolled element, show its profile name
    if (elem.getProfileName() != null && !elem.getProfileName().equals("")) {
        for (int i = 0; i < indent; i++) write("  ");
        write("<span style=\"color: Gray\">// </span><span style=\"color: blue\">\"" + elem.getProfileName() + "\":</span>\r\n");
    }
    if (elem.getMaxCardinality() != null && elem.getMaxCardinality() == 0)
        write("<span style=\"text-decoration: line-through\">");
    String en = elem.getName();
    if (en.contains("[x]") && elem.getTypes().size() == 1 && !elem.getTypes().get(0).isWildcardType())
        en = en.replace("[x]", elem.typeCode());
    if (en.contains("[x]")) {
        // 1. name
        for (int i = 0; i < indent; i++) {
            write("  ");
        }
        if (elem.getTypes().size() > 1) {
            write("<span style=\"color: Gray\">// " + en + ": <span style=\"color: navy; opacity: 0.8\">" + docPrefix(width, indent, elem) + Utilities.escapeXml(elem.getShortDefn()) + "</span>. One of these " + Integer.toString(elem.getTypes().size()) + ":</span>\r\n");
            for (TypeRef t : elem.getTypes()) generateCoreElemDetails(elem, indent, rootName, pathName, backbone, last, width, en.replace("[x]", nameForType(t.getName())), t, false);
        } else {
            List<WildcardInformation> tr = TypesUtilities.wildcards(version);
            write("<span style=\"color: Gray\">// " + en + ": <span style=\"color: navy; opacity: 0.8\">" + docPrefix(width, indent, elem) + Utilities.escapeXml(elem.getShortDefn()) + "</span>. One of these " + Integer.toString(tr.size()) + ":</span>\r\n");
            for (WildcardInformation t : tr) generateCoreElemDetails(elem, indent, rootName, pathName, backbone, last, width, en.replace("[x]", upFirst(t.getTypeName())), toTypeRef(t), false);
        }
    } else {
        generateCoreElemDetails(elem, indent, rootName, pathName, backbone, last, width, en, elem.getTypes().isEmpty() ? null : elem.getTypes().get(0), true);
    }
}
Also used : WildcardInformation(org.hl7.fhir.r5.utils.TypesUtilities.WildcardInformation) TypeRef(org.hl7.fhir.definitions.model.TypeRef)

Example 4 with WildcardInformation

use of org.hl7.fhir.r5.utils.TypesUtilities.WildcardInformation in project kindling by HL7.

the class JsonSpecGenerator method toTypeRef.

private TypeRef toTypeRef(WildcardInformation t) {
    TypeRef r = new TypeRef();
    r.setName(t.getTypeName());
    return r;
}
Also used : TypeRef(org.hl7.fhir.definitions.model.TypeRef)

Aggregations

WildcardInformation (org.hl7.fhir.r5.utils.TypesUtilities.WildcardInformation)3 TypeRef (org.hl7.fhir.definitions.model.TypeRef)2 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)2 TypeClassification (org.hl7.fhir.r5.utils.TypesUtilities.TypeClassification)1