LocalDate startDate = null;
if (workingWeek.startDate != null) {
expiringDate = LocalDate.fromDateFields(workingWeek.startDate);
}
CalendarData calendarData = CalendarData.create();
calendarData.setExpiringDate(expiringDate);
if (parent != null) {
calendarData.setParent(parent);
}
calendarData.setCodeAutogenerated(true);
Map<Integer, Capacity> capacitiesPerDays = getCapacitiesPerDays(
workingWeek.hoursPerDays, parent);
try {
calendarData.updateCapacitiesPerDay(capacitiesPerDays);
} catch (IllegalArgumentException e) {
throw new ValidationException(e.getMessage());
}
return calendarData;