103 lines
4.9 KiB
Java
103 lines
4.9 KiB
Java
/*
|
|
* 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;
|
|
import utils.BuildInformation;
|
|
|
|
/**
|
|
* The class AgirStatool.
|
|
*
|
|
* @author Christian Pierre MOMON
|
|
*/
|
|
public class ProjectPage
|
|
{
|
|
private static Logger logger = LoggerFactory.getLogger(ProjectPage.class);
|
|
|
|
/**
|
|
* Builds the.
|
|
*
|
|
* @param project
|
|
* the project
|
|
* @return the string
|
|
* @throws AgirStatoolException
|
|
* the agir statool exception
|
|
*/
|
|
public static String build(final Project project) throws AgirStatoolException
|
|
{
|
|
String result;
|
|
|
|
try
|
|
{
|
|
logger.debug("Building project page {}…", project.getName());
|
|
|
|
TagDataManager data = new TagDataManager();
|
|
|
|
data.setContent("agirLink", project.getName());
|
|
data.setAttribute("agirLink", "href", "https://agir.april.org/projects/" + project.getIdentifier() + "/issues");
|
|
data.setContent("versionsup", BuildInformation.instance().version());
|
|
|
|
data.setContent("createdClosed3MonthsChart", CreatedClosedCountChartView.buildLastMonths("Created/closed 3 months Count", project, 3));
|
|
data.setContent("created-Closed3MonthsChart", CreatedClosedDiffChartView.buildLastMonths("Created-closed 3 months Count", project, 3));
|
|
data.setContent("age3MonthsChart", IssueAgeChartView.buildLastMonths("Issue Age 3 months Chart", project, 3));
|
|
data.setContent("createdClosed6MonthsChart", CreatedClosedCountChartView.buildLastMonths("Created/closed 6 months Count", project, 6));
|
|
data.setContent("created-Closed6MonthsChart", CreatedClosedDiffChartView.buildLastMonths("Created-closed 6 months Count", project, 6));
|
|
data.setContent("age6MonthsChart", IssueAgeChartView.buildLastMonths("Issue Age 6 months", project, 6));
|
|
data.setContent("createdClosedPreviousYearChart", CreatedClosedCountChartView.buildPreviousYear("Created/closed last year Count", project));
|
|
data.setContent("created-ClosedPreviousYearChart", CreatedClosedDiffChartView.buildPreviousYear("Created-closed last year Count", project));
|
|
data.setContent("agePreviousYearChart", IssueAgeChartView.buildPreviousYear("Issue Age Previous Year Chart", project));
|
|
data.setContent("createdClosedFullChart", CreatedClosedCountChartView.buildFull("Created/closed Count", project));
|
|
data.setContent("created-ClosedFullChart", CreatedClosedDiffChartView.buildFull("Created-closed Count", project));
|
|
data.setContent("ageFullChart", IssueAgeChartView.buildFull("Issue Age Full Chart", project));
|
|
|
|
data.setContent("issueRawChart", IssueStatChartView.build("Issue Raw Count", project));
|
|
data.setContent("issueGroupedChart", IssueStatChartView.buildGrouped("Issue Grouped Count", project));
|
|
data.setContent("unassignedRawChart", UnassignedPolarChartView.build("Unassigned Raw Count", project));
|
|
data.setContent("unassignedGroupedChart", UnassignedPolarChartView.buildGrouped("Unassigned Grouped Count", project));
|
|
data.setContent("createdClosed6MonthsChartA", CreatedClosedCountChartView.buildLastMonths("Created/closed 6 months CountA", project, 6));
|
|
data.setContent("createdClosed6MonthsChartB", CreatedClosedCountChartView.buildLastMonths("Created/closed 6 months CountB", project, 6));
|
|
|
|
data.setContent("created-Closed6MonthsChartA", CreatedClosedDiffChartView.buildLastMonths("Created-closed 6 months CountA", project, 6));
|
|
data.setContent("created-Closed6MonthsChartB", CreatedClosedDiffChartView.buildLastMonths("Created-closed 6 months CountB", project, 6));
|
|
|
|
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;
|
|
}
|
|
}
|