Search in sources :

Example 1 with ExecuteCommandJob

use of org.openhab.io.gcal.internal.util.ExecuteCommandJob in project openhab1-addons by openhab.

the class GCalEventDownloader method createJob.

/**
     * 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;
}
Also used : JobDetail(org.quartz.JobDetail) ExecuteCommandJob(org.openhab.io.gcal.internal.util.ExecuteCommandJob)

Aggregations

ExecuteCommandJob (org.openhab.io.gcal.internal.util.ExecuteCommandJob)1 JobDetail (org.quartz.JobDetail)1