OrderElement orderElement = task.orderElement;
TaskElement taskElement;
TaskSource taskSource;
if (task.children.size() == 0) {
taskSource = TaskSource.create(
orderElement.getCurrentSchedulingDataForVersion(),
orderElement.getHoursGroups());
taskElement = taskSource
.createTaskWithoutDatesInitializedAndLinkItToTaskSource();
if (importCalendar && task.calendarName != null) {
taskElement.setCalendar(findBaseCalendar(task.calendarName));
}
setPositionConstraint((Task) taskElement, task);
} else {
taskSource = TaskSource.createForGroup(orderElement
.getCurrentSchedulingDataForVersion());
taskElement = taskSource
.createTaskGroupWithoutDatesInitializedAndLinkItToTaskSource();
List<TaskElement> taskElements = new ArrayList<TaskElement>();
for (OrderElementDTO importTask : task.children) {