/* * Copyright (C) 2020 Christian Pierre MOMON * * 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 . */ 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 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("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)); 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("issueCreatedClosed6MonthsChartA", CreatedConcludedCountChartView.buildLastMonths("Created/closed 6 months CountA", project, 6)); data.setContent("issueCreatedClosed6MonthsChartB", CreatedConcludedCountChartView.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; } }