From ae6fc2ba199e03f31ac95029fefea046d250bc24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Gonz=C3=A1lez=20Fern=C3=A1ndez?= Date: Wed, 7 Oct 2009 13:14:39 +0200 Subject: [PATCH] ItEr29S06CUAsignacionGrupoRecursosAPlanificacionItEr28S06: Adding method to calculate hours between two dates for an aggregate of ResourceAllocation --- .../planner/entities/AggregateOfResourceAllocations.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/AggregateOfResourceAllocations.java b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/AggregateOfResourceAllocations.java index 32afe2048..1c6d51a8d 100644 --- a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/AggregateOfResourceAllocations.java +++ b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/AggregateOfResourceAllocations.java @@ -29,6 +29,7 @@ import java.util.Map; import java.util.Set; import org.apache.commons.lang.Validate; +import org.joda.time.LocalDate; /** * Computes aggregate values on a set{@link ResourceAllocation} @@ -72,4 +73,12 @@ public class AggregateOfResourceAllocations { return ResourceAllocation.sortedByStartDate(result); } + public int hoursBetween(LocalDate startDate, LocalDate endDate) { + int sum = 0; + for (ResourceAllocation r : resourceAllocations) { + sum += r.getAssignedHours(startDate, endDate); + } + return sum; + } + }