Bug #1343: Prevent NullPointerException when creating a new milestone.
The method belongsClosedProject() was not correctly implemented for TaskMilestone objects, I've added the correct implementation for them. FEA: ItEr76S04BugFixing
This commit is contained in:
parent
a4e4f311a1
commit
67b8bc55b6
1 changed files with 16 additions and 0 deletions
|
|
@ -23,6 +23,7 @@ package org.libreplan.business.planner.entities;
|
|||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
|
@ -30,6 +31,8 @@ import org.apache.commons.lang.Validate;
|
|||
import org.hibernate.validator.AssertTrue;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Days;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.business.orders.entities.OrderStatusEnum;
|
||||
import org.libreplan.business.resources.daos.IResourcesSearcher;
|
||||
import org.libreplan.business.scenarios.entities.Scenario;
|
||||
import org.libreplan.business.workingday.IntraDayDate;
|
||||
|
|
@ -181,4 +184,17 @@ public class TaskMilestone extends TaskElement implements ITaskPositionConstrain
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean belongsClosedProject() {
|
||||
EnumSet<OrderStatusEnum> CLOSED = EnumSet.of(OrderStatusEnum.CANCELLED,
|
||||
OrderStatusEnum.FINISHED, OrderStatusEnum.STORED);
|
||||
|
||||
Order order = getParent().getOrderElement().getOrder();
|
||||
if(CLOSED.contains(order.getState())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue