use of org.hl7.fhir.dstu2016may.model.StructureDefinition in project kindling by HL7.
the class Publisher method minifyProfile.
private void minifyProfile(StructureDefinition p) {
p.getContact().clear();
p.setDescriptionElement(null);
p.getKeyword().clear();
p.setPurposeElement(null);
p.getMapping().clear();
p.setDifferential(null);
for (ElementDefinition ed : p.getSnapshot().getElement()) {
ed.setShortElement(null);
ed.setDefinitionElement(null);
ed.setCommentElement(null);
ed.setRequirementsElement(null);
ed.getAlias().clear();
ed.setMeaningWhenMissingElement(null);
ed.getMapping().clear();
}
}
use of org.hl7.fhir.dstu2016may.model.StructureDefinition in project kindling by HL7.
the class Publisher method genPrimitiveTypeProfile.
private void genPrimitiveTypeProfile(DefinedStringPattern t) throws Exception {
StructureDefinition profile = new ProfileGenerator(page.getDefinitions(), page.getWorkerContext(), page, page.getGenDate(), page.getVersion(), dataElements, fpUsages, page.getFolders().rootDir, page.getUml(), page.getRc()).generate(t);
if (page.getProfiles().has(profile.getUrl()))
throw new Exception("Duplicate Profile URL " + profile.getUrl());
page.getProfiles().see(profile, page.packageInfo());
t.setProfile(profile);
// DataTypeTableGenerator dtg = new DataTypeTableGenerator(page.getFolders().dstDir, page, t.getCode(), true);
// t.setProfile(profile);
// t.getProfile().getText().setDiv(new XhtmlNode(NodeType.Element, "div"));
// t.getProfile().getText().getDiv().getChildNodes().add(dtg.generate(t));
}
use of org.hl7.fhir.dstu2016may.model.StructureDefinition in project kindling by HL7.
the class PageProcessor method produceDataTypeExtras.
private String produceDataTypeExtras(String tn, boolean profiles) {
int count = 0;
Map<String, StructureDefinition> map = new HashMap<String, StructureDefinition>();
for (StructureDefinition sd : workerContext.getExtensionDefinitions()) {
boolean inc = false;
for (StructureDefinitionContextComponent ec : sd.getContext()) {
if (ec.getType() == ExtensionContextType.ELEMENT) {
inc = inc || matchesType(tn, ec.getExpression());
}
}
if (inc)
map.put(sd.getId(), sd);
}
StringBuilder b = new StringBuilder();
b.append(" <tr><td colspan=\"3\"><b>Extensions</b> (+ see <a href=\"" + definitions.getElementExtrasLink() + "\">extensions on all Elements</a>)</td></tr>\r\n");
for (String s : sorted(map.keySet())) {
StructureDefinition cs = map.get(s);
count++;
b.append(" <tr>\r\n");
String ref = cs.getUserString("path");
b.append(" <td><a href=\"").append(ref).append("\">").append(Utilities.escapeXml(cs.getId())).append("</a></td>\r\n");
b.append(" <td>").append(Utilities.escapeXml(cs.getName())).append("</td>\r\n");
Profile ap = (Profile) cs.getUserData("profile");
if (ap == null)
b.append(" <td></td>\r\n");
else {
ImplementationGuideDefn ig = definitions.getIgs().get(ap.getCategory());
b.append(" <td>for <a href=\"" + ig.getPrefix() + ap.getId().toLowerCase() + ".html\">" + Utilities.escapeXml(ap.getTitle()) + "</a></td>\r\n");
}
b.append(" </tr>\r\n");
}
if (count == 0)
b.append("<tr><td>No Extensions defined for " + (tn.equals("primitives") ? "primitive types" : "this type") + " (though see <a href=\"element-extensions.html\">extensions on all Elements</a>)</td></tr>");
if (profiles) {
count = 0;
Map<String, CSPair> pmap = new HashMap<String, CSPair>();
for (Profile ap : definitions.getPackList()) {
for (ConstraintStructure cs : ap.getProfiles()) {
if (coversType(cs, tn))
pmap.put(cs.getTitle(), new CSPair(ap, cs));
}
}
b.append(" <tr><td colspan=\"3\"><b>Profiles</b></td></tr>\r\n");
for (String s : sorted(pmap.keySet())) {
CSPair cs = pmap.get(s);
ImplementationGuideDefn ig = definitions.getIgs().get(cs.p.getCategory());
count++;
b.append(" <tr>\r\n");
String ref = (ig.isCore() ? "" : ig.getCode() + File.separator) + cs.cs.getId() + ".html";
b.append(" <td><a href=\"").append(ref).append("\">").append(Utilities.escapeXml(cs.cs.getTitle())).append("</a></td>\r\n");
b.append(" <td>").append(Utilities.escapeXml(cs.p.getDescription())).append("</td>\r\n");
ref = (ig.isCore() ? "" : ig.getCode() + File.separator) + cs.p.getId().toLowerCase() + ".html";
b.append(" <td>for <a href=\"").append(ref).append("\">").append(Utilities.escapeXml(cs.p.getTitle())).append("</a></td>\r\n");
b.append(" </tr>\r\n");
}
if (count == 0)
b.append("<tr><td>No Profiles defined for for " + (tn.equals("primitives") ? "primitive types" : "this type") + "</td></tr>");
}
return b.toString();
}
use of org.hl7.fhir.dstu2016may.model.StructureDefinition in project kindling by HL7.
the class PageProcessor method genExtensionsTable.
private String genExtensionsTable() throws Exception {
StringBuilder s = new StringBuilder();
s.append("<table class=\"list\">\r\n");
s.append("<tr>");
s.append("<td><b>Identity</b></td>");
s.append("<td><b><a href=\"defining-extensions.html#cardinality\">Conf.</a></b></td>");
s.append("<td><b>Type</b></td>");
s.append("<td><b><a href=\"defining-extensions.html#context\">Context</a></b></td>");
s.append("<td><b><a href=\"versions.html#maturity\">FMM</a></b></td>");
s.append("</tr>");
List<String> names = new ArrayList<String>();
for (StructureDefinition sd : workerContext.getExtensionDefinitions()) names.add(sd.getUrl());
Collections.sort(names);
Set<StructureDefinition> processed = new HashSet<StructureDefinition>();
for (ImplementationGuideDefn ig : definitions.getSortedIgs()) {
// if (ig.isCore()) {
for (String n : names) {
StructureDefinition ed = workerContext.fetchResource(StructureDefinition.class, n);
if (!processed.contains(ed)) {
processed.add(ed);
// if (ig.getCode().equals(ToolResourceUtilities.getUsage(ed))) {
genExtensionRow(ig, s, ed);
// }
}
}
// }
}
s.append("</table>\r\n");
return s.toString();
}
use of org.hl7.fhir.dstu2016may.model.StructureDefinition in project kindling by HL7.
the class PageProcessor method genExampleProfileLink.
private String genExampleProfileLink(Resource resource) throws FHIRException {
if (resource == null || !(resource instanceof StructureDefinition))
return "";
StructureDefinition sd = (StructureDefinition) resource;
if (!sd.hasBaseDefinition())
return "";
String pack = "";
if (sd.hasUserData("pack")) {
Profile p = (Profile) sd.getUserData("pack");
ImplementationGuideDefn ig = definitions.getIgs().get(p.getCategory());
if (Utilities.noString(ig.getHomePage()))
pack = " (" + ig.getName() + "))";
else
pack = " (<a href=\"" + ig.getHomePage() + "\">" + ig.getName() + "</a>)";
if (!p.getTitle().equals(sd.getName()))
pack = " in <a href=\"" + p.getId().toLowerCase() + ".html\">" + p.getTitle() + "</a> " + pack;
}
if (sd.hasUserData("path"))
return "This example conforms to the <a href=\"" + sd.getUserData("path") + "\">profile " + (sd.getName()) + "</a>" + pack + ".";
else
return "This example conforms to the <a href=\"" + sd.getId().toLowerCase() + ".html\">profile " + (sd.getName()) + "</a>" + pack + ".";
}
Aggregations