ItEr29S06CUAsignacionGrupoRecursosAPlanificacionItEr28S06: Extracting method and moving it to AllocationResult
This commit is contained in:
parent
182c874715
commit
9c9b54de22
3 changed files with 22 additions and 5 deletions
|
|
@ -312,6 +312,8 @@ public class ResourceAllocationController extends GenericForwardComposer {
|
|||
}
|
||||
|
||||
public void advanceAllocation() {
|
||||
AllocationResult allocationResult = allocationsBeingEdited
|
||||
.doAllocation();
|
||||
switcher.goToAdvancedAllocation();
|
||||
window.setVisible(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,9 +119,7 @@ public class ResourceAllocationModel implements IResourceAllocationModel {
|
|||
private void doTheAllocation() {
|
||||
AllocationResult allocationResult = resourceAllocationsBeingEdited
|
||||
.doAllocation();
|
||||
task.mergeAllocation(resourceAllocationsBeingEdited
|
||||
.getCalculatedValue(), allocationResult.getDaysDuration(),
|
||||
allocationResult.getNew(), allocationResult.getModified());
|
||||
allocationResult.applyTo(task);
|
||||
ganttTask.setEndDate(task.getEndDate());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -201,7 +201,8 @@ public class ResourceAllocationsBeingEdited {
|
|||
default:
|
||||
throw new RuntimeException("cant handle: " + calculatedValue);
|
||||
}
|
||||
return new AllocationResult(new AggregateOfResourceAllocations(
|
||||
return new AllocationResult(calculatedValue,
|
||||
new AggregateOfResourceAllocations(
|
||||
stripResourcesPerDay(allocations)), daysDuration,
|
||||
fromDetachedToAttached);
|
||||
}
|
||||
|
|
@ -318,11 +319,17 @@ class AllocationResult {
|
|||
|
||||
private final Map<ResourceAllocation<?>, ResourceAllocation<?>> fromDetachedAllocationToAttached;
|
||||
|
||||
AllocationResult(AggregateOfResourceAllocations aggregate,
|
||||
private final CalculatedValue calculatedValue;
|
||||
|
||||
AllocationResult(
|
||||
CalculatedValue calculatedValue,
|
||||
AggregateOfResourceAllocations aggregate,
|
||||
Integer daysDuration,
|
||||
Map<ResourceAllocationWithDesiredResourcesPerDay, ResourceAllocation<?>> fromDetachedAllocationToAttached) {
|
||||
Validate.notNull(daysDuration);
|
||||
Validate.notNull(aggregate);
|
||||
Validate.notNull(calculatedValue);
|
||||
this.calculatedValue = calculatedValue;
|
||||
this.aggregate = aggregate;
|
||||
this.daysDuration = daysDuration;
|
||||
this.fromDetachedAllocationToAttached = translation(fromDetachedAllocationToAttached);
|
||||
|
|
@ -358,4 +365,14 @@ class AllocationResult {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public CalculatedValue getCalculatedValue() {
|
||||
return calculatedValue;
|
||||
}
|
||||
|
||||
public void applyTo(Task task) {
|
||||
task.mergeAllocation(getCalculatedValue(),
|
||||
getDaysDuration(),
|
||||
getNew(), getModified());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue