diff --git a/src/fr/devinsy/statoolinfos/htmlize/FederationHeaderView.java b/src/fr/devinsy/statoolinfos/htmlize/FederationHeaderView.java
new file mode 100644
index 0000000..89b9f21
--- /dev/null
+++ b/src/fr/devinsy/statoolinfos/htmlize/FederationHeaderView.java
@@ -0,0 +1,138 @@
+/*
+ * 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 org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import fr.devinsy.statoolinfos.checker.PropertyChecks;
+import fr.devinsy.statoolinfos.core.Federation;
+import fr.devinsy.statoolinfos.core.StatoolInfosException;
+import fr.devinsy.xidyn.XidynException;
+import fr.devinsy.xidyn.data.DisplayMode;
+import fr.devinsy.xidyn.data.TagDataManager;
+import fr.devinsy.xidyn.presenters.PresenterUtils;
+import fr.devinsy.xidyn.utils.XidynUtils;
+
+/**
+ * The Class FederationHeaderView.
+ */
+public class FederationHeaderView
+{
+ private static Logger logger = LoggerFactory.getLogger(FederationHeaderView.class);
+
+ /**
+ * 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.setAttribute("federationRawButton", "href", federation.getTechnicalName() + ".properties");
+ data.setAttribute("federationLogo", "src", federation.getLogoFileName());
+ data.setEscapedContent("federationName", federation.getName());
+ data.setEscapedContent("federationDescription", federation.getDescription());
+
+ data.setEscapedContent("federationURL", federation.getWebsite());
+ data.setEscapedAttribute("federationURL", "href", federation.getWebsite());
+ data.setContent("federationStartDate", StringUtils.defaultIfBlank(federation.getStartDate(), "n/a"));
+
+ data.setAttribute("subsLink", "href", "index.xhtml");
+ data.setAttribute("rawLink", "href", federation.getTechnicalName() + ".properties");
+ data.setAttribute("rawCheckLink", "href", federation.getTechnicalName() + "-check.xhtml");
+ data.setAttribute("statsLink", "href", federation.getTechnicalName() + "-stats.xhtml");
+
+ data.setAttribute("crawlLink", "href", federation.getTechnicalName() + "-crawl.xhtml");
+ if (federation.getCrawlJournal().getErrors().isEmpty())
+ {
+ data.setAttribute("crawlLinkImg", "src", "circle-icons/download-mono.svg");
+ }
+ else
+ {
+ data.setAttribute("crawlLinkImg", "src", "circle-icons/download.svg");
+ }
+
+ {
+ PropertyChecks checks = federation.getInputChecksAll();
+
+ data.setContent("errorCount", checks.getErrorCount());
+ data.setContent("warningCount", checks.getWarningCount());
+ data.setContent("voidCount", checks.getVoidCount());
+
+ data.setAttribute("alertLink", "href", federation.getTechnicalName() + "-checkalerts.xhtml");
+ }
+
+ if (StringUtils.isNotBlank(federation.getLegalWebsite()))
+ {
+ data.setEscapedAttribute("legalLink", "href", federation.getLegalWebsite());
+ data.setAttribute("legalLinkImg", "class", "");
+ data.getIdData("legalLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
+ }
+ if (StringUtils.isNotBlank(federation.getContactWebsite()))
+ {
+ data.setEscapedAttribute("contactLink", "href", federation.getContactWebsite());
+ data.setAttribute("contactLinkImg", "class", "");
+ data.getIdData("contactLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
+ }
+ if (StringUtils.isNotBlank(federation.getContactEmail()))
+ {
+ data.setEscapedAttribute("emailLink", "href", "mailto:" + federation.getContactEmail());
+ data.setAttribute("emailLinkImg", "class", "");
+ data.getIdData("emailLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
+ }
+ if (StringUtils.isNotBlank(federation.getUserDocWebsite()))
+ {
+ data.setEscapedAttribute("userDocLink", "href", federation.getUserDocWebsite());
+ data.setAttribute("userDocLinkImg", "class", "");
+ data.getIdData("userDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
+ }
+ if (StringUtils.isNotBlank(federation.getTechnicalDocWebsite()))
+ {
+ data.setEscapedAttribute("technicalDocLink", "href", federation.getTechnicalDocWebsite());
+ data.setAttribute("technicalDocLinkImg", "class", "");
+ data.getIdData("technicalDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
+ }
+
+ String content = PresenterUtils.dynamize("/fr/devinsy/statoolinfos/htmlize/federationHeaderView.xhtml", data).toString();
+
+ result = XidynUtils.extractBodyContent(content);
+ }
+ catch (XidynException exception)
+ {
+ throw new StatoolInfosException("Error building federation header view: " + exception.getMessage(), exception);
+ }
+
+ //
+ return result;
+ }
+}
diff --git a/src/fr/devinsy/statoolinfos/htmlize/FederationPage.java b/src/fr/devinsy/statoolinfos/htmlize/FederationPage.java
index 259d8b5..a3cd445 100644
--- a/src/fr/devinsy/statoolinfos/htmlize/FederationPage.java
+++ b/src/fr/devinsy/statoolinfos/htmlize/FederationPage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2020 Christian Pierre MOMON
+ * Copyright (C) 2020-2021 Christian Pierre MOMON
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@@ -24,19 +24,16 @@ import java.nio.charset.StandardCharsets;
import java.time.format.DateTimeFormatter;
import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.devinsy.catgenerator.core.CatGenerator;
import fr.devinsy.statoolinfos.HtmlizerContext;
-import fr.devinsy.statoolinfos.checker.PropertyChecks;
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.xidyn.XidynException;
-import fr.devinsy.xidyn.data.DisplayMode;
import fr.devinsy.xidyn.data.TagDataManager;
import fr.devinsy.xidyn.presenters.PresenterUtils;
@@ -97,70 +94,7 @@ public class FederationPage
TagDataManager data = new TagDataManager();
- data.setAttribute("federationRawButton", "href", federation.getTechnicalName() + ".properties");
- data.setAttribute("federationLogo", "src", federation.getLogoFileName());
- data.setEscapedContent("federationName", federation.getName());
- data.setEscapedContent("federationDescription", federation.getDescription());
-
- data.setEscapedContent("federationURL", federation.getWebsite());
- data.setEscapedAttribute("federationURL", "href", federation.getWebsite());
- data.setContent("federationStartDate", StringUtils.defaultIfBlank(federation.getStartDate(), "n/a"));
-
- data.setAttribute("subsLink", "href", "index.xhtml");
- data.setAttribute("rawLink", "href", federation.getTechnicalName() + ".properties");
- data.setAttribute("rawCheckLink", "href", federation.getTechnicalName() + "-check.xhtml");
- data.setAttribute("statsLink", "href", federation.getTechnicalName() + "-stats.xhtml");
-
- data.setAttribute("crawlLink", "href", federation.getTechnicalName() + "-crawl.xhtml");
- if (federation.getCrawlJournal().getErrors().isEmpty())
- {
- data.setAttribute("crawlLinkImg", "src", "circle-icons/download-mono.svg");
- }
- else
- {
- data.setAttribute("crawlLinkImg", "src", "circle-icons/download.svg");
- }
-
- {
- PropertyChecks checks = federation.getInputChecksAll();
-
- data.setContent("errorCount", checks.getErrorCount());
- data.setContent("warningCount", checks.getWarningCount());
- data.setContent("voidCount", checks.getVoidCount());
-
- data.setAttribute("alertLink", "href", federation.getTechnicalName() + "-checkalerts.xhtml");
- }
-
- if (StringUtils.isNotBlank(federation.getLegalWebsite()))
- {
- data.setEscapedAttribute("legalLink", "href", federation.getLegalWebsite());
- data.setAttribute("legalLinkImg", "class", "");
- data.getIdData("legalLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
- }
- if (StringUtils.isNotBlank(federation.getContactWebsite()))
- {
- data.setEscapedAttribute("contactLink", "href", federation.getContactWebsite());
- data.setAttribute("contactLinkImg", "class", "");
- data.getIdData("contactLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
- }
- if (StringUtils.isNotBlank(federation.getContactEmail()))
- {
- data.setEscapedAttribute("emailLink", "href", "mailto:" + federation.getContactEmail());
- data.setAttribute("emailLinkImg", "class", "");
- data.getIdData("emailLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
- }
- if (StringUtils.isNotBlank(federation.getUserDocWebsite()))
- {
- data.setEscapedAttribute("userDocLink", "href", federation.getUserDocWebsite());
- data.setAttribute("userDocLinkImg", "class", "");
- data.getIdData("userDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
- }
- if (StringUtils.isNotBlank(federation.getTechnicalDocWebsite()))
- {
- data.setEscapedAttribute("technicalDocLink", "href", federation.getTechnicalDocWebsite());
- data.setAttribute("technicalDocLinkImg", "class", "");
- data.getIdData("technicalDocLinkImg").getAttribute("class").setMode(DisplayMode.REPLACE);
- }
+ data.setContent("federationHeaderView", FederationHeaderView.htmlize(federation));
data.setContent("organizationCount", federation.getOrganizations().size());
data.setContent("serviceCount", federation.getServiceCount());
diff --git a/src/fr/devinsy/statoolinfos/htmlize/federation.xhtml b/src/fr/devinsy/statoolinfos/htmlize/federation.xhtml
index c159147..c433ba5 100644
--- a/src/fr/devinsy/statoolinfos/htmlize/federation.xhtml
+++ b/src/fr/devinsy/statoolinfos/htmlize/federation.xhtml
@@ -11,43 +11,11 @@
-
-
-
-
-
-
-
Description absente…
-
Depuis n/a
-
- Liens :
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Nombre de membres : n/a
-
Nombre de services : n/a
-
+
+
+
Nombre de membres : n/a
+
Nombre de services : n/a
diff --git a/src/fr/devinsy/statoolinfos/htmlize/federationHeaderView.xhtml b/src/fr/devinsy/statoolinfos/htmlize/federationHeaderView.xhtml
new file mode 100644
index 0000000..8200bec
--- /dev/null
+++ b/src/fr/devinsy/statoolinfos/htmlize/federationHeaderView.xhtml
@@ -0,0 +1,48 @@
+
+
+
+
+ StatoolInfos
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Description absente…
+
Depuis n/a
+
+ Liens :
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+