Search in sources :

Example 1 with TriggerDescription

use of org.opennms.web.svclayer.model.TriggerDescription in project opennms by OpenNMS.

the class ManageReportScheduleController method listTriggers.

@RequestMapping(method = RequestMethod.GET)
public ModelAndView listTriggers(@RequestParam(value = "p", required = false, defaultValue = "0") int page, ModelAndView modelAndView) {
    List<TriggerDescription> reportTriggers = m_reportSchedulerService.getTriggerDescriptions();
    PagedListHolder<TriggerDescription> pagedListHolder = new PagedListHolder<>(reportTriggers);
    pagedListHolder.setPageSize(m_pageSize);
    // strip minus values
    pagedListHolder.setPage(Math.max(page, 0));
    modelAndView.addObject("pagedListHolder", pagedListHolder);
    modelAndView.addObject("command", new ManageReportScheduleCommand());
    modelAndView.setViewName("/report/database/manageSchedule");
    return modelAndView;
}
Also used : TriggerDescription(org.opennms.web.svclayer.model.TriggerDescription) ManageReportScheduleCommand(org.opennms.web.svclayer.model.ManageReportScheduleCommand) PagedListHolder(org.springframework.beans.support.PagedListHolder) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with TriggerDescription

use of org.opennms.web.svclayer.model.TriggerDescription in project opennms by OpenNMS.

the class DefaultSchedulerService method getTriggerDescriptions.

/**
 * <p>getTriggerDescriptions</p>
 *
 * @return a {@link java.util.List} object.
 */
@Override
public List<TriggerDescription> getTriggerDescriptions() {
    List<TriggerDescription> triggerDescriptions = new ArrayList<>();
    try {
        Set<TriggerKey> triggerKeys = m_scheduler.getTriggerKeys(GroupMatcher.<TriggerKey>groupEquals(m_triggerGroup));
        for (TriggerKey triggerKey : triggerKeys) {
            TriggerDescription description = new TriggerDescription();
            Trigger trigger = m_scheduler.getTrigger(triggerKey);
            description.setNextFireTime(trigger.getNextFireTime());
            description.setTriggerName(triggerKey.getName());
            description.setReportId((String) trigger.getJobDataMap().get("reportId"));
            description.setDeliveryOptions((DeliveryOptions) trigger.getJobDataMap().get("deliveryOptions"));
            description.setReportParameters(((ReportParameters) trigger.getJobDataMap().get("criteria")).getReportParms());
            triggerDescriptions.add(description);
        }
    } catch (SchedulerException e) {
        LOG.error("exception lretrieving trigger descriptions", e);
    }
    return triggerDescriptions;
}
Also used : TriggerKey(org.quartz.TriggerKey) TriggerDescription(org.opennms.web.svclayer.model.TriggerDescription) Trigger(org.quartz.Trigger) SchedulerException(org.quartz.SchedulerException) ArrayList(java.util.ArrayList)

Aggregations

TriggerDescription (org.opennms.web.svclayer.model.TriggerDescription)2 ArrayList (java.util.ArrayList)1 ManageReportScheduleCommand (org.opennms.web.svclayer.model.ManageReportScheduleCommand)1 SchedulerException (org.quartz.SchedulerException)1 Trigger (org.quartz.Trigger)1 TriggerKey (org.quartz.TriggerKey)1 PagedListHolder (org.springframework.beans.support.PagedListHolder)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1