Added services page.
This commit is contained in:
parent
c5843f0ff9
commit
ed60bf88cd
9 changed files with 159 additions and 17 deletions
|
@ -93,6 +93,7 @@ public class Factory
|
||||||
{
|
{
|
||||||
File subFile = cache.restoreFile(new URL(property.getValue()));
|
File subFile = cache.restoreFile(new URL(property.getValue()));
|
||||||
Organization organization = loadOrganization(subFile, cache);
|
Organization organization = loadOrganization(subFile, cache);
|
||||||
|
organization.setFederation(result);
|
||||||
result.getOrganizations().add(organization);
|
result.getOrganizations().add(organization);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,6 +128,7 @@ public class Factory
|
||||||
{
|
{
|
||||||
File subFile = cache.restoreFile(new URL(property.getValue()));
|
File subFile = cache.restoreFile(new URL(property.getValue()));
|
||||||
Service service = loadService(subFile);
|
Service service = loadService(subFile);
|
||||||
|
service.setOrganization(result);
|
||||||
result.getServices().add(service);
|
result.getServices().add(service);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import fr.devinsy.statoolinfos.properties.PathPropertyList;
|
||||||
public class Organization extends PathPropertyList
|
public class Organization extends PathPropertyList
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = -2709210934548224213L;
|
private static final long serialVersionUID = -2709210934548224213L;
|
||||||
|
private Federation federation;
|
||||||
private Services services;
|
private Services services;
|
||||||
private File localFile;
|
private File localFile;
|
||||||
|
|
||||||
|
@ -75,6 +76,11 @@ public class Organization extends PathPropertyList
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Federation getFederation()
|
||||||
|
{
|
||||||
|
return this.federation;
|
||||||
|
}
|
||||||
|
|
||||||
public File getLocalFile()
|
public File getLocalFile()
|
||||||
{
|
{
|
||||||
return this.localFile;
|
return this.localFile;
|
||||||
|
@ -170,6 +176,11 @@ public class Organization extends PathPropertyList
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFederation(final Federation federation)
|
||||||
|
{
|
||||||
|
this.federation = federation;
|
||||||
|
}
|
||||||
|
|
||||||
public void setLocalFile(final File localFile)
|
public void setLocalFile(final File localFile)
|
||||||
{
|
{
|
||||||
this.localFile = localFile;
|
this.localFile = localFile;
|
||||||
|
|
|
@ -33,6 +33,7 @@ import fr.devinsy.statoolinfos.properties.PathPropertyList;
|
||||||
public class Service extends PathPropertyList
|
public class Service extends PathPropertyList
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 3629841771102288863L;
|
private static final long serialVersionUID = 3629841771102288863L;
|
||||||
|
private Organization organization;
|
||||||
private File localFile;
|
private File localFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,6 +115,11 @@ public class Service extends PathPropertyList
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Organization getOrganization()
|
||||||
|
{
|
||||||
|
return this.organization;
|
||||||
|
}
|
||||||
|
|
||||||
public String getSoftware()
|
public String getSoftware()
|
||||||
{
|
{
|
||||||
String result;
|
String result;
|
||||||
|
@ -158,4 +164,9 @@ public class Service extends PathPropertyList
|
||||||
{
|
{
|
||||||
this.localFile = localFile;
|
this.localFile = localFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOrganization(final Organization organization)
|
||||||
|
{
|
||||||
|
this.organization = organization;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,6 +254,10 @@ public class Htmlizer
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
logger.info("Htmlize services page.");
|
||||||
|
page = ServicesPage.build(federation.getAllServices());
|
||||||
|
FileUtils.write(new File(htmlizeDirectory, "services.xhtml"), page, StandardCharsets.UTF_8);
|
||||||
|
|
||||||
logger.info("Htmlize propertiesFiles page.");
|
logger.info("Htmlize propertiesFiles page.");
|
||||||
page = PropertiesFilesPage.build(federation);
|
page = PropertiesFilesPage.build(federation);
|
||||||
FileUtils.write(new File(htmlizeDirectory, "propertiesFiles.xhtml"), page, StandardCharsets.UTF_8);
|
FileUtils.write(new File(htmlizeDirectory, "propertiesFiles.xhtml"), page, StandardCharsets.UTF_8);
|
||||||
|
|
|
@ -18,17 +18,12 @@
|
||||||
*/
|
*/
|
||||||
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.Organization;
|
import fr.devinsy.statoolinfos.core.Organization;
|
||||||
import fr.devinsy.statoolinfos.core.Service;
|
import fr.devinsy.statoolinfos.core.Service;
|
||||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||||
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;
|
||||||
|
@ -59,9 +54,6 @@ public class OrganizationPage
|
||||||
|
|
||||||
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.setAttribute("organizationRawButton", "href", organization.getTechnicalName() + ".properties");
|
data.setAttribute("organizationRawButton", "href", organization.getTechnicalName() + ".properties");
|
||||||
|
|
||||||
data.setAttribute("organizationLogo", "src", organization.getTechnicalName() + "-logo.png");
|
data.setAttribute("organizationLogo", "src", organization.getTechnicalName() + "-logo.png");
|
||||||
|
|
|
@ -18,17 +18,12 @@
|
||||||
*/
|
*/
|
||||||
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.Organization;
|
import fr.devinsy.statoolinfos.core.Organization;
|
||||||
import fr.devinsy.statoolinfos.core.Service;
|
import fr.devinsy.statoolinfos.core.Service;
|
||||||
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
import fr.devinsy.statoolinfos.core.StatoolInfosException;
|
||||||
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;
|
||||||
|
@ -59,9 +54,6 @@ public class ServicePage
|
||||||
|
|
||||||
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.setAttribute("serviceRawButton", "href", organization.getTechnicalName() + "-" + service.getTechnicalName() + ".properties");
|
data.setAttribute("serviceRawButton", "href", organization.getTechnicalName() + "-" + service.getTechnicalName() + ".properties");
|
||||||
|
|
||||||
data.setAttribute("serviceLogo", "src", organization.getTechnicalName() + "-" + service.getTechnicalName() + "-logo.png");
|
data.setAttribute("serviceLogo", "src", organization.getTechnicalName() + "-" + service.getTechnicalName() + "-logo.png");
|
||||||
|
|
87
src/fr/devinsy/statoolinfos/htmlize/ServicesPage.java
Normal file
87
src/fr/devinsy/statoolinfos/htmlize/ServicesPage.java
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
/*
|
||||||
|
* 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 org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import fr.devinsy.statoolinfos.core.Service;
|
||||||
|
import fr.devinsy.statoolinfos.core.Services;
|
||||||
|
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 ServicesPage.
|
||||||
|
*/
|
||||||
|
public class ServicesPage
|
||||||
|
{
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(ServicesPage.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the.
|
||||||
|
*
|
||||||
|
* @param services
|
||||||
|
* the services
|
||||||
|
* @return the string
|
||||||
|
* @throws StatoolInfosException
|
||||||
|
* the statool infos exception
|
||||||
|
*/
|
||||||
|
public static String build(final Services services) throws StatoolInfosException
|
||||||
|
{
|
||||||
|
String result;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
logger.debug("Building services page.");
|
||||||
|
|
||||||
|
TagDataManager data = new TagDataManager();
|
||||||
|
|
||||||
|
data.setContent("serviceCount", services.size());
|
||||||
|
|
||||||
|
int index = 0;
|
||||||
|
for (Service service : services)
|
||||||
|
{
|
||||||
|
data.setAttribute("serviceListLine", index, "serviceListLineLogo", "src", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-logo.png");
|
||||||
|
data.setEscapedContent("serviceListLine", index, "serviceListLineNameValue", service.getName());
|
||||||
|
data.setAttribute("serviceListLine", index, "serviceListLineNameLink", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml");
|
||||||
|
data.setEscapedContent("serviceListLine", index, "serviceListLineOrganizationLink", service.getOrganization().getName());
|
||||||
|
data.setAttribute("serviceListLine", index, "serviceListLineOrganizationLink", "href", service.getOrganization().getTechnicalName() + ".xhtml");
|
||||||
|
data.setEscapedContent("serviceListLine", index, "serviceListLineUrlLink", service.getWebsite());
|
||||||
|
data.setEscapedContent("serviceListLine", index, "serviceListLineWebsiteLink", service.getWebsite());
|
||||||
|
data.setAttribute("serviceListLine", index, "serviceListLineWebsiteLink", "href", service.getWebsite());
|
||||||
|
data.setEscapedContent("serviceListLine", index, "serviceListLineSoftware", service.getSoftware());
|
||||||
|
|
||||||
|
index += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/services.xhtml", data).toString();
|
||||||
|
|
||||||
|
result = WebCharterView.build(content);
|
||||||
|
}
|
||||||
|
catch (XidynException exception)
|
||||||
|
{
|
||||||
|
throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
43
src/fr/devinsy/statoolinfos/htmlize/services.xhtml
Normal file
43
src/fr/devinsy/statoolinfos/htmlize/services.xhtml
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
<?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>
|
||||||
|
<h2>Tous les services</h2>
|
||||||
|
|
||||||
|
<div>Nombre de services : <span id="serviceCount">n/a</span></div>
|
||||||
|
<div>
|
||||||
|
<table class="table_classic sortable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="">Nom du service</th>
|
||||||
|
<th class="">Organisation</th>
|
||||||
|
<th class="">URL</th>
|
||||||
|
<th class="">Logiciel</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr id="serviceListLine">
|
||||||
|
<td id="serviceListLineName" style="padding-top: 0; padding-bottom: 0;">
|
||||||
|
<a href="#" id="serviceListLineNameLink">
|
||||||
|
<img id="serviceListLineLogo" src="" style="width: 26px; height: 26px; padding-top:0; padding-bottom: 0; vertical-align: middle;"/>
|
||||||
|
 <span id="serviceListLineNameValue">n/a</span>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td id="serviceListLineOrganization"><a href="#" id="serviceListLineOrganizationLink">n/a</a></td>
|
||||||
|
<td id="serviceListLineWebsite"><a href="#" id="serviceListLineWebsiteLink">n/a</a></td>
|
||||||
|
<td id="serviceListLineSoftware">n/a</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -17,7 +17,7 @@
|
||||||
<div style="margin: 5px;">
|
<div style="margin: 5px;">
|
||||||
<a id="propertiesRawButton" href="propertiesFiles.xhtml" class="button">Fichiers properties</a>
|
<a id="propertiesRawButton" href="propertiesFiles.xhtml" class="button">Fichiers properties</a>
|
||||||
<a id="propertiesRawButton" href="propertyStats.xhtml" class="button">Toutes les property</a>
|
<a id="propertiesRawButton" href="propertyStats.xhtml" class="button">Toutes les property</a>
|
||||||
<a id="" href="#" class="button">Tous les services</a>
|
<a id="" href="services.xhtml" class="button">Tous les services</a>
|
||||||
<a id="" href="#" class="button">Tous les logiciels</a>
|
<a id="" href="#" class="button">Tous les logiciels</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue