From 164c92eb7140db37fc7574006e04a127c7f54931 Mon Sep 17 00:00:00 2001 From: Javier Moran Rua Date: Wed, 29 Jul 2009 21:40:07 +0200 Subject: [PATCH] ItEr19S08CUCreacionProxectoPlanificacionItEr18S08: Fixing code to allow reattachment of transiet objects. --- .../web/planner/ResourceAllocationModel.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/ResourceAllocationModel.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/ResourceAllocationModel.java index 29bdd5c6d..ad67959e3 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/ResourceAllocationModel.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/ResourceAllocationModel.java @@ -145,14 +145,14 @@ public class ResourceAllocationModel implements IResourceAllocationModel { } @Override - @Transactional(readOnly=true) + @Transactional(readOnly = true) public Worker getWorker() { if (resourceAllocation == null) { return null; } Worker worker = ((SpecificResourceAllocation) resourceAllocation) .getWorker(); - if(worker == null) { + if (worker == null) { return null; } try { @@ -188,9 +188,27 @@ public class ResourceAllocationModel implements IResourceAllocationModel { @Override @Transactional(readOnly = true) public void updateGanttTaskDuration() { + + // A set of resourceAllocation objects of the task with the ones which + // are transiet is filled + Set transietResourceAllocations = new HashSet(); + + for (ResourceAllocation resourceAllocation : task + .getResourceAllocations()) { + if (resourceAllocation.isTransient()) { + transietResourceAllocations.add(resourceAllocation); + } + } + taskElementDAO.save(task); task.getDuration(); ganttTask.setEndDate(task.getEndDate()); + + // The set of resourceAllocation objects which are previously transiet + // are put to transiet again + for (ResourceAllocation resourceAllocation : transietResourceAllocations) { + resourceAllocation.makeTransientAgain(); + } } } \ No newline at end of file