From 4c3c072d4ff08afd25d5e58e3e1179c79c682ca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Gonz=C3=A1lez=20Fern=C3=A1ndez?= Date: Wed, 3 Feb 2010 17:09:55 +0100 Subject: [PATCH] ItEr46S12CUVisualizacionResponsabilidadesTRaballoNaPlanificacion: Doing method renaming. Renaming ResourceAllocation#getResourceAllocations to getSatisfiedResourceAllocations in order to convey better its meaning. --- .../business/planner/entities/Task.java | 10 +++++----- .../business/planner/entities/TaskElement.java | 6 +++--- .../business/planner/entities/TaskGroup.java | 4 ++-- .../business/planner/entities/TaskMilestone.java | 2 +- .../business/test/planner/entities/TaskTest.java | 14 +++++++------- .../web/planner/TaskElementAdapter.java | 4 ++-- .../web/planner/allocation/AllocationResult.java | 4 ++-- .../allocation/ResourceAllocationModel.java | 8 ++++---- .../web/planner/order/OrderPlanningModel.java | 4 ++-- .../web/planner/order/SaveCommand.java | 4 ++-- .../web/planner/order/SubcontractModel.java | 2 +- .../web/planner/reassign/ReassignCommand.java | 2 +- .../planner/tabs/AdvancedAllocationTabCreator.java | 2 +- .../reports/SchedulingProgressPerOrderModel.java | 2 +- 14 files changed, 34 insertions(+), 34 deletions(-) diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/Task.java b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/Task.java index d24c216e7..4234887e8 100644 --- a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/Task.java +++ b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/Task.java @@ -123,7 +123,7 @@ public class Task extends TaskElement { throw new UnsupportedOperationException(); } - public Set> getResourceAllocations() { + public Set> getSatisfiedResourceAllocations() { List> filtered = ResourceAllocation .getSatisfied(resourceAllocations); return Collections.unmodifiableSet(new HashSet>( @@ -208,13 +208,13 @@ public class Task extends TaskElement { public Set getGenericResourceAllocations() { return new HashSet(ResourceAllocation .getOfType(GenericResourceAllocation.class, - getResourceAllocations())); + getSatisfiedResourceAllocations())); } public Set getSpecificResourceAllocations() { return new HashSet(ResourceAllocation .getOfType(SpecificResourceAllocation.class, - getResourceAllocations())); + getSatisfiedResourceAllocations())); } public static class ModifiedAllocation { @@ -374,7 +374,7 @@ public class Task extends TaskElement { private void reassign(AllocationModificationStrategy strategy) { List copied = ModifiedAllocation - .copy(getResourceAllocations()); + .copy(getSatisfiedResourceAllocations()); List> toBeModified = ModifiedAllocation .modified(copied); List allocations = strategy @@ -464,7 +464,7 @@ public class Task extends TaskElement { } public void removeAllResourceAllocations() { - Set> resourceAllocations = getResourceAllocations(); + Set> resourceAllocations = getSatisfiedResourceAllocations(); for (ResourceAllocation resourceAllocation : resourceAllocations) { removeResourceAllocation(resourceAllocation); } diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/TaskElement.java b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/TaskElement.java index 674ccb579..80470a56f 100644 --- a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/TaskElement.java +++ b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/TaskElement.java @@ -326,11 +326,11 @@ public abstract class TaskElement extends BaseEntity { return calendar; } - public abstract Set> getResourceAllocations(); + public abstract Set> getSatisfiedResourceAllocations(); public SortedMap getHoursAssignedByDay() { SortedMap result = new TreeMap(); - for (ResourceAllocation resourceAllocation : getResourceAllocations()) { + for (ResourceAllocation resourceAllocation : getSatisfiedResourceAllocations()) { for (DayAssignment each : resourceAllocation .getAssignments()) { addToResult(result, each.getDay(), each.getHours()); @@ -347,7 +347,7 @@ public abstract class TaskElement extends BaseEntity { public List getDayAssignments() { List dayAssignments = new ArrayList(); - Set> resourceAllocations = getResourceAllocations(); + Set> resourceAllocations = getSatisfiedResourceAllocations(); for (ResourceAllocation resourceAllocation : resourceAllocations) { dayAssignments.addAll(resourceAllocation.getAssignments()); } diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/TaskGroup.java b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/TaskGroup.java index 881977215..6580b22cd 100644 --- a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/TaskGroup.java +++ b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/TaskGroup.java @@ -88,12 +88,12 @@ public class TaskGroup extends TaskElement { } @Override - public Set> getResourceAllocations() { + public Set> getSatisfiedResourceAllocations() { Set> result = new HashSet>(); List children = this.getChildren(); for (TaskElement child : children) { - result.addAll(child.getResourceAllocations()); + result.addAll(child.getSatisfiedResourceAllocations()); } return result; diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/TaskMilestone.java b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/TaskMilestone.java index 2f68e1acf..9edb73221 100644 --- a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/TaskMilestone.java +++ b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/TaskMilestone.java @@ -49,7 +49,7 @@ public class TaskMilestone extends TaskElement { } - public Set> getResourceAllocations() { + public Set> getSatisfiedResourceAllocations() { return Collections.emptySet(); } diff --git a/navalplanner-business/src/test/java/org/navalplanner/business/test/planner/entities/TaskTest.java b/navalplanner-business/src/test/java/org/navalplanner/business/test/planner/entities/TaskTest.java index 4ffc4b998..10f78d0ad 100644 --- a/navalplanner-business/src/test/java/org/navalplanner/business/test/planner/entities/TaskTest.java +++ b/navalplanner-business/src/test/java/org/navalplanner/business/test/planner/entities/TaskTest.java @@ -91,7 +91,7 @@ public class TaskTest { @Test public void getResourceAllocationsDoesntRetrieveUnsatisfiedAllocations() { - assertThat(task.getResourceAllocations().size(), equalTo(0)); + assertThat(task.getSatisfiedResourceAllocations().size(), equalTo(0)); SpecificResourceAllocation unsatisfied = SpecificResourceAllocation .create(task); @@ -99,32 +99,32 @@ public class TaskTest { + "allocation", unsatisfied.isUnsatisfied()); task.addResourceAllocation(unsatisfied); - assertThat(task.getResourceAllocations().size(), equalTo(0)); + assertThat(task.getSatisfiedResourceAllocations().size(), equalTo(0)); assertThat(task.getAllResourceAllocations().size(), equalTo(1)); } @Test public void addingNoEmptyResourceAllocationAddsIt() { - assertThat(task.getResourceAllocations().size(), equalTo(0)); + assertThat(task.getSatisfiedResourceAllocations().size(), equalTo(0)); SpecificResourceAllocation resourceAllocation = stubResourceAllocationWithAssignedHours( task, 500); task.addResourceAllocation(resourceAllocation); - assertThat(task.getResourceAllocations().size(), equalTo(1)); + assertThat(task.getSatisfiedResourceAllocations().size(), equalTo(1)); } @Test public void taskRemoveResourceAllocation() { - assertThat(task.getResourceAllocations().size(), equalTo(0)); + assertThat(task.getSatisfiedResourceAllocations().size(), equalTo(0)); SpecificResourceAllocation resourceAllocation = stubResourceAllocationWithAssignedHours( task, 500); task.addResourceAllocation(resourceAllocation); - assertThat(task.getResourceAllocations().size(), equalTo(1)); + assertThat(task.getSatisfiedResourceAllocations().size(), equalTo(1)); task.removeResourceAllocation(resourceAllocation); - assertThat(task.getResourceAllocations().size(), equalTo(0)); + assertThat(task.getSatisfiedResourceAllocations().size(), equalTo(0)); } @Test diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/TaskElementAdapter.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/TaskElementAdapter.java index 00c1cbcef..b8037726d 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/TaskElementAdapter.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/TaskElementAdapter.java @@ -186,7 +186,7 @@ public class TaskElementAdapter implements ITaskElementAdapter { } private Set resourcesForTask() { - Set> resourceAllocations = taskElement.getResourceAllocations(); + Set> resourceAllocations = taskElement.getSatisfiedResourceAllocations(); Set resources = new HashSet(); for (ResourceAllocation each : resourceAllocations) { resources.addAll(each @@ -419,7 +419,7 @@ public class TaskElementAdapter implements ITaskElementAdapter { List result = new ArrayList(); Set alreadyFoundResources = new HashSet(); for (ResourceAllocation each : taskElement - .getResourceAllocations()) { + .getSatisfiedResourceAllocations()) { result.addAll(extractRepresentations(each, alreadyFoundResources)); } diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationResult.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationResult.java index f677dabbf..baf145159 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationResult.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/allocation/AllocationResult.java @@ -62,7 +62,7 @@ public class AllocationResult { public static AllocationResult createCurrent(Task task) { Set> resourceAllocations = task - .getResourceAllocations(); + .getSatisfiedResourceAllocations(); List modifiedAllocations = ModifiedAllocation .copy(resourceAllocations); AggregateOfResourceAllocations aggregate = new AggregateOfResourceAllocations( @@ -141,7 +141,7 @@ public class AllocationResult { private Set> getNotModified( List> modified) { Set> all = new HashSet>( - task.getResourceAllocations()); + task.getSatisfiedResourceAllocations()); all.removeAll(modified); return all; } 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 0bd56df6c..2802db944 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 @@ -244,10 +244,10 @@ public class ResourceAllocationModel implements IResourceAllocationModel { loadCriterionsOfGenericAllocations(); reattachHoursGroup(this.task.getHoursGroup()); reattachCriterions(this.task.getHoursGroup().getValidCriterions()); - loadResources(this.task.getResourceAllocations()); - loadDerivedAllocations(this.task.getResourceAllocations()); + loadResources(this.task.getSatisfiedResourceAllocations()); + loadDerivedAllocations(this.task.getSatisfiedResourceAllocations()); List initialRows = AllocationRow.toRows(this.task - .getResourceAllocations()); + .getSatisfiedResourceAllocations()); allocationRowsHandler = AllocationRowsHandler.create(task, initialRows, createWorkerFinder()); return allocationRowsHandler; @@ -275,7 +275,7 @@ public class ResourceAllocationModel implements IResourceAllocationModel { private void loadCriterionsOfGenericAllocations() { Set> resourceAllocations = this.task - .getResourceAllocations(); + .getSatisfiedResourceAllocations(); for (ResourceAllocation resourceAllocation : resourceAllocations) { if (resourceAllocation instanceof GenericResourceAllocation) { GenericResourceAllocation generic = (GenericResourceAllocation) resourceAllocation; diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/order/OrderPlanningModel.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/order/OrderPlanningModel.java index ed8cfdbdd..38e441be2 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/order/OrderPlanningModel.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/order/OrderPlanningModel.java @@ -740,7 +740,7 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel { private void forceLoadOfCriterions(TaskElement taskElement) { List generic = ResourceAllocation.getOfType( GenericResourceAllocation.class, taskElement - .getResourceAllocations()); + .getSatisfiedResourceAllocations()); for (GenericResourceAllocation each : generic) { for (Criterion eachCriterion : each.getCriterions()) { eachCriterion.getName(); @@ -754,7 +754,7 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel { */ private void forceLoadOfResourceAllocationsResources(TaskElement taskElement) { Set> resourceAllocations = taskElement - .getResourceAllocations(); + .getSatisfiedResourceAllocations(); for (ResourceAllocation each : resourceAllocations) { each.getAssociatedResources(); for (DerivedAllocation eachDerived : each.getDerivedAllocations()) { diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/order/SaveCommand.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/order/SaveCommand.java index f3623257a..270799db4 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/order/SaveCommand.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/order/SaveCommand.java @@ -137,7 +137,7 @@ public class SaveCommand implements ISaveCommand { } private void removeDetachedDerivedDayAssignments(TaskElement taskElement) { - for (ResourceAllocation each : taskElement.getResourceAllocations()) { + for (ResourceAllocation each : taskElement.getSatisfiedResourceAllocations()) { for (DerivedAllocation eachDerived : each.getDerivedAllocations()) { removeAssigments(eachDerived.getDetached()); eachDerived.clearDetached(); @@ -161,7 +161,7 @@ public class SaveCommand implements ISaveCommand { if (taskElement.isNewObject()) { taskElement.dontPoseAsTransientObjectAnymore(); } - Set> resourceAllocations = taskElement.getResourceAllocations(); + Set> resourceAllocations = taskElement.getSatisfiedResourceAllocations(); dontPoseAsTransient(resourceAllocations); if (!taskElement.isLeaf()) { for (TaskElement each : taskElement.getChildren()) { diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/order/SubcontractModel.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/order/SubcontractModel.java index 0d4b11179..2bc93714c 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/order/SubcontractModel.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/order/SubcontractModel.java @@ -159,7 +159,7 @@ public class SubcontractModel implements ISubcontractModel { @Override public boolean hasResourceAllocations() { if (task != null) { - return !task.getResourceAllocations().isEmpty(); + return !task.getSatisfiedResourceAllocations().isEmpty(); } return false; } diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/reassign/ReassignCommand.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/reassign/ReassignCommand.java index d60f99400..b1a5de270 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/reassign/ReassignCommand.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/reassign/ReassignCommand.java @@ -135,7 +135,7 @@ public class ReassignCommand implements IReassignCommand { for (WithAssociatedEntity each : withEntities) { taskElementDAO.reattach(each.domainEntity); Set> resourceAllocations = each.domainEntity - .getResourceAllocations(); + .getSatisfiedResourceAllocations(); List generic = ResourceAllocation .getOfType(GenericResourceAllocation.class, resourceAllocations); diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/tabs/AdvancedAllocationTabCreator.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/tabs/AdvancedAllocationTabCreator.java index 94cecf434..8962ceeaf 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/tabs/AdvancedAllocationTabCreator.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/planner/tabs/AdvancedAllocationTabCreator.java @@ -90,7 +90,7 @@ public class AdvancedAllocationTabCreator { private Set getAssociatedResources(Task task) { Set result = new HashSet(); for (ResourceAllocation resourceAllocation : task - .getResourceAllocations()) { + .getSatisfiedResourceAllocations()) { result.addAll(resourceAllocation.getAssociatedResources()); } return result; diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/reports/SchedulingProgressPerOrderModel.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/reports/SchedulingProgressPerOrderModel.java index 9263cc2f3..b0f56e364 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/reports/SchedulingProgressPerOrderModel.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/reports/SchedulingProgressPerOrderModel.java @@ -96,7 +96,7 @@ public class SchedulingProgressPerOrderModel implements ISchedulingProgressPerOr for(TaskElement each: tasks) { each.getName(); initializeTaskSource(each.getTaskSource()); - initializeResourceAllocations(each.getResourceAllocations()); + initializeResourceAllocations(each.getSatisfiedResourceAllocations()); } }