use of org.hl7.fhir.r5.model.Base in project kindling by HL7.
the class PageProcessor method elHeader.
private String elHeader(String mode) {
StringBuilder b = new StringBuilder();
b.append("<ul class=\"nav nav-tabs\">");
b.append(makeHeaderTab("Element", "element.html", mode == null || "base".equals(mode)));
b.append(makeHeaderTab("Detailed Descriptions", "element-definitions.html", mode == null || "definitions".equals(mode)));
b.append(makeHeaderTab("Extensions", "element-extras.html", mode == null || "extensions".equals(mode)));
b.append("</ul>\r\n");
return b.toString();
}
use of org.hl7.fhir.r5.model.Base in project kindling by HL7.
the class Publisher method getIgProfile.
public StructureDefinition getIgProfile(String base) throws Exception {
String[] parts = base.split("#");
StructureDefinition p = getIGProfileByURL(parts[0]);
if (p == null)
return null;
// this is recursive, but will terminate at the root
processProfile(p);
if (parts.length == 1) {
if (p.getSnapshot() == null)
// or else we could fill it in?
throw new Exception("StructureDefinition " + base + " has no snapshot");
return p;
}
for (Resource r : p.getContained()) {
if (r instanceof StructureDefinition && r.getId().equals(parts[1])) {
StructureDefinition pc = (StructureDefinition) r;
if (pc.getSnapshot() == null) {
StructureDefinition ps = getSnapShotForProfile(pc.getBaseDefinition());
processProfile(pc);
}
return pc;
}
}
throw new Exception("Unable to find snapshot for " + base);
}
use of org.hl7.fhir.r5.model.Base in project kindling by HL7.
the class Publisher method processProfile.
private void processProfile(Profile ap, ConstraintStructure profile, String filename, ResourceDefn baseResource) throws Exception {
// create StructureDefinition structures if needed (create differential definitions from spreadsheets)
if (profile.getResource() == null) {
StructureDefinition p = new ProfileGenerator(page.getDefinitions(), page.getWorkerContext(), page, page.getGenDate(), page.getVersion(), dataElements, fpUsages, page.getFolders().rootDir, page.getUml(), page.getRc()).generate(ap, profile, profile.getDefn(), profile.getId(), profile.getUsage(), page.getValidationErrors(), baseResource);
p.setUserData("pack", ap);
profile.setResource(p);
if (profile.getResourceInfo() != null) {
profile.getResourceInfo().setUserData(ToolResourceUtilities.RES_ACTUAL_RESOURCE, p);
}
if (page.getProfiles().has(p.getUrl()))
throw new Exception("Duplicate Profile URL " + p.getUrl());
page.getProfiles().see(p, page.packageInfo());
} else {
profile.getResource().setUserData("pack", ap);
sortProfile(profile.getResource());
for (ElementDefinition ed : profile.getResource().getDifferential().getElement()) if (!ed.hasId())
throw new Exception("Missing ID");
// special case: if the profile itself doesn't claim a date, it's date is the date of this publication
if (!profile.getResource().hasDate())
profile.getResource().setDate(page.getGenDate().getTime());
if (profile.getResource().hasBaseDefinition() && !profile.getResource().hasSnapshot()) {
// cause it probably doesn't, coming from the profile directly
StructureDefinition base = getSnapShotForProfile(profile.getResource().getBaseDefinition());
new ProfileUtilities(page.getWorkerContext(), page.getValidationErrors(), page).generateSnapshot(base, profile.getResource(), profile.getResource().getBaseDefinition().split("#")[0], "http://hl7.org/fhir", profile.getResource().getName());
}
if (page.getProfiles().has(profile.getResource().getUrl()))
throw new Exception("Duplicate Profile URL " + profile.getResource().getUrl());
System.out.println("register " + profile.getResource().getUrl());
page.getProfiles().see(profile.getResource(), page.packageInfo());
}
if (!Utilities.noString(filename))
profile.getResource().setUserData("filename", filename + ".html");
if (Utilities.noString(profile.getResource().getUserString("path"))) {
String path = "";
ImplementationGuideDefn ig = page.getDefinitions().getUsageIG(ap.getCategory(), "processProfile");
if (ig != null && !ig.isCore())
path = ig.getCode() + File.separator;
profile.getResource().setUserData("path", path + filename + ".html");
}
}
use of org.hl7.fhir.r5.model.Base in project kindling by HL7.
the class PageProcessor method refHeader.
private String refHeader(String mode) {
StringBuilder b = new StringBuilder();
b.append("<ul class=\"nav nav-tabs\">");
b.append(makeHeaderTab("References", "references.html", mode == null || "base".equals(mode)));
b.append(makeHeaderTab("Detailed Descriptions", "references-definitions.html", mode == null || "definitions".equals(mode)));
b.append("</ul>\r\n");
return b.toString();
}
use of org.hl7.fhir.r5.model.Base in project kindling by HL7.
the class PageProcessor method resourcesHeader.
private String resourcesHeader(String mode) {
StringBuilder b = new StringBuilder();
b.append("<ul class=\"nav nav-tabs\">");
b.append(makeHeaderTab("Resource Definitions", "resource.html", mode == null || "base".equals(mode)));
b.append(makeHeaderTab("Examples", "resources-examples.html", mode == null || "examples".equals(mode)));
b.append(makeHeaderTab("Detailed Descriptions", "resources-definitions.html", mode == null || "definitions".equals(mode)));
b.append("</ul>\r\n");
return b.toString();
}
Aggregations