/** * Re-attach {@link TaskSource} */ private void reattachTaskSource() { TaskSource taskSource = task.getTaskSource(); taskSourceDAO.reattach(taskSource); Set<HoursGroup> hoursGroups = taskSource.getHoursGroups(); for (HoursGroup hoursGroup : hoursGroups) { reattachHoursGroup(hoursGroup); } }
@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())); }
@Override @Transactional(readOnly = true) public void reattach(TaskElement taskElement) { if (taskElement.getTaskSource() != null) { taskSourceDAO.reattach(taskElement.getTaskSource()); } taskElementDAO.reattach(taskElement); if (taskElement instanceof Task) { forceLoadHoursGroup((Task) taskElement); if (taskElement.isSubcontracted()) { forceLoadExternalCompany(((Task) taskElement).getSubcontractedTaskData()); } } reattachAndLoadCalendar(taskElement); }