try {
Scheduler scheduler = getQuartzScheduler();
for ( String groupName : scheduler.getJobGroupNames() ) {
for ( String jobId : scheduler.getJobNames( groupName ) ) {
for ( Trigger trigger : scheduler.getTriggersOfJob( jobId, groupName ) ) {
Job job = new Job();
job.setGroupName( groupName );
JobDetail jobDetail = scheduler.getJobDetail( jobId, groupName );
if ( jobDetail != null ) {
job.setUserName( jobDetail.getGroup() );
JobDataMap jobDataMap = jobDetail.getJobDataMap();
if ( jobDataMap != null ) {
Map<String, Serializable> wrappedMap = jobDataMap.getWrappedMap();
job.setJobParams( wrappedMap );
}
}
job.setJobId( jobId );
setJobTrigger( scheduler, job, trigger );
job.setJobName( QuartzJobKey.parse( jobId ).getJobName() );
job.setNextRun( trigger.getNextFireTime() );
job.setLastRun( trigger.getPreviousFireTime() );
if ( ( filter == null ) || filter.accept( job ) ) {
jobs.add( job );
}
}
}