Package com.google.api.services.calendar.model

Examples of com.google.api.services.calendar.model.Event


    }


    private static void addEvent(Calendar calendar) throws IOException {
      View.header("Add Event");
      Event event = newEvent();
      Event result = client.events().insert(calendar.getId(), event).execute();
      View.display(result);
    }
View Full Code Here


      Event result = client.events().insert(calendar.getId(), event).execute();
      View.display(result);
    }

    private static Event newEvent() {
      Event event = new Event();
      event.setSummary("New Event");
      Date startDate = new Date();
      Date endDate = new Date(startDate.getTime() + 3600000);
      DateTime start = new DateTime(startDate, TimeZone.getTimeZone("UTC"));
      event.setStart(new EventDateTime().setDateTime(start));
      DateTime end = new DateTime(endDate, TimeZone.getTimeZone("UTC"));
      event.setEnd(new EventDateTime().setDateTime(end));
      return event;
    }
View Full Code Here

    }
  }
 
  @Override
  public void addAppointment(final AppointmentDto appointment) throws IOException {
    final Event event = new Event();
    final Map<String, String> privateProperties = new HashMap<String, String>();
    privateProperties.put(EXT_PROPERTY_EXCHANGE_ID, appointment.getExchangeId());
    final ExtendedProperties extProperties = new ExtendedProperties();
    extProperties.setPrivate(privateProperties);
    event.setExtendedProperties(extProperties);
    populateEventFromAppointmentDto(appointment, event);

    client.events().insert(calendarId, event).execute();

    LOG.info("Added Google appointment " + appointment.getSummary());
View Full Code Here

  }

  @Override
  public void updateAppointment(final AppointmentDto appointment) throws IOException {
    final GoogleAppointmentDto googleAppointmentDto = (GoogleAppointmentDto) appointment;
    final Event event = client.events().get(calendarId, googleAppointmentDto.getGoogleId()).execute();
    populateEventFromAppointmentDto(appointment, event);
    client.events().update(calendarId, event.getId(), event).execute();

    LOG.info("Updated Google appointment " + appointment.getSummary());
  }
View Full Code Here

    LOG.debug("Creating claendar");
    Calendar calendar = addCalendar(subject);
    LOG.debug("Calendar created with id :: " + calendar.getId());

    LOG.debug("Creating Event");
    Event event = newEvent(subject, description, startDate, endDate, from,
        attendees, location);

    LOG.debug("Inserting event in calendar id :: " + calendar.getId());
    client.events().insert(calendar.getId(), event).execute();
View Full Code Here

  }

  private Event newEvent(final String subject, final String description,
      final Date startDate, final Date endDate, final Participant from,
      final List<Participant> attendeesList, final String location) {
    Event event = new Event();
    if (subject != null) {
      event.setSummary(subject);
    }
    if (description != null) {
      event.setDescription(description);
    }
    if (location != null) {
      event.setLocation(location);
    }

    DateTime start = new DateTime(startDate, TimeZone.getTimeZone("UTC"));
    event.setStart(new EventDateTime().setDateTime(start));
    DateTime end = new DateTime(endDate, TimeZone.getTimeZone("UTC"));
    event.setEnd(new EventDateTime().setDateTime(end));

    List<EventAttendee> list = new ArrayList<EventAttendee>();
    for (Participant bean : attendeesList) {
      EventAttendee attendee = new EventAttendee();
      attendee.setDisplayName(bean.getName());
      attendee.setEmail(bean.getEmail());
      if (ParticipantType.REQUIRED.equals(bean.getType())) {
        attendee.setOptional(false);
      }
      list.add(attendee);
    }

    EventAttendee organizer = new EventAttendee();
    organizer.setDisplayName(from.getName());
    organizer.setEmail(from.getEmail());
    if (ParticipantType.REQUIRED.equals(from.getType())) {
      organizer.setOptional(false);
    }
    organizer.setOrganizer(true);
    list.add(organizer);

    event.setAttendees(list);
    return event;
  }
View Full Code Here

    LOG.debug("Creating claendar");
    Calendar calendar = addCalendar(subject);
    LOG.debug("Calendar created with id :: " + calendar.getId());

    LOG.debug("Creating Event");
    Event event = newEvent(subject, description, startDate, endDate, from,
        attendees, location);

    LOG.debug("Inserting event in calendar id :: " + calendar.getId());
    client.events().insert(calendar.getId(), event).execute();
View Full Code Here

  }

  private Event newEvent(final String subject, final String description,
      final Date startDate, final Date endDate, final Participant from,
      final List<Participant> attendeesList, final String location) {
    Event event = new Event();
    if (subject != null) {
      event.setSummary(subject);
    }
    if (description != null) {
      event.setDescription(description);
    }
    if (location != null) {
      event.setLocation(location);
    }

    DateTime start = new DateTime(startDate, TimeZone.getTimeZone("UTC"));
    event.setStart(new EventDateTime().setDateTime(start));
    DateTime end = new DateTime(endDate, TimeZone.getTimeZone("UTC"));
    event.setEnd(new EventDateTime().setDateTime(end));

    List<EventAttendee> list = new ArrayList<EventAttendee>();
    for (Participant bean : attendeesList) {
      EventAttendee attendee = new EventAttendee();
      attendee.setDisplayName(bean.getName());
      attendee.setEmail(bean.getEmail());
      if (ParticipantType.REQUIRED.equals(bean.getType())) {
        attendee.setOptional(false);
      }
      list.add(attendee);
    }

    EventAttendee organizer = new EventAttendee();
    organizer.setDisplayName(from.getName());
    organizer.setEmail(from.getEmail());
    if (ParticipantType.REQUIRED.equals(from.getType())) {
      organizer.setOptional(false);
    }
    organizer.setOrganizer(true);
    list.add(organizer);

    event.setAttendees(list);
    return event;
  }
View Full Code Here

TOP

Related Classes of com.google.api.services.calendar.model.Event

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.