Package com.zerodes.exchangesync.dto

Examples of com.zerodes.exchangesync.dto.AppointmentDto


    final Collection<AppointmentDto> otherAppointments = otherSource.getAllAppointments(startDate, endDate);
    final Collection<AppointmentDto> exchangeAppointments = exchangeSource.getAllAppointments(startDate, endDate);
    final Map<String, AppointmentDto> otherAppointmentsMap = generateExchangeIdMap(otherAppointments);
    final Map<String, AppointmentDto> exchangeAppointmentsMap = generateExchangeIdMap(exchangeAppointments);
    for (final AppointmentDto exchangeAppointment : exchangeAppointments) {
      final AppointmentDto otherAppointment = otherAppointmentsMap.get(exchangeAppointment.getExchangeId());
      results.add(new Pair<AppointmentDto, AppointmentDto>(exchangeAppointment, otherAppointment));
    }
    for (final AppointmentDto otherAppointment : otherAppointments) {
      final AppointmentDto exchangeAppointment = exchangeAppointmentsMap.get(otherAppointment.getExchangeId());
      results.add(new Pair<AppointmentDto, AppointmentDto>(exchangeAppointment, otherAppointment));
    }
    return results;
  }
View Full Code Here


    person.setOptional(optional);
    return person;
  }

  public AppointmentDto convertToAppointmentDto(final Appointment appointment) throws ServiceLocalException {
    final AppointmentDto appointmentDto = new AppointmentDto();
    appointmentDto.setExchangeId(appointment.getId().getUniqueId());
    appointmentDto.setLastModified(convertToJodaDateTime(appointment.getLastModifiedTime(), false));
    appointmentDto.setSummary(appointment.getSubject());
    try {
      appointmentDto.setDescription(MessageBody.getStringFromMessageBody(appointment.getBody()));
    } catch (final Exception e) {
      LOG.error("Unable to retrieve appointment body from Exchange", e);
    }
    appointmentDto.setStart(convertToJodaDateTime(appointment.getStart(), appointment.getIsAllDayEvent()));
    appointmentDto.setEnd(convertToJodaDateTime(appointment.getEnd(), appointment.getIsAllDayEvent()));
    appointmentDto.setAllDay(appointment.getIsAllDayEvent());
    appointmentDto.setLocation(appointment.getLocation());
    if (appointment.getOrganizer() != null) {
      appointmentDto.setOrganizer(convertToPersonDto(appointment.getOrganizer(), false));
    }
    final Set<PersonDto> attendees = new HashSet<PersonDto>();
    if (appointment.getRequiredAttendees() != null) {
      for (final Attendee exchangeAttendee : appointment.getRequiredAttendees()) {
        attendees.add(convertToPersonDto(exchangeAttendee, false));
      }
    }
    if (appointment.getOptionalAttendees() != null) {
      for (final Attendee exchangeAttendee : appointment.getOptionalAttendees()) {
        attendees.add(convertToPersonDto(exchangeAttendee, true));
      }
    }
    appointmentDto.setAttendees(attendees);
    appointmentDto.setReminderMinutesBeforeStart(appointment.getReminderMinutesBeforeStart());
    if (appointment.getRecurrence() != null) {
      if (appointment.getRecurrence() instanceof Recurrence.DailyPattern) {
        appointmentDto.setRecurrenceType(RecurrenceType.DAILY);
      } else if (appointment.getRecurrence() instanceof Recurrence.WeeklyPattern) {
        appointmentDto.setRecurrenceType(RecurrenceType.WEEKLY);
      } else if (appointment.getRecurrence() instanceof Recurrence.MonthlyPattern) {
        appointmentDto.setRecurrenceType(RecurrenceType.MONTHLY);
      } else if (appointment.getRecurrence() instanceof Recurrence.YearlyPattern) {
        appointmentDto.setRecurrenceType(RecurrenceType.YEARLY);
      }
      appointmentDto.setRecurrenceCount(appointment.getRecurrence().getNumberOfOccurrences());
    }
    return appointmentDto;
  }
View Full Code Here

    }
    return appointmentDto;
  }

  public AppointmentDto convertToAppointmentDto(final MeetingRequest meeting) throws ServiceLocalException {
    final AppointmentDto appointmentDto = new AppointmentDto();
    appointmentDto.setExchangeId(meeting.getId().getUniqueId());
    appointmentDto.setLastModified(convertToJodaDateTime(meeting.getLastModifiedTime(), false));
    appointmentDto.setSummary(meeting.getSubject());
    try {
      appointmentDto.setDescription(MessageBody.getStringFromMessageBody(meeting.getBody()));
    } catch (final Exception e) {
      LOG.error("Unable to retrieve appointment body from Exchange", e);
    }
    appointmentDto.setStart(convertToJodaDateTime(meeting.getStart(), meeting.getIsAllDayEvent()));
    appointmentDto.setEnd(convertToJodaDateTime(meeting.getEnd(), meeting.getIsAllDayEvent()));
    appointmentDto.setAllDay(meeting.getIsAllDayEvent());
    appointmentDto.setLocation(meeting.getLocation());
    if (meeting.getOrganizer() != null) {
      appointmentDto.setOrganizer(convertToPersonDto(meeting.getOrganizer(), false));
    }
    final Set<PersonDto> attendees = new HashSet<PersonDto>();
    if (meeting.getRequiredAttendees() != null) {
      for (final Attendee exchangeAttendee : meeting.getRequiredAttendees()) {
        attendees.add(convertToPersonDto(exchangeAttendee, false));
      }
    }
    if (meeting.getOptionalAttendees() != null) {
      for (final Attendee exchangeAttendee : meeting.getOptionalAttendees()) {
        attendees.add(convertToPersonDto(exchangeAttendee, true));
      }
    }
    appointmentDto.setAttendees(attendees);
    appointmentDto.setReminderMinutesBeforeStart(meeting.getReminderMinutesBeforeStart());
    if (meeting.getRecurrence() != null) {
      if (meeting.getRecurrence() instanceof Recurrence.DailyPattern) {
        appointmentDto.setRecurrenceType(RecurrenceType.DAILY);
      } else if (meeting.getRecurrence() instanceof Recurrence.WeeklyPattern) {
        appointmentDto.setRecurrenceType(RecurrenceType.WEEKLY);
      } else if (meeting.getRecurrence() instanceof Recurrence.MonthlyPattern) {
        appointmentDto.setRecurrenceType(RecurrenceType.MONTHLY);
      } else if (meeting.getRecurrence() instanceof Recurrence.YearlyPattern) {
        appointmentDto.setRecurrenceType(RecurrenceType.YEARLY);
      }
      appointmentDto.setRecurrenceCount(meeting.getRecurrence().getNumberOfOccurrences());
    }
    return appointmentDto;
  }
View Full Code Here

TOP

Related Classes of com.zerodes.exchangesync.dto.AppointmentDto

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.