use of org.hl7.fhir.dstu2016may.model.DataElement in project org.hl7.fhir.core by hapifhir.
the class ResourceUtilities method renderDE.
private static void renderDE(DataElement de, List<String> cols, StringBuilder b, boolean profileLink, String linkBase) {
b.append("<tr>");
for (String col : cols) {
String v;
ElementDefinition dee = de.getElement().get(0);
if (col.equals("DataElement.name")) {
v = de.hasName() ? Utilities.escapeXml(de.getName()) : "";
} else if (col.equals("DataElement.status")) {
v = de.hasStatusElement() ? de.getStatusElement().asStringValue() : "";
} else if (col.equals("DataElement.code")) {
v = renderCoding(dee.getCode());
} else if (col.equals("DataElement.type")) {
v = dee.hasType() ? Utilities.escapeXml(dee.getType().get(0).getCode()) : "";
} else if (col.equals("DataElement.units")) {
v = renderDEUnits(ToolingExtensions.getAllowedUnits(dee));
} else if (col.equals("DataElement.binding")) {
v = renderBinding(dee.getBinding());
} else if (col.equals("DataElement.minValue")) {
v = ToolingExtensions.hasExtension(de, "http://hl7.org/fhir/StructureDefinition/minValue") ? Utilities.escapeXml(ToolingExtensions.readPrimitiveExtension(de, "http://hl7.org/fhir/StructureDefinition/minValue").asStringValue()) : "";
} else if (col.equals("DataElement.maxValue")) {
v = ToolingExtensions.hasExtension(de, "http://hl7.org/fhir/StructureDefinition/maxValue") ? Utilities.escapeXml(ToolingExtensions.readPrimitiveExtension(de, "http://hl7.org/fhir/StructureDefinition/maxValue").asStringValue()) : "";
} else if (col.equals("DataElement.maxLength")) {
v = ToolingExtensions.hasExtension(de, "http://hl7.org/fhir/StructureDefinition/maxLength") ? Utilities.escapeXml(ToolingExtensions.readPrimitiveExtension(de, "http://hl7.org/fhir/StructureDefinition/maxLength").asStringValue()) : "";
} else if (col.equals("DataElement.mask")) {
v = ToolingExtensions.hasExtension(de, "http://hl7.org/fhir/StructureDefinition/mask") ? Utilities.escapeXml(ToolingExtensions.readPrimitiveExtension(de, "http://hl7.org/fhir/StructureDefinition/mask").asStringValue()) : "";
} else
throw new Error("Unknown column name: " + col);
b.append("<td>" + v + "</td>");
}
if (profileLink) {
b.append("<td><a href=\"" + linkBase + "-" + de.getId() + ".html\">Profile</a>, <a href=\"http://www.opencem.org/#/20140917/Intermountain/" + de.getId() + "\">CEM</a>");
if (ToolingExtensions.hasExtension(de, ToolingExtensions.EXT_CIMI_REFERENCE))
b.append(", <a href=\"" + ToolingExtensions.readStringExtension(de, ToolingExtensions.EXT_CIMI_REFERENCE) + "\">CIMI</a>");
b.append("</td>");
}
b.append("</tr>\r\n");
}
use of org.hl7.fhir.dstu2016may.model.DataElement in project org.hl7.fhir.core by hapifhir.
the class ResourceUtilities method representDataElementCollection.
public static String representDataElementCollection(IWorkerContext context, Bundle bundle, boolean profileLink, String linkBase) {
StringBuilder b = new StringBuilder();
DataElement common = showDECHeader(b, bundle);
b.append("<table class=\"grid\">\r\n");
List<String> cols = chooseColumns(bundle, common, b, profileLink);
for (BundleEntryComponent e : bundle.getEntry()) {
DataElement de = (DataElement) e.getResource();
renderDE(de, cols, b, profileLink, linkBase);
}
b.append("</table>\r\n");
return b.toString();
}
Aggregations