.setupVersionUsing(scenarioManager, orderLine
.getOrder());
orderLine.useSchedulingDataFor(orderVersion);
SchedulingDataForVersion schedulingDataForVersion = orderLine
.getCurrentSchedulingDataForVersion();
TaskSource taskSource = TaskSource
.createForGroup(schedulingDataForVersion);
TaskGroupSynchronization synchronization = new TaskGroupSynchronization(
taskSource, Collections.<TaskSourceSynchronization> emptyList()) {
@Override
protected TaskElement apply(List<TaskElement> children,
IOptionalPersistence persistence) {
TaskGroup result = TaskGroup.create(taskSource);
Date today = new Date();
result.setStartDate(today);
result.setEndDate(plusDays(today, 3));
setTask(taskSource, result);
taskSourceDAO.save(taskSource);
return result;
}
};
synchronization.apply(TaskSource.persistTaskSources(taskSourceDAO));
return (TaskGroup) taskSource.getTask();
}