Java Code Examples for com.google.api.services.calendar.model.Event#getICalUID()
The following examples show how to use
com.google.api.services.calendar.model.Event#getICalUID() .
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: GCalEventDownloader.java From openhab1-addons with Eclipse Public License 2.0 | 5 votes |
/** * Checks the first {@link CalendarEventEntry} of <code>entries</code> for * completeness. If this first event is incomplete all other events will be * incomplete as well. * * @param list the set to check */ private static void checkIfFullCalendarFeed(List<Event> list) { if (list != null && !list.isEmpty()) { Event referenceEvent = list.get(0); if (referenceEvent.getICalUID() == null || referenceEvent.getStart().toString().isEmpty()) { logger.warn("calendar entries are incomplete - please make sure to use the full calendar feed"); } } }
Example 2
Source File: GCalEventDownloader.java From openhab1-addons with Eclipse Public License 2.0 | 5 votes |
/** * Creates a new quartz-job with jobData <code>content</code> in the scheduler * group <code>GCAL_SCHEDULER_GROUP</code> if <code>content</code> is not * blank. * * @param content the set of commands to be executed by the * {@link ExecuteCommandJob} later on * @param event * @param isStartEvent indicator to identify whether this trigger will be * triggering a start or an end command. * * @return the {@link JobDetail}-object to be used at further processing */ protected JobDetail createJob(String content, Event event, boolean isStartEvent) { String jobIdentity = event.getICalUID() + (isStartEvent ? "_start" : "_end"); if (StringUtils.isBlank(content)) { logger.debug("content of job '{}' is empty -> no task will be created!", jobIdentity); return null; } JobDetail job = newJob(ExecuteCommandJob.class).usingJobData(ExecuteCommandJob.JOB_DATA_CONTENT_KEY, content) .withIdentity(jobIdentity, GCAL_SCHEDULER_GROUP).build(); return job; }
Example 3
Source File: GCalEventDownloader.java From openhab1-addons with Eclipse Public License 2.0 | 4 votes |
/** * Creates a set quartz-triggers for <code>job</code>. For each {@link When} * object of <code>event</code> a new trigger is created. That is the case * in recurring events where gcal creates one event (with one unique IcalUID) * and a set of {@link When}-object for each occurrence. * * @param job the {@link Job} to create triggers for * @param event the {@link CalendarEventEntry} to read the {@link When}-objects * from * @param modifiedByEvent defines the name of an event which modifies the * schedule of the new Trigger * @param isStartEvent indicator to identify whether this trigger will be * triggering a start or an end command. * * @throws SchedulerException if there is an internal Scheduler error. */ protected boolean createTriggerAndSchedule(JobDetail job, Event event, String modifiedByEvent, boolean isStartEvent) { boolean triggersCreated = false; if (job == null) { logger.debug("job is null -> no triggers are created"); return false; } String jobIdentity = event.getICalUID() + (isStartEvent ? "_start" : "_end"); EventDateTime date = isStartEvent ? event.getStart() : event.getEnd(); long dateValue = date.getDateTime().getValue(); /* * TODO: TEE: do only create a new trigger when the start/endtime * lies in the future. This exclusion is necessary because the SimpleTrigger * triggers a job even if the startTime lies in the past. If somebody * knows the way to let quartz ignore such triggers this exclusion * can be omitted. */ if (dateValue >= (new Date()).getTime()) { Trigger trigger; if (StringUtils.isBlank(modifiedByEvent)) { trigger = newTrigger().forJob(job) .withIdentity(jobIdentity + "_" + dateValue + "_trigger", GCAL_SCHEDULER_GROUP) .startAt(new Date(dateValue)).build(); } else { trigger = newTrigger().forJob(job) .withIdentity(jobIdentity + "_" + dateValue + "_trigger", GCAL_SCHEDULER_GROUP) .startAt(new Date(dateValue)).modifiedByCalendar(modifiedByEvent).build(); } try { scheduler.scheduleJob(job, trigger); triggersCreated = true; } catch (SchedulerException se) { logger.warn("scheduling Trigger '{}' throws an exception: {}", trigger, se); } } // } return triggersCreated; }