Search in sources :

Example 41 with UriType

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

the class DataElement method setProperty.

@Override
public void setProperty(String name, Base value) throws FHIRException {
    if (name.equals("url"))
        // UriType
        this.url = castToUri(value);
    else if (name.equals("identifier"))
        this.getIdentifier().add(castToIdentifier(value));
    else if (name.equals("version"))
        // StringType
        this.version = castToString(value);
    else if (name.equals("name"))
        // StringType
        this.name = castToString(value);
    else if (name.equals("status"))
        // Enumeration<ConformanceResourceStatus>
        this.status = new ConformanceResourceStatusEnumFactory().fromType(value);
    else if (name.equals("experimental"))
        // BooleanType
        this.experimental = castToBoolean(value);
    else if (name.equals("publisher"))
        // StringType
        this.publisher = castToString(value);
    else if (name.equals("contact"))
        this.getContact().add((DataElementContactComponent) value);
    else if (name.equals("date"))
        // DateTimeType
        this.date = castToDateTime(value);
    else if (name.equals("useContext"))
        this.getUseContext().add(castToCodeableConcept(value));
    else if (name.equals("copyright"))
        // StringType
        this.copyright = castToString(value);
    else if (name.equals("stringency"))
        // Enumeration<DataElementStringency>
        this.stringency = new DataElementStringencyEnumFactory().fromType(value);
    else if (name.equals("mapping"))
        this.getMapping().add((DataElementMappingComponent) value);
    else if (name.equals("element"))
        this.getElement().add(castToElementDefinition(value));
    else
        super.setProperty(name, value);
}
Also used : ConformanceResourceStatusEnumFactory(org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatusEnumFactory)

Example 42 with UriType

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

the class DocumentManifest method setProperty.

@Override
public void setProperty(String name, Base value) throws FHIRException {
    if (name.equals("masterIdentifier"))
        // Identifier
        this.masterIdentifier = castToIdentifier(value);
    else if (name.equals("identifier"))
        this.getIdentifier().add(castToIdentifier(value));
    else if (name.equals("subject"))
        // Reference
        this.subject = castToReference(value);
    else if (name.equals("recipient"))
        this.getRecipient().add(castToReference(value));
    else if (name.equals("type"))
        // CodeableConcept
        this.type = castToCodeableConcept(value);
    else if (name.equals("author"))
        this.getAuthor().add(castToReference(value));
    else if (name.equals("created"))
        // DateTimeType
        this.created = castToDateTime(value);
    else if (name.equals("source"))
        // UriType
        this.source = castToUri(value);
    else if (name.equals("status"))
        // Enumeration<DocumentReferenceStatus>
        this.status = new DocumentReferenceStatusEnumFactory().fromType(value);
    else if (name.equals("description"))
        // StringType
        this.description = castToString(value);
    else if (name.equals("content"))
        this.getContent().add((DocumentManifestContentComponent) value);
    else if (name.equals("related"))
        this.getRelated().add((DocumentManifestRelatedComponent) value);
    else
        super.setProperty(name, value);
}
Also used : DocumentReferenceStatusEnumFactory(org.hl7.fhir.dstu2.model.Enumerations.DocumentReferenceStatusEnumFactory)

Example 43 with UriType

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

the class ProfileUtilities method generateSlicer.

private Slicer generateSlicer(ElementDefinition child, ElementDefinitionSlicingComponent slicing, StructureDefinition structure) {
    // given a child in a structure, it's sliced. figure out the slicing xpath
    if (child.getPath().endsWith(".extension")) {
        ElementDefinition ued = getUrlFor(structure, child);
        if ((ued == null || !ued.hasFixed()) && !(child.getType().get(0).hasProfile()))
            return new Slicer(false);
        else {
            Slicer s = new Slicer(true);
            String url = (ued == null || !ued.hasFixed()) ? child.getType().get(0).getProfile().get(0).asStringValue() : ((UriType) ued.getFixed()).asStringValue();
            s.name = " with URL = '" + url + "'";
            s.criteria = "[@url = '" + url + "']";
            return s;
        }
    } else
        return new Slicer(false);
}
Also used : ElementDefinition(org.hl7.fhir.dstu2.model.ElementDefinition)

Example 44 with UriType

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

the class ProfileUtilities method generateExtensionTable.

public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, Set<String> outputTracker) throws IOException, FHIRException {
    HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics);
    TableModel model = gen.initNormalTable(corePath, false, true, ed.getId(), false);
    boolean deep = false;
    boolean vdeep = false;
    for (ElementDefinition eld : ed.getSnapshot().getElement()) {
        deep = deep || eld.getPath().contains("Extension.extension.");
        vdeep = vdeep || eld.getPath().contains("Extension.extension.extension.");
    }
    Row r = gen.new Row();
    model.getRows().add(r);
    r.getCells().add(gen.new Cell(null, defFile == null ? "" : defFile + "-definitions.html#extension." + ed.getName(), ed.getSnapshot().getElement().get(0).getIsModifier() ? "modifierExtension" : "extension", null, null));
    r.getCells().add(gen.new Cell());
    r.getCells().add(gen.new Cell(null, null, describeCardinality(ed.getSnapshot().getElement().get(0), null, new UnusedTracker()), null, null));
    if (full || vdeep) {
        r.getCells().add(gen.new Cell("", "", "Extension", null, null));
        r.setIcon(deep ? "icon_extension_complex.png" : "icon_extension_simple.png", deep ? HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX : HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE);
        List<ElementDefinition> children = getChildren(ed.getSnapshot().getElement(), ed.getSnapshot().getElement().get(0));
        for (ElementDefinition child : children) if (!child.getPath().endsWith(".id"))
            genElement(defFile == null ? "" : defFile + "-definitions.html#extension.", gen, r.getSubRows(), child, ed.getSnapshot().getElement(), null, true, defFile, true, full, corePath);
    } else if (deep) {
        List<ElementDefinition> children = new ArrayList<ElementDefinition>();
        for (ElementDefinition ted : ed.getSnapshot().getElement()) {
            if (ted.getPath().equals("Extension.extension"))
                children.add(ted);
        }
        r.getCells().add(gen.new Cell("", "", "Extension", null, null));
        r.setIcon("icon_extension_complex.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX);
        for (ElementDefinition c : children) {
            ElementDefinition ved = getValueFor(ed, c);
            ElementDefinition ued = getUrlFor(ed, c);
            if (ved != null && ued != null) {
                Row r1 = gen.new Row();
                r.getSubRows().add(r1);
                r1.getCells().add(gen.new Cell(null, defFile == null ? "" : defFile + "-definitions.html#extension." + ed.getName(), ((UriType) ued.getFixed()).getValue(), null, null));
                r1.getCells().add(gen.new Cell());
                r1.getCells().add(gen.new Cell(null, null, describeCardinality(c, null, new UnusedTracker()), null, null));
                genTypes(gen, r1, ved, defFile, ed, corePath);
                r1.getCells().add(gen.new Cell(null, null, c.getDefinition(), null, null));
                r1.setIcon("icon_extension_simple.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE);
            }
        }
    } else {
        ElementDefinition ved = null;
        for (ElementDefinition ted : ed.getSnapshot().getElement()) {
            if (ted.getPath().startsWith("Extension.value"))
                ved = ted;
        }
        genTypes(gen, r, ved, defFile, ed, corePath);
        r.setIcon("icon_extension_simple.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE);
    }
    Cell c = gen.new Cell("", "", "URL = " + ed.getUrl(), null, null);
    c.addPiece(gen.new Piece("br")).addPiece(gen.new Piece(null, ed.getName() + ": " + ed.getDescription(), null));
    c.addPiece(gen.new Piece("br")).addPiece(gen.new Piece(null, describeExtensionContext(ed), null));
    r.getCells().add(c);
    return gen.generate(model, corePath, 0, outputTracker);
}
Also used : Piece(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Piece) HierarchicalTableGenerator(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator) List(java.util.List) ArrayList(java.util.ArrayList) ElementDefinition(org.hl7.fhir.dstu2.model.ElementDefinition) Row(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row) Cell(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell) TableModel(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel)

Example 45 with UriType

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

the class ProfileUtilities method generateExtensionTable.

public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, Set<String> outputTracker) throws IOException, FHIRException {
    HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics);
    TableModel model = gen.initNormalTable(corePath, false, true, ed.getId(), false);
    boolean deep = false;
    boolean vdeep = false;
    for (ElementDefinition eld : ed.getSnapshot().getElement()) {
        deep = deep || eld.getPath().contains("Extension.extension.");
        vdeep = vdeep || eld.getPath().contains("Extension.extension.extension.");
    }
    Row r = gen.new Row();
    model.getRows().add(r);
    r.getCells().add(gen.new Cell(null, defFile == null ? "" : defFile + "-definitions.html#extension." + ed.getName(), ed.getSnapshot().getElement().get(0).getIsModifier() ? "modifierExtension" : "extension", null, null));
    r.getCells().add(gen.new Cell());
    r.getCells().add(gen.new Cell(null, null, describeCardinality(ed.getSnapshot().getElement().get(0), null, new UnusedTracker()), null, null));
    if (full || vdeep) {
        r.getCells().add(gen.new Cell("", "", "Extension", null, null));
        r.setIcon(deep ? "icon_extension_complex.png" : "icon_extension_simple.png", deep ? HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX : HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE);
        List<ElementDefinition> children = getChildren(ed.getSnapshot().getElement(), ed.getSnapshot().getElement().get(0));
        for (ElementDefinition child : children) if (!child.getPath().endsWith(".id"))
            genElement(defFile == null ? "" : defFile + "-definitions.html#extension.", gen, r.getSubRows(), child, ed.getSnapshot().getElement(), null, true, defFile, true, full, corePath, true, false);
    } else if (deep) {
        List<ElementDefinition> children = new ArrayList<ElementDefinition>();
        for (ElementDefinition ted : ed.getSnapshot().getElement()) {
            if (ted.getPath().equals("Extension.extension"))
                children.add(ted);
        }
        r.getCells().add(gen.new Cell("", "", "Extension", null, null));
        r.setIcon("icon_extension_complex.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX);
        for (ElementDefinition c : children) {
            ElementDefinition ved = getValueFor(ed, c);
            ElementDefinition ued = getUrlFor(ed, c);
            if (ved != null && ued != null) {
                Row r1 = gen.new Row();
                r.getSubRows().add(r1);
                r1.getCells().add(gen.new Cell(null, defFile == null ? "" : defFile + "-definitions.html#extension." + ed.getName(), ((UriType) ued.getFixed()).getValue(), null, null));
                r1.getCells().add(gen.new Cell());
                r1.getCells().add(gen.new Cell(null, null, describeCardinality(c, null, new UnusedTracker()), null, null));
                genTypes(gen, r1, ved, defFile, ed, corePath);
                r1.getCells().add(gen.new Cell(null, null, c.getDefinition(), null, null));
                r1.setIcon("icon_extension_simple.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE);
            }
        }
    } else {
        ElementDefinition ved = null;
        for (ElementDefinition ted : ed.getSnapshot().getElement()) {
            if (ted.getPath().startsWith("Extension.value"))
                ved = ted;
        }
        genTypes(gen, r, ved, defFile, ed, corePath);
        r.setIcon("icon_extension_simple.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE);
    }
    Cell c = gen.new Cell("", "", "URL = " + ed.getUrl(), null, null);
    c.addPiece(gen.new Piece("br")).addPiece(gen.new Piece(null, ed.getName() + ": " + ed.getDescription(), null));
    c.addPiece(gen.new Piece("br")).addPiece(gen.new Piece(null, describeExtensionContext(ed), null));
    r.getCells().add(c);
    try {
        return gen.generate(model, corePath, 0, outputTracker);
    } catch (org.hl7.fhir.exceptions.FHIRException e) {
        throw new FHIRException(e.getMessage(), e);
    }
}
Also used : HierarchicalTableGenerator(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator) FHIRException(org.hl7.fhir.exceptions.FHIRException) Piece(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Piece) List(java.util.List) ArrayList(java.util.ArrayList) FHIRException(org.hl7.fhir.exceptions.FHIRException) ElementDefinition(org.hl7.fhir.dstu2016may.model.ElementDefinition) Row(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row) Cell(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell) TableModel(org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel)

Aggregations

FHIRException (org.hl7.fhir.exceptions.FHIRException)60 UriType (org.hl7.fhir.r5.model.UriType)45 ArrayList (java.util.ArrayList)42 UriType (org.hl7.fhir.r4.model.UriType)41 UriType (org.hl7.fhir.r4b.model.UriType)29 UriType (org.hl7.fhir.dstu3.model.UriType)26 CommaSeparatedStringBuilder (org.hl7.fhir.utilities.CommaSeparatedStringBuilder)24 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)22 ElementDefinition (org.hl7.fhir.r5.model.ElementDefinition)19 List (java.util.List)17 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)16 NotImplementedException (org.apache.commons.lang3.NotImplementedException)15 TypeRefComponent (org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent)14 UriType (org.hl7.fhir.dstu2016may.model.UriType)12 FHIRFormatError (org.hl7.fhir.exceptions.FHIRFormatError)12 Coding (org.hl7.fhir.r4.model.Coding)12 IOException (java.io.IOException)11 StringType (org.hl7.fhir.r4.model.StringType)10 org.hl7.fhir.r5.model (org.hl7.fhir.r5.model)10 StringType (org.hl7.fhir.r5.model.StringType)10