Java Code Examples for com.google.api.services.calendar.model.Calendar#setSummary()
The following examples show how to use
com.google.api.services.calendar.model.Calendar#setSummary() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GoogleCalendarResource.java From camel-quarkus with Apache License 2.0 | 5 votes |
@Path("/create") @POST @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) public Response createCalendar(String summary) throws Exception { Calendar calendar = new Calendar(); calendar.setSummary(summary); calendar.setTimeZone("Europe/London"); Calendar response = producerTemplate.requestBody("google-calendar://calendars/insert?inBody=content", calendar, Calendar.class); return Response .created(new URI("https://camel.apache.org/")) .entity(response.getId()) .build(); }
Example 2
Source File: GoogleCalendarIntegrationTest.java From wildfly-camel with Apache License 2.0 | 5 votes |
private static Calendar createTestCalendar(ProducerTemplate template, String testId) { Calendar calendar = new Calendar(); calendar.setSummary(testId + UUID.randomUUID().toString()); calendar.setTimeZone("America/St_Johns"); return template.requestBody("google-calendar://calendars/insert?inBody=content", calendar, Calendar.class); }
Example 3
Source File: AddCalendarWorkitemHandler.java From jbpm-work-items with Apache License 2.0 | 4 votes |
public Calendar addCalendar(com.google.api.services.calendar.Calendar client, String calendarSummary) throws IOException { Calendar entry = new Calendar(); entry.setSummary(calendarSummary); return client.calendars().insert(entry).execute(); }
Example 4
Source File: DashboardHandler.java From DisCal-Discord-Bot with GNU Lesser General Public License v3.0 | 4 votes |
@PostMapping(value = "/create/calendar") public static String handleCalendarCreate(HttpServletRequest request, HttpServletResponse response, @RequestParam Map<String, String> queryParams) { try { String name = queryParams.get("cal-name"); String desc = queryParams.get("cal-desc"); String tz = queryParams.get("cal-tz"); Map m = DiscordAccountHandler.getHandler().getAccount(request); WebGuild g = (WebGuild) m.get("selected"); if (g.isDiscalRole()) { Calendar calendar = new Calendar(); calendar.setSummary(name); calendar.setDescription(desc); calendar.setTimeZone(tz.replace("___", "/")); try { com.google.api.services.calendar.Calendar service = CalendarAuth.getCalendarService(g.getSettings()); Calendar confirmed = service.calendars().insert(calendar).execute(); AclRule rule = new AclRule(); AclRule.Scope scope = new AclRule.Scope(); scope.setType("default"); rule.setScope(scope).setRole("reader"); service.acl().insert(confirmed.getId(), rule).execute(); CalendarData calendarData = new CalendarData(Snowflake.of(g.getId()), 1); calendarData.setCalendarId(confirmed.getId()); calendarData.setCalendarAddress(confirmed.getId()); DatabaseManager.getManager().updateCalendar(calendarData); //Refresh to display correct info... g.setCalendar(new WebCalendar().fromCalendar(calendarData, g.getSettings())); } catch (Exception ex) { Logger.getLogger().exception(null, "[WEB] Failed to confirm calendar.", ex, true, DashboardHandler.class); } } //Finally redirect back to the dashboard response.sendRedirect("/dashboard/guild/calendar"); return "redirect:/dashboard/guild/calendar"; } catch (Exception e) { Logger.getLogger().exception(null, "[WEB] Calendar create failed!", e, true, DashboardHandler.class); response.setContentType("application/json"); response.setStatus(500); return ResponseUtils.getJsonResponseMessage("Internal Server Error"); } }
Example 5
Source File: DashboardHandler.java From DisCal-Discord-Bot with GNU Lesser General Public License v3.0 | 4 votes |
@PostMapping(value = "/create/calendar") public static String handleCalendarCreate(HttpServletRequest request, HttpServletResponse response, @RequestParam Map<String, String> queryParams) { try { String name = queryParams.get("cal-name"); String desc = queryParams.get("cal-desc"); String tz = queryParams.get("cal-tz"); Map m = DiscordAccountHandler.getHandler().getAccount(request); WebGuild g = (WebGuild) m.get("selected"); if (g.isDiscalRole()) { Calendar calendar = new Calendar(); calendar.setSummary(name); calendar.setDescription(desc); calendar.setTimeZone(tz.replace("___", "/")); try { com.google.api.services.calendar.Calendar service = CalendarAuth.getCalendarService(g.getSettings()); Calendar confirmed = service.calendars().insert(calendar).execute(); AclRule rule = new AclRule(); AclRule.Scope scope = new AclRule.Scope(); scope.setType("default"); rule.setScope(scope).setRole("reader"); service.acl().insert(confirmed.getId(), rule).execute(); CalendarData calendarData = new CalendarData(Snowflake.of(g.getId()), 1); calendarData.setCalendarId(confirmed.getId()); calendarData.setCalendarAddress(confirmed.getId()); DatabaseManager.getManager().updateCalendar(calendarData); //Refresh to display correct info... g.setCalendar(new WebCalendar().fromCalendar(calendarData, g.getSettings())); } catch (Exception ex) { Logger.getLogger().exception(null, "[WEB] Failed to confirm calendar.", ex, true, DashboardHandler.class); } } //Finally redirect back to the dashboard response.sendRedirect("/dashboard/guild/calendar"); return "redirect:/dashboard/guild/calendar"; } catch (Exception e) { Logger.getLogger().exception(null, "[WEB] Calendar create failed!", e, true, DashboardHandler.class); response.setContentType("application/json"); response.setStatus(500); return ResponseUtils.getJsonResponseMessage("Internal Server Error"); } }