diff --git a/src/fr/devinsy/statoolinfos/cli/StatoolInfosCLI.java b/src/fr/devinsy/statoolinfos/cli/StatoolInfosCLI.java index 174b61d..430c5f8 100644 --- a/src/fr/devinsy/statoolinfos/cli/StatoolInfosCLI.java +++ b/src/fr/devinsy/statoolinfos/cli/StatoolInfosCLI.java @@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory; import fr.devinsy.statoolinfos.core.StatoolInfos; import fr.devinsy.statoolinfos.util.BuildInformation; +import fr.devinsy.statoolinfos.util.Chrono; import fr.devinsy.statoolinfos.util.Files; import fr.devinsy.statoolinfos.util.FilesUtils; import fr.devinsy.strings.StringList; @@ -262,6 +263,7 @@ public final class StatoolInfosCLI } else if (isMatching(args, "crawl", "\\s*.+\\s*")) { + Chrono chrono = new Chrono().start(); Files inputs = convertPath(StringUtils.trim(args[1])); for (File input : inputs) { @@ -275,6 +277,7 @@ public final class StatoolInfosCLI exception.printStackTrace(); } } + System.out.println(chrono.format()); } else if (isMatching(args, "format", "\\s*.+\\s*")) { @@ -294,6 +297,7 @@ public final class StatoolInfosCLI } else if (isMatching(args, "htmlize", "\\s*.+\\s*")) { + Chrono chrono = new Chrono().start(); Files inputs = convertPath(StringUtils.trim(args[1])); for (File input : inputs) { @@ -307,6 +311,7 @@ public final class StatoolInfosCLI exception.printStackTrace(); } } + System.out.println(chrono.format()); } else if (isMatching(args, "probe", "\\s*.+\\s*")) { diff --git a/src/fr/devinsy/statoolinfos/htmlize/OrganizationHeaderView.java b/src/fr/devinsy/statoolinfos/htmlize/OrganizationHeaderView.java index 624d3aa..2fd610a 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/OrganizationHeaderView.java +++ b/src/fr/devinsy/statoolinfos/htmlize/OrganizationHeaderView.java @@ -99,6 +99,7 @@ public class OrganizationHeaderView data.setAttribute("rawCheckLink", "href", organization.getTechnicalName() + "-check.xhtml"); data.setAttribute("statsLink", "href", organization.getTechnicalName() + "-stats.xhtml"); + data.setAttribute("metricsLink", "href", organization.getTechnicalName() + "-metrics.xhtml"); data.setAttribute("crawlLink", "href", organization.getTechnicalName() + "-crawl.xhtml"); if (organization.getCrawlJournal().getErrors().isEmpty()) diff --git a/src/fr/devinsy/statoolinfos/htmlize/OrganizationMetricMenuView.java b/src/fr/devinsy/statoolinfos/htmlize/OrganizationMetricMenuView.java index f82238b..b62e73d 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/OrganizationMetricMenuView.java +++ b/src/fr/devinsy/statoolinfos/htmlize/OrganizationMetricMenuView.java @@ -37,7 +37,6 @@ public class OrganizationMetricMenuView public enum MenuItem { - GENERAL, SUMMARY, GENERIC, WEB, @@ -61,17 +60,12 @@ public class OrganizationMetricMenuView { TagDataManager data = new TagDataManager(); - data.setAttribute("generalTypeButton", "href", organization.getTechnicalName() + "-stats.xhtml"); - data.setAttribute("summaryTypeButton", "href", organization.getTechnicalName() + "-stats-summarymetrics.xhtml"); - data.setAttribute("genericTypeButton", "href", organization.getTechnicalName() + "-stats-genericmetrics.xhtml"); - data.setAttribute("webTypeButton", "href", organization.getTechnicalName() + "-stats-webmetrics.xhtml"); - data.setAttribute("specificTypeButton", "href", organization.getTechnicalName() + "-stats-specificmetrics.xhtml"); + data.setAttribute("summaryTypeButton", "href", organization.getTechnicalName() + "-metrics.xhtml"); + data.setAttribute("genericTypeButton", "href", organization.getTechnicalName() + "-metrics-generic.xhtml"); + data.setAttribute("webTypeButton", "href", organization.getTechnicalName() + "-metrics-web.xhtml"); + data.setAttribute("specificTypeButton", "href", organization.getTechnicalName() + "-metrics-specific.xhtml"); - if ((item == null) || (item == MenuItem.GENERAL)) - { - data.appendAttribute("generalTypeButton", "class", "button selected"); - } - else if (item == MenuItem.SUMMARY) + if ((item == null) || (item == MenuItem.SUMMARY)) { data.appendAttribute("summaryTypeButton", "class", "button selected"); } diff --git a/src/fr/devinsy/statoolinfos/htmlize/OrganizationPage.java b/src/fr/devinsy/statoolinfos/htmlize/OrganizationPage.java index 10cc72e..01b4e68 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/OrganizationPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/OrganizationPage.java @@ -78,20 +78,20 @@ public class OrganizationPage FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-stats.xhtml"), page, StandardCharsets.UTF_8); logger.info("Htmlize organization summarty metric page: {}.", organization.getName()); - page = OrganizationSummaryStatsPage.htmlize(organization); - FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-stats-summarymetrics.xhtml"), page, StandardCharsets.UTF_8); + page = OrganizationSummaryMetricPage.htmlize(organization); + FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-metrics.xhtml"), page, StandardCharsets.UTF_8); logger.info("Htmlize organization generic metric page: {}.", organization.getName()); page = OrganizationGenericMetricPage.htmlize(organization); - FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-stats-genericmetrics.xhtml"), page, StandardCharsets.UTF_8); + FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-metrics-generic.xhtml"), page, StandardCharsets.UTF_8); logger.info("Htmlize organization web metric page: {}.", organization.getName()); page = OrganizationWebMetricPage.htmlize(organization); - FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-stats-webmetrics.xhtml"), page, StandardCharsets.UTF_8); + FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-metrics-web.xhtml"), page, StandardCharsets.UTF_8); logger.info("Htmlize service specific metric page: {}.", organization.getName()); page = OrganizationSpecificMetricPage.htmlize(organization); - FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-stats-specificmetrics.xhtml"), page, StandardCharsets.UTF_8); + FileUtils.write(new File(htmlizeDirectory, organization.getLocalFileBaseName() + "-metrics-specific.xhtml"), page, StandardCharsets.UTF_8); } /** diff --git a/src/fr/devinsy/statoolinfos/htmlize/OrganizationStatsPage.java b/src/fr/devinsy/statoolinfos/htmlize/OrganizationStatsPage.java index d895d50..73c8f45 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/OrganizationStatsPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/OrganizationStatsPage.java @@ -18,16 +18,13 @@ */ package fr.devinsy.statoolinfos.htmlize; -import java.io.File; import java.io.IOException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import fr.devinsy.statoolinfos.HtmlizerContext; import fr.devinsy.statoolinfos.core.Organization; import fr.devinsy.statoolinfos.core.StatoolInfosException; -import fr.devinsy.statoolinfos.htmlize.OrganizationMetricMenuView.MenuItem; import fr.devinsy.statoolinfos.stats.StatAgent; import fr.devinsy.statoolinfos.stats.services.RegistrationStats; import fr.devinsy.xidyn.XidynException; @@ -60,13 +57,10 @@ public class OrganizationStatsPage { logger.debug("Building organization stats page {}…"); - File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory(); - TagDataManager data = new TagDataManager(); // data.setContent("headerView", OrganizationHeaderView.htmlize(organization)); - data.setContent("metricMenuView", OrganizationMetricMenuView.htmlize(organization, MenuItem.GENERAL)); // data.setContent("serviceCountYearChart", ChartHtmlizer.htmlizeServiceCountYearChart(organization)); @@ -91,7 +85,7 @@ public class OrganizationStatsPage } // - String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/organizationStatsView.xhtml", data).toString(); + String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/organizationStatsPage.xhtml", data).toString(); // BreadcrumbTrail trail = new BreadcrumbTrail(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/OrganizationSummaryStatsPage.java b/src/fr/devinsy/statoolinfos/htmlize/OrganizationSummaryMetricPage.java similarity index 98% rename from src/fr/devinsy/statoolinfos/htmlize/OrganizationSummaryStatsPage.java rename to src/fr/devinsy/statoolinfos/htmlize/OrganizationSummaryMetricPage.java index aff254a..386f7ac 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/OrganizationSummaryStatsPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/OrganizationSummaryMetricPage.java @@ -38,9 +38,9 @@ import fr.devinsy.xidyn.presenters.PresenterUtils; /** * The Class OrganizationGeneralStatsPage. */ -public class OrganizationSummaryStatsPage +public class OrganizationSummaryMetricPage { - private static Logger logger = LoggerFactory.getLogger(OrganizationSummaryStatsPage.class); + private static Logger logger = LoggerFactory.getLogger(OrganizationSummaryMetricPage.class); /** * Htmlize. diff --git a/src/fr/devinsy/statoolinfos/htmlize/ServiceHeaderView.java b/src/fr/devinsy/statoolinfos/htmlize/ServiceHeaderView.java index d0d707f..d00c94e 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/ServiceHeaderView.java +++ b/src/fr/devinsy/statoolinfos/htmlize/ServiceHeaderView.java @@ -86,6 +86,7 @@ public class ServiceHeaderView data.setAttribute("rawCheckLink", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-check.xhtml"); data.setAttribute("statsLink", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml"); + data.setAttribute("metricsLink", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-metrics.xhtml"); if (StringUtils.isNotBlank(service.getLegalWebsite())) { diff --git a/src/fr/devinsy/statoolinfos/htmlize/ServiceMetricMenuView.java b/src/fr/devinsy/statoolinfos/htmlize/ServiceMetricMenuView.java index 45571f8..381330b 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/ServiceMetricMenuView.java +++ b/src/fr/devinsy/statoolinfos/htmlize/ServiceMetricMenuView.java @@ -37,7 +37,6 @@ public class ServiceMetricMenuView public enum MenuItem { - GENERAL, SUMMARY, WEB, GENERIC, @@ -61,17 +60,12 @@ public class ServiceMetricMenuView { TagDataManager data = new TagDataManager(); - data.setAttribute("generalTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml"); - data.setAttribute("summaryTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-stats-summarymetrics.xhtml"); - data.setAttribute("genericTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-stats-genericmetrics.xhtml"); - data.setAttribute("webTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-stats-webmetrics.xhtml"); - data.setAttribute("specificTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-stats-specificmetrics.xhtml"); + data.setAttribute("summaryTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-metrics.xhtml"); + data.setAttribute("genericTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-metrics-generic.xhtml"); + data.setAttribute("webTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-metrics-web.xhtml"); + data.setAttribute("specificTypeButton", "href", service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + "-metrics-specific.xhtml"); - if ((item == null) || (item == MenuItem.GENERAL)) - { - data.appendAttribute("generalTypeButton", "class", "button selected"); - } - else if (item == MenuItem.SUMMARY) + if ((item == null) || (item == MenuItem.SUMMARY)) { data.appendAttribute("summaryTypeButton", "class", "button selected"); } diff --git a/src/fr/devinsy/statoolinfos/htmlize/ServicePage.java b/src/fr/devinsy/statoolinfos/htmlize/ServicePage.java index fd00e9b..6111156 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/ServicePage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/ServicePage.java @@ -78,20 +78,20 @@ public class ServicePage // logger.info("Htmlize service summary metric page: {}.", service.getName()); page = ServiceSummaryMetricPage.htmlize(service); - FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-stats-summarymetrics.xhtml"), page, StandardCharsets.UTF_8); + FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-metrics.xhtml"), page, StandardCharsets.UTF_8); // logger.info("Htmlize service generic metric page: {}.", service.getName()); page = ServiceGenericMetricPage.htmlize(service); - FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-stats-genericmetrics.xhtml"), page, StandardCharsets.UTF_8); + FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-metrics-generic.xhtml"), page, StandardCharsets.UTF_8); logger.info("Htmlize service web metric page: {}.", service.getName()); page = ServiceWebMetricPage.htmlize(service); - FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-stats-webmetrics.xhtml"), page, StandardCharsets.UTF_8); + FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-metrics-web.xhtml"), page, StandardCharsets.UTF_8); logger.info("Htmlize service specific metric page: {}.", service.getName()); page = ServiceSpecificMetricPage.htmlize(service); - FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-stats-specificmetrics.xhtml"), page, StandardCharsets.UTF_8); + FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-metrics-specific.xhtml"), page, StandardCharsets.UTF_8); } /** diff --git a/src/fr/devinsy/statoolinfos/htmlize/ServiceStatsView.java b/src/fr/devinsy/statoolinfos/htmlize/ServiceStatsView.java index 33cd96e..841b4be 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/ServiceStatsView.java +++ b/src/fr/devinsy/statoolinfos/htmlize/ServiceStatsView.java @@ -24,7 +24,6 @@ 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.statoolinfos.htmlize.ServiceMetricMenuView.MenuItem; import fr.devinsy.statoolinfos.stats.StatAgent; import fr.devinsy.statoolinfos.stats.services.RegistrationStats; import fr.devinsy.xidyn.XidynException; @@ -58,9 +57,6 @@ public class ServiceStatsView TagDataManager data = new TagDataManager(); - // - data.setContent("metricMenuView", ServiceMetricMenuView.htmlize(service, MenuItem.GENERAL)); - // data.setContent("turnoutChart", ChartHtmlizer.htmlizeOrganizationTurnoutChart(service)); diff --git a/src/fr/devinsy/statoolinfos/htmlize/metricMenuView.xhtml b/src/fr/devinsy/statoolinfos/htmlize/metricMenuView.xhtml index 45b8ede..2ae525b 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/metricMenuView.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/metricMenuView.xhtml @@ -14,7 +14,6 @@