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


Java CalendarListEntry类代码示例

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


CalendarListEntry类属于com.google.api.services.calendar.model包,在下文中一共展示了CalendarListEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convert

import com.google.api.services.calendar.model.CalendarListEntry; //导入依赖的package包/类
@Override
public GoogleCalendar convert(CalendarListEntry source) {
    GoogleCalendar calendar = new GoogleCalendar();
    calendar.setId(source.getId());
    calendar.setName(source.getSummary());
    calendar.setShortName(source.getSummary());
    calendar.setPrimary(source.isPrimary());
    calendar.setReadOnly(GoogleCalendar.isReadOnlyAccessRole(source.getAccessRole()));
    List<GoogleEntryReminder> reminders = new ArrayList<>();
    if (source.getDefaultReminders() != null) {
        for (EventReminder r : source.getDefaultReminders()) {
            reminders.add(new GoogleEntryReminder(r));
        }
    }
    calendar.getDefaultReminders().setAll(reminders);
    return calendar;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:18,代码来源:CalendarListEntryToGoogleCalendarConverter.java

示例2: convert

import com.google.api.services.calendar.model.CalendarListEntry; //导入依赖的package包/类
@Override
public CalendarListEntry convert(GoogleCalendar source) {
    CalendarListEntry calendarListEntry = new CalendarListEntry();
    calendarListEntry.setId(source.getId());
    calendarListEntry.setSummary(source.getName());
    calendarListEntry.setPrimary(source.isPrimary());
    List<EventReminder> reminders = new ArrayList<>();
    for (GoogleEntryReminder reminder : source.getDefaultReminders()) {
        EventReminder er = new EventReminder();
        er.setMethod(reminder.getMethod().getId());
        er.setMinutes(reminder.getMinutes());
        reminders.add(er);
    }
    calendarListEntry.setDefaultReminders(reminders);
    return calendarListEntry;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:17,代码来源:GoogleCalendarToCalendarListEntryConverter.java

示例3: getCalendars

import com.google.api.services.calendar.model.CalendarListEntry; //导入依赖的package包/类
/**
 * Gets the list of all calendars available in the account.
 *
 * @return A non-null list of all calendars.
 * @throws IOException For unexpected errors.
 */
public List<GoogleCalendar> getCalendars() throws IOException {
    List<CalendarListEntry> calendarListEntries = dao.calendarList().list().execute().getItems();
    List<GoogleCalendar> calendars = new ArrayList<>();

    if (calendarListEntries != null && !calendarListEntries.isEmpty()) {
        for (int i = 0; i < calendarListEntries.size(); i++) {
            CalendarListEntry calendarListEntry = calendarListEntries.get(i);
            GoogleCalendar calendar = converter.convert(calendarListEntry, GoogleCalendar.class);
            calendar.setStyle(com.calendarfx.model.Calendar.Style.getStyle(i));
            calendars.add(calendar);
        }
    }

    return calendars;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:22,代码来源:GoogleCalendarService.java

示例4: updateCalendars

import com.google.api.services.calendar.model.CalendarListEntry; //导入依赖的package包/类
void updateCalendars(){
    tabs.removeAll();
    try {
        List<CalendarListEntry> cl = Program.calendars.fetchCalendars().getItems();
        for(CalendarListEntry c : cl){
            tabs.add(new JCalendar(Program.calendars.fetchCalendar(c.getId())));
            String text = "<html>";
            if(c.getSummary() != null) text += c.getSummary() + "<br />";
            if(c.getDescription() != null) text += c.getDescription();
            text += "</html>";
            if(!text.equals("<html></html>")) tabs.setToolTipTextAt(tabs.getTabCount() - 1, text);
        }
    }
    catch(Exception e){
        e.printStackTrace();
        JOptionPane.showMessageDialog(this, "Failed to pull calendars: " + e.getMessage(), "EVE Calendars", JOptionPane.ERROR_MESSAGE);
    }
}
 
开发者ID:beesenpai,项目名称:EVE,代码行数:19,代码来源:CalendarTab.java

示例5: getDataFromApi

import com.google.api.services.calendar.model.CalendarListEntry; //导入依赖的package包/类
@Override
protected List<CalendarListEntry> getDataFromApi() throws IOException {
    List<CalendarListEntry> calList =
            getCalendarService().calendarList().list().execute().getItems();
    if (DEBUG) {
        Log.d(TAG, calList.toString());
        for (CalendarListEntry calendarListEntry : calList) {
            List<Event> events = new ListCalendarEventsRequestTask(getCredential(),
                    calendarListEntry.getId()).getDataFromApi();
            if (DEBUG) {
                Log.d(TAG, calendarListEntry.getSummary());
                Log.d(TAG, calendarListEntry.getId());
                Log.d(TAG, "Events: " + events.toString());
            }
        }
    }
    return calList;
}
 
开发者ID:ITVlab,项目名称:Family-Calendar,代码行数:19,代码来源:ListCalendarListRequestTask.java

示例6: getCalendar

import com.google.api.services.calendar.model.CalendarListEntry; //导入依赖的package包/类
/**
 * retrieves the calendar for the given name (summary)
 *
 * @return den Kalender
 */
private com.google.api.services.calendar.model.Calendar getCalendar() {
	if (calendar == null) {
		final com.google.api.services.calendar.Calendar myService = settings.getGoogleCalendarService();
		try {
			final CalendarList list = myService.calendarList().list().execute();
			for (final CalendarListEntry entry : list.getItems()) {
				if (settings.getGoogleCalendarName().equals(entry.getSummary())) {
					final String id = entry.getId();
					calendar = myService.calendars().get(id).execute();
					break;
				}
			}
		} catch (final IOException e) {
			throw new SynchronisationException(e);
		}

		if (calendar == null) {
			// calendar with given name does not exist
			throw new SynchronisationException(UserMessage.get().GOOGLE_CALENDAR_S_DOES_NOT_EXIST_CHECK_CONFIG(settings.getGoogleCalendarName()));
		}
	}
	return calendar;
}
 
开发者ID:fjakop,项目名称:ngcalsync,代码行数:29,代码来源:GoogleCalendarDAO.java

示例7: createCalendarEvent

import com.google.api.services.calendar.model.CalendarListEntry; //导入依赖的package包/类
/**
 * Creates a new calendar entry.
 *
 * @param event the event to create in the remote calendar identified by the
 *            full calendar feed configured in </code>openhab.cfg</code>
 * @return the newly created entry
 * @throws IOException
 */
private Event createCalendarEvent(Calendar calendarClient, Event event) throws IOException {

    if (calendarClient == null) {
        logger.error(
                "Please configure gcal:client_id/gcal:client_secret in openhab.cfg. Refer to wiki how to create client_id/client_secret pair");
    } else {
        // set up global Calendar instance
        CalendarListEntry calendarID = GCalGoogleOAuth.getCalendarId(calendar_name);
        if (calendarID != null) {
            return calendarClient.events().insert(calendarID.getId(), event).execute();
        }

    }

    return null;

}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:26,代码来源:GCalPersistenceService.java

示例8: BeanConverterService

import com.google.api.services.calendar.model.CalendarListEntry; //导入依赖的package包/类
private BeanConverterService() {
    converters.put(Pair.of(GoogleEntry.class, Event.class), new GoogleEntryToEventConverter());
    converters.put(Pair.of(Event.class, GoogleEntry.class), new EventToGoogleEntryConverter());
    converters.put(Pair.of(GoogleCalendar.class, CalendarListEntry.class), new GoogleCalendarToCalendarListEntryConverter());
    converters.put(Pair.of(CalendarListEntry.class, GoogleCalendar.class), new CalendarListEntryToGoogleCalendarConverter());
    converters.put(Pair.of(GoogleCalendar.class, Calendar.class), new GoogleCalendarToCalendarConverter());
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:8,代码来源:BeanConverterService.java

示例9: addCheckInEvent

import com.google.api.services.calendar.model.CalendarListEntry; //导入依赖的package包/类
private static void addCheckInEvent(final Booking b) throws IOException {
    final CalendarListEntry flats = getCalendar();
    String note = "Checkin: ";
    if (b.getCheckInNote() != null) {
        note += b.getCheckInNote();
    }
    if (b.getSpecialRequestNote() != null) {
        note = note + "\n" + b.getSpecialRequestNote();
    }
    final Event checkInEvent = new EventFactory().newEvent(getCheckInSummary(b), b.getCheckIn(),
            b.getGuest().getName() + ": " + note);
    b.addCalendarId(addEvent(flats.getId(), checkInEvent));
}
 
开发者ID:DrBookings,项目名称:drbookings,代码行数:14,代码来源:GoogleCalendarSync.java

示例10: addCheckOutEvent

import com.google.api.services.calendar.model.CalendarListEntry; //导入依赖的package包/类
private static void addCheckOutEvent(final Booking b) throws IOException {
    final CalendarListEntry flats = getCalendar();
    String note = "Checkout: ";
    if (b.getCheckOutNote() != null) {
        note += b.getCheckOutNote();
    }
    final Event event = new EventFactory().newEvent(getCheckOutSummary(b), b.getCheckOut(),
            b.getGuest().getName() + ": " + note);
    b.addCalendarId(addEvent(flats.getId(), event));

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

示例11: addCleaningEvent

import com.google.api.services.calendar.model.CalendarListEntry; //导入依赖的package包/类
private static void addCleaningEvent(final CleaningEntry c) throws IOException {
    final CalendarListEntry flats = getCalendar();
    final String prefix = SettingsManager.getInstance().getRoomNamePrefix();
    final Event event = new EventFactory().newEvent(
            "Cleaning " + prefix + c.getRoom().getName() + " " + c.getElement().getName(), c.getDate(),
            "Cleaning event");
    c.addCalendarId(addEvent(flats.getId(), event));
}
 
开发者ID:DrBookings,项目名称:drbookings,代码行数:9,代码来源:GoogleCalendarSync.java

示例12: getCalendar

import com.google.api.services.calendar.model.CalendarListEntry; //导入依赖的package包/类
private static CalendarListEntry getCalendar() throws IOException {
    final CalendarList feed = client.calendarList().list().execute();
    for (final CalendarListEntry c : feed.getItems()) {
        if (c.getSummary().equalsIgnoreCase("flats")) {
            return c;
        }
    }
    return null;
}
 
开发者ID:DrBookings,项目名称:drbookings,代码行数:10,代码来源:GoogleCalendarSync.java

示例13: testCalendarList

import com.google.api.services.calendar.model.CalendarListEntry; //导入依赖的package包/类
@Test
public void testCalendarList() throws Exception {
    Calendar calendar = getCalendar();
    assertTrue("Test calendar should be in the list", isCalendarInList(calendar));

    CalendarListEntry calendarFromGet = requestBody("direct://GET", calendar.getId());
    assertTrue(calendar.getId().equals(calendarFromGet.getId()));
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:9,代码来源:CalendarCalendarListIntegrationTest.java

示例14: isCalendarInList

import com.google.api.services.calendar.model.CalendarListEntry; //导入依赖的package包/类
protected boolean isCalendarInList(Calendar calendar) {
    CalendarList calendarList = requestBody("direct://LIST", null);

    java.util.List<CalendarListEntry> items = calendarList.getItems();

    boolean found = false;
    for (CalendarListEntry calendarListEntry : items) {
        if (calendar.getSummary().equals(calendarListEntry.getSummary())) {
            found = true;
        }
    }
    return found;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:14,代码来源:CalendarCalendarListIntegrationTest.java

示例15: getCalendarId

import com.google.api.services.calendar.model.CalendarListEntry; //导入依赖的package包/类
/**
 * Return calendarID based on calendar name.
 * if calendar name is "primary" not check primary - just return primary
 *
 * @param calendar object
 */
public static CalendarListEntry getCalendarId(String calendar_name) {

    CalendarListEntry calendarID = null;

    if (calendarList == null) {
        Calendar client = new Calendar.Builder(HTTP_TRANSPORT, JSON_FACTORY, getCredential(false))
                .setApplicationName("openHAB").build();
        try {
            calendarList = client.calendarList().list().execute();
        } catch (com.google.api.client.auth.oauth2.TokenResponseException ae) {
            logger.error("authentication failed: {}", ae.getMessage());
            return null;
        } catch (IOException e1) {
            logger.error("authentication I/O exception: {}", e1.getMessage());
            return null;
        }
    }

    if (calendarList != null && calendarList.getItems() != null) {
        for (CalendarListEntry entry : calendarList.getItems()) {
            if ((entry.getSummary().equals(calendar_name))
                    || (calendar_name.equals("primary")) && entry.isPrimary()) {
                calendarID = entry;
                logger.debug("Got calendar {} CalendarID: {}", calendar_name, calendarID.getId());
            }
        }
    }

    if (calendarID == null) {
        logger.warn("Calendar {} not found", calendar_name);
    }

    return calendarID;
}
 
开发者ID:openhab,项目名称:openhab1-addons,代码行数:41,代码来源:GCalGoogleOAuth.java


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