From 037eb02d5978d108af3f8e3324e25a4c1ba74421 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Fri, 9 Oct 2020 05:05:00 +0200 Subject: [PATCH] Split property stats page. --- .../statoolinfos/htmlize/Htmlizer.java | 18 +- .../htmlize/PropertyStatsPage.java | 80 ++------ .../statoolinfos/htmlize/propertyStats.xhtml | 186 +++++++----------- 3 files changed, 107 insertions(+), 177 deletions(-) diff --git a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java index 47f62dd..313c344 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java +++ b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java @@ -345,12 +345,22 @@ public class Htmlizer // { logger.info("Htmlize propertyStats page."); + PropertyStats stats = StatAgent.statAllProperties(federation); - PropertyStats federationStats = StatAgent.statFederationProperties(federation); - PropertyStats organizationsStats = StatAgent.statOrganizationsProperties(federation.getOrganizations()); - PropertyStats servicesStats = StatAgent.statServicesProperties(federation.getAllServices()); - page = PropertyStatsPage.build(stats, federationStats, organizationsStats, servicesStats); + page = PropertyStatsPage.build("Toutes les propriétés", stats); FileUtils.write(new File(htmlizeDirectory, "propertyStats.xhtml"), page, StandardCharsets.UTF_8); + + PropertyStats federationStats = StatAgent.statFederationProperties(federation); + page = PropertyStatsPage.build("Les propriétés de la fédération", federationStats); + FileUtils.write(new File(htmlizeDirectory, "propertyStats-federation.xhtml"), page, StandardCharsets.UTF_8); + + PropertyStats organizationsStats = StatAgent.statOrganizationsProperties(federation.getOrganizations()); + page = PropertyStatsPage.build("Les propriétés des organizations", organizationsStats); + FileUtils.write(new File(htmlizeDirectory, "propertyStats-organizations.xhtml"), page, StandardCharsets.UTF_8); + + PropertyStats servicesStats = StatAgent.statServicesProperties(federation.getAllServices()); + page = PropertyStatsPage.build("Les propriétés des services", servicesStats); + FileUtils.write(new File(htmlizeDirectory, "propertyStats-services.xhtml"), page, StandardCharsets.UTF_8); } // diff --git a/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage.java b/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage.java index 6bdb998..de3fc50 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/PropertyStatsPage.java @@ -18,18 +18,14 @@ */ 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.properties.PropertyStat; +import fr.devinsy.statoolinfos.stats.properties.PropertyStatList; import fr.devinsy.statoolinfos.stats.properties.PropertyStats; -import fr.devinsy.statoolinfos.util.BuildInformation; import fr.devinsy.xidyn.XidynException; import fr.devinsy.xidyn.data.TagDataManager; import fr.devinsy.xidyn.presenters.PresenterUtils; @@ -56,7 +52,7 @@ public class PropertyStatsPage * @throws StatoolInfosException * the statool infos exception */ - public static String build(final PropertyStats stats, final PropertyStats federationStats, final PropertyStats organizationsStats, final PropertyStats servicesStats) throws StatoolInfosException + public static String build(final String title, final PropertyStats stats) throws StatoolInfosException { String result; @@ -66,73 +62,37 @@ public class PropertyStatsPage 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("statsTitle", title); data.setContent("propertyCount", stats.getPropertyCount()); data.setContent("fileCount", stats.getFileCount()); + // + PropertyStatList generalStats = stats.getGeneralPropertyStats().getList().sortByReverseFilledCount(); + data.setContent("generalPropertyCount", generalStats.size()); int index = 0; - for (PropertyStat stat : stats.getList().sortByReverseFilledCount()) + for (PropertyStat stat : generalStats) { - 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())); + data.setEscapedContent("generalPropertyLine", index, "generalPropertyLinePath", stat.getPath()); + data.setContent("generalPropertyLine", index, "generalPropertyLineBlankCount", stat.getBlankCount()); + data.setContent("generalPropertyLine", index, "generalPropertyLineBlankCountPercentage", StatoolInfosUtils.toPercentage(stat.getBlankCount(), stats.getFileCount())); + data.setContent("generalPropertyLine", index, "generalPropertyLineFilledCount", stat.getFilledCount()); + data.setContent("generalPropertyLine", index, "generalPropertyLineFilledCountPercentage", StatoolInfosUtils.toPercentage(stat.getFilledCount(), stats.getFileCount())); index += 1; } // - data.setContent("statsTitleF", "Fédération"); - data.setContent("propertyCountF", federationStats.getPropertyCount()); - data.setContent("fileCountF", federationStats.getFileCount()); - + PropertyStatList metricStats = stats.getMetricPropertyStats().getList().sortByReverseFilledCount(); + data.setContent("metricPropertyCount", metricStats.size()); index = 0; - for (PropertyStat stat : federationStats.getList().sortByReverseFilledCount()) + for (PropertyStat stat : metricStats) { - 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().sortByReverseFilledCount()) - { - 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().sortByReverseFilledCount()) - { - 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())); + data.setEscapedContent("metricPropertyLine", index, "metricPropertyLinePath", stat.getPath()); + data.setContent("metricPropertyLine", index, "metricPropertyLineBlankCount", stat.getBlankCount()); + data.setContent("metricPropertyLine", index, "metricPropertyLineBlankCountPercentage", StatoolInfosUtils.toPercentage(stat.getBlankCount(), stats.getFileCount())); + data.setContent("metricPropertyLine", index, "metricPropertyLineFilledCount", stat.getFilledCount()); + data.setContent("metricPropertyLine", index, "metricPropertyLineFilledCountPercentage", StatoolInfosUtils.toPercentage(stat.getFilledCount(), stats.getFileCount())); index += 1; } diff --git a/src/fr/devinsy/statoolinfos/htmlize/propertyStats.xhtml b/src/fr/devinsy/statoolinfos/htmlize/propertyStats.xhtml index ea2b273..c98c6ab 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/propertyStats.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/propertyStats.xhtml @@ -12,123 +12,83 @@
-
-

Statistics des property

-
Nombre de property : n/a
-
Nombre de fichiers : n/a
-
- - - - - - - - - - - - - - - - - - - -
CheminRemplis%Vides%
n/an/an/an/an/a
-
+ +
+ Toutes + Fédération + Organizations + Services
+ +
+

n/a

+
Nombre de propriétés : n/a
+
Nombre de fichiers : n/a
+
+
+
+
+
+
Nombre de propriétés : n/a
+ + + + + + + + + + + + + + + + + + + + + + + +
CheminRemplissageVides
Nombre%Nombre%
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
+
 
+ +
+
+
Nombre de propriétés : n/a
+ + + + + + + + + + + + + + + + + + + + + + + +
CheminRemplissageVides
Nombre%Nombre%
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
-
-
-