use of org.hl7.fhir.dstu2.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);
}
use of org.hl7.fhir.dstu2.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);
}
use of org.hl7.fhir.dstu2.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);
}
use of org.hl7.fhir.dstu2.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);
}
use of org.hl7.fhir.dstu2.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);
}
}
Aggregations