ItEr47S04ValidacionEProbasFuncionaisItEr46S04: [Bug #276] Adding prefixes with the name of the topmost task.

This commit is contained in:
Óscar González Fernández 2010-02-09 21:44:33 +01:00
parent 62a7eeaae6
commit 150eacae86
2 changed files with 16 additions and 2 deletions

View file

@ -398,4 +398,12 @@ public abstract class TaskElement extends BaseEntity {
return false;
}
public TaskElement getTopMost() {
TaskElement result = this;
while (result.getParent() != null) {
result = result.getParent();
}
return result;
}
}

View file

@ -262,8 +262,8 @@ public class ResourceLoadModel implements IResourceLoadModel {
.byTask(sortedByStartDate);
List<LoadTimeLine> secondLevel = new ArrayList<LoadTimeLine>();
for (Entry<Task, List<ResourceAllocation<?>>> entry : byTask.entrySet()) {
LoadTimeLine timeLine = buildTimeLine(resource, entry.getKey()
.getName(),
Task task = entry.getKey();
LoadTimeLine timeLine = buildTimeLine(resource, getTaskName(task),
entry.getValue());
if (!timeLine.isEmpty()) {
secondLevel.add(timeLine);
@ -272,6 +272,12 @@ public class ResourceLoadModel implements IResourceLoadModel {
return secondLevel;
}
private String getTaskName(Task task) {
TaskElement topMost = task.getTopMost();
String prefix = topMost != task ? (topMost.getName() + " :: ") : "";
return prefix + task.getName();
}
private LoadTimeLine buildTimeLine(Collection<Criterion> criterions,
Resource resource,
List<GenericResourceAllocation> allocationsSortedByStartDate) {