private void readException ( ProjectCalendar bc , Project . Calendars . Calendar . Exceptions . Exception exception ) { Date fromDate = exception . getTimePeriod ( ) . getFromDate ( ) ; Date toDate = exception . getTimePeriod ( ) . getToDate ( ) ; // Vico Schedule Planner seems to write start and end dates to FromTime and ToTime // rather than FromDate and ToDate. This is plain wrong, and appears to be ignored by MS Project // so we will ignore it too! if ( fromDate != null && toDate != null ) { ProjectCalendarException bce = bc . addCalendarException ( fromDate , toDate ) ; bce . setName ( exception . getName ( ) ) ; readRecurringData ( bce , exception ) ; Project . Calendars . Calendar . Exceptions . Exception . WorkingTimes times = exception . getWorkingTimes ( ) ; if ( times != null ) { List < Project . Calendars . Calendar . Exceptions . Exception . WorkingTimes . WorkingTime > time = times . getWorkingTime ( ) ; for ( Project . Calendars . Calendar . Exceptions . Exception . WorkingTimes . WorkingTime period : time ) { Date startTime = period . getFromTime ( ) ; Date endTime = period . getToTime ( ) ; if ( startTime != null && endTime != null ) { if ( startTime . getTime ( ) >= endTime . getTime ( ) ) { endTime = DateHelper . addDays ( endTime , 1 ) ; } bce . addRange ( new DateRange ( startTime , endTime ) ) ; } } } } }
Read a single calendar exception .