if (actualExceptionsCalendar != null)
return actualExceptionsCalendar;
if (baselineCalendar != null)
return baselineCalendar;
Resource resource = getResource();
Task task = getTask();
if (((NormalTask)task).isIgnoreResourceCalendar() || isInvalidIntersectionCalendar() || resource.getEffectiveWorkCalendar() == null)
return task.getEffectiveWorkCalendar();
// if no task calendar, or calendar is invalid due to empty intersection of task and resource calendars
if (task.getWorkCalendar() == null)
return resource.getEffectiveWorkCalendar();
if (intersectionCalendar == null) {
try {
intersectionCalendar = ((WorkingCalendar)task.getEffectiveWorkCalendar()).intersectWith((WorkingCalendar)resource.getEffectiveWorkCalendar());
} catch (InvalidCalendarIntersectionException e) {
intersectionCalendar = WorkingCalendar.INVALID_INTERSECTION_CALENDAR;
Alert.error(Messages.getString("Message.invalidIntersection"));
return task.getEffectiveWorkCalendar();
}
}
return intersectionCalendar;
// need to use intersection work calendar
}