Fix bug: NullPointerException in calculation of OvertimeRatio

The value of 'order' in OrderResourceLoadCalculator was set in the Gantt
View. Switching from 'Project Details' to 'Dashboard' directly caused a
NullPointerException.

FEA: ItEr76S15OrganizingPerProjectDashboard
This commit is contained in:
Diego Pino 2012-06-07 21:18:32 +02:00
parent 7b29017e00
commit b979db78d2
4 changed files with 14 additions and 6 deletions

View file

@ -34,6 +34,7 @@ import org.libreplan.business.orders.entities.Order;
import org.libreplan.business.planner.entities.TaskElement;
import org.libreplan.business.planner.entities.TaskStatusEnum;
import org.libreplan.web.dashboard.DashboardModel.Interval;
import org.libreplan.web.planner.order.PlanningStateCreator.PlanningState;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Scope;
@ -101,8 +102,10 @@ public class DashboardController extends GenericForwardComposer {
return sb.toString();
}
public void setCurrentOrder(Order order, List<TaskElement> criticalPath) {
dashboardModel.setCurrentOrder(order, criticalPath);
public void setCurrentOrder(PlanningState planningState, List<TaskElement> criticalPath) {
final Order order = planningState.getOrder();
dashboardModel.setCurrentOrder(planningState, criticalPath);
if (dashboardModel.tasksAvailable()) {
if (self != null) {
renderGlobalProgress();

View file

@ -48,6 +48,7 @@ import org.libreplan.business.planner.entities.visitors.CalculateFinishedTasksEs
import org.libreplan.business.planner.entities.visitors.CalculateFinishedTasksLagInCompletionVisitor;
import org.libreplan.business.planner.entities.visitors.ResetTasksStatusVisitor;
import org.libreplan.business.workingday.EffortDuration;
import org.libreplan.web.planner.order.PlanningStateCreator.PlanningState;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
@ -96,7 +97,11 @@ public class DashboardModel implements IDashboardModel {
}
@Override
public void setCurrentOrder(Order order, List<TaskElement> criticalPath) {
public void setCurrentOrder(PlanningState planningState, List<TaskElement> criticalPath) {
final Order order = planningState.getOrder();
resourceLoadCalculator.setOrder(order,
planningState.getAssignmentsCalculator());
this.currentOrder = order;
this.criticalPath = criticalPath;
this.taskCount = null;

View file

@ -23,14 +23,14 @@ import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import org.libreplan.business.orders.entities.Order;
import org.libreplan.business.planner.entities.TaskElement;
import org.libreplan.business.planner.entities.TaskStatusEnum;
import org.libreplan.web.dashboard.DashboardModel.Interval;
import org.libreplan.web.planner.order.PlanningStateCreator.PlanningState;
interface IDashboardModel {
void setCurrentOrder(Order order, List<TaskElement> criticalPath);
void setCurrentOrder(PlanningState planningState, List<TaskElement> criticalPath);
boolean tasksAvailable();

View file

@ -117,7 +117,7 @@ public class DashboardTabCreator {
}
PlanningState planningState = getPlanningState(mode.getOrder(), getDesktop());
Order currentOrder = planningState.getOrder();
dashboardController.setCurrentOrder(currentOrder,
dashboardController.setCurrentOrder(planningState,
criticalPath);
breadcrumbs.getChildren().clear();
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));