@ SuppressWarnings ( "unchecked" ) public List < io . mangoo . models . Job > getAllJobs ( ) throws MangooSchedulerException { Objects . requireNonNull ( this . quartzScheduler , Required . SCHEDULER . toString ( ) ) ; List < io . mangoo . models . Job > jobs = new ArrayList <> ( ) ; try { for ( JobKey jobKey : getAllJobKeys ( ) ) { List < Trigger > triggers = ( List < Trigger > ) this . quartzScheduler . getTriggersOfJob ( jobKey ) ; Trigger trigger = triggers . get ( 0 ) ; TriggerState triggerState = quartzScheduler . getTriggerState ( trigger . getKey ( ) ) ; boolean active = ( TriggerState . NORMAL == triggerState ) ? true : false ; jobs . add ( new io . mangoo . models . Job ( active , jobKey . getName ( ) , trigger . getDescription ( ) , trigger . getNextFireTime ( ) , trigger . getPreviousFireTime ( ) ) ) ; } } catch ( SchedulerException e ) { throw new MangooSchedulerException ( e ) ; } return jobs ; }
Retrieves a list of all jobs and their current status