From 2ee42fd197ffd20251456beb1f50fd1b6bd7770b Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Sat, 22 Jan 2022 19:29:44 +0100 Subject: [PATCH] Improved code. --- .../devinsy/statoolinfos/core/Federation.java | 20 +++++++++---------- .../statoolinfos/htmlize/ChartHtmlizer.java | 5 ++--- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/fr/devinsy/statoolinfos/core/Federation.java b/src/fr/devinsy/statoolinfos/core/Federation.java index 901f1dc..d11ea9a 100644 --- a/src/fr/devinsy/statoolinfos/core/Federation.java +++ b/src/fr/devinsy/statoolinfos/core/Federation.java @@ -101,15 +101,14 @@ public class Federation extends PathPropertyList * * @return the active services */ - public Services getActiveServices() + public long getActiveServiceCount() { - Services result; - - result = new Services(); + long result; + result = 0; for (Organization organization : getActiveOrganizations()) { - result.addAll(organization.getActiveServices()); + result += organization.getActiveServiceCount(); } // @@ -121,14 +120,15 @@ public class Federation extends PathPropertyList * * @return the active services */ - public long getActiveServiceCount() + public Services getActiveServices() { - long result; + Services result; + + result = new Services(); - result = 0; for (Organization organization : getActiveOrganizations()) { - result += organization.getActiveServiceCount(); + result.addAll(organization.getActiveServices()); } // @@ -510,7 +510,7 @@ public class Federation extends PathPropertyList result = new Softwares(); - for (Service service : getServicesAll()) + for (Service service : getServices()) { if (StringUtils.isNotBlank(service.getSoftwareName())) { diff --git a/src/fr/devinsy/statoolinfos/htmlize/ChartHtmlizer.java b/src/fr/devinsy/statoolinfos/htmlize/ChartHtmlizer.java index 96b9b68..cc3cb8b 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/ChartHtmlizer.java +++ b/src/fr/devinsy/statoolinfos/htmlize/ChartHtmlizer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Christian Pierre MOMON + * Copyright (C) 2020-2022 Christian Pierre MOMON * * This file is part of StatoolInfos, simple service statistics tool. * @@ -1271,8 +1271,7 @@ public class ChartHtmlizer { String result; - result = htmlizeServiceCountYearChart(federation.getServicesAll(), - StatoolInfosUtils.parseDate(federation.getStartDate()).getYear()); + result = htmlizeServiceCountYearChart(federation.getServices(), StatoolInfosUtils.parseDate(federation.getStartDate()).getYear()); // return result;