Improved Federation getStartDate management.

This commit is contained in:
Christian P. MOMON 2022-07-24 10:49:28 +02:00
parent a414ba7956
commit f23834d8e3
3 changed files with 23 additions and 8 deletions

View file

@ -21,6 +21,7 @@ package fr.devinsy.statoolinfos.core;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.LocalDate;
import java.time.LocalDateTime;
import org.apache.commons.lang3.StringUtils;
@ -578,7 +579,22 @@ public class Federation extends PathPropertyList
*
* @return the start date
*/
public String getStartDate()
public LocalDate getStartDate()
{
LocalDate result;
result = StatoolInfosUtils.parseDate(getStartDateValue());
//
return result;
}
/**
* Gets the start date.
*
* @return the start date
*/
public String getStartDateValue()
{
String result;

View file

@ -1267,8 +1267,7 @@ public class ChartHtmlizer
{
String result;
result = htmlizeServiceCountMonthChart(federation.getServicesAll(),
YearMonth.from(StatoolInfosUtils.parseDate(federation.getStartDate())));
result = htmlizeServiceCountMonthChart(federation.getServicesAll(), YearMonth.from(federation.getStartDate()));
//
return result;
@ -1287,7 +1286,7 @@ public class ChartHtmlizer
{
String result;
LocalDate startDate = StatoolInfosUtils.parseDate(organization.getFederation().getStartDate());
LocalDate startDate = organization.getFederation().getStartDate();
if (startDate == null)
{
@ -1453,7 +1452,7 @@ public class ChartHtmlizer
{
String result;
result = htmlizeServiceCountYearChart(federation.getServices(), StatoolInfosUtils.parseDate(federation.getStartDate()).getYear());
result = htmlizeServiceCountYearChart(federation.getServices(), federation.getStartDate().getYear());
//
return result;
@ -1472,7 +1471,7 @@ public class ChartHtmlizer
{
String result;
LocalDate startDate = StatoolInfosUtils.parseDate(organization.getFederation().getStartDate());
LocalDate startDate = organization.getFederation().getStartDate();
if (startDate == null)
{

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Christian Pierre MOMON <christian@momon.org>
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org>
*
* This file is part of StatoolInfos, simple service statistics tool.
*
@ -69,7 +69,7 @@ public class FederationHeaderView
data.setEscapedContent("federationURL", federation.getWebsiteURL().toString());
data.setEscapedAttribute("federationURL", "href", federation.getWebsiteURL().toString());
}
data.setContent("federationStartDate", StringUtils.defaultIfBlank(federation.getStartDate(), "n/a"));
data.setContent("federationStartDate", StringUtils.defaultIfBlank(federation.getStartDateValue(), "n/a"));
data.setAttribute("organizationsLink", "href", federation.getTechnicalName() + "-organizations.xhtml");
data.setAttribute("servicesLink", "href", federation.getTechnicalName() + "-services.xhtml");