ItEr46S12CUVisualizacionResponsabilidadesTRaballoNaPlanificacion: Doing method renaming.

Renaming ResourceAllocation#getResourceAllocations to
getSatisfiedResourceAllocations in order to convey better its meaning.
This commit is contained in:
Óscar González Fernández 2010-02-03 17:09:55 +01:00
parent b2955b55ab
commit 4c3c072d4f
14 changed files with 34 additions and 34 deletions

View file

@ -123,7 +123,7 @@ public class Task extends TaskElement {
throw new UnsupportedOperationException();
}
public Set<ResourceAllocation<?>> getResourceAllocations() {
public Set<ResourceAllocation<?>> getSatisfiedResourceAllocations() {
List<ResourceAllocation<?>> filtered = ResourceAllocation
.getSatisfied(resourceAllocations);
return Collections.unmodifiableSet(new HashSet<ResourceAllocation<?>>(
@ -208,13 +208,13 @@ public class Task extends TaskElement {
public Set<GenericResourceAllocation> getGenericResourceAllocations() {
return new HashSet<GenericResourceAllocation>(ResourceAllocation
.getOfType(GenericResourceAllocation.class,
getResourceAllocations()));
getSatisfiedResourceAllocations()));
}
public Set<SpecificResourceAllocation> getSpecificResourceAllocations() {
return new HashSet<SpecificResourceAllocation>(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<ModifiedAllocation> copied = ModifiedAllocation
.copy(getResourceAllocations());
.copy(getSatisfiedResourceAllocations());
List<ResourceAllocation<?>> toBeModified = ModifiedAllocation
.modified(copied);
List<ResourcesPerDayModification> allocations = strategy
@ -464,7 +464,7 @@ public class Task extends TaskElement {
}
public void removeAllResourceAllocations() {
Set<ResourceAllocation<?>> resourceAllocations = getResourceAllocations();
Set<ResourceAllocation<?>> resourceAllocations = getSatisfiedResourceAllocations();
for (ResourceAllocation<?> resourceAllocation : resourceAllocations) {
removeResourceAllocation(resourceAllocation);
}

View file

@ -326,11 +326,11 @@ public abstract class TaskElement extends BaseEntity {
return calendar;
}
public abstract Set<ResourceAllocation<?>> getResourceAllocations();
public abstract Set<ResourceAllocation<?>> getSatisfiedResourceAllocations();
public SortedMap<LocalDate, Integer> getHoursAssignedByDay() {
SortedMap<LocalDate, Integer> result = new TreeMap<LocalDate, Integer>();
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<DayAssignment> getDayAssignments() {
List<DayAssignment> dayAssignments = new ArrayList<DayAssignment>();
Set<ResourceAllocation<?>> resourceAllocations = getResourceAllocations();
Set<ResourceAllocation<?>> resourceAllocations = getSatisfiedResourceAllocations();
for (ResourceAllocation<?> resourceAllocation : resourceAllocations) {
dayAssignments.addAll(resourceAllocation.getAssignments());
}

View file

@ -88,12 +88,12 @@ public class TaskGroup extends TaskElement {
}
@Override
public Set<ResourceAllocation<?>> getResourceAllocations() {
public Set<ResourceAllocation<?>> getSatisfiedResourceAllocations() {
Set<ResourceAllocation<?>> result = new HashSet<ResourceAllocation<?>>();
List<TaskElement> children = this.getChildren();
for (TaskElement child : children) {
result.addAll(child.getResourceAllocations());
result.addAll(child.getSatisfiedResourceAllocations());
}
return result;

View file

@ -49,7 +49,7 @@ public class TaskMilestone extends TaskElement {
}
public Set<ResourceAllocation<?>> getResourceAllocations() {
public Set<ResourceAllocation<?>> getSatisfiedResourceAllocations() {
return Collections.emptySet();
}

View file

@ -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

View file

@ -186,7 +186,7 @@ public class TaskElementAdapter implements ITaskElementAdapter {
}
private Set<Resource> resourcesForTask() {
Set<ResourceAllocation<?>> resourceAllocations = taskElement.getResourceAllocations();
Set<ResourceAllocation<?>> resourceAllocations = taskElement.getSatisfiedResourceAllocations();
Set<Resource> resources = new HashSet<Resource>();
for (ResourceAllocation<?> each : resourceAllocations) {
resources.addAll(each
@ -419,7 +419,7 @@ public class TaskElementAdapter implements ITaskElementAdapter {
List<String> result = new ArrayList<String>();
Set<Resource> alreadyFoundResources = new HashSet<Resource>();
for (ResourceAllocation<?> each : taskElement
.getResourceAllocations()) {
.getSatisfiedResourceAllocations()) {
result.addAll(extractRepresentations(each,
alreadyFoundResources));
}

View file

@ -62,7 +62,7 @@ public class AllocationResult {
public static AllocationResult createCurrent(Task task) {
Set<ResourceAllocation<?>> resourceAllocations = task
.getResourceAllocations();
.getSatisfiedResourceAllocations();
List<ModifiedAllocation> modifiedAllocations = ModifiedAllocation
.copy(resourceAllocations);
AggregateOfResourceAllocations aggregate = new AggregateOfResourceAllocations(
@ -141,7 +141,7 @@ public class AllocationResult {
private Set<ResourceAllocation<?>> getNotModified(
List<ResourceAllocation<?>> modified) {
Set<ResourceAllocation<?>> all = new HashSet<ResourceAllocation<?>>(
task.getResourceAllocations());
task.getSatisfiedResourceAllocations());
all.removeAll(modified);
return all;
}

View file

@ -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<AllocationRow> 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<ResourceAllocation<?>> resourceAllocations = this.task
.getResourceAllocations();
.getSatisfiedResourceAllocations();
for (ResourceAllocation<?> resourceAllocation : resourceAllocations) {
if (resourceAllocation instanceof GenericResourceAllocation) {
GenericResourceAllocation generic = (GenericResourceAllocation) resourceAllocation;

View file

@ -740,7 +740,7 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
private void forceLoadOfCriterions(TaskElement taskElement) {
List<GenericResourceAllocation> 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<ResourceAllocation<?>> resourceAllocations = taskElement
.getResourceAllocations();
.getSatisfiedResourceAllocations();
for (ResourceAllocation<?> each : resourceAllocations) {
each.getAssociatedResources();
for (DerivedAllocation eachDerived : each.getDerivedAllocations()) {

View file

@ -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<ResourceAllocation<?>> resourceAllocations = taskElement.getResourceAllocations();
Set<ResourceAllocation<?>> resourceAllocations = taskElement.getSatisfiedResourceAllocations();
dontPoseAsTransient(resourceAllocations);
if (!taskElement.isLeaf()) {
for (TaskElement each : taskElement.getChildren()) {

View file

@ -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;
}

View file

@ -135,7 +135,7 @@ public class ReassignCommand implements IReassignCommand {
for (WithAssociatedEntity each : withEntities) {
taskElementDAO.reattach(each.domainEntity);
Set<ResourceAllocation<?>> resourceAllocations = each.domainEntity
.getResourceAllocations();
.getSatisfiedResourceAllocations();
List<GenericResourceAllocation> generic = ResourceAllocation
.getOfType(GenericResourceAllocation.class,
resourceAllocations);

View file

@ -90,7 +90,7 @@ public class AdvancedAllocationTabCreator {
private Set<Resource> getAssociatedResources(Task task) {
Set<Resource> result = new HashSet<Resource>();
for (ResourceAllocation<?> resourceAllocation : task
.getResourceAllocations()) {
.getSatisfiedResourceAllocations()) {
result.addAll(resourceAllocation.getAssociatedResources());
}
return result;

View file

@ -96,7 +96,7 @@ public class SchedulingProgressPerOrderModel implements ISchedulingProgressPerOr
for(TaskElement each: tasks) {
each.getName();
initializeTaskSource(each.getTaskSource());
initializeResourceAllocations(each.getResourceAllocations());
initializeResourceAllocations(each.getSatisfiedResourceAllocations());
}
}