diff --git a/src/fr/devinsy/statoolinfos/core/Organizations.java b/src/fr/devinsy/statoolinfos/core/Organizations.java index ccdcc58..090aaa4 100644 --- a/src/fr/devinsy/statoolinfos/core/Organizations.java +++ b/src/fr/devinsy/statoolinfos/core/Organizations.java @@ -36,6 +36,31 @@ public class Organizations extends ArrayList super(); } + /** + * Filter by social network. + * + * @param value + * the value + * @return the organizations + */ + public Organizations filterBySocialNetwork(final SocialNetworks value) + { + Organizations result; + + result = new Organizations(); + + for (Organization organization : this) + { + if (organization.hasSocialNetwork(value)) + { + result.add(organization); + } + } + + // + return result; + } + /** * Filter by social network. * @@ -60,24 +85,18 @@ public class Organizations extends ArrayList } /** - * Filter by social network. + * Gets the service count. * - * @param value - * the value - * @return the organizations + * @return the service count */ - public Organizations filterBySocialNetwork(final SocialNetworks value) + public int getServiceCount() { - Organizations result; - - result = new Organizations(); + int result; + result = 0; for (Organization organization : this) { - if (organization.hasSocialNetwork(value)) - { - result.add(organization); - } + result += organization.getServiceCount(); } // diff --git a/src/fr/devinsy/statoolinfos/htmlize/FederationHeaderView.java b/src/fr/devinsy/statoolinfos/htmlize/FederationHeaderView.java index 652ce9c..d318e76 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/FederationHeaderView.java +++ b/src/fr/devinsy/statoolinfos/htmlize/FederationHeaderView.java @@ -71,7 +71,8 @@ public class FederationHeaderView } data.setContent("federationStartDate", StringUtils.defaultIfBlank(federation.getStartDate(), "n/a")); - data.setAttribute("subsLink", "href", "index.xhtml"); + data.setAttribute("organizationsLink", "href", federation.getTechnicalName() + "-organizations.xhtml"); + data.setAttribute("servicesLink", "href", federation.getTechnicalName() + "-services.xhtml"); data.setAttribute("rawLink", "href", federation.getTechnicalName() + ".properties"); data.setAttribute("propertyCheckLink", "href", federation.getTechnicalName() + "-propertycheck.xhtml"); data.setAttribute("statsLink", "href", federation.getTechnicalName() + "-stats.xhtml"); diff --git a/src/fr/devinsy/statoolinfos/htmlize/FederationMetricWebPage.java b/src/fr/devinsy/statoolinfos/htmlize/FederationMetricWebPage.java index 332bc1c..5f15fb7 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/FederationMetricWebPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/FederationMetricWebPage.java @@ -53,8 +53,6 @@ public class FederationMetricWebPage */ public static void build(final File htmlizeDirectory, final Federation federation, final ViewMenu view, final PeriodMenu period) throws StatoolInfosException, IOException { - String result; - try { TagDataManager data = new TagDataManager(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/FederationOrganizationsPage.java b/src/fr/devinsy/statoolinfos/htmlize/FederationOrganizationsPage.java new file mode 100644 index 0000000..b188bb5 --- /dev/null +++ b/src/fr/devinsy/statoolinfos/htmlize/FederationOrganizationsPage.java @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2020-2021 Christian Pierre MOMON + * + * 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 . + */ +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 FederationOrganizationsPage. + */ +public class FederationOrganizationsPage +{ + private static Logger logger = LoggerFactory.getLogger(FederationOrganizationsPage.class); + + /** + * Builds the. + * + * @throws StatoolInfosException + * the statool infos exception + * @throws IOException + */ + public static void build() throws StatoolInfosException, IOException + { + Federation federation = HtmlizerContext.instance().getFederation(); + File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory(); + + // + logger.info("PAGE FEDERATION organizations page: {}.", federation.getName()); + String page = htmlize(federation); + + FileUtils.write(new File(htmlizeDirectory, federation.getLocalFileBaseName() + "-organizations.xhtml"), page, StandardCharsets.UTF_8); + } + + /** + * Builds the. + * + * @param federation + * the organization + * @return the string + * @throws StatoolInfosException + * the statool infos exception + * @throws IOException + */ + public static String htmlize(final Federation federation) throws StatoolInfosException, IOException + { + String result; + + try + { + TagDataManager data = new TagDataManager(); + + data.setContent("federationHeaderView", FederationHeaderView.htmlize(federation)); + data.setContent("organizationListView", OrganizationListView.htmlize(federation.getOrganizations())); + + String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/federationOrganizations.xhtml", data).toString(); + + BreadcrumbTrail trail = new BreadcrumbTrail(); + result = WebCharterView.build(content, trail); + } + catch (XidynException exception) + { + throw new StatoolInfosException("Error building federation organizations page: " + exception.getMessage(), exception); + } + + // + return result; + } +} diff --git a/src/fr/devinsy/statoolinfos/htmlize/FederationPage.java b/src/fr/devinsy/statoolinfos/htmlize/FederationPages.java similarity index 56% rename from src/fr/devinsy/statoolinfos/htmlize/FederationPage.java rename to src/fr/devinsy/statoolinfos/htmlize/FederationPages.java index 2215659..0b71c27 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/FederationPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/FederationPages.java @@ -21,7 +21,6 @@ package fr.devinsy.statoolinfos.htmlize; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; -import java.time.format.DateTimeFormatter; import org.apache.commons.io.FileUtils; import org.slf4j.Logger; @@ -30,21 +29,17 @@ import org.slf4j.LoggerFactory; import fr.devinsy.catgenerator.core.CatGenerator; 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.statoolinfos.crawl.CrawlCache; import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.PeriodMenu; import fr.devinsy.statoolinfos.htmlize.FederationMetricMenuView.ViewMenu; -import fr.devinsy.xidyn.XidynException; -import fr.devinsy.xidyn.data.TagDataManager; -import fr.devinsy.xidyn.presenters.PresenterUtils; /** * The Class FederationPage. */ -public class FederationPage +public class FederationPages { - private static Logger logger = LoggerFactory.getLogger(FederationPage.class); + private static Logger logger = LoggerFactory.getLogger(FederationPages.class); /** * Builds the. @@ -68,9 +63,18 @@ public class FederationPage FileUtils.copyFile(federation.getInputFile(), new File(htmlizeDirectory, federation.getTechnicalName() + ".properties")); logger.info("PAGE FEDERATION federation page: {}.", federation.getName()); - String page = htmlize(federation); + String page = FederationOrganizationsPage.htmlize(federation); FileUtils.write(new File(htmlizeDirectory, "index.xhtml"), page, StandardCharsets.UTF_8); + // + FederationOrganizationsPage.build(); + FederationServicesPage.build(); + FederationCrawlJournalPage.build(); + FederationPropertyCheckPage.build(); + FederationPropertyAlertPage.buildAll(); + FederationStatsPage.build(); + FederationUptimePage.build(); + // logger.info("Htmlize federation metric pages: {}.", federation.getName()); for (ViewMenu view : ViewMenu.values()) @@ -91,68 +95,6 @@ public class FederationPage } } - /** - * Builds the. - * - * @param federation - * the organization - * @return the string - * @throws StatoolInfosException - * the statool infos exception - * @throws IOException - */ - public static String htmlize(final Federation federation) throws StatoolInfosException, IOException - { - String result; - - try - { - logger.debug("Building federation page {}…", federation.getName()); - - TagDataManager data = new TagDataManager(); - - data.setContent("federationHeaderView", FederationHeaderView.htmlize(federation)); - - data.setContent("organizationCount", federation.getOrganizations().size()); - data.setContent("serviceCount", federation.getServiceCount()); - - int index = 0; - for (Organization organization : federation.getOrganizations().sortByReverseServiceCount()) - { - data.setAttribute("organizationListLine", index, "organizationListLineNameLink", "href", organization.getTechnicalName() + ".xhtml"); - data.setAttribute("organizationListLine", index, "organizationListLineLogo", "src", organization.getLogoFileName()); - data.setAttribute("organizationListLine", index, "organizationListLineLogo", "alt", organization.getName()); - data.setEscapedContent("organizationListLine", index, "organizationListLineNameValue", organization.getName()); - - if (organization.getWebsiteURL() != null) - { - data.setEscapedContent("organizationListLine", index, "organizationListLineUrlLink", organization.getWebsiteURL().toString()); - data.setEscapedAttribute("organizationListLine", index, "organizationListLineUrlLink", "href", organization.getWebsiteURL().toString()); - } - data.setContent("organizationListLine", index, "organizationListLineServiceCount", organization.getServiceCount()); - data.setContent("organizationListLine", index, "organizationListLineUserCount", organization.getPreviousMonthUserCount()); - data.setContent("organizationListLine", index, "organizationListLineVisitCount", organization.getPreviousMonthVisitCount()); - - data.setContent("organizationListLine", index, "organizationListLineDate", organization.getCrawledDate().format(DateTimeFormatter.ofPattern("dd/MM/YYYY"))); - data.setAttribute("organizationListLine", index, "organizationListLineDate", "title", organization.getCrawledDate().format(DateTimeFormatter.ofPattern("HH:mm:ss"))); - - index += 1; - } - - String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/federation.xhtml", data).toString(); - - BreadcrumbTrail trail = new BreadcrumbTrail(); - result = WebCharterView.build(content, trail); - } - catch (XidynException exception) - { - throw new StatoolInfosException("Error building federation page: " + exception.getMessage(), exception); - } - - // - return result; - } - /** * Htmlize federation logo. * diff --git a/src/fr/devinsy/statoolinfos/htmlize/FederationServicesPage.java b/src/fr/devinsy/statoolinfos/htmlize/FederationServicesPage.java new file mode 100644 index 0000000..f8cdbe0 --- /dev/null +++ b/src/fr/devinsy/statoolinfos/htmlize/FederationServicesPage.java @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2020-2021 Christian Pierre MOMON + * + * 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 . + */ +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 FederationServicesPage. + */ +public class FederationServicesPage +{ + private static Logger logger = LoggerFactory.getLogger(FederationServicesPage.class); + + /** + * Builds the. + * + * @throws StatoolInfosException + * the statool infos exception + * @throws IOException + */ + public static void build() throws StatoolInfosException, IOException + { + Federation federation = HtmlizerContext.instance().getFederation(); + File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory(); + + // + logger.info("PAGE FEDERATION services page: {}.", federation.getName()); + String page = htmlize(federation); + + FileUtils.write(new File(htmlizeDirectory, federation.getLocalFileBaseName() + "-services.xhtml"), page, StandardCharsets.UTF_8); + } + + /** + * Builds the. + * + * @param federation + * the organization + * @return the string + * @throws StatoolInfosException + * the statool infos exception + * @throws IOException + */ + public static String htmlize(final Federation federation) throws StatoolInfosException, IOException + { + String result; + + try + { + TagDataManager data = new TagDataManager(); + + data.setContent("federationHeaderView", FederationHeaderView.htmlize(federation)); + data.setContent("serviceListView", ServiceListView.htmlize(federation.getServicesAll())); + + String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/federationServices.xhtml", data).toString(); + + BreadcrumbTrail trail = new BreadcrumbTrail(); + result = WebCharterView.build(content, trail); + } + catch (XidynException exception) + { + throw new StatoolInfosException("Error building federation services page: " + exception.getMessage(), exception); + } + + // + return result; + } +} diff --git a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java index e783bd7..8143eb3 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java +++ b/src/fr/devinsy/statoolinfos/htmlize/Htmlizer.java @@ -162,12 +162,7 @@ public class Htmlizer CategoryPage.buildAll(); EditoPage.build(); ExportsPage.build(); - FederationPage.build(); - FederationCrawlJournalPage.build(); - FederationPropertyCheckPage.build(); - FederationPropertyAlertPage.buildAll(); - FederationStatsPage.build(); - FederationUptimePage.build(); + FederationPages.build(); OrganizationPage.buildAll(); OrganizationCrawlJournalPage.buildAll(); OrganizationUptimePage.buildAll(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/OrganizationHeaderView.java b/src/fr/devinsy/statoolinfos/htmlize/OrganizationHeaderView.java index aeb4879..ab9b74a 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/OrganizationHeaderView.java +++ b/src/fr/devinsy/statoolinfos/htmlize/OrganizationHeaderView.java @@ -96,7 +96,8 @@ public class OrganizationHeaderView data.setContent("organizationStartDateWord", ""); } - data.setAttribute("subsLink", "href", organization.getTechnicalName() + ".xhtml"); + data.setAttribute("organizationsLink", "href", organization.getFederation().getTechnicalName() + "-organizations.xhtml"); + data.setAttribute("servicesLink", "href", organization.getTechnicalName() + "-services.xhtml"); data.setAttribute("rawLink", "href", organization.getTechnicalName() + ".properties"); data.setAttribute("rawCheckLink", "href", organization.getTechnicalName() + "-propertycheck.xhtml"); diff --git a/src/fr/devinsy/statoolinfos/htmlize/OrganizationListView.java b/src/fr/devinsy/statoolinfos/htmlize/OrganizationListView.java new file mode 100644 index 0000000..1980ede --- /dev/null +++ b/src/fr/devinsy/statoolinfos/htmlize/OrganizationListView.java @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2020-2021 Christian Pierre MOMON + * + * 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 . + */ +package fr.devinsy.statoolinfos.htmlize; + +import java.io.IOException; +import java.time.format.DateTimeFormatter; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import fr.devinsy.statoolinfos.core.Organization; +import fr.devinsy.statoolinfos.core.Organizations; +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 OrganizationsView. + */ +public class OrganizationListView +{ + private static Logger logger = LoggerFactory.getLogger(OrganizationListView.class); + + /** + * Htmlize. + * + * @param organizations + * the organizations + * @return the string + * @throws StatoolInfosException + * the statool infos exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + public static String htmlize(final Organizations organizations) throws StatoolInfosException, IOException + { + String result; + + try + { + TagDataManager data = new TagDataManager(); + + data.setContent("organizationCount", organizations.size()); + data.setContent("serviceCount", organizations.getServiceCount()); + + int index = 0; + for (Organization organization : organizations.sortByReverseServiceCount()) + { + data.setAttribute("organizationListLine", index, "organizationListLineNameLink", "href", organization.getTechnicalName() + ".xhtml"); + data.setAttribute("organizationListLine", index, "organizationListLineLogo", "src", organization.getLogoFileName()); + data.setAttribute("organizationListLine", index, "organizationListLineLogo", "alt", organization.getName()); + data.setEscapedContent("organizationListLine", index, "organizationListLineNameValue", organization.getName()); + + if (organization.getWebsiteURL() != null) + { + data.setEscapedContent("organizationListLine", index, "organizationListLineUrlLink", organization.getWebsiteURL().toString()); + data.setEscapedAttribute("organizationListLine", index, "organizationListLineUrlLink", "href", organization.getWebsiteURL().toString()); + } + data.setContent("organizationListLine", index, "organizationListLineServiceCount", organization.getServiceCount()); + data.setContent("organizationListLine", index, "organizationListLineUserCount", organization.getPreviousMonthUserCount()); + data.setContent("organizationListLine", index, "organizationListLineVisitCount", organization.getPreviousMonthVisitCount()); + + data.setContent("organizationListLine", index, "organizationListLineDate", organization.getCrawledDate().format(DateTimeFormatter.ofPattern("dd/MM/YYYY"))); + data.setAttribute("organizationListLine", index, "organizationListLineDate", "title", organization.getCrawledDate().format(DateTimeFormatter.ofPattern("HH:mm:ss"))); + + index += 1; + } + + String page = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/organizationListView.xhtml", data).toString(); + + result = XidynUtils.extractBodyContent(page); + } + catch (XidynException exception) + { + throw new StatoolInfosException("Error building organizations view: " + exception.getMessage(), exception); + } + + // + return result; + } +} diff --git a/src/fr/devinsy/statoolinfos/htmlize/OrganizationPage.java b/src/fr/devinsy/statoolinfos/htmlize/OrganizationPage.java index ce9b6b7..866105e 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/OrganizationPage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/OrganizationPage.java @@ -69,6 +69,7 @@ public class OrganizationPage logger.info("Htmlize organization page: {}.", organization.getName()); String page = OrganizationPage.htmlize(organization); FileUtils.write(new File(htmlizeDirectory, organization.getTechnicalName() + ".xhtml"), page, StandardCharsets.UTF_8); + FileUtils.write(new File(htmlizeDirectory, organization.getTechnicalName() + "-services.xhtml"), page, StandardCharsets.UTF_8); // OrganizationPropertyAlertPage.buildAll(); diff --git a/src/fr/devinsy/statoolinfos/htmlize/ServiceHeaderView.java b/src/fr/devinsy/statoolinfos/htmlize/ServiceHeaderView.java index 05a1dde..14f276b 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/ServiceHeaderView.java +++ b/src/fr/devinsy/statoolinfos/htmlize/ServiceHeaderView.java @@ -84,6 +84,9 @@ public class ServiceHeaderView data.setAttribute("serviceStatusImg", "src", "status-" + service.getStatus().toString().toLowerCase() + ".png"); data.setAttribute("serviceStatusImg", "title", StringUtils.defaultIfBlank(service.getStatusDescription(), service.getStatus().toString())); + data.setAttribute("organizationsLink", "href", service.getOrganization().getTechnicalName() + "-services.xhtml"); + data.setAttribute("servicesLink", "href", service.getLocalFileBaseName() + "-services.xhtml"); + data.setAttribute("rawLink", "href", service.getLocalFileBaseName() + ".properties"); data.setAttribute("rawCheckLink", "href", service.getLocalFileBaseName() + "-propertycheck.xhtml"); diff --git a/src/fr/devinsy/statoolinfos/htmlize/ServicePage.java b/src/fr/devinsy/statoolinfos/htmlize/ServicePage.java index c28b2bb..5fdfd77 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/ServicePage.java +++ b/src/fr/devinsy/statoolinfos/htmlize/ServicePage.java @@ -77,6 +77,8 @@ public class ServicePage String page = ServicePage.htmlize(service); FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + ".xhtml"), page, StandardCharsets.UTF_8); + ServiceServicesPage.build(service); + // logger.info("Htmlize service metric pages: {}.", service.getName()); for (ViewMenu view : ViewMenu.values()) diff --git a/src/fr/devinsy/statoolinfos/htmlize/ServiceServicesPage.java b/src/fr/devinsy/statoolinfos/htmlize/ServiceServicesPage.java new file mode 100644 index 0000000..de5ee30 --- /dev/null +++ b/src/fr/devinsy/statoolinfos/htmlize/ServiceServicesPage.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2020-2021 Christian Pierre MOMON + * + * 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 . + */ +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.catgenerator.core.BirdGenerator; +import fr.devinsy.statoolinfos.HtmlizerContext; +import fr.devinsy.statoolinfos.core.Service; +import fr.devinsy.statoolinfos.core.Services; +import fr.devinsy.statoolinfos.core.StatoolInfosException; +import fr.devinsy.statoolinfos.crawl.CrawlCache; +import fr.devinsy.xidyn.XidynException; +import fr.devinsy.xidyn.data.TagDataManager; +import fr.devinsy.xidyn.presenters.PresenterUtils; + +// TODO: Auto-generated Javadoc +/** + * The Class ServiceServicesPage. + */ +public class ServiceServicesPage +{ + private static Logger logger = LoggerFactory.getLogger(ServiceServicesPage.class); + + /** + * Builds the view. + * + * @param service + * the service + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws StatoolInfosException + * the statool infos exception + */ + public static void build(final Service service) throws IOException, StatoolInfosException + { + File htmlizeDirectory = HtmlizerContext.instance().getHtmlizeDirectory(); + + // + String page = htmlize(service); + FileUtils.write(new File(htmlizeDirectory, service.getLocalFileBaseName() + "-services.xhtml"), page, StandardCharsets.UTF_8); + } + + /** + * Builds the. + * + * @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)); + + Services services = new Services(); + services.add(service); + data.setContent("servicesView", ServiceListView.htmlize(services)); + + // + String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/serviceServices.xhtml", data).toString(); + + BreadcrumbTrail trail = new BreadcrumbTrail(); + trail.add(service.getOrganization().getName(), service.getOrganization().getTechnicalName() + ".xhtml"); + trail.add(service.getName(), service.getOrganization().getTechnicalName() + "-" + service.getTechnicalName() + ".xhtml"); + result = WebCharterView.build(content, trail); + } + catch (XidynException exception) + { + throw new StatoolInfosException("Error building service page: " + exception.getMessage(), exception); + } + + // + return result; + } +} diff --git a/src/fr/devinsy/statoolinfos/htmlize/federation.xhtml b/src/fr/devinsy/statoolinfos/htmlize/federation.xhtml index ac32d6c..3a6052f 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/federation.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/federation.xhtml @@ -12,51 +12,6 @@
-
-
-
Nombre de membres : n/a
-
Nombre de services : n/a
- - - - - - - - - - - - - - - - - - - - - -
MembreURLServicesUtilisateurs mensuelsVisites mensuellesDate
- - -  n/a - - n/an/an/an/an/a
-
- +
diff --git a/src/fr/devinsy/statoolinfos/htmlize/federationHeaderView.xhtml b/src/fr/devinsy/statoolinfos/htmlize/federationHeaderView.xhtml index 74ca0e8..07ed216 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/federationHeaderView.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/federationHeaderView.xhtml @@ -28,7 +28,8 @@ - + + diff --git a/src/fr/devinsy/statoolinfos/htmlize/federationOrganizations.xhtml b/src/fr/devinsy/statoolinfos/htmlize/federationOrganizations.xhtml new file mode 100644 index 0000000..3a6052f --- /dev/null +++ b/src/fr/devinsy/statoolinfos/htmlize/federationOrganizations.xhtml @@ -0,0 +1,17 @@ + + + + + StatoolInfos + + + + + + + +
+
+ + diff --git a/src/fr/devinsy/statoolinfos/htmlize/federationServices.xhtml b/src/fr/devinsy/statoolinfos/htmlize/federationServices.xhtml new file mode 100644 index 0000000..9e4607f --- /dev/null +++ b/src/fr/devinsy/statoolinfos/htmlize/federationServices.xhtml @@ -0,0 +1,17 @@ + + + + + StatoolInfos + + + + + + + +
+
+ + diff --git a/src/fr/devinsy/statoolinfos/htmlize/organizationHeaderView.xhtml b/src/fr/devinsy/statoolinfos/htmlize/organizationHeaderView.xhtml index eb293d8..9c3b6e2 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/organizationHeaderView.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/organizationHeaderView.xhtml @@ -30,7 +30,8 @@ - + + diff --git a/src/fr/devinsy/statoolinfos/htmlize/organizationListView.xhtml b/src/fr/devinsy/statoolinfos/htmlize/organizationListView.xhtml new file mode 100644 index 0000000..fbd0a40 --- /dev/null +++ b/src/fr/devinsy/statoolinfos/htmlize/organizationListView.xhtml @@ -0,0 +1,61 @@ + + + + + StatoolInfos + + + + + + + +
+
+
Nombre de membres : n/a
+
Nombre de services : n/a
+ + + + + + + + + + + + + + + + + + + + + +
MembreURLServicesUtilisateurs mensuelsVisites mensuellesDate
+ + +  n/a + + n/an/an/an/an/a
+
+ + + diff --git a/src/fr/devinsy/statoolinfos/htmlize/serviceHeaderView.xhtml b/src/fr/devinsy/statoolinfos/htmlize/serviceHeaderView.xhtml index 0b4809e..144386a 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/serviceHeaderView.xhtml +++ b/src/fr/devinsy/statoolinfos/htmlize/serviceHeaderView.xhtml @@ -38,7 +38,8 @@ - + + diff --git a/src/fr/devinsy/statoolinfos/htmlize/serviceServices.xhtml b/src/fr/devinsy/statoolinfos/htmlize/serviceServices.xhtml new file mode 100644 index 0000000..08e61aa --- /dev/null +++ b/src/fr/devinsy/statoolinfos/htmlize/serviceServices.xhtml @@ -0,0 +1,17 @@ + + + + + StatoolInfos + + + + + + + +
+
+ + diff --git a/src/fr/devinsy/statoolinfos/htmlize/stuff/circle-icons/stack-mono.svg b/src/fr/devinsy/statoolinfos/htmlize/stuff/circle-icons/stack-mono.svg new file mode 100644 index 0000000..4bf7895 --- /dev/null +++ b/src/fr/devinsy/statoolinfos/htmlize/stuff/circle-icons/stack-mono.svg @@ -0,0 +1,78 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/src/fr/devinsy/statoolinfos/htmlize/stuff/circle-icons/stack.svg b/src/fr/devinsy/statoolinfos/htmlize/stuff/circle-icons/stack.svg new file mode 100644 index 0000000..f855a08 --- /dev/null +++ b/src/fr/devinsy/statoolinfos/htmlize/stuff/circle-icons/stack.svg @@ -0,0 +1,129 @@ + + + +image/svg+xml \ No newline at end of file