Search in sources :

Example 1 with ElementDefinitionSlicingDiscriminatorComponent

use of org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent in project kindling by HL7.

the class XmlSpecGenerator method describeSlicing.

private String describeSlicing(ElementDefinitionSlicingComponent slicing) {
    CommaSeparatedStringBuilder csv = new CommaSeparatedStringBuilder();
    for (ElementDefinitionSlicingDiscriminatorComponent d : slicing.getDiscriminator()) {
        csv.append(d.getType().toCode() + ":" + d.getPath());
    }
    String s = slicing.getOrdered() ? " in any order" : " in the specified order" + (slicing.hasRules() ? slicing.getRules().getDisplay() : "");
    return " sliced by " + csv.toString() + " " + s;
}
Also used : ElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Example 2 with ElementDefinitionSlicingDiscriminatorComponent

use of org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent in project kindling by HL7.

the class JsonSpecGenerator method describeSlicing.

private String describeSlicing(ElementDefinitionSlicingComponent slicing) {
    CommaSeparatedStringBuilder csv = new CommaSeparatedStringBuilder();
    for (ElementDefinitionSlicingDiscriminatorComponent d : slicing.getDiscriminator()) {
        csv.append(d.getType().toCode() + ":" + d.getPath());
    }
    String s = slicing.getOrdered() ? " in any order, " : " in the specified order, " + (slicing.hasRules() ? slicing.getRules().getDisplay() : "");
    return " sliced by " + csv.toString() + " " + s;
}
Also used : ElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Example 3 with ElementDefinitionSlicingDiscriminatorComponent

use of org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent in project kindling by HL7.

the class DictHTMLGenerator method generateSlicing.

private void generateSlicing(StructureDefinition profile, ElementDefinitionSlicingComponent slicing) throws IOException {
    StringBuilder b = new StringBuilder();
    if (slicing.getOrdered())
        b.append("<li>ordered</li>");
    else
        b.append("<li>unordered</li>");
    if (slicing.hasRules())
        b.append("<li>" + slicing.getRules().getDisplay() + "</li>");
    if (!slicing.getDiscriminator().isEmpty()) {
        b.append("<li>discriminators: ");
        boolean first = true;
        for (ElementDefinitionSlicingDiscriminatorComponent s : slicing.getDiscriminator()) {
            if (first)
                first = false;
            else
                b.append(", ");
            b.append(s.getType().toCode() + ":" + s.getPath());
        }
        b.append("</li>");
    }
    tableRowNE("Slicing", "profiling.html#slicing", "This element introduces a set of slices. The slicing rules are: <ul> " + b.toString() + "</ul>");
}
Also used : ElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Example 4 with ElementDefinitionSlicingDiscriminatorComponent

use of org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent in project org.hl7.fhir.core by hapifhir.

the class ProfileUtilities method sliceSummary.

private String sliceSummary(ElementDefinition ed) {
    if (!ed.hasSlicing() && !ed.hasSliceName())
        return "";
    if (ed.hasSliceName())
        return " (slicename = " + ed.getSliceName() + ")";
    StringBuilder b = new StringBuilder();
    boolean first = true;
    for (ElementDefinitionSlicingDiscriminatorComponent d : ed.getSlicing().getDiscriminator()) {
        if (first)
            first = false;
        else
            b.append("|");
        b.append(d.getPath());
    }
    return " (slicing by " + b.toString() + ")";
}
Also used : ElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Example 5 with ElementDefinitionSlicingDiscriminatorComponent

use of org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent in project org.hl7.fhir.core by hapifhir.

the class ProfileUtilities method summariseSlicing.

private String summariseSlicing(ElementDefinitionSlicingComponent slice) {
    StringBuilder b = new StringBuilder();
    boolean first = true;
    for (ElementDefinitionSlicingDiscriminatorComponent d : slice.getDiscriminator()) {
        if (first)
            first = false;
        else
            b.append(", ");
        b.append(d);
    }
    b.append("(");
    if (slice.hasOrdered())
        b.append(slice.getOrderedElement().asStringValue());
    b.append("/");
    if (slice.hasRules())
        b.append(slice.getRules().toCode());
    b.append(")");
    if (slice.hasDescription()) {
        b.append(" \"");
        b.append(slice.getDescription());
        b.append("\"");
    }
    return b.toString();
}
Also used : ElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent) CommaSeparatedStringBuilder(org.hl7.fhir.utilities.CommaSeparatedStringBuilder)

Aggregations

CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)18 ElementDefinitionSlicingDiscriminatorComponent (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent)10 ElementDefinitionSlicingDiscriminatorComponent (org.hl7.fhir.r4b.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent)5 ElementDefinitionSlicingDiscriminatorComponent (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent)4 ElementDefinitionSlicingDiscriminatorComponent (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent)3 Coding (org.hl7.fhir.r4b.model.Coding)3 ElementDefinitionConstraintComponent (org.hl7.fhir.r4b.model.ElementDefinition.ElementDefinitionConstraintComponent)3 TypeRefComponent (org.hl7.fhir.r4b.model.ElementDefinition.TypeRefComponent)3 IdType (org.hl7.fhir.r4b.model.IdType)3 StringType (org.hl7.fhir.r4b.model.StringType)3 UriType (org.hl7.fhir.r4b.model.UriType)3 Coding (org.hl7.fhir.r4.model.Coding)2 ElementDefinitionConstraintComponent (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent)2 TypeRefComponent (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent)2 IdType (org.hl7.fhir.r4.model.IdType)2 StringType (org.hl7.fhir.r4.model.StringType)2 UriType (org.hl7.fhir.r4.model.UriType)2 Coding (org.hl7.fhir.r5.model.Coding)2 ElementDefinitionConstraintComponent (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionConstraintComponent)2 TypeRefComponent (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent)2