本文整理汇总了Java中com.google.api.services.calendar.model.CalendarList类的典型用法代码示例。如果您正苦于以下问题:Java CalendarList类的具体用法?Java CalendarList怎么用?Java CalendarList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CalendarList类属于com.google.api.services.calendar.model包,在下文中一共展示了CalendarList类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getCalendar
import com.google.api.services.calendar.model.CalendarList; //导入依赖的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
示例2: getCalendar
import com.google.api.services.calendar.model.CalendarList; //导入依赖的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
示例3: isCalendarInList
import com.google.api.services.calendar.model.CalendarList; //导入依赖的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
示例4: fetchCalendars
import com.google.api.services.calendar.model.CalendarList; //导入依赖的package包/类
/***
* Gets a lists of all calendars in the client instance and returns it.
* @return List of calendars
* @throws IOException
*/
public CalendarList fetchCalendars() throws IOException{
return client.calendarList().list().execute();
}
开发者ID:beesenpai,项目名称:EVE,代码行数:9,代码来源:CalendarAPI.java
示例5: update
import com.google.api.services.calendar.model.CalendarList; //导入依赖的package包/类
@Override
public Map<Thermostat, SortedMap<Period, ZoneStatus>> update() throws IOException {
NDC.push("update");
Marker m = new Marker("update");
Map<Thermostat, SortedMap<Period, ZoneStatus>> ts2schedule = new TreeMap<Thermostat, SortedMap<Period, ZoneStatus>>();
try {
HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
FileDataStoreFactory dataStoreFactory = new FileDataStoreFactory(new File(System.getProperty("user.home"), STORED_CREDENTIALS));
m.checkpoint("instantiated tools");
Credential credential = authorize(httpTransport, jsonFactory, dataStoreFactory);
m.checkpoint("authorized");
// VT: NOTE: There's no need for us to do this more often than we really need.
// I'd assume that once a year would be just fine. Maybe a bit too often, but come on, let's be realistic,
// users need some extra fun.
credential.setExpiresInSeconds(60L * 60L * 24L * 365L);
Calendar calendarClient = new Calendar.Builder(httpTransport, jsonFactory, credential).setApplicationName(LITERAL_APP_NAME).build();
m.checkpoint("instantiated client");
CalendarList feed = calendarClient.calendarList().list().execute();
List<CalendarListEntry> calendars = feed.getItems();
m.checkpoint("retrieved feed");
logger.info(calendars.size() + " calendars found:");
for (Iterator<CalendarListEntry> i = calendars.iterator(); i.hasNext(); ) {
CalendarListEntry c = i.next();
logger.info(" calendar: " + c.getSummary());
}
m.checkpoint("retrieved summary");
for (Iterator<CalendarListEntry> i = calendars.iterator(); i.hasNext(); ) {
CalendarListEntry calendar = i.next();
updateCalendar(ts2schedule, calendarClient, calendar);
}
NDC.push("schedule");
for (Iterator<Entry<Thermostat, SortedMap<Period, ZoneStatus>>> i = ts2schedule.entrySet().iterator(); i.hasNext(); ) {
Entry<Thermostat, SortedMap<Period, ZoneStatus>> pair = i.next();
logger.info(pair.getKey().getName() + ": " + pair.getValue().size() + " entries");
for (Iterator<Entry<Period, ZoneStatus>> i2 = pair.getValue().entrySet().iterator(); i2.hasNext(); ) {
logger.info(" " + i2.next());
}
}
NDC.pop();
return ts2schedule;
} catch (GeneralSecurityException ex) {
throw new IllegalStateException("Oops", ex);
} finally {
m.close();
NDC.pop();
}
}
开发者ID:home-climate-control,项目名称:dz,代码行数:82,代码来源:GCalScheduleUpdater.java
注:本文中的com.google.api.services.calendar.model.CalendarList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论