use of org.hl7.fhir.definitions.model.Definitions.PageInformation in project kindling by HL7.
the class Publisher method processWarnings.
private void processWarnings(boolean showOnlyErrors) throws Exception {
String xslt = Utilities.path(page.getFolders().rootDir, "implementations", "xmltools", "OwnerResources.xslt");
OutputStreamWriter s = new OutputStreamWriter(new FileOutputStream(page.getFolders().dstDir + "warnings.xml"), "UTF-8");
s.write("<warnings>");
for (WorkGroup wg : page.getDefinitions().getWorkgroups().values()) {
s.write("<wg code=\"" + wg.getCode() + "\" name=\"" + wg.getName() + "\" url=\"" + wg.getUrl() + "\"/>\r\n");
}
for (PageInformation pn : page.getDefinitions().getPageInfo().values()) {
s.write("<page name=\"" + pn.getName() + "\" wg=\"" + pn.getWgCode() + "\" fmm=\"" + pn.getFmm() + "\"/>\r\n");
}
try {
s.write(new String(XsltUtilities.saxonTransform(page.getFolders().dstDir + "profiles-resources.xml", xslt)));
s.write(new String(XsltUtilities.saxonTransform(page.getFolders().dstDir + "profiles-types.xml", xslt)));
s.write(new String(XsltUtilities.saxonTransform(page.getFolders().dstDir + "profiles-others.xml", xslt)));
} catch (Exception e) {
for (ValidationMessage err : page.getValidationErrors()) {
if (!page.getSuppressedMessages().contains(err.getDisplay()))
System.out.println(err.summary());
}
System.out.println("WARNING: Unable to create warnings file - one or more profiles-* files unavailable or invalid");
System.out.println("To determine the cause of the build failure, look in the log prior to the warning and information messages immediately above");
}
for (ValidationMessage e : page.getValidationErrors()) {
if (!page.getSuppressedMessages().contains(e.getDisplay()))
s.write(e.toXML());
}
s.write("</warnings>");
s.flush();
s.close();
String xslt2 = Utilities.path(page.getFolders().rootDir, "implementations", "xmltools", "CategorizeWarnings.xslt");
FileOutputStream s2 = new FileOutputStream(page.getFolders().dstDir + "work-group-warnings.xml");
try {
s2.write(XsltUtilities.saxonTransform(page.getFolders().dstDir + "warnings.xml", xslt2).getBytes("UTF8"));
} catch (Exception e) {
// nothing - do not want to know.
}
s2.flush();
s2.close();
String xslt3 = Utilities.path(page.getFolders().rootDir, "implementations", "xmltools", "RenderWarnings.xslt");
try {
String hw = XsltUtilities.saxonTransform(page.getFolders().dstDir + "work-group-warnings.xml", xslt3);
if (!showOnlyErrors)
page.log(hw, LogMessageType.Process);
} catch (Exception e) {
// nothing - do not want to know.
}
int i = 0;
int w = 0;
int ee = 0;
for (ValidationMessage e : page.getValidationErrors()) {
if (e.getLevel() == IssueSeverity.ERROR || e.getLevel() == IssueSeverity.FATAL) {
ee++;
page.log(e.summary(), LogMessageType.Hint);
} else if (e.getLevel() == IssueSeverity.WARNING) {
w++;
} else if (e.getLevel() == IssueSeverity.INFORMATION) {
i++;
}
}
page.getQa().setCounts(ee, w, i);
}
Aggregations