com.google.api.services.calendar.model.EventAttendee Java Examples

The following examples show how to use com.google.api.services.calendar.model.EventAttendee. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GoogleCalendarExporter.java    From data-transfer-project with Apache License 2.0 6 votes vote down vote up
private static CalendarEventModel convertToCalendarEventModel(String id, Event eventData) {
  List<EventAttendee> attendees = eventData.getAttendees();
  List<String> recurrenceRulesStrings = eventData.getRecurrence();
  return new CalendarEventModel(
      id,
      eventData.getDescription(),
      eventData.getSummary(),
      attendees == null
          ? null
          : attendees
              .stream()
              .map(GoogleCalendarExporter::transformToModelAttendee)
              .collect(Collectors.toList()),
      eventData.getLocation(),
      getEventTime(eventData.getStart()),
      getEventTime(eventData.getEnd()),
      recurrenceRulesStrings == null ? null : getRecurrenceRule(recurrenceRulesStrings));
}
 
Example #2
Source File: AddEventWorkitemHandler.java    From jbpm-work-items with Apache License 2.0 5 votes vote down vote up
private static Event createNewEvent(String paramEventSummary,
                                    String paramEventStart,
                                    String paramEventEnd,
                                    String paramEventAttendees,
                                    String paramEventCreator) throws Exception {
    Event event = new Event();
    event.setSummary(paramEventSummary);

    DateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss z",
                                             Locale.ENGLISH);

    if (paramEventStart != null) {
        DateTime startDateTime = new DateTime(format.parse(paramEventStart));
        event.setStart(new EventDateTime().setDateTime(startDateTime));
    }

    if (paramEventEnd != null) {
        DateTime endDateTime = new DateTime(format.parse(paramEventEnd));
        event.setEnd(new EventDateTime().setDateTime(endDateTime));
    }

    if (paramEventAttendees != null) {
        List<String> attendees = Arrays.asList(paramEventAttendees.split(","));
        List<EventAttendee> attendiesList = new ArrayList<>();
        for (String attendee : attendees) {
            EventAttendee newAttendee = new EventAttendee();
            newAttendee.setEmail(attendee);
            attendiesList.add(newAttendee);
        }
        event.setAttendees(attendiesList);
    }

    if (paramEventCreator != null) {
        Creator creator = new Creator();
        creator.setEmail(paramEventCreator);
        event.setCreator(creator);
    }

    return event;
}
 
Example #3
Source File: GoogleCalendarUtils.java    From syndesis with Apache License 2.0 5 votes vote down vote up
static String formatAtendees(final List<EventAttendee> attendees) {
    if (attendees == null || attendees.isEmpty()) {
        return null;
    }

    return attendees.stream()
        .map(EventAttendee::getEmail)
        .collect(Collectors.joining(","));
}
 
Example #4
Source File: GoogleCalendarUtils.java    From syndesis with Apache License 2.0 5 votes vote down vote up
static List<EventAttendee> parseAtendees(final String attendeesString) {
    if (ObjectHelper.isEmpty(attendeesString)) {
        return Collections.emptyList();
    }

    return Splitter.on(',').trimResults().splitToList(attendeesString)
        .stream()
        .map(GoogleCalendarUtils::attendee)
        .collect(Collectors.toList());
}
 
Example #5
Source File: GoogleCalendarExporter.java    From data-transfer-project with Apache License 2.0 4 votes vote down vote up
private static CalendarAttendeeModel transformToModelAttendee(EventAttendee attendee) {
  return new CalendarAttendeeModel(
      attendee.getDisplayName(),
      attendee.getEmail(),
      Boolean.TRUE.equals(attendee.getOptional()));
}
 
Example #6
Source File: GoogleCalendarImporter.java    From data-transfer-project with Apache License 2.0 4 votes vote down vote up
private static EventAttendee transformToEventAttendee(CalendarAttendeeModel attendee) {
  return new EventAttendee()
      .setDisplayName(attendee.getDisplayName())
      .setEmail(attendee.getEmail())
      .setOptional(attendee.getOptional());
}