code: private void writeExceptions12(Project.Calendars.Calendar calendar, List<ProjectCalendarException> exceptions)
     {
        Exceptions ce = m_factory.createProjectCalendarsCalendarExceptions();
        calendar.setExceptions(ce);
        List<Exceptions.Exception> el = ce.getException();
  
        for (ProjectCalendarException exception : exceptions)
        {
           Exceptions.Exception ex = m_factory.createProjectCalendarsCalendarExceptionsException();
           el.add(ex);
  
           ex.setName(exception.getName());
           boolean working = exception.getWorking();
           ex.setDayWorking(Boolean.valueOf(working));
  
           if (exception.getRecurring() == null)
           {
              ex.setEnteredByOccurrences(Boolean.FALSE);
              ex.setOccurrences(BigInteger.ONE);
              ex.setType(BigInteger.ONE);
           }
           else
           {
              populateRecurringException(exception, ex);
           }
  
           Project.Calendars.Calendar.Exceptions.Exception.TimePeriod period = m_factory.createProjectCalendarsCalendarExceptionsExceptionTimePeriod();
           ex.setTimePeriod(period);
           period.setFromDate(exception.getFromDate());
           period.setToDate(exception.getToDate());
  
           if (working)
           {
              Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes times = m_factory.createProjectCalendarsCalendarExceptionsExceptionWorkingTimes();
              ex.setWorkingTimes(times);
              List<Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime> timesList = times.getWorkingTime();
  
              for (DateRange range : exception)
              {
                 Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime time = m_factory.createProjectCalendarsCalendarExceptionsExceptionWorkingTimesWorkingTime();
                 timesList.add(time);
  
                 time.setFromTime(range.getStart());
                 time.setToTime(range.getEnd());
              }
           }
        }
     }
docs: Write exceptions into the format used by MSPDI files from
  Project 2007 onwards.
  
  @param calendar parent calendar
  @param exceptions list of exceptions