ItEr33S14CUCreacionUnidadesPlanificacion: Deadline dates copied to tasks when scheduling
This commit is contained in:
parent
8804c5aff1
commit
fb92e39e2d
2 changed files with 23 additions and 2 deletions
|
|
@ -32,6 +32,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.navalplanner.business.advance.entities.AdvanceMeasurement;
|
||||
import org.navalplanner.business.advance.entities.DirectAdvanceAssignment;
|
||||
import org.navalplanner.business.advance.entities.IndirectAdvanceAssignment;
|
||||
|
|
@ -321,9 +322,10 @@ public class OrderModel implements IOrderModel {
|
|||
|
||||
@Override
|
||||
public TaskElement convertToInitialSchedule(OrderElement order) {
|
||||
TaskElement result;
|
||||
if (order instanceof OrderLineGroup) {
|
||||
OrderLineGroup group = (OrderLineGroup) order;
|
||||
return convertToTaskGroup(group);
|
||||
result = convertToTaskGroup(group);
|
||||
} else {
|
||||
OrderLine line = (OrderLine) order;
|
||||
if (line.getHoursGroups().isEmpty()) {
|
||||
|
|
@ -331,9 +333,13 @@ public class OrderModel implements IOrderModel {
|
|||
"The line must have at least one {0} associated",
|
||||
HoursGroup.class.getSimpleName()));
|
||||
}
|
||||
return line.getHoursGroups().size() > 1 ? convertToTaskGroup(line)
|
||||
result = line.getHoursGroups().size() > 1 ? convertToTaskGroup(line)
|
||||
: convertToTask(line);
|
||||
}
|
||||
if (order.getDeadline() != null) {
|
||||
result.setDeadline(new LocalDate(order.getDeadline()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private TaskGroup convertToTaskGroup(OrderLine line) {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import javax.annotation.Resource;
|
|||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.matchers.JUnitMatchers;
|
||||
|
|
@ -493,6 +494,20 @@ public class OrderModelTest {
|
|||
assertThat(taskElement.getWorkHours(), equalTo(hours));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void theDeadlineIsCopied() {
|
||||
OrderLine orderLine = OrderLine.create();
|
||||
orderLine.setName("bla");
|
||||
orderLine.setCode("000000000");
|
||||
final int hours = 30;
|
||||
HoursGroup hoursGroup = createHoursGroup(hours);
|
||||
orderLine.addHoursGroup(hoursGroup);
|
||||
orderLine.setDeadline(year(2007));
|
||||
TaskElement task = orderModel
|
||||
.convertToInitialSchedule(orderLine);
|
||||
assertThat(task.getDeadline(), equalTo(new LocalDate(year(2007))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void theSublinesOfAnOrderLineGroupAreConverted() {
|
||||
OrderLineGroup orderLineGroup = OrderLineGroup.create();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue