Search in sources :

Example 1 with DatabaseReportDescription

use of org.opennms.web.svclayer.model.DatabaseReportDescription in project opennms by OpenNMS.

the class ReportListController method handleRequestInternal.

/**
 * {@inheritDoc}
 */
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
    logger.debug("start: reload reporting configuration files");
    // TODO indigo: We have to solve this problem on DAO level
    synchronized (m_reportListService) {
        m_reportListService.reloadConfigurationFiles();
    }
    logger.debug("stop : reload reporting configuration files");
    Map<ReportRepositoryDescription, PagedListHolder<DatabaseReportDescription>> repositoryList = new LinkedHashMap<ReportRepositoryDescription, PagedListHolder<DatabaseReportDescription>>();
    for (ReportRepositoryDescription reportRepositoryDescription : m_reportListService.getActiveRepositories()) {
        PagedListHolder<DatabaseReportDescription> pageListholder = new PagedListHolder<DatabaseReportDescription>(m_reportListService.getReportsByRepositoryId(reportRepositoryDescription.getId()));
        pageListholder.setPageSize(m_pageSize);
        int page = ServletRequestUtils.getIntParameter(request, "p_" + reportRepositoryDescription.getId(), 0);
        pageListholder.setPage(page);
        repositoryList.put(reportRepositoryDescription, pageListholder);
    }
    return new ModelAndView("report/database/reportList", "repositoryList", repositoryList);
}
Also used : ReportRepositoryDescription(org.opennms.web.svclayer.model.ReportRepositoryDescription) DatabaseReportDescription(org.opennms.web.svclayer.model.DatabaseReportDescription) ModelAndView(org.springframework.web.servlet.ModelAndView) PagedListHolder(org.springframework.beans.support.PagedListHolder) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with DatabaseReportDescription

use of org.opennms.web.svclayer.model.DatabaseReportDescription in project opennms by OpenNMS.

the class DefaultDatabaseReportListService method getAll.

/**
 * <p>
 * getAll Reports from all Repositories
 * </p>
 *
 * @return a {@link java.util.List} object.
 */
@Deprecated
@Override
public List<DatabaseReportDescription> getAll() {
    List<DatabaseReportDescription> allReports = new ArrayList<>();
    for (ReportRepository globalRepository : m_globalReportRepository.getRepositoryList()) {
        for (BasicReportDefinition report : globalRepository.getReports()) {
            DatabaseReportDescription summary = new DatabaseReportDescription();
            summary.setRepositoryId(globalRepository.getRepositoryId());
            summary.setId(report.getId());
            summary.setDisplayName(report.getDisplayName());
            summary.setDescription(report.getDescription());
            summary.setIsOnline(report.getOnline());
            summary.setAllowAccess(report.getAllowAccess());
            allReports.add(summary);
        }
    }
    return allReports;
}
Also used : DatabaseReportDescription(org.opennms.web.svclayer.model.DatabaseReportDescription) ArrayList(java.util.ArrayList) GlobalReportRepository(org.opennms.features.reporting.repository.global.GlobalReportRepository) ReportRepository(org.opennms.features.reporting.repository.ReportRepository) BasicReportDefinition(org.opennms.features.reporting.model.basicreport.BasicReportDefinition)

Example 3 with DatabaseReportDescription

use of org.opennms.web.svclayer.model.DatabaseReportDescription in project opennms by OpenNMS.

the class DefaultDatabaseReportListService method getReportsByRepositoryId.

@Override
public List<DatabaseReportDescription> getReportsByRepositoryId(String repositoryId) {
    List<DatabaseReportDescription> reportList = new ArrayList<>();
    for (BasicReportDefinition reportDefinition : m_globalReportRepository.getRepositoryById(repositoryId).getReports()) {
        DatabaseReportDescription summary = new DatabaseReportDescription();
        summary.setRepositoryId(reportDefinition.getRepositoryId());
        summary.setId(reportDefinition.getId());
        summary.setDisplayName(reportDefinition.getDisplayName());
        summary.setDescription(reportDefinition.getDescription());
        summary.setIsOnline(reportDefinition.getOnline());
        summary.setAllowAccess(reportDefinition.getAllowAccess());
        reportList.add(summary);
    }
    return reportList;
}
Also used : DatabaseReportDescription(org.opennms.web.svclayer.model.DatabaseReportDescription) ArrayList(java.util.ArrayList) BasicReportDefinition(org.opennms.features.reporting.model.basicreport.BasicReportDefinition)

Example 4 with DatabaseReportDescription

use of org.opennms.web.svclayer.model.DatabaseReportDescription in project opennms by OpenNMS.

the class DefaultDatabaseReportListService method getAllOnline.

/**
 * <p>
 * getAll Reports from all Repositories
 * </p>
 *
 * @return a {@link java.util.List} object.
 */
@Deprecated
@Override
public List<DatabaseReportDescription> getAllOnline() {
    List<DatabaseReportDescription> onlineReports = new ArrayList<>();
    for (ReportRepository m_repo : m_globalReportRepository.getRepositoryList()) {
        for (BasicReportDefinition report : m_repo.getOnlineReports()) {
            DatabaseReportDescription summary = new DatabaseReportDescription();
            summary.setRepositoryId(m_repo.getRepositoryId());
            summary.setId(report.getId());
            summary.setDisplayName(report.getDisplayName());
            summary.setDescription(report.getDescription());
            summary.setIsOnline(report.getOnline());
            summary.setAllowAccess(report.getAllowAccess());
            onlineReports.add(summary);
        }
    }
    return onlineReports;
}
Also used : DatabaseReportDescription(org.opennms.web.svclayer.model.DatabaseReportDescription) ArrayList(java.util.ArrayList) GlobalReportRepository(org.opennms.features.reporting.repository.global.GlobalReportRepository) ReportRepository(org.opennms.features.reporting.repository.ReportRepository) BasicReportDefinition(org.opennms.features.reporting.model.basicreport.BasicReportDefinition)

Example 5 with DatabaseReportDescription

use of org.opennms.web.svclayer.model.DatabaseReportDescription in project opennms by OpenNMS.

the class DefaultDatabaseReportListService method getOnlineReportsByRepositoryId.

@Override
public List<DatabaseReportDescription> getOnlineReportsByRepositoryId(String repositoryId) {
    List<DatabaseReportDescription> onlineReportList = new ArrayList<>();
    for (BasicReportDefinition reportDefinition : m_globalReportRepository.getRepositoryById(repositoryId).getOnlineReports()) {
        DatabaseReportDescription summary = new DatabaseReportDescription();
        summary.setRepositoryId(reportDefinition.getRepositoryId());
        summary.setId(reportDefinition.getId());
        summary.setDisplayName(reportDefinition.getDisplayName());
        summary.setDescription(reportDefinition.getDescription());
        summary.setIsOnline(reportDefinition.getOnline());
        summary.setAllowAccess(reportDefinition.getAllowAccess());
        onlineReportList.add(summary);
    }
    return onlineReportList;
}
Also used : DatabaseReportDescription(org.opennms.web.svclayer.model.DatabaseReportDescription) ArrayList(java.util.ArrayList) BasicReportDefinition(org.opennms.features.reporting.model.basicreport.BasicReportDefinition)

Aggregations

DatabaseReportDescription (org.opennms.web.svclayer.model.DatabaseReportDescription)5 ArrayList (java.util.ArrayList)4 BasicReportDefinition (org.opennms.features.reporting.model.basicreport.BasicReportDefinition)4 ReportRepository (org.opennms.features.reporting.repository.ReportRepository)2 GlobalReportRepository (org.opennms.features.reporting.repository.global.GlobalReportRepository)2 LinkedHashMap (java.util.LinkedHashMap)1 ReportRepositoryDescription (org.opennms.web.svclayer.model.ReportRepositoryDescription)1 PagedListHolder (org.springframework.beans.support.PagedListHolder)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1