Search in sources :

Example 1 with IdmScheduledTaskTriggerType

use of eu.bcvsolutions.idm.core.scheduler.jaxb.IdmScheduledTaskTriggerType in project CzechIdMng by bcvsolutions.

the class AbstractScheduledTaskInitializer method createAndSaveTriggers.

/**
 * Create and save trigger from {@link IdmScheduledTaskType}.
 *
 * @param task
 * @param type
 */
private void createAndSaveTriggers(Task task, IdmScheduledTaskType type) {
    Assert.notNull(task);
    Assert.notNull(task.getId());
    // triggers
    if (type.getTriggers() != null && type.getTriggers().getTriggers() != null) {
        for (IdmScheduledTaskTriggerType trigger : type.getTriggers().getTriggers()) {
            AbstractTaskTrigger newTrigger = null;
            try {
                newTrigger = getTrigger(trigger);
            } catch (ClassNotFoundException e) {
                LOG.error("Trigger type: [{}], not exist. Skip init this trigger for task id: [{}]. Error message: [{}]", trigger.getType(), task.getId(), e.getMessage());
                continue;
            }
            if (newTrigger != null) {
                LOG.info("Create new trigger for task id: [{}]. Trigger type: [{}].", task.getId(), trigger.getType());
                schedulerService.createTrigger(task.getId(), newTrigger);
            }
        }
    }
}
Also used : AbstractTaskTrigger(eu.bcvsolutions.idm.core.scheduler.api.dto.AbstractTaskTrigger) IdmScheduledTaskTriggerType(eu.bcvsolutions.idm.core.scheduler.jaxb.IdmScheduledTaskTriggerType)

Aggregations

AbstractTaskTrigger (eu.bcvsolutions.idm.core.scheduler.api.dto.AbstractTaskTrigger)1 IdmScheduledTaskTriggerType (eu.bcvsolutions.idm.core.scheduler.jaxb.IdmScheduledTaskTriggerType)1