use of org.hl7.fhir.definitions.model.ImplementationGuideDefn in project kindling by HL7.
the class PageProcessor method processProfileIncludes.
public String processProfileIncludes(String filename, String fileid, Profile pack, ConstraintStructure profile, String xml, String json, String tx, String src, String master, String path, String intro, String notes, ImplementationGuideDefn ig, boolean isDict, boolean hasNarrative) throws Exception {
String workingTitle = null;
int level = (ig == null || ig.isCore()) ? 0 : 1;
while (src.contains("<%") || src.contains("[%")) {
int i1 = src.indexOf("<%");
int i2 = src.indexOf("%>");
if (i1 == -1) {
i1 = src.indexOf("[%");
i2 = src.indexOf("%]");
}
String s1 = src.substring(0, i1);
String s2 = src.substring(i1 + 2, i2).trim();
String s3 = src.substring(i2 + 2);
String[] com = s2.split(" ");
if (com[0].equals("profileheader"))
src = s1 + profileHeader(fileid, com.length > 1 ? com[1] : "", hasExamples(pack)) + s3;
else if (com[0].equals("file")) {
if (new File(folders.templateDir + com[1] + ".html").exists()) {
src = s1 + TextFile.fileToString(folders.templateDir + com[1] + ".html") + s3;
} else {
src = s1 + TextFile.fileToString(folders.srcDir + com[1] + ".html") + s3;
}
} else if (com[0].equals("settitle")) {
workingTitle = s2.substring(9).replace("{", "<%").replace("}", "%>");
src = s1 + s3;
} else if (com.length != 1)
throw new Exception("Instruction <%" + s2 + "%> not understood parsing resource " + filename);
else if (com[0].equals("pageheader"))
src = s1 + pageHeader(pack.metadata("name")) + s3;
else if (com[0].equals("level"))
src = s1 + genlevel(level) + s3;
else if (com[0].equals("newheader"))
src = s1 + TextFile.fileToString(folders.srcDir + "newheader.html") + s3;
else if (com[0].equals("newheader1"))
src = s1 + TextFile.fileToString(folders.srcDir + "newheader1.html") + s3;
else if (com[0].equals("footer"))
src = s1 + TextFile.fileToString(folders.srcDir + "footer.html") + s3;
else if (com[0].equals("newfooter"))
src = s1 + TextFile.fileToString(folders.srcDir + "newfooter.html") + s3;
else if (com[0].equals("footer1"))
src = s1 + TextFile.fileToString(folders.srcDir + "footer1.html") + s3;
else if (com[0].equals("footer2"))
src = s1 + TextFile.fileToString(folders.srcDir + "footer2.html") + s3;
else if (com[0].equals("footer3"))
src = s1 + TextFile.fileToString(folders.srcDir + "footer3.html") + s3;
else if (com[0].equals("title"))
src = s1 + (workingTitle == null ? Utilities.escapeXml("StructureDefinition: " + profile.getTitle()) : workingTitle) + s3;
else if (com[0].equals("xtitle"))
src = s1 + (workingTitle == null ? Utilities.escapeXml("StructureDefinition: " + profile.getTitle()) : Utilities.escapeXml(workingTitle)) + s3;
else if (com[0].equals("profiletitle"))
src = s1 + Utilities.escapeXml(pack.metadata("name")) + s3;
else if (com[0].equals("filetitle"))
src = s1 + (filename.contains(".") ? filename.substring(0, filename.lastIndexOf(".")) : filename) + s3;
else if (com[0].equals("name"))
src = s1 + filename + s3;
else if (com[0].equals("date")) {
if (!Utilities.noString(pack.metadata("date"))) {
Date d = new SimpleDateFormat("yyyy-MM-dd").parse(pack.metadata("date"));
src = s1 + Config.DATE_FORMAT().format(d) + s3;
} else
src = s1 + "[no date]" + s3;
} else if (com[0].equals("version"))
src = s1 + ini.getStringProperty("FHIR", "version") + s3;
else if (com[0].equals("gendate"))
src = s1 + Config.DATE_FORMAT().format(new Date()) + s3;
else if (com[0].equals("definition"))
src = s1 + Utilities.escapeXml(pack.metadata("description")) + s3;
else if (com[0].equals("status"))
src = s1 + describeStatus(pack.metadata("status")) + s3;
else if (com[0].equals("author"))
src = s1 + Utilities.escapeXml(pack.metadata("author.name")) + s3;
else if (com[0].equals("xml"))
src = s1 + xml + s3;
else if (com[0].equals("json"))
src = s1 + json + s3;
else if (com[0].equals("profiledesc")) {
src = s1 + Utilities.escapeXml(profile.getResource().getDescription()) + s3;
} else if (com[0].equals("tx"))
src = s1 + tx + s3;
else if (com[0].equals("inv"))
src = s1 + genProfileConstraints(profile.getResource()) + s3;
else if (com[0].equals("plural"))
src = s1 + Utilities.pluralizeMe(filename) + s3;
else if (com[0].equals("notes"))
src = s1 + "todo" + /*Utilities.fileToString(folders.srcDir + filename+File.separatorChar+filename+".html")*/
s3;
else if (com[0].equals("dictionary"))
src = s1 + "todo" + s3;
else if (com[0].equals("breadcrumb"))
src = s1 + breadCrumbManager.make(filename) + s3;
else if (com[0].equals("navlist"))
src = s1 + breadCrumbManager.navlist(filename, genlevel(level)) + s3;
else if (com[0].equals("breadcrumblist"))
src = s1 + ((ig == null || ig.isCore()) ? breadCrumbManager.makelist(filename, "profile:" + path, genlevel(0), profile.getResource().getName()) : ig.makeList(filename, "profile:" + path, genlevel(level), profile.getResource().getName())) + s3;
else if (com[0].equals("year"))
src = s1 + new SimpleDateFormat("yyyy").format(new Date()) + s3;
else if (com[0].equals("buildId"))
src = s1 + buildId + s3;
else if (com[0].equals("level"))
src = s1 + genlevel(0) + s3;
else if (com[0].equals("pub-type"))
src = s1 + publicationType + s3;
else if (com[0].equals("pub-notice"))
src = s1 + publicationNotice + s3;
else if (com[0].equals("profileurl"))
src = s1 + profile.getResource().getUrl() + s3;
else if (com[0].equals("baseURL"))
src = s1 + Utilities.URLEncode(baseURL) + s3;
else if (com[0].equals("baseURLn"))
src = s1 + Utilities.appendForwardSlash(baseURL) + s3;
else if (com[0].equals("base-link"))
src = s1 + baseLink(profile.getResource(), genlevel(level)) + s3;
else if (com[0].equals("profile-structure-table-diff"))
src = s1 + generateProfileStructureTable(profile, true, filename, pack.getId(), genlevel(level)) + s3;
else if (com[0].equals("profile-structure-table"))
src = s1 + generateProfileStructureTable(profile, false, filename, pack.getId(), genlevel(level)) + s3;
else if (com[0].equals("maponthispage"))
src = s1 + mapOnPageProfile(profile.getResource()) + s3;
else if (com[0].equals("mappings"))
src = s1 + mappingsProfile(profile.getResource()) + s3;
else if (com[0].equals("definitions"))
src = s1 + definitionsProfile(profile.getResource(), genlevel(level)) + s3;
else if (com[0].equals("profile.review"))
src = s1 + profileReviewLink(profile) + s3;
else if (com[0].equals("profile.datadictionary"))
src = s1 + profileDictionaryLink(profile) + s3;
else if (com[0].equals("profile.tx"))
src = s1 + getTerminologyNotes(profile.getResource(), level) + s3;
else if (com[0].equals("profile.inv"))
src = s1 + getInvariantList(profile.getResource()) + s3;
else if (com[0].equals("draft-note"))
src = s1 + getDraftNote(pack, genlevel(level)) + s3;
else if (com[0].equals("pagepath"))
src = s1 + filename + s3;
else if (com[0].equals("rellink")) {
if (!filename.contains(".html"))
src = s1 + filename + ".html" + s3;
else
src = s1 + filename + s3;
} else if (com[0].equals("schematron"))
src = s1 + (isDict ? "<i>None</i>" : "<a href=\"" + filename + ".sch\">Schematron</a>") + s3;
else if (com[0].equals("summary"))
src = s1 + generateHumanSummary(profile.getResource(), genlevel(level)) + s3;
else if (com[0].equals("profile-examples"))
src = s1 + generateProfileExamples(pack, profile) + s3;
else if (com[0].equals("profile-extensions-table"))
src = s1 + "<p><i>Todo</i></p>" + s3;
else if (com[0].equals("definitionsonthispage"))
src = s1 + "<p><i>Todo</i></p>" + s3;
else if (com[0].equals("profile.intro"))
src = s1 + genProfileDoco(pack, intro) + s3;
else if (com[0].equals("profile.notes"))
src = s1 + genProfileDoco(pack, notes) + s3;
else if (com[0].equals("search-footer"))
src = s1 + searchFooter(level) + s3;
else if (com[0].equals("search-header"))
src = s1 + searchHeader(level) + s3;
else if (com[0].startsWith("!"))
src = s1 + s3;
else if (com[0].equals("wg")) {
String wg = profile.getWg().getCode();
if (Utilities.noString(wg))
pack.getWg();
if (Utilities.noString(wg) && profile.getDefn() != null)
wg = profile.getDefn().getWg().getCode();
if (wg == null || !definitions.getWorkgroups().containsKey(wg))
src = s1 + "(No assigned work group) (" + wg + ") (4)" + s3;
else
src = s1 + "<a _target=\"blank\" href=\"" + definitions.getWorkgroups().get(wg).getUrl() + "\">" + definitions.getWorkgroups().get(wg).getName() + "</a> Work Group" + s3;
} else if (com[0].equals("fmm-style")) {
String fmm = ToolingExtensions.readStringExtension(profile.getResource(), ToolingExtensions.EXT_FMM_LEVEL);
StandardsStatus ss = ToolingExtensions.getStandardsStatus(profile.getResource());
src = s1 + fmmBarColorStyle(ss, fmm) + s3;
} else if (com[0].equals("fmm")) {
String fmm = profile.getFmm();
if (Utilities.noString(fmm))
fmm = pack.getFmmLevel();
src = s1 + getFmmFromlevel(genlevel(level), fmm) + s3;
} else if (com[0].equals("profile-context"))
src = s1 + getProfileContext(pack.getCandidateResource(), genlevel(level)) + s3;
else if (com[0].equals("sstatus")) {
StandardsStatus ss = ToolingExtensions.getStandardsStatus(profile.getResource());
if (ss == null)
ss = StandardsStatus.INFORMATIVE;
if (ss == StandardsStatus.NORMATIVE && ToolingExtensions.hasExtension(profile.getResource(), ToolingExtensions.EXT_NORMATIVE_VERSION))
src = s1 + "<a href=\"" + genlevel(level) + "versions.html#std-process\">" + ss.toDisplay() + "</a> (from v" + ToolingExtensions.readStringExtension(profile.getResource(), ToolingExtensions.EXT_NORMATIVE_VERSION) + ")" + s3;
else
src = s1 + "<a href=\"" + genlevel(level) + "versions.html#std-process\">" + ss.toDisplay() + "</a>" + s3;
} else if (com[0].equals("past-narrative-link")) {
if (hasNarrative)
src = s1 + s3;
else
src = s1 + "<p><a href=\"#DomainResource.text.div-end\">Jump past Narrative</a></p>" + s3;
} else if (com[0].equals("resurl")) {
if (Utilities.noString(pack.metadata("id")))
src = s1 + s3;
else
src = s1 + "The id of this profile is " + pack.metadata("id") + s3;
} else if (com[0].equals("res-type-count")) {
src = s1 + definitions.getResources().size() + s3;
} else if (macros.containsKey(com[0])) {
src = s1 + macros.get(com[0]) + s3;
} else
throw new Exception("Instruction <%" + s2 + "%> not understood parsing resource " + filename);
}
return src;
}
use of org.hl7.fhir.definitions.model.ImplementationGuideDefn in project kindling by HL7.
the class PageProcessor method produceStructureDefinitionExamples.
private String produceStructureDefinitionExamples(ResourceDefn resource) throws Exception {
StringBuilder s = new StringBuilder();
s.append("<div id=\"tabs\">\r\n");
s.append("<ul>\r\n");
s.append(" <li><a href=\"#tabs-1\">Base Types</a></li>\r\n");
s.append(" <li><a href=\"#tabs-2\">Resources</a></li>\r\n");
s.append(" <li><a href=\"#tabs-3\">Constraints</a></li>\r\n");
s.append(" <li><a href=\"#tabs-4\">Extensions</a></li>\r\n");
s.append(" <li><a href=\"#tabs-5\">Examples</a></li>\r\n");
s.append("</ul>\r\n");
s.append("<div id=\"tabs-1\">\r\n");
// base types
s.append("<table class=\"list\">\r\n");
genStructureExampleCategory(s, "Abstract Types", "3");
genStructureExample(s, definitions.getElementLink(), "element.profile", "element", "Element");
genStructureExample(s, definitions.getBackboneLink(), "backboneelement.profile", "backboneelement", "BackBoneElement");
genStructureExample(s, "resource.html", "resource.profile", "resource", "Resource");
genStructureExample(s, "domainresource.html", "domainresource.profile", "domainresource", "DomainResource");
genStructureExampleCategory(s, "Primitive Types", "3");
List<String> names = new ArrayList<String>();
names.addAll(definitions.getPrimitives().keySet());
Collections.sort(names);
for (String n : names) {
DefinedCode dc = definitions.getPrimitives().get(n);
genStructureExample(s, "datatypes.html#" + dc.getCode(), dc.getCode().toLowerCase() + ".profile", dc.getCode().toLowerCase(), dc.getCode());
}
genStructureExampleCategory(s, "Data Types", "3");
names.clear();
names.addAll(definitions.getTypes().keySet());
names.addAll(definitions.getInfrastructure().keySet());
Collections.sort(names);
for (String n : names) {
org.hl7.fhir.definitions.model.TypeDefn t = definitions.getTypes().get(n);
if (t == null)
t = definitions.getInfrastructure().get(n);
genStructureExample(s, getLinkFor("", t.getName()), t.getName().toLowerCase() + ".profile", t.getName().toLowerCase(), t.getName());
}
s.append("</table>\r\n");
s.append("</div>\r\n");
s.append("<div id=\"tabs-2\">\r\n");
s.append("<table class=\"list\">\r\n");
genStructureExampleCategory(s, "Resources", "3");
for (String n : definitions.sortedResourceNames()) {
ResourceDefn r = definitions.getResources().get(n);
genStructureExample(s, r.getName().toLowerCase() + ".html", r.getName().toLowerCase() + ".profile", r.getName().toLowerCase(), r.getName());
}
s.append("</table>\r\n");
s.append("</div>\r\n");
s.append("<div id=\"tabs-3\">\r\n");
s.append("<table class=\"list\">\r\n");
Map<String, ConstraintStructure> constraints = new HashMap<String, ConstraintStructure>();
for (Profile pp : definitions.getPackList()) {
for (ConstraintStructure p : pp.getProfiles()) constraints.put(p.getId(), p);
}
for (String rn : definitions.sortedResourceNames()) for (Profile ap : definitions.getResourceByName(rn).getConformancePackages()) for (ConstraintStructure p : ap.getProfiles()) constraints.put(p.getId(), p);
names.clear();
names.addAll(constraints.keySet());
Collections.sort(names);
for (ImplementationGuideDefn ig : definitions.getSortedIgs()) {
boolean started = false;
for (String n : names) {
ConstraintStructure p = constraints.get(n);
if (ig == p.getUsage()) {
if (!started) {
started = true;
genStructureExampleCategory(s, ig.getName(), "3");
}
String prefix = ig.isCore() ? "" : ig.getCode() + "/";
genStructureExample(s, prefix + p.getId().toLowerCase() + ".html", prefix + p.getId().toLowerCase() + ".profile", p.getId().toLowerCase(), p.getTitle());
}
}
}
s.append("</table>\r\n");
s.append("</div>\r\n");
s.append("<div id=\"tabs-4\">\r\n");
s.append("<table class=\"list\">\r\n");
names.clear();
for (StructureDefinition sd : workerContext.getExtensionDefinitions()) names.add(sd.getUrl());
Collections.sort(names);
for (ImplementationGuideDefn ig : definitions.getSortedIgs()) {
boolean started = false;
for (String n : names) {
StructureDefinition ed = workerContext.fetchResource(StructureDefinition.class, n);
if (ig.getCode().equals(ToolResourceUtilities.getUsage(ed))) {
if (!started) {
started = true;
genStructureExampleCategory(s, ig.getName(), "3");
}
String prefix = ig.isCore() ? "" : ig.getCode() + "/";
genStructureExample(s, prefix + "extension-" + ed.getId().toLowerCase() + ".html", prefix + "extension-" + ed.getId().toLowerCase(), ed.getId().toLowerCase(), ed.getUrl().startsWith("http://hl7.org/fhir/StructureDefinition/") ? ed.getUrl().substring(40) : ed.getUrl(), ed.getName());
}
}
}
s.append("</table>\r\n");
s.append("</div>\r\n");
s.append("<div id=\"tabs-5\">\r\n");
s.append("<table class=\"list\">\r\n");
for (Example e : resource.getExamples()) {
if (e.isRegistered() && Utilities.noString(e.getIg()))
produceExampleListEntry(s, e, null, null);
}
for (Profile p : resource.getConformancePackages()) {
for (Example e : p.getExamples()) {
produceExampleListEntry(s, e, p, null);
}
}
for (Profile p : definitions.getPackList()) {
ImplementationGuideDefn ig = definitions.getIgs().get(p.getCategory());
for (Example e : p.getExamples()) {
String rn = e.getResourceName();
if (Utilities.noString(rn))
rn = e.getXml().getDocumentElement().getNodeName();
if (rn.equals(resource.getName()))
produceExampleListEntry(s, e, p, ig);
}
}
for (ImplementationGuideDefn ig : definitions.getSortedIgs()) {
if (ig.getIg() != null) {
for (ImplementationGuideDefinitionResourceComponent res : ig.getIg().getDefinition().getResource()) {
Example e = (Example) res.getUserData(ToolResourceUtilities.NAME_RES_EXAMPLE);
if (res.hasExample() && e != null && e.getResourceName().equals(resource.getName()))
produceExampleListEntry(s, res, ig);
}
}
}
s.append("</table>\r\n");
s.append("</div>\r\n");
s.append("</div>\r\n");
s.append("\r\n");
s.append("<script src=\"external/jquery/jquery.js\"> </script>\r\n");
s.append("<script src=\"jquery-ui.min.js\"> </script>\r\n");
s.append("<script>\r\n");
s.append("try {\r\n");
s.append(" var currentTabIndex = sessionStorage.getItem('fhir-sdelist-tab-index');\r\n");
s.append("}\r\n");
s.append("catch(exception){\r\n");
s.append("}\r\n");
s.append("\r\n");
s.append("if (!currentTabIndex)\r\n");
s.append(" currentTabIndex = '0';\r\n");
s.append(" \r\n");
s.append("$( '#tabs' ).tabs({\r\n");
s.append(" active: currentTabIndex,\r\n");
s.append(" activate: function( event, ui ) {\r\n");
s.append(" var active = $('.selector').tabs('option', 'active');\r\n");
s.append(" currentTabIndex = ui.newTab.index();\r\n");
s.append(" document.activeElement.blur();\r\n");
s.append(" try {\r\n");
s.append(" sessionStorage.setItem('fhir-sdelist-tab-index', currentTabIndex);\r\n");
s.append(" }\r\n");
s.append(" catch(exception){\r\n");
s.append(" }\r\n");
s.append(" }\r\n");
s.append(" });\r\n");
s.append("</script>\r\n");
s.append("\r\n");
return s.toString();
}
use of org.hl7.fhir.definitions.model.ImplementationGuideDefn in project kindling by HL7.
the class PageProcessor method produceExtensions.
private String produceExtensions(ResourceDefn resource) {
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 || (ec.getExpression().equals(resource.getName()) || ec.getExpression().startsWith(resource.getName() + "."));
}
if (inc)
map.put(sd.getId(), sd);
}
}
StringBuilder b = new StringBuilder();
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(presentContext(cs, resource.getName())).append("</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 this resource</td></tr>");
map.clear();
for (StructureDefinition sd : workerContext.getExtensionDefinitions()) {
boolean inc = false;
for (StructureDefinitionContextComponent ec : sd.getContext()) inc = inc || (ec.getExpression().equals("Resource") || ec.getExpression().equals("DomainResource") || ec.getExpression().equals("Any"));
if (inc)
map.put(sd.getId(), sd);
}
b.append("<tr><td colspan=\"4\">Extensions for all resources or elements</td></tr>");
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 colspan=\"2\"><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() + ".html\">" + Utilities.escapeXml(ap.getTitle()) + "</a></td>\r\n");
}
b.append(" </tr>\r\n");
}
return b.toString();
}
use of org.hl7.fhir.definitions.model.ImplementationGuideDefn in project kindling by HL7.
the class Publisher method genExampleUsage.
private String genExampleUsage(Example e, String prefix) {
if (e.getInbounds().isEmpty())
return "";
else {
StringBuilder b = new StringBuilder();
b.append("<p>\r\nOther examples that reference this example:</p>\r\n");
List<String> names = new ArrayList<String>();
for (Example x : e.getInbounds()) names.add(x.getResourceName() + ":" + x.getId());
Collections.sort(names);
for (String n : names) {
Example x = null;
for (Example y : e.getInbounds()) if (n.equals(y.getResourceName() + ":" + y.getId()))
x = y;
b.append("<li><a href=\"");
b.append(prefix);
if (x.getIg() != null) {
ImplementationGuideDefn ig = page.getDefinitions().getIgs().get(x.getIg());
if (ig != null && !ig.isCore()) {
b.append(ig.getCode());
b.append("/");
}
}
b.append(x.getTitle() + ".html");
b.append("\">");
b.append(x.getResourceName() + "/" + x.getName());
b.append("</a></li>\r\n");
}
b.append("</ul>\r\n");
return b.toString();
}
}
use of org.hl7.fhir.definitions.model.ImplementationGuideDefn 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");
}
}
Aggregations