当前位置: 首页>>代码示例>>Java>>正文


Java Events.getItems方法代码示例

本文整理汇总了Java中com.google.api.services.calendar.model.Events.getItems方法的典型用法代码示例。如果您正苦于以下问题:Java Events.getItems方法的具体用法?Java Events.getItems怎么用?Java Events.getItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.api.services.calendar.model.Events的用法示例。


在下文中一共展示了Events.getItems方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDataFromApi

import com.google.api.services.calendar.model.Events; //导入方法依赖的package包/类
/**
 * Fetch a list of the next 10 events from the primary calendar.
 *
 * @return List of Strings describing returned events.
 * @throws IOException
 */
private List<String> getDataFromApi() throws IOException {
    // List the next 10 events from the primary calendar.
    DateTime now = new DateTime(System.currentTimeMillis());
    List<String> eventStrings = new ArrayList<String>();
    Events events = mService.events().list("primary")
            .setMaxResults(10)
            .setTimeMin(now)
            .setOrderBy("startTime")
            .setSingleEvents(true)
            .execute();
    List<Event> items = events.getItems();

    for (Event event : items) {
        DateTime start = event.getStart().getDateTime();
        if (start == null) {
            // All-day events don't have start times, so just use
            // the start date.
            start = event.getStart().getDate();
        }
        eventStrings.add(
                String.format("%s (%s)", event.getSummary(), start));
    }
    return eventStrings;
}
 
开发者ID:webianks,项目名称:Crimson,代码行数:31,代码来源:CheckupReminders.java

示例2: execute

import com.google.api.services.calendar.model.Events; //导入方法依赖的package包/类
/**
 * @{inheritDoc}
 */
@Override
protected void execute() {
    Events myFeed = downloadEventFeed();
    if (myFeed != null) {
        List<Event> entries = myFeed.getItems();

        if (entries.size() > 0) {
            logger.debug("found {} calendar events to process", entries.size());

            try {
                if (scheduler.isShutdown()) {
                    logger.warn("Scheduler has been shut down - probably due to exceptions?");
                }
                cleanJobs();
                processEntries(entries);
            } catch (SchedulerException se) {
                logger.error("scheduling jobs throws exception", se);
            }
        } else {
            logger.debug("gcal feed contains no events ...");
        }
    }
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:27,代码来源:GCalEventDownloader.java

示例3: getEvents

import com.google.api.services.calendar.model.Events; //导入方法依赖的package包/类
private List<Event> getEvents(GuildSettings gs, CalendarData cd, Calendar service, Announcement a) {
	if (!allEvents.containsKey(gs.getGuildID())) {
		try {
			Events events = service.events().list(cd.getCalendarAddress())
					.setMaxResults(15)
					.setTimeMin(new DateTime(System.currentTimeMillis()))
					.setOrderBy("startTime")
					.setSingleEvents(true)
					.setShowDeleted(false)
					.execute();
			List<Event> items = events.getItems();
			allEvents.put(gs.getGuildID(), items);
		} catch (IOException e) {
			ExceptionHandler.sendException(null, "Failed to get events list! 00x2304 | Guild: " + gs.getGuildID() + " | Announcement: " + a.getAnnouncementId(), e, this.getClass());
			allEvents.put(gs.getGuildID(), new VirtualFlow.ArrayLinkedList<>());
		}
	}
	return allEvents.get(gs.getGuildID());
}
 
开发者ID:NovaFox161,项目名称:DisCal-Discord-Bot,代码行数:20,代码来源:AnnouncementTask.java

示例4: fetchEvent

import com.google.api.services.calendar.model.Events; //导入方法依赖的package包/类
public Event fetchEvent(String id, String summary) throws IOException{
	Events ev = showEvents(id);
	for(Event e : ev.getItems()){
		if(e.getSummary().equalsIgnoreCase(summary)) return e;
	}
	return null;
}
 
开发者ID:beesenpai,项目名称:EVE,代码行数:8,代码来源:CalendarAPI.java

示例5: clear

import com.google.api.services.calendar.model.Events; //导入方法依赖的package包/类
public GoogleCalendarSync clear(final LocalDate date) throws IOException {
    final CalendarListEntry flats = getCalendar();
    // Iterate over the events in the specified calendar
    String pageToken = null;
    int cnt = 0;
    do {
        final Events events;
        if (date != null) {
            events = client.events().list(flats.getId()).setTimeMin(new DateTime(new DateConverter().convert(date)))
                    .setPageToken(pageToken).execute();
        } else {
            events = client.events().list(flats.getId()).setPageToken(pageToken).execute();
        }
        final List<Event> items = events.getItems();
        for (final Event event : items) {
            if (event == null) {
                if (logger.isWarnEnabled()) {
                    logger.warn("Skipping null event");
                }
                continue;
            }
            clearEvent(flats.getId(), event);
            cnt++;
        }
        pageToken = events.getNextPageToken();
    } while (pageToken != null);
    if (logger.isDebugEnabled()) {
        logger.debug("Processed " + cnt + " events");
    }

    return this;
}
 
开发者ID:DrBookings,项目名称:drbookings,代码行数:33,代码来源:GoogleCalendarSync.java

示例6: getEvents

import com.google.api.services.calendar.model.Events; //导入方法依赖的package包/类
@Override
public List<CalendarEvent> getEvents(final ICalendarEventFilter[] filters) throws SynchronisationException {
	log.info(UserMessage.get().MSG_READING_GOOGLE_EVENTS(getCalendar().getSummary()));

	final List<CalendarEvent> events = new ArrayList<CalendarEvent>();
	try {

		final Calendar sdt = settings.getSyncStartDate();
		final Calendar edt = settings.getSyncEndDate();

		final DateTime startDateTime = new DateTime(sdt.getTime(), sdt.getTimeZone());
		final DateTime endDateTime = new DateTime(edt.getTime(), edt.getTimeZone());

		final Events googleEvents = service.events().list(getCalendar().getId())//
				.setTimeMin(startDateTime).setTimeMax(endDateTime)//
				.setMaxResults(new Integer(65535))//
				.setOrderBy("starttime")// //$NON-NLS-1$
				// handling recurrence is not necessary, since Lotus Notes recurrence is a pain in the a..
				.setSingleEvents(Boolean.TRUE)//
				.execute();

		// if no entry is present in the Google calendar, the list is null
		if (googleEvents.getItems() == null) {
			return new ArrayList<CalendarEvent>();
		}
		for (final Event googleEvent : googleEvents.getItems()) {
			events.add(convGoogleEvent(googleEvent));
		}
	} catch (final IOException e) {
		throw new SynchronisationException(e);
	}

	return events;

}
 
开发者ID:fjakop,项目名称:ngcalsync,代码行数:36,代码来源:GoogleCalendarDAO.java


注:本文中的com.google.api.services.calendar.model.Events.getItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。