From 979a4978c653766a2ecbda75cf2495cbba889170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Gonz=C3=A1lez=20Fern=C3=A1ndez?= Date: Mon, 14 Sep 2009 20:17:38 +0200 Subject: [PATCH] ItEr26S07CUAsignacionGrupoRecursosAPlanificacionItEr25S07: Removing unused methods from interface and implementation --- .../allocation/IResourceAllocationModel.java | 16 --------- .../allocation/ResourceAllocationModel.java | 36 +------------------ 2 files changed, 1 insertion(+), 51 deletions(-) diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/IResourceAllocationModel.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/IResourceAllocationModel.java index a0dca0dc4..e3db3d6be 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/IResourceAllocationModel.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/IResourceAllocationModel.java @@ -41,13 +41,6 @@ public interface IResourceAllocationModel { */ Set getCriterions(); - /** - * Returns {@link Set} of {@link GenericResourceAllocation} of current - * - * @return - */ - Set getGenericResourceAllocations(); - /** * Returns the {@link Set} of {@link ResourceAllocation} of the current * {@link Task}. @@ -96,15 +89,6 @@ public interface IResourceAllocationModel { */ void setTask(Task task); - /** - * Update the duration of the current Gantt - * {@link org.zkoss.ganttz.data.Task ganttTask}, depending on the resources - * assigned and the dedication. - * - * @param ganttTask - */ - void updateGanttTaskDuration(); - /** * Cancel operation */ diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ResourceAllocationModel.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ResourceAllocationModel.java index 772c90813..b5999a585 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ResourceAllocationModel.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/ResourceAllocationModel.java @@ -4,7 +4,6 @@ import static org.navalplanner.web.I18nHelper._; import java.math.BigDecimal; import java.util.HashSet; -import java.util.Iterator; import java.util.Set; import org.navalplanner.business.common.exceptions.InstanceNotFoundException; @@ -16,7 +15,6 @@ import org.navalplanner.business.planner.entities.GenericResourceAllocation; import org.navalplanner.business.planner.entities.ResourceAllocation; import org.navalplanner.business.planner.entities.SpecificResourceAllocation; import org.navalplanner.business.planner.entities.Task; -import org.navalplanner.business.resources.daos.IResourceDAO; import org.navalplanner.business.resources.daos.IWorkerDAO; import org.navalplanner.business.resources.entities.Criterion; import org.navalplanner.business.resources.entities.CriterionSatisfaction; @@ -47,9 +45,6 @@ public class ResourceAllocationModel implements IResourceAllocationModel { @Autowired private IHoursGroupDAO hoursGroupDAO; - @Autowired - private IResourceDAO resourceDAO; - @Autowired private IResourceAllocationDAO resourceAllocationDAO; @@ -150,7 +145,7 @@ public class ResourceAllocationModel implements IResourceAllocationModel { reattachWorker(worker); // Check if worker was itself a generic resource if (worker.satisfiesCriterions(getCriterions())) { - Set genericResourceAllocations = getGenericResourceAllocations(); + Set genericResourceAllocations = task.getGenericResourceAllocations(); // Generic resources always match criterions, so we need to remove // one generic resource to leave room for a specific resource if (genericResourceAllocations.size() > 0) { @@ -161,12 +156,6 @@ public class ResourceAllocationModel implements IResourceAllocationModel { task.addResourceAllocation(resourceAllocation); } - @Override - @Transactional(readOnly = true) - public Set getGenericResourceAllocations() { - return task.getGenericResourceAllocations(); - } - @Override public void removeResourceAllocation(ResourceAllocation resourceAllocation) { task.removeResourceAllocation(resourceAllocation); @@ -204,21 +193,6 @@ public class ResourceAllocationModel implements IResourceAllocationModel { } } - @SuppressWarnings("unchecked") - private BigDecimal getSumPercentage(Set resourceAllocations) { - BigDecimal result = new BigDecimal(0); - - for (Iterator i = resourceAllocations.iterator(); i.hasNext();) { - ResourceAllocation resourceAllocation = (ResourceAllocation) i.next(); - BigDecimal percentage = (resourceAllocation.getPercentage() != null) ? resourceAllocation - .getPercentage() - : new BigDecimal(0); - result = result.add(percentage); - } - - return result; - } - private SpecificResourceAllocation findSpecificResourceAllocationByWorker(Worker worker) { for (SpecificResourceAllocation resourceAllocation : task .getSpecificResourceAllocations()) { @@ -248,14 +222,6 @@ public class ResourceAllocationModel implements IResourceAllocationModel { this.ganttTask = ganttTask; } - @Override - @Transactional(readOnly = true) - public void updateGanttTaskDuration() { - taskElementDAO.save(task); - task.getDuration(); - ganttTask.setEndDate(task.getEndDate()); - } - @Override public void cancel() { task.clearResourceAllocations();