2020-01-18 09:55:56 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020 Christian Pierre MOMON <christian.momon@devinsy.fr>
|
|
|
|
*
|
|
|
|
* This file is part of AgirStatool, simple key value database.
|
|
|
|
*
|
|
|
|
* AgirStatool 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.
|
|
|
|
*
|
|
|
|
* AgirStatool 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 AgirStatool. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
package org.april.agirstatool.core.pages;
|
|
|
|
|
|
|
|
import org.april.agirstatool.core.AgirStatoolException;
|
|
|
|
import org.april.agirstatool.core.Project;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
import fr.devinsy.xidyn.XidynException;
|
|
|
|
import fr.devinsy.xidyn.data.TagDataManager;
|
|
|
|
import fr.devinsy.xidyn.presenters.PresenterUtils;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The class AgirStatool.
|
|
|
|
*
|
|
|
|
* @author Christian Pierre MOMON
|
|
|
|
*/
|
|
|
|
public class ProjectPage
|
|
|
|
{
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(ProjectPage.class);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Builds the.
|
|
|
|
*
|
|
|
|
* @param projects
|
|
|
|
* the projects
|
|
|
|
* @return the string
|
|
|
|
* @throws AgirStatoolException
|
|
|
|
* the agir statool exception
|
|
|
|
*/
|
|
|
|
public static String build(final Project project) throws AgirStatoolException
|
|
|
|
{
|
|
|
|
String result;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
logger.info("Building project page " + project.getName() + "…");
|
|
|
|
|
|
|
|
TagDataManager data = new TagDataManager();
|
|
|
|
|
2020-01-21 20:07:49 +01:00
|
|
|
data.setContent("agirLink", project.getName());
|
2020-01-20 17:46:54 +01:00
|
|
|
data.setAttribute("agirLink", "href", "https://agir.april.org/projects/" + project.getIdentifier() + "/issues");
|
2020-01-18 09:55:56 +01:00
|
|
|
|
2020-01-22 18:13:34 +01:00
|
|
|
data.setContent("issueCreatedClosed3MonthsChart", CreatedConcludedCountChartView.buildLastMonths("Created/closed 3 months Count", project, 3));
|
|
|
|
data.setContent("issueCreatedClosed6MonthsChart", CreatedConcludedCountChartView.buildLastMonths("Created/closed 6 months Count", project, 6));
|
|
|
|
data.setContent("issueCreatedClosedPreviousYearChart", CreatedConcludedCountChartView.buildPreviousYear("Created/closed last year Count", project));
|
|
|
|
data.setContent("issueCreatedClosedFullChart", CreatedConcludedCountChartView.buildFull("Created/closed Count", project));
|
2020-01-21 20:07:49 +01:00
|
|
|
|
2020-01-20 08:00:41 +01:00
|
|
|
data.setContent("issueRawChart", IssueStatChartView.build("Issue Raw Count", project));
|
|
|
|
data.setContent("issueGroupedChart", IssueStatChartView.buildGrouped("Issue Grouped Count", project));
|
2020-01-20 17:46:54 +01:00
|
|
|
data.setContent("unassignedRawChart", UnassignedPolarChartView.build("Unassigned Raw Count", project));
|
|
|
|
data.setContent("unassignedGroupedChart", UnassignedPolarChartView.buildGrouped("Unassigned Grouped Count", project));
|
2020-01-22 18:13:34 +01:00
|
|
|
data.setContent("issueCreatedClosed6MonthsChartA", CreatedConcludedCountChartView.buildLastMonths("Created/closed 6 months CountA", project, 6));
|
|
|
|
data.setContent("issueCreatedClosed6MonthsChartB", CreatedConcludedCountChartView.buildLastMonths("Created/closed 6 months CountB", project, 6));
|
2020-01-19 23:33:40 +01:00
|
|
|
|
2020-01-18 09:55:56 +01:00
|
|
|
String projectsRawView = ProjectsRawView.build(project);
|
|
|
|
data.setContent("projectsRawView", projectsRawView);
|
|
|
|
|
|
|
|
String projectsGroupedView = ProjectsGroupedView.build(project);
|
|
|
|
data.setContent("projectsGroupedView", projectsGroupedView);
|
|
|
|
|
|
|
|
result = PresenterUtils.dynamize("/org/april/agirstatool/core/pages/project.xhtml", data).toString();
|
|
|
|
}
|
|
|
|
catch (XidynException exception)
|
|
|
|
{
|
|
|
|
throw new AgirStatoolException("Error building project page: " + exception.getMessage(), exception);
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|