Create interface IDashboardModel to do dependency injection correctly, as Developers reference recommends.

FEA: ItEr75S27PerProjectDashboard
This commit is contained in:
Nacho Barrientos 2011-11-22 18:01:10 +01:00 committed by Manuel Rego Casasnovas
parent b0490ac4f1
commit e1b64b8e34
3 changed files with 72 additions and 4 deletions

View file

@ -29,7 +29,6 @@ import java.util.List;
import org.libreplan.business.orders.entities.Order;
import org.libreplan.web.common.Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@ -50,8 +49,7 @@ import org.zkoss.zul.Window;
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class DashboardController extends GenericForwardComposer {
@Autowired
private DashboardModel dashboardModel;
private IDashboardModel dashboardModel;
private Window dashboardWindow;

View file

@ -49,7 +49,7 @@ import org.springframework.stereotype.Component;
*/
@Component
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class DashboardModel {
public class DashboardModel implements IDashboardModel {
/* Parameters */
public final static int EA_STRETCHES_PERCENTAGE_STEP = 10;

View file

@ -0,0 +1,70 @@
/*
* This file is part of LibrePlan
*
* Copyright (C) 2010-2011 Igalia, S.L.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.libreplan.web.dashboard;
import java.math.BigDecimal;
import java.util.List;
import org.libreplan.business.orders.entities.Order;
interface IDashboardModel {
void setCurrentOrder(Order order);
boolean tasksAvailable();
/* Progress KPI: "Number of tasks by status" */
BigDecimal getPercentageOfFinishedTasks();
BigDecimal getPercentageOfInProgressTasks();
BigDecimal getPercentageOfReadyToStartTasks();
BigDecimal getPercentageOfBlockedTasks();
/* Progress KPI: "Deadline violation" */
BigDecimal getPercentageOfOnScheduleTasks();
BigDecimal getPercentageOfTasksWithViolatedDeadline();
BigDecimal getPercentageOfTasksWithNoDeadline();
/* Progress KPI: "Global Progress of the Project" */
BigDecimal getAdvancePercentageByHours();
BigDecimal getTheoreticalAdvancePercentageByHoursUntilNow();
BigDecimal getCriticalPathProgressByNumHours();
BigDecimal getTheoreticalProgressByNumHoursForCriticalPathUntilNow();
BigDecimal getCriticalPathProgressByDuration();
BigDecimal getTheoreticalProgressByDurationForCriticalPathUntilNow();
/* Time KPI: "Margin with deadline" */
BigDecimal getMarginWithDeadLine();
/* Time KPI: "Estimation accuracy" */
List<Double> getFinishedTasksEstimationAccuracyHistogram();
/* Time KPI: "Lead/Lag in task completion" */
List<Double> getLagInTaskCompletionHistogram();
}