Object object = (Object) it.next();
if (!(object instanceof CompositeDataSupport)) {
continue;
}
CompositeDataSupport compositeDataSupport = (CompositeDataSupport) object;
Job job = new Job();
job.setSchedulerName(scheduler.getName());
job.setQuartzInstanceId(scheduler.getQuartzInstanceUUID());
job.setSchedulerInstanceId(scheduler.getInstanceId());
job.setJobName((String) JMXUtil.convertToType(compositeDataSupport, "name"));
log.info("job name:"+job.getJobName());
job.setDescription((String) JMXUtil.convertToType(compositeDataSupport,"description"));
job.setDurability(((Boolean) JMXUtil.convertToType(compositeDataSupport,"durability")).booleanValue());
job.setShouldRecover(((Boolean) JMXUtil.convertToType(compositeDataSupport,"shouldRecover")).booleanValue());
job.setGroup((String) JMXUtil.convertToType(compositeDataSupport, "group"));
job.setJobClass((String) JMXUtil.convertToType(compositeDataSupport, "jobClass"));
// get Next Fire Time for job
List<Trigger> triggers = this.getTriggersForJob(quartzInstance, scheduler,
job.getJobName(), job.getGroup());
if(triggers == null || triggers.size() == 0){
job.setState("NONE");
}else{
job.setState(getTriggerState(quartzInstance,scheduler,triggers.get(0)));
}
log.info("job state:"+job.getState());
try {
if (triggers != null && triggers.size() > 0) {
Date nextFireTime = QuartzUtil.getNextFireTimeForJob(triggers);
job.setNextFireTime(nextFireTime);
job.setNumTriggers(triggers.size());
}
} catch (Throwable t) {
t.printStackTrace();
}