Clean Javadoc and code.

This commit is contained in:
Christian P. MOMON 2020-09-21 05:40:06 +02:00
parent 348abcb993
commit c5843f0ff9
7 changed files with 169 additions and 305 deletions

View file

@ -45,8 +45,8 @@ public class Crawler
/**
* Clear.
*
* @param configurationFile
* the input
* @param configuration
* the configuration
* @throws StatoolInfosException
* the statool infos exception
* @throws IOException

View file

@ -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);
}
}

View file

@ -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)
{

View file

@ -1,147 +0,0 @@
/*
* Copyright (C) 2020 Christian Pierre MOMON <christian@momon.org>
*
* 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 <http://www.gnu.org/licenses/>.
*/
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;
}
}

View file

@ -11,19 +11,73 @@
<script src="Chart.bundle.min.js"></script>
</head>
<body>
<div style="margin: 5px 10px 10px 10px;">
<h1><a href="index.xhtml"><img src="logo.jpg" style="width: 35px;"/> StatoolInfos</a><sup id="versionsup" style="font-size: 9px;">v0.0.14</sup> <a href="about.xhtml">À propos</a><span style="font-size: 9px; float: right;">Page updated on<br/><span id="lastUpdateDate" style="font-size: 9px;">xx/xx/xxxx xx:xx</span></span></h1>
<div style="margin: 5px;">
<a id="propertiesRawButton" href="#" class="button">Property Stats</a>
<div class="row center_table" style="width: 1100px;">
<div class="column center">
<h2 id="statsTitleO">Statistics des property</h2>
<div>Nombre de property : <span id="propertyCountO">n/a</span></div>
<div>Nombre de fichiers : <span id="fileCountO">n/a</span></div>
<div class="left">
<table class="table_classic center_table sortable">
<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="propertyLineO">
<td id="propertyLinePathO" class="">n/a</td>
<td id="propertyLineFilledCountO" class="td_number">n/a</td>
<td id="propertyLineFilledCountPercentageO" class="td_number">n/a</td>
<td id="propertyLineBlankCountO" class="td_number">n/a</td>
<td id="propertyLineBlankCountPercentageO" class="td_number">n/a</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="center">
<h2>Statistics des property</h2>
<div class="column" style="width: 20px;">&#160;</div>
<div class="column center">
<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">
<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="propertyLineS">
<td id="propertyLinePathS" class="">n/a</td>
<td id="propertyLineFilledCountS" class="td_number">n/a</td>
<td id="propertyLineFilledCountPercentageS" class="td_number">n/a</td>
<td id="propertyLineBlankCountS" class="td_number">n/a</td>
<td id="propertyLineBlankCountPercentageS" class="td_number">n/a</td>
</tr>
</tbody>
</table>
</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="width: 600px; margin-left: auto; margin-right: auto;">
<table class="table_classic center_table sortable " style="margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="width: 150px;">Path</th>
@ -45,7 +99,36 @@
</table>
</div>
</div>
<div class="column" style="width: 20px;">&#160;</div>
</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>
</body>
</html>

View file

@ -1,134 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>StatoolInfos</title>
<meta charset="UTF-8" />
<meta name="keywords" content="statoolinfos,devinsy,federation" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="statoolinfos.css" />
<script src="sorttable.js" />
<script src="Chart.bundle.min.js"></script>
</head>
<body>
<div class="row center_table" style="width: 1100px;">
<div class="column center">
<h2 id="statsTitleO">Statistics des property</h2>
<div>Nombre de property : <span id="propertyCountO">n/a</span></div>
<div>Nombre de fichiers : <span id="fileCountO">n/a</span></div>
<div class="left">
<table class="table_classic center_table sortable">
<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="propertyLineO">
<td id="propertyLinePathO" class="">n/a</td>
<td id="propertyLineFilledCountO" class="td_number">n/a</td>
<td id="propertyLineFilledCountPercentageO" class="td_number">n/a</td>
<td id="propertyLineBlankCountO" class="td_number">n/a</td>
<td id="propertyLineBlankCountPercentageO" 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="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">
<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="propertyLineS">
<td id="propertyLinePathS" class="">n/a</td>
<td id="propertyLineFilledCountS" class="td_number">n/a</td>
<td id="propertyLineFilledCountPercentageS" class="td_number">n/a</td>
<td id="propertyLineBlankCountS" class="td_number">n/a</td>
<td id="propertyLineBlankCountPercentageS" class="td_number">n/a</td>
</tr>
</tbody>
</table>
</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>
</body>
</html>

View file

@ -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)