Java Code Examples for com.google.api.services.calendar.model.Event#setDescription()
The following examples show how to use
com.google.api.services.calendar.model.Event#setDescription() .
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: GoogleCalendar.java From garoon-google with MIT License | 6 votes |
public String addSchedule(Date start, Date end, String title, String description, String location, String color, ArrayList<String> recurrence, TimeZone timezone) throws Exception { String id = null; Event googleSchedule = new Event(); googleSchedule.setStart(new EventDateTime().setTimeZone(timezone.getID()).setDateTime(new DateTime(start))); googleSchedule.setEnd(new EventDateTime().setTimeZone(timezone.getID()).setDateTime(new DateTime(end))); googleSchedule.setRecurrence(null); googleSchedule.setSummary(title.trim()); googleSchedule.setDescription(description.trim()); googleSchedule.setLocation(location.trim()); googleSchedule.setColorId(color); googleSchedule.setRecurrence(recurrence); Event createdEvent = this.CALENDAR.events().insert(this.CALENDAR_NAME, googleSchedule).execute(); id = createdEvent.getId(); return id; }
Example 2
Source File: GCalPersistenceService.java From openhab1-addons with Eclipse Public License 2.0 | 6 votes |
/** * Creates a new Google Calendar Entry for each <code>item</code> and adds * it to the processing queue. The entries' title will either be the items * name or <code>alias</code> if it is <code>!= null</code>. * * The new Calendar Entry will contain a single command to be executed e.g.<br> * <p> * <code>send <item.name> <item.state></code> * </p> * * @param item the item which state should be persisted. * @param alias the alias under which the item should be persisted. */ @Override public void store(final Item item, final String alias) { if (initialized) { String newAlias = alias != null ? alias : item.getName(); Event event = new Event(); event.setSummary("[PresenceSimulation] " + newAlias); event.setDescription(String.format(executeScript, item.getName(), item.getState().toString())); Date now = new Date(); Date startDate = new Date(now.getTime() + 3600000L * 24 * offset); Date endDate = startDate; DateTime start = new DateTime(startDate); event.setStart(new EventDateTime().setDateTime(start)); DateTime end = new DateTime(endDate); event.setEnd(new EventDateTime().setDateTime(end)); entries.offer(event); logger.trace("added new entry '{}' for item '{}' to upload queue", event.getSummary(), item.getName()); } else { logger.debug( "GCal PresenceSimulation Service isn't initialized properly! No entries will be uploaded to your Google Calendar"); } }
Example 3
Source File: GoogleCalendarEventModel.java From syndesis with Apache License 2.0 | 5 votes |
Event asEvent() { final Event event = new Event(); event.setSummary(title); event.setDescription(description); event.setAttendees(GoogleCalendarUtils.parseAtendees(attendees)); event.setStart(getStart()); event.setEnd(getEnd()); event.setLocation(location); event.setId(eventId); return event; }
Example 4
Source File: GoogleCalendarEventModelTest.java From syndesis with Apache License 2.0 | 5 votes |
@Test public void createsConnectorModelFromGoogleModel() { final Event googleModel = new Event(); googleModel.setSummary("summary"); googleModel.setDescription("description"); googleModel.setAttendees(Arrays.asList(attendee("[email protected]"), attendee("[email protected]"))); googleModel.setStart(dateTime("2018-05-18T15:30:00+02:00")); googleModel.setEnd(dateTime("2018-05-18T16:30:00+02:00")); googleModel.setLocation("location"); googleModel.setId("eventId"); final GoogleCalendarEventModel eventModel = GoogleCalendarEventModel.newFrom(googleModel); final GoogleCalendarEventModel expected = new GoogleCalendarEventModel(); expected.setTitle("summary"); expected.setDescription("description"); expected.setAttendees("[email protected],[email protected]"); expected.setStartDate("2018-05-18"); expected.setStartTime("15:30:00"); expected.setEndDate("2018-05-18"); expected.setEndTime("16:30:00"); expected.setLocation("location"); expected.setEventId("eventId"); assertThat(eventModel).isEqualToComparingFieldByField(expected); googleModel.setStart(dateTime("2018-05-18T15:30:00.000Z")); googleModel.setEnd(dateTime("2018-05-18T16:30:00.000Z")); assertThat(eventModel.asEvent()).isEqualTo(googleModel); }