public Object createServiceObjectWithServiceParam( ExchangeService srv) throws Exception { return new Appointment(srv); } }, new ICreateServiceObjectWithAttachmentParam() {
public Object createServiceObjectWithAttachmentParam( ItemAttachment itemAttachment, boolean isNew) throws Exception { return new Appointment(itemAttachment, isNew); } });
public Object createServiceObjectWithAttachmentParam( ItemAttachment itemAttachment, boolean isNew) throws Exception { return new Appointment(itemAttachment, isNew); } });
public Object createServiceObjectWithServiceParam( ExchangeService srv) throws Exception { return new Appointment(srv); } }, new ICreateServiceObjectWithAttachmentParam() {
@Override public Optional<String> add(Absence absence, CalendarSettings calendarSettings) { ExchangeCalendarSettings exchangeCalendarSettings = calendarSettings.getExchangeCalendarSettings(); String calendarName = exchangeCalendarSettings.getCalendar(); connectToExchange(exchangeCalendarSettings); try { CalendarFolder calendarFolder = findOrCreateCalendar(calendarName); Appointment appointment = new Appointment(exchangeService); fillAppointment(absence, appointment); SendInvitationsMode invitationsMode = SendInvitationsMode.SendToNone; if (exchangeCalendarSettings.isSendInvitationActive()) { invitationsMode = SendInvitationsMode.SendToAllAndSaveCopy; } appointment.save(calendarFolder.getId(), invitationsMode); LOG.info(String.format("Appointment %s for '%s' added to exchange calendar '%s'.", appointment.getId(), absence.getPerson().getNiceName(), calendarFolder.getDisplayName())); return Optional.ofNullable(appointment.getId().getUniqueId()); } catch (Exception ex) { // NOSONAR - EWS Java API throws Exception, that's life LOG.warn("An error occurred while trying to add appointment to Exchange calendar"); mailService.sendCalendarSyncErrorNotification(calendarName, absence, ExceptionUtils.getStackTrace(ex)); } return Optional.empty(); }