use of org.opennms.netmgt.model.ReportCatalogEntry in project opennms by OpenNMS.
the class DefaultReportService method createReportCatalogEntry.
private void createReportCatalogEntry(JasperPrint jasperPrint, Report report, String fileName) throws ReportRunException {
ReportCatalogEntry catalogEntry = new ReportCatalogEntry();
catalogEntry.setDate(new Date());
// FIXME Is this correct ?
catalogEntry.setReportId("reportd_" + report.getReportTemplate());
catalogEntry.setTitle(report.getReportName());
catalogEntry.setLocation(fileName);
try {
m_reportCatalogDao.save(catalogEntry);
} catch (Exception e) {
throw new ReportRunException("Can't save a report catalog entry, " + e.getMessage());
}
}
use of org.opennms.netmgt.model.ReportCatalogEntry in project opennms by OpenNMS.
the class ManageDatabaseReportController method listReports.
@RequestMapping(method = RequestMethod.GET)
public ModelAndView listReports(@RequestParam(value = "p", required = false, defaultValue = "0") int page, ModelAndView modelAndView) {
List<ReportCatalogEntry> reportCatalog = reportStoreService.getAll();
Map<String, Object> formatMap = reportStoreService.getFormatMap();
PagedListHolder<ReportCatalogEntry> pagedListHolder = new PagedListHolder<>(reportCatalog);
pagedListHolder.setPageSize(m_pageSize);
// strip minus values
pagedListHolder.setPage(Math.max(page, 0));
modelAndView.addObject("formatMap", formatMap);
modelAndView.addObject("pagedListHolder", pagedListHolder);
modelAndView.addObject("command", new ManageDatabaseReportCommand());
modelAndView.setViewName("/report/database/manage");
return modelAndView;
}
use of org.opennms.netmgt.model.ReportCatalogEntry in project opennms by OpenNMS.
the class ReportCatalogDaoHibernateIT method testSave.
@Test
@Transactional
public void testSave() {
Date date = new Date();
ReportCatalogEntry catalogEntry = new ReportCatalogEntry();
catalogEntry.setReportId("reportId_1");
catalogEntry.setLocation("location_1");
catalogEntry.setTitle("title_1");
catalogEntry.setDate(date);
m_reportCatalogDao.save(catalogEntry);
Integer id = catalogEntry.getId();
ReportCatalogEntry retrievedEntry = m_reportCatalogDao.get(id);
assertEquals(catalogEntry.getReportId(), retrievedEntry.getReportId());
assertEquals(catalogEntry.getTitle(), retrievedEntry.getTitle());
assertEquals(catalogEntry.getLocation(), retrievedEntry.getLocation());
assertEquals(0, catalogEntry.getDate().compareTo(retrievedEntry.getDate()));
}
use of org.opennms.netmgt.model.ReportCatalogEntry in project opennms by OpenNMS.
the class ReportCatalogDaoHibernateIT method testDelete.
@Test
@Transactional
public void testDelete() {
Date date = new Date();
ReportCatalogEntry catalogEntry = new ReportCatalogEntry();
catalogEntry.setReportId("reportId_2");
catalogEntry.setLocation("location_2");
catalogEntry.setTitle("title_2");
catalogEntry.setDate(date);
m_reportCatalogDao.save(catalogEntry);
Integer id = catalogEntry.getId();
assertNotNull(m_reportCatalogDao.get(id));
m_reportCatalogDao.delete(id);
assertNull(m_reportCatalogDao.get(id));
}
use of org.opennms.netmgt.model.ReportCatalogEntry in project opennms by OpenNMS.
the class DefaultReportStoreServiceTest method testSave.
@Test
public void testSave() {
ReportCatalogEntry reportCatalogEntry = new ReportCatalogEntry();
m_reportCatalogDao.save(reportCatalogEntry);
m_reportCatalogDao.flush();
replay(m_reportCatalogDao);
m_reportStoreService.save(reportCatalogEntry);
verify(m_reportCatalogDao);
}
Aggregations