congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Event
Code IndexAdd Tabnine to your IDE (free)

How to use
Event
in
com.google.api.services.calendar.model

Best Java code snippets using com.google.api.services.calendar.model.Event (Showing top 20 results out of 315)

origin: google/data-transfer-project

static Event convertToGoogleCalendarEvent(CalendarEventModel eventModel) {
 Event event = new Event()
   .setLocation(eventModel.getLocation())
   .setDescription(eventModel.getTitle())
   .setSummary(eventModel.getNotes())
   .setStart(getEventDateTime(eventModel.getStartTime()))
   .setEnd(getEventDateTime(eventModel.getEndTime()));
 if (eventModel.getAttendees() != null) {
  event.setAttendees(eventModel.getAttendees().stream()
    .map(GoogleCalendarImporter::transformToEventAttendee)
    .collect(Collectors.toList()));
 }
 return event;
}
origin: google/data-transfer-project

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));
}
origin: google/google-api-java-client-samples

 static void display(Event event) {
  if (event.getStart() != null) {
   System.out.println("Start Time: " + event.getStart());
  }
  if (event.getEnd() != null) {
   System.out.println("End Time: " + event.getEnd());
  }
 }
}
origin: NovaFox161/DisCal-Discord-Bot

com.google.api.services.calendar.model.Calendar cal = service.calendars().get(calendarData.getCalendarId()).execute();
Event event = new Event();
event.setId(KeyGenerator.generateEventId());
event.setVisibility("public");
event.setSummary(body.getString("summary"));
event.setDescription(body.getString("description"));
event.setStart(start.setTimeZone(cal.getTimeZone()));
event.setEnd(end.setTimeZone(cal.getTimeZone()));
  event.setColorId(EventColor.fromNameOrHexOrID(body.getString("color")).getId() + "");
  event.setLocation(body.getString("location"));
  event.setRecurrence(Arrays.asList(rr));
ed.setEventId(event.getId());
  ed.setEventEnd(event.getEnd().getDateTime().getValue());
respondBody.put("id", confirmed.getId());
origin: NovaFox161/DisCal-Discord-Bot

public PreEvent(long _guildId, Event e) {
  guildId = _guildId;
  eventId = e.getId();
  color = EventColor.fromNameOrHexOrID(e.getColorId());
  if (e.getRecurrence() != null && e.getRecurrence().size() > 0) {
    recur = true;
    recurrence.fromRRule(e.getRecurrence().get(0));
  if (e.getSummary() != null)
    summary = e.getSummary();
  if (e.getDescription() != null)
    description = e.getDescription();
  if (e.getLocation() != null)
    location = e.getLocation();
  startDateTime = e.getStart();
  endDateTime = e.getEnd();
    if (e.getStart().getDateTime() != null) {
      viewableStartDate = new EventDateTime().setDateTime(new DateTime(TimeUtils.applyTimeZoneOffset(e.getStart().getDateTime().getValue(), cal.getTimeZone())));
      viewableEndDate = new EventDateTime().setDateTime(new DateTime(TimeUtils.applyTimeZoneOffset(e.getEnd().getDateTime().getValue(), cal.getTimeZone())));
    } else {
      viewableStartDate = new EventDateTime().setDate(new DateTime(TimeUtils.applyTimeZoneOffset(e.getStart().getDate().getValue(), cal.getTimeZone())));
      viewableEndDate = new EventDateTime().setDate(new DateTime(TimeUtils.applyTimeZoneOffset(e.getEnd().getDate().getValue(), cal.getTimeZone())));
origin: io.syndesis.connector/connector-google-calendar

if (ObjectHelper.isNotEmpty(event.getSummary())) {
  model.setTitle(event.getSummary());
if (ObjectHelper.isNotEmpty(event.getDescription())) {
  model.setDescription(event.getDescription());
if (ObjectHelper.isNotEmpty(event.getAttendees())) {
  model.setAttendees(getAttendeesString(event.getAttendees()));
if (ObjectHelper.isNotEmpty(event.getStart())) {
  if (event.getStart().getDateTime() != null) {
    model.setStartDate(dateFormat.format(new Date(event.getStart().getDateTime().getValue())));
    model.setStartTime(timeFormat.format(new Date(event.getStart().getDateTime().getValue())));
  } else {
    model.setStartDate(dateFormat.format(new Date(event.getStart().getDate().getValue())));
if (ObjectHelper.isNotEmpty(event.getEnd())) {
  if (event.getEnd().getDateTime() != null) {
    model.setEndDate(dateFormat.format(new Date(event.getEnd().getDateTime().getValue())));
    model.setEndTime(timeFormat.format(new Date(event.getEnd().getDateTime().getValue())));
  } else {
    model.setEndDate(dateFormat.format(new Date(event.getEnd().getDate().getValue())));
if (ObjectHelper.isNotEmpty(event.getLocation())) {
  model.setLocation(event.getLocation());
if (ObjectHelper.isNotEmpty(event.getId())) {
  model.setEventId(event.getId());
origin: gdenning/exchange-sync

private AppointmentDto convertToAppointmentDto(final Event event) {
  final GoogleAppointmentDto result = new GoogleAppointmentDto();
  result.setGoogleId(event.getId());
  if (event.getExtendedProperties() != null && event.getExtendedProperties().getPrivate() != null) {
    result.setExchangeId(event.getExtendedProperties().getPrivate().get(EXT_PROPERTY_EXCHANGE_ID));
  result.setLastModified(convertToJodaDateTime(event.getUpdated()));
  result.setSummary(event.getSummary());
  result.setDescription(event.getDescription());
  result.setStart(convertToJodaDateTime(event.getStart()));
  result.setEnd(convertToJodaDateTime(event.getEnd()));
  if (event.getEnd().getDateTime() != null) {
    result.setAllDay(event.getEnd().getDateTime().isDateOnly());
  result.setLocation(event.getLocation());
  if (event.getOrganizer() != null) {
    final PersonDto person = new PersonDto();
    person.setName(event.getOrganizer().getDisplayName());
    person.setEmail(event.getOrganizer().getEmail());
    result.setOrganizer(person);
  if (event.getAttendees() != null) {
    final Set<PersonDto> attendees = new HashSet<PersonDto>();
    for (final EventAttendee eventAttendee : event.getAttendees()) {
      final PersonDto person = new PersonDto();
      person.setName(eventAttendee.getDisplayName());
  if (event.getReminders() != null && event.getReminders().getOverrides() != null) {
    final EventReminder reminder = event.getReminders().getOverrides().iterator().next();
    result.setReminderMinutesBeforeStart(reminder.getMinutes());
origin: gdenning/exchange-sync

private void populateEventFromAppointmentDto(final AppointmentDto appointmentDto, final Event event) {
  event.setSummary(appointmentDto.getSummary());
  event.setDescription(appointmentDto.getDescription());
  event.setStart(convertToEventDateTime(appointmentDto.getStart(), appointmentDto.isAllDay(), calendarTimeZone));
  event.setEnd(convertToEventDateTime(appointmentDto.getEnd(), appointmentDto.isAllDay(), calendarTimeZone));
  event.setLocation(appointmentDto.getLocation());
  if (syncOrganizerAndAttendees) {
    if (appointmentDto.getOrganizer() != null && appointmentDto.getOrganizer().getEmail() != null) {
      organizer.setDisplayName(appointmentDto.getOrganizer().getName());
      organizer.setEmail(obfuscateEmail(appointmentDto.getOrganizer().getEmail()));
      event.setOrganizer(organizer);
      event.setAttendees(attendees);
    reminders.setUseDefault(false);
    reminders.setOverrides(Collections.singletonList(reminder));
    event.setReminders(reminders);
    event.setRecurrence(Collections.singletonList(recurrencePattern));
origin: NovaFox161/DisCal-Discord-Bot

for (Event e: items) {
  JSONObject jo = new JSONObject();
  jo.put("id", e.getId());
  jo.put("epochStart", e.getStart().getDateTime().getValue());
  jo.put("epochEnd", e.getEnd().getDateTime().getValue());
origin: google/google-api-java-client-samples

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;
}
origin: NovaFox161/DisCal-Discord-Bot

  public static PreEvent copyEvent(long guildId, Event event) {
    PreEvent pe = new PreEvent(guildId);
    pe.setSummary(event.getSummary());
    pe.setDescription(event.getDescription());
    pe.setLocation(event.getLocation());
    if (event.getColorId() != null)
      pe.setColor(EventColor.fromNameOrHexOrID(event.getColorId()));
    else
      pe.setColor(EventColor.RED);

    pe.setEventData(DatabaseManager.getManager().getEventData(guildId, event.getId()));

    return pe;
  }
}
origin: synyx/urlaubsverwaltung

private static void fillEvent(Absence absence, Event event) {
  event.setSummary(absence.getEventSubject());
  EventAttendee eventAttendee = new EventAttendee();
  eventAttendee.setEmail(absence.getPerson().getEmail());
  eventAttendee.setDisplayName(absence.getPerson().getNiceName());
  event.setAttendees(Collections.singletonList(eventAttendee));
  EventDateTime startEventDateTime;
  EventDateTime endEventDateTime;
  if (absence.isAllDay()) {
    // To create an all-day event, you must use setDate() having created DateTime objects using a String
    DateFormat dateFormat = new SimpleDateFormat(DATE_PATTERN_YYYY_MM_DD);
    String startDateStr = dateFormat.format(absence.getStartDate());
    String endDateStr = dateFormat.format(absence.getEndDate());
    DateTime startDateTime = new DateTime(startDateStr);
    DateTime endDateTime = new DateTime(endDateStr);
    startEventDateTime = new EventDateTime().setDate(startDateTime);
    endEventDateTime = new EventDateTime().setDate(endDateTime);
  } else {
    DateTime dateTimeStart = new DateTime(absence.getStartDate());
    DateTime dateTimeEnd = new DateTime(absence.getEndDate());
    startEventDateTime = new EventDateTime().setDateTime(dateTimeStart);
    endEventDateTime = new EventDateTime().setDateTime(dateTimeEnd);
  }
  event.setStart(startEventDateTime);
  event.setEnd(endEventDateTime);
}
origin: synyx/urlaubsverwaltung

@Override
public Optional<String> add(Absence absence, CalendarSettings calendarSettings) {
  googleCalendarClient = getOrCreateGoogleCalendarClient();
  if (googleCalendarClient != null) {
    GoogleCalendarSettings googleCalendarSettings =
        settingsService.getSettings().getCalendarSettings().getGoogleCalendarSettings();
    String calendarId = googleCalendarSettings.getCalendarId();
    try {
      Event eventToCommit = new Event();
      fillEvent(absence, eventToCommit);
      Event eventInCalendar = googleCalendarClient.events().insert(calendarId, eventToCommit).execute();
      LOG.info(String.format("Event %s for '%s' added to calendar '%s'.", eventInCalendar.getId(),
          absence.getPerson().getNiceName(), eventInCalendar.getSummary()));
      return Optional.of(eventInCalendar.getId());
    } catch (IOException ex) {
      LOG.warn(String.format("An error occurred while trying to add appointment to calendar %s", calendarId), ex);
      mailService.sendCalendarSyncErrorNotification(calendarId, absence, ex.toString());
    }
  }
  return Optional.empty();
}
origin: gsuitedevs/java-samples

  public static void main(String... args) throws IOException, GeneralSecurityException {
    // Build a new authorized API client service.
    final NetHttpTransport HTTP_TRANSPORT = GoogleNetHttpTransport.newTrustedTransport();
    Calendar service = new Calendar.Builder(HTTP_TRANSPORT, JSON_FACTORY, getCredentials(HTTP_TRANSPORT))
        .setApplicationName(APPLICATION_NAME)
        .build();

    // List the next 10 events from the primary calendar.
    DateTime now = new DateTime(System.currentTimeMillis());
    Events events = service.events().list("primary")
        .setMaxResults(10)
        .setTimeMin(now)
        .setOrderBy("startTime")
        .setSingleEvents(true)
        .execute();
    List<Event> items = events.getItems();
    if (items.isEmpty()) {
      System.out.println("No upcoming events found.");
    } else {
      System.out.println("Upcoming events");
      for (Event event : items) {
        DateTime start = event.getStart().getDateTime();
        if (start == null) {
          start = event.getStart().getDate();
        }
        System.out.printf("%s (%s)\n", event.getSummary(), start);
      }
    }
  }
}
origin: google/data-transfer-project

  new CalendarEventModel(modelCalendarId, null, null, null, null, null, null, null);
Event eventToInsert = GoogleCalendarImporter.convertToGoogleCalendarEvent(eventModel);
Event responseEvent = new Event();
origin: org.apache.camel/camel-google-calendar

  public Exchange createExchange(ExchangePattern pattern, Event event) {
    Exchange exchange = super.createExchange(pattern);
    Message message = exchange.getIn();
    message.setBody(event);
    message.setHeader(GoogleCalendarStreamConstants.EVENT_ID, event.getId());
    return exchange;
  }
}
origin: gdenning/exchange-sync

@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());
}
origin: NovaFox161/DisCal-Discord-Bot

private static boolean inPast(Event event) {
  if (event.getStart().getDateTime() != null)
    return event.getStart().getDateTime().getValue() <= System.currentTimeMillis();
  else
    return event.getStart().getDate().getValue() <= System.currentTimeMillis();
}
origin: NovaFox161/DisCal-Discord-Bot

com.google.api.services.calendar.model.Calendar cal = service.calendars().get(calendarData.getCalendarId()).execute();
Event event = new Event();
event.setId(KeyGenerator.generateEventId());
event.setVisibility("public");
event.setSummary(body.getString("summary"));
event.setDescription(body.getString("description"));
event.setStart(start.setTimeZone(cal.getTimeZone()));
event.setEnd(end.setTimeZone(cal.getTimeZone()));
  event.setColorId(EventColor.fromNameOrHexOrID(body.getString("color")).getId() + "");
  event.setLocation(body.getString("location"));
  event.setRecurrence(Arrays.asList(rr));
ed.setEventId(event.getId());
  ed.setEventEnd(event.getEnd().getDateTime().getValue());
respondBody.put("id", confirmed.getId());
origin: NovaFox161/DisCal-Discord-Bot

for (Event e : items) {
  JSONObject jo = new JSONObject();
  jo.put("id", e.getId());
  jo.put("epochStart", e.getStart().getDateTime().getValue());
  jo.put("epochEnd", e.getEnd().getDateTime().getValue());
  jo.put("timezone", tz);
  jo.put("summary", e.getSummary());
  jo.put("description", e.getDescription());
  if (e.getLocked() != null)
    jo.put("location", e.getLocation());
  else
    jo.put("location", "N/a");
  jo.put("color", EventColor.fromNameOrHexOrID(e.getColorId()).name());
  jo.put("isParent", !(e.getId().contains("_")));
  if (e.getRecurrence() != null && e.getRecurrence().size() > 0) {
    jo.put("recur", true);
    Recurrence r = new Recurrence().fromRRule(e.getRecurrence().get(0));
  EventData ed = DatabaseManager.getManager().getEventData(settings.getGuildID(), e.getId());
com.google.api.services.calendar.modelEvent

Most used methods

  • <init>
  • getStart
  • getSummary
  • getEnd
  • getId
  • setEnd
  • setStart
  • setSummary
  • getDescription
  • getLocation
  • setDescription
  • setLocation
  • setDescription,
  • setLocation,
  • getRecurrence,
  • getColorId,
  • setAttendees,
  • setRecurrence,
  • getAttendees,
  • getLocked,
  • setColorId,
  • setId

Popular in Java

  • Making http post requests using okhttp
  • putExtra (Intent)
  • setContentView (Activity)
  • scheduleAtFixedRate (Timer)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Socket (java.net)
    Provides a client-side TCP socket.
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now