report.addReportletConf(conf);
}
}
public ReportTO getReportTO(final Report report) {
ReportTO reportTO = new ReportTO();
reportTO.setId(report.getId());
BeanUtils.copyProperties(report, reportTO, IGNORE_REPORT_PROPERTIES);
reportTO.setReportletConfs(report.getReportletConfs());
ReportExec latestExec = reportExecDAO.findLatestStarted(report);
reportTO.setLatestExecStatus(latestExec == null
? ""
: latestExec.getStatus());
reportTO.setStartDate(latestExec == null
? null
: latestExec.getStartDate());
reportTO.setEndDate(latestExec == null
? null
: latestExec.getEndDate());
for (ReportExec reportExec : report.getExecs()) {
reportTO.addExecution(getReportExecTO(reportExec));
}
String triggerName = JobInstanceLoader.getTriggerName(JobInstanceLoader.getJobName(report));
Trigger trigger;
try {
trigger = scheduler.getScheduler().getTrigger(triggerName, Scheduler.DEFAULT_GROUP);
} catch (SchedulerException e) {
LOG.warn("While trying to get to " + triggerName, e);
trigger = null;
}
if (trigger != null) {
reportTO.setLastExec(trigger.getPreviousFireTime());
reportTO.setNextExec(trigger.getNextFireTime());
}
return reportTO;
}