ItEr27S07CUVistaRecursosTempoPorProxectoItEr26S08: It allows to put the generic allocation to zero

This commit is contained in:
Óscar González Fernández 2009-09-28 18:28:32 +02:00
parent 740192980d
commit 2e057952c8
2 changed files with 17 additions and 1 deletions

View file

@ -65,6 +65,10 @@ public abstract class AllocationDTO {
public abstract boolean isGeneric();
public boolean isEmptyResourcesPerDay() {
return getResourcesPerDay().isZero();
}
public static List<AllocationDTO> toDTOs(
Collection<? extends ResourceAllocation<?>> resourceAllocations) {
List<AllocationDTO> result = new ArrayList<AllocationDTO>();

View file

@ -100,13 +100,25 @@ public class ResourceAllocationsBeingEdited {
public List<ResourceAllocationWithDesiredResourcesPerDay> asResourceAllocations() {
List<ResourceAllocationWithDesiredResourcesPerDay> result = new ArrayList<ResourceAllocationWithDesiredResourcesPerDay>();
for (AllocationDTO allocation : currentAllocations) {
for (AllocationDTO allocation : withoutZeroResourcesPerDayAllocations(currentAllocations)) {
result.add(createOrModify(allocation).withDesiredResourcesPerDay(
allocation.getResourcesPerDay()));
}
return result;
}
private List<AllocationDTO> withoutZeroResourcesPerDayAllocations(
List<AllocationDTO> allocations) {
List<AllocationDTO> result = new ArrayList<AllocationDTO>();
for (AllocationDTO allocationDTO : allocations) {
if (!allocationDTO.isEmptyResourcesPerDay()) {
result.add(allocationDTO);
}
}
return result;
}
public AggregateOfResourceAllocations doAllocation() {
List<ResourceAllocationWithDesiredResourcesPerDay> allocations = asResourceAllocations();
switch (calculatedValue) {