Search in sources :

Example 21 with ElementDefinitionSlicingDiscriminatorComponent

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

the class CSVWriter method itemList.

private String itemList(List l) {
    StringBuilder s = new StringBuilder();
    for (int i = 0; i < l.size(); i++) {
        Object o = l.get(i);
        String val = "";
        if (o instanceof StringType) {
            val = ((StringType) o).getValue();
        } else if (o instanceof UriType) {
            val = ((UriType) o).getValue();
        } else if (o instanceof IdType) {
            val = ((IdType) o).getValue();
        } else if (o instanceof Enumeration<?>) {
            val = o.toString();
        } else if (o instanceof TypeRefComponent) {
            TypeRefComponent t = (TypeRefComponent) o;
            val = t.getWorkingCode() + (t.getProfile() == null ? "" : " {" + t.getProfile() + "}") + (t.getTargetProfile() == null ? "" : " {" + t.getTargetProfile() + "}") + (t.getAggregation() == null || t.getAggregation().isEmpty() ? "" : " (" + itemList(t.getAggregation()) + ")");
        } else if (o instanceof Coding) {
            Coding t = (Coding) o;
            val = (t.getSystem() == null ? "" : t.getSystem()) + (t.getCode() == null ? "" : "#" + t.getCode()) + (t.getDisplay() == null ? "" : " (" + t.getDisplay() + ")");
        } else if (o instanceof ElementDefinitionConstraintComponent) {
            ElementDefinitionConstraintComponent c = (ElementDefinitionConstraintComponent) o;
            val = c.getKey() + ":" + c.getHuman() + " {" + c.getExpression() + "}";
        } else if (o instanceof ElementDefinitionSlicingDiscriminatorComponent) {
            ElementDefinitionSlicingDiscriminatorComponent c = (ElementDefinitionSlicingDiscriminatorComponent) o;
            val = c.getType().toCode() + ":" + c.getPath() + "}";
        } else {
            val = o.toString();
            val = val.substring(val.indexOf("[") + 1);
            val = val.substring(0, val.indexOf("]"));
        }
        s = s.append(val);
        if (i == 0)
            s.append("\n");
    }
    return s.toString();
}
Also used : ElementDefinitionSlicingDiscriminatorComponent(org.hl7.fhir.r4b.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent) StringType(org.hl7.fhir.r4b.model.StringType) TypeRefComponent(org.hl7.fhir.r4b.model.ElementDefinition.TypeRefComponent) Coding(org.hl7.fhir.r4b.model.Coding) ElementDefinitionConstraintComponent(org.hl7.fhir.r4b.model.ElementDefinition.ElementDefinitionConstraintComponent) UriType(org.hl7.fhir.r4b.model.UriType) IdType(org.hl7.fhir.r4b.model.IdType)

Example 22 with ElementDefinitionSlicingDiscriminatorComponent

use of org.hl7.fhir.r4b.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.r5.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