Managed active service in organizationList and uptimes.

This commit is contained in:
Christian P. MOMON 2021-09-16 17:31:53 +02:00
parent 073ae817e4
commit 33c585d4ca
7 changed files with 121 additions and 3 deletions

View file

@ -501,6 +501,35 @@ public class Federation extends PathPropertyList
return result;
}
/**
* Gets the URL active all.
*
* @return the URL active all
*/
public URLSet getURLActiveAll()
{
URLSet result;
result = new URLSet();
//
result.add(getContactURL());
result.add(getLegalURL());
result.add(getLogoURL());
result.add(getTechnicalGuideURL());
result.add(getUserGuideURL());
result.add(getWebsiteURL());
//
for (Organization organization : getOrganizations())
{
result.addAll(organization.getURLActiveAll());
}
//
return result;
}
/**
* Gets the URL all.
*

View file

@ -616,6 +616,21 @@ public class Organization extends PathPropertyList
return result;
}
/**
* Gets the service active count.
*
* @return the service active count
*/
public int getServiceActiveCount()
{
int result;
result = this.services.getBy(Service.Status.OK).size();
//
return result;
}
/**
* Gets the service count.
*
@ -683,6 +698,34 @@ public class Organization extends PathPropertyList
return result;
}
/**
* Gets the URL all.
*
* @return the URL all
*/
public URLSet getURLActiveAll()
{
URLSet result;
result = new URLSet();
result.add(getContactURL());
result.add(getLegalURL());
result.add(getLogoURL());
result.add(getTechnicalGuideURL());
result.add(getUserGuideURL());
result.add(getWebsiteURL());
//
for (Service service : getServices().getBy(Service.Status.OK))
{
result.addAll(service.getURLAll());
}
//
return result;
}
/**
* Gets the URL all.
*

View file

@ -84,6 +84,25 @@ public class Organizations extends ArrayList<Organization>
return result;
}
/**
* Gets the service active count.
*
* @return the service active count
*/
public int getServiceActiveCount()
{
int result;
result = 0;
for (Organization organization : this)
{
result += organization.getServiceCount();
}
//
return result;
}
/**
* Gets the service count.
*

View file

@ -23,6 +23,8 @@ import java.util.Collections;
import org.apache.commons.lang3.StringUtils;
import fr.devinsy.statoolinfos.core.Service.Status;
/**
* The Class Services.
*/
@ -90,6 +92,31 @@ public class Services extends ArrayList<Service>
return result;
}
/**
* Gets the by.
*
* @param status
* the category
* @return the by
*/
public Services getBy(final Status status)
{
Services result;
result = new Services();
for (Service service : this)
{
if (service.getStatus() == status)
{
result.add(service);
}
}
//
return result;
}
/**
* Reverse.
*

View file

@ -547,7 +547,7 @@ public class StatoolInfos
UptimeJournal journal = HtmlizerContext.instance().getUptimeJournal();
Federation federation = HtmlizerContext.instance().getFederation();
UptimeSurveyor.survey(journal, federation.getURLAll());
UptimeSurveyor.survey(journal, federation.getURLActiveAll());
HtmlizerContext.instance().getCache().storeUptimeJournal(journal);
}
}

View file

@ -74,7 +74,7 @@ public class OrganizationListView
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, "organizationListLineServiceCount", organization.getServiceActiveCount());
data.setContent("organizationListLine", index, "organizationListLineUserCount", organization.getPreviousMonthUserCount());
data.setContent("organizationListLine", index, "organizationListLineVisitCount", organization.getPreviousMonthVisitCount());

View file

@ -156,7 +156,7 @@ public class UptimeView
}
int index = 0;
for (Service service : services.sortByName())
for (Service service : services.getBy(Service.Status.OK).sortByName())
{
//
data.setAttribute("line", index, "lineLogo", "src", service.getLogoFileName());