From c5843f0ff9fc5f692e8dd1eaee64815687249071 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Mon, 21 Sep 2020 05:40:06 +0200 Subject: [PATCH] Clean Javadoc and code. --- .../devinsy/statoolinfos/crawl/Crawler.java | 4 +- .../statoolinfos/htmlize/Htmlizer.java | 2 +- .../htmlize/PropertyStatsPage.java | 72 ++++++++- .../htmlize/PropertyStatsPage2.java | 147 ------------------ .../statoolinfos/htmlize/propertyStats.xhtml | 103 ++++++++++-- .../statoolinfos/htmlize/propertyStats2.xhtml | 134 ---------------- .../devinsy/statoolinfos/stats/StatAgent.java | 12 +- 7 files changed, 169 insertions(+), 305 deletions(-) delete mode 100644 src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage2.java delete mode 100644 src/fr/devinsy/statoolinfos/htmlize/propertyStats2.xhtml diff --git a/src/fr/devinsy/statoolinfos/crawl/Crawler.java b/src/fr/devinsy/statoolinfos/crawl/Crawler.java index bba476a..3be9680 100644 --- a/src/fr/devinsy/statoolinfos/crawl/Crawler.java +++ b/src/fr/devinsy/statoolinfos/crawl/Crawler.java @@ -45,8 +45,8 @@ public class Crawler /** * Clear. * - * @param configurationFile - * the input + * @param configuration + * the configuration * @throws StatoolInfosException * the statool infos exception * @throws IOException diff --git a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java index cce30eb..f6dc9a1 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java +++ b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java @@ -265,7 +265,7 @@ public class Htmlizer PropertyStats federationStats = StatAgent.statFederationProperties(federation); PropertyStats organizationsStats = StatAgent.statOrganizationsProperties(federation.getOrganizations()); PropertyStats servicesStats = StatAgent.statServicesProperties(federation.getAllServices()); - page = PropertyStatsPage2.build(stats, federationStats, organizationsStats, servicesStats); + page = PropertyStatsPage.build(stats, federationStats, organizationsStats, servicesStats); FileUtils.write(new File(htmlizeDirectory, "propertyStats.xhtml"), page, StandardCharsets.UTF_8); } } diff --git a/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage.java b/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage.java index ec67423..22b9f29 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage.java @@ -35,7 +35,7 @@ import fr.devinsy.xidyn.data.TagDataManager; import fr.devinsy.xidyn.presenters.PresenterUtils; /** - * The Class PropertyStatsPage. + * The Class OrganizationPage. */ public class PropertyStatsPage { @@ -44,13 +44,19 @@ public class PropertyStatsPage /** * Builds the. * - * @param service - * the service + * @param stats + * the stats + * @param federationStats + * the federation stats + * @param organizationsStats + * the organizations stats + * @param servicesStats + * the services stats * @return the string * @throws StatoolInfosException * the statool infos exception */ - public static String build(final PropertyStats stats) throws StatoolInfosException + public static String build(final PropertyStats stats, final PropertyStats federationStats, final PropertyStats organizationsStats, final PropertyStats servicesStats) throws StatoolInfosException { String result; @@ -63,6 +69,8 @@ public class PropertyStatsPage data.setContent("versionsup", BuildInformation.instance().version()); data.setContent("lastUpdateDate", LocalDateTime.now().format(DateTimeFormatter.ofPattern("dd/MM/yyyy HH':'mm", Locale.FRANCE))); + // + data.setContent("statsTitle", "Tous"); data.setContent("propertyCount", stats.getPropertyCount()); data.setContent("fileCount", stats.getFileCount()); @@ -78,7 +86,61 @@ public class PropertyStatsPage index += 1; } - result = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/propertyStats2.xhtml", data).toString(); + // + data.setContent("statsTitleF", "Fédération"); + data.setContent("propertyCountF", federationStats.getPropertyCount()); + data.setContent("fileCountF", federationStats.getFileCount()); + + index = 0; + for (PropertyStat stat : federationStats.getList().sortByFilledCount().reverse()) + { + data.setEscapedContent("propertyLineF", index, "propertyLinePathF", stat.getPath()); + data.setContent("propertyLineF", index, "propertyLineBlankCountF", stat.getBlankCount()); + data.setContent("propertyLineF", index, "propertyLineBlankCountPercentageF", StatoolInfosUtils.toPercentage(stat.getBlankCount(), federationStats.getFileCount())); + data.setContent("propertyLineF", index, "propertyLineFilledCountF", stat.getFilledCount()); + data.setContent("propertyLineF", index, "propertyLineFilledCountPercentageF", StatoolInfosUtils.toPercentage(stat.getFilledCount(), federationStats.getFileCount())); + + index += 1; + } + + // + data.setContent("statsTitleO", "Organisations"); + data.setContent("propertyCountO", organizationsStats.getPropertyCount()); + data.setContent("fileCountO", organizationsStats.getFileCount()); + + index = 0; + for (PropertyStat stat : organizationsStats.getList().sortByFilledCount().reverse()) + { + data.setEscapedContent("propertyLineO", index, "propertyLinePathO", stat.getPath()); + data.setContent("propertyLineO", index, "propertyLineBlankCountO", stat.getBlankCount()); + data.setContent("propertyLineO", index, "propertyLineBlankCountPercentageO", StatoolInfosUtils.toPercentage(stat.getBlankCount(), organizationsStats.getFileCount())); + data.setContent("propertyLineO", index, "propertyLineFilledCountO", stat.getFilledCount()); + data.setContent("propertyLineO", index, "propertyLineFilledCountPercentageO", StatoolInfosUtils.toPercentage(stat.getFilledCount(), organizationsStats.getFileCount())); + + index += 1; + } + + // + data.setContent("statsTitleS", "Services"); + data.setContent("propertyCountS", servicesStats.getPropertyCount()); + data.setContent("fileCountS", servicesStats.getFileCount()); + + index = 0; + for (PropertyStat stat : servicesStats.getList().sortByFilledCount().reverse()) + { + data.setEscapedContent("propertyLineS", index, "propertyLinePathS", stat.getPath()); + data.setContent("propertyLineS", index, "propertyLineBlankCountS", stat.getBlankCount()); + data.setContent("propertyLineS", index, "propertyLineBlankCountPercentageS", StatoolInfosUtils.toPercentage(stat.getBlankCount(), servicesStats.getFileCount())); + data.setContent("propertyLineS", index, "propertyLineFilledCountS", stat.getFilledCount()); + data.setContent("propertyLineS", index, "propertyLineFilledCountPercentageS", StatoolInfosUtils.toPercentage(stat.getFilledCount(), servicesStats.getFileCount())); + + index += 1; + } + + // + String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/propertyStats.xhtml", data).toString(); + + result = WebCharterView.build(content); } catch (XidynException exception) { diff --git a/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage2.java b/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage2.java deleted file mode 100644 index b0a0738..0000000 --- a/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage2.java +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (C) 2020 Christian Pierre MOMON - * - * This file is part of StatoolInfos, simple service statistics tool. - * - * StatoolInfos is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * StatoolInfos is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with StatoolInfos. If not, see . - */ -package fr.devinsy.statoolinfos.htmlize; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Locale; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import fr.devinsy.statoolinfos.core.StatoolInfosException; -import fr.devinsy.statoolinfos.core.StatoolInfosUtils; -import fr.devinsy.statoolinfos.stats.PropertyStat; -import fr.devinsy.statoolinfos.stats.PropertyStats; -import fr.devinsy.statoolinfos.util.BuildInformation; -import fr.devinsy.xidyn.XidynException; -import fr.devinsy.xidyn.data.TagDataManager; -import fr.devinsy.xidyn.presenters.PresenterUtils; - -/** - * The Class OrganizationPage. - */ -public class PropertyStatsPage2 -{ - private static Logger logger = LoggerFactory.getLogger(PropertyStatsPage2.class); - - /** - * Builds the. - * - * @param service - * the service - * @return the string - * @throws StatoolInfosException - * the statool infos exception - */ - public static String build(final PropertyStats stats, final PropertyStats federationStats, final PropertyStats organizationsStats, final PropertyStats servicesStats) throws StatoolInfosException - { - String result; - - try - { - logger.debug("Building propertyStats page…"); - - TagDataManager data = new TagDataManager(); - - data.setContent("versionsup", BuildInformation.instance().version()); - data.setContent("lastUpdateDate", LocalDateTime.now().format(DateTimeFormatter.ofPattern("dd/MM/yyyy HH':'mm", Locale.FRANCE))); - - // - data.setContent("statsTitle", "Tous"); - data.setContent("propertyCount", stats.getPropertyCount()); - data.setContent("fileCount", stats.getFileCount()); - - int index = 0; - for (PropertyStat stat : stats.getList().sortByFilledCount().reverse()) - { - data.setEscapedContent("propertyLine", index, "propertyLinePath", stat.getPath()); - data.setContent("propertyLine", index, "propertyLineBlankCount", stat.getBlankCount()); - data.setContent("propertyLine", index, "propertyLineBlankCountPercentage", StatoolInfosUtils.toPercentage(stat.getBlankCount(), stats.getFileCount())); - data.setContent("propertyLine", index, "propertyLineFilledCount", stat.getFilledCount()); - data.setContent("propertyLine", index, "propertyLineFilledCountPercentage", StatoolInfosUtils.toPercentage(stat.getFilledCount(), stats.getFileCount())); - - index += 1; - } - - // - data.setContent("statsTitleF", "Fédération"); - data.setContent("propertyCountF", federationStats.getPropertyCount()); - data.setContent("fileCountF", federationStats.getFileCount()); - - index = 0; - for (PropertyStat stat : federationStats.getList().sortByFilledCount().reverse()) - { - data.setEscapedContent("propertyLineF", index, "propertyLinePathF", stat.getPath()); - data.setContent("propertyLineF", index, "propertyLineBlankCountF", stat.getBlankCount()); - data.setContent("propertyLineF", index, "propertyLineBlankCountPercentageF", StatoolInfosUtils.toPercentage(stat.getBlankCount(), federationStats.getFileCount())); - data.setContent("propertyLineF", index, "propertyLineFilledCountF", stat.getFilledCount()); - data.setContent("propertyLineF", index, "propertyLineFilledCountPercentageF", StatoolInfosUtils.toPercentage(stat.getFilledCount(), federationStats.getFileCount())); - - index += 1; - } - - // - data.setContent("statsTitleO", "Organisations"); - data.setContent("propertyCountO", organizationsStats.getPropertyCount()); - data.setContent("fileCountO", organizationsStats.getFileCount()); - - index = 0; - for (PropertyStat stat : organizationsStats.getList().sortByFilledCount().reverse()) - { - data.setEscapedContent("propertyLineO", index, "propertyLinePathO", stat.getPath()); - data.setContent("propertyLineO", index, "propertyLineBlankCountO", stat.getBlankCount()); - data.setContent("propertyLineO", index, "propertyLineBlankCountPercentageO", StatoolInfosUtils.toPercentage(stat.getBlankCount(), organizationsStats.getFileCount())); - data.setContent("propertyLineO", index, "propertyLineFilledCountO", stat.getFilledCount()); - data.setContent("propertyLineO", index, "propertyLineFilledCountPercentageO", StatoolInfosUtils.toPercentage(stat.getFilledCount(), organizationsStats.getFileCount())); - - index += 1; - } - - // - data.setContent("statsTitleS", "Services"); - data.setContent("propertyCountS", servicesStats.getPropertyCount()); - data.setContent("fileCountS", servicesStats.getFileCount()); - - index = 0; - for (PropertyStat stat : servicesStats.getList().sortByFilledCount().reverse()) - { - data.setEscapedContent("propertyLineS", index, "propertyLinePathS", stat.getPath()); - data.setContent("propertyLineS", index, "propertyLineBlankCountS", stat.getBlankCount()); - data.setContent("propertyLineS", index, "propertyLineBlankCountPercentageS", StatoolInfosUtils.toPercentage(stat.getBlankCount(), servicesStats.getFileCount())); - data.setContent("propertyLineS", index, "propertyLineFilledCountS", stat.getFilledCount()); - data.setContent("propertyLineS", index, "propertyLineFilledCountPercentageS", StatoolInfosUtils.toPercentage(stat.getFilledCount(), servicesStats.getFileCount())); - - index += 1; - } - - // - String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/propertyStats2.xhtml", data).toString(); - - result = WebCharterView.build(content); - } - catch (XidynException exception) - { - throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception); - } - - // - return result; - } -} diff --git a/src/fr/devinsy/statoolinfos/htmlize/propertyStats.xhtml b/src/fr/devinsy/statoolinfos/htmlize/propertyStats.xhtml index c671ac4..a2d4f1c 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/propertyStats.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/propertyStats.xhtml @@ -11,19 +11,73 @@ -
-

StatoolInfosv0.0.14À proposPage updated on
xx/xx/xxxx xx:xx

- -
- Property Stats +
+
+

Statistics des property

+
Nombre de property : n/a
+
Nombre de fichiers : n/a
+
+ + + + + + + + + + + + + + + + + + + +
PathFilled CountFile %Blank CountFile %
n/an/an/an/an/a
+
- -
-

Statistics des property

+ +
 
+ +
+

Statistics des property

+
Nombre de property : n/a
+
Nombre de fichiers : n/a
+
+ + + + + + + + + + + + + + + + + + + +
PathFilled CountFile %Blank CountFile %
n/an/an/an/an/a
+
+
+
+ +
+
+

Statistics des property

Nombre de property : n/a
Nombre de fichiers : n/a
- +
@@ -45,7 +99,36 @@
Path
+ +
 
-
+
+

Statistics des property

+
Nombre de property : n/a
+
Nombre de fichiers : n/a
+
+ + + + + + + + + + + + + + + + + + + +
PathFilled CountFile %Blank CountFile %
n/an/an/an/an/a
+
+
+
diff --git a/src/fr/devinsy/statoolinfos/htmlize/propertyStats2.xhtml b/src/fr/devinsy/statoolinfos/htmlize/propertyStats2.xhtml deleted file mode 100644 index a2d4f1c..0000000 --- a/src/fr/devinsy/statoolinfos/htmlize/propertyStats2.xhtml +++ /dev/null @@ -1,134 +0,0 @@ - - - - - StatoolInfos - - - - - - - -
-
-

Statistics des property

-
Nombre de property : n/a
-
Nombre de fichiers : n/a
-
- - - - - - - - - - - - - - - - - - - -
PathFilled CountFile %Blank CountFile %
n/an/an/an/an/a
-
-
- -
 
- -
-

Statistics des property

-
Nombre de property : n/a
-
Nombre de fichiers : n/a
-
- - - - - - - - - - - - - - - - - - - -
PathFilled CountFile %Blank CountFile %
n/an/an/an/an/a
-
-
-
- -
-
-

Statistics des property

-
Nombre de property : n/a
-
Nombre de fichiers : n/a
-
- - - - - - - - - - - - - - - - - - - -
PathFilled CountFile %Blank CountFile %
n/an/an/an/an/a
-
-
- -
 
- -
-

Statistics des property

-
Nombre de property : n/a
-
Nombre de fichiers : n/a
-
- - - - - - - - - - - - - - - - - - - -
PathFilled CountFile %Blank CountFile %
n/an/an/an/an/a
-
-
-
- - diff --git a/src/fr/devinsy/statoolinfos/stats/StatAgent.java b/src/fr/devinsy/statoolinfos/stats/StatAgent.java index 5a6aca7..0540625 100644 --- a/src/fr/devinsy/statoolinfos/stats/StatAgent.java +++ b/src/fr/devinsy/statoolinfos/stats/StatAgent.java @@ -38,10 +38,10 @@ public class StatAgent } /** - * Stat properties. + * Stat all properties. * - * @param fedration - * the fedration + * @param federation + * the federation * @return the property stats */ public static PropertyStats statAllProperties(final Federation federation) @@ -85,10 +85,10 @@ public class StatAgent } /** - * Stat organization properties. + * Stat organizations properties. * - * @param organization - * the federation + * @param organizations + * the organizations * @return the property stats */ public static PropertyStats statOrganizationsProperties(final Organizations organizations)