Ensure that getResourcesPerDay never returns null

FEA: ItEr66S04BugFixing
This commit is contained in:
Óscar González Fernández 2010-12-29 17:47:33 +01:00
parent 9a9afdc5c9
commit a42018bfc5
2 changed files with 4 additions and 3 deletions

View file

@ -442,6 +442,7 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
private AssignmentFunction assignmentFunction;
@OnCopy(Strategy.SHARE)
@NotNull
private ResourcesPerDay resourcesPerDay;
private Integer intendedTotalHours;
@ -1416,8 +1417,10 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
return calculateResourcesPerDayFromAssignments(getConsolidatedAssignments());
}
@NotNull
public ResourcesPerDay getResourcesPerDay() {
if (resourcesPerDay == null) {
return ResourcesPerDay.amount(0);
}
return resourcesPerDay;
}

View file

@ -215,8 +215,6 @@ public abstract class ResourcesPerDayModification extends
Collection<? extends ResourceAllocation<?>> allocations) {
List<ResourcesPerDayModification> result = new ArrayList<ResourcesPerDayModification>();
for (ResourceAllocation<?> resourceAllocation : allocations) {
ResourcesPerDay perDay = resourceAllocation.getResourcesPerDay();
Validate.notNull(perDay);
result.add(resourceAllocation.asResourcesPerDayModification());
}
return result;