From 7e8aac7ec7491c67b63b7fe97fc65e6eb226a8c9 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Fri, 11 Jun 2021 23:35:50 +0200 Subject: [PATCH] Improved code. --- .../devinsy/statoolinfos/core/Federation.java | 21 +------------- .../statoolinfos/core/Organization.java | 29 +++++++++++++++++++ src/fr/devinsy/statoolinfos/core/Service.java | 21 ++++++++++++++ .../statoolinfos/htmlize/uptimeView.xhtml | 6 +++- .../devinsy/statoolinfos/uptime/URLSet.java | 14 +++++++++ 5 files changed, 70 insertions(+), 21 deletions(-) diff --git a/src/fr/devinsy/statoolinfos/core/Federation.java b/src/fr/devinsy/statoolinfos/core/Federation.java index 7d8e5d5..504ec5b 100644 --- a/src/fr/devinsy/statoolinfos/core/Federation.java +++ b/src/fr/devinsy/statoolinfos/core/Federation.java @@ -523,26 +523,7 @@ public class Federation extends PathPropertyList // for (Organization organization : getOrganizations()) { - result.add(organization.getContactURL()); - result.add(organization.getLegalURL()); - result.add(organization.getLogoURL()); - result.add(organization.getTechnicalGuideURL()); - result.add(organization.getUserGuideURL()); - result.add(organization.getWebsiteURL()); - - // - for (Service service : organization.getServices()) - { - result.add(service.getContactURL()); - result.add(service.getLegalURL()); - result.add(service.getLogoURL()); - result.add(service.getSoftwareWebsite()); - result.add(service.getSoftwareLicenseURL()); - result.add(service.getSoftwareSourceURL()); - result.add(service.getTechnicalGuideURL()); - result.add(service.getUserGuideURL()); - result.add(service.getWebsiteURL()); - } + result.addAll(organization.getURLAll()); } // diff --git a/src/fr/devinsy/statoolinfos/core/Organization.java b/src/fr/devinsy/statoolinfos/core/Organization.java index 814b362..1c595df 100644 --- a/src/fr/devinsy/statoolinfos/core/Organization.java +++ b/src/fr/devinsy/statoolinfos/core/Organization.java @@ -33,6 +33,7 @@ import fr.devinsy.statoolinfos.htmlize.charts.WeekValues; import fr.devinsy.statoolinfos.htmlize.charts.YearValues; import fr.devinsy.statoolinfos.properties.PathProperties; import fr.devinsy.statoolinfos.properties.PathPropertyList; +import fr.devinsy.statoolinfos.uptime.URLSet; import fr.devinsy.statoolinfos.util.URLUtils; /** @@ -682,6 +683,34 @@ public class Organization extends PathPropertyList return result; } + /** + * Gets the URL all. + * + * @return the URL all + */ + public URLSet getURLAll() + { + URLSet result; + + result = new URLSet(); + + result.add(getContactURL()); + result.add(getLegalURL()); + result.add(getLogoURL()); + result.add(getTechnicalGuideURL()); + result.add(getUserGuideURL()); + result.add(getWebsiteURL()); + + // + for (Service service : getServices()) + { + result.addAll(service.getURLAll()); + } + + // + return result; + } + /** * Gets the user count. * diff --git a/src/fr/devinsy/statoolinfos/core/Service.java b/src/fr/devinsy/statoolinfos/core/Service.java index 6e0e2c2..43413ef 100644 --- a/src/fr/devinsy/statoolinfos/core/Service.java +++ b/src/fr/devinsy/statoolinfos/core/Service.java @@ -34,6 +34,7 @@ import fr.devinsy.statoolinfos.crawl.CrawlJournal; import fr.devinsy.statoolinfos.htmlize.charts.MonthValues; import fr.devinsy.statoolinfos.properties.PathProperties; import fr.devinsy.statoolinfos.properties.PathPropertyList; +import fr.devinsy.statoolinfos.uptime.URLSet; import fr.devinsy.statoolinfos.util.URLUtils; /** @@ -779,6 +780,26 @@ public class Service extends PathPropertyList return result; } + public URLSet getURLAll() + { + URLSet result; + + result = new URLSet(); + + result.add(getContactURL()); + result.add(getLegalURL()); + result.add(getLogoURL()); + result.add(getSoftwareWebsite()); + result.add(getSoftwareLicenseURL()); + result.add(getSoftwareSourceURL()); + result.add(getTechnicalGuideURL()); + result.add(getUserGuideURL()); + result.add(getWebsiteURL()); + + // + return result; + } + /** * User count. * diff --git a/src/fr/devinsy/statoolinfos/htmlize/uptimeView.xhtml b/src/fr/devinsy/statoolinfos/htmlize/uptimeView.xhtml index 7352ee4..52d34a9 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/uptimeView.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/uptimeView.xhtml @@ -12,7 +12,11 @@
-

Disponibilités

+

Disponibilité des services

+
+ Tout + Réduit +
diff --git a/src/fr/devinsy/statoolinfos/uptime/URLSet.java b/src/fr/devinsy/statoolinfos/uptime/URLSet.java index 62e9aac..f900c0e 100644 --- a/src/fr/devinsy/statoolinfos/uptime/URLSet.java +++ b/src/fr/devinsy/statoolinfos/uptime/URLSet.java @@ -59,6 +59,20 @@ public class URLSet implements Iterable } } + /** + * Adds the all. + * + * @param urls + * the urls + */ + public void addAll(final URLSet urls) + { + for (URL url : urls) + { + add(url); + } + } + /** * Clear. */