Split property stats page.

This commit is contained in:
Christian P. MOMON 2020-10-09 05:05:00 +02:00
parent d9524597b4
commit 037eb02d59
3 changed files with 107 additions and 177 deletions

View file

@ -345,12 +345,22 @@ public class Htmlizer
// //
{ {
logger.info("Htmlize propertyStats page."); logger.info("Htmlize propertyStats page.");
PropertyStats stats = StatAgent.statAllProperties(federation); PropertyStats stats = StatAgent.statAllProperties(federation);
PropertyStats federationStats = StatAgent.statFederationProperties(federation); page = PropertyStatsPage.build("Toutes les propriétés", stats);
PropertyStats organizationsStats = StatAgent.statOrganizationsProperties(federation.getOrganizations());
PropertyStats servicesStats = StatAgent.statServicesProperties(federation.getAllServices());
page = PropertyStatsPage.build(stats, federationStats, organizationsStats, servicesStats);
FileUtils.write(new File(htmlizeDirectory, "propertyStats.xhtml"), page, StandardCharsets.UTF_8); 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);
} }
// //

View file

@ -18,18 +18,14 @@
*/ */
package fr.devinsy.statoolinfos.htmlize; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.core.StatoolInfosException; import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.statoolinfos.core.StatoolInfosUtils; import fr.devinsy.statoolinfos.core.StatoolInfosUtils;
import fr.devinsy.statoolinfos.stats.properties.PropertyStat; 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.stats.properties.PropertyStats;
import fr.devinsy.statoolinfos.util.BuildInformation;
import fr.devinsy.xidyn.XidynException; import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager; import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils; import fr.devinsy.xidyn.presenters.PresenterUtils;
@ -56,7 +52,7 @@ public class PropertyStatsPage
* @throws StatoolInfosException * @throws StatoolInfosException
* the statool infos exception * 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; String result;
@ -66,73 +62,37 @@ public class PropertyStatsPage
TagDataManager data = new TagDataManager(); 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("propertyCount", stats.getPropertyCount());
data.setContent("fileCount", stats.getFileCount()); data.setContent("fileCount", stats.getFileCount());
//
PropertyStatList generalStats = stats.getGeneralPropertyStats().getList().sortByReverseFilledCount();
data.setContent("generalPropertyCount", generalStats.size());
int index = 0; int index = 0;
for (PropertyStat stat : stats.getList().sortByReverseFilledCount()) for (PropertyStat stat : generalStats)
{ {
data.setEscapedContent("propertyLine", index, "propertyLinePath", stat.getPath()); data.setEscapedContent("generalPropertyLine", index, "generalPropertyLinePath", stat.getPath());
data.setContent("propertyLine", index, "propertyLineBlankCount", stat.getBlankCount()); data.setContent("generalPropertyLine", index, "generalPropertyLineBlankCount", stat.getBlankCount());
data.setContent("propertyLine", index, "propertyLineBlankCountPercentage", StatoolInfosUtils.toPercentage(stat.getBlankCount(), stats.getFileCount())); data.setContent("generalPropertyLine", index, "generalPropertyLineBlankCountPercentage", StatoolInfosUtils.toPercentage(stat.getBlankCount(), stats.getFileCount()));
data.setContent("propertyLine", index, "propertyLineFilledCount", stat.getFilledCount()); data.setContent("generalPropertyLine", index, "generalPropertyLineFilledCount", stat.getFilledCount());
data.setContent("propertyLine", index, "propertyLineFilledCountPercentage", StatoolInfosUtils.toPercentage(stat.getFilledCount(), stats.getFileCount())); data.setContent("generalPropertyLine", index, "generalPropertyLineFilledCountPercentage", StatoolInfosUtils.toPercentage(stat.getFilledCount(), stats.getFileCount()));
index += 1; index += 1;
} }
// //
data.setContent("statsTitleF", "Fédération"); PropertyStatList metricStats = stats.getMetricPropertyStats().getList().sortByReverseFilledCount();
data.setContent("propertyCountF", federationStats.getPropertyCount()); data.setContent("metricPropertyCount", metricStats.size());
data.setContent("fileCountF", federationStats.getFileCount());
index = 0; index = 0;
for (PropertyStat stat : federationStats.getList().sortByReverseFilledCount()) for (PropertyStat stat : metricStats)
{ {
data.setEscapedContent("propertyLineF", index, "propertyLinePathF", stat.getPath()); data.setEscapedContent("metricPropertyLine", index, "metricPropertyLinePath", stat.getPath());
data.setContent("propertyLineF", index, "propertyLineBlankCountF", stat.getBlankCount()); data.setContent("metricPropertyLine", index, "metricPropertyLineBlankCount", stat.getBlankCount());
data.setContent("propertyLineF", index, "propertyLineBlankCountPercentageF", StatoolInfosUtils.toPercentage(stat.getBlankCount(), federationStats.getFileCount())); data.setContent("metricPropertyLine", index, "metricPropertyLineBlankCountPercentage", StatoolInfosUtils.toPercentage(stat.getBlankCount(), stats.getFileCount()));
data.setContent("propertyLineF", index, "propertyLineFilledCountF", stat.getFilledCount()); data.setContent("metricPropertyLine", index, "metricPropertyLineFilledCount", stat.getFilledCount());
data.setContent("propertyLineF", index, "propertyLineFilledCountPercentageF", StatoolInfosUtils.toPercentage(stat.getFilledCount(), federationStats.getFileCount())); data.setContent("metricPropertyLine", index, "metricPropertyLineFilledCountPercentage", StatoolInfosUtils.toPercentage(stat.getFilledCount(), stats.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()));
index += 1; index += 1;
} }

View file

@ -12,28 +12,45 @@
</head> </head>
<body> <body>
<div class="row center_table" style="width: 1100px;"> <div class="row center_table" style="width: 1100px;">
<div class="column center">
<h2 id="statsTitleO">Statistics des property</h2> <div style="margin: 5px;">
<div>Nombre de property : <span id="propertyCountO">n/a</span></div> <a id="" href="propertyStats.xhtml" class="button">Toutes</a>
<div>Nombre de fichiers : <span id="fileCountO">n/a</span></div> <a id="" href="propertyStats-federation.xhtml" class="button">Fédération</a>
<a id="" href="propertyStats-organizations.xhtml" class="button">Organizations</a>
<a id="" href="propertyStats-services.xhtml" class="button">Services</a>
</div>
<div class="center">
<h2 id="statsTitle">n/a</h2>
<div>Nombre de propriétés : <span id="propertyCount">n/a</span></div>
<div>Nombre de fichiers : <span id="fileCount">n/a</span></div>
</div>
<br/>
<div class="row center">
<div class="column">
<div class="left"> <div class="left">
<div>Nombre de propriétés : <span id="generalPropertyCount">n/a</span></div>
<table class="table_classic center_table sortable"> <table class="table_classic center_table sortable">
<thead> <thead>
<tr> <tr>
<th style="width: 150px;">Chemin</th> <th style="width: 150px;" rowspan="2">Chemin</th>
<th style="width: 10px;">Remplis</th> <th style="width: 10px;" colspan="2">Remplissage</th>
<th style="width: 10px;">%</th> <th style="width: 10px;" colspan="2">Vides</th>
<th style="width: 10px;">Vides</th> </tr>
<tr>
<th style="width: 10px;">Nombre</th>
<th style="width: 25px;">%</th>
<th style="width: 10px;">Nombre</th>
<th style="width: 10px;">%</th> <th style="width: 10px;">%</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr id="propertyLineO"> <tr id="generalPropertyLine">
<td id="propertyLinePathO" class="">n/a</td> <td id="generalPropertyLinePath" class="">n/a</td>
<td id="propertyLineFilledCountO" class="td_number">n/a</td> <td id="generalPropertyLineFilledCount" class="td_number">n/a</td>
<td id="propertyLineFilledCountPercentageO" class="td_number">n/a</td> <td id="generalPropertyLineFilledCountPercentage" class="td_number">n/a</td>
<td id="propertyLineBlankCountO" class="td_number">n/a</td> <td id="generalPropertyLineBlankCount" class="td_number">n/a</td>
<td id="propertyLineBlankCountPercentageO" class="td_number">n/a</td> <td id="generalPropertyLineBlankCountPercentage" class="td_number">n/a</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -42,93 +59,36 @@
<div class="column" style="width: 20px;">&#160;</div> <div class="column" style="width: 20px;">&#160;</div>
<div class="column center"> <div class="column">
<h2 id="statsTitleS">Statistics des property</h2>
<div>Nombre de property : <span id="propertyCountS">n/a</span></div>
<div>Nombre de fichiers : <span id="fileCountS">n/a</span></div>
<div class="left"> <div class="left">
<div>Nombre de propriétés : <span id="metricPropertyCount">n/a</span></div>
<table class="table_classic center_table sortable " style="margin-left: auto; margin-right: auto;"> <table class="table_classic center_table sortable " style="margin-left: auto; margin-right: auto;">
<thead> <thead>
<tr> <tr>
<th style="width: 150px;">Path</th> <th style="width: 150px;" rowspan="2">Chemin</th>
<th style="width: 10px;">Filled Count</th> <th style="width: 10px;" colspan="2">Remplissage</th>
<th style="width: 10px;">File&#160;%</th> <th style="width: 10px;" colspan="2">Vides</th>
<th style="width: 10px;">Blank Count</th> </tr>
<th style="width: 10px;">File&#160;%</th> <tr>
<th style="width: 10px;">Nombre</th>
<th style="width: 25px;">%</th>
<th style="width: 10px;">Nombre</th>
<th style="width: 10px;">%</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr id="propertyLineS"> <tr id="metricPropertyLine">
<td id="propertyLinePathS" class="">n/a</td> <td id="metricPropertyLinePath" class="">n/a</td>
<td id="propertyLineFilledCountS" class="td_number">n/a</td> <td id="metricPropertyLineFilledCount" class="td_number">n/a</td>
<td id="propertyLineFilledCountPercentageS" class="td_number">n/a</td> <td id="metricPropertyLineFilledCountPercentage" class="td_number">n/a</td>
<td id="propertyLineBlankCountS" class="td_number">n/a</td> <td id="metricPropertyLineBlankCount" class="td_number">n/a</td>
<td id="propertyLineBlankCountPercentageS" class="td_number">n/a</td> <td id="metricPropertyLineBlankCountPercentage" class="td_number">n/a</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
<div class="row center_table" style="width: 1100px;">
<div class="column center">
<h2 id="statsTitle">Statistics des property</h2>
<div>Nombre de property : <span id="propertyCount">n/a</span></div>
<div>Nombre de fichiers : <span id="fileCount">n/a</span></div>
<div class="left">
<table class="table_classic center_table sortable " style="margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="width: 150px;">Path</th>
<th style="width: 10px;">Filled Count</th>
<th style="width: 10px;">File&#160;%</th>
<th style="width: 10px;">Blank Count</th>
<th style="width: 10px;">File&#160;%</th>
</tr>
</thead>
<tbody>
<tr id="propertyLine">
<td id="propertyLinePath" class="">n/a</td>
<td id="propertyLineFilledCount" class="td_number">n/a</td>
<td id="propertyLineFilledCountPercentage" class="td_number">n/a</td>
<td id="propertyLineBlankCount" class="td_number">n/a</td>
<td id="propertyLineBlankCountPercentage" class="td_number">n/a</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="column" style="width: 20px;">&#160;</div>
<div class="column center">
<h2 id="statsTitleF">Statistics des property</h2>
<div>Nombre de property : <span id="propertyCountF">n/a</span></div>
<div>Nombre de fichiers : <span id="fileCountF">n/a</span></div>
<div class="left">
<table class="table_classic center_table sortable " style="margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="width: 150px;">Path</th>
<th style="width: 10px;">Filled Count</th>
<th style="width: 10px;">File&#160;%</th>
<th style="width: 10px;">Blank Count</th>
<th style="width: 10px;">File&#160;%</th>
</tr>
</thead>
<tbody>
<tr id="propertyLineF">
<td id="propertyLinePathF" class="">n/a</td>
<td id="propertyLineFilledCountF" class="td_number">n/a</td>
<td id="propertyLineFilledCountPercentageF" class="td_number">n/a</td>
<td id="propertyLineBlankCountF" class="td_number">n/a</td>
<td id="propertyLineBlankCountPercentageF" class="td_number">n/a</td>
</tr>
</tbody>
</table>
</div>
</div>
</div> </div>
</body> </body>
</html> </html>