/**
  * 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);
     }
 }
Ejemplo n.º 2
0
 @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()));
 }
Ejemplo n.º 3
0
  @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);
  }