use of org.hl7.fhir.dstu2016may.model.Base in project kindling by HL7.
the class Publisher method processProfiles.
@SuppressWarnings("unchecked")
private void processProfiles() throws Exception {
page.log(" ...process profiles (base)", LogMessageType.Process);
// first, for each type and resource, we build it's master profile
for (DefinedCode t : page.getDefinitions().getPrimitives().values()) {
if (t instanceof PrimitiveType)
genPrimitiveTypeProfile((PrimitiveType) t);
else
genPrimitiveTypeProfile((DefinedStringPattern) t);
}
genXhtmlProfile();
for (TypeDefn t : page.getDefinitions().getTypes().values()) genTypeProfile(t);
for (TypeDefn t : page.getDefinitions().getInfrastructure().values()) genTypeProfile(t);
page.log(" ...process profiles (resources)", LogMessageType.Process);
for (ResourceDefn r : page.getDefinitions().getBaseResources().values()) {
r.setConformancePack(makeConformancePack(r));
r.setProfile(new ProfileGenerator(page.getDefinitions(), page.getWorkerContext(), page, page.getGenDate(), page.getVersion(), dataElements, fpUsages, page.getFolders().rootDir, page.getUml(), page.getRc()).generate(r.getConformancePack(), r, "core", false));
if (page.getProfiles().has(r.getProfile().getUrl()))
throw new Exception("Duplicate Profile URL " + r.getProfile().getUrl());
page.getProfiles().see(r.getProfile(), page.packageInfo());
ResourceTableGenerator rtg = new ResourceTableGenerator(page.getFolders().dstDir, page, null, true, page.getVersion());
r.getProfile().getText().setDiv(new XhtmlNode(NodeType.Element, "div"));
r.getProfile().getText().getDiv().getChildNodes().add(rtg.generate(r, "", false));
}
for (String rn : page.getDefinitions().sortedResourceNames()) {
ResourceDefn r = page.getDefinitions().getResourceByName(rn);
r.setConformancePack(makeConformancePack(r));
r.setProfile(new ProfileGenerator(page.getDefinitions(), page.getWorkerContext(), page, page.getGenDate(), page.getVersion(), dataElements, fpUsages, page.getFolders().rootDir, page.getUml(), page.getRc()).generate(r.getConformancePack(), r, "core", false));
if (page.getProfiles().has(r.getProfile().getUrl()))
throw new Exception("Duplicate Profile URL " + r.getProfile().getUrl());
page.getProfiles().see(r.getProfile(), page.packageInfo());
ResourceTableGenerator rtg = new ResourceTableGenerator(page.getFolders().dstDir, page, null, true, page.getVersion());
r.getProfile().getText().setDiv(new XhtmlNode(NodeType.Element, "div"));
r.getProfile().getText().getDiv().getChildNodes().add(rtg.generate(r, "", false));
}
for (ResourceDefn r : page.getDefinitions().getResourceTemplates().values()) {
r.setConformancePack(makeConformancePack(r));
r.setProfile(new ProfileGenerator(page.getDefinitions(), page.getWorkerContext(), page, page.getGenDate(), page.getVersion(), dataElements, fpUsages, page.getFolders().rootDir, page.getUml(), page.getRc()).generate(r.getConformancePack(), r, "core", true));
ResourceTableGenerator rtg = new ResourceTableGenerator(page.getFolders().dstDir, page, null, true, page.getVersion());
r.getProfile().getText().setDiv(new XhtmlNode(NodeType.Element, "div"));
r.getProfile().getText().getDiv().getChildNodes().add(rtg.generate(r, "", true));
if (page.getProfiles().has(r.getProfile().getUrl()))
throw new Exception("Duplicate Profile URL " + r.getProfile().getUrl());
page.getProfiles().see(r.getProfile(), page.packageInfo());
}
for (ProfiledType pt : page.getDefinitions().getConstraints().values()) {
genProfiledTypeProfile(pt);
}
page.log(" ...process profiles (extensions)", LogMessageType.Process);
for (StructureDefinition ex : page.getWorkerContext().getExtensionDefinitions()) processExtension(ex);
for (ResourceDefn r : page.getDefinitions().getResources().values()) {
// boolean logged = false;
for (Profile ap : r.getConformancePackages()) {
// logged = true;
for (ConstraintStructure p : ap.getProfiles()) processProfile(ap, p, ap.getId(), r);
}
}
page.log(" ...process profiles (packs)", LogMessageType.Process);
// we have profiles scoped by resources, and stand alone profiles
for (Profile ap : page.getDefinitions().getPackList()) {
// page.log(" ... pack "+ap.getId(), LogMessageType.Process);
for (ConstraintStructure p : ap.getProfiles()) processProfile(ap, p, ap.getId(), null);
}
page.log(" ...process logical models", LogMessageType.Process);
for (ImplementationGuideDefn ig : page.getDefinitions().getSortedIgs()) {
for (LogicalModel lm : ig.getLogicalModels()) {
page.log(" ...process logical model " + lm.getId(), LogMessageType.Process);
if (lm.getDefinition() == null)
lm.setDefinition(new ProfileGenerator(page.getDefinitions(), page.getWorkerContext(), page, page.getGenDate(), page.getVersion(), dataElements, fpUsages, page.getFolders().rootDir, page.getUml(), page.getRc()).generateLogicalModel(ig, lm.getResource()));
}
}
// now, validate the profiles
for (Profile ap : page.getDefinitions().getPackList()) for (ConstraintStructure p : ap.getProfiles()) validateProfile(p);
for (ResourceDefn r : page.getDefinitions().getResources().values()) for (Profile ap : r.getConformancePackages()) for (ConstraintStructure p : ap.getProfiles()) validateProfile(p);
page.log(" ...Check FHIR Path Expressions", LogMessageType.Process);
StringBuilder b = new StringBuilder();
FHIRPathEngine fp = new FHIRPathEngine(page.getWorkerContext());
fp.setHostServices(page.getExpressionResolver());
for (FHIRPathUsage p : fpUsages) {
checkExpression(b, fp, p);
}
TextFile.stringToFile(b.toString(), Utilities.path(page.getFolders().dstDir, "fhirpaths.txt"));
checkAllOk();
}
use of org.hl7.fhir.dstu2016may.model.Base in project kindling by HL7.
the class Publisher method makeConformancePack.
private Profile makeConformancePack(ResourceDefn r) {
Profile result = new Profile("core");
result.setTitle("Base Profile for " + r.getName());
return result;
}
use of org.hl7.fhir.dstu2016may.model.Base in project kindling by HL7.
the class PageProcessor method cdHeader.
private String cdHeader(String mode) {
StringBuilder b = new StringBuilder();
b.append("<ul class=\"nav nav-tabs\">");
b.append(makeHeaderTab("Contact Detail", "contactdetail.html", mode == null || "base".equals(mode)));
b.append(makeHeaderTab("Examples", "contactdetail-examples.html", mode == null || "examples".equals(mode)));
b.append(makeHeaderTab("Detailed Descriptions", "contactdetail-definitions.html", mode == null || "definitions".equals(mode)));
b.append(makeHeaderTab("Mappings", "contactdetail-mappings.html", mode == null || "mappings".equals(mode)));
b.append("</ul>\r\n");
return b.toString();
}
use of org.hl7.fhir.dstu2016may.model.Base in project kindling by HL7.
the class PageProcessor method extHeader.
private String extHeader(String mode) {
StringBuilder b = new StringBuilder();
b.append("<ul class=\"nav nav-tabs\">");
b.append(makeHeaderTab("Extensibility", "extensibility.html", mode == null || "base".equals(mode)));
b.append(makeHeaderTab("Defining Extensions", "defining-extensions.html", mode == null || "defining".equals(mode)));
b.append(makeHeaderTab("Examples", "extensibility-examples.html", mode == null || "examples".equals(mode)));
b.append(makeHeaderTab("Detailed Descriptions", "extensibility-definitions.html", mode == null || "definitions".equals(mode)));
b.append(makeHeaderTab("Registry", "extensibility-registry.html", mode == null || "registry".equals(mode)));
b.append("</ul>\r\n");
return b.toString();
}
use of org.hl7.fhir.dstu2016may.model.Base in project kindling by HL7.
the class PageProcessor method ordistHeader.
private String ordistHeader(String mode) {
StringBuilder b = new StringBuilder();
b.append("<ul class=\"nav nav-tabs\">");
b.append(makeHeaderTab("OrderedDistribution", "ordereddistribution.html", mode == null || "base".equals(mode)));
b.append(makeHeaderTab("Examples", "ordereddistribution-examples.html", mode == null || "examples".equals(mode)));
b.append(makeHeaderTab("Detailed Descriptions", "ordereddistribution-definitions.html", mode == null || "definitions".equals(mode)));
b.append(makeHeaderTab("Mappings", "ordereddistribution-mappings.html", mode == null || "mappings".equals(mode)));
b.append("</ul>\r\n");
return b.toString();
}
Aggregations