public ProjectStatusReportDTO(OrderElement orderElement, Order orderToAppendName) { code = orderElement.getCode(); if (orderToAppendName != null) { name = orderElement.getName() + " (" + orderToAppendName.getName() + ")"; } else { name = Util.getPrefixSpacesDependingOnDepth(orderElement) + orderElement.getName(); } Integer estimatedHours = orderElement.getWorkHours(); this.estimatedHours = estimatedHours != null ? EffortDuration.hours(estimatedHours) : null; TaskSource taskSource = orderElement.getTaskSource(); if (taskSource != null) { plannedHours = taskSource.getTask().getSumOfAssignedEffort(); } SumChargedEffort sumChargedEffort = orderElement.getSumChargedEffort(); if (sumChargedEffort != null) { imputedHours = sumChargedEffort.getTotalChargedEffort(); } setBudget(orderElement.getSubstractedBudget()); setExpensesBudget(orderElement.getBudget()); setResourcesBudget(orderElement.getResourcesBudget()); }
@Test @Transactional @Ignore("FIXME pending review after rename to libreplan") public void createOrderWithScheduledOrderLine() { Order order = givenOrderFromPrepareForCreate(); OrderElement line = OrderLine.createOrderLineWithUnfixedPercentage(20); order.add(line); line.setName(UUID.randomUUID().toString()); line.setCode(UUID.randomUUID().toString()); assert line.getSchedulingState().isSomewhatScheduled(); orderModel.save(); assertTrue(orderDAO.exists(order.getId())); TaskSource lineTaskSource = line.getTaskSource(); assertTrue(taskSourceDAO.exists(lineTaskSource.getId())); }