From 1e0b2e3ac368b1f21d5609b9df3f98e273c439ce Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Mon, 25 Jan 2021 04:51:07 +0100 Subject: [PATCH] Add alert check page for organization. --- .../htmlize/OrganizationPage.java | 32 +++++++++++++++++++ .../htmlize/PropertyFileCheckPage.java | 3 -- .../htmlize/PropertyFilesCheckPage.java | 2 +- .../statoolinfos/htmlize/organization.xhtml | 2 ++ .../htmlize/propertiesFiles.xhtml | 6 ++-- .../htmlize/propertyFileCheck.xhtml | 2 +- .../htmlize/propertyFilesCheck.xhtml | 2 +- 7 files changed, 40 insertions(+), 9 deletions(-) diff --git a/src/fr/devinsy/statoolinfos/htmlize/OrganizationPage.java b/src/fr/devinsy/statoolinfos/htmlize/OrganizationPage.java index 63f56c0..f9efc6e 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/OrganizationPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/OrganizationPage.java @@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory; import fr.devinsy.catgenerator.core.CatGenerator; import fr.devinsy.statoolinfos.HtmlizerContext; +import fr.devinsy.statoolinfos.checker.PropertyCheck; import fr.devinsy.statoolinfos.checker.PropertyChecker; import fr.devinsy.statoolinfos.checker.PropertyChecks; import fr.devinsy.statoolinfos.core.Organization; @@ -72,6 +73,35 @@ public class OrganizationPage logger.info("Htmlize organization page: {}.", organization.getName()); String page = OrganizationPage.htmlize(organization); FileUtils.write(new File(htmlizeDirectory, organization.getTechnicalName() + ".xhtml"), page, StandardCharsets.UTF_8); + + { + try + { + PropertyChecker checker = new PropertyChecker(); + PropertyChecks checks = checker.checkOrganization(organization.getInputFile()); + for (PropertyCheck check : checks) + { + check.setFileName(organization.getLocalFileName()); + } + + for (Service service : organization.getServices()) + { + PropertyChecks subChecks = checker.checkService(service.getInputFile()); + for (PropertyCheck check : subChecks) + { + check.setFileName(service.getLocalFileName()); + } + checks.addAll(subChecks); + } + + page = PropertyFilesCheckPage.htmlize(organization.getName(), checks.getAlertLines()); + FileUtils.write(new File(htmlizeDirectory, "alertChecks-" + organization.getTechnicalName() + ".xhtml"), page, StandardCharsets.UTF_8); + } + catch (IOException exception) + { + exception.printStackTrace(); + } + } } /** @@ -147,6 +177,8 @@ public class OrganizationPage data.setContent("errorCount", checks.getErrorCount()); data.setContent("warningCount", checks.getWarningCount()); data.setContent("voidCount", checks.getVoidCount()); + + data.setAttribute("alertLink", "href", "alertChecks-" + organization.getTechnicalName() + ".xhtml"); } catch (IOException exception) { diff --git a/src/fr/devinsy/statoolinfos/htmlize/PropertyFileCheckPage.java b/src/fr/devinsy/statoolinfos/htmlize/PropertyFileCheckPage.java index 11088bd..f2f616a 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/PropertyFileCheckPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/PropertyFileCheckPage.java @@ -155,7 +155,6 @@ public class PropertyFileCheckPage { for (PropertyCheck check : checks) { - // data.setContent("line", index, "lineIndex", check.getIndex()); data.setEscapedContent("line", index, "lineComment", check.getComment()); data.setEscapedContent("line", index, "lineContent", check.getLine()); @@ -176,7 +175,6 @@ public class PropertyFileCheckPage { for (PropertyCheck check : subchecks) { - // data.setContent("shrunkLine", index, "shrunkLineIndex", check.getIndex()); data.setEscapedContent("shrunkLine", index, "shrunkLineContent", check.getLine()); data.setEscapedContent("shrunkLine", index, "shrunkLineComment", check.getComment()); @@ -197,7 +195,6 @@ public class PropertyFileCheckPage { for (PropertyCheck check : subchecks) { - // data.setContent("alertLine", index, "alertLineIndex", check.getIndex()); data.setEscapedContent("alertLine", index, "alertLineContent", check.getLine()); data.setEscapedContent("alertLine", index, "alertLineComment", check.getComment()); diff --git a/src/fr/devinsy/statoolinfos/htmlize/PropertyFilesCheckPage.java b/src/fr/devinsy/statoolinfos/htmlize/PropertyFilesCheckPage.java index 8be30ff..e57a9b1 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/PropertyFilesCheckPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/PropertyFilesCheckPage.java @@ -58,8 +58,8 @@ public class PropertyFilesCheckPage TagDataManager data = new TagDataManager(); data.setContent("lineCount", checks.size()); - data.setContent("warningCount", checks.getWarningCount()); data.setContent("errorCount", checks.getErrorCount()); + data.setContent("warningCount", checks.getWarningCount()); data.setContent("voidCount", checks.getVoidCount()); // diff --git a/src/fr/devinsy/statoolinfos/htmlize/organization.xhtml b/src/fr/devinsy/statoolinfos/htmlize/organization.xhtml index ed0a7c6..3da2113 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/organization.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/organization.xhtml @@ -35,9 +35,11 @@
+ n/a
n/a
n/a +

diff --git a/src/fr/devinsy/statoolinfos/htmlize/propertiesFiles.xhtml b/src/fr/devinsy/statoolinfos/htmlize/propertiesFiles.xhtml index af35db4..739af86 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/propertiesFiles.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/propertiesFiles.xhtml @@ -42,8 +42,8 @@ Alertes : - n/a n/a + n/a n/a @@ -60,8 +60,8 @@ Propriétés Remplies Vides - Attendues Erreurs + Attendues Inconnues Date @@ -81,8 +81,8 @@ n/a n/a n/a - n/a n/a + n/a n/a n/a diff --git a/src/fr/devinsy/statoolinfos/htmlize/propertyFileCheck.xhtml b/src/fr/devinsy/statoolinfos/htmlize/propertyFileCheck.xhtml index 18aca71..7722fbb 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/propertyFileCheck.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/propertyFileCheck.xhtml @@ -22,8 +22,8 @@ Statistiques : n/a - n/a n/a + n/a n/a
diff --git a/src/fr/devinsy/statoolinfos/htmlize/propertyFilesCheck.xhtml b/src/fr/devinsy/statoolinfos/htmlize/propertyFilesCheck.xhtml index 29eecb8..f5f43a3 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/propertyFilesCheck.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/propertyFilesCheck.xhtml @@ -25,8 +25,8 @@
Statistiques : n/a - n/a n/a + n/a n/a