Refactored Property Check in content view.

This commit is contained in:
Christian P. MOMON 2021-06-13 00:48:51 +02:00
parent e365513e94
commit 633efbcc8c
10 changed files with 373 additions and 46 deletions

View file

@ -51,7 +51,7 @@ public class FederationHeaderView
* the statool infos exception
* @throws IOException
*/
public static String htmlize(final Federation federation) throws StatoolInfosException, IOException
public static String htmlize(final Federation federation) throws StatoolInfosException
{
String result;

View file

@ -0,0 +1,95 @@
/*
* Copyright (C) 2020-2021 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.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.HtmlizerContext;
import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
/**
* The Class PropertyFileCheckPage.
*/
public class FederationPropertyFileCheckPage
{
private static Logger logger = LoggerFactory.getLogger(FederationPropertyFileCheckPage.class);
/**
* Builds the.
*
* @throws IOException
* Signals that an I/O exception has occurred.
* @throws StatoolInfosException
* the statool infos exception
*/
public static void build() throws IOException, StatoolInfosException
{
Federation federation = HtmlizerContext.instance().getFederation();
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
String page = htmlize(federation);
FileUtils.write(new File(htmlizeDirectory, federation.getTechnicalName() + "-check.xhtml"), page, StandardCharsets.UTF_8);
}
/**
* Htmlize.
*
* @param federation
* the federation
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
public static String htmlize(final Federation federation) throws StatoolInfosException
{
String result;
try
{
TagDataManager data = new TagDataManager();
data.setContent("headerView", FederationHeaderView.htmlize(federation));
data.setContent("contentView", PropertyFileCheckView.htmlize(federation.getInputChecks()));
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/headerContentView.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add("Propriétés", federation.getLocalFileBaseName() + "-check.xhtml");
result = WebCharterView.build(content, trail);
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building federation property file check page: " + exception.getMessage(), exception);
}
//
return result;
}
}

View file

@ -160,24 +160,27 @@ public class Htmlizer
AboutPage.build();
CategoriesPage.build();
CategoryPage.buildAll();
FederationCrawlJournalPage.build();
OrganizationCrawlJournalPage.buildAll();
ServiceCrawlJournalPage.buildAll();
EditoPage.build();
ExportsPage.build();
FederationPage.build();
FederationStatsPage.build();
FederationCrawlJournalPage.build();
FederationUptimePage.build();
FederationPropertyFileCheckPage.build();
OrganizationPage.buildAll();
OrganizationCrawlJournalPage.buildAll();
OrganizationUptimePage.buildAll();
PropertyFileCheckPage.buildAll();
OrganizationPropertyFileCheckPage.buildAll();
PropertiesFilesPage.build();
PropertyStatsPage.buildAll();
ServicePage.buildAll();
ServiceCrawlJournalPage.buildAll();
ServiceUptimePage.buildAll();
ServicePropertyFileCheckPage.buildAll();
ServicesPage.build();
SoftwaresPage.build();
SoftwarePage.buildAll();
SocialNetworksPage.buildAll();
PropertyFileCheckView.buildAll();
}
}

View file

@ -0,0 +1,99 @@
/*
* Copyright (C) 2020-2021 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.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.HtmlizerContext;
import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.Organization;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
/**
* The Class OrganizationPropertyFileCheckView.
*/
public class OrganizationPropertyFileCheckPage
{
private static Logger logger = LoggerFactory.getLogger(OrganizationPropertyFileCheckPage.class);
/**
* Builds the all 1.
*
* @throws IOException
* Signals that an I/O exception has occurred.
* @throws StatoolInfosException
* the statool infos exception
*/
public static void buildAll() throws IOException, StatoolInfosException
{
Federation federation = HtmlizerContext.instance().getFederation();
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
for (Organization organization : federation.getOrganizations())
{
String page = htmlize(organization);
FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-check.xhtml"), page, StandardCharsets.UTF_8);
}
}
/**
* Htmlize.
*
* @param organization
* the organization
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
public static String htmlize(final Organization organization) throws StatoolInfosException
{
String result;
try
{
TagDataManager data = new TagDataManager();
data.setContent("headerView", OrganizationHeaderView.htmlize(organization));
data.setContent("contentView", PropertyFileCheckView.htmlize(organization.getInputChecks()));
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/headerContentView.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add(organization.getName(), organization.getLocalFileBaseName() + ".xhtml");
trail.add("Propriétés", organization.getLocalFileBaseName() + "-check.xhtml");
result = WebCharterView.build(content, trail);
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building organization property file check page: " + exception.getMessage(), exception);
}
//
return result;
}
}

View file

@ -38,19 +38,22 @@ import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
import fr.devinsy.xidyn.utils.XidynUtils;
/**
* The Class PropertyFileCheckPage.
* The Class PropertyFileCheckView.
*/
public class PropertyFileCheckPage
public class PropertyFileCheckView
{
private static Logger logger = LoggerFactory.getLogger(PropertyFileCheckPage.class);
private static Logger logger = LoggerFactory.getLogger(PropertyFileCheckView.class);
/**
* Builds the.
*
* Builds the all.
*
* @throws IOException
* Signals that an I/O exception has occurred.
* @throws StatoolInfosException
* the statool infos exception
*/
public static void buildAll() throws IOException, StatoolInfosException
{
@ -63,20 +66,14 @@ public class PropertyFileCheckPage
PropertyChecks serviceAlertChecks = new PropertyChecks();
//
PropertyChecks checks = federation.getInputChecks();
String page = htmlize("Fédération", checks);
FileUtils.write(new File(htmlizeDirectory, federation.getTechnicalName() + "-check.xhtml"), page, StandardCharsets.UTF_8);
PropertyChecks alerts = checks.getAlertLines().setFileName(federation.getName());
PropertyChecks alerts = federation.getInputChecks().getAlertLines().setFileName(federation.getName());
allAlertChecks.addAll(alerts);
federationAlertChecks.addAll(alerts);
//
for (Organization organization : federation.getOrganizations())
{
checks = organization.getInputChecks();
page = htmlize("Organisation", checks);
FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-check.xhtml"), page, StandardCharsets.UTF_8);
PropertyChecks checks = organization.getInputChecks();
// Ignore ghost organizations.
if (organization.getServiceCount() > 0)
@ -87,21 +84,13 @@ public class PropertyFileCheckPage
for (Service service : organization.getServices())
{
checks = service.getInputChecks();
page = htmlize("Service", checks);
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-check.xhtml"), page, StandardCharsets.UTF_8);
alerts = checks.getAlertLines().setFileName(service.getLocalFileName());
alerts = service.getInputChecks().getAlertLines().setFileName(service.getLocalFileName());
allAlertChecks.addAll(alerts);
serviceAlertChecks.addAll(alerts);
for (Metrics metrics : service.getMetrics())
{
checks = metrics.getInputChecks();
page = htmlize("Metrics", checks);
FileUtils.write(new File(htmlizeDirectory, metrics.getLocalFileBaseName() + "-check.xhtml"), page, StandardCharsets.UTF_8);
alerts = checks.getAlertLines().setFileName(metrics.getLocalFileName());
alerts = metrics.getInputChecks().getAlertLines().setFileName(metrics.getLocalFileName());
allAlertChecks.addAll(alerts);
serviceAlertChecks.addAll(alerts);
}
@ -110,7 +99,7 @@ public class PropertyFileCheckPage
}
//
page = PropertyFilesCheckPage.htmlize("Tous", allAlertChecks);
String page = PropertyFilesCheckPage.htmlize("Tous", allAlertChecks);
FileUtils.write(new File(htmlizeDirectory, "alertChecks.xhtml"), page, StandardCharsets.UTF_8);
page = PropertyFilesCheckPage.htmlize("Fédération", federationAlertChecks);
@ -134,14 +123,12 @@ public class PropertyFileCheckPage
* @throws StatoolInfosException
* the statool infos exception
*/
public static String htmlize(final String title, final PropertyChecks checks) throws StatoolInfosException
public static String htmlize(final PropertyChecks checks) throws StatoolInfosException
{
String result;
try
{
logger.debug("Building propertyStats page…");
TagDataManager data = new TagDataManager();
data.setContent("lineCount", checks.size());
@ -150,7 +137,7 @@ public class PropertyFileCheckPage
data.setContent("voidCount", checks.getVoidCount());
//
data.setContent("statsTitle", title);
data.setContent("statsTitle", "Propriétés");
//
int index = 0;
@ -213,14 +200,11 @@ public class PropertyFileCheckPage
//
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/propertyFileCheck.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add("Propriétés", "propertyStats.xhtml");
result = WebCharterView.build(content, trail);
result = XidynUtils.extractBodyContent(content);
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception);
throw new StatoolInfosException("Error building property check view: " + exception.getMessage(), exception);
}
//
@ -268,5 +252,4 @@ public class PropertyFileCheckPage
//
return result;
}
}

View file

@ -0,0 +1,147 @@
/*
* Copyright (C) 2020-2021 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.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.statoolinfos.HtmlizerContext;
import fr.devinsy.statoolinfos.core.Federation;
import fr.devinsy.statoolinfos.core.Metrics;
import fr.devinsy.statoolinfos.core.Service;
import fr.devinsy.statoolinfos.core.StatoolInfosException;
import fr.devinsy.xidyn.XidynException;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
/**
* The Class ServicePropertyFileCheckView.
*/
public class ServicePropertyFileCheckPage
{
private static Logger logger = LoggerFactory.getLogger(ServicePropertyFileCheckPage.class);
/**
* Builds the all.
*
* @throws IOException
* Signals that an I/O exception has occurred.
* @throws StatoolInfosException
* the statool infos exception
*/
public static void buildAll() throws IOException, StatoolInfosException
{
Federation federation = HtmlizerContext.instance().getFederation();
File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory();
for (Service service : federation.getServicesAll())
{
String page = htmlize(service);
FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-check.xhtml"), page, StandardCharsets.UTF_8);
for (Metrics metrics : service.getMetrics())
{
page = htmlize(service, metrics);
FileUtils.write(new File(htmlizeDirectory, metrics.getLocalFileBaseName() + "-check.xhtml"), page, StandardCharsets.UTF_8);
}
}
}
/**
* Htmlize.
*
* @param service
* the service
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
public static String htmlize(final Service service) throws StatoolInfosException
{
String result;
try
{
TagDataManager data = new TagDataManager();
data.setContent("headerView", ServiceHeaderView.htmlize(service));
data.setContent("contentView", PropertyFileCheckView.htmlize(service.getInputChecks()));
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/headerContentView.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add(service.getOrganization().getName(), service.getOrganization().getLocalFileBaseName() + ".xhtml");
trail.add(service.getName(), service.getLocalFileBaseName() + ".xhtml");
trail.add("Propriétés", service.getLocalFileBaseName() + "-check.xhtml");
result = WebCharterView.build(content, trail);
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building service property file check page: " + exception.getMessage(), exception);
}
//
return result;
}
/**
* Htmlize.
*
* @param service
* the service
* @param metrics
* the metrics
* @return the string
* @throws StatoolInfosException
* the statool infos exception
*/
public static String htmlize(final Service service, final Metrics metrics) throws StatoolInfosException
{
String result;
try
{
TagDataManager data = new TagDataManager();
data.setContent("headerView", ServiceHeaderView.htmlize(service));
data.setContent("contentView", PropertyFileCheckView.htmlize(metrics.getInputChecks()));
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/headerContentView.xhtml", data).toString();
BreadcrumbTrail trail = new BreadcrumbTrail();
trail.add(service.getOrganization().getName(), service.getOrganization().getLocalFileBaseName() + ".xhtml");
trail.add(service.getName(), service.getLocalFileBaseName() + ".xhtml");
trail.add("Propriétés", service.getLocalFileBaseName() + "-check.xhtml");
trail.add("Propriétés", metrics.getLocalFileBaseName() + "-check.xhtml");
result = WebCharterView.build(content, trail);
}
catch (XidynException exception)
{
throw new StatoolInfosException("Error building metrics property file check page: " + exception.getMessage(), exception);
}
//
return result;
}
}

View file

@ -29,8 +29,8 @@
<a id="userDocLink" href="#"><img id="userDocLinkImg" src="circle-icons/bookshelf.svg" class="disabled" title="Documentation"/></a>
<a id="technicalDocLink" href="#"><img id="technicalDocLinkImg" src="circle-icons/tools.svg" class="disabled" title="Documentation technique"/></a>
<a id="subsLink" href="#"><img id="subsLinkImg" src="circle-icons/frames-mono.svg" title="Liste des organisations"/></a>
<a id="rawCheckLink" href="#"><img id="rawCheckLinkImg" src="circle-icons/clipboard-mono.svg" title="Fichier propriétés analysé"/></a>
<a id="rawLink" href="#"><img id="rawLinkImg" src="circle-icons/document-mono.svg" title="Fichier propriétés"/></a>
<a id="rawCheckLink" href="#"><img id="rawCheckLinkImg" src="circle-icons/clipboard-mono.svg" title="Propriétés"/></a>
<a id="rawLink" href="#"><img id="rawLinkImg" src="circle-icons/document-mono.svg" title="Propriétés brutes"/></a>
<a id="crawlLink" href="#"><img id="crawlLinkImg" src="circle-icons/download-mono.svg" title="Statut des téléchargements"/></a>
<a id="statsLink" href="#"><img id="statsLinkImg" src="circle-icons/piechart-mono.svg" title="Statistiques"/></a>
<a id="metricsLink" href="#"><img id="metricsLinkImg" src="circle-icons/barchart-mono.svg" title="Métriques"/></a>

View file

@ -31,8 +31,8 @@
<a id="userDocLink" href="#"><img id="userDocLinkImg" src="circle-icons/bookshelf.svg" class="disabled" title="Documentation"/></a>
<a id="technicalDocLink" href="#"><img id="technicalDocLinkImg" src="circle-icons/tools.svg" class="disabled" title="Documentation technique"/></a>
<a id="subsLink" href="#"><img id="subsLinkImg" src="circle-icons/frames-mono.svg" title="Liste des services"/></a>
<a id="rawCheckLink" href="#"><img id="rawCheckLinkImg" src="circle-icons/clipboard-mono.svg" title="Fichier propriétés analysé"/></a>
<a id="rawLink" href="#"><img id="rawLinkImg" src="circle-icons/document-mono.svg" title="Fichier propriétés"/></a>
<a id="rawCheckLink" href="#"><img id="rawCheckLinkImg" src="circle-icons/clipboard-mono.svg" title="Propriétés"/></a>
<a id="rawLink" href="#"><img id="rawLinkImg" src="circle-icons/document-mono.svg" title="Propriétés brutes"/></a>
<a id="crawlLink" href="#"><img id="crawlLinkImg" src="circle-icons/download-mono.svg" title="Statut des téléchargements"/></a>
<a id="statsLink" href="#"><img id="statsLinkImg" src="circle-icons/piechart-mono.svg" title="Statistiques"/></a>
<a id="metricsLink" href="#"><img id="metricsLinkImg" src="circle-icons/barchart-mono.svg" title="Métriques"/></a>

View file

@ -13,7 +13,7 @@
<body>
<div class="row center_table" style="width: 1100px;">
<div class="center">
<h2 id="statsTitle">n/a</h2>
<h2 id="statsTitle">Propriétés</h2>
</div>
<div style="margin-left: 0px; margin-bottom: 10px;">
<a id="allButton" href="#all" class="button" onclick="javascript:setView('ALL');">Tout</a>

View file

@ -39,8 +39,8 @@
<a id="userDocLink" href="#"><img id="userDocLinkImg" src="circle-icons/bookshelf.svg" class="disabled" title="Documentation"/></a>
<a id="technicalDocLink" href="#"><img id="technicalDocLinkImg" src="circle-icons/tools.svg" class="disabled" title="Documentation technique"/></a>
<a id="subsLink" href="#"><img id="subsLinkImg" src="circle-icons/frames-mono.svg" title="" class="disabled" /></a>
<a id="rawCheckLink" href="#"><img id="rawCheckLinkImg" src="circle-icons/clipboard-mono.svg" title="Fichier propriétés analysé"/></a>
<a id="rawLink" href="#"><img id="rawLinkImg" src="circle-icons/document-mono.svg" title="Fichier propriétés"/></a>
<a id="rawCheckLink" href="#"><img id="rawCheckLinkImg" src="circle-icons/clipboard-mono.svg" title="Propriétés"/></a>
<a id="rawLink" href="#"><img id="rawLinkImg" src="circle-icons/document-mono.svg" title="Propriétés brutes"/></a>
<a id="crawlLink" href="#"><img id="crawlLinkImg" src="circle-icons/download-mono.svg" title="Statut des téléchargements"/></a>
<a id="statsLink" href="#"><img id="statsLinkImg" src="circle-icons/piechart-mono.svg" title="Statistiques"/></a>
<a id="metricsLink" href="#"><img id="metricsLinkImg" src="circle-icons/barchart-mono.svg" title="Métriques"/></a>