From edb9d0c3d33d16f8cbdb98e5edac02fb1d3c3803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Gonz=C3=A1lez=20Fern=C3=A1ndez?= Date: Wed, 7 Oct 2009 12:09:35 +0200 Subject: [PATCH] ItEr29S06CUAsignacionGrupoRecursosAPlanificacionItEr28S06: Exposing getName function --- .../web/resourceload/ResourceLoadModel.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/resourceload/ResourceLoadModel.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/resourceload/ResourceLoadModel.java index 946c3d645..b055fcab6 100644 --- a/navalplanner-webapp/src/main/java/org/navalplanner/web/resourceload/ResourceLoadModel.java +++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/resourceload/ResourceLoadModel.java @@ -231,9 +231,8 @@ public class ResourceLoadModel implements IResourceLoadModel { List result = new ArrayList(); for (Entry, List> entry : byCriterions .entrySet()) { - LoadTimeLine timeLine = buildTimeLine(new ArrayList( - entry.getKey()), - resource, entry.getValue()); + LoadTimeLine timeLine = buildTimeLine(entry.getKey(), resource, + entry.getValue()); if (!timeLine.isEmpty()) { result.add(timeLine); } @@ -257,7 +256,7 @@ public class ResourceLoadModel implements IResourceLoadModel { return secondLevel; } - private LoadTimeLine buildTimeLine(List criterions, + private LoadTimeLine buildTimeLine(Collection criterions, Resource resource, List allocationsSortedByStartDate) { return new LoadTimeLine(getName(criterions), PeriodsBuilder.build( @@ -265,13 +264,14 @@ public class ResourceLoadModel implements IResourceLoadModel { allocationsSortedByStartDate)); } - private String getName(List criterions) { + public static String getName(Collection criterions) { if (criterions.isEmpty()) { - return _("generic all workers"); + return _("[generic all workers]"); } String[] names = new String[criterions.size()]; - for (int i = 0; i < names.length; i++) { - names[i] = criterions.get(i).getName(); + int i = 0; + for (Criterion criterion : criterions) { + names[i++] = criterion.getName(); } return Arrays.toString(names); }