diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/GenericResourceAllocation.java b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/GenericResourceAllocation.java index 6d4ac9682..beff50a2e 100644 --- a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/GenericResourceAllocation.java +++ b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/GenericResourceAllocation.java @@ -85,27 +85,6 @@ public class GenericResourceAllocation extends return result; } - public static Map> byResource( - Collection allocations) { - Map> result = new HashMap>(); - for (GenericResourceAllocation resourceAllocation : allocations) { - for (Resource resource : resourceAllocation - .getAssociatedResources()) { - initializeIfNeeded_(result, resource); - result.get(resource).add(resourceAllocation); - } - } - return result; - } - - private static void initializeIfNeeded_( - Map> result, - Resource resource) { - if (!result.containsKey(resource)) { - result.put(resource, new ArrayList()); - } - } - @OnCopy(Strategy.SHARE_COLLECTION_ELEMENTS) private Set criterions = new HashSet(); diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/ResourceAllocation.java b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/ResourceAllocation.java index e30d541db..92663b25b 100644 --- a/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/ResourceAllocation.java +++ b/navalplanner-business/src/main/java/org/navalplanner/business/planner/entities/ResourceAllocation.java @@ -103,6 +103,21 @@ public abstract class ResourceAllocation extends return result; } + public static > Map> byResource( + Collection allocations) { + Map> result = new HashMap>(); + for (R resourceAllocation : allocations) { + for (Resource resource : resourceAllocation + .getAssociatedResources()) { + if (!result.containsKey(resource)) { + result.put(resource, new ArrayList()); + } + result.get(resource).add(resourceAllocation); + } + } + return result; + } + public static > List sortedByStartDate( Collection allocations) { List result = new ArrayList(allocations);