Example #1
0
 /**
  * Don't pose as transient anymore calendar and all data hanging from
  * calendar (data versions, availabilities and exceptions)
  *
  * @param calendar
  */
 private void dontPoseAsTransientObjectAnymore(BaseCalendar calendar) {
     calendar.dontPoseAsTransientObjectAnymore();
     for (CalendarData each: calendar.getCalendarDataVersions()) {
         each.dontPoseAsTransientObjectAnymore();
     }
     for (CalendarAvailability each : calendar.getCalendarAvailabilities()) {
         each.dontPoseAsTransientObjectAnymore();
     }
     for (CalendarException each : calendar.getExceptions()) {
         each.dontPoseAsTransientObjectAnymore();
     }
 }
Example #2
0
    @Override
    public void createCalendarAvailability() {
        if (getBaseCalendar() != null) {
            LocalDate startDate = new LocalDate();
            CalendarAvailability lastCalendarAvailability = getBaseCalendar()
            .getLastCalendarAvailability();
            if (lastCalendarAvailability != null) {
                if (lastCalendarAvailability.getEndDate() == null) {
                    startDate = lastCalendarAvailability.getStartDate();
                } else {
                    startDate = lastCalendarAvailability.getEndDate();
                }
                startDate = startDate.plusDays(1);
            }

            CalendarAvailability calendarAvailability = CalendarAvailability
                    .create(startDate, null);
            calendarAvailability.setCode("");
            getBaseCalendar().addNewCalendarAvailability(calendarAvailability);
        }
    }